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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutDeprecatedFlexibleBox.cpp

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/LayoutDeprecatedFlexibleBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutDeprecatedFlexibleBox.cpp b/third_party/WebKit/Source/core/layout/LayoutDeprecatedFlexibleBox.cpp
index 9857cf4b7c912f9f171c47626ca836cbce46a93f..ac3fa8784a2c15ae3fd305caa831056a55a42ff5 100644
--- a/third_party/WebKit/Source/core/layout/LayoutDeprecatedFlexibleBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutDeprecatedFlexibleBox.cpp
@@ -419,7 +419,7 @@ void LayoutDeprecatedFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
LayoutUnit childY = yPos;
switch (style()->boxAlign()) {
case BCENTER:
- childY += child->marginTop() + std::max<LayoutUnit>(0, (contentHeight() - (child->size().height() + child->marginHeight())) / 2);
+ childY += child->marginTop() + ((contentHeight() - (child->size().height() + child->marginHeight())) / 2).clampToZero();
break;
case BBASELINE: {
LayoutUnit ascent = child->firstLineBoxBaseline();
@@ -563,7 +563,7 @@ void LayoutDeprecatedFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
remainingSpace -= (remainingSpace / totalChildren);
--totalChildren;
- placeChild(child, child->location() + LayoutSize(offset, 0));
+ placeChild(child, child->location() + LayoutSize(offset, LayoutUnit()));
}
}
} else {
@@ -575,7 +575,7 @@ void LayoutDeprecatedFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
if (childDoesNotAffectWidthOrFlexing(child))
continue;
- placeChild(child, child->location() + LayoutSize(offset, 0));
+ placeChild(child, child->location() + LayoutSize(offset, LayoutUnit()));
}
}
}
@@ -658,7 +658,7 @@ void LayoutDeprecatedFlexibleBox::layoutVerticalBox(bool relayoutChildren)
switch (style()->boxAlign()) {
case BCENTER:
case BBASELINE: // Baseline just maps to center for vertical boxes
- childX += child->marginLeft() + std::max<LayoutUnit>(0, (contentWidth() - (child->size().width() + child->marginWidth())) / 2);
+ childX += child->marginLeft() + std::max<LayoutUnit>(LayoutUnit(), (contentWidth() - (child->size().width() + child->marginWidth())) / 2);
break;
case BEND:
if (!style()->isLeftToRightDirection())
@@ -813,7 +813,7 @@ void LayoutDeprecatedFlexibleBox::layoutVerticalBox(bool relayoutChildren)
offset += remainingSpace / totalChildren;
remainingSpace -= (remainingSpace / totalChildren);
--totalChildren;
- placeChild(child, child->location() + LayoutSize(0, offset));
+ placeChild(child, child->location() + LayoutSize(LayoutUnit(), offset));
}
}
} else {
@@ -824,7 +824,7 @@ void LayoutDeprecatedFlexibleBox::layoutVerticalBox(bool relayoutChildren)
for (LayoutBox* child = iterator.first(); child; child = iterator.next()) {
if (childDoesNotAffectWidthOrFlexing(child))
continue;
- placeChild(child, child->location() + LayoutSize(0, offset));
+ placeChild(child, child->location() + LayoutSize(LayoutUnit(), offset));
}
}
}

Powered by Google App Engine
This is Rietveld 408576698