Changeset 208314 in webkit
- Timestamp:
- Nov 2, 2016, 5:19:54 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r208313 r208314 1 2016-11-02 Simon Fraser <simon.fraser@apple.com> 2 3 REGRESSION (r208025) GraphicsContext state stack assertions loading webkit.org 4 https://bugs.webkit.org/show_bug.cgi?id=164350 5 rdar://problem/29053414 6 7 Reviewed by Dean Jackson. 8 9 Test was reduced from webkit.org. 10 11 * animations/stacking-during-opacity-animation-expected.txt: Added. 12 * animations/stacking-during-opacity-animation.html: Added. 13 1 14 2016-11-02 Myles C. Maxfield <mmaxfield@apple.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r208313 r208314 1 2016-11-02 Simon Fraser <simon.fraser@apple.com> 2 3 REGRESSION (r208025) GraphicsContext state stack assertions loading webkit.org 4 https://bugs.webkit.org/show_bug.cgi?id=164350 5 rdar://problem/29053414 6 7 Reviewed by Dean Jackson. 8 9 After r208025 it as possible for KeyframeAnimation::animate() to produce a RenderStyle 10 with a non-1 opacity, but without the explicit z-index that triggers stacking context. 11 This confused the RenderLayer paintWithTransparency code, triggering mismsatched GraphicsContext 12 save/restores. 13 14 This occurred when the runningOrFillingForwards state was mis-computed. keyframeAnim->animate() 15 can spit out a new style when in the StartWaitTimer sometimes, so "!keyframeAnim->waitingToStart() && !keyframeAnim->postActive()" 16 gave the wrong answser. 17 18 Rather than depend on the super-confusing animation state, use a bool out param from animate() to say 19 when it actually produced a new style, and when true, do the setZIndex(0). 20 21 Test: animations/stacking-during-opacity-animation.html 22 23 * page/animation/AnimationBase.h: 24 * page/animation/CSSPropertyAnimation.cpp: 25 (WebCore::CSSPropertyAnimation::blendProperties): Log after blending so the log shows the blended style. 26 * page/animation/CompositeAnimation.cpp: 27 (WebCore::CompositeAnimation::animate): 28 * page/animation/ImplicitAnimation.cpp: 29 (WebCore::ImplicitAnimation::animate): 30 * page/animation/ImplicitAnimation.h: 31 * page/animation/KeyframeAnimation.cpp: 32 (WebCore::KeyframeAnimation::animate): 33 * page/animation/KeyframeAnimation.h: 34 * platform/graphics/GraphicsContext.cpp: 35 (WebCore::GraphicsContext::restore): 36 * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: 37 (PlatformCALayer::drawLayerContents): No functional change, but created scope for the 38 GraphicsContext so that it didn't outlive the CGContextRestoreGState(context). 39 * rendering/RenderLayer.cpp: 40 (WebCore::RenderLayer::beginTransparencyLayers): New assertion that catches the problem earlier. 41 1 42 2016-11-02 Myles C. Maxfield <mmaxfield@apple.com> 2 43 -
trunk/Source/WebCore/page/animation/AnimationBase.h
r204466 r208314 137 137 138 138 // Returns true if the animation state changed. 139 virtual bool animate(CompositeAnimation*, RenderElement*, const RenderStyle* /*currentStyle*/, const RenderStyle* /*targetStyle*/, std::unique_ptr<RenderStyle>& /*animatedStyle*/ ) = 0;139 virtual bool animate(CompositeAnimation*, RenderElement*, const RenderStyle* /*currentStyle*/, const RenderStyle* /*targetStyle*/, std::unique_ptr<RenderStyle>& /*animatedStyle*/, bool& didBlendStyle) = 0; 140 140 virtual void getAnimatedStyle(std::unique_ptr<RenderStyle>& /*animatedStyle*/) = 0; 141 141 -
trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp
r208025 r208314 1577 1577 AnimationPropertyWrapperBase* wrapper = CSSPropertyAnimationWrapperMap::singleton().wrapperForProperty(prop); 1578 1578 if (wrapper) { 1579 wrapper->blend(anim, dst, a, b, progress); 1579 1580 #if !LOG_DISABLED 1580 1581 wrapper->logBlend(a, b, dst, progress); 1581 1582 #endif 1582 wrapper->blend(anim, dst, a, b, progress);1583 1583 return !wrapper->animationIsAccelerated() || !anim->isAccelerated(); 1584 1584 } -
trunk/Source/WebCore/page/animation/CompositeAnimation.cpp
r208025 r208314 300 300 bool checkForStackingContext = false; 301 301 for (auto& transition : m_transitions.values()) { 302 if (transition->animate(this, &renderer, currentStyle, &targetStyle, blendedStyle)) 302 bool didBlendStyle = false; 303 if (transition->animate(this, &renderer, currentStyle, &targetStyle, blendedStyle, didBlendStyle)) 303 304 animationStateChanged = true; 304 305 305 checkForStackingContext |= WillChangeData::propertyCreatesStackingContext(transition->animatingProperty()); 306 if (didBlendStyle) 307 checkForStackingContext |= WillChangeData::propertyCreatesStackingContext(transition->animatingProperty()); 306 308 } 307 309 … … 328 330 RefPtr<KeyframeAnimation> keyframeAnim = m_keyframeAnimations.get(name); 329 331 if (keyframeAnim) { 330 if (keyframeAnim->animate(this, &renderer, currentStyle, &targetStyle, blendedStyle)) 332 bool didBlendStyle = false; 333 if (keyframeAnim->animate(this, &renderer, currentStyle, &targetStyle, blendedStyle, didBlendStyle)) 331 334 animationStateChanged = true; 332 335 333 bool runningOrFillingForwards = !keyframeAnim->waitingToStart() && !keyframeAnim->postActive(); 334 forceStackingContext |= runningOrFillingForwards && keyframeAnim->triggersStackingContext(); 336 forceStackingContext |= didBlendStyle && keyframeAnim->triggersStackingContext(); 335 337 } 336 338 } -
trunk/Source/WebCore/page/animation/ImplicitAnimation.cpp
r208033 r208314 62 62 } 63 63 64 bool ImplicitAnimation::animate(CompositeAnimation*, RenderElement*, const RenderStyle*, const RenderStyle* targetStyle, std::unique_ptr<RenderStyle>& animatedStyle )64 bool ImplicitAnimation::animate(CompositeAnimation*, RenderElement*, const RenderStyle*, const RenderStyle* targetStyle, std::unique_ptr<RenderStyle>& animatedStyle, bool& didBlendStyle) 65 65 { 66 66 // If we get this far and the animation is done, it means we are cleaning up a just finished animation. … … 86 86 // Fire the start timeout if needed 87 87 fireAnimationEventsIfNeeded(); 88 89 didBlendStyle = true; 88 90 return state() != oldState; 89 91 } -
trunk/Source/WebCore/page/animation/ImplicitAnimation.h
r200098 r208314 55 55 void endAnimation() override; 56 56 57 bool animate(CompositeAnimation*, RenderElement*, const RenderStyle* currentStyle, const RenderStyle* targetStyle, std::unique_ptr<RenderStyle>& animatedStyle ) override;57 bool animate(CompositeAnimation*, RenderElement*, const RenderStyle* currentStyle, const RenderStyle* targetStyle, std::unique_ptr<RenderStyle>& animatedStyle, bool& didBlendStyle) override; 58 58 void getAnimatedStyle(std::unique_ptr<RenderStyle>& animatedStyle) override; 59 59 void reset(const RenderStyle* to); -
trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp
r208033 r208314 125 125 } 126 126 127 bool KeyframeAnimation::animate(CompositeAnimation* compositeAnimation, RenderElement*, const RenderStyle*, const RenderStyle* targetStyle, std::unique_ptr<RenderStyle>& animatedStyle )127 bool KeyframeAnimation::animate(CompositeAnimation* compositeAnimation, RenderElement*, const RenderStyle*, const RenderStyle* targetStyle, std::unique_ptr<RenderStyle>& animatedStyle, bool& didBlendStyle) 128 128 { 129 129 // Fire the start timeout if needed … … 180 180 } 181 181 182 didBlendStyle = true; 182 183 return state() != oldState; 183 184 } -
trunk/Source/WebCore/page/animation/KeyframeAnimation.h
r208025 r208314 46 46 } 47 47 48 bool animate(CompositeAnimation*, RenderElement*, const RenderStyle* currentStyle, const RenderStyle* targetStyle, std::unique_ptr<RenderStyle>& animatedStyle ) override;48 bool animate(CompositeAnimation*, RenderElement*, const RenderStyle* currentStyle, const RenderStyle* targetStyle, std::unique_ptr<RenderStyle>& animatedStyle, bool& didBlendStyle) override; 49 49 void getAnimatedStyle(std::unique_ptr<RenderStyle>&) override; 50 50 -
trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp
r207020 r208314 368 368 return; 369 369 } 370 370 371 m_state = m_stack.last(); 371 372 m_stack.removeLast(); -
trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
r202858 r208314 1068 1068 #endif 1069 1069 1070 GraphicsContext graphicsContext(context); 1071 graphicsContext.setIsCALayerContext(true); 1072 graphicsContext.setIsAcceleratedContext(platformCALayer->acceleratesDrawing()); 1073 1074 if (!layerContents->platformCALayerContentsOpaque()) { 1075 // Turn off font smoothing to improve the appearance of text rendered onto a transparent background. 1076 graphicsContext.setShouldSmoothFonts(false); 1077 } 1078 1070 { 1071 GraphicsContext graphicsContext(context); 1072 graphicsContext.setIsCALayerContext(true); 1073 graphicsContext.setIsAcceleratedContext(platformCALayer->acceleratesDrawing()); 1074 1075 if (!layerContents->platformCALayerContentsOpaque()) { 1076 // Turn off font smoothing to improve the appearance of text rendered onto a transparent background. 1077 graphicsContext.setShouldSmoothFonts(false); 1078 } 1079 1079 1080 #if PLATFORM(MAC) 1080 // It's important to get the clip from the context, because it may be significantly 1081 // smaller than the layer bounds (e.g. tiled layers) 1082 ThemeMac::setFocusRingClipRect(CGContextGetClipBoundingBox(context)); 1083 #endif 1084 1085 for (const auto& rect : dirtyRects) { 1086 GraphicsContextStateSaver stateSaver(graphicsContext); 1087 graphicsContext.clip(rect); 1081 // It's important to get the clip from the context, because it may be significantly 1082 // smaller than the layer bounds (e.g. tiled layers) 1083 ThemeMac::setFocusRingClipRect(CGContextGetClipBoundingBox(context)); 1084 #endif 1088 1085 1089 layerContents->platformCALayerPaintContents(platformCALayer, graphicsContext, rect); 1090 } 1091 1086 for (const auto& rect : dirtyRects) { 1087 GraphicsContextStateSaver stateSaver(graphicsContext); 1088 graphicsContext.clip(rect); 1089 1090 layerContents->platformCALayerPaintContents(platformCALayer, graphicsContext, rect); 1091 } 1092 1092 1093 #if PLATFORM(IOS) 1093 fontAntialiasingState.restore();1094 fontAntialiasingState.restore(); 1094 1095 #else 1095 ThemeMac::setFocusRingClipRect(FloatRect()); 1096 1097 [NSGraphicsContext restoreGraphicsState]; 1098 #endif 1099 1096 ThemeMac::setFocusRingClipRect(FloatRect()); 1097 1098 [NSGraphicsContext restoreGraphicsState]; 1099 #endif 1100 } 1101 1102 CGContextRestoreGState(context); 1103 1100 1104 // Re-fetch the layer owner, since <rdar://problem/9125151> indicates that it might have been destroyed during painting. 1101 1105 layerContents = platformCALayer->owner(); 1102 1106 ASSERT(layerContents); 1103 1107 1104 CGContextRestoreGState(context);1105 1106 1108 // Always update the repaint count so that it's accurate even if the count itself is not shown. This will be useful 1107 1109 // for the Web Inspector feeding this information through the LayerTreeAgent. 1108 1110 int repaintCount = layerContents->platformCALayerIncrementRepaintCount(platformCALayer); 1109 1111 1110 1112 if (!platformCALayer->usesTiledBackingLayer() && layerContents && layerContents->platformCALayerShowRepaintCounter(platformCALayer)) 1111 1113 drawRepaintIndicator(context, platformCALayer, repaintCount, nullptr); -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r208033 r208314 1810 1810 1811 1811 if (paintsWithTransparency(paintingInfo.paintBehavior)) { 1812 ASSERT(isStackingContext()); 1812 1813 m_usedTransparency = true; 1813 1814 context.save();
Note:
See TracChangeset
for help on using the changeset viewer.