Changeset 209065 in webkit
- Timestamp:
- Nov 29, 2016, 2:59:23 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r209062 r209065 1 2016-11-28 Antti Koivisto <antti@apple.com> 2 3 Slotted nodes ignore transition 4 https://bugs.webkit.org/show_bug.cgi?id=160866 5 <rdar://problem/29231901> 6 7 Reviewed by Sam Weinig. 8 9 * fast/shadow-dom/shadow-host-transition-expected.html: Added. 10 * fast/shadow-dom/shadow-host-transition.html: Added. 11 1 12 2016-11-28 Matt Baker <mattbaker@apple.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r209064 r209065 1 2016-11-28 Antti Koivisto <antti@apple.com> 2 3 Slotted nodes ignore transition 4 https://bugs.webkit.org/show_bug.cgi?id=160866 5 <rdar://problem/29231901> 6 7 Reviewed by Sam Weinig. 8 9 The problem is that slot (display:contents) always triggers full render tree rebuild when something 10 changes in the slotted subtree. This causes animation to jump to end (may be another bug). 11 12 Test: fast/shadow-dom/shadow-host-transition.html 13 14 * style/RenderTreeUpdater.cpp: 15 (WebCore::RenderTreeUpdater::updateElementRenderer): 16 (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement): 17 * style/StyleChange.h: 18 19 Rearrange so the strongest ('Detach') is the highest. 20 21 * style/StyleTreeResolver.cpp: 22 (WebCore::Style::TreeResolver::resolveElement): 23 (WebCore::Style::TreeResolver::createAnimatedElementUpdate): 24 25 If style was display:contents and stays that way, use 'Inherit' StyleChange which doesn't force render tree rebuild. 26 Refactor more of the functionality to createAnimatedElementUpdate. 27 28 * style/StyleTreeResolver.h: 29 1 30 2016-11-28 Carlos Garcia Campos <cgarcia@igalia.com> 2 31 -
trunk/Source/WebCore/style/RenderTreeUpdater.cpp
r208998 r209065 258 258 tearDownRenderers(element, TeardownType::KeepHoverAndActive); 259 259 260 bool hasDisplayConte st= update.style && update.style->display() == CONTENTS;261 if (hasDisplayConte st!= element.hasDisplayContents()) {262 element.setHasDisplayContents(hasDisplayConte st);260 bool hasDisplayContents = update.style && update.style->display() == CONTENTS; 261 if (hasDisplayContents != element.hasDisplayContents()) { 262 element.setHasDisplayContents(hasDisplayContents); 263 263 // Render tree position needs to be recomputed as rendering siblings may be found from the display:contents subtree. 264 264 renderTreePosition().invalidateNextSibling(); 265 265 } 266 266 267 bool shouldCreateNewRenderer = !element.renderer() && update.style && !hasDisplayConte st;267 bool shouldCreateNewRenderer = !element.renderer() && update.style && !hasDisplayContents; 268 268 if (shouldCreateNewRenderer) { 269 269 if (element.hasCustomStyleResolveCallbacks()) … … 480 480 PseudoElement* pseudoElement = pseudoId == BEFORE ? current.beforePseudoElement() : current.afterPseudoElement(); 481 481 482 auto* renderer = pseudoElement ? pseudoElement->renderer() : nullptr; 483 if (renderer) 482 if (auto* renderer = pseudoElement ? pseudoElement->renderer() : nullptr) 484 483 renderTreePosition().invalidateNextSibling(*renderer); 485 484 … … 495 494 } 496 495 496 RefPtr<PseudoElement> newPseudoElement; 497 if (!pseudoElement) { 498 newPseudoElement = PseudoElement::create(current, pseudoId); 499 pseudoElement = newPseudoElement.get(); 500 } 501 497 502 auto newStyle = RenderStyle::clonePtr(*current.renderer()->getCachedPseudoStyle(pseudoId, ¤t.renderer()->style())); 498 503 499 auto elementUpdate = Style::TreeResolver::createAnimatedElementUpdate(WTFMove(newStyle), renderer, m_document);504 auto elementUpdate = Style::TreeResolver::createAnimatedElementUpdate(WTFMove(newStyle), *pseudoElement, Style::NoChange); 500 505 501 506 if (elementUpdate.change == Style::NoChange) 502 507 return; 503 508 504 if (!pseudoElement) { 505 auto newPseudoElement = PseudoElement::create(current, pseudoId); 506 pseudoElement = newPseudoElement.ptr(); 507 InspectorInstrumentation::pseudoElementCreated(m_document.page(), newPseudoElement); 509 if (newPseudoElement) { 510 InspectorInstrumentation::pseudoElementCreated(m_document.page(), *newPseudoElement); 508 511 if (pseudoId == BEFORE) 509 current.setBeforePseudoElement( WTFMove(newPseudoElement));512 current.setBeforePseudoElement(newPseudoElement.releaseNonNull()); 510 513 else 511 current.setAfterPseudoElement( WTFMove(newPseudoElement));514 current.setAfterPseudoElement(newPseudoElement.releaseNonNull()); 512 515 } 513 516 -
trunk/Source/WebCore/style/StyleChange.h
r208668 r209065 32 32 namespace Style { 33 33 34 enum Change { NoChange, NoInherit, Inherit, Detach, Force};34 enum Change { NoChange, NoInherit, Inherit, Force, Detach }; 35 35 36 36 Change determineChange(const RenderStyle&, const RenderStyle&); -
trunk/Source/WebCore/style/StyleTreeResolver.cpp
r208971 r209065 201 201 return { }; 202 202 203 bool shouldReconstructRenderTree = element.styleValidity() >= Validity::SubtreeAndRenderersInvalid || parent().change == Detach; 204 auto* rendererToUpdate = shouldReconstructRenderTree ? nullptr : element.renderer(); 205 206 auto update = createAnimatedElementUpdate(WTFMove(newStyle), rendererToUpdate, m_document); 207 208 if (element.styleResolutionShouldRecompositeLayer()) 209 update.recompositeLayer = true; 203 auto update = createAnimatedElementUpdate(WTFMove(newStyle), element, parent().change); 210 204 211 205 auto* existingStyle = element.renderStyle(); … … 219 213 // In practice this is rare. 220 214 scope().styleResolver.invalidateMatchedPropertiesCache(); 221 update.change = Force;215 update.change = std::max(update.change, Force); 222 216 } 223 217 } … … 233 227 update.change = Detach; 234 228 } 235 236 if (update.change != Detach && (parent().change == Force || element.styleValidity() >= Validity::SubtreeInvalid))237 update.change = Force;238 229 239 230 return update; … … 254 245 } 255 246 256 ElementUpdate TreeResolver::createAnimatedElementUpdate(std::unique_ptr<RenderStyle> newStyle, RenderElement* rendererToUpdate, Document& document) 257 { 258 ElementUpdate update; 247 ElementUpdate TreeResolver::createAnimatedElementUpdate(std::unique_ptr<RenderStyle> newStyle, Element& element, Change parentChange) 248 { 249 auto validity = element.styleValidity(); 250 bool recompositeLayer = element.styleResolutionShouldRecompositeLayer(); 251 252 auto makeUpdate = [&] (std::unique_ptr<RenderStyle> style, Change change) { 253 if (validity >= Validity::SubtreeInvalid) 254 change = std::max(change, validity == Validity::SubtreeAndRenderersInvalid ? Detach : Force); 255 if (parentChange >= Force) 256 change = std::max(change, parentChange); 257 return ElementUpdate { WTFMove(style), change, recompositeLayer }; 258 }; 259 260 auto* renderer = element.renderer(); 261 262 bool shouldReconstruct = validity >= Validity::SubtreeAndRenderersInvalid || parentChange == Detach; 263 if (shouldReconstruct) 264 return makeUpdate(WTFMove(newStyle), Detach); 265 266 if (!renderer) { 267 auto keepsDisplayContents = newStyle->display() == CONTENTS && element.hasDisplayContents(); 268 // Some inherited property might have changed. 269 return makeUpdate(WTFMove(newStyle), keepsDisplayContents ? Inherit : Detach); 270 } 259 271 260 272 std::unique_ptr<RenderStyle> animatedStyle; 261 if ( rendererToUpdate && document.frame()->animation().updateAnimations(*rendererToUpdate, *newStyle, animatedStyle))262 update.recompositeLayer = true;273 if (element.document().frame()->animation().updateAnimations(*renderer, *newStyle, animatedStyle)) 274 recompositeLayer = true; 263 275 264 276 if (animatedStyle) { 265 update.change = determineChange(rendererToUpdate->style(), *animatedStyle);277 auto change = determineChange(renderer->style(), *animatedStyle); 266 278 // If animation forces render tree reconstruction pass the original style. The animation will be applied on renderer construction. 267 279 // FIXME: We should always use the animated style here. 268 update.style = update.change == Detach ? WTFMove(newStyle) : WTFMove(animatedStyle); 269 } else { 270 update.change = rendererToUpdate ? determineChange(rendererToUpdate->style(), *newStyle) : Detach; 271 update.style = WTFMove(newStyle); 272 } 273 274 return update; 280 auto style = change == Detach ? WTFMove(newStyle) : WTFMove(animatedStyle); 281 return makeUpdate(WTFMove(style), change); 282 } 283 284 auto change = determineChange(renderer->style(), *newStyle); 285 return makeUpdate(WTFMove(newStyle), change); 275 286 } 276 287 -
trunk/Source/WebCore/style/StyleTreeResolver.h
r208743 r209065 33 33 #include "StyleSharingResolver.h" 34 34 #include "StyleUpdate.h" 35 #include "StyleValidity.h" 35 36 #include <wtf/Function.h> 36 37 #include <wtf/RefPtr.h> … … 54 55 std::unique_ptr<Update> resolve(Change); 55 56 56 static ElementUpdate createAnimatedElementUpdate(std::unique_ptr<RenderStyle>, RenderElement* existingRenderer, Document&);57 static ElementUpdate createAnimatedElementUpdate(std::unique_ptr<RenderStyle>, Element&, Change parentChange); 57 58 58 59 private:
Note:
See TracChangeset
for help on using the changeset viewer.