Title: [167820] trunk
Revision
167820
Author
hy...@apple.com
Date
2014-04-25 14:05:59 -0700 (Fri, 25 Apr 2014)

Log Message

Column rules not respecting scroll offsets.
https://bugs.webkit.org/show_bug.cgi?id=109683

Reviewed by Dean Jackson.


Source/WebCore: 
Added fast/multicol/scrolling-column-rules.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paintColumnRules):
Make paintColumnRules virtual so that it works with both column implementations.

(WebCore::RenderBlock::paintObject):
Changed to call paintColumnRules with the adjusted scroll offset and to do it after
bailing on the root background only check.

* rendering/RenderBlock.h:
paintColumnRules is now virtual.

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::paintColumnRules):
(WebCore::RenderBlockFlow::paintBoxDecorations): Deleted.
* rendering/RenderBlockFlow.h:
Got rid of paintBoxDecorations override since it failed when hasBoxDecorations was false
anyway. Override paintColumnRules instead to paint at the right time.

LayoutTests: 
* fast/multicol/scrolling-column-rules.html: Added.
* platform/mac/fast/multicol/scrolling-column-rules-expected.png: Added.
* platform/mac/fast/multicol/scrolling-column-rules-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (167819 => 167820)


--- trunk/LayoutTests/ChangeLog	2014-04-25 20:34:47 UTC (rev 167819)
+++ trunk/LayoutTests/ChangeLog	2014-04-25 21:05:59 UTC (rev 167820)
@@ -1,3 +1,14 @@
+2014-04-25  David Hyatt  <hy...@apple.com>
+
+        Column rules not respecting scroll offsets.
+        https://bugs.webkit.org/show_bug.cgi?id=109683
+
+        Reviewed by Dean Jackson.
+
+        * fast/multicol/scrolling-column-rules.html: Added.
+        * platform/mac/fast/multicol/scrolling-column-rules-expected.png: Added.
+        * platform/mac/fast/multicol/scrolling-column-rules-expected.txt: Added.
+
 2014-04-23  Jon Honeycutt  <jhoneyc...@apple.com>
 
         Crash applying editing commands from iframe onload event

Added: trunk/LayoutTests/fast/multicol/scrolling-column-rules.html (0 => 167820)


--- trunk/LayoutTests/fast/multicol/scrolling-column-rules.html	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/scrolling-column-rules.html	2014-04-25 21:05:59 UTC (rev 167820)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <script>
+internals.settings.setRegionBasedColumnsEnabled(true)
+</script>
+    <title>Column rule in scrollable multicol container</title>
+    <style>
+       .mc {
+        columns: 2;
+        column-gap: 110px;
+        column-rule: 100px solid;
+        -moz-columns: 2;
+        -moz-column-gap: 110px;
+        -moz-column-rule: 100px solid;
+        -webkit-columns: 2;
+        -webkit-column-gap: 110px;
+        -webkit-column-rule: 100px solid;
+        orphans: 1;
+        widows: 1;
+        height: 100px;
+        overflow: hidden;
+      }
+    </style>
+    <script>
+      if (window.testRunner)
+        testRunner.waitUntilDone();
+      function foo() {
+        document.getElementById('elm').scrollLeft = 200;
+        if (window.testRunner)
+          testRunner.notifyDone();
+      }
+    </script>
+  </head>
+  <body _onload_="foo()">
+    <p>There should be <b>two</b> black squares below.</p>
+    <div id="elm" class="mc">
+      <div style="height:600px;background-color:silver"></div>
+    </div>
+  </body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/platform/mac/fast/multicol/scrolling-column-rules-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/multicol/scrolling-column-rules-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/fast/multicol/scrolling-column-rules-expected.txt (0 => 167820)


