Title: [143506] trunk
Revision
143506
Author
[email protected]
Date
2013-02-20 14:16:55 -0800 (Wed, 20 Feb 2013)

Log Message

[New Multicolumn] Resize RenderMultiColumnSets around their columns.
https://bugs.webkit.org/show_bug.cgi?id=110378.

Reviewed by Dirk Schulze.

Source/WebCore: 

Test: fast/multicol/newmulticol/positioned-with-constrained-height.html.

* rendering/RenderBlock.h:
(RenderBlock):
Make computeOverflow public so that RenderMultiColumnFlowThread can
access it.

* rendering/RenderMultiColumnFlowThread.cpp:
(WebCore::RenderMultiColumnFlowThread::layout):
Subclass layout to recompute the overflow for RenderMultiColumnBlock
after the flow thread has finished layout. This way it can account
for changes in RenderMultiColumnSets without having to do a second
layout pass.

* rendering/RenderMultiColumnFlowThread.h:
(RenderMultiColumnFlowThread):
Override layout().

* rendering/RenderMultiColumnSet.cpp:
(WebCore::RenderMultiColumnSet::columnCount):
Clean up a comment that referred to portions as region rects still.

(WebCore::RenderMultiColumnSet::setFlowThreadPortionRect):
* rendering/RenderMultiColumnSet.h:
* rendering/RenderRegion.h:
(WebCore::RenderRegion::setFlowThreadPortionRect):
Make setFlowThreadPortionRect virtual and actually mutate the size
and position of RenderMultiColumnSets so that they enclose their
column rects.

LayoutTests: 

* fast/multicol/newmulticol/positioned-with-constrained-height-expected.html: Added.
* fast/multicol/newmulticol/positioned-with-constrained-height.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (143505 => 143506)


--- trunk/LayoutTests/ChangeLog	2013-02-20 22:14:04 UTC (rev 143505)
+++ trunk/LayoutTests/ChangeLog	2013-02-20 22:16:55 UTC (rev 143506)
@@ -1,3 +1,13 @@
+2013-02-20  David Hyatt  <[email protected]>
+
+        [New Multicolumn] Resize RenderMultiColumnSets around their columns.
+        https://bugs.webkit.org/show_bug.cgi?id=110378.
+
+        Reviewed by Dirk Schulze.
+
+        * fast/multicol/newmulticol/positioned-with-constrained-height-expected.html: Added.
+        * fast/multicol/newmulticol/positioned-with-constrained-height.html: Added.
+
 2013-02-20  Dirk Schulze  <[email protected]>
 
         Enable CANVAS_PATH flag

Added: trunk/LayoutTests/fast/multicol/newmulticol/positioned-with-constrained-height-expected.html (0 => 143506)


--- trunk/LayoutTests/fast/multicol/newmulticol/positioned-with-constrained-height-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/positioned-with-constrained-height-expected.html	2013-02-20 22:16:55 UTC (rev 143506)
@@ -0,0 +1,138 @@
+<body style="overflow:hidden; font-size:12px">
+<div style="-moz-column-width:100px; -webkit-column-width:100px;height:150px; position:absolute; background-color:lime">
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+</div>
\ No newline at end of file

Added: trunk/LayoutTests/fast/multicol/newmulticol/positioned-with-constrained-height.html (0 => 143506)


--- trunk/LayoutTests/fast/multicol/newmulticol/positioned-with-constrained-height.html	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/positioned-with-constrained-height.html	2013-02-20 22:16:55 UTC (rev 143506)
@@ -0,0 +1,141 @@
+<script>
+internals.settings.setRegionBasedColumnsEnabled(true)
+</script>
+<body style="overflow:hidden; font-size:12px">
+<div style="-moz-column-width:100px; -webkit-column-width:100px;height:150px; position:absolute; background-color:lime">
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+This is some text<br>
+</div>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (143505 => 143506)


