Title: [178380] trunk
Revision
178380
Author
d...@apple.com
Date
2015-01-13 15:22:21 -0800 (Tue, 13 Jan 2015)

Log Message

Filters aren't applied to elements in columns after the first
https://bugs.webkit.org/show_bug.cgi?id=140331
Source/WebCore:

Reviewed by Simon Fraser.

The important bits of this change came from Simon.

Filters and clipping were not taking columns into
account when using their offset rectangles. The fix
is to recalculate the rects if you're in such a
situation.

Tests: fast/multicol/clip-in-columns.html
       fast/multicol/filter-in-columns.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hasFilterThatIsPainting): New method used
to check if we're about to paint a filter.
(WebCore::RenderLayer::setupFilters): Use the new helper if possible.
(WebCore::RenderLayer::paintLayerContents): If we're in columns,
and we either have a clip or a filter, recalculate the offset rectangles.
* rendering/RenderLayer.h:

LayoutTests:

<rdar://problem/19313858>

Reviewed by Simon Fraser.

Tests for filters and clipping on a column other
than the first.

* fast/multicol/clip-in-columns-expected.html: Added.
* fast/multicol/clip-in-columns.html: Added.
* fast/multicol/filter-in-columns-expected.html: Added.
* fast/multicol/filter-in-columns.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (178379 => 178380)


--- trunk/LayoutTests/ChangeLog	2015-01-13 23:04:09 UTC (rev 178379)
+++ trunk/LayoutTests/ChangeLog	2015-01-13 23:22:21 UTC (rev 178380)
@@ -1,3 +1,19 @@
+2015-01-13  Dean Jackson  <d...@apple.com>
+
+        Filters aren't applied to elements in columns after the first
+        https://bugs.webkit.org/show_bug.cgi?id=140331
+        <rdar://problem/19313858>
+
+        Reviewed by Simon Fraser.
+
+        Tests for filters and clipping on a column other
+        than the first.
+
+        * fast/multicol/clip-in-columns-expected.html: Added.
+        * fast/multicol/clip-in-columns.html: Added.
+        * fast/multicol/filter-in-columns-expected.html: Added.
+        * fast/multicol/filter-in-columns.html: Added.
+
 2015-01-13  Yusuke Suzuki  <utatane....@gmail.com>
 
         DFG can call PutByValDirect for generic arrays

Added: trunk/LayoutTests/fast/multicol/clip-in-columns-expected.html (0 => 178380)


--- trunk/LayoutTests/fast/multicol/clip-in-columns-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/clip-in-columns-expected.html	2015-01-13 23:22:21 UTC (rev 178380)
@@ -0,0 +1,30 @@
+<style>
+section {
+    height: 200px;
+    width: 300px;
+    position: relative;
+}
+
+p {
+    padding: 0;
+    margin: 0;
+}
+
+.break-after {
+    page-break-after: always;
+}
+
+.clipped {
+    position: absolute;
+    left: 150px;
+    top: 0;
+    width: 150px;
+    background: blue;
+    color: white;
+    -webkit-clip-path: polygon(5px 5px, 60px 5px, 60px 20px, 5px 20px);
+}
+</style>
+<section>
+<p class="break-after">Hello</p>
+<p class="clipped">World</p>
+</section>
\ No newline at end of file
Property changes on: trunk/LayoutTests/fast/multicol/clip-in-columns-expected.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/fast/multicol/clip-in-columns.html (0 => 178380)


--- trunk/LayoutTests/fast/multicol/clip-in-columns.html	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/clip-in-columns.html	2015-01-13 23:22:21 UTC (rev 178380)
@@ -0,0 +1,27 @@
+<style>
+section {
+    columns: 2;
+    column-gap: 0;
+    height: 200px;
+    width: 300px;
+}
+
+p {
+    padding: 0;
+    margin: 0;
+}
+
+.break-after {
+    page-break-after: always;
+}
+
+.clipped {
+    background: blue;
+    color: white;
+    -webkit-clip-path: polygon(5px 5px, 60px 5px, 60px 20px, 5px 20px);
+}
+</style>
+<section>
+<p class="break-after">Hello</p>
+<p class="clipped">World</p>
+</section>
\ No newline at end of file
Property changes on: trunk/LayoutTests/fast/multicol/clip-in-columns.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/fast/multicol/filter-in-columns-expected.html (0 => 178380)


--- trunk/LayoutTests/fast/multicol/filter-in-columns-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/filter-in-columns-expected.html	2015-01-13 23:22:21 UTC (rev 178380)
@@ -0,0 +1,29 @@
+<style>
+section {
+    height: 200px;
+    width: 300px;
+    position: relative;
+}
+
+p {
+    padding: 0;
+    margin: 0;
+}
+
+.break-after {
+    page-break-after: always;
+}
+
+.filtered {
+    position: absolute;
+    left: 150px;
+    top: 0;
+    width: 150px;
+    background: white;
+    -webkit-filter: invert();
+}
+</style>
+<section>
+<p class="break-after">Hello</p>
+<p class="filtered">World</p>
+</section>
\ No newline at end of file
Property changes on: trunk/LayoutTests/fast/multicol/filter-in-columns-expected.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/fast/multicol/filter-in-columns.html (0 => 178380)


--- trunk/LayoutTests/fast/multicol/filter-in-columns.html	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/filter-in-columns.html	2015-01-13 23:22:21 UTC (rev 178380)
@@ -0,0 +1,26 @@
+<style>
+section {
+    columns: 2;
+    column-gap: 0;
+    height: 200px;
+    width: 300px;
+}
+
+p {
+    padding: 0;
+    margin: 0;
+}
+
+.break-after {
+    page-break-after: always;
+}
+
+.filtered {
+    background: white;
+    -webkit-filter: invert();
+}
+</style>
+<section>
+<p class="break-after">Hello</p>
+<p class="filtered">World</p>
+</section>
\ No newline at end of file
Property changes on: trunk/LayoutTests/fast/multicol/filter-in-columns.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (178379 => 178380)


