Column height and count calculation ignores most overflow
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Jul 2012 04:08:04 +0000 (04:08 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Jul 2012 04:08:04 +0000 (04:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90392

Reviewed by Dean Jackson.

Source/WebCore:

Test: fast/multicol/overflow-content.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::relayoutForPagination): Changed to compute the overflow from children
and use the layout overflow height rather the content height.

LayoutTests:

* fast/multicol/overflow-content-expected.html: Added.
* fast/multicol/overflow-content.html: Added.
* fast/multicol/vertical-rl/rules-with-border-before-expected.png:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121728 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/multicol/overflow-content-expected.html [new file with mode: 0644]
LayoutTests/fast/multicol/overflow-content.html [new file with mode: 0644]
LayoutTests/fast/multicol/vertical-rl/rules-with-border-before-expected.png
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp

index 56404db..da05c50 100644 (file)
@@ -1,3 +1,14 @@
+2012-07-02  Dan Bernstein  <mitz@apple.com>
+
+        Column height and count calculation ignores most overflow
+        https://bugs.webkit.org/show_bug.cgi?id=90392
+
+        Reviewed by Dean Jackson.
+
+        * fast/multicol/overflow-content-expected.html: Added.
+        * fast/multicol/overflow-content.html: Added.
+        * fast/multicol/vertical-rl/rules-with-border-before-expected.png:
+
 2012-07-02  Yoshifumi Inoue  <yosin@chromium.org>
 
         Build fix for Chromium
diff --git a/LayoutTests/fast/multicol/overflow-content-expected.html b/LayoutTests/fast/multicol/overflow-content-expected.html
new file mode 100644 (file)
index 0000000..70630de
--- /dev/null
@@ -0,0 +1,70 @@
+<style>
+    div.test {
+        -webkit-logical-width: 100px;
+        -webkit-border-before: 5px solid;
+        -webkit-border-after: 15px solid;
+        -webkit-column-count: 2;
+        -webkit-column-gap: 0;
+        background-color: lightblue;
+    }
+    div.container {
+        -webkit-logical-height: 120px;
+        background-color: red;
+        -webkit-logical-width: 100px;
+        -webkit-margin-after: 8px;
+    }
+</style>
+<div>
+    <div class="container">
+        <div class="test" style="-webkit-logical-height: 100px;">
+            <div>
+                <div style="-webkit-logical-height: 300px; background-color: yellow;"></div>
+            </div>
+        </div>
+    </div>
+
+    <div class="container">
+        <div class="test">
+            <div>
+                <div style="-webkit-logical-height: 200px; background-color: yellow;"></div>
+            </div>
+        </div>
+    </div>
+
+    <div class="container">
+        <div class="test">
+            <div style="-webkit-logical-height: 10px;"></div>
+            <div style="-webkit-column-break-before: always;">
+                <div style="-webkit-logical-height: 100px; background-color: yellow;"></div>
+            </div>
+            <div></div>
+        </div>
+    </div>
+</div>
+<div style="-webkit-writing-mode: vertical-rl;">
+    <div class="container">
+        <div class="test" style="-webkit-logical-height: 100px;">
+            <div>
+                <div style="-webkit-logical-height: 300px; background-color: yellow;"></div>
+            </div>
+        </div>
+    </div>
+
+    <div class="container">
+        <div class="test">
+            <div>
+                <div style="-webkit-logical-height: 200px; background-color: yellow;"></div>
+            </div>
+        </div>
+    </div>
+
+    <div class="container">
+        <div class="test">
+            <div style="-webkit-logical-height: 10px;"></div>
+            <div style="-webkit-column-break-before: always;">
+                <div style="-webkit-logical-height: 100px; background-color: yellow;"></div>
+            </div>
+            <div></div>
+        </div>
+    </div>
+</div>
diff --git a/LayoutTests/fast/multicol/overflow-content.html b/LayoutTests/fast/multicol/overflow-content.html
new file mode 100644 (file)
index 0000000..10f7e92
--- /dev/null
@@ -0,0 +1,70 @@
+<style>
+    div.test {
+        -webkit-logical-width: 100px;
+        -webkit-border-before: 5px solid;
+        -webkit-border-after: 15px solid;
+        -webkit-column-count: 2;
+        -webkit-column-gap: 0;
+        background-color: lightblue;
+    }
+    div.container {
+        -webkit-logical-height: 120px;
+        background-color: red;
+        -webkit-logical-width: 100px;
+        -webkit-margin-after: 8px;
+    }
+</style>
+<div>
+    <div class="container">
+        <div class="test" style="-webkit-logical-height: 100px;">
+            <div style="-webkit-logical-height: 20px;">
+                <div style="-webkit-logical-height: 300px; background-color: yellow;"></div>
+            </div>
+        </div>
+    </div>
+
+    <div class="container">
+        <div class="test">
+            <div style="-webkit-logical-height: 20px;">
+                <div style="-webkit-logical-height: 200px; background-color: yellow;"></div>
+            </div>
+        </div>
+    </div>
+
+    <div class="container">
+        <div class="test">
+            <div style="-webkit-logical-height: 10px;"></div>
+            <div style="-webkit-column-break-before: always; -webkit-logical-height: 10px;">
+                <div style="-webkit-logical-height: 100px; background-color: yellow;"></div>
+            </div>
+            <div style="-webkit-logical-height: 20px;"></div>
+        </div>
+    </div>
+</div>
+<div style="-webkit-writing-mode: vertical-rl;">
+    <div class="container">
+        <div class="test" style="-webkit-logical-height: 100px;">
+            <div style="-webkit-logical-height: 20px;">
+                <div style="-webkit-logical-height: 300px; background-color: yellow;"></div>
+            </div>
+        </div>
+    </div>
+
+    <div class="container">
+        <div class="test">
+            <div style="-webkit-logical-height: 20px;">
+                <div style="-webkit-logical-height: 200px; background-color: yellow;"></div>
+            </div>
+        </div>
+    </div>
+
+    <div class="container">
+        <div class="test">
+            <div style="-webkit-logical-height: 10px;"></div>
+            <div style="-webkit-column-break-before: always; -webkit-logical-height: 10px;">
+                <div style="-webkit-logical-height: 100px; background-color: yellow;"></div>
+            </div>
+            <div style="-webkit-logical-height: 20px;"></div>
+        </div>
+    </div>
+</div>
index e9688e0..d162455 100644 (file)
Binary files a/LayoutTests/fast/multicol/vertical-rl/rules-with-border-before-expected.png and b/LayoutTests/fast/multicol/vertical-rl/rules-with-border-before-expected.png differ
index 272d6b7..0237184 100644 (file)
@@ -1,3 +1,16 @@
+2012-07-02  Dan Bernstein  <mitz@apple.com>
+
+        Column height and count calculation ignores most overflow
+        https://bugs.webkit.org/show_bug.cgi?id=90392
+
+        Reviewed by Dean Jackson.
+
+        Test: fast/multicol/overflow-content.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::relayoutForPagination): Changed to compute the overflow from children
+        and use the layout overflow height rather the content height.
+
 2012-07-02  Chris Guan  <chris.guan@torchmobile.com.cn>
 
         [BlackBerry] Refactor : move the implementation of getMIMETypeForExtension and getPreferredExtensionForMIMEType into BlackBerry platform
