Skip to content

Commit 2aa6d76

Browse files
awesomeklingtcl3
authored andcommitted
LibWeb: Invalidate sheet owners after mutating cssText of its rules
This fixes one source of flakiness on WPT (of many) where we wouldn't recompute style after programmatically altering the contents of a style sheet, but instead had to wait for something else to cause invalidation.
1 parent 6db20a9 commit 2aa6d76

File tree

4 files changed

+681
-0
lines changed

4 files changed

+681
-0
lines changed

Libraries/LibWeb/CSS/CSSStyleProperties.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,6 +1158,13 @@ WebIDL::ExceptionOr<void> CSSStyleProperties::set_css_text(StringView css_text)
11581158
// 4. Update style attribute for the CSS declaration block.
11591159
update_style_attribute();
11601160

1161+
// Non-standard: Invalidate style for the owners of our containing sheet, if any.
1162+
if (auto rule = parent_rule()) {
1163+
if (auto sheet = rule->parent_style_sheet()) {
1164+
sheet->invalidate_owners(DOM::StyleInvalidationReason::CSSStylePropertiesTextChange);
1165+
}
1166+
}
1167+
11611168
return {};
11621169
}
11631170

Libraries/LibWeb/DOM/Node.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ enum class ShouldComputeRole {
5353
X(AdoptedStyleSheetsList) \
5454
X(CSSFontLoaded) \
5555
X(CSSImportRule) \
56+
X(CSSStylePropertiesTextChange) \
5657
X(CustomElementStateChange) \
5758
X(DidLoseFocus) \
5859
X(DidReceiveFocus) \
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
Harness status: OK
2+
3+
Found 197 tests
4+
5+
187 Pass
6+
10 Fail
7+
Pass accent-color
8+
Pass border-collapse
9+
Pass border-spacing
10+
Pass caption-side
11+
Pass caret-color
12+
Pass clip-rule
13+
Pass color
14+
Pass color-scheme
15+
Pass cursor
16+
Pass direction
17+
Pass fill
18+
Pass fill-opacity
19+
Pass fill-rule
20+
Pass font-family
21+
Pass font-feature-settings
22+
Pass font-language-override
23+
Pass font-size
24+
Pass font-style
25+
Pass font-variant-alternates
26+
Pass font-variant-caps
27+
Pass font-variant-east-asian
28+
Pass font-variant-emoji
29+
Pass font-variant-ligatures
30+
Pass font-variant-numeric
31+
Pass font-variant-position
32+
Pass font-variation-settings
33+
Pass font-weight
34+
Pass font-width
35+
Pass image-rendering
36+
Pass letter-spacing
37+
Pass line-height
38+
Pass list-style-position
39+
Pass list-style-type
40+
Pass math-depth
41+
Pass math-shift
42+
Pass math-style
43+
Pass pointer-events
44+
Pass quotes
45+
Pass stroke
46+
Pass stroke-dasharray
47+
Pass stroke-dashoffset
48+
Pass stroke-linecap
49+
Pass stroke-linejoin
50+
Pass stroke-miterlimit
51+
Pass stroke-opacity
52+
Pass stroke-width
53+
Pass tab-size
54+
Pass text-align
55+
Pass text-anchor
56+
Pass text-decoration-line
57+
Pass text-indent
58+
Pass text-justify
59+
Pass text-shadow
60+
Pass text-transform
61+
Pass visibility
62+
Pass white-space
63+
Pass word-break
64+
Pass word-spacing
65+
Pass word-wrap
66+
Pass writing-mode
67+
Pass align-items
68+
Pass align-self
69+
Pass animation-delay
70+
Pass animation-direction
71+
Pass animation-duration
72+
Pass animation-fill-mode
73+
Pass animation-iteration-count
74+
Fail animation-name
75+
Pass animation-play-state
76+
Pass animation-timing-function
77+
Pass appearance
78+
Pass aspect-ratio
79+
Pass backdrop-filter
80+
Pass background-attachment
81+
Pass background-blend-mode
82+
Pass background-clip
83+
Pass background-color
84+
Pass background-origin
85+
Pass background-repeat
86+
Pass background-size
87+
Fail block-size
88+
Pass bottom
89+
Pass box-shadow
90+
Pass box-sizing
91+
Pass clear
92+
Pass clip
93+
Pass clip-path
94+
Pass column-count
95+
Pass column-gap
96+
Pass column-span
97+
Pass column-width
98+
Pass contain
99+
Pass content
100+
Pass content-visibility
101+
Pass counter-increment
102+
Pass counter-reset
103+
Pass counter-set
104+
Pass cx
105+
Pass cy
106+
Pass display
107+
Pass flex-basis
108+
Pass flex-direction
109+
Pass flex-grow
110+
Pass flex-shrink
111+
Pass flex-wrap
112+
Pass float
113+
Pass grid-auto-columns
114+
Pass grid-auto-flow
115+
Pass grid-auto-rows
116+
Pass grid-column-end
117+
Pass grid-column-start
118+
Pass grid-row-end
119+
Pass grid-row-start
120+
Pass grid-template-areas
121+
Pass grid-template-columns
122+
Pass grid-template-rows
123+
Fail height
124+
Fail inline-size
125+
Pass inset-block-end
126+
Pass inset-block-start
127+
Pass inset-inline-end
128+
Pass inset-inline-start
129+
Pass isolation
130+
Pass justify-content
131+
Pass justify-items
132+
Pass justify-self
133+
Pass left
134+
Pass margin-block-end
135+
Pass margin-block-start
136+
Pass margin-bottom
137+
Pass margin-inline-end
138+
Pass margin-inline-start
139+
Pass margin-left
140+
Pass margin-right
141+
Pass margin-top
142+
Pass mask-image
143+
Pass mask-type
144+
Fail max-block-size
145+
Pass max-height
146+
Fail max-inline-size
147+
Pass max-width
148+
Fail min-block-size
149+
Pass min-height
150+
Fail min-inline-size
151+
Pass min-width
152+
Pass mix-blend-mode
153+
Pass object-fit
154+
Pass object-position
155+
Pass opacity
156+
Pass order
157+
Pass outline-color
158+
Pass outline-offset
159+
Pass outline-style
160+
Pass outline-width
161+
Pass overflow-x
162+
Pass overflow-y
163+
Pass padding-block-end
164+
Pass padding-block-start
165+
Pass padding-bottom
166+
Pass padding-inline-end
167+
Pass padding-inline-start
168+
Pass padding-left
169+
Pass padding-right
170+
Pass padding-top
171+
Pass position
172+
Pass r
173+
Pass right
174+
Pass rotate
175+
Pass row-gap
176+
Pass rx
177+
Pass ry
178+
Pass scale
179+
Pass scrollbar-gutter
180+
Pass scrollbar-width
181+
Pass stop-color
182+
Pass stop-opacity
183+
Pass table-layout
184+
Pass text-decoration-color
185+
Pass text-decoration-style
186+
Pass text-decoration-thickness
187+
Pass text-overflow
188+
Pass top
189+
Fail transform
190+
Pass transform-box
191+
Pass transition-delay
192+
Pass transition-duration
193+
Pass transition-property
194+
Pass transition-timing-function
195+
Pass translate
196+
Pass unicode-bidi
197+
Pass user-select
198+
Pass vertical-align
199+
Pass view-transition-name
200+
Fail width
201+
Pass x
202+
Pass y
203+
Pass z-index

0 commit comments

Comments
 (0)