瀏覽代碼

LibWeb: Make getComputedStyle(e).getPropertyValue() see custom props

A lot of WPT tests rely on this mechanism to test unrelated things.
Andreas Kling 7 月之前
父節點
當前提交
6dc61f895d

+ 3 - 3
Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp

@@ -601,10 +601,10 @@ Optional<StyleProperty> ResolvedCSSStyleDeclaration::property(PropertyID propert
     };
     };
 }
 }
 
 
-Optional<StyleProperty> ResolvedCSSStyleDeclaration::custom_property(FlyString const&) const
+Optional<StyleProperty> ResolvedCSSStyleDeclaration::custom_property(FlyString const& name) const
 {
 {
-    dbgln("FIXME: ResolvedCSSStyleDeclaration::custom_property is not implemented");
-    return {};
+    const_cast<DOM::Document&>(m_element->document()).update_style();
+    return m_element->custom_properties(m_pseudo_element).get(name);
 }
 }
 
 
 static WebIDL::ExceptionOr<void> cannot_modify_computed_property_error(JS::Realm& realm)
 static WebIDL::ExceptionOr<void> cannot_modify_computed_property_error(JS::Realm& realm)

+ 2 - 2
Tests/LibWeb/Text/expected/wpt-import/css/css-display/display-contents-focusable-001.txt

@@ -6,6 +6,6 @@ Rerun
 
 
 Found 1 tests
 Found 1 tests
 
 
-1 Fail
+1 Pass
 Details
 Details
-Result	Test Name	MessageFail	element with display:contents is focusable	
+Result	Test Name	MessagePass	element with display:contents is focusable	

+ 11 - 12
Tests/LibWeb/Text/expected/wpt-import/css/css-nesting/nested-declarations-matching.txt

@@ -6,17 +6,16 @@ Rerun
 
 
 Found 11 tests
 Found 11 tests
 
 
-1 Pass
-10 Fail
+11 Pass
 Details
 Details
-Result	Test Name	MessageFail	Trailing declarations apply after any preceding rules	
-Fail	Trailing declarations apply after any preceding rules (no leading)	
-Fail	Trailing declarations apply after any preceding rules (multiple)	
-Fail	Nested declarations rule has same specificity as outer selector	
-Fail	Nested declarations rule has top-level specificity behavior	
-Fail	Nested declarations rule has top-level specificity behavior (max matching)	
-Fail	Bare declartaion in nested grouping rule can match pseudo-element	
-Fail	Nested group rules have top-level specificity behavior	
-Fail	Nested @scope rules behave like :where(:scope)	
-Fail	Nested @scope rules behave like :where(:scope) (trailing)	
+Result	Test Name	MessagePass	Trailing declarations apply after any preceding rules	
+Pass	Trailing declarations apply after any preceding rules (no leading)	
+Pass	Trailing declarations apply after any preceding rules (multiple)	
+Pass	Nested declarations rule has same specificity as outer selector	
+Pass	Nested declarations rule has top-level specificity behavior	
+Pass	Nested declarations rule has top-level specificity behavior (max matching)	
+Pass	Bare declartaion in nested grouping rule can match pseudo-element	
+Pass	Nested group rules have top-level specificity behavior	
+Pass	Nested @scope rules behave like :where(:scope)	
+Pass	Nested @scope rules behave like :where(:scope) (trailing)	
 Pass	Nested declarations rule responds to parent selector text change	
 Pass	Nested declarations rule responds to parent selector text change	

+ 9 - 9
Tests/LibWeb/Text/expected/wpt-import/css/selectors/has-specificity.txt

@@ -6,13 +6,13 @@ Rerun
 
 
 Found 8 tests
 Found 8 tests
 
 
-8 Fail
+8 Pass
 Details
 Details
-Result	Test Name	MessageFail	:has(#foo) wins over :has(.foo)	
-Fail	:has(span#foo) wins over :has(#foo)	
-Fail	:has(.bar, #foo) has same specificity as :has(#foo, .bar)	
-Fail	:has(.bar, #foo) wins over :has(.foo, .bar)	
-Fail	:has(span + span) wins over :has(span)	
-Fail	:has(span, li, p) wins over :has(span, lo, p)	
-Fail	latter .baz wins over :has(.foo)	
-Fail	latter :has(.foo) wins over .baz	
+Result	Test Name	MessagePass	:has(#foo) wins over :has(.foo)	
+Pass	:has(span#foo) wins over :has(#foo)	
+Pass	:has(.bar, #foo) has same specificity as :has(#foo, .bar)	
+Pass	:has(.bar, #foo) wins over :has(.foo, .bar)	
+Pass	:has(span + span) wins over :has(span)	
+Pass	:has(span, li, p) wins over :has(span, lo, p)	
+Pass	latter .baz wins over :has(.foo)	
+Pass	latter :has(.foo) wins over .baz	

+ 2 - 2
Tests/LibWeb/Text/expected/wpt-import/css/selectors/hash-collision.txt

@@ -6,6 +6,6 @@ Rerun
 
 
 Found 1 tests
 Found 1 tests
 
 
-1 Fail
+1 Pass
 Details
 Details
-Result	Test Name	MessageFail	Test string hash collision in bucketing	
+Result	Test Name	MessagePass	Test string hash collision in bucketing	

+ 9 - 9
Tests/LibWeb/Text/expected/wpt-import/css/selectors/not-specificity.txt

@@ -6,13 +6,13 @@ Rerun
 
 
 Found 8 tests
 Found 8 tests
 
 
-8 Fail
+8 Pass
 Details
 Details
-Result	Test Name	MessageFail	:not(#foo) wins over :not(.foo)	
-Fail	:not(div#foo) wins over :not(#foo)	
-Fail	:not(.bar, #foo) has same specificity as :not(#foo, .bar)	
-Fail	:not(.bar, #foo) wins over :not(.foo, .bar)	
-Fail	:not(span + span) wins over :not(span)	
-Fail	:not(span, li, p) wins over :not(span, lo, p)	
-Fail	:not(span, :not(:not(.a#foo)), p) wins over :not(span, #foo, p)	
-Fail	:not(span, #foo, p) wins over :not(span, :where(.a#foo), p)	
+Result	Test Name	MessagePass	:not(#foo) wins over :not(.foo)	
+Pass	:not(div#foo) wins over :not(#foo)	
+Pass	:not(.bar, #foo) has same specificity as :not(#foo, .bar)	
+Pass	:not(.bar, #foo) wins over :not(.foo, .bar)	
+Pass	:not(span + span) wins over :not(span)	
+Pass	:not(span, li, p) wins over :not(span, lo, p)	
+Pass	:not(span, :not(:not(.a#foo)), p) wins over :not(span, #foo, p)	
+Pass	:not(span, #foo, p) wins over :not(span, :where(.a#foo), p)