--- trunk/LayoutTests/platform/mac/fast/multicol/scrolling-column-rules-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/multicol/scrolling-column-rules-expected.txt	2014-04-25 21:05:59 UTC (rev 167820)
@@ -0,0 +1,19 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x158
+  RenderBlock {HTML} at (0,0) size 800x158
+    RenderBody {BODY} at (8,16) size 784x134
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 106x18
+          text run at (0,0) width 106: "There should be "
+        RenderInline {B} at (0,0) size 25x18
+          RenderText {#text} at (106,0) size 25x18
+            text run at (106,0) width 25: "two"
+        RenderText {#text} at (131,0) size 136x18
+          text run at (131,0) width 136: " black squares below."
+layer at (8,50) size 784x100 scrollX 200 scrollWidth 2572
+  RenderBlock {DIV} at (0,34) size 784x100
+    RenderMultiColumnSet at (0,0) size 784x100
+layer at (-192,50) size 337x600 backgroundClip at (8,50) size 784x100 clip at (8,50) size 784x100 outlineClip at (8,50) size 784x100
+  RenderMultiColumnFlowThread at (0,0) size 337x600
+    RenderBlock {DIV} at (0,0) size 337x600 [bgcolor=#C0C0C0]

Modified: trunk/Source/WebCore/ChangeLog (167819 => 167820)


--- trunk/Source/WebCore/ChangeLog	2014-04-25 20:34:47 UTC (rev 167819)
+++ trunk/Source/WebCore/ChangeLog	2014-04-25 21:05:59 UTC (rev 167820)
@@ -1,3 +1,30 @@
+2014-04-25  David Hyatt  <hy...@apple.com>
+
+        Column rules not respecting scroll offsets.
+        https://bugs.webkit.org/show_bug.cgi?id=109683
+
+        Reviewed by Dean Jackson.
+
+        Added fast/multicol/scrolling-column-rules.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::paintColumnRules):
+        Make paintColumnRules virtual so that it works with both column implementations.
+
+        (WebCore::RenderBlock::paintObject):
+        Changed to call paintColumnRules with the adjusted scroll offset and to do it after
+        bailing on the root background only check.
+
+        * rendering/RenderBlock.h:
+        paintColumnRules is now virtual.
+
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::paintColumnRules):
+        (WebCore::RenderBlockFlow::paintBoxDecorations): Deleted.
+        * rendering/RenderBlockFlow.h:
+        Got rid of paintBoxDecorations override since it failed when hasBoxDecorations was false
+        anyway. Override paintColumnRules instead to paint at the right time.
+
 2014-04-23  Jon Honeycutt  <jhoneyc...@apple.com>
 
         Crash applying editing commands from iframe onload event

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (167819 => 167820)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2014-04-25 20:34:47 UTC (rev 167819)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2014-04-25 21:05:59 UTC (rev 167820)
@@ -1826,7 +1826,7 @@
 
 void RenderBlock::paintColumnRules(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
-    if (paintInfo.context->paintingDisabled())
+    if (!hasColumns() || paintInfo.context->paintingDisabled())
         return;
 
     const Color& ruleColor = style().visitedDependentColor(CSSPropertyWebkitColumnRuleColor);
@@ -2113,8 +2113,6 @@
             if (didClipToRegion)
                 paintInfo.context->restore();
         }
-        if (hasColumns() && !paintInfo.paintRootBackgroundOnly())
-            paintColumnRules(paintInfo, paintOffset);
     }
 
     if (paintPhase == PaintPhaseMask && style().visibility() == VISIBLE) {
@@ -2122,14 +2120,24 @@
         return;
     }
 
-    // We're done.  We don't bother painting any children.
-    if (paintPhase == PaintPhaseBlockBackground || paintInfo.paintRootBackgroundOnly())
+    // If just painting the root background, then return.
+    if (paintInfo.paintRootBackgroundOnly())
         return;
 
     // Adjust our painting position if we're inside a scrolled layer (e.g., an overflow:auto div).
     LayoutPoint scrolledOffset = paintOffset;
     scrolledOffset.move(-scrolledContentOffset());
 
+    // Column rules need to account for scrolling and clipping.
+    // FIXME: Clipping of column rules does not work. We will need a separate paint phase for column rules I suspect in order to get
+    // clipping correct (since it has to paint as background but is still considered "contents").
+    if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground) && style().visibility() == VISIBLE)
+        paintColumnRules(paintInfo, scrolledOffset);
+
+    // Done with backgrounds, borders and column rules.
+    if (paintPhase == PaintPhaseBlockBackground)
+        return;
+    
     // 2. paint contents
     if (paintPhase != PaintPhaseSelfOutline) {
         if (hasColumns())

Modified: trunk/Source/WebCore/rendering/RenderBlock.h (167819 => 167820)


--- trunk/Source/WebCore/rendering/RenderBlock.h	2014-04-25 20:34:47 UTC (rev 167819)
+++ trunk/Source/WebCore/rendering/RenderBlock.h	2014-04-25 21:05:59 UTC (rev 167820)
@@ -483,7 +483,7 @@
     virtual void paintInlineChildren(PaintInfo&, const LayoutPoint&) { }
     void paintContents(PaintInfo&, const LayoutPoint&);
     void paintColumnContents(PaintInfo&, const LayoutPoint&, bool paintFloats = false);
-    void paintColumnRules(PaintInfo&, const LayoutPoint&);
+    virtual void paintColumnRules(PaintInfo&, const LayoutPoint&);
     void paintSelection(PaintInfo&, const LayoutPoint&);
     void paintCaret(PaintInfo&, const LayoutPoint&, CaretType);
 

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (167819 => 167820)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2014-04-25 20:34:47 UTC (rev 167819)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2014-04-25 21:05:59 UTC (rev 167820)
@@ -1997,13 +1997,13 @@
     }
 }
 
-void RenderBlockFlow::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& point)
+void RenderBlockFlow::paintColumnRules(PaintInfo& paintInfo, const LayoutPoint& point)
 {
-    RenderBlock::paintBoxDecorations(paintInfo, point);
+    RenderBlock::paintColumnRules(paintInfo, point);
     
-    if (!multiColumnFlowThread() || !paintInfo.shouldPaintWithinRoot(*this))
+    if (!multiColumnFlowThread() || paintInfo.context->paintingDisabled())
         return;
-    
+
     // Iterate over our children and paint the column rules as needed.
     for (auto& columnSet : childrenOfType<RenderMultiColumnSet>(*this)) {
         LayoutPoint childPoint = columnSet.location() + flipForWritingModeForChild(&columnSet, point);

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (167819 => 167820)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.h	2014-04-25 20:34:47 UTC (rev 167819)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h	2014-04-25 21:05:59 UTC (rev 167820)
@@ -82,7 +82,7 @@
     virtual void dirtyLinesFromChangedChild(RenderObject* child) override final { lineBoxes().dirtyLinesFromChangedChild(this, child); }
     virtual void updateLogicalHeight() override;
 
-    virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&) override;
+    virtual void paintColumnRules(PaintInfo&, const LayoutPoint&) override;
 
 public:
     class MarginValues {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to