Blur filter escapes an enclosing overflow:hidden
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Apr 2016 04:13:16 +0000 (04:13 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Apr 2016 04:13:16 +0000 (04:13 +0000)
commit1c381f41d2c5b25d3e96ef1623b07d669f874123
tree6512640246b167d19387c64a3afed9f21c0fd802
parent984f5dede456fab1095bd5fe3aa40e96a4a97de5
Blur filter escapes an enclosing overflow:hidden
https://bugs.webkit.org/show_bug.cgi?id=155029

Reviewed by Zalan Bujtas.

Source/WebCore:

The clipping that was applied when drawing the results of filters was wrong for two reasons.

First, it used localPaintingInfo which has already been contaminated when setting up the filters.
When painting the result, we need to use the original paintingInfo, to get the right paintDirtyRect.

Secondly, when setting up the clip to paint the filter result, it was relying on layerFragments[0].backgroundRect.
However, that was also contaminated by filter setup, since calculateRects() intersects with paintDirtyRect to
compute that backgroundRect, and that paintDirtyRect came from filterPainter->repaintRect().

Fix this second issue by re-running collectFragments(), which computes a fragment backgroundRect using
the original paintDirtyRect.

Tests: css3/filters/blur-clipped-by-ancestor.html
       css3/filters/blur-clipped-with-overflow.html
       css3/filters/drop-shadow-with-overflow-hidden.html
       css3/filters/drop-shadow.html

* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::clearResult): Unconditionally null these out.
* rendering/FilterEffectRenderer.cpp:
(WebCore::FilterEffectRendererHelper::beginFilterEffect): Typo fix.
* rendering/FilterEffectRenderer.h:
(WebCore::FilterEffectRendererHelper::FilterEffectRendererHelper): C++11 initialization.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::applyFilters):
(WebCore::RenderLayer::paintLayerContents):
* rendering/RenderLayer.h: const

LayoutTests:

* css3/filters/blur-clipped-by-ancestor-expected.html: Added.
* css3/filters/blur-clipped-by-ancestor.html: Added.
* css3/filters/blur-clipped-with-overflow-expected.html: Added.
* css3/filters/blur-clipped-with-overflow.html: Added.
* css3/filters/drop-shadow-expected.html: Added.
* css3/filters/drop-shadow-with-overflow-hidden-expected.html: Added.
* css3/filters/drop-shadow-with-overflow-hidden.html: Added.
* css3/filters/drop-shadow.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200283 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/filters/blur-clipped-by-ancestor-expected.html [new file with mode: 0644]
LayoutTests/css3/filters/blur-clipped-by-ancestor.html [new file with mode: 0644]
LayoutTests/css3/filters/blur-clipped-with-overflow-expected.html [new file with mode: 0644]
LayoutTests/css3/filters/blur-clipped-with-overflow.html [new file with mode: 0644]
LayoutTests/css3/filters/drop-shadow-expected.html [new file with mode: 0644]
LayoutTests/css3/filters/drop-shadow-with-overflow-hidden-expected.html [new file with mode: 0644]
LayoutTests/css3/filters/drop-shadow-with-overflow-hidden.html [new file with mode: 0644]
LayoutTests/css3/filters/drop-shadow.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/filters/FilterEffect.cpp
Source/WebCore/rendering/FilterEffectRenderer.cpp
Source/WebCore/rendering/FilterEffectRenderer.h
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayer.h