[New Multicolumn] Update sets' flow thread portion rectangles properly.

logicalHeightOfAllFlowThreadContent() was wrong. This still doesn't matter
much, but it will once we have support for multiple sets (column-span:all).

Review URL: https://codereview.chromium.org/265293005

git-svn-id: svn://svn.chromium.org/blink/trunk@173769 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/third_party/WebKit/Source/core/rendering/RenderFlowThread.cpp b/third_party/WebKit/Source/core/rendering/RenderFlowThread.cpp
index 0cf04c5..0be18546 100644
--- a/third_party/WebKit/Source/core/rendering/RenderFlowThread.cpp
+++ b/third_party/WebKit/Source/core/rendering/RenderFlowThread.cpp
@@ -128,8 +128,6 @@
 {
     m_pageLogicalSizeChanged = m_regionsInvalidated && everHadLayout();
 
-    validateRegions();
-
     CurrentRenderFlowThreadMaintainer currentFlowThreadSetter(this);
     RenderBlockFlow::layout();
 
diff --git a/third_party/WebKit/Source/core/rendering/RenderMultiColumnSet.cpp b/third_party/WebKit/Source/core/rendering/RenderMultiColumnSet.cpp
index 24dffef..7ffece20 100644
--- a/third_party/WebKit/Source/core/rendering/RenderMultiColumnSet.cpp
+++ b/third_party/WebKit/Source/core/rendering/RenderMultiColumnSet.cpp
@@ -302,6 +302,16 @@
     setFlowThreadPortionRect(LayoutRect(rect.x(), rect.y(), isHorizontal ? rect.width() : logicalHeightWithOverflow, isHorizontal ? logicalHeightWithOverflow : rect.height()));
 }
 
+void RenderMultiColumnSet::layout()
+{
+    RenderRegion::layout();
+
+    if (!nextSiblingMultiColumnSet()) {
+        // This is the last set, i.e. the last region. Seize the opportunity to validate them.
+        multiColumnFlowThread()->validateRegions();
+    }
+}
+
 void RenderMultiColumnSet::computeLogicalHeight(LayoutUnit, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
 {
     computedValues.m_extent = m_computedColumnHeight;
diff --git a/third_party/WebKit/Source/core/rendering/RenderMultiColumnSet.h b/third_party/WebKit/Source/core/rendering/RenderMultiColumnSet.h
index e7079dc..a750eff 100644
--- a/third_party/WebKit/Source/core/rendering/RenderMultiColumnSet.h
+++ b/third_party/WebKit/Source/core/rendering/RenderMultiColumnSet.h
@@ -67,6 +67,8 @@
 
     LayoutUnit logicalBottomInFlowThread() const { return isHorizontalWritingMode() ? flowThreadPortionRect().maxY() : flowThreadPortionRect().maxX(); }
 
+    LayoutUnit logicalHeightInFlowThread() const { return isHorizontalWritingMode() ? flowThreadPortionRect().height() : flowThreadPortionRect().width(); }
+
     unsigned computedColumnCount() const { return m_computedColumnCount; }
     LayoutUnit computedColumnWidth() const { return m_computedColumnWidth; }
     LayoutUnit computedColumnHeight() const { return m_computedColumnHeight; }
@@ -112,6 +114,7 @@
 private:
     RenderMultiColumnSet(RenderFlowThread*);
 
+    virtual void layout() OVERRIDE;
     virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE;
 
     virtual void paintObject(PaintInfo&, const LayoutPoint& paintOffset) OVERRIDE;
@@ -121,8 +124,7 @@
 
     virtual LayoutUnit pageLogicalTopForOffset(LayoutUnit offset) const OVERRIDE;
 
-    // FIXME: This will change once we have column sets constrained by enclosing pages, etc.
-    virtual LayoutUnit logicalHeightOfAllFlowThreadContent() const OVERRIDE { return m_computedColumnHeight; }
+    virtual LayoutUnit logicalHeightOfAllFlowThreadContent() const OVERRIDE { return logicalHeightInFlowThread(); }
 
     virtual void repaintFlowThreadContent(const LayoutRect& repaintRect) const OVERRIDE;