--- trunk/Source/WebCore/ChangeLog	2015-01-13 23:04:09 UTC (rev 178379)
+++ trunk/Source/WebCore/ChangeLog	2015-01-13 23:22:21 UTC (rev 178380)
@@ -1,3 +1,28 @@
+2015-01-13  Dean Jackson  <d...@apple.com>
+
+        Filters aren't applied to elements in columns after the first
+        https://bugs.webkit.org/show_bug.cgi?id=140331
+
+        Reviewed by Simon Fraser.
+
+        The important bits of this change came from Simon.
+
+        Filters and clipping were not taking columns into
+        account when using their offset rectangles. The fix
+        is to recalculate the rects if you're in such a
+        situation.
+
+        Tests: fast/multicol/clip-in-columns.html
+               fast/multicol/filter-in-columns.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::hasFilterThatIsPainting): New method used
+        to check if we're about to paint a filter.
+        (WebCore::RenderLayer::setupFilters): Use the new helper if possible.
+        (WebCore::RenderLayer::paintLayerContents): If we're in columns,
+        and we either have a clip or a filter, recalculate the offset rectangles.
+        * rendering/RenderLayer.h:
+
 2015-01-13  Beth Dakin  <bda...@apple.com>
 
         Should disable immediate actions for iTunes

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (178379 => 178380)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2015-01-13 23:04:09 UTC (rev 178379)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2015-01-13 23:22:21 UTC (rev 178380)
@@ -3959,23 +3959,35 @@
     return false;
 }
 
-std::unique_ptr<FilterEffectRendererHelper> RenderLayer::setupFilters(GraphicsContext* context, LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed)
+bool RenderLayer::hasFilterThatIsPainting(GraphicsContext* context, PaintLayerFlags paintFlags) const
 {
     if (context->paintingDisabled())
-        return nullptr;
+        return false;
 
     if (paintFlags & PaintLayerPaintingOverlayScrollbars)
-        return nullptr;
+        return false;
 
     FilterInfo* filterInfo = FilterInfo::getIfExists(*this);
     bool hasPaintedFilter = filterInfo && filterInfo->renderer() && paintsWithFilters();
     if (!hasPaintedFilter)
-        return nullptr;
+        return false;
 
     auto filterPainter = std::make_unique<FilterEffectRendererHelper>(hasPaintedFilter);
     if (!filterPainter->haveFilterEffect())
+        return false;
+
+    return true;
+}
+
+std::unique_ptr<FilterEffectRendererHelper> RenderLayer::setupFilters(GraphicsContext* context, LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed)
+{
+    if (!hasFilterThatIsPainting(context, paintFlags))
         return nullptr;
-    
+
+    FilterInfo* filterInfo = FilterInfo::getIfExists(*this);
+    bool hasPaintedFilter = filterInfo && filterInfo->renderer() && paintsWithFilters();
+    auto filterPainter = std::make_unique<FilterEffectRendererHelper>(hasPaintedFilter);
+
     LayoutRect filterRepaintRect = filterInfo->dirtySourceRect();
     filterRepaintRect.move(offsetFromRoot);
 
@@ -4094,12 +4106,15 @@
     bool needToAdjustSubpixelQuantization = setupFontSubpixelQuantization(context, didQuantizeFonts);
 
     // Apply clip-path to context.
-    bool hasClipPath = setupClipPath(context, paintingInfo, offsetFromRoot, rootRelativeBounds, rootRelativeBoundsComputed);
+    LayoutSize columnAwareOffsetFromRoot = offsetFromRoot;
+    if (renderer().flowThreadContainingBlock() && (renderer().hasClipPath() || hasFilterThatIsPainting(context, paintFlags)))
+        columnAwareOffsetFromRoot = toLayoutSize(convertToLayerCoords(paintingInfo.rootLayer, LayoutPoint(), AdjustForColumns));
+    bool hasClipPath = setupClipPath(context, paintingInfo, columnAwareOffsetFromRoot, rootRelativeBounds, rootRelativeBoundsComputed);
 
     LayerPaintingInfo localPaintingInfo(paintingInfo);
 
     GraphicsContext* transparencyLayerContext = context;
-    std::unique_ptr<FilterEffectRendererHelper> filterPainter = setupFilters(context, localPaintingInfo, paintFlags, offsetFromRoot, rootRelativeBounds, rootRelativeBoundsComputed);
+    std::unique_ptr<FilterEffectRendererHelper> filterPainter = setupFilters(context, localPaintingInfo, paintFlags, columnAwareOffsetFromRoot, rootRelativeBounds, rootRelativeBoundsComputed);
     if (filterPainter) {
         context = filterPainter->filterContext();
         if (context != transparencyLayerContext && haveTransparency) {

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (178379 => 178380)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2015-01-13 23:04:09 UTC (rev 178379)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2015-01-13 23:22:21 UTC (rev 178380)
@@ -986,6 +986,7 @@
     bool setupFontSubpixelQuantization(GraphicsContext*, bool& didQuantizeFonts);
     bool setupClipPath(GraphicsContext*, const LayerPaintingInfo&, const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed);
 
+    bool hasFilterThatIsPainting(GraphicsContext*, PaintLayerFlags) const;
     std::unique_ptr<FilterEffectRendererHelper> setupFilters(GraphicsContext*, LayerPaintingInfo&, PaintLayerFlags, const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed);
     GraphicsContext* applyFilters(FilterEffectRendererHelper*, GraphicsContext* originalContext, LayerPaintingInfo&, LayerFragments&);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to