--- trunk/Source/WebCore/ChangeLog	2013-02-20 22:14:04 UTC (rev 143505)
+++ trunk/Source/WebCore/ChangeLog	2013-02-20 22:16:55 UTC (rev 143506)
@@ -1,3 +1,40 @@
+2013-02-20  David Hyatt  <[email protected]>
+
+        [New Multicolumn] Resize RenderMultiColumnSets around their columns.
+        https://bugs.webkit.org/show_bug.cgi?id=110378.
+
+        Reviewed by Dirk Schulze.
+
+        Test: fast/multicol/newmulticol/positioned-with-constrained-height.html.
+
+        * rendering/RenderBlock.h:
+        (RenderBlock):
+        Make computeOverflow public so that RenderMultiColumnFlowThread can
+        access it.
+
+        * rendering/RenderMultiColumnFlowThread.cpp:
+        (WebCore::RenderMultiColumnFlowThread::layout):
+        Subclass layout to recompute the overflow for RenderMultiColumnBlock
+        after the flow thread has finished layout. This way it can account
+        for changes in RenderMultiColumnSets without having to do a second
+        layout pass.
+
+        * rendering/RenderMultiColumnFlowThread.h:
+        (RenderMultiColumnFlowThread):
+        Override layout().
+
+        * rendering/RenderMultiColumnSet.cpp:
+        (WebCore::RenderMultiColumnSet::columnCount):
+        Clean up a comment that referred to portions as region rects still.
+
+        (WebCore::RenderMultiColumnSet::setFlowThreadPortionRect):
+        * rendering/RenderMultiColumnSet.h:
+        * rendering/RenderRegion.h:
+        (WebCore::RenderRegion::setFlowThreadPortionRect):
+        Make setFlowThreadPortionRect virtual and actually mutate the size
+        and position of RenderMultiColumnSets so that they enclose their
+        column rects.
+
 2013-02-20  Dirk Schulze  <[email protected]>
 
         Enable CANVAS_PATH flag

Modified: trunk/Source/WebCore/rendering/RenderBlock.h (143505 => 143506)


--- trunk/Source/WebCore/rendering/RenderBlock.h	2013-02-20 22:14:04 UTC (rev 143505)
+++ trunk/Source/WebCore/rendering/RenderBlock.h	2013-02-20 22:16:55 UTC (rev 143506)
@@ -525,7 +525,9 @@
 
     void setDesiredColumnCountAndWidth(int, LayoutUnit);
 
+public:
     void computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFloats = false);
+protected:
     virtual void addOverflowFromChildren();
     void addOverflowFromFloats();
     void addOverflowFromPositionedObjects();

Modified: trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp (143505 => 143506)


--- trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp	2013-02-20 22:14:04 UTC (rev 143505)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp	2013-02-20 22:16:55 UTC (rev 143506)
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "RenderMultiColumnFlowThread.h"
 
+#include "RenderMultiColumnBlock.h"
+
 namespace WebCore {
 
 RenderMultiColumnFlowThread::RenderMultiColumnFlowThread(Document* document)
@@ -49,4 +51,17 @@
     computedValues.m_position = logicalTop;
 }
 
+void RenderMultiColumnFlowThread::layout()
+{
+    RenderFlowThread::layout();
+    
+    // Now that flow thread portions have been determined, we may have changed the dimensions of some of our multi-column sets.
+    // We need to make the RenderMultiColumnBlock recompute its overflow because some of these sets may be spilling out of the
+    // block.
+    RenderMultiColumnBlock* colBlock = toRenderMultiColumnBlock(parent());
+    if (!colBlock)
+        return;
+    colBlock->computeOverflow(colBlock->clientLogicalBottom());
 }
+
+}

Modified: trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.h (143505 => 143506)


--- trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.h	2013-02-20 22:14:04 UTC (rev 143505)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.h	2013-02-20 22:16:55 UTC (rev 143506)
@@ -38,8 +38,9 @@
 
 private:
     virtual const char* renderName() const OVERRIDE;
