diff options
author | Sam Atkins <atkinssj@gmail.com> | 2021-07-24 13:28:45 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-31 00:18:11 +0200 |
commit | 8d1762ac62b78c4348bab47f9f0c42de7768d2f7 (patch) | |
tree | e09fa69786ed7de55cdf9826e11e5aee32aa9b1b /Userland/Libraries/LibWeb | |
parent | 6ea5d03f43ab9b0ef58f143a44a6fedd7c36c0e9 (diff) | |
download | serenity-8d1762ac62b78c4348bab47f9f0c42de7768d2f7.zip |
LibWeb: Fix dump_selector() handling of attribute selectors
Encountering an attribute selector was immediately ending the dump
output by mistake, and it was assigning the match types to the wrong
variable.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r-- | Userland/Libraries/LibWeb/Dump.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Userland/Libraries/LibWeb/Dump.cpp b/Userland/Libraries/LibWeb/Dump.cpp index 7cb1b4358c..4322129ed1 100644 --- a/Userland/Libraries/LibWeb/Dump.cpp +++ b/Userland/Libraries/LibWeb/Dump.cpp @@ -393,10 +393,10 @@ void dump_selector(StringBuilder& builder, CSS::Selector const& selector) builder.appendff(" pseudo_class={}", pseudo_class_description); if (pseudo_class.type == CSS::Selector::SimpleSelector::PseudoClass::Type::Not) { - builder.append("("); + builder.append("(["); for (auto& selector : pseudo_class.not_selector) dump_selector(builder, selector); - builder.append(")"); + builder.append("])"); } else if ((pseudo_class.type == CSS::Selector::SimpleSelector::PseudoClass::Type::NthChild) || (pseudo_class.type == CSS::Selector::SimpleSelector::PseudoClass::Type::NthLastChild)) { builder.appendff("(step={}, offset={})", pseudo_class.nth_child_pattern.step_size, pseudo_class.nth_child_pattern.offset); @@ -407,7 +407,7 @@ void dump_selector(StringBuilder& builder, CSS::Selector const& selector) char const* pseudo_element_description = ""; switch (simple_selector.pseudo_element) { case CSS::Selector::SimpleSelector::PseudoElement::None: - pseudo_element_description = "None"; + pseudo_element_description = "NONE"; break; case CSS::Selector::SimpleSelector::PseudoElement::Before: pseudo_element_description = "before"; @@ -431,30 +431,30 @@ void dump_selector(StringBuilder& builder, CSS::Selector const& selector) switch (simple_selector.attribute.match_type) { case CSS::Selector::SimpleSelector::Attribute::MatchType::None: + attribute_match_type_description = "NONE"; break; case CSS::Selector::SimpleSelector::Attribute::MatchType::HasAttribute: - type_description = "HasAttribute"; + attribute_match_type_description = "HasAttribute"; break; case CSS::Selector::SimpleSelector::Attribute::MatchType::ExactValueMatch: - type_description = "ExactValueMatch"; + attribute_match_type_description = "ExactValueMatch"; break; case CSS::Selector::SimpleSelector::Attribute::MatchType::ContainsWord: - type_description = "ContainsWord"; + attribute_match_type_description = "ContainsWord"; break; case CSS::Selector::SimpleSelector::Attribute::MatchType::ContainsString: - type_description = "ContainsString"; + attribute_match_type_description = "ContainsString"; break; case CSS::Selector::SimpleSelector::Attribute::MatchType::StartsWithSegment: - type_description = "StartsWithSegment"; + attribute_match_type_description = "StartsWithSegment"; break; case CSS::Selector::SimpleSelector::Attribute::MatchType::StartsWithString: - type_description = "StartsWithString"; + attribute_match_type_description = "StartsWithString"; break; case CSS::Selector::SimpleSelector::Attribute::MatchType::EndsWithString: - type_description = "EndsWithString"; + attribute_match_type_description = "EndsWithString"; break; } - break; builder.appendff(" [{}, name='{}', value='{}']", attribute_match_type_description, simple_selector.attribute.name, simple_selector.attribute.value); } |