mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibWeb: Add style invalidation for :defined selector
This commit is contained in:
parent
6c945fc353
commit
adfc69bc67
Notes:
github-actions[bot]
2024-11-06 20:44:08 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/adfc69bc674 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2204
5 changed files with 18 additions and 9 deletions
|
@ -6,6 +6,6 @@ Rerun
|
||||||
|
|
||||||
Found 1 tests
|
Found 1 tests
|
||||||
|
|
||||||
1 Fail
|
1 Pass
|
||||||
Details
|
Details
|
||||||
Result Test Name MessageFail Test :has() invalidation with :defined pseudo-class
|
Result Test Name MessagePass Test :has() invalidation with :defined pseudo-class
|
|
@ -6,6 +6,6 @@ Rerun
|
||||||
|
|
||||||
Found 1 tests
|
Found 1 tests
|
||||||
|
|
||||||
1 Fail
|
1 Pass
|
||||||
Details
|
Details
|
||||||
Result Test Name MessageFail :defined selector is effective
|
Result Test Name MessagePass :defined selector is effective
|
|
@ -2093,7 +2093,7 @@ JS::ThrowCompletionOr<void> Element::upgrade_element(JS::NonnullGCPtr<HTML::Cust
|
||||||
m_custom_element_definition = custom_element_definition;
|
m_custom_element_definition = custom_element_definition;
|
||||||
|
|
||||||
// 3. Set element's custom element state to "failed".
|
// 3. Set element's custom element state to "failed".
|
||||||
m_custom_element_state = CustomElementState::Failed;
|
set_custom_element_state(CustomElementState::Failed);
|
||||||
|
|
||||||
// 4. For each attribute in element's attribute list, in order, enqueue a custom element callback reaction with element, callback name "attributeChangedCallback",
|
// 4. For each attribute in element's attribute list, in order, enqueue a custom element callback reaction with element, callback name "attributeChangedCallback",
|
||||||
// and an argument list containing attribute's local name, null, attribute's value, and attribute's namespace.
|
// and an argument list containing attribute's local name, null, attribute's value, and attribute's namespace.
|
||||||
|
@ -2130,7 +2130,7 @@ JS::ThrowCompletionOr<void> Element::upgrade_element(JS::NonnullGCPtr<HTML::Cust
|
||||||
return JS::throw_completion(WebIDL::NotSupportedError::create(realm, "Custom element definition disables shadow DOM and the custom element has a shadow root"_string));
|
return JS::throw_completion(WebIDL::NotSupportedError::create(realm, "Custom element definition disables shadow DOM and the custom element has a shadow root"_string));
|
||||||
|
|
||||||
// 2. Set element's custom element state to "precustomized".
|
// 2. Set element's custom element state to "precustomized".
|
||||||
m_custom_element_state = CustomElementState::Precustomized;
|
set_custom_element_state(CustomElementState::Precustomized);
|
||||||
|
|
||||||
// 3. Let constructResult be the result of constructing C, with no arguments.
|
// 3. Let constructResult be the result of constructing C, with no arguments.
|
||||||
auto construct_result_optional = TRY(WebIDL::construct(constructor));
|
auto construct_result_optional = TRY(WebIDL::construct(constructor));
|
||||||
|
@ -2168,7 +2168,7 @@ JS::ThrowCompletionOr<void> Element::upgrade_element(JS::NonnullGCPtr<HTML::Cust
|
||||||
// 2. If element is disabled, then enqueue a custom element callback reaction with element, callback name "formDisabledCallback" and « true ».
|
// 2. If element is disabled, then enqueue a custom element callback reaction with element, callback name "formDisabledCallback" and « true ».
|
||||||
|
|
||||||
// 10. Set element's custom element state to "custom".
|
// 10. Set element's custom element state to "custom".
|
||||||
m_custom_element_state = CustomElementState::Custom;
|
set_custom_element_state(CustomElementState::Custom);
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -2198,11 +2198,19 @@ bool Element::is_custom() const
|
||||||
return m_custom_element_state == CustomElementState::Custom;
|
return m_custom_element_state == CustomElementState::Custom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Element::set_custom_element_state(CustomElementState state)
|
||||||
|
{
|
||||||
|
if (m_custom_element_state == state)
|
||||||
|
return;
|
||||||
|
m_custom_element_state = state;
|
||||||
|
invalidate_style(StyleInvalidationReason::CustomElementStateChange);
|
||||||
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/dom.html#html-element-constructors
|
// https://html.spec.whatwg.org/multipage/dom.html#html-element-constructors
|
||||||
void Element::setup_custom_element_from_constructor(HTML::CustomElementDefinition& custom_element_definition, Optional<String> const& is_value)
|
void Element::setup_custom_element_from_constructor(HTML::CustomElementDefinition& custom_element_definition, Optional<String> const& is_value)
|
||||||
{
|
{
|
||||||
// 7.6. Set element's custom element state to "custom".
|
// 7.6. Set element's custom element state to "custom".
|
||||||
m_custom_element_state = CustomElementState::Custom;
|
set_custom_element_state(CustomElementState::Custom);
|
||||||
|
|
||||||
// 7.7. Set element's custom element definition to definition.
|
// 7.7. Set element's custom element definition to definition.
|
||||||
m_custom_element_definition = custom_element_definition;
|
m_custom_element_definition = custom_element_definition;
|
||||||
|
|
|
@ -369,7 +369,7 @@ public:
|
||||||
Optional<String> const& is_value() const { return m_is_value; }
|
Optional<String> const& is_value() const { return m_is_value; }
|
||||||
void set_is_value(Optional<String> const& is) { m_is_value = is; }
|
void set_is_value(Optional<String> const& is) { m_is_value = is; }
|
||||||
|
|
||||||
void set_custom_element_state(CustomElementState value) { m_custom_element_state = value; }
|
void set_custom_element_state(CustomElementState);
|
||||||
void setup_custom_element_from_constructor(HTML::CustomElementDefinition& custom_element_definition, Optional<String> const& is_value);
|
void setup_custom_element_from_constructor(HTML::CustomElementDefinition& custom_element_definition, Optional<String> const& is_value);
|
||||||
|
|
||||||
void scroll(HTML::ScrollToOptions);
|
void scroll(HTML::ScrollToOptions);
|
||||||
|
|
|
@ -62,6 +62,7 @@ enum class IsDescendant {
|
||||||
X(AdoptedStyleSheetsList) \
|
X(AdoptedStyleSheetsList) \
|
||||||
X(CSSFontLoaded) \
|
X(CSSFontLoaded) \
|
||||||
X(CSSImportRule) \
|
X(CSSImportRule) \
|
||||||
|
X(CustomElementStateChange) \
|
||||||
X(DidLoseFocus) \
|
X(DidLoseFocus) \
|
||||||
X(DidReceiveFocus) \
|
X(DidReceiveFocus) \
|
||||||
X(EditingInsertion) \
|
X(EditingInsertion) \
|
||||||
|
|
Loading…
Reference in a new issue