Title: [136886] trunk/Source/WebCore
Revision
136886
Author
[email protected]
Date
2012-12-06 14:08:33 -0800 (Thu, 06 Dec 2012)

Log Message

[New Multicolumn] Add requiresBalancing booleans to track which column sets need to rebalance.
https://bugs.webkit.org/show_bug.cgi?id=104297

Reviewed by Simon Fraser.

Add requiresBalancing booleans to RenderMultiColumnBlock and RenderMultiColumnSet. For now the former is just propagated
to the latter, but eventually RenderMultiColumnSets will have a notion of balancing that has to be independent of the
owning block (e.g., maybe only the last set rebalances, or maybe only a set that contains the content between two forced
breaks wants to rebalance, etc.).

* rendering/RenderMultiColumnBlock.cpp:
(WebCore::RenderMultiColumnBlock::RenderMultiColumnBlock):
(WebCore::RenderMultiColumnBlock::checkForPaginationLogicalHeightChange):
(WebCore::RenderMultiColumnBlock::ensureColumnSets):
* rendering/RenderMultiColumnBlock.h:
(WebCore::RenderMultiColumnBlock::requiresBalancing):
(RenderMultiColumnBlock):
* rendering/RenderMultiColumnSet.cpp:
(WebCore::RenderMultiColumnSet::RenderMultiColumnSet):
* rendering/RenderMultiColumnSet.h:
(WebCore::RenderMultiColumnSet::requiresBalancing):
(WebCore::RenderMultiColumnSet::setRequiresBalancing):
(RenderMultiColumnSet):
(WebCore::toRenderMultiColumnSet):
(WebCore):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (136885 => 136886)


--- trunk/Source/WebCore/ChangeLog	2012-12-06 22:00:46 UTC (rev 136885)
+++ trunk/Source/WebCore/ChangeLog	2012-12-06 22:08:33 UTC (rev 136886)
@@ -1,3 +1,31 @@
+2012-12-06  David Hyatt  <[email protected]>
+
+        [New Multicolumn] Add requiresBalancing booleans to track which column sets need to rebalance.
+        https://bugs.webkit.org/show_bug.cgi?id=104297
+
+        Reviewed by Simon Fraser.
+
+        Add requiresBalancing booleans to RenderMultiColumnBlock and RenderMultiColumnSet. For now the former is just propagated
+        to the latter, but eventually RenderMultiColumnSets will have a notion of balancing that has to be independent of the
+        owning block (e.g., maybe only the last set rebalances, or maybe only a set that contains the content between two forced
+        breaks wants to rebalance, etc.).
+
+        * rendering/RenderMultiColumnBlock.cpp:
+        (WebCore::RenderMultiColumnBlock::RenderMultiColumnBlock):
+        (WebCore::RenderMultiColumnBlock::checkForPaginationLogicalHeightChange):
+        (WebCore::RenderMultiColumnBlock::ensureColumnSets):
+        * rendering/RenderMultiColumnBlock.h:
+        (WebCore::RenderMultiColumnBlock::requiresBalancing):
+        (RenderMultiColumnBlock):
+        * rendering/RenderMultiColumnSet.cpp:
+        (WebCore::RenderMultiColumnSet::RenderMultiColumnSet):
+        * rendering/RenderMultiColumnSet.h:
+        (WebCore::RenderMultiColumnSet::requiresBalancing):
+        (WebCore::RenderMultiColumnSet::setRequiresBalancing):
+        (RenderMultiColumnSet):
+        (WebCore::toRenderMultiColumnSet):
+        (WebCore):
+
 2012-12-06  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r136871.

Modified: trunk/Source/WebCore/rendering/RenderMultiColumnBlock.cpp (136885 => 136886)


--- trunk/Source/WebCore/rendering/RenderMultiColumnBlock.cpp	2012-12-06 22:00:46 UTC (rev 136885)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnBlock.cpp	2012-12-06 22:08:33 UTC (rev 136886)
@@ -39,6 +39,7 @@
     , m_columnCount(1)
     , m_columnWidth(0)
     , m_columnHeight(0)
+    , m_requiresBalancing(false)
 {
 }
 
@@ -83,7 +84,8 @@
     // We don't actually update any of the variables. We just subclassed to adjust our column height.
     updateLogicalHeight();
     LayoutUnit newContentLogicalHeight = contentLogicalHeight();
