Title: [164868] trunk/Source/WebCore
- Revision
- 164868
- Author
- zol...@webkit.org
- Date
- 2014-02-28 10:14:41 -0800 (Fri, 28 Feb 2014)
Log Message
[CSS Shapes] Update line segments for ShapeInside only if the new line is wide enough
https://bugs.webkit.org/show_bug.cgi?id=129461
Reviewed by David Hyatt.
Shape-inside can make a line only narrower than the original line width, thus we don't need
to update the line/shape segments in fitBelowFloats for every single line inside shape-inside.
This patch adds a helper function, which updates the line segments, furthermore it updates the
line segments only when the content would fit without the shape.
No new tests, no behavior change.
* rendering/line/BreakingContextInlineHeaders.h: Use new helper.
(WebCore::updateSegmentsForShapes):
* rendering/line/LineWidth.cpp: Use new helper.
(WebCore::LineWidth::updateLineSegment): Add new helper.
(WebCore::LineWidth::fitBelowFloats):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (164867 => 164868)
--- trunk/Source/WebCore/ChangeLog 2014-02-28 18:12:52 UTC (rev 164867)
+++ trunk/Source/WebCore/ChangeLog 2014-02-28 18:14:41 UTC (rev 164868)
@@ -1,3 +1,23 @@
+2014-02-28 Zoltan Horvath <zol...@webkit.org>
+
+ [CSS Shapes] Update line segments for ShapeInside only if the new line is wide enough
+ https://bugs.webkit.org/show_bug.cgi?id=129461
+
+ Reviewed by David Hyatt.
+
+ Shape-inside can make a line only narrower than the original line width, thus we don't need
+ to update the line/shape segments in fitBelowFloats for every single line inside shape-inside.
+ This patch adds a helper function, which updates the line segments, furthermore it updates the
+ line segments only when the content would fit without the shape.
+
+ No new tests, no behavior change.
+
+ * rendering/line/BreakingContextInlineHeaders.h: Use new helper.
+ (WebCore::updateSegmentsForShapes):
+ * rendering/line/LineWidth.cpp: Use new helper.
+ (WebCore::LineWidth::updateLineSegment): Add new helper.
+ (WebCore::LineWidth::fitBelowFloats):
+
2014-02-28 Mario Sanchez Prada <mario.pr...@samsung.com>
paragraphs with different directionality in textarea with unicode-bidi: plaintext are aligned the same
Modified: trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h (164867 => 164868)
--- trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h 2014-02-28 18:12:52 UTC (rev 164867)
+++ trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h 2014-02-28 18:14:41 UTC (rev 164868)
@@ -461,6 +461,7 @@
}
#if ENABLE(CSS_SHAPES) && ENABLE(CSS_SHAPE_INSIDE)
+// FIXME: We can move this function & logic into LineWidth::fitBelowFloats
inline void updateSegmentsForShapes(RenderBlockFlow& block, const FloatingObject* lastFloatFromPreviousLine, const WordMeasurements& wordMeasurements, LineWidth& width, bool isFirstLine)
{
ASSERT(lastFloatFromPreviousLine);
@@ -495,11 +496,7 @@
block.setLogicalHeight(shapeInsideInfo->logicalLineTop() - logicalOffsetFromShapeContainer);
}
- lineLogicalTop = block.logicalHeight() + logicalOffsetFromShapeContainer;
-
- shapeInsideInfo->updateSegmentsForLine(lineLogicalTop, lineLogicalHeight);
- width.updateCurrentShapeSegment();
- width.updateAvailableWidth();
+ width.updateLineSegment(block.logicalHeight());
}
#endif
Modified: trunk/Source/WebCore/rendering/line/LineWidth.cpp (164867 => 164868)
--- trunk/Source/WebCore/rendering/line/LineWidth.cpp 2014-02-28 18:12:52 UTC (rev 164867)
+++ trunk/Source/WebCore/rendering/line/LineWidth.cpp 2014-02-28 18:14:41 UTC (rev 164868)
@@ -216,7 +216,22 @@
}
updateLineDimension(newLineTop, newLineWidth, newLineLeft, newLineRight);
}
+
+#if ENABLE(CSS_SHAPE_INSIDE)
+void LineWidth::updateLineSegment(const LayoutUnit& lineTop)
+{
+ ShapeInsideInfo* shapeInsideInfo = m_block.layoutShapeInsideInfo();
+ if (!shapeInsideInfo)
+ return;
+
+ LayoutUnit logicalOffsetFromShapeContainer = m_block.logicalOffsetFromShapeAncestorContainer(&shapeInsideInfo->owner()).height();
+ LayoutUnit lineHeight = m_block.lineHeight(false, m_block.isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
+ shapeInsideInfo->updateSegmentsForLine(lineTop + logicalOffsetFromShapeContainer, lineHeight);
+ updateCurrentShapeSegment();
+ updateAvailableWidth();
+}
#endif
+#endif
void LineWidth::fitBelowFloats(bool isFirstLine)
{
@@ -247,18 +262,12 @@
newLineWidth = availableWidthAtOffset(m_block, floatLogicalBottom, shouldIndentText(), newLineLeft, newLineRight);
lastFloatLogicalBottom = floatLogicalBottom;
+ if (newLineWidth >= m_uncommittedWidth) {
#if ENABLE(CSS_SHAPES) && ENABLE(CSS_SHAPE_INSIDE)
- ShapeInsideInfo* shapeInsideInfo = m_block.layoutShapeInsideInfo();
- if (shapeInsideInfo) {
- LayoutUnit logicalOffsetFromShapeContainer = m_block.logicalOffsetFromShapeAncestorContainer(&shapeInsideInfo->owner()).height();
- LayoutUnit lineHeight = m_block.lineHeight(false, m_block.isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
- shapeInsideInfo->updateSegmentsForLine(lastFloatLogicalBottom + logicalOffsetFromShapeContainer, lineHeight);
- updateCurrentShapeSegment();
- updateAvailableWidth();
- }
+ updateLineSegment(lastFloatLogicalBottom);
#endif
- if (newLineWidth >= m_uncommittedWidth)
break;
+ }
}
updateLineDimension(lastFloatLogicalBottom, newLineWidth, newLineLeft, newLineRight);
Modified: trunk/Source/WebCore/rendering/line/LineWidth.h (164867 => 164868)
--- trunk/Source/WebCore/rendering/line/LineWidth.h 2014-02-28 18:12:52 UTC (rev 164867)
+++ trunk/Source/WebCore/rendering/line/LineWidth.h 2014-02-28 18:14:41 UTC (rev 164868)
@@ -66,20 +66,21 @@
void applyOverhang(RenderRubyRun*, RenderObject* startRenderer, RenderObject* endRenderer);
void fitBelowFloats(bool isFirstLine = false);
void setTrailingWhitespaceWidth(float collapsedWhitespace, float borderPaddingMargin = 0);
-
+ bool shouldIndentText() const { return m_shouldIndentText == IndentText; }
#if ENABLE(CSS_SHAPES) && ENABLE(CSS_SHAPE_INSIDE)
- void updateCurrentShapeSegment();
+ void updateLineSegment(const LayoutUnit&);
#endif
- bool shouldIndentText() const { return m_shouldIndentText == IndentText; }
-
private:
void computeAvailableWidthFromLeftAndRight();
bool fitsOnLineExcludingTrailingCollapsedWhitespace() const;
void updateLineDimension(LayoutUnit newLineTop, LayoutUnit newLineWidth, float newLineLeft, float newLineRight);
#if ENABLE(CSS_SHAPES)
void wrapNextToShapeOutside(bool isFirstLine);
+#if ENABLE(CSS_SHAPE_INSIDE)
+ void updateCurrentShapeSegment();
#endif
+#endif
RenderBlockFlow& m_block;
float m_uncommittedWidth;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes