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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlow.h

Issue 1648573002: Transition to explicit constructors in LayoutUnit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove int constructors for size/point... they result in incorrect conversions until LayoutUnit is … 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/LayoutBlockFlow.h
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.h b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.h
index 4e4298079c43a71cdfaafa3c662ed697972e42e8..d2f341419062c1955ae02caeb81871451d1c1b41 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.h
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.h
@@ -99,24 +99,24 @@ public:
void deleteLineBoxTree() final;
- LayoutUnit availableLogicalWidthForLine(LayoutUnit position, IndentTextOrNot indentText, LayoutUnit logicalHeight = 0) const
+ LayoutUnit availableLogicalWidthForLine(LayoutUnit position, IndentTextOrNot indentText, LayoutUnit logicalHeight = LayoutUnit()) const
{
- return max<LayoutUnit>(0, logicalRightOffsetForLine(position, indentText, logicalHeight) - logicalLeftOffsetForLine(position, indentText, logicalHeight));
+ return (logicalRightOffsetForLine(position, indentText, logicalHeight) - logicalLeftOffsetForLine(position, indentText, logicalHeight)).clampToZero();
}
- LayoutUnit logicalRightOffsetForLine(LayoutUnit position, IndentTextOrNot indentText, LayoutUnit logicalHeight = 0) const
+ LayoutUnit logicalRightOffsetForLine(LayoutUnit position, IndentTextOrNot indentText, LayoutUnit logicalHeight = LayoutUnit()) const
{
return logicalRightOffsetForLine(position, logicalRightOffsetForContent(), indentText, logicalHeight);
}
- LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, IndentTextOrNot indentText, LayoutUnit logicalHeight = 0) const
+ LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, IndentTextOrNot indentText, LayoutUnit logicalHeight = LayoutUnit()) const
{
return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(), indentText, logicalHeight);
}
- LayoutUnit startOffsetForLine(LayoutUnit position, IndentTextOrNot indentText, LayoutUnit logicalHeight = 0) const
+ LayoutUnit startOffsetForLine(LayoutUnit position, IndentTextOrNot indentText, LayoutUnit logicalHeight = LayoutUnit()) const
{
return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, indentText, logicalHeight)
: logicalWidth() - logicalRightOffsetForLine(position, indentText, logicalHeight);
}
- LayoutUnit endOffsetForLine(LayoutUnit position, IndentTextOrNot indentText, LayoutUnit logicalHeight = 0) const
+ LayoutUnit endOffsetForLine(LayoutUnit position, IndentTextOrNot indentText, LayoutUnit logicalHeight = LayoutUnit()) const
{
return !style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, indentText, logicalHeight)
: logicalWidth() - logicalRightOffsetForLine(position, indentText, logicalHeight);
@@ -447,19 +447,19 @@ public:
static LayoutUnit positiveMarginBeforeDefault(const LayoutBlockFlow* block)
{
- return std::max<LayoutUnit>(block->marginBefore(), 0);
+ return block->marginBefore().clampToZero();
}
static LayoutUnit negativeMarginBeforeDefault(const LayoutBlockFlow* block)
{
- return std::max<LayoutUnit>(-block->marginBefore(), 0);
+ return (-block->marginBefore()).clampToZero();
}
static LayoutUnit positiveMarginAfterDefault(const LayoutBlockFlow* block)
{
- return std::max<LayoutUnit>(block->marginAfter(), 0);
+ return block->marginAfter().clampToZero();
}
static LayoutUnit negativeMarginAfterDefault(const LayoutBlockFlow* block)
{
- return std::max<LayoutUnit>(-block->marginAfter(), 0);
+ return (-block->marginAfter()).clampToZero();
}
MarginValues m_margins;
« no previous file with comments | « third_party/WebKit/Source/core/editing/VisibleUnits.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698