Changeset 224864 in webkit
- Timestamp:
- Nov 14, 2017, 5:15:21 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r224853 r224864 1 2017-11-14 Antti Koivisto <antti@apple.com> 2 3 Media query with :host inside a custom elements doesn't get updated on window resize 4 https://bugs.webkit.org/show_bug.cgi?id=176101 5 <rdar://problem/34163850> 6 7 Reviewed by Simon Fraser. 8 9 Expand the existing test case to cover :host and ::slotted. 10 11 * fast/shadow-dom/media-query-in-shadow-style-expected.html: 12 * fast/shadow-dom/resources/media-query-in-shadow-style-frame.html: 13 1 14 2017-11-14 Ryan Haddad <ryanhaddad@apple.com> 2 15 -
trunk/LayoutTests/fast/shadow-dom/media-query-in-shadow-style-expected.html
r224535 r224864 1 <iframe src="data:text/html,< span style='color:red'>Text</span>" width=150 height=50></iframe><br>2 <iframe src="data:text/html,< span style='color:green'>Text</span>" width=300 height=50></iframe><br>3 <iframe src="data:text/html,< span style='color:red'>Text</span>" width=150 height=50></iframe><br>4 <iframe src="data:text/html,< span style='color:green'>Text</span>" width=300 height=50></iframe><br>1 <iframe src="data:text/html,<div style='color:red'>Text</div>" width=150 height=50></iframe><br> 2 <iframe src="data:text/html,<div style='color:green;background-color: lightgrey'>Text</div>" width=300 height=50></iframe><br> 3 <iframe src="data:text/html,<div style='color:red'>Text</div>" width=150 height=50></iframe><br> 4 <iframe src="data:text/html,<div style='color:green;background-color: lightgrey'>Text</div>" width=300 height=50></iframe><br> -
trunk/LayoutTests/fast/shadow-dom/resources/media-query-in-shadow-style-frame.html
r224535 r224864 1 <div id=test>< /div>1 <div id=test><span>Text</span></div> 2 2 <script> 3 3 const shadow = test.attachShadow({mode: 'open'}); … … 6 6 @media (min-width:200px) { 7 7 div { color: green } 8 :host { background-color: lightgrey } 8 9 } 9 10 @media (max-width:200px) { 10 div{ color: red }11 ::slotted(*) { color: red } 11 12 } 12 13 </style> 13 <div> Text</div>14 <div><slot></slot></div> 14 15 `; 15 16 </script> -
trunk/Source/WebCore/ChangeLog
r224863 r224864 1 2017-11-14 Antti Koivisto <antti@apple.com> 2 3 Media query with :host inside a custom elements doesn't get updated on window resize 4 https://bugs.webkit.org/show_bug.cgi?id=176101 5 <rdar://problem/34163850> 6 7 Reviewed by Simon Fraser. 8 9 If a media query containing :host or ::slotted stops applying we fail to update the style. 10 11 * style/StyleScope.cpp: 12 (WebCore::Style::invalidateHostAndSlottedStyleIfNeeded): 13 14 Factor into function. 15 16 (WebCore::Style::Scope::updateActiveStyleSheets): 17 (WebCore::Style::Scope::scheduleUpdate): 18 19 Invalidate elements that may match :host and ::slotted before clearing style resolver for full update. 20 1 21 2017-11-14 Carlos Garcia Campos <cgarcia@igalia.com> 2 22 -
trunk/Source/WebCore/style/StyleScope.cpp
r224535 r224864 447 447 } 448 448 449 static void invalidateHostAndSlottedStyleIfNeeded(ShadowRoot& shadowRoot, StyleResolver& resolver) 450 { 451 auto& host = *shadowRoot.host(); 452 if (!resolver.ruleSets().authorStyle().hostPseudoClassRules().isEmpty()) 453 host.invalidateStyle(); 454 455 if (!resolver.ruleSets().authorStyle().slottedPseudoElementRules().isEmpty()) { 456 for (auto& shadowChild : childrenOfType<Element>(host)) 457 shadowChild.invalidateStyle(); 458 } 459 } 460 449 461 void Scope::updateActiveStyleSheets(UpdateType updateType) 450 462 { … … 494 506 for (auto& shadowChild : childrenOfType<Element>(*m_shadowRoot)) 495 507 shadowChild.invalidateStyleForSubtree(); 496 if (m_shadowRoot->host()) { 497 if (!resolver().ruleSets().authorStyle().hostPseudoClassRules().isEmpty()) 498 m_shadowRoot->host()->invalidateStyle(); 499 if (!resolver().ruleSets().authorStyle().slottedPseudoElementRules().isEmpty()) { 500 for (auto& shadowChild : childrenOfType<Element>(*m_shadowRoot->host())) 501 shadowChild.invalidateStyle(); 502 } 503 } 508 invalidateHostAndSlottedStyleIfNeeded(*m_shadowRoot, resolver()); 504 509 } else 505 510 m_document.scheduleForcedStyleRecalc(); … … 586 591 void Scope::scheduleUpdate(UpdateType update) 587 592 { 588 // FIXME: The m_isUpdatingStyleResolver test is here because extension stylesheets can get us here from StyleResolver::appendAuthorStyleSheets. 589 if (update == UpdateType::ContentsOrInterpretation && !m_isUpdatingStyleResolver) 590 clearResolver(); 593 if (update == UpdateType::ContentsOrInterpretation) { 594 // :host and ::slotted rules might go away. 595 if (m_shadowRoot && m_resolver) 596 invalidateHostAndSlottedStyleIfNeeded(*m_shadowRoot, *m_resolver); 597 // FIXME: The m_isUpdatingStyleResolver test is here because extension stylesheets can get us here from StyleResolver::appendAuthorStyleSheets. 598 if (!m_isUpdatingStyleResolver) 599 clearResolver(); 600 } 591 601 592 602 if (!m_pendingUpdate || *m_pendingUpdate < update) {
Note:
See TracChangeset
for help on using the changeset viewer.