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

Unified Diff: third_party/WebKit/Source/core/layout/line/LineWidth.cpp

Issue 1583783002: Use IndentTextOrNot instead of a bool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@568851-2
Patch Set: Update Created 4 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
Index: third_party/WebKit/Source/core/layout/line/LineWidth.cpp
diff --git a/third_party/WebKit/Source/core/layout/line/LineWidth.cpp b/third_party/WebKit/Source/core/layout/line/LineWidth.cpp
index b740c28f9d447c088a4114b662e697099ff780ff..bda4f0979107f5efd1d9ba9880608ed544430f8f 100644
--- a/third_party/WebKit/Source/core/layout/line/LineWidth.cpp
+++ b/third_party/WebKit/Source/core/layout/line/LineWidth.cpp
@@ -34,7 +34,7 @@
namespace blink {
-LineWidth::LineWidth(LineLayoutBlockFlow block, bool isFirstLine, IndentTextOrNot shouldIndentText)
+LineWidth::LineWidth(LineLayoutBlockFlow block, bool isFirstLine, IndentTextOrNot indentText)
: m_block(block)
, m_uncommittedWidth(0)
, m_committedWidth(0)
@@ -44,7 +44,7 @@ LineWidth::LineWidth(LineLayoutBlockFlow block, bool isFirstLine, IndentTextOrNo
, m_right(0)
, m_availableWidth(0)
, m_isFirstLine(isFirstLine)
- , m_shouldIndentText(shouldIndentText)
+ , m_indentText(indentText)
{
updateAvailableWidth();
}
@@ -53,8 +53,8 @@ void LineWidth::updateAvailableWidth(LayoutUnit replacedHeight)
{
LayoutUnit height = m_block.logicalHeight();
LayoutUnit logicalHeight = m_block.minLineHeightForReplacedObject(m_isFirstLine, replacedHeight);
- m_left = m_block.logicalLeftOffsetForLine(height, shouldIndentText(), logicalHeight).toFloat();
- m_right = m_block.logicalRightOffsetForLine(height, shouldIndentText(), logicalHeight).toFloat();
+ m_left = m_block.logicalLeftOffsetForLine(height, indentText(), logicalHeight).toFloat();
+ m_right = m_block.logicalRightOffsetForLine(height, indentText(), logicalHeight).toFloat();
computeAvailableWidthFromLeftAndRight();
}
@@ -79,7 +79,7 @@ void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(const FloatingObject& ne
else // Per the CSS Shapes spec, If the line doesn't overlap the shape, then ignore this shape for this line.
newLeft = m_left;
}
- if (shouldIndentText() && m_block.style()->isLeftToRightDirection())
+ if (indentText() == IndentText && m_block.style()->isLeftToRightDirection())
newLeft += floorToInt(m_block.textIndentOffset());
m_left = std::max<float>(m_left, newLeft);
} else {
@@ -90,7 +90,7 @@ void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(const FloatingObject& ne
else // Per the CSS Shapes spec, If the line doesn't overlap the shape, then ignore this shape for this line.
newRight = m_right;
}
- if (shouldIndentText() && !m_block.style()->isLeftToRightDirection())
+ if (indentText() == IndentText && !m_block.style()->isLeftToRightDirection())
newRight -= floorToInt(m_block.textIndentOffset());
m_right = std::min<float>(m_right, newRight);
}
@@ -118,11 +118,11 @@ void LineWidth::applyOverhang(LineLayoutRubyRun rubyRun, LineLayoutItem startLay
m_overhangWidth += startOverhang + endOverhang;
}
-inline static float availableWidthAtOffset(LineLayoutBlockFlow block, const LayoutUnit& offset, bool shouldIndentText, float& newLineLeft,
+inline static float availableWidthAtOffset(LineLayoutBlockFlow block, const LayoutUnit& offset, IndentTextOrNot indentText, float& newLineLeft,
float& newLineRight, const LayoutUnit& lineHeight = 0)
{
- newLineLeft = block.logicalLeftOffsetForLine(offset, shouldIndentText, lineHeight).toFloat();
- newLineRight = block.logicalRightOffsetForLine(offset, shouldIndentText, lineHeight).toFloat();
+ newLineLeft = block.logicalLeftOffsetForLine(offset, indentText, lineHeight).toFloat();
+ newLineRight = block.logicalRightOffsetForLine(offset, indentText, lineHeight).toFloat();
return std::max(0.0f, newLineRight - newLineLeft);
}
@@ -148,7 +148,7 @@ void LineWidth::wrapNextToShapeOutside(bool isFirstLine)
float newLineLeft = m_left;
float newLineRight = m_right;
while (true) {
- newLineWidth = availableWidthAtOffset(m_block, newLineTop, shouldIndentText(), newLineLeft, newLineRight, lineHeight);
+ newLineWidth = availableWidthAtOffset(m_block, newLineTop, indentText(), newLineLeft, newLineRight, lineHeight);
if (newLineWidth >= m_uncommittedWidth)
break;
@@ -181,7 +181,7 @@ void LineWidth::fitBelowFloats(bool isFirstLine)
if (floatLogicalBottom <= lastFloatLogicalBottom)
break;
- newLineWidth = availableWidthAtOffset(m_block, floatLogicalBottom, shouldIndentText(), newLineLeft, newLineRight);
+ newLineWidth = availableWidthAtOffset(m_block, floatLogicalBottom, indentText(), newLineLeft, newLineRight);
lastFloatLogicalBottom = floatLogicalBottom;
if (newLineWidth >= m_uncommittedWidth)
« no previous file with comments | « third_party/WebKit/Source/core/layout/line/LineWidth.h ('k') | third_party/WebKit/Source/core/layout/line/RootInlineBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698