diff options
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Selector.cpp | 10 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Selector.h | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp | 16 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/SelectorEngine.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Dump.cpp | 58 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Dump.h | 24 |
6 files changed, 57 insertions, 57 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Selector.cpp b/Userland/Libraries/LibWeb/CSS/Selector.cpp index 1ddd9de306..896534daf4 100644 --- a/Userland/Libraries/LibWeb/CSS/Selector.cpp +++ b/Userland/Libraries/LibWeb/CSS/Selector.cpp @@ -47,7 +47,7 @@ u32 Selector::specificity() const return ids * 0x10000 + classes * 0x100 + tag_names; } -Selector::SimpleSelector::NthChildPattern Selector::SimpleSelector::NthChildPattern::parse(const StringView& args) +Selector::SimpleSelector::NthChildPattern Selector::SimpleSelector::NthChildPattern::parse(StringView const& args) { CSS::Selector::SimpleSelector::NthChildPattern pattern; if (args.equals_ignoring_case("odd")) { @@ -56,7 +56,7 @@ Selector::SimpleSelector::NthChildPattern Selector::SimpleSelector::NthChildPatt } else if (args.equals_ignoring_case("even")) { pattern.step_size = 2; } else { - const auto consume_int = [](GenericLexer& lexer) -> Optional<int> { + auto const consume_int = [](GenericLexer& lexer) -> Optional<int> { return AK::StringUtils::convert_to_int(lexer.consume_while([](char c) -> bool { return isdigit(c) || c == '+' || c == '-'; })); @@ -81,7 +81,7 @@ Selector::SimpleSelector::NthChildPattern Selector::SimpleSelector::NthChildPatt step_size_or_offset = -1; lexer.retreat(); } else { - const auto value = consume_int(lexer); + auto const value = consume_int(lexer); if (!value.has_value()) return {}; step_size_or_offset = value.value(); @@ -90,12 +90,12 @@ Selector::SimpleSelector::NthChildPattern Selector::SimpleSelector::NthChildPatt if (lexer.consume_specific("n")) { lexer.ignore_while(isspace); if (lexer.next_is('+') || lexer.next_is('-')) { - const auto sign = lexer.next_is('+') ? 1 : -1; + auto const sign = lexer.next_is('+') ? 1 : -1; lexer.ignore(); lexer.ignore_while(isspace); // "An+B" pattern - const auto offset = consume_int(lexer); + auto const offset = consume_int(lexer); if (!offset.has_value()) return {}; pattern.step_size = step_size_or_offset; diff --git a/Userland/Libraries/LibWeb/CSS/Selector.h b/Userland/Libraries/LibWeb/CSS/Selector.h index 2e724307f9..7bed123dd0 100644 --- a/Userland/Libraries/LibWeb/CSS/Selector.h +++ b/Userland/Libraries/LibWeb/CSS/Selector.h @@ -75,7 +75,7 @@ public: int step_size = 0; int offset = 0; - static NthChildPattern parse(const StringView& args); + static NthChildPattern parse(StringView const& args); }; // FIXME: We don't need this field on every single SimpleSelector, but it's also annoying to malloc it somewhere. @@ -103,7 +103,7 @@ public: explicit Selector(Vector<ComplexSelector>&&); ~Selector(); - const Vector<ComplexSelector>& complex_selectors() const { return m_complex_selectors; } + Vector<ComplexSelector> const& complex_selectors() const { return m_complex_selectors; } u32 specificity() const; diff --git a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp index 141e426adf..364a405959 100644 --- a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp +++ b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp @@ -14,7 +14,7 @@ namespace Web::SelectorEngine { -static bool matches_hover_pseudo_class(const DOM::Element& element) +static bool matches_hover_pseudo_class(DOM::Element const& element) { auto* hovered_node = element.document().hovered_node(); if (!hovered_node) @@ -24,7 +24,7 @@ static bool matches_hover_pseudo_class(const DOM::Element& element) return element.is_ancestor_of(*hovered_node); } -static bool matches(const CSS::Selector::SimpleSelector& component, const DOM::Element& element) +static bool matches(CSS::Selector::SimpleSelector const& component, DOM::Element const& element) { switch (component.pseudo_element) { case CSS::Selector::SimpleSelector::PseudoElement::None: @@ -119,12 +119,12 @@ static bool matches(const CSS::Selector::SimpleSelector& component, const DOM::E } case CSS::Selector::SimpleSelector::PseudoClass::NthChild: case CSS::Selector::SimpleSelector::PseudoClass::NthLastChild: - const auto step_size = component.nth_child_pattern.step_size; - const auto offset = component.nth_child_pattern.offset; + auto const step_size = component.nth_child_pattern.step_size; + auto const offset = component.nth_child_pattern.offset; if (step_size == 0 && offset == 0) return false; // "If both a and b are equal to zero, the pseudo-class represents no element in the document tree." - const auto* parent = element.parent_element(); + auto const* parent = element.parent_element(); if (!parent) return false; @@ -152,7 +152,7 @@ static bool matches(const CSS::Selector::SimpleSelector& component, const DOM::E } // Like "a % b", but handles negative integers correctly. - const auto canonical_modulo = [](int a, int b) -> int { + auto const canonical_modulo = [](int a, int b) -> int { int c = a % b; if ((c < 0 && b > 0) || (c > 0 && b < 0)) { c += b; @@ -218,7 +218,7 @@ static bool matches(const CSS::Selector::SimpleSelector& component, const DOM::E } } -static bool matches(const CSS::Selector& selector, int component_list_index, const DOM::Element& element) +static bool matches(CSS::Selector const& selector, int component_list_index, DOM::Element const& element) { auto& component_list = selector.complex_selectors()[component_list_index]; for (auto& component : component_list.compound_selector) { @@ -260,7 +260,7 @@ static bool matches(const CSS::Selector& selector, int component_list_index, con VERIFY_NOT_REACHED(); } -bool matches(const CSS::Selector& selector, const DOM::Element& element) +bool matches(CSS::Selector const& selector, DOM::Element const& element) { VERIFY(!selector.complex_selectors().is_empty()); return matches(selector, selector.complex_selectors().size() - 1, element); diff --git a/Userland/Libraries/LibWeb/CSS/SelectorEngine.h b/Userland/Libraries/LibWeb/CSS/SelectorEngine.h index 1035fb6dc2..42e13855a5 100644 --- a/Userland/Libraries/LibWeb/CSS/SelectorEngine.h +++ b/Userland/Libraries/LibWeb/CSS/SelectorEngine.h @@ -11,6 +11,6 @@ namespace Web::SelectorEngine { -bool matches(const CSS::Selector&, const DOM::Element&); +bool matches(CSS::Selector const&, DOM::Element const&); } diff --git a/Userland/Libraries/LibWeb/Dump.cpp b/Userland/Libraries/LibWeb/Dump.cpp index 99b6217cb0..eeaf525dd4 100644 --- a/Userland/Libraries/LibWeb/Dump.cpp +++ b/Userland/Libraries/LibWeb/Dump.cpp @@ -27,14 +27,14 @@ namespace Web { -void dump_tree(const DOM::Node& node) +void dump_tree(DOM::Node const& node) { StringBuilder builder; dump_tree(builder, node); dbgln("{}", builder.string_view()); } -void dump_tree(StringBuilder& builder, const DOM::Node& node) +void dump_tree(StringBuilder& builder, DOM::Node const& node) { static int indent = 0; for (int i = 0; i < indent; ++i) @@ -56,7 +56,7 @@ void dump_tree(StringBuilder& builder, const DOM::Node& node) } if (is<DOM::ParentNode>(node)) { if (!is<HTML::HTMLTemplateElement>(node)) { - static_cast<const DOM::ParentNode&>(node).for_each_child([](auto& child) { + static_cast<DOM::ParentNode const&>(node).for_each_child([](auto& child) { dump_tree(child); }); } else { @@ -67,14 +67,14 @@ void dump_tree(StringBuilder& builder, const DOM::Node& node) --indent; } -void dump_tree(const Layout::Node& layout_node, bool show_box_model, bool show_specified_style) +void dump_tree(Layout::Node const& layout_node, bool show_box_model, bool show_specified_style) { StringBuilder builder; dump_tree(builder, layout_node, show_box_model, show_specified_style, true); dbgln("{}", builder.string_view()); } -void dump_tree(StringBuilder& builder, const Layout::Node& layout_node, bool show_box_model, bool show_specified_style, bool interactive) +void dump_tree(StringBuilder& builder, Layout::Node const& layout_node, bool show_box_model, bool show_specified_style, bool interactive) { static size_t indent = 0; for (size_t i = 0; i < indent; ++i) @@ -104,15 +104,15 @@ void dump_tree(StringBuilder& builder, const Layout::Node& layout_node, bool sho identifier = builder.to_string(); } - const char* nonbox_color_on = ""; - const char* box_color_on = ""; - const char* positioned_color_on = ""; - const char* floating_color_on = ""; - const char* inline_block_color_on = ""; - const char* line_box_color_on = ""; - const char* fragment_color_on = ""; - const char* flex_color_on = ""; - const char* color_off = ""; + char const* nonbox_color_on = ""; + char const* box_color_on = ""; + char const* positioned_color_on = ""; + char const* floating_color_on = ""; + char const* inline_block_color_on = ""; + char const* line_box_color_on = ""; + char const* fragment_color_on = ""; + char const* flex_color_on = ""; + char const* color_off = ""; if (interactive) { nonbox_color_on = "\033[33m"; @@ -194,8 +194,8 @@ void dump_tree(StringBuilder& builder, const Layout::Node& layout_node, bool sho builder.append("\n"); } - if (is<Layout::BlockBox>(layout_node) && static_cast<const Layout::BlockBox&>(layout_node).children_are_inline()) { - auto& block = static_cast<const Layout::BlockBox&>(layout_node); + if (is<Layout::BlockBox>(layout_node) && static_cast<Layout::BlockBox const&>(layout_node).children_are_inline()) { + auto& block = static_cast<Layout::BlockBox const&>(layout_node); for (size_t line_box_index = 0; line_box_index < block.line_boxes().size(); ++line_box_index) { auto& line_box = block.line_boxes()[line_box_index]; for (size_t i = 0; i < indent; ++i) @@ -223,7 +223,7 @@ void dump_tree(StringBuilder& builder, const Layout::Node& layout_node, bool sho if (is<Layout::TextNode>(fragment.layout_node())) { for (size_t i = 0; i < indent; ++i) builder.append(" "); - auto& layout_text = static_cast<const Layout::TextNode&>(fragment.layout_node()); + auto& layout_text = static_cast<Layout::TextNode const&>(fragment.layout_node()); auto fragment_text = layout_text.text_for_rendering().substring(fragment.start(), fragment.length()); builder.appendff(" \"{}\"\n", fragment_text); } @@ -256,21 +256,21 @@ void dump_tree(StringBuilder& builder, const Layout::Node& layout_node, bool sho --indent; } -void dump_selector(const CSS::Selector& selector) +void dump_selector(CSS::Selector const& selector) { StringBuilder builder; dump_selector(builder, selector); dbgln("{}", builder.string_view()); } -void dump_selector(StringBuilder& builder, const CSS::Selector& selector) +void dump_selector(StringBuilder& builder, CSS::Selector const& selector) { builder.append(" CSS::Selector:\n"); for (auto& complex_selector : selector.complex_selectors()) { builder.append(" "); - const char* relation_description = ""; + char const* relation_description = ""; switch (complex_selector.relation) { case CSS::Selector::ComplexSelector::Relation::None: relation_description = "None"; @@ -297,7 +297,7 @@ void dump_selector(StringBuilder& builder, const CSS::Selector& selector) for (size_t i = 0; i < complex_selector.compound_selector.size(); ++i) { auto& simple_selector = complex_selector.compound_selector[i]; - const char* type_description = "Unknown"; + char const* type_description = "Unknown"; switch (simple_selector.type) { case CSS::Selector::SimpleSelector::Type::Invalid: type_description = "Invalid"; @@ -342,7 +342,7 @@ void dump_selector(StringBuilder& builder, const CSS::Selector& selector) break; } - const char* pseudo_class_description = ""; + char const* pseudo_class_description = ""; switch (simple_selector.pseudo_class) { case CSS::Selector::SimpleSelector::PseudoClass::Link: pseudo_class_description = "Link"; @@ -417,34 +417,34 @@ void dump_selector(StringBuilder& builder, const CSS::Selector& selector) } } -void dump_rule(const CSS::CSSRule& rule) +void dump_rule(CSS::CSSRule const& rule) { StringBuilder builder; dump_rule(builder, rule); dbgln("{}", builder.string_view()); } -void dump_rule(StringBuilder& builder, const CSS::CSSRule& rule) +void dump_rule(StringBuilder& builder, CSS::CSSRule const& rule) { builder.appendff("{}:\n", rule.class_name()); switch (rule.type()) { case CSS::CSSRule::Type::Style: - dump_style_rule(builder, verify_cast<const CSS::CSSStyleRule>(rule)); + dump_style_rule(builder, verify_cast<CSS::CSSStyleRule const>(rule)); break; case CSS::CSSRule::Type::Import: - dump_import_rule(builder, verify_cast<const CSS::CSSImportRule>(rule)); + dump_import_rule(builder, verify_cast<CSS::CSSImportRule const>(rule)); break; default: VERIFY_NOT_REACHED(); } } -void dump_import_rule(StringBuilder& builder, const CSS::CSSImportRule& rule) +void dump_import_rule(StringBuilder& builder, CSS::CSSImportRule const& rule) { builder.appendff(" Document URL: {}\n", rule.url()); } -void dump_style_rule(StringBuilder& builder, const CSS::CSSStyleRule& rule) +void dump_style_rule(StringBuilder& builder, CSS::CSSStyleRule const& rule) { for (auto& selector : rule.selectors()) { dump_selector(builder, selector); @@ -455,7 +455,7 @@ void dump_style_rule(StringBuilder& builder, const CSS::CSSStyleRule& rule) } } -void dump_sheet(const CSS::StyleSheet& sheet) +void dump_sheet(CSS::StyleSheet const& sheet) { StringBuilder builder; dump_sheet(builder, sheet); diff --git a/Userland/Libraries/LibWeb/Dump.h b/Userland/Libraries/LibWeb/Dump.h index 96dc34bacc..32827c8266 100644 --- a/Userland/Libraries/LibWeb/Dump.h +++ b/Userland/Libraries/LibWeb/Dump.h @@ -12,17 +12,17 @@ namespace Web { -void dump_tree(StringBuilder&, const DOM::Node&); -void dump_tree(const DOM::Node&); -void dump_tree(StringBuilder&, const Layout::Node&, bool show_box_model = false, bool show_specified_style = false, bool colorize = false); -void dump_tree(const Layout::Node&, bool show_box_model = false, bool show_specified_style = false); -void dump_sheet(StringBuilder&, const CSS::StyleSheet&); -void dump_sheet(const CSS::StyleSheet&); -void dump_rule(StringBuilder&, const CSS::CSSRule&); -void dump_rule(const CSS::CSSRule&); -void dump_style_rule(StringBuilder&, const CSS::CSSStyleRule&); -void dump_import_rule(StringBuilder&, const CSS::CSSImportRule&); -void dump_selector(StringBuilder&, const CSS::Selector&); -void dump_selector(const CSS::Selector&); +void dump_tree(StringBuilder&, DOM::Node const&); +void dump_tree(DOM::Node const&); +void dump_tree(StringBuilder&, Layout::Node const&, bool show_box_model = false, bool show_specified_style = false, bool colorize = false); +void dump_tree(Layout::Node const&, bool show_box_model = false, bool show_specified_style = false); +void dump_sheet(StringBuilder&, CSS::StyleSheet const&); +void dump_sheet(CSS::StyleSheet const&); +void dump_rule(StringBuilder&, CSS::CSSRule const&); +void dump_rule(CSS::CSSRule const&); +void dump_style_rule(StringBuilder&, CSS::CSSStyleRule const&); +void dump_import_rule(StringBuilder&, CSS::CSSImportRule const&); +void dump_selector(StringBuilder&, CSS::Selector const&); +void dump_selector(CSS::Selector const&); } |