Title: [153058] trunk
Revision
153058
Author
[email protected]
Date
2013-07-23 11:49:19 -0700 (Tue, 23 Jul 2013)

Log Message

[CSS Shapes] New positioning model: Borders
https://bugs.webkit.org/show_bug.cgi?id=118822

Patch by Bem Jones-Bey <[email protected]> on 2013-07-23
Reviewed by Dean Jackson.

Source/WebCore:

Converting to the shape coordinate system was not properly accounting
for borders and padding. This has been fixed and a new convienence
method added because of the added complexity of the conversion.

Test: csswg/submitted/shapes/shape-outside/shape-outside-floats-square-border-000.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::logicalLeftFloatOffsetForLine): Update to use
    computeSegmentsForContainingBlockLine to do the coordinate
    conversion.
(WebCore::RenderBlock::logicalRightFloatOffsetForLine): Ditto.
* rendering/RenderBlockLineLayout.cpp:
(WebCore::LineWidth::shrinkAvailableWidthForNewFloatIfNeeded): Ditto.
* rendering/shapes/ShapeOutsideInfo.cpp:
(WebCore::ShapeOutsideInfo::computeSegmentsForContainingBlockLine):
    Add new method to do the coordinate conversion from the containing
    block coordinate system to the coordinate system of the shape so
    that the segments can be correctly calculated.

LayoutTests:

Test that the shape is properly respected when the float has a border.

* csswg/submitted/shapes/shape-outside/shape-outside-floats-square-border-000-expected.html: Added.
* csswg/submitted/shapes/shape-outside/shape-outside-floats-square-border-000.html: Added.
* csswg/submitted/shapes/shape-outside/w3c-import.log: Updated with new
    import information.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (153057 => 153058)


--- trunk/LayoutTests/ChangeLog	2013-07-23 17:36:42 UTC (rev 153057)
+++ trunk/LayoutTests/ChangeLog	2013-07-23 18:49:19 UTC (rev 153058)
@@ -1,3 +1,17 @@
+2013-07-23  Bem Jones-Bey  <[email protected]>
+
+        [CSS Shapes] New positioning model: Borders
+        https://bugs.webkit.org/show_bug.cgi?id=118822
+
+        Reviewed by Dean Jackson.
+
+        Test that the shape is properly respected when the float has a border.
+
+        * csswg/submitted/shapes/shape-outside/shape-outside-floats-square-border-000-expected.html: Added.
+        * csswg/submitted/shapes/shape-outside/shape-outside-floats-square-border-000.html: Added.
+        * csswg/submitted/shapes/shape-outside/w3c-import.log: Updated with new
+            import information.
+
 2013-07-23  Andrei Bucur  <[email protected]>
 
         [CSS Regions] Convert percentage-margins-* tests to ref-tests

Added: trunk/LayoutTests/csswg/submitted/shapes/shape-outside/shape-outside-floats-square-border-000-expected.html (0 => 153058)


--- trunk/LayoutTests/csswg/submitted/shapes/shape-outside/shape-outside-floats-square-border-000-expected.html	                        (rev 0)
+++ trunk/LayoutTests/csswg/submitted/shapes/shape-outside/shape-outside-floats-square-border-000-expected.html	2013-07-23 18:49:19 UTC (rev 153058)
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<title>CSS RefTest Reference</title>
+<link rel="author" title="Bem Jones-Bey" href=""
+<meta name="flags" content="ahem">
+<style>
+.container {
+    width: 75px;
+    height: 75px;
+    font: 25px/1 Ahem;
+    line-height: 25px;
+    border: 10px solid black;
+    display: inline-block;
+}
+
+.left-text {
+    text-align: left;
+}
+
+.right-text {
+    text-align: right;
+}
+
+.left {
+    float: left;
+    width: 50px;
+    height: 50px;
+}
+
+.right {
+    float: right;
+    width: 50px;
+    height: 50px;
+}
+</style>
+</head>
+<body>
+    <p>Test passes if you see two black square boxes with a smaller white square in one corner.</p>
+    <div class="container left-text">
+        <div class="left"></div>
+        X<br/>
+        X<br/>
+        XXX<br/>
+    </div>
+
+    <div class="container right-text">
+        <div class="right"></div>
+        X<br/>
+        X<br/>
+        XXX<br/>
+    </div>
+</body>

