Title: [143484] trunk
Revision
143484
Author
hy...@apple.com
Date
2013-02-20 11:58:16 -0800 (Wed, 20 Feb 2013)

Log Message

[New Multicolumn] Column gap is computed incorrectly.
https://bugs.webkit.org/show_bug.cgi?id=110360.

Reviewed by Simon Fraser.

Source/WebCore: 

Test: fast/multicol/newmulticol/layers-split-across-columns.html.

* rendering/RenderMultiColumnSet.cpp:
(WebCore::RenderMultiColumnSet::columnGap):
Make sure we ask the RenderMultiColumnBlock for the gap rather than our
own style, since we don't actually have the gap value in our style.
        
(WebCore::RenderMultiColumnSet::flowThreadPortionOverflowRect):
* rendering/RenderMultiColumnSet.h:
Fix another spot where the columnGap was an int. It should be a LayoutUnit.

LayoutTests: 

* fast/multicol/newmulticol/layers-split-across-columns-expected.html: Added.
* fast/multicol/newmulticol/layers-split-across-columns.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (143483 => 143484)


--- trunk/LayoutTests/ChangeLog	2013-02-20 19:51:03 UTC (rev 143483)
+++ trunk/LayoutTests/ChangeLog	2013-02-20 19:58:16 UTC (rev 143484)
@@ -1,3 +1,13 @@
+2013-02-20  David Hyatt  <hy...@apple.com>
+
+        [New Multicolumn] Column gap is computed incorrectly.
+        https://bugs.webkit.org/show_bug.cgi?id=110360.
+
+        Reviewed by Simon Fraser.
+
+        * fast/multicol/newmulticol/layers-split-across-columns-expected.html: Added.
+        * fast/multicol/newmulticol/layers-split-across-columns.html: Added.
+
 2013-02-20  Robert Hogan  <rob...@webkit.org>
 
         No caret on empty contenteditable element with negative text-indent

Added: trunk/LayoutTests/fast/multicol/newmulticol/layers-split-across-columns-expected.html (0 => 143484)


--- trunk/LayoutTests/fast/multicol/newmulticol/layers-split-across-columns-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/layers-split-across-columns-expected.html	2013-02-20 19:58:16 UTC (rev 143484)
@@ -0,0 +1,69 @@
+<html>
+<head>
+<style>
+.container { display:inline-block; width:220px; }
+.multicol { -moz-column-width:100px; -webkit-column-width:100px; height:300px; border:5px solid black; -webkit-column-gap: 10px; -moz-column-gap: 10px }
+.block { width:100px; height:100px }
+.block:hover { background-color: maroon !important; }
+.layer { height:400px; width:100px }
+</style>
+<body style="overflow:hidden">
+
+<div class="container">
+Overflow:
+<div class="multicol">
+<div class="block" style="display:inline-block; background-color:black"></div>
+<div style="overflow:hidden;" class="layer">
+<div class="block" style="background-color: #0000f0"></div>
+<div class="block" style="background-color: #0000d0"></div>
+<div class="block" style="background-color: #0000b0"></div>
+<div class="block" style="background-color: #000090"></div>
+</div>
+<div class="block" style="display:inline-block; background-color:black"></div>
+</div>
+</div>
+
+<div class="container">
+Transforms:
+
+<div class="multicol">
+<div class="block" style="display:inline-block; background-color:black"></div>
+<div style="margin-left: -100px; -webkit-transform: translate(100px, 0);" class="layer">
+<div class="block" style="background-color: #0000f0"></div>
+<div class="block" style="background-color: #0000d0"></div>
+<div class="block" style="background-color: #0000b0"></div>
+<div class="block" style="background-color: #000090"></div>
+</div>
+<div class="block" style="display:inline-block; background-color:black"></div>
+</div>
+</div>
+</div>
+
+<div class="container">
+Relative Positioning:
+<div class="multicol">
+<div class="block" style="display:inline-block; background-color:black"></div>
+<div style="position:relative; margin-left:-100px; left:100px" class="layer">
+<div class="block" style="background-color: #0000f0"></div>
+<div class="block" style="background-color: #0000d0"></div>
+<div class="block" style="background-color: #0000b0"></div>
+<div class="block" style="background-color: #000090"></div>
+</div>
+<div class="block" style="display:inline-block; background-color:black"></div>
+</div>
+</div>
+
+<div class="container">
+Opacity:
+
+<div class="multicol">
+<div class="block" style="display:inline-block; background-color:black"></div>
+<div style="opacity:0.99;" class="layer">
+<div class="block" style="background-color: #0000f0"></div>
+<div class="block" style="background-color: #0000d0"></div>
+<div class="block" style="background-color: #0000b0"></div>
+<div class="block" style="background-color: #000090"></div>
+</div>
+<div class="block" style="display:inline-block; background-color:black"></div>
+</div>
+</div>
\ No newline at end of file

Added: trunk/LayoutTests/fast/multicol/newmulticol/layers-split-across-columns.html (0 => 143484)