-    if (newContentLogicalHeight > 0) {
+    m_requiresBalancing = !newContentLogicalHeight;
+    if (!m_requiresBalancing) {
         // The regions will be invalidated when we lay them out and they change size to
         // the new column height.
         if (columnHeight() != newContentLogicalHeight)
@@ -137,11 +139,16 @@
     // FIXME: For now just make one column set. This matches the old multi-column code.
     // Right now our goal is just feature parity with the old multi-column code so that we can switch over to the
     // new code as soon as possible.
-    if (flowThread() && !firstChild()->isRenderMultiColumnSet()) {
-        RenderMultiColumnSet* columnSet = new (renderArena()) RenderMultiColumnSet(document(), flowThread());
+    if (!flowThread())
+        return;
+
+    RenderMultiColumnSet* columnSet = firstChild()->isRenderMultiColumnSet() ? toRenderMultiColumnSet(firstChild()) : 0;
+    if (!columnSet) {
+        columnSet = new (renderArena()) RenderMultiColumnSet(document(), flowThread());
         columnSet->setStyle(RenderStyle::createAnonymousStyleWithDisplay(style(), BLOCK));
         RenderBlock::addChild(columnSet, firstChild());
     }
+    columnSet->setRequiresBalancing(requiresBalancing());
 }
 
 const char* RenderMultiColumnBlock::renderName() const

Modified: trunk/Source/WebCore/rendering/RenderMultiColumnBlock.h (136885 => 136886)


--- trunk/Source/WebCore/rendering/RenderMultiColumnBlock.h	2012-12-06 22:00:46 UTC (rev 136885)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnBlock.h	2012-12-06 22:08:33 UTC (rev 136886)
@@ -45,6 +45,8 @@
 
     RenderMultiColumnFlowThread* flowThread() const { return m_flowThread; }
 
+    bool requiresBalancing() const { return m_requiresBalancing; }
+
 private:
     virtual bool isRenderMultiColumnBlock() const { return true; }
     
@@ -65,6 +67,7 @@
     LayoutUnit m_columnWidth; // since a multi-column block that is split across variable width pages or regions will have different column counts and widths in each.
                               // These values will be cached (eventually) for multi-column blocks.
     LayoutUnit m_columnHeight; // The current column height.
+    bool m_requiresBalancing; // Whether or not the block specified any kind of logical height. We have to balance by default if it didn't.
 };
 
 inline RenderMultiColumnBlock* toRenderMultiColumnBlock(RenderObject* object)

Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp (136885 => 136886)


--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp	2012-12-06 22:00:46 UTC (rev 136885)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp	2012-12-06 22:08:33 UTC (rev 136886)
@@ -41,6 +41,7 @@
     , m_computedColumnCount(1)
     , m_computedColumnWidth(0)
     , m_computedColumnHeight(0)
+    , m_requiresBalancing(false)
     , m_minimumColumnHeight(0)
     , m_forcedBreaksCount(0)
     , m_maximumDistanceBetweenForcedBreaks(0)

Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.h (136885 => 136886)


--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.h	2012-12-06 22:00:46 UTC (rev 136885)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.h	2012-12-06 22:08:33 UTC (rev 136886)
@@ -84,6 +84,9 @@
         m_forcedBreakOffset = offsetFromFirstPage;
     }
 
+    bool requiresBalancing() const { return m_requiresBalancing; }
+    void setRequiresBalancing(bool balancing) { m_requiresBalancing = balancing; }
+
 private:
     virtual void updateLogicalWidth() OVERRIDE;
     virtual void updateLogicalHeight() OVERRIDE;
@@ -121,12 +124,28 @@
     LayoutUnit m_computedColumnHeight;
     
     // The following variables are used when balancing the column set.
+    bool m_requiresBalancing; // Whether or not the columns in the column set have to be balanced, i.e., made to be similar logical heights.
     LayoutUnit m_minimumColumnHeight;
     unsigned m_forcedBreaksCount; // FIXME: We will ultimately need to cache more information to balance around forced breaks properly.
     LayoutUnit m_maximumDistanceBetweenForcedBreaks;
     LayoutUnit m_forcedBreakOffset;
 };
 
+inline RenderMultiColumnSet* toRenderMultiColumnSet(RenderObject* object)
+{
+    ASSERT(!object || object->isRenderMultiColumnSet());
+    return static_cast<RenderMultiColumnSet*>(object);
+}
+
+inline const RenderMultiColumnSet* toRenderMultiColumnSet(const RenderObject* object)
+{
+    ASSERT(!object || object->isRenderMultiColumnSet());
+    return static_cast<const RenderMultiColumnSet*>(object);
+}
+
+// This will catch anyone doing an unnecessary cast.
+void toRenderMultiColumnSet(const RenderMultiColumnSet*);
+
 } // namespace WebCore
 
 #endif // RenderMultiColumnSet_h
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to