Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1827)

Unified Diff: Source/core/rendering/line/LineWidth.cpp

Issue 849873003: [CSS Shapes] Simplify LineWidth::wrapNextToShapeOutside() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/line/LineWidth.cpp
diff --git a/Source/core/rendering/line/LineWidth.cpp b/Source/core/rendering/line/LineWidth.cpp
index 714bc6ca8d5568d9ed440368f03e2d385d79f145..1a27a29da9a579e5e07237e5d7135ec9ec7545cf 100644
--- a/Source/core/rendering/line/LineWidth.cpp
+++ b/Source/core/rendering/line/LineWidth.cpp
@@ -119,17 +119,11 @@ void LineWidth::applyOverhang(RenderRubyRun* rubyRun, RenderObject* startRendere
m_overhangWidth += startOverhang + endOverhang;
}
-inline static float availableWidthAtOffset(const RenderBlockFlow& block, const LayoutUnit& offset, bool shouldIndentText, float& newLineLeft, float& newLineRight)
+inline static float availableWidthAtOffset(const RenderBlockFlow& block, const LayoutUnit& offset, bool shouldIndentText, float& newLineLeft,
+ float& newLineRight, const LayoutUnit& lineHeight = 0)
{
- newLineLeft = block.logicalLeftOffsetForLine(offset, shouldIndentText).toFloat();
- newLineRight = block.logicalRightOffsetForLine(offset, shouldIndentText).toFloat();
- return std::max(0.0f, newLineRight - newLineLeft);
-}
-
-inline static float availableWidthAtOffset(const RenderBlockFlow& block, const LayoutUnit& offset, bool shouldIndentText)
-{
- float newLineLeft = block.logicalLeftOffsetForLine(offset, shouldIndentText).toFloat();
- float newLineRight = block.logicalRightOffsetForLine(offset, shouldIndentText).toFloat();
+ newLineLeft = block.logicalLeftOffsetForLine(offset, shouldIndentText, lineHeight).toFloat();
+ newLineRight = block.logicalRightOffsetForLine(offset, shouldIndentText, lineHeight).toFloat();
return std::max(0.0f, newLineRight - newLineLeft);
}
@@ -144,16 +138,6 @@ void LineWidth::updateLineDimension(LayoutUnit newLineTop, LayoutUnit newLineWid
m_right = newLineRight;
}
-inline static bool isWholeLineFit(const RenderBlockFlow& block, const LayoutUnit& lineTop, LayoutUnit lineHeight, float uncommittedWidth, bool shouldIndentText)
-{
- for (LayoutUnit lineBottom = lineTop; lineBottom <= lineTop + lineHeight; lineBottom++) {
- LayoutUnit availableWidthAtBottom = availableWidthAtOffset(block, lineBottom, shouldIndentText);
- if (availableWidthAtBottom < uncommittedWidth)
- return false;
- }
- return true;
-}
-
void LineWidth::wrapNextToShapeOutside(bool isFirstLine)
{
LayoutUnit lineHeight = m_block.lineHeight(isFirstLine, m_block.isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
@@ -165,8 +149,8 @@ void LineWidth::wrapNextToShapeOutside(bool isFirstLine)
float newLineLeft = m_left;
float newLineRight = m_right;
while (true) {
- newLineWidth = availableWidthAtOffset(m_block, newLineTop, shouldIndentText(), newLineLeft, newLineRight);
- if (newLineWidth >= m_uncommittedWidth && isWholeLineFit(m_block, newLineTop, lineHeight, m_uncommittedWidth, shouldIndentText()))
+ newLineWidth = availableWidthAtOffset(m_block, newLineTop, shouldIndentText(), newLineLeft, newLineRight, lineHeight);
+ if (newLineWidth >= m_uncommittedWidth)
break;
if (newLineTop >= floatLogicalBottom)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698