--- trunk/LayoutTests/fast/multicol/newmulticol/layers-split-across-columns.html	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/layers-split-across-columns.html	2013-02-20 19:58:16 UTC (rev 143484)
@@ -0,0 +1,72 @@
+<html>
+<head>
+<style>
+.container { display:inline-block; width:220px; }
+.multicol { -moz-column-width:100px; -webkit-column-width:100px; height:300px; border:5px solid black; -webkit-column-gap: 10px; -moz-column-gap: 10px }
+.block { width:100px; height:100px }
+.block:hover { background-color: maroon !important; }
+.layer { height:400px; width:100px }
+</style>
+<script>
+internals.settings.setRegionBasedColumnsEnabled(true)
+</script>
+<body style="overflow:hidden">
+
+<div class="container">
+Overflow:
+<div class="multicol">
+<div class="block" style="display:inline-block; background-color:black"></div>
+<div style="overflow:hidden;" class="layer">
+<div class="block" style="background-color: #0000f0"></div>
+<div class="block" style="background-color: #0000d0"></div>
+<div class="block" style="background-color: #0000b0"></div>
+<div class="block" style="background-color: #000090"></div>
+</div>
+<div class="block" style="display:inline-block; background-color:black"></div>
+</div>
+</div>
+
+<div class="container">
+Transforms:
+
+<div class="multicol">
+<div class="block" style="display:inline-block; background-color:black"></div>
+<div style="margin-left: -100px; -webkit-transform: translate(100px, 0);" class="layer">
+<div class="block" style="background-color: #0000f0"></div>
+<div class="block" style="background-color: #0000d0"></div>
+<div class="block" style="background-color: #0000b0"></div>
+<div class="block" style="background-color: #000090"></div>
+</div>
+<div class="block" style="display:inline-block; background-color:black"></div>
+</div>
+</div>
+</div>
+
+<div class="container">
+Relative Positioning:
+<div class="multicol">
+<div class="block" style="display:inline-block; background-color:black"></div>
+<div style="position:relative; margin-left:-100px; left:100px" class="layer">
+<div class="block" style="background-color: #0000f0"></div>
+<div class="block" style="background-color: #0000d0"></div>
+<div class="block" style="background-color: #0000b0"></div>
+<div class="block" style="background-color: #000090"></div>
+</div>
+<div class="block" style="display:inline-block; background-color:black"></div>
+</div>
+</div>
+
+<div class="container">
+Opacity:
+
+<div class="multicol">
+<div class="block" style="display:inline-block; background-color:black"></div>
+<div style="opacity:0.99;" class="layer">
+<div class="block" style="background-color: #0000f0"></div>
+<div class="block" style="background-color: #0000d0"></div>
+<div class="block" style="background-color: #0000b0"></div>
+<div class="block" style="background-color: #000090"></div>
+</div>
+<div class="block" style="display:inline-block; background-color:black"></div>
+</div>
+</div>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (143483 => 143484)


--- trunk/Source/WebCore/ChangeLog	2013-02-20 19:51:03 UTC (rev 143483)
+++ trunk/Source/WebCore/ChangeLog	2013-02-20 19:58:16 UTC (rev 143484)
@@ -1,3 +1,21 @@
+2013-02-20  David Hyatt  <hy...@apple.com>
+
+        [New Multicolumn] Column gap is computed incorrectly.
+        https://bugs.webkit.org/show_bug.cgi?id=110360.
+
+        Reviewed by Simon Fraser.
+
+        Test: fast/multicol/newmulticol/layers-split-across-columns.html.
+
+        * rendering/RenderMultiColumnSet.cpp:
+        (WebCore::RenderMultiColumnSet::columnGap):
+        Make sure we ask the RenderMultiColumnBlock for the gap rather than our
+        own style, since we don't actually have the gap value in our style.
+        
+        (WebCore::RenderMultiColumnSet::flowThreadPortionOverflowRect):
+        * rendering/RenderMultiColumnSet.h:
+        Fix another spot where the columnGap was an int. It should be a LayoutUnit.
+
 2013-02-20  Robert Hogan  <rob...@webkit.org>
 
         No caret on empty contenteditable element with negative text-indent

Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp (143483 => 143484)


--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp	2013-02-20 19:51:03 UTC (rev 143483)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp	2013-02-20 19:58:16 UTC (rev 143484)
@@ -98,9 +98,12 @@
 
 LayoutUnit RenderMultiColumnSet::columnGap() const
 {
-    if (style()->hasNormalColumnGap())
-        return style()->fontDescription().computedPixelSize(); // "1em" is recommended as the normal gap setting. Matches <p> margins.
-    return static_cast<int>(style()->columnGap());
+    // FIXME: Eventually we will cache the column gap when the widths of columns start varying, but for now we just
+    // go to the parent block to get the gap.
+    RenderMultiColumnBlock* parentBlock = toRenderMultiColumnBlock(parent());
+    if (parentBlock->style()->hasNormalColumnGap())
+        return parentBlock->style()->fontDescription().computedPixelSize(); // "1em" is recommended as the normal gap setting. Matches <p> margins.
+    return parentBlock->style()->columnGap();
 }
 
 unsigned RenderMultiColumnSet::columnCount() const
@@ -156,7 +159,7 @@
     return portionRect;
 }
 
-LayoutRect RenderMultiColumnSet::flowThreadPortionOverflowRect(const LayoutRect& portionRect, unsigned index, unsigned colCount, int colGap) const
+LayoutRect RenderMultiColumnSet::flowThreadPortionOverflowRect(const LayoutRect& portionRect, unsigned index, unsigned colCount, LayoutUnit colGap) const
 {
     // This function determines the portion of the flow thread that paints for the column. Along the inline axis, columns are
     // unclipped at outside edges (i.e., the first and last column in the set), and they clip to half the column

Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.h (143483 => 143484)


--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.h	2013-02-20 19:51:03 UTC (rev 143483)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.h	2013-02-20 19:58:16 UTC (rev 143484)
@@ -117,7 +117,7 @@
     unsigned columnCount() const;
 
     LayoutRect flowThreadPortionRectAt(unsigned index) const;
-    LayoutRect flowThreadPortionOverflowRect(const LayoutRect& flowThreadPortion, unsigned index, unsigned colCount, int colGap) const;
+    LayoutRect flowThreadPortionOverflowRect(const LayoutRect& flowThreadPortion, unsigned index, unsigned colCount, LayoutUnit colGap) const;
     
     unsigned columnIndexAtOffset(LayoutUnit) const;
     
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to