diff options
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Selector.h | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Dump.cpp | 3 |
3 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp index 94ee9dbaaf..8135665835 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp @@ -579,6 +579,9 @@ public: simple_selector.pseudo_class = CSS::Selector::SimpleSelector::PseudoClass::Enabled; } else if (pseudo_name.equals_ignoring_case("checked")) { simple_selector.pseudo_class = CSS::Selector::SimpleSelector::PseudoClass::Checked; + } else if (pseudo_name.starts_with("not", CaseSensitivity::CaseInsensitive)) { + simple_selector.pseudo_class = CSS::Selector::SimpleSelector::PseudoClass::Not; + simple_selector.not_selector = capture_selector_args(pseudo_name); } else { dbgln("Unknown pseudo class: '{}'", pseudo_name); return {}; diff --git a/Userland/Libraries/LibWeb/CSS/Selector.h b/Userland/Libraries/LibWeb/CSS/Selector.h index 9e7036a98a..eb648bde8c 100644 --- a/Userland/Libraries/LibWeb/CSS/Selector.h +++ b/Userland/Libraries/LibWeb/CSS/Selector.h @@ -7,6 +7,7 @@ #pragma once #include <AK/FlyString.h> +#include <AK/String.h> #include <AK/Vector.h> namespace Web::CSS { @@ -41,6 +42,7 @@ public: Disabled, Enabled, Checked, + Not, }; PseudoClass pseudo_class { PseudoClass::None }; @@ -75,6 +77,7 @@ public: // FIXME: We don't need this field on every single SimpleSelector, but it's also annoying to malloc it somewhere. // Only used when "pseudo_class" is "NthChild" or "NthLastChild". NthChildPattern nth_child_pattern; + String not_selector {}; }; struct ComplexSelector { diff --git a/Userland/Libraries/LibWeb/Dump.cpp b/Userland/Libraries/LibWeb/Dump.cpp index 9bc10bd479..5b81e10d22 100644 --- a/Userland/Libraries/LibWeb/Dump.cpp +++ b/Userland/Libraries/LibWeb/Dump.cpp @@ -384,6 +384,9 @@ void dump_selector(StringBuilder& builder, const CSS::Selector& selector) case CSS::Selector::SimpleSelector::PseudoClass::Checked: pseudo_class_description = "Checked"; break; + case CSS::Selector::SimpleSelector::PseudoClass::Not: + pseudo_class_description = "Not"; + break; } builder.appendff("{}:{}", type_description, simple_selector.value); |