index f17836d..0c7d894 100755 (executable)
@@ -5083,6 +5083,13 @@ bool RenderBlock::relayoutForPagination(bool hasSpecifiedPageLogicalHeight, Layo
     if (!hasColumns())
         return false;
 
+    OwnPtr<RenderOverflow> savedOverflow = m_overflow.release();
+    if (childrenInline())
+        addOverflowFromInlineChildren();
+    else
+        addOverflowFromBlockChildren();
+    LayoutUnit layoutOverflowLogicalBottom = (isHorizontalWritingMode() ? layoutOverflowRect().maxY() : layoutOverflowRect().maxX()) - borderBefore() - paddingBefore();
+
     // FIXME: We don't balance properly at all in the presence of forced page breaks.  We need to understand what
     // the distance between forced page breaks is so that we can avoid making the minimum column height too tall.
     ColumnInfo* colInfo = columnInfo();
@@ -5095,12 +5102,12 @@ bool RenderBlock::relayoutForPagination(bool hasSpecifiedPageLogicalHeight, Layo
             // maximum page break distance.
             if (!pageLogicalHeight) {
                 LayoutUnit distanceBetweenBreaks = max<LayoutUnit>(colInfo->maximumDistanceBetweenForcedBreaks(),
-                                                                   view()->layoutState()->pageLogicalOffset(this, borderBefore() + paddingBefore() + contentLogicalHeight()) - colInfo->forcedBreakOffset());
+                                                                   view()->layoutState()->pageLogicalOffset(this, borderBefore() + paddingBefore() + layoutOverflowLogicalBottom) - colInfo->forcedBreakOffset());
                 columnHeight = max(colInfo->minimumColumnHeight(), distanceBetweenBreaks);
             }
-        } else if (contentLogicalHeight() > boundedMultiply(pageLogicalHeight, desiredColumnCount)) {
+        } else if (layoutOverflowLogicalBottom > boundedMultiply(pageLogicalHeight, desiredColumnCount)) {
             // Now that we know the intrinsic height of the columns, we have to rebalance them.
-            columnHeight = max<LayoutUnit>(colInfo->minimumColumnHeight(), ceilf((float)contentLogicalHeight() / desiredColumnCount));
+            columnHeight = max<LayoutUnit>(colInfo->minimumColumnHeight(), ceilf((float)layoutOverflowLogicalBottom / desiredColumnCount));
         }
         
         if (columnHeight && columnHeight != pageLogicalHeight) {
@@ -5110,14 +5117,15 @@ bool RenderBlock::relayoutForPagination(bool hasSpecifiedPageLogicalHeight, Layo
             return true;
         }
     } 
-    
+
     if (pageLogicalHeight)
-        colInfo->setColumnCountAndHeight(ceilf((float)contentLogicalHeight() / pageLogicalHeight), pageLogicalHeight);
+        colInfo->setColumnCountAndHeight(ceilf((float)layoutOverflowLogicalBottom / pageLogicalHeight), pageLogicalHeight);
 
     if (columnCount(colInfo)) {
         setLogicalHeight(borderBefore() + paddingBefore() + colInfo->columnHeight() + borderAfter() + paddingAfter() + scrollbarLogicalHeight());
         m_overflow.clear();
-    }
+    } else
+        m_overflow = savedOverflow.release();
     
     return false;
 }