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

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

Issue 2156323002: [css-flexbox] Simplify code a bit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « third_party/WebKit/Source/core/layout/LayoutFlexibleBox.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
index 4a7cf2bec4aea4734f609106980cd3781dc085db..5499abfa2bb724aa3ef6aa575a1d009780070f0c 100644
--- a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
@@ -498,6 +498,11 @@ LayoutUnit LayoutFlexibleBox::mainAxisExtentForChild(const LayoutBox& child) con
return isHorizontalFlow() ? child.size().width() : child.size().height();
}
+LayoutUnit LayoutFlexibleBox::mainAxisContentExtentForChild(const LayoutBox& child) const
+{
+ return isHorizontalFlow() ? child.contentWidth() : child.contentHeight();
+}
+
LayoutUnit LayoutFlexibleBox::crossAxisExtent() const
{
return isHorizontalFlow() ? size().height() : size().width();
@@ -1409,12 +1414,12 @@ static LayoutUnit alignmentOffset(LayoutUnit availableFreeSpace, ItemPosition po
return LayoutUnit();
}
-void LayoutFlexibleBox::setOverrideMainAxisSizeForChild(LayoutBox& child, LayoutUnit childPreferredSize)
+void LayoutFlexibleBox::setOverrideMainAxisContentSizeForChild(LayoutBox& child, LayoutUnit childPreferredSize)
{
if (hasOrthogonalFlow(child))
- child.setOverrideLogicalContentHeight(childPreferredSize - child.borderAndPaddingLogicalHeight());
+ child.setOverrideLogicalContentHeight(childPreferredSize);
else
- child.setOverrideLogicalContentWidth(childPreferredSize - child.borderAndPaddingLogicalWidth());
+ child.setOverrideLogicalContentWidth(childPreferredSize);
}
LayoutUnit LayoutFlexibleBox::staticMainAxisPositionForPositionedChild(const LayoutBox& child)
@@ -1611,9 +1616,8 @@ void LayoutFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, cons
child->setMayNeedPaintInvalidation();
- LayoutUnit childPreferredSize = flexItem.flexedContentSize + mainAxisBorderAndPaddingExtentForChild(*child);
- setOverrideMainAxisSizeForChild(*child, childPreferredSize);
- if (childPreferredSize != mainAxisExtentForChild(*child)) {
+ setOverrideMainAxisContentSizeForChild(*child, flexItem.flexedContentSize);
+ if (flexItem.flexedContentSize != mainAxisContentExtentForChild(*child)) {
child->setChildNeedsLayout(MarkOnlyThis);
} else {
// To avoid double applying margin changes in updateAutoMarginsInCrossAxis, we reset the margins here.
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutFlexibleBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698