Added: trunk/LayoutTests/csswg/submitted/shapes/shape-outside/shape-outside-floats-square-border-000.html (0 => 153058)


--- trunk/LayoutTests/csswg/submitted/shapes/shape-outside/shape-outside-floats-square-border-000.html	                        (rev 0)
+++ trunk/LayoutTests/csswg/submitted/shapes/shape-outside/shape-outside-floats-square-border-000.html	2013-07-23 18:49:19 UTC (rev 153058)
@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<title>
+ CSS Test: square shape-outside on floats with a border
+</title>
+<link rel="author" title="Bem Jones-Bey" href="" />
+<link rel="help" href="" />
+<link rel="match" href="" />
+<meta name="flags" content="ahem" />
+<script>
+ // This is required to run the tests in WebKit's test infrastructure.
+if (window.internals)
+    window.internals.settings.setCSSShapesEnabled(true);
+</script>
+<style>
+ .container {
+    width: 75px;
+    height: 75px;
+    font: 25px/1 Ahem;
+    line-height: 25px;
+    border: 10px solid red;
+    display: inline-block;
+}
+
+.right-text {
+    text-align: right;
+}
+
+.left {
+    float: left;
+    width: 75px;
+    height: 75px;
+    border: 10px solid black;
+    margin-top: -10px;
+    margin-left: -10px;
+   -webkit-shape-outside: rectangle(0px, 0px, 50px, 50px);
+}
+
+.right {
+    float: right;
+    width: 75px;
+    height: 75px;
+    border: 10px solid black;
+    margin-top: -10px;
+    margin-right: -10px;
+   -webkit-shape-outside: rectangle(25px, 0px, 50px, 50px);
+}
+</style>
+<body>
+ <p>
+  Test passes if you see two black square boxes with a smaller white square in one corner.
+ </p>
+ <div class="container right-text">
+  <div class="left">
+  </div>
+  X
+  <br />
+  X
+  <br />
+  XXX
+  <br />
+ </div>
+ <div class="container">
+  <div class="right">
+  </div>
+  X
+  <br />
+  X
+  <br />
+  XXX
+  <br />
+ </div>
+</body>

Modified: trunk/LayoutTests/csswg/submitted/shapes/shape-outside/w3c-import.log (153057 => 153058)


--- trunk/LayoutTests/csswg/submitted/shapes/shape-outside/w3c-import.log	2013-07-23 17:36:42 UTC (rev 153057)
+++ trunk/LayoutTests/csswg/submitted/shapes/shape-outside/w3c-import.log	2013-07-23 18:49:19 UTC (rev 153058)
@@ -8,26 +8,28 @@
 Do NOT modify or remove this file
 
 ------------------------------------------------------------------------
-Last Import: 2013-06-27 10:24
+Last Import: 2013-07-17 17:23
 W3C Mercurial changeset: Not Available
-Test status at time of import: submitted
+Test status at time of import: unknown
 ------------------------------------------------------------------------
 Properties requiring vendor prefixes:
 -webkit-shape-outside
 -webkit-writing-mode
 ------------------------------------------------------------------------
 List of files:
