Changeset 200283 in webkit
- Timestamp:
- Apr 29, 2016, 9:13:16 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 7 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/css3/filters/blur-clipped-by-ancestor-expected.html (added)
-
LayoutTests/css3/filters/blur-clipped-by-ancestor.html (added)
-
LayoutTests/css3/filters/blur-clipped-with-overflow-expected.html (added)
-
LayoutTests/css3/filters/blur-clipped-with-overflow.html (added)
-
LayoutTests/css3/filters/drop-shadow-expected.html (added)
-
LayoutTests/css3/filters/drop-shadow-with-overflow-hidden-expected.html (added)
-
LayoutTests/css3/filters/drop-shadow-with-overflow-hidden.html (added)
-
LayoutTests/css3/filters/drop-shadow.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/platform/graphics/filters/FilterEffect.cpp (modified) (1 diff)
-
Source/WebCore/rendering/FilterEffectRenderer.cpp (modified) (2 diffs)
-
Source/WebCore/rendering/FilterEffectRenderer.h (modified) (3 diffs)
-
Source/WebCore/rendering/RenderLayer.cpp (modified) (5 diffs)
-
Source/WebCore/rendering/RenderLayer.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r200282 r200283 1 2016-04-29 Simon Fraser <simon.fraser@apple.com> 2 3 Blur filter escapes an enclosing overflow:hidden 4 https://bugs.webkit.org/show_bug.cgi?id=155029 5 6 Reviewed by Zalan Bujtas. 7 8 * css3/filters/blur-clipped-by-ancestor-expected.html: Added. 9 * css3/filters/blur-clipped-by-ancestor.html: Added. 10 * css3/filters/blur-clipped-with-overflow-expected.html: Added. 11 * css3/filters/blur-clipped-with-overflow.html: Added. 12 * css3/filters/drop-shadow-expected.html: Added. 13 * css3/filters/drop-shadow-with-overflow-hidden-expected.html: Added. 14 * css3/filters/drop-shadow-with-overflow-hidden.html: Added. 15 * css3/filters/drop-shadow.html: Added. 16 1 17 2016-04-29 Myles C. Maxfield <mmaxfield@apple.com> 2 18 -
trunk/Source/WebCore/ChangeLog
r200282 r200283 1 2016-04-29 Simon Fraser <simon.fraser@apple.com> 2 3 Blur filter escapes an enclosing overflow:hidden 4 https://bugs.webkit.org/show_bug.cgi?id=155029 5 6 Reviewed by Zalan Bujtas. 7 8 The clipping that was applied when drawing the results of filters was wrong for two reasons. 9 10 First, it used localPaintingInfo which has already been contaminated when setting up the filters. 11 When painting the result, we need to use the original paintingInfo, to get the right paintDirtyRect. 12 13 Secondly, when setting up the clip to paint the filter result, it was relying on layerFragments[0].backgroundRect. 14 However, that was also contaminated by filter setup, since calculateRects() intersects with paintDirtyRect to 15 compute that backgroundRect, and that paintDirtyRect came from filterPainter->repaintRect(). 16 17 Fix this second issue by re-running collectFragments(), which computes a fragment backgroundRect using 18 the original paintDirtyRect. 19 20 Tests: css3/filters/blur-clipped-by-ancestor.html 21 css3/filters/blur-clipped-with-overflow.html 22 css3/filters/drop-shadow-with-overflow-hidden.html 23 css3/filters/drop-shadow.html 24 25 * platform/graphics/filters/FilterEffect.cpp: 26 (WebCore::FilterEffect::clearResult): Unconditionally null these out. 27 * rendering/FilterEffectRenderer.cpp: 28 (WebCore::FilterEffectRendererHelper::beginFilterEffect): Typo fix. 29 * rendering/FilterEffectRenderer.h: 30 (WebCore::FilterEffectRendererHelper::FilterEffectRendererHelper): C++11 initialization. 31 * rendering/RenderLayer.cpp: 32 (WebCore::RenderLayer::applyFilters): 33 (WebCore::RenderLayer::paintLayerContents): 34 * rendering/RenderLayer.h: const 35 1 36 2016-04-29 Myles C. Maxfield <mmaxfield@apple.com> 2 37 -
trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp
r192138 r200283 198 198 if (m_imageBufferResult) 199 199 m_imageBufferResult.reset(); 200 if (m_unmultipliedImageResult) 201 m_unmultipliedImageResult = nullptr; 202 if (m_premultipliedImageResult) 203 m_premultipliedImageResult = nullptr; 200 201 m_unmultipliedImageResult = nullptr; 202 m_premultipliedImageResult = nullptr; 204 203 } 205 204 -
trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp
r200279 r200283 68 68 FilterEffectRenderer::FilterEffectRenderer() 69 69 : Filter(AffineTransform()) 70 , m_graphicsBufferAttached(false)71 , m_hasFilterThatMovesPixels(false)72 70 { 73 71 setFilterResolution(FloatSize(1, 1)); … … 408 406 } 409 407 410 // Translate the context so that the contents of the layer is captu terd in the offscreen memory buffer.408 // Translate the context so that the contents of the layer is captured in the offscreen memory buffer. 411 409 sourceGraphicsContext->save(); 412 410 sourceGraphicsContext->translate(-m_paintOffset.x(), -m_paintOffset.y()); -
trunk/Source/WebCore/rendering/FilterEffectRenderer.h
r197563 r200283 59 59 public: 60 60 FilterEffectRendererHelper(bool haveFilterEffect) 61 : m_renderLayer(0) 62 , m_haveFilterEffect(haveFilterEffect) 63 , m_startedFilterEffect(false) 61 : m_haveFilterEffect(haveFilterEffect) 64 62 { 65 63 } … … 77 75 78 76 private: 79 RenderLayer* m_renderLayer ; // FIXME: this is mainly used to get the FilterEffectRenderer. FilterEffectRendererHelper should be weaned off it.77 RenderLayer* m_renderLayer { nullptr }; // FIXME: this is mainly used to get the FilterEffectRenderer. FilterEffectRendererHelper should be weaned off it. 80 78 LayoutPoint m_paintOffset; 81 79 LayoutRect m_repaintRect; 82 bool m_haveFilterEffect ;83 bool m_startedFilterEffect ;80 bool m_haveFilterEffect { false }; 81 bool m_startedFilterEffect { false }; 84 82 }; 85 83 … … 146 144 IntRectExtent m_outsets; 147 145 148 bool m_graphicsBufferAttached ;149 bool m_hasFilterThatMovesPixels ;146 bool m_graphicsBufferAttached { false }; 147 bool m_hasFilterThatMovesPixels { false }; 150 148 }; 151 149 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r200279 r200283 4197 4197 } 4198 4198 4199 void RenderLayer::applyFilters(FilterEffectRendererHelper* filterPainter, GraphicsContext& originalContext, LayerPaintingInfo& paintingInfo,LayerFragments& layerFragments)4199 void RenderLayer::applyFilters(FilterEffectRendererHelper* filterPainter, GraphicsContext& originalContext, const LayerPaintingInfo& paintingInfo, const LayerFragments& layerFragments) 4200 4200 { 4201 4201 ASSERT(filterPainter->hasStartedFilterEffect()); 4202 // Apply the correct clipping (ie. overflow: hidden). 4203 // FIXME: It is incorrect to just clip to the damageRect here once multiple fragments are involved.4202 4203 // FIXME: Handle more than one fragment. 4204 4204 ClipRect backgroundRect = layerFragments.isEmpty() ? ClipRect() : layerFragments[0].backgroundRect; 4205 4205 clipToRect(paintingInfo, originalContext, backgroundRect); … … 4292 4292 hasClipPath = setupClipPath(context, paintingInfo, columnAwareOffsetFromRoot, rootRelativeBounds, rootRelativeBoundsComputed); 4293 4293 4294 LayerPaintingInfo localPaintingInfo(paintingInfo); 4295 4296 bool selectionAndBackgroundsOnly = localPaintingInfo.paintBehavior & PaintBehaviorSelectionAndBackgroundsOnly; 4297 bool selectionOnly = localPaintingInfo.paintBehavior & PaintBehaviorSelectionOnly; 4294 bool selectionAndBackgroundsOnly = paintingInfo.paintBehavior & PaintBehaviorSelectionAndBackgroundsOnly; 4295 bool selectionOnly = paintingInfo.paintBehavior & PaintBehaviorSelectionOnly; 4298 4296 LayerFragments layerFragments; 4299 4297 RenderObject* subtreePaintRootForRenderer = nullptr; 4300 4298 4301 { // Scope for currentContext. 4299 { // Scope for filter-related state changes. 4300 LayerPaintingInfo localPaintingInfo(paintingInfo); 4302 4301 std::unique_ptr<FilterEffectRendererHelper> filterPainter = setupFilters(context, localPaintingInfo, paintFlags, columnAwareOffsetFromRoot, rootRelativeBounds, rootRelativeBoundsComputed); 4303 4302 … … 4330 4329 // fragment should paint. If the parent's filter dictates full repaint to ensure proper filter effect, 4331 4330 // use the overflow clip as dirty rect, instead of no clipping. It maintains proper clipping for overflow::scroll. 4332 if (! paintingInfo.clipToDirtyRect && renderer().hasOverflowClip()) {4331 if (!localPaintingInfo.clipToDirtyRect && renderer().hasOverflowClip()) { 4333 4332 // We can turn clipping back by requesting full repaint for the overflow area. 4334 4333 localPaintingInfo.clipToDirtyRect = true; … … 4382 4381 4383 4382 if (filterContext) { 4384 applyFilters(filterPainter.get(), context, localPaintingInfo, layerFragments); 4383 // When we called collectFragments() last time, paintDirtyRect was reset to represent the filter bounds. 4384 // Now we need to compute the backgroundRect uncontaminated by filters, in order to clip the filtered result. 4385 // Note that we also use paintingInfo here, not localPaintingInfo which filters also contaminated. 4386 LayerFragments layerFragments; 4387 collectFragments(layerFragments, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, ExcludeCompositedPaginatedLayers, 4388 (localPaintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, IgnoreOverlayScrollbarSize, 4389 (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, offsetFromRoot); 4390 updatePaintingInfoForFragments(layerFragments, paintingInfo, localPaintFlags, shouldPaintContent, offsetFromRoot); 4391 4392 applyFilters(filterPainter.get(), context, paintingInfo, layerFragments); 4385 4393 filterPainter = nullptr; 4386 4394 } … … 4390 4398 if (shouldPaintMask(paintingInfo.paintBehavior, localPaintFlags)) { 4391 4399 // Paint the mask for the fragments. 4392 paintMaskForFragments(layerFragments, context, localPaintingInfo, subtreePaintRootForRenderer);4400 paintMaskForFragments(layerFragments, context, paintingInfo, subtreePaintRootForRenderer); 4393 4401 } 4394 4402 4395 4403 if (!(paintFlags & PaintLayerPaintingCompositingMaskPhase) && (paintFlags & PaintLayerPaintingCompositingClipPathPhase)) { 4396 4404 // Re-use paintChildClippingMaskForFragments to paint black for the compositing clipping mask. 4397 paintChildClippingMaskForFragments(layerFragments, context, localPaintingInfo, subtreePaintRootForRenderer);4405 paintChildClippingMaskForFragments(layerFragments, context, paintingInfo, subtreePaintRootForRenderer); 4398 4406 } 4399 4407 4400 4408 if ((localPaintFlags & PaintLayerPaintingChildClippingMaskPhase)) { 4401 4409 // Paint the border radius mask for the fragments. 4402 paintChildClippingMaskForFragments(layerFragments, context, localPaintingInfo, subtreePaintRootForRenderer);4410 paintChildClippingMaskForFragments(layerFragments, context, paintingInfo, subtreePaintRootForRenderer); 4403 4411 } 4404 4412 } -
trunk/Source/WebCore/rendering/RenderLayer.h
r200279 r200283 787 787 bool hasFilterThatIsPainting(GraphicsContext&, PaintLayerFlags) const; 788 788 std::unique_ptr<FilterEffectRendererHelper> setupFilters(GraphicsContext&, LayerPaintingInfo&, PaintLayerFlags, const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed); 789 void applyFilters(FilterEffectRendererHelper*, GraphicsContext& originalContext, LayerPaintingInfo&,LayerFragments&);789 void applyFilters(FilterEffectRendererHelper*, GraphicsContext& originalContext, const LayerPaintingInfo&, const LayerFragments&); 790 790 791 791 void paintLayer(GraphicsContext&, const LayerPaintingInfo&, PaintLayerFlags);
Note:
See TracChangeset
for help on using the changeset viewer.