Title: [278478] trunk
- Revision
- 278478
- Author
- [email protected]
- Date
- 2021-06-04 11:52:23 -0700 (Fri, 04 Jun 2021)
Log Message
REGRESSION (maybe r276882): custom properties not available on host on initial paint
https://bugs.webkit.org/show_bug.cgi?id=226574
<rdar://problem/78863643>
Reviewed by Simon Fraser.
Source/WebCore:
We fail to invalidate :host style when switching out of shared resolver after asynchronously
loading a stylesheet into a shadow tree. This happens because the resolver has been cleared and
the invalidation code just bails out if none is present.
Test case by [email protected].
Test: fast/shadow-dom/shared-resolver-host-invalidation.html
* style/StyleInvalidator.cpp:
(WebCore::Style::Invalidator::invalidateHostAndSlottedStyleIfNeeded):
Change the assumption so that if we don't have a resolver we always invalidate the host.
The alternative would be to build the resolver and do this accurately but doing that here
seems bit risky. This should be cheap and rare invalidation in any case.
LayoutTests:
* fast/shadow-dom/resources/shared-resolver-host-invalidation.css: Added.
(:host,):
(div):
* fast/shadow-dom/shared-resolver-host-invalidation-expected.html: Added.
* fast/shadow-dom/shared-resolver-host-invalidation.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (278477 => 278478)
--- trunk/LayoutTests/ChangeLog 2021-06-04 18:35:42 UTC (rev 278477)
+++ trunk/LayoutTests/ChangeLog 2021-06-04 18:52:23 UTC (rev 278478)
@@ -1,3 +1,17 @@
+2021-06-04 Antti Koivisto <[email protected]>
+
+ REGRESSION (maybe r276882): custom properties not available on host on initial paint
+ https://bugs.webkit.org/show_bug.cgi?id=226574
+ <rdar://problem/78863643>
+
+ Reviewed by Simon Fraser.
+
+ * fast/shadow-dom/resources/shared-resolver-host-invalidation.css: Added.
+ (:host,):
+ (div):
+ * fast/shadow-dom/shared-resolver-host-invalidation-expected.html: Added.
+ * fast/shadow-dom/shared-resolver-host-invalidation.html: Added.
+
2021-06-04 Alex Christensen <[email protected]>
Implement off-by-default experimental feature for PerformanceResourceTiming.transferSize, encodedBodySize, and decodedBodySize
Added: trunk/LayoutTests/fast/shadow-dom/resources/shared-resolver-host-invalidation.css (0 => 278478)
--- trunk/LayoutTests/fast/shadow-dom/resources/shared-resolver-host-invalidation.css (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/resources/shared-resolver-host-invalidation.css 2021-06-04 18:52:23 UTC (rev 278478)
@@ -0,0 +1,9 @@
+:host,
+:root {
+ --background-color: red;
+}
+
+div {
+ background-color: var(--background-color);
+ border: 1px solid black;
+}
Added: trunk/LayoutTests/fast/shadow-dom/shared-resolver-host-invalidation-expected.html (0 => 278478)
--- trunk/LayoutTests/fast/shadow-dom/shared-resolver-host-invalidation-expected.html (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/shared-resolver-host-invalidation-expected.html 2021-06-04 18:52:23 UTC (rev 278478)
@@ -0,0 +1,16 @@
+<head>
+<style>
+.app div {
+ border: 1px solid black;
+ Background-color: red;
+}
+</style>
+</head>
+<body>
+ <div class="app">
+ <div><p>I should have a red background</p></div>
+ </div>
+ <div class="app">
+ <div><p>I should have a red background</p></div>
+ </div>
+</body>
Added: trunk/LayoutTests/fast/shadow-dom/shared-resolver-host-invalidation.html (0 => 278478)
--- trunk/LayoutTests/fast/shadow-dom/shared-resolver-host-invalidation.html (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/shared-resolver-host-invalidation.html 2021-06-04 18:52:23 UTC (rev 278478)
@@ -0,0 +1,24 @@
+<head>
+</head>
+<body>
+ <div class="app"></div>
+ <!-- only one element is fine -->
+ <div class="app"></div>
+ <script>
+ const attachApp = (element) => {
+ const root = element.attachShadow({mode: "open"})
+
+ const style = document.createElement('link')
+ style.rel= 'stylesheet'
+ style.href = ''
+ root.append(style)
+
+ const div = document.createElement('div')
+ const p = document.createElement('p')
+ p.textContent = 'I should have a red background'
+ div.append(p)
+ root.append(div)
+ }
+ document.querySelectorAll('.app').forEach(attachApp)
+ </script>
+</body>
Modified: trunk/Source/WebCore/ChangeLog (278477 => 278478)
--- trunk/Source/WebCore/ChangeLog 2021-06-04 18:35:42 UTC (rev 278477)
+++ trunk/Source/WebCore/ChangeLog 2021-06-04 18:52:23 UTC (rev 278478)
@@ -1,3 +1,26 @@
+2021-06-04 Antti Koivisto <[email protected]>
+
+ REGRESSION (maybe r276882): custom properties not available on host on initial paint
+ https://bugs.webkit.org/show_bug.cgi?id=226574
+ <rdar://problem/78863643>
+
+ Reviewed by Simon Fraser.
+
+ We fail to invalidate :host style when switching out of shared resolver after asynchronously
+ loading a stylesheet into a shadow tree. This happens because the resolver has been cleared and
+ the invalidation code just bails out if none is present.
+
+ Test case by [email protected].
+
+ Test: fast/shadow-dom/shared-resolver-host-invalidation.html
+
+ * style/StyleInvalidator.cpp:
+ (WebCore::Style::Invalidator::invalidateHostAndSlottedStyleIfNeeded):
+
+ Change the assumption so that if we don't have a resolver we always invalidate the host.
+ The alternative would be to build the resolver and do this accurately but doing that here
+ seems bit risky. This should be cheap and rare invalidation in any case.
+
2021-06-04 Alex Christensen <[email protected]>
Implement off-by-default experimental feature for PerformanceResourceTiming.transferSize, encodedBodySize, and decodedBodySize
Modified: trunk/Source/WebCore/style/StyleInvalidator.cpp (278477 => 278478)
--- trunk/Source/WebCore/style/StyleInvalidator.cpp 2021-06-04 18:35:42 UTC (rev 278477)
+++ trunk/Source/WebCore/style/StyleInvalidator.cpp 2021-06-04 18:52:23 UTC (rev 278478)
@@ -387,14 +387,23 @@
{
auto& host = *shadowRoot.host();
auto* resolver = shadowRoot.styleScope().resolverIfExists();
- if (!resolver)
- return;
- auto& authorStyle = resolver->ruleSets().authorStyle();
- if (!authorStyle.hostPseudoClassRules().isEmpty())
+ auto shouldInvalidateHost = [&] {
+ if (!resolver)
+ return true;
+ return !resolver->ruleSets().authorStyle().hostPseudoClassRules().isEmpty();
+ }();
+
+ if (shouldInvalidateHost)
host.invalidateStyleInternal();
- if (!authorStyle.slottedPseudoElementRules().isEmpty()) {
+ auto shouldInvalidateHostChildren = [&] {
+ if (!resolver)
+ return true;
+ return !resolver->ruleSets().authorStyle().slottedPseudoElementRules().isEmpty();
+ }();
+
+ if (shouldInvalidateHostChildren) {
for (auto& shadowChild : childrenOfType<Element>(host))
shadowChild.invalidateStyleInternal();
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes