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

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

Issue 2086083002: Fix percentage handling for replaced elements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: with test Created 4 years, 6 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/LayoutBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
index 2dae9193d9c32f32b75eeb6aa231e20bf0b40965..8d2f18f7012defd451e73877a9219c51143dc035 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -2910,8 +2910,14 @@ LayoutUnit LayoutBox::computeReplacedLogicalHeightUsing(SizeType sizeType, const
LayoutObject* cb = isOutOfFlowPositioned() ? container() : containingBlock();
while (cb->isAnonymous())
cb = cb->containingBlock();
- if (cb->isLayoutBlock())
- toLayoutBlock(cb)->addPercentHeightDescendant(const_cast<LayoutBox*>(this));
+ LayoutUnit stretchedFlexHeight(-1);
+ if (cb->isLayoutBlock()) {
+ LayoutBlock* block = toLayoutBlock(cb);
+ block->addPercentHeightDescendant(const_cast<LayoutBox*>(this));
+ if (block->isFlexItem())
+ stretchedFlexHeight = toLayoutFlexibleBox(block->parent())->childLogicalHeightForPercentageResolution(*block);
+
+ }
if (cb->isOutOfFlowPositioned() && cb->style()->height().isAuto() && !(cb->style()->top().isAuto() || cb->style()->bottom().isAuto())) {
ASSERT_WITH_SECURITY_IMPLICATION(cb->isLayoutBlock());
@@ -2929,6 +2935,8 @@ LayoutUnit LayoutBox::computeReplacedLogicalHeightUsing(SizeType sizeType, const
LayoutUnit availableHeight;
if (isOutOfFlowPositioned()) {
availableHeight = containingBlockLogicalHeightForPositioned(toLayoutBoxModelObject(cb));
+ } else if (stretchedFlexHeight != -1) {
+ availableHeight = stretchedFlexHeight;
} else {
availableHeight = containingBlockLogicalHeightForContent(IncludeMarginBorderPadding);
// It is necessary to use the border-box to match WinIE's broken

Powered by Google App Engine
This is Rietveld 408576698