[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

hamaji at chromium.org hamaji at chromium.org
Wed Apr 7 23:33:16 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 1f16d5604d1160614173f727e408b42d4ccfb616
Author: hamaji at chromium.org <hamaji at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Nov 12 08:15:48 2009 +0000

    2009-11-12  Yuta Kitamura  <yutak at chromium.org>
    
            Reviewed by Eric Seidel.
    
            Prevent text inside a multi-column block from being split into columns.
    
            If the tentative height of a multi-column block was too small, we need to
            expand the block height and try to layout again, in order to prevent text
            from being split into different columns.
    
            CSS Multicolumn text is split awkwardly
            https://bugs.webkit.org/show_bug.cgi?id=22249
    
            * fast/multicol/single-line.html: Added.
            * fast/multicol/single-line-expected.checksum: Added.
            * fast/multicol/single-line-expected.png: Added.
            * fast/multicol/single-line-expected.txt: Added.
    2009-11-12  Yuta Kitamura  <yutak at chromium.org>
    
            Reviewed by Eric Seidel.
    
            Prevent text inside a multi-column block from being split into columns.
    
            If the tentative height of a multi-column block was too small, we need to
            expand the block height and try to layout again, in order to prevent text
            from being split into different columns.
    
            CSS Multicolumn text is split awkwardly
            https://bugs.webkit.org/show_bug.cgi?id=22249
    
            Test: fast/multicol/single-line.html
    
            * rendering/RenderBlock.cpp:
            (WebCore::RenderBlock::layoutColumns):
            * rendering/RenderBlock.h:
            * rendering/RenderLineBoxList.cpp:
            (WebCore::RenderLineBoxList::paint):
            * rendering/RenderView.h:
            (WebCore::RenderView::setTruncatedAt):
            (WebCore::RenderView::setMinimumColumnHeight):
            (WebCore::RenderView::minimumColumnHeight):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50869 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 8ac9d65..c632ba5 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,21 @@
+2009-11-12  Yuta Kitamura  <yutak at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Prevent text inside a multi-column block from being split into columns.
+        
+        If the tentative height of a multi-column block was too small, we need to
+        expand the block height and try to layout again, in order to prevent text
+        from being split into different columns.
+
+        CSS Multicolumn text is split awkwardly
+        https://bugs.webkit.org/show_bug.cgi?id=22249
+
+        * fast/multicol/single-line.html: Added.
+        * fast/multicol/single-line-expected.checksum: Added.
+        * fast/multicol/single-line-expected.png: Added.
+        * fast/multicol/single-line-expected.txt: Added.
+
 2009-11-11  Kent Tamura  <tkent at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/fast/multicol/single-line-expected.checksum b/LayoutTests/fast/multicol/single-line-expected.checksum
new file mode 100644
index 0000000..268a722
--- /dev/null
+++ b/LayoutTests/fast/multicol/single-line-expected.checksum
@@ -0,0 +1 @@
+0f84ceccbd6cc6e8ebba290abfedc025
\ No newline at end of file
diff --git a/LayoutTests/fast/multicol/single-line-expected.png b/LayoutTests/fast/multicol/single-line-expected.png
new file mode 100644
index 0000000..9780683
Binary files /dev/null and b/LayoutTests/fast/multicol/single-line-expected.png differ
diff --git a/LayoutTests/fast/multicol/single-line-expected.txt b/LayoutTests/fast/multicol/single-line-expected.txt
new file mode 100644
index 0000000..40d3753
--- /dev/null
+++ b/LayoutTests/fast/multicol/single-line-expected.txt
@@ -0,0 +1,37 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x290
+  RenderBlock {HTML} at (0,0) size 800x290
+    RenderBody {BODY} at (8,16) size 784x258
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 764x18
+          text run at (0,0) width 389: "This test checks if CSS3 multi-column layout properly works "
+          text run at (389,0) width 375: "when the multi-column block contains only one line of text."
+      RenderBlock {P} at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 555x18
+          text run at (0,0) width 298: "Test successful if the following text is readable "
+          text run at (298,0) width 257: "(i.e. not split into two different columns)."
+      RenderBlock {P} at (0,68) size 784x18 [bgcolor=#EEEEEE]
+        RenderText {#text} at (0,0) size 65x18
+          text run at (0,0) width 65: "Short text."
+      RenderBlock {P} at (0,102) size 784x36 [bgcolor=#EEEEEE]
+        RenderInline {SPAN} at (0,0) size 141x36
+          RenderText {#text} at (0,0) size 141x36
+            text run at (0,0) width 141: "Bigger text."
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {P} at (0,154) size 784x36 [bgcolor=#EEEEEE]
+        RenderText {#text} at (0,14) size 56x18
+          text run at (0,14) width 56: "Partially "
+        RenderInline {SPAN} at (0,0) size 38x36
+          RenderText {#text} at (56,0) size 38x36
+            text run at (56,0) width 38: "big"
+        RenderText {#text} at (94,14) size 31x18
+          text run at (94,14) width 31: " text."
+      RenderBlock {DIV} at (0,206) size 784x18 [bgcolor=#EEEEEE]
+        RenderBlock {P} at (0,0) size 184x18
+          RenderText {#text} at (0,0) size 87x18
+            text run at (0,0) width 87: "Nested block."
+      RenderBlock {DIV} at (0,240) size 784x18
+        RenderBlock {P} at (0,0) size 784x18 [bgcolor=#EEEEEE]
+          RenderText {#text} at (0,0) size 107x18
+            text run at (0,0) width 107: "Nested block #2."
diff --git a/LayoutTests/fast/multicol/single-line.html b/LayoutTests/fast/multicol/single-line.html
new file mode 100644
index 0000000..0a41f93
--- /dev/null
+++ b/LayoutTests/fast/multicol/single-line.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+    "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    <title>CSS3 Multi-column Layout: Single line test</title>
+    <style type="text/css">
+      .multicol {
+        -webkit-columns: 4;
+        -webkit-column-rule: #bbb 1px solid;
+        background-color: #eee;
+      }
+      p, div {
+        margin-top: 1em;
+        margin-bottom: 1em;
+      }
+      .large {
+        font-size: 30px;
+      }
+    </style>
+  </head>
+  <body>
+    <p>
+      This test checks if CSS3 multi-column layout properly works
+      when the multi-column block contains only one line of text.
+    </p>
+    <p>
+      Test successful if the following text is readable
+      (i.e. not split into two different columns).
+    </p>
+    <p class="multicol">
+      Short text.
+    </p>
+    <p class="multicol">
+      <span class="large">Bigger text.</span>
+    </p>
+    <p class="multicol">
+      Partially <span class="large">big</span> text.
+    </p>
+    <div class="multicol">
+      <p>Nested block.</p>
+    </div>
+    <div>
+      <p class="multicol">Nested block #2.</p>
+    </div>
+  </body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6953867..1458196 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,28 @@
+2009-11-12  Yuta Kitamura  <yutak at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Prevent text inside a multi-column block from being split into columns.
+        
+        If the tentative height of a multi-column block was too small, we need to
+        expand the block height and try to layout again, in order to prevent text
+        from being split into different columns.
+
+        CSS Multicolumn text is split awkwardly
+        https://bugs.webkit.org/show_bug.cgi?id=22249
+
+        Test: fast/multicol/single-line.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::layoutColumns):
+        * rendering/RenderBlock.h:
+        * rendering/RenderLineBoxList.cpp:
+        (WebCore::RenderLineBoxList::paint):
+        * rendering/RenderView.h:
+        (WebCore::RenderView::setTruncatedAt):
+        (WebCore::RenderView::setMinimumColumnHeight):
+        (WebCore::RenderView::minimumColumnHeight):
+
 2009-11-11  Kent Tamura  <tkent at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp
index 470358d..a8407d1 100644
--- a/WebCore/rendering/RenderBlock.cpp
+++ b/WebCore/rendering/RenderBlock.cpp
@@ -3617,7 +3617,7 @@ Vector<IntRect>* RenderBlock::columnRects() const
     return &gColumnInfoMap->get(this)->m_columnRects;    
 }
 
-int RenderBlock::layoutColumns(int endOfContent)
+int RenderBlock::layoutColumns(int endOfContent, int requestedColumnHeight)
 {
     // Don't do anything if we have no columns
     if (!hasColumns())
@@ -3630,17 +3630,20 @@ int RenderBlock::layoutColumns(int endOfContent)
     
     bool computeIntrinsicHeight = (endOfContent == -1);
 
-    // Fill the columns in to the available height.  Attempt to balance the height of the columns
-    int availableHeight = contentHeight();
-    int colHeight = computeIntrinsicHeight ? availableHeight / desiredColumnCount : availableHeight;
-    
+    // Fill the columns in to the available height.  Attempt to balance the height of the columns.
     // Add in half our line-height to help with best-guess initial balancing.
     int columnSlop = lineHeight(false) / 2;
     int remainingSlopSpace = columnSlop * desiredColumnCount;
+    int availableHeight = contentHeight();
+    int colHeight;
+    if (computeIntrinsicHeight && requestedColumnHeight >= 0)
+        colHeight = requestedColumnHeight;
+    else if (computeIntrinsicHeight)
+        colHeight = availableHeight / desiredColumnCount + columnSlop;
+    else
+        colHeight = availableHeight;
+    int originalColHeight = colHeight;
 
-    if (computeIntrinsicHeight)
-        colHeight += columnSlop;
-                                                                            
     int colGap = columnGap();
 
     // Compute a collection of column rects.
@@ -3656,7 +3659,8 @@ int RenderBlock::layoutColumns(int endOfContent)
     int currY = top;
     unsigned colCount = desiredColumnCount;
     int maxColBottom = borderTop() + paddingTop();
-    int contentBottom = top + availableHeight; 
+    int contentBottom = top + availableHeight;
+    int minimumColumnHeight = -1;
     for (unsigned i = 0; i < colCount; i++) {
         // If we aren't constrained, then the last column can just get all the remaining space.
         if (computeIntrinsicHeight && i == colCount - 1)
@@ -3676,6 +3680,11 @@ int RenderBlock::layoutColumns(int endOfContent)
         paintObject(paintInfo, 0, 0);
         setHasColumns(true);
 
+        if (computeIntrinsicHeight && v->minimumColumnHeight() > originalColHeight) {
+            // The initial column height was too small to contain one line of text.
+            minimumColumnHeight = max(minimumColumnHeight, v->minimumColumnHeight());
+        }
+
         int adjustedBottom = v->bestTruncatedAt();
         if (adjustedBottom <= currY)
             adjustedBottom = currY + colHeight;
@@ -3712,6 +3721,11 @@ int RenderBlock::layoutColumns(int endOfContent)
             colCount++;
     }
 
+    if (minimumColumnHeight >= 0) {
+        // If originalColHeight was too small, we need to try to layout again.
+        return layoutColumns(endOfContent, minimumColumnHeight);
+    }
+
     int overflowRight = max(width(), currX - colGap);
     int overflowLeft = min(0, currX + desiredColumnWidth + colGap);
     int overflowHeight = maxColBottom;
diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h
index 050ab38..06f9652 100644
--- a/WebCore/rendering/RenderBlock.h
+++ b/WebCore/rendering/RenderBlock.h
@@ -368,7 +368,7 @@ private:
     void offsetForContents(int& tx, int& ty) const;
 
     void calcColumnWidth();
-    int layoutColumns(int endOfContent = -1);
+    int layoutColumns(int endOfContent = -1, int requestedColumnHeight = -1);
 
     bool expandsToEncloseOverhangingFloats() const;
 
diff --git a/WebCore/rendering/RenderLineBoxList.cpp b/WebCore/rendering/RenderLineBoxList.cpp
index 76a2e2f..57bc26c 100644
--- a/WebCore/rendering/RenderLineBoxList.cpp
+++ b/WebCore/rendering/RenderLineBoxList.cpp
@@ -199,6 +199,7 @@ void RenderLineBoxList::paint(RenderBoxModelObject* renderer, RenderObject::Pain
         int bottom = curr->bottomVisibleOverflow() + renderer->maximalOutlineSize(info.phase);
         h = bottom - top;
         yPos = ty + top;
+        v->setMinimumColumnHeight(h);
         if (yPos < info.rect.bottom() && yPos + h > info.rect.y())
             curr->paint(info, tx, ty);
     }
diff --git a/WebCore/rendering/RenderView.h b/WebCore/rendering/RenderView.h
index 3e4adde..6b8da14 100644
--- a/WebCore/rendering/RenderView.h
+++ b/WebCore/rendering/RenderView.h
@@ -75,9 +75,11 @@ public:
     bool printing() const;
     void setPrintImages(bool enable) { m_printImages = enable; }
     bool printImages() const { return m_printImages; }
-    void setTruncatedAt(int y) { m_truncatedAt = y; m_bestTruncatedAt = m_truncatorWidth = 0; m_forcedPageBreak = false; }
+    void setTruncatedAt(int y) { m_truncatedAt = y; m_bestTruncatedAt = m_truncatorWidth = 0; m_minimumColumnHeight = 0; m_forcedPageBreak = false; }
     void setBestTruncatedAt(int y, RenderBoxModelObject* forRenderer, bool forcedBreak = false);
+    void setMinimumColumnHeight(int height) { m_minimumColumnHeight = height; }
     int bestTruncatedAt() const { return m_bestTruncatedAt; }
+    int minimumColumnHeight() const { return m_minimumColumnHeight; }
 
     int truncatedAt() const { return m_truncatedAt; }
 
@@ -195,6 +197,7 @@ private:
 
     int m_bestTruncatedAt;
     int m_truncatorWidth;
+    int m_minimumColumnHeight;
     bool m_forcedPageBreak;
     LayoutState* m_layoutState;
     unsigned m_layoutStateDisableCount;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list