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

Unified Diff: Source/core/rendering/RenderBox.cpp

Issue 616583002: Revert of Blink doesn't honor percent heights on children of "align-self:stretch" flex items in a fixed-height (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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/rendering/RenderBox.h ('k') | Source/core/rendering/RenderFlexibleBox.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBox.cpp
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp
index cbf845eeec867fd21201069da18e0925d358e567..8c150d19f17d4ca1257f7ff3f20a7c7360971482 100644
--- a/Source/core/rendering/RenderBox.cpp
+++ b/Source/core/rendering/RenderBox.cpp
@@ -2027,17 +2027,14 @@
return logicalWidthResult;
}
-static bool flexItemHasStretchAlignment(const RenderObject* flexitem)
+static bool columnFlexItemHasStretchAlignment(const RenderObject* flexitem)
{
RenderObject* parent = flexitem->parent();
- // auto margins mean we don't stretch.
- if (parent->style()->isColumnFlexDirection()) {
- if (flexitem->style()->marginStart().isAuto() || flexitem->style()->marginEnd().isAuto())
- return false;
- } else {
- if (flexitem->style()->marginBefore().isAuto() || flexitem->style()->marginAfter().isAuto())
- return false;
- }
+ // auto margins mean we don't stretch. Note that this function will only be used for
+ // widths, so we don't have to check marginBefore/marginAfter.
+ ASSERT(parent->style()->isColumnFlexDirection());
+ if (flexitem->style()->marginStart().isAuto() || flexitem->style()->marginEnd().isAuto())
+ return false;
return flexitem->style()->alignSelf() == ItemPositionStretch || (flexitem->style()->alignSelf() == ItemPositionAuto && parent->style()->alignItems() == ItemPositionStretch);
}
@@ -2048,7 +2045,7 @@
return true;
// We don't stretch multiline flexboxes because they need to apply line spacing (align-content) first.
- if (parent->isFlexibleBox() && parent->style()->flexWrap() == FlexNoWrap && parent->style()->isColumnFlexDirection() && flexItemHasStretchAlignment(flexitem))
+ if (parent->isFlexibleBox() && parent->style()->flexWrap() == FlexNoWrap && parent->style()->isColumnFlexDirection() && columnFlexItemHasStretchAlignment(flexitem))
return true;
return false;
}
@@ -2081,7 +2078,7 @@
// For multiline columns, we need to apply align-content first, so we can't stretch now.
if (!parent()->style()->isColumnFlexDirection() || parent()->style()->flexWrap() != FlexNoWrap)
return true;
- if (!flexItemHasStretchAlignment(this))
+ if (!columnFlexItemHasStretchAlignment(this))
return true;
}
@@ -2385,13 +2382,11 @@
bool includeBorderPadding = isTable();
- if (isHorizontalWritingMode() != cb->isHorizontalWritingMode()) {
+ if (isHorizontalWritingMode() != cb->isHorizontalWritingMode())
availableHeight = containingBlockChild->containingBlockLogicalWidthForContent();
- } else if (hasOverrideContainingBlockLogicalHeight()) {
+ else if (hasOverrideContainingBlockLogicalHeight())
availableHeight = overrideContainingBlockContentLogicalHeight();
- } else if (cb->isFlexItem() && flexItemHasStretchAlignment(cb) && cb->hasOverrideHeight()) {
- availableHeight = cb->overrideLogicalContentHeight();
- } else if (cb->isTableCell()) {
+ else if (cb->isTableCell()) {
if (!skippedAutoHeightContainingBlock) {
// Table cells violate what the CSS spec says to do with heights. Basically we
// don't care if the cell specified a height or not. We just always make ourselves
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | Source/core/rendering/RenderFlexibleBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698