summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp6
-rw-r--r--Userland/Libraries/LibWeb/CSS/Selector.h3
-rw-r--r--Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp18
-rw-r--r--Userland/Libraries/LibWeb/Dump.cpp9
4 files changed, 36 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp
index 9706850d6e..c0c57a79eb 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp
@@ -573,6 +573,12 @@ public:
simple_selector.pseudo_element = CSS::Selector::SimpleSelector::PseudoElement::Before;
} else if (pseudo_name.equals_ignoring_case("after")) {
simple_selector.pseudo_element = CSS::Selector::SimpleSelector::PseudoElement::After;
+ } else if (pseudo_name.equals_ignoring_case("disabled")) {
+ simple_selector.pseudo_class = CSS::Selector::SimpleSelector::PseudoClass::Disabled;
+ } else if (pseudo_name.equals_ignoring_case("enabled")) {
+ 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 {
dbgln("Unknown pseudo class: '{}'", pseudo_name);
return {};
diff --git a/Userland/Libraries/LibWeb/CSS/Selector.h b/Userland/Libraries/LibWeb/CSS/Selector.h
index 7a132fde25..9e7036a98a 100644
--- a/Userland/Libraries/LibWeb/CSS/Selector.h
+++ b/Userland/Libraries/LibWeb/CSS/Selector.h
@@ -38,6 +38,9 @@ public:
LastOfType,
NthChild,
NthLastChild,
+ Disabled,
+ Enabled,
+ Checked,
};
PseudoClass pseudo_class { PseudoClass::None };
diff --git a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp
index 6807f40eae..44b7a48dba 100644
--- a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp
+++ b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp
@@ -82,6 +82,24 @@ static bool matches(const CSS::Selector::SimpleSelector& component, const DOM::E
return false;
}
break;
+ case CSS::Selector::SimpleSelector::PseudoClass::Disabled:
+ if (!element.tag_name().equals_ignoring_case(HTML::TagNames::input))
+ return false;
+ if (!element.has_attribute("disabled"))
+ return false;
+ break;
+ case CSS::Selector::SimpleSelector::PseudoClass::Enabled:
+ if (!element.tag_name().equals_ignoring_case(HTML::TagNames::input))
+ return false;
+ if (element.has_attribute("disabled"))
+ return false;
+ break;
+ case CSS::Selector::SimpleSelector::PseudoClass::Checked:
+ if (!element.tag_name().equals_ignoring_case(HTML::TagNames::input))
+ return false;
+ if (!element.has_attribute("checked"))
+ return false;
+ break;
case CSS::Selector::SimpleSelector::PseudoClass::NthChild:
case CSS::Selector::SimpleSelector::PseudoClass::NthLastChild:
const auto step_size = component.nth_child_pattern.step_size;
diff --git a/Userland/Libraries/LibWeb/Dump.cpp b/Userland/Libraries/LibWeb/Dump.cpp
index 3a1868d8b2..9bc10bd479 100644
--- a/Userland/Libraries/LibWeb/Dump.cpp
+++ b/Userland/Libraries/LibWeb/Dump.cpp
@@ -375,6 +375,15 @@ void dump_selector(StringBuilder& builder, const CSS::Selector& selector)
case CSS::Selector::SimpleSelector::PseudoClass::OnlyChild:
pseudo_class_description = "OnlyChild";
break;
+ case CSS::Selector::SimpleSelector::PseudoClass::Disabled:
+ pseudo_class_description = "Disabled";
+ break;
+ case CSS::Selector::SimpleSelector::PseudoClass::Enabled:
+ pseudo_class_description = "Enabled";
+ break;
+ case CSS::Selector::SimpleSelector::PseudoClass::Checked:
+ pseudo_class_description = "Checked";
+ break;
}
builder.appendff("{}:{}", type_description, simple_selector.value);