-/LayoutTests/csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-000-expected.html
-/LayoutTests/csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-000.html
-/LayoutTests/csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-001-expected.html
-/LayoutTests/csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-001.html
-/LayoutTests/csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-002-expected.html
-/LayoutTests/csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-002.html
-/LayoutTests/csswg/submitted/shapes/shape-outside/shape-outside-floats-square-000-expected.html
-/LayoutTests/csswg/submitted/shapes/shape-outside/shape-outside-floats-square-000.html
-/LayoutTests/csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-000-expected.html
-/LayoutTests/csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-000.html
-/LayoutTests/csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-001-expected.html
-/LayoutTests/csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-001.html
-/LayoutTests/csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-002-expected.html
-/LayoutTests/csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-002.html
+/LayoutTests/w3c/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-000-expected.html
+/LayoutTests/w3c/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-000.html
+/LayoutTests/w3c/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-001-expected.html
+/LayoutTests/w3c/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-001.html
+/LayoutTests/w3c/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-002-expected.html
+/LayoutTests/w3c/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-002.html
+/LayoutTests/w3c/submitted/shapes/shape-outside/shape-outside-floats-square-000-expected.html
+/LayoutTests/w3c/submitted/shapes/shape-outside/shape-outside-floats-square-000.html
+/LayoutTests/w3c/submitted/shapes/shape-outside/shape-outside-floats-square-border-000-expected.html
+/LayoutTests/w3c/submitted/shapes/shape-outside/shape-outside-floats-square-border-000.html
+/LayoutTests/w3c/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-000-expected.html
+/LayoutTests/w3c/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-000.html
+/LayoutTests/w3c/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-001-expected.html
+/LayoutTests/w3c/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-001.html
+/LayoutTests/w3c/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-002-expected.html
+/LayoutTests/w3c/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-002.html

Modified: trunk/Source/WebCore/ChangeLog (153057 => 153058)


--- trunk/Source/WebCore/ChangeLog	2013-07-23 17:36:42 UTC (rev 153057)
+++ trunk/Source/WebCore/ChangeLog	2013-07-23 18:49:19 UTC (rev 153058)
@@ -1,3 +1,29 @@
+2013-07-23  Bem Jones-Bey  <[email protected]>
+
+        [CSS Shapes] New positioning model: Borders
+        https://bugs.webkit.org/show_bug.cgi?id=118822
+
+        Reviewed by Dean Jackson.
+
+        Converting to the shape coordinate system was not properly accounting
+        for borders and padding. This has been fixed and a new convienence
+        method added because of the added complexity of the conversion.
+
+        Test: csswg/submitted/shapes/shape-outside/shape-outside-floats-square-border-000.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::logicalLeftFloatOffsetForLine): Update to use
+            computeSegmentsForContainingBlockLine to do the coordinate
+            conversion.
+        (WebCore::RenderBlock::logicalRightFloatOffsetForLine): Ditto.
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::LineWidth::shrinkAvailableWidthForNewFloatIfNeeded): Ditto.
+        * rendering/shapes/ShapeOutsideInfo.cpp:
+        (WebCore::ShapeOutsideInfo::computeSegmentsForContainingBlockLine):
+            Add new method to do the coordinate conversion from the containing
+            block coordinate system to the coordinate system of the shape so
+            that the segments can be correctly calculated.
+
 2013-07-23  Allan Sandfeld Jensen  <[email protected]>
 
         Remove deprecated and unused compositing settings

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (153057 => 153058)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2013-07-23 17:36:42 UTC (rev 153057)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2013-07-23 18:49:19 UTC (rev 153058)
@@ -4477,8 +4477,7 @@
         const FloatingObject* lastFloat = adapter.lastFloat();
         if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) {
             if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOutsideInfo()) {
-                LayoutUnit lineTopInShapeCoordinates = logicalTop - logicalTopForFloat(lastFloat);
-                shapeOutside->computeSegmentsForLine(lineTopInShapeCoordinates, logicalHeight);
+                shapeOutside->computeSegmentsForContainingBlockLine(logicalTop, logicalTopForFloat(lastFloat), logicalHeight);
                 left += shapeOutside->rightSegmentMarginBoxDelta();
             }
         }