+    virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE;
     
-    virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE;
+    virtual void layout() OVERRIDE;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp (143505 => 143506)


--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp	2013-02-20 22:14:04 UTC (rev 143505)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp	2013-02-20 22:16:55 UTC (rev 143506)
@@ -31,8 +31,7 @@
 #include "RenderMultiColumnBlock.h"
 #include "RenderMultiColumnFlowThread.h"
 
-using std::min;
-using std::max;
+using namespace std;
 
 namespace WebCore {
 
@@ -111,7 +110,7 @@
     if (!computedColumnHeight())
         return 0;
     
-    // Our region rect determines our column count. We have as many columns as needed to fit all the content.
+    // Our portion rect determines our column count. We have as many columns as needed to fit all the content.
     LayoutUnit logicalHeightInColumns = flowThread()->isHorizontalWritingMode() ? flowThreadPortionRect().height() : flowThreadPortionRect().width();
     return ceil(static_cast<float>(logicalHeightInColumns) / computedColumnHeight());
 }
@@ -210,6 +209,31 @@
     return overflowRectForFlowThreadPortion(overflowRect, isFirstRegion() && isFirstColumn, isLastRegion() && isLastColumn);
 }
 
+void RenderMultiColumnSet::setFlowThreadPortionRect(const LayoutRect& rect)
+{
+    RenderRegion::setFlowThreadPortionRect(rect);
+    
+    // Mutate the dimensions of the column set once our flow portion is set if the flow portion has more columns
+    // than can fit inside our current dimensions.
+    unsigned colCount = columnCount();
+    if (!colCount)
+        return;
+    
+    LayoutUnit colGap = columnGap();
+    LayoutUnit minimumContentLogicalWidth = colCount * computedColumnWidth() + (colCount - 1) * colGap;
+    LayoutUnit currentContentLogicalWidth = contentLogicalWidth();
+    LayoutUnit delta = max(LayoutUnit(), minimumContentLogicalWidth - currentContentLogicalWidth);
+    if (!delta)
+        return;
+
+    // Increase our logical width by the delta.
+    setLogicalWidth(logicalWidth() + delta);
+    
+    // Shift our position left by the delta if we are RTL.
+    if (!style()->isLeftToRightDirection())
+        setLogicalLeft(logicalLeft() - delta);
+}
+
 void RenderMultiColumnSet::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
     if (style()->visibility() != VISIBLE)

Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.h (143505 => 143506)


--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.h	2013-02-20 22:14:04 UTC (rev 143505)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.h	2013-02-20 22:16:55 UTC (rev 143506)
@@ -118,6 +118,7 @@
 
     LayoutRect flowThreadPortionRectAt(unsigned index) const;
     LayoutRect flowThreadPortionOverflowRect(const LayoutRect& flowThreadPortion, unsigned index, unsigned colCount, LayoutUnit colGap) const;
+    virtual void setFlowThreadPortionRect(const LayoutRect&) OVERRIDE;
     
     unsigned columnIndexAtOffset(LayoutUnit) const;
     

Modified: trunk/Source/WebCore/rendering/RenderRegion.h (143505 => 143506)


--- trunk/Source/WebCore/rendering/RenderRegion.h	2013-02-20 22:14:04 UTC (rev 143505)
+++ trunk/Source/WebCore/rendering/RenderRegion.h	2013-02-20 22:16:55 UTC (rev 143506)
@@ -50,7 +50,7 @@
 
     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
 
-    void setFlowThreadPortionRect(const LayoutRect& rect) { m_flowThreadPortionRect = rect; }
+    virtual void setFlowThreadPortionRect(const LayoutRect& rect) { m_flowThreadPortionRect = rect; }
     LayoutRect flowThreadPortionRect() const { return m_flowThreadPortionRect; }
     LayoutRect flowThreadPortionOverflowRect() const;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to