Changeset 222104 in webkit
- Timestamp:
- Sep 15, 2017 12:54:01 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r222102 r222104 1 2017-09-15 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r222040. 4 5 The LayoutTest added with this change is a flaky image failure 6 on mac-wk1 debug bots. 7 8 Reverted changeset: 9 10 "Computing animated style should not require renderers" 11 https://bugs.webkit.org/show_bug.cgi?id=171926 12 http://trac.webkit.org/changeset/222040 13 1 14 2017-09-15 Matt Baker <mattbaker@apple.com> 2 15 -
trunk/LayoutTests/transitions/transition-display-property.html
r222040 r222104 6 6 <script> 7 7 var test = document.querySelector("test"); 8 var count = 0; 9 function testUntilComplete() 10 { 11 if (test.offsetWidth == 10 || ++count == 10) 12 testRunner.notifyDone(); 13 else 14 setTimeout(testUntilComplete, 0.1); 15 } 8 16 9 17 if (window.testRunner) { 10 18 testRunner.waitUntilDone(); 11 test .ontransitionend = () => testRunner.notifyDone();19 testUntilComplete(); 12 20 } 13 21 test.offsetWidth; -
trunk/Source/WebCore/ChangeLog
r222103 r222104 1 2017-09-15 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r222040. 4 5 The LayoutTest added with this change is a flaky image failure 6 on mac-wk1 debug bots. 7 8 Reverted changeset: 9 10 "Computing animated style should not require renderers" 11 https://bugs.webkit.org/show_bug.cgi?id=171926 12 http://trac.webkit.org/changeset/222040 13 1 14 2017-09-15 Tim Horton <timothy_horton@apple.com> 2 15 -
trunk/Source/WebCore/page/animation/CSSAnimationController.cpp
r222040 r222104 638 638 } 639 639 640 AnimationUpdate CSSAnimationController::updateAnimations(Element& element, const RenderStyle& newStyle, const RenderStyle* oldStyle) 641 { 642 bool hasOrHadAnimations = (oldStyle && oldStyle->hasAnimationsOrTransitions()) || newStyle.hasAnimationsOrTransitions(); 643 if (!hasOrHadAnimations) 644 return { }; 640 bool CSSAnimationController::updateAnimations(Element& element, const RenderStyle& newStyle, std::unique_ptr<RenderStyle>& animatedStyle) 641 { 642 auto* renderer = element.renderer(); 643 auto* oldStyle = (renderer && renderer->hasInitializedStyle()) ? &renderer->style() : nullptr; 644 if ((!oldStyle || (!oldStyle->animations() && !oldStyle->transitions())) && (!newStyle.animations() && !newStyle.transitions())) 645 return false; 645 646 646 647 if (element.document().pageCacheState() != Document::NotInPageCache) 647 return { };648 return false; 648 649 649 650 // Don't run transitions when printing. 650 651 if (element.document().renderView()->printing()) 651 return { };652 return false; 652 653 653 654 // Fetch our current set of implicit animations from a hashtable. We then compare them … … 657 658 658 659 CompositeAnimation& compositeAnimation = m_data->ensureCompositeAnimation(element); 659 auto update = compositeAnimation.animate(element, oldStyle, newStyle); 660 661 auto* renderer = element.renderer(); 660 bool animationStateChanged = compositeAnimation.animate(element, oldStyle, newStyle, animatedStyle); 661 662 662 if ((renderer && renderer->parent()) || newStyle.animations() || (oldStyle && oldStyle->animations())) { 663 663 auto& frameView = *element.document().view(); … … 668 668 } 669 669 670 return update;670 return animationStateChanged; 671 671 } 672 672 -
trunk/Source/WebCore/page/animation/CSSAnimationController.h
r222040 r222104 31 31 #include "AnimationBase.h" 32 32 #include "CSSPropertyNames.h" 33 #include "RenderStyle.h"34 33 #include <wtf/Forward.h> 35 34 … … 42 41 class LayoutRect; 43 42 class RenderElement; 44 45 struct AnimationUpdate { 46 #if !COMPILER_SUPPORTS(NSDMI_FOR_AGGREGATES) 47 AnimationUpdate() = default; 48 AnimationUpdate(std::unique_ptr<RenderStyle> style, bool stateChanged) 49 : style(WTFMove(style)) 50 , stateChanged(stateChanged) 51 { } 52 #endif 53 std::unique_ptr<RenderStyle> style; 54 bool stateChanged { false }; 55 }; 43 class RenderStyle; 56 44 57 45 class CSSAnimationController { … … 62 50 63 51 void cancelAnimations(Element&); 64 AnimationUpdate updateAnimations(Element&, const RenderStyle& newStyle, const RenderStyle* oldStyle);52 bool updateAnimations(Element&, const RenderStyle& newStyle, std::unique_ptr<RenderStyle>& animatedStyle); 65 53 std::unique_ptr<RenderStyle> animatedStyleForRenderer(RenderElement&); 66 54 -
trunk/Source/WebCore/page/animation/CompositeAnimation.cpp
r222040 r222104 288 288 } 289 289 290 AnimationUpdate CompositeAnimation::animate(Element& element, const RenderStyle* currentStyle, const RenderStyle& targetStyle)290 bool CompositeAnimation::animate(Element& element, const RenderStyle* currentStyle, const RenderStyle& targetStyle, std::unique_ptr<RenderStyle>& blendedStyle) 291 291 { 292 292 // We don't do any transitions if we don't have a currentStyle (on startup). … … 298 298 bool forceStackingContext = false; 299 299 300 std::unique_ptr<RenderStyle> animatedStyle;301 302 300 if (currentStyle) { 303 301 // Now that we have transition objects ready, let them know about the new goal state. We want them … … 306 304 for (auto& transition : m_transitions.values()) { 307 305 bool didBlendStyle = false; 308 if (transition->animate(*this, targetStyle, animatedStyle, didBlendStyle))306 if (transition->animate(*this, targetStyle, blendedStyle, didBlendStyle)) 309 307 animationStateChanged = true; 310 308 … … 313 311 } 314 312 315 if ( animatedStyle && checkForStackingContext) {313 if (blendedStyle && checkForStackingContext) { 316 314 // Note that this is similar to code in StyleResolver::adjustRenderStyle() but only needs to consult 317 315 // animatable properties that can trigger stacking context. 318 if ( animatedStyle->opacity() < 1.0f319 || animatedStyle->hasTransformRelatedProperty()320 || animatedStyle->hasMask()321 || animatedStyle->clipPath()322 || animatedStyle->boxReflect()323 || animatedStyle->hasFilter()316 if (blendedStyle->opacity() < 1.0f 317 || blendedStyle->hasTransformRelatedProperty() 318 || blendedStyle->hasMask() 319 || blendedStyle->clipPath() 320 || blendedStyle->boxReflect() 321 || blendedStyle->hasFilter() 324 322 #if ENABLE(FILTERS_LEVEL_2) 325 || animatedStyle->hasBackdropFilter()323 || blendedStyle->hasBackdropFilter() 326 324 #endif 327 325 ) … … 336 334 if (keyframeAnim) { 337 335 bool didBlendStyle = false; 338 if (keyframeAnim->animate(*this, targetStyle, animatedStyle, didBlendStyle))336 if (keyframeAnim->animate(*this, targetStyle, blendedStyle, didBlendStyle)) 339 337 animationStateChanged = true; 340 338 … … 348 346 // the user agent must act as if the will-change property ([css-will-change-1]) on the element additionally 349 347 // includes all the properties animated by the animation. 350 if (forceStackingContext && animatedStyle) {351 if ( animatedStyle->hasAutoZIndex())352 animatedStyle->setZIndex(0);353 } 354 355 return { WTFMove(animatedStyle), animationStateChanged };348 if (forceStackingContext && blendedStyle) { 349 if (blendedStyle->hasAutoZIndex()) 350 blendedStyle->setZIndex(0); 351 } 352 353 return animationStateChanged; 356 354 } 357 355 -
trunk/Source/WebCore/page/animation/CompositeAnimation.h
r222040 r222104 29 29 #pragma once 30 30 31 #include "CSSAnimationController.h"32 31 #include "ImplicitAnimation.h" 33 32 #include "KeyframeAnimation.h" … … 56 55 void clearElement(); 57 56 58 AnimationUpdate animate(Element&, const RenderStyle* currentStyle, const RenderStyle& targetStyle);57 bool animate(Element&, const RenderStyle* currentStyle, const RenderStyle& targetStyle, std::unique_ptr<RenderStyle>& blendedStyle); 59 58 std::unique_ptr<RenderStyle> getAnimatedStyle() const; 60 59 bool computeExtentOfTransformAnimation(LayoutRect&) const; -
trunk/Source/WebCore/rendering/RenderElement.cpp
r222040 r222104 27 27 28 28 #include "AXObjectCache.h" 29 #include "CSSAnimationController.h" 29 30 #include "ContentData.h" 30 31 #include "CursorList.h" … … 102 103 , m_ancestorLineBoxDirty(false) 103 104 , m_hasInitializedStyle(false) 105 , m_hasInitialAnimatedStyle(false) 104 106 , m_renderInlineAlwaysCreatesLineBoxes(false) 105 107 , m_renderBoxNeedsLazyRepaint(false) … … 1103 1105 view().frameView().removeSlowRepaintObject(this); 1104 1106 1107 if (element()) 1108 animation().cancelAnimations(*element()); 1109 1105 1110 destroyLeftoverChildren(); 1106 1111 -
trunk/Source/WebCore/rendering/RenderElement.h
r222040 r222104 132 132 void setStyleInternal(RenderStyle&& style) { m_style = WTFMove(style); } 133 133 134 bool hasInitialAnimatedStyle() const { return m_hasInitialAnimatedStyle; } 135 void setHasInitialAnimatedStyle(bool b) { m_hasInitialAnimatedStyle = b; } 136 134 137 // Repaint only if our old bounds and new bounds are different. The caller may pass in newBounds and newOutlineBox if they are known. 135 138 bool repaintAfterLayoutIfNeeded(const RenderLayerModelObject* repaintContainer, const LayoutRect& oldBounds, const LayoutRect& oldOutlineBox, const LayoutRect* newBoundsPtr = nullptr, const LayoutRect* newOutlineBoxPtr = nullptr); … … 327 330 unsigned m_ancestorLineBoxDirty : 1; 328 331 unsigned m_hasInitializedStyle : 1; 332 unsigned m_hasInitialAnimatedStyle : 1; 329 333 330 334 unsigned m_renderInlineAlwaysCreatesLineBoxes : 1; -
trunk/Source/WebCore/style/RenderTreeUpdater.cpp
r222040 r222104 308 308 renderTreePosition().invalidateNextSibling(); 309 309 } 310 311 // display:none cancels animations. 312 auto teardownType = update.style->display() == NONE ? TeardownType::RendererUpdateCancelingAnimations : TeardownType::RendererUpdate; 313 tearDownRenderers(element, teardownType); 310 tearDownRenderers(element, TeardownType::KeepHoverAndActive); 314 311 } 315 312 … … 399 396 400 397 element.setRenderer(newRenderer); 398 399 auto& initialStyle = newRenderer->style(); 400 std::unique_ptr<RenderStyle> animatedStyle; 401 newRenderer->animation().updateAnimations(element, initialStyle, animatedStyle); 402 if (animatedStyle) { 403 newRenderer->setStyleInternal(WTFMove(*animatedStyle)); 404 newRenderer->setHasInitialAnimatedStyle(true); 405 } 401 406 402 407 newRenderer->initializeStyle(); … … 521 526 } 522 527 523 void RenderTreeUpdater::tearDownRenderers(Element& root)524 {525 tearDownRenderers(root, TeardownType::Full);526 }527 528 528 void RenderTreeUpdater::tearDownRenderers(Element& root, TeardownType teardownType) 529 529 { … … 538 538 }; 539 539 540 auto& animationController = root.document().frame()->animation();541 542 540 auto pop = [&] (unsigned depth) { 543 541 while (teardownStack.size() > depth) { 544 542 auto& element = *teardownStack.takeLast(); 545 543 546 if (teardownType == TeardownType::Full || teardownType == TeardownType::RendererUpdateCancelingAnimations) 547 animationController.cancelAnimations(element); 548 549 if (teardownType == TeardownType::Full) 544 if (teardownType != TeardownType::KeepHoverAndActive) 550 545 element.clearHoverAndActiveStatusBeforeDetachingRenderer(); 551 552 546 element.clearStyleDerivedDataBeforeDetachingRenderer(); 553 547 -
trunk/Source/WebCore/style/RenderTreeUpdater.h
r222040 r222104 48 48 void commit(std::unique_ptr<const Style::Update>); 49 49 50 static void tearDownRenderers(Element&); 50 enum class TeardownType { Normal, KeepHoverAndActive }; 51 static void tearDownRenderers(Element&, TeardownType = TeardownType::Normal); 51 52 static void tearDownRenderer(Text&); 52 53 … … 83 84 void popParentsToDepth(unsigned depth); 84 85 85 enum class TeardownType { Full, RendererUpdate, RendererUpdateCancelingAnimations };86 static void tearDownRenderers(Element&, TeardownType);87 88 86 RenderView& renderView(); 89 87 -
trunk/Source/WebCore/style/StyleTreeResolver.cpp
r222040 r222104 242 242 ElementUpdate TreeResolver::createAnimatedElementUpdate(std::unique_ptr<RenderStyle> newStyle, Element& element, Change parentChange) 243 243 { 244 auto& animationController = element.document().frame()->animation();245 246 auto* oldStyle = renderOrDisplayContentsStyle(element);247 auto animationUpdate = animationController.updateAnimations(element, *newStyle, oldStyle);248 249 if (animationUpdate.style)250 newStyle = WTFMove(animationUpdate.style);251 252 auto change = oldStyle ? determineChange(*oldStyle, *newStyle) : Detach;253 254 244 auto validity = element.styleValidity(); 255 if (validity >= Validity::SubtreeInvalid) 256 change = std::max(change, validity == Validity::SubtreeAndRenderersInvalid ? Detach : Force); 257 if (parentChange >= Force) 258 change = std::max(change, parentChange); 259 260 bool shouldRecompositeLayer = element.styleResolutionShouldRecompositeLayer() || animationUpdate.stateChanged; 261 262 return { WTFMove(newStyle), change, shouldRecompositeLayer }; 245 bool recompositeLayer = element.styleResolutionShouldRecompositeLayer(); 246 247 auto makeUpdate = [&] (std::unique_ptr<RenderStyle> style, Change change) { 248 if (validity >= Validity::SubtreeInvalid) 249 change = std::max(change, validity == Validity::SubtreeAndRenderersInvalid ? Detach : Force); 250 if (parentChange >= Force) 251 change = std::max(change, parentChange); 252 return ElementUpdate { WTFMove(style), change, recompositeLayer }; 253 }; 254 255 auto* renderer = element.renderer(); 256 257 bool shouldReconstruct = validity >= Validity::SubtreeAndRenderersInvalid || parentChange == Detach; 258 if (shouldReconstruct) 259 return makeUpdate(WTFMove(newStyle), Detach); 260 261 if (!renderer) { 262 auto change = Detach; 263 if (auto* oldStyle = renderOrDisplayContentsStyle(element)) 264 change = determineChange(*oldStyle, *newStyle); 265 return makeUpdate(WTFMove(newStyle), change); 266 } 267 268 std::unique_ptr<RenderStyle> animatedStyle; 269 if (element.document().frame()->animation().updateAnimations(element, *newStyle, animatedStyle)) 270 recompositeLayer = true; 271 272 if (animatedStyle) { 273 auto change = determineChange(renderer->style(), *animatedStyle); 274 if (renderer->hasInitialAnimatedStyle()) { 275 renderer->setHasInitialAnimatedStyle(false); 276 // When we initialize a newly created renderer with initial animated style we don't inherit it to descendants. 277 // The first animation frame needs to correct this. 278 // FIXME: We should compute animated style correctly during initial style resolution when we don't have renderers yet. 279 // https://bugs.webkit.org/show_bug.cgi?id=171926 280 change = std::max(change, Inherit); 281 } 282 // If animation forces render tree reconstruction pass the original style. The animation will be applied on renderer construction. 283 // FIXME: We should always use the animated style here. 284 auto style = change == Detach ? WTFMove(newStyle) : WTFMove(animatedStyle); 285 return makeUpdate(WTFMove(style), change); 286 } 287 288 auto change = determineChange(renderer->style(), *newStyle); 289 return makeUpdate(WTFMove(newStyle), change); 263 290 } 264 291
Note: See TracChangeset
for help on using the changeset viewer.