@@ -4546,8 +4545,7 @@
         const FloatingObject* lastFloat = adapter.lastFloat();
         if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) {
             if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOutsideInfo()) {
-                LayoutUnit lineTopInShapeCoordinates = logicalTop - logicalTopForFloat(lastFloat);
-                shapeOutside->computeSegmentsForLine(lineTopInShapeCoordinates, logicalHeight);
+                shapeOutside->computeSegmentsForContainingBlockLine(logicalTop, logicalTopForFloat(lastFloat), logicalHeight);
                 rightFloatOffset += shapeOutside->leftSegmentMarginBoxDelta();
             }
         }

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (153057 => 153058)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-07-23 17:36:42 UTC (rev 153057)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-07-23 18:49:19 UTC (rev 153058)
@@ -209,8 +209,7 @@
         if (previousFloat != newFloat && previousFloat->type() == newFloat->type()) {
             previousShapeOutsideInfo = previousFloat->renderer()->shapeOutsideInfo();
             if (previousShapeOutsideInfo) {
-                LayoutUnit lineTopInShapeCoordinates = m_block->logicalHeight() - m_block->logicalTopForFloat(previousFloat);
-                previousShapeOutsideInfo->computeSegmentsForLine(lineTopInShapeCoordinates, logicalHeightForLine(m_block, m_isFirstLine));
+                previousShapeOutsideInfo->computeSegmentsForContainingBlockLine(m_block->logicalHeight(), m_block->logicalTopForFloat(previousFloat), logicalHeightForLine(m_block, m_isFirstLine));
             }
             break;
         }
@@ -218,8 +217,7 @@
 
     ShapeOutsideInfo* shapeOutsideInfo = newFloat->renderer()->shapeOutsideInfo();
     if (shapeOutsideInfo) {
-        LayoutUnit lineTopInShapeCoordinates = m_block->logicalHeight() - m_block->logicalTopForFloat(newFloat);
-        shapeOutsideInfo->computeSegmentsForLine(lineTopInShapeCoordinates, logicalHeightForLine(m_block, m_isFirstLine));
+        shapeOutsideInfo->computeSegmentsForContainingBlockLine(m_block->logicalHeight(), m_block->logicalTopForFloat(newFloat), logicalHeightForLine(m_block, m_isFirstLine));
     }
 #endif
 

Modified: trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp (153057 => 153058)


--- trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp	2013-07-23 17:36:42 UTC (rev 153057)
+++ trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp	2013-07-23 18:49:19 UTC (rev 153058)
@@ -42,6 +42,12 @@
     return box->isFloatingWithShapeOutside() && value->type() == ShapeValue::Shape && value->shape();
 }
 
+bool ShapeOutsideInfo::computeSegmentsForContainingBlockLine(LayoutUnit lineTop, LayoutUnit floatTop, LayoutUnit lineHeight)
+{
+    LayoutUnit lineTopInShapeCoordinates = lineTop - floatTop + logicalTopOffset();
+    return computeSegmentsForLine(lineTopInShapeCoordinates, lineHeight);
+}
+
 bool ShapeOutsideInfo::computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight)
 {
     if (shapeSizeDirty() || m_lineTop != lineTop || m_lineHeight != lineHeight) {

Modified: trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.h (153057 => 153058)


--- trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.h	2013-07-23 17:36:42 UTC (rev 153057)
+++ trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.h	2013-07-23 18:49:19 UTC (rev 153058)
@@ -44,6 +44,7 @@
     LayoutUnit leftSegmentMarginBoxDelta() const { return m_leftSegmentMarginBoxDelta; }
     LayoutUnit rightSegmentMarginBoxDelta() const { return m_rightSegmentMarginBoxDelta; }
 
+    bool computeSegmentsForContainingBlockLine(LayoutUnit lineTop, LayoutUnit floatTop, LayoutUnit lineHeight);
     virtual bool computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight) OVERRIDE;
 
     static PassOwnPtr<ShapeOutsideInfo> createInfo(const RenderBox* renderer) { return adoptPtr(new ShapeOutsideInfo(renderer)); }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to