- Revision
- 156364
- Author
- zol...@webkit.org
- Date
- 2013-09-24 15:24:39 -0700 (Tue, 24 Sep 2013)
Log Message
[CSS Shapes] Modify updateSegmentsForShapes function to use logical coordinates
https://bugs.webkit.org/show_bug.cgi?id=121864
Reviewed by David Hyatt.
When I landed updateSegmentsForShapes in r156022, I didn't use logical coordinates. This change modifies the
code to use coordinates for positioning the float and the content around the float in a shape-inside. Now I
added only one writing mode tests, but I will add more later in bug #121866.
Source/WebCore:
Test: fast/shapes/shape-inside/shape-inside-left-float-in-upper-left-triangle-vertical-lr-inline-content.html
* rendering/FloatingObjects.h:
(WebCore::FloatingObject::logicalHeight):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeLogicalLocationForFloat):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::updateSegmentsForShapes):
LayoutTests:
* fast/shapes/shape-inside/shape-inside-left-float-in-upper-left-triangle-vertical-lr-inline-content-expected.html: Added.
* fast/shapes/shape-inside/shape-inside-left-float-in-upper-left-triangle-vertical-lr-inline-content.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (156363 => 156364)
--- trunk/LayoutTests/ChangeLog 2013-09-24 22:18:17 UTC (rev 156363)
+++ trunk/LayoutTests/ChangeLog 2013-09-24 22:24:39 UTC (rev 156364)
@@ -1,3 +1,17 @@
+2013-09-24 Zoltan Horvath <zol...@webkit.org>
+
+ [CSS Shapes] Modify updateSegmentsForShapes function to use logical coordinates
+ https://bugs.webkit.org/show_bug.cgi?id=121864
+
+ Reviewed by David Hyatt.
+
+ When I landed updateSegmentsForShapes in r156022, I didn't use logical coordinates. This change modifies the
+ code to use coordinates for positioning the float and the content around the float in a shape-inside. Now I
+ added only one writing mode tests, but I will add more later in bug #121866.
+
+ * fast/shapes/shape-inside/shape-inside-left-float-in-upper-left-triangle-vertical-lr-inline-content-expected.html: Added.
+ * fast/shapes/shape-inside/shape-inside-left-float-in-upper-left-triangle-vertical-lr-inline-content.html: Added.
+
2013-09-24 Alexey Proskuryakov <a...@apple.com>
Flaky Test: fast/history/history-subframe-with-name.html
Added: trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-left-float-in-upper-left-triangle-vertical-lr-inline-content-expected.html (0 => 156364)
--- trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-left-float-in-upper-left-triangle-vertical-lr-inline-content-expected.html (rev 0)
+++ trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-left-float-in-upper-left-triangle-vertical-lr-inline-content-expected.html 2013-09-24 22:24:39 UTC (rev 156364)
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ #polygon-svg-shape {
+ position: absolute;
+ left: 0px;
+ top: 0px;
+ width: 200px;
+ height: 200px;
+ }
+ #shape-inside {
+ -webkit-writing-mode: vertical-lr;
+ font: 20px Ahem, sans-serif;
+ line-height: 20px;
+ position: absolute;
+ left: 0px;
+ top: 0px;
+ }
+ #float {
+ width: 50px;
+ height: 50px;
+ float: left;
+ background-color: yellow;
+ }
+ #overflow {
+ height: 200px;
+ margin-left: 20px;
+ }
+</style>
+</head>
+<body>
+ <svg id="polygon-svg-shape" xmlns="http://www.w3.org/2000/svg">
+ <polygon points="0,0 200,0 0,200" fill="#636363"></polygon>
+ </svg>
+ <div id="shape-inside">
+ <div id="float"></div>
+ <span style="color: red;">X</span>
+ <span style="color: white;">X</span>
+ <span style="color: green;">X</span><br/>
+ X X X<br/>
+ X X<br/>
+ X X X<br/>
+ X X X<br/>
+ X X<br/>
+ X X<br/>
+ X<br/>
+ X<br/>
+ <div id="overflow">X X X X X X</div>
+ </div>
+
+ <p style="margin-top: 250px;">
+ There is a triangle shape-inside (represented by the matching filled SVG polygon), the shape-inside contains a 50x50px yellow float left,
+ the float should be at the very left and top position inside the triangle shape where it fits first.
+ The writing mode is vertical-lr, the first column under the yellow float should contain a red, white and green box in this order.
+ The overflow should be pushed on the right side of triangle shape-inside.
+ </p>
+ <p>Bug <a href="" [CSS Shapes] Use the float height to determine position in shape-inside</p>
+</body>
+</html>
Added: trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-left-float-in-upper-left-triangle-vertical-lr-inline-content.html (0 => 156364)
--- trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-left-float-in-upper-left-triangle-vertical-lr-inline-content.html (rev 0)
+++ trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-left-float-in-upper-left-triangle-vertical-lr-inline-content.html 2013-09-24 22:24:39 UTC (rev 156364)
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ #polygon-svg-shape {
+ position: absolute;
+ left: 0px;
+ top: 0px;
+ }
+ #shape-inside {
+ font: 20px Ahem, sans-serif;
+ line-height: 20px;
+ width: 200px;
+ height: 200px;
+ position: absolute;
+ left: 0px;
+ top: 0px;
+ -webkit-shape-inside: polygon(0px 0px, 200px 0px, 0px 200px);
+ -webkit-writing-mode: vertical-lr;
+ }
+ #float {
+ width: 50px;
+ height: 50px;
+ float: left;
+ background-color: yellow;
+ }
+</style>
+</head>
+<body>
+ <svg id="polygon-svg-shape" xmlns="http://www.w3.org/2000/svg">
+ <polygon points="0,0 200,0 0,200" fill="#636363"></polygon>
+ </svg>
+ <div id="shape-inside">
+ <span style="color: red;">A</span>
+ <div id="float"></div>
+ <span style="color: white;">X</span>
+ <span style="color: green;">X</span> X X X X X X X X X X X X X X X X X X X X X X X
+ </div>
+ <p style="margin-top: 250px;">
+ There is a triangle shape-inside (represented by the matching filled SVG polygon), the shape-inside contains a 50x50px yellow float left,
+ the float should be at the very left and top position inside the triangle shape where it fits first.
+ The writing mode is vertical-lr, the first column under the yellow float should contain a red, white and green box in this order.
+ The overflow should be pushed on the right side of triangle shape-inside.
+ </p>
+ <p>Bug <a href="" [CSS Shapes] Use the float height to determine position in shape-inside</p>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (156363 => 156364)
--- trunk/Source/WebCore/ChangeLog 2013-09-24 22:18:17 UTC (rev 156363)
+++ trunk/Source/WebCore/ChangeLog 2013-09-24 22:24:39 UTC (rev 156364)
@@ -1,3 +1,23 @@
+2013-09-24 Zoltan Horvath <zol...@webkit.org>
+
+ [CSS Shapes] Modify updateSegmentsForShapes function to use logical coordinates
+ https://bugs.webkit.org/show_bug.cgi?id=121864
+
+ Reviewed by David Hyatt.
+
+ When I landed updateSegmentsForShapes in r156022, I didn't use logical coordinates. This change modifies the
+ code to use coordinates for positioning the float and the content around the float in a shape-inside. Now I
+ added only one writing mode tests, but I will add more later in bug #121866.
+
+ Test: fast/shapes/shape-inside/shape-inside-left-float-in-upper-left-triangle-vertical-lr-inline-content.html
+
+ * rendering/FloatingObjects.h:
+ (WebCore::FloatingObject::logicalHeight):
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::computeLogicalLocationForFloat):
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::updateSegmentsForShapes):
+
2013-09-24 Brady Eidson <beid...@apple.com>
Remove IDBTransactionCallbacks.h from the .xcodeproj, as it's gone from the repository.
Modified: trunk/Source/WebCore/rendering/FloatingObjects.h (156363 => 156364)
--- trunk/Source/WebCore/rendering/FloatingObjects.h 2013-09-24 22:18:17 UTC (rev 156363)
+++ trunk/Source/WebCore/rendering/FloatingObjects.h 2013-09-24 22:24:39 UTC (rev 156364)
@@ -91,6 +91,7 @@
LayoutUnit logicalLeft(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? x() : y(); }
LayoutUnit logicalRight(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? maxX() : maxY(); }
LayoutUnit logicalWidth(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? width() : height(); }
+ LayoutUnit logicalHeight(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? height() : width(); }
int pixelSnappedLogicalTop(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? frameRect().pixelSnappedY() : frameRect().pixelSnappedX(); }
int pixelSnappedLogicalBottom(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? frameRect().pixelSnappedMaxY() : frameRect().pixelSnappedMaxX(); }
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (156363 => 156364)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2013-09-24 22:18:17 UTC (rev 156363)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2013-09-24 22:24:39 UTC (rev 156364)
@@ -3357,8 +3357,9 @@
ShapeInsideInfo* shapeInsideInfo = this->shapeInsideInfo();
// FIXME: Implement behavior for right floats.
if (shapeInsideInfo) {
+ LayoutSize floatLogicalSize = LayoutSize(floatingObject->logicalWidth(isHorizontalWritingMode()), floatingObject->logicalHeight(isHorizontalWritingMode()));
// FIXME: If the float doesn't fit in the shape we should push it under the content box
- logicalTopOffset = shapeInsideInfo->computeFirstFitPositionForFloat(LayoutSize(floatingObject->width(), floatingObject->height()));
+ logicalTopOffset = shapeInsideInfo->computeFirstFitPositionForFloat(floatLogicalSize);
if (logicalHeight() > logicalTopOffset)
logicalTopOffset = logicalHeight();
Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (156363 => 156364)
--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2013-09-24 22:18:17 UTC (rev 156363)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2013-09-24 22:24:39 UTC (rev 156364)
@@ -2631,21 +2631,31 @@
ASSERT(lastFloatFromPreviousLine);
ShapeInsideInfo* shapeInsideInfo = block->layoutShapeInsideInfo();
- LayoutUnit lineLogicalHeight = block->lineHeight(isFirstLine, block->isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
- LayoutUnit lineLogicalBottom = block->logicalHeight() + lineLogicalHeight;
- bool lineOverlapsWithFloat = (lastFloatFromPreviousLine->y() < lineLogicalBottom) && (block->logicalHeight() < lastFloatFromPreviousLine->maxY());
+ if (!shapeInsideInfo)
+ return;
- if (!shapeInsideInfo || !lineOverlapsWithFloat)
+ bool isHorizontalWritingMode = block->isHorizontalWritingMode();
+
+ LayoutUnit lineLogicalTop = block->logicalHeight();
+ LayoutUnit lineLogicalHeight = block->lineHeight(isFirstLine, isHorizontalWritingMode ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
+ LayoutUnit lineLogicalBottom = lineLogicalTop + lineLogicalHeight;
+
+ LayoutUnit floatLogicalTop = lastFloatFromPreviousLine->logicalTop(isHorizontalWritingMode);
+ LayoutUnit floatLogicalBottom = lastFloatFromPreviousLine->logicalBottom(isHorizontalWritingMode);
+
+ bool lineOverlapsWithFloat = (floatLogicalTop < lineLogicalBottom) && (lineLogicalTop < floatLogicalBottom);
+ if (!lineOverlapsWithFloat)
return;
- float minWidth = firstPositiveWidth(wordMeasurements);
+ float minSegmentWidth = firstPositiveWidth(wordMeasurements);
- LayoutUnit availableWidth = block->width() - lastFloatFromPreviousLine->maxX();
- if (availableWidth < minWidth)
- block->setLogicalHeight(lastFloatFromPreviousLine->maxY());
+ LayoutUnit floatLogicalWidth = lastFloatFromPreviousLine->logicalWidth(isHorizontalWritingMode);
+ LayoutUnit availableLogicalWidth = block->logicalWidth() - lastFloatFromPreviousLine->logicalRight(isHorizontalWritingMode);
+ if (availableLogicalWidth < minSegmentWidth)
+ block->setLogicalHeight(floatLogicalBottom);
- if (block->logicalHeight() < lastFloatFromPreviousLine->y()) {
- shapeInsideInfo->adjustLogicalLineTop(minWidth + lastFloatFromPreviousLine->width());
+ if (block->logicalHeight() < floatLogicalTop) {
+ shapeInsideInfo->adjustLogicalLineTop(minSegmentWidth + floatLogicalWidth);
block->setLogicalHeight(shapeInsideInfo->logicalLineTop());
}