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

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

Issue 1258693005: [css-flexbox] Correctly determine whether a percentage height is definite (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix tests Created 5 years, 4 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 | « 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: Source/core/layout/LayoutFlexibleBox.cpp
diff --git a/Source/core/layout/LayoutFlexibleBox.cpp b/Source/core/layout/LayoutFlexibleBox.cpp
index 0a676c9316df5f2186bf503278dda462b71ce7a6..04978014df78e11f96be8b7dc8a8cda4df07dc56 100644
--- a/Source/core/layout/LayoutFlexibleBox.cpp
+++ b/Source/core/layout/LayoutFlexibleBox.cpp
@@ -363,11 +363,6 @@ LayoutUnit LayoutFlexibleBox::childIntrinsicWidth(LayoutBox& child) const
return child.size().width();
}
-bool LayoutFlexibleBox::mainAxisExtentIsDefinite() const
-{
- return isColumnFlow() ? hasDefiniteLogicalHeight() : hasDefiniteLogicalWidth();
-}
-
LayoutUnit LayoutFlexibleBox::crossAxisIntrinsicExtentForChild(LayoutBox& child) const
{
return isHorizontalFlow() ? childIntrinsicHeight(child) : childIntrinsicWidth(child);
@@ -596,14 +591,22 @@ LayoutUnit LayoutFlexibleBox::mainAxisBorderAndPaddingExtentForChild(LayoutBox&
return isHorizontalFlow() ? child.borderAndPaddingWidth() : child.borderAndPaddingHeight();
}
-bool LayoutFlexibleBox::mainAxisLengthIsIndefinite(const Length& flexBasis) const
+bool LayoutFlexibleBox::mainAxisLengthIsIndefinite(LayoutBox& child, const Length& flexBasis) const
leviw_travelin_and_unemployed 2015/08/05 00:06:25 Maybe a TODO change this to definite :p
cbiesinger 2015/08/05 04:46:38 https://codereview.chromium.org/1268253002/
{
- return flexBasis.isAuto() || (flexBasis.hasPercent() && !mainAxisExtentIsDefinite());
+ if (flexBasis.isAuto())
+ return true;
+ if (flexBasis.hasPercent()) {
+ return isColumnFlow() ?
+ child.computePercentageLogicalHeight(flexBasis) == -1 :
+ !hasDefiniteLogicalWidth();
+ }
+ // FIXME(cbiesinger): Is this correct?
+ return false;
}
bool LayoutFlexibleBox::childFlexBaseSizeRequiresLayout(LayoutBox& child) const
{
- return mainAxisLengthIsIndefinite(flexBasisForChild(child)) && hasOrthogonalFlow(child);
+ return mainAxisLengthIsIndefinite(child, flexBasisForChild(child)) && hasOrthogonalFlow(child);
}
LayoutUnit LayoutFlexibleBox::computeInnerFlexBaseSizeForChild(LayoutBox& child, ChildLayoutType childLayoutType)
@@ -614,7 +617,7 @@ LayoutUnit LayoutFlexibleBox::computeInnerFlexBaseSizeForChild(LayoutBox& child,
UseCounter::count(document(), UseCounter::AspectRatioFlexItem);
Length flexBasis = flexBasisForChild(child);
- if (mainAxisLengthIsIndefinite(flexBasis)) {
+ if (mainAxisLengthIsIndefinite(child, flexBasis)) {
LayoutUnit mainAxisExtent;
if (hasOrthogonalFlow(child)) {
if (childLayoutType == NeverLayout)
@@ -861,7 +864,7 @@ LayoutUnit LayoutFlexibleBox::adjustChildSizeForMinAndMax(LayoutBox& child, Layo
contentSize = maxExtent;
Length mainSize = isHorizontalFlow() ? child.styleRef().width() : child.styleRef().height();
- if (!mainAxisLengthIsIndefinite(mainSize)) {
+ if (!mainAxisLengthIsIndefinite(child, mainSize)) {
LayoutUnit resolvedMainSize = computeMainAxisExtentForChild(child, MainOrPreferredSize, mainSize);
ASSERT(resolvedMainSize >= 0);
LayoutUnit specifiedSize = maxExtent != -1 ? std::min(resolvedMainSize, maxExtent) : resolvedMainSize;
« no previous file with comments | « Source/core/layout/LayoutFlexibleBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698