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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2037383002: [css-grid] Fix definite/indefinite size detection on block axis (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-percentage-widths
Patch Set: Use firstInFlowChildBox() 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 2713 matching lines...) Expand 10 before | Expand all | Expand 10 after
2724 bool includeBorderPadding = isTable(); 2724 bool includeBorderPadding = isTable();
2725 2725
2726 LayoutUnit stretchedFlexHeight(-1); 2726 LayoutUnit stretchedFlexHeight(-1);
2727 if (cb->isFlexItem()) 2727 if (cb->isFlexItem())
2728 stretchedFlexHeight = toLayoutFlexibleBox(cb->parent())->childLogicalHei ghtForPercentageResolution(*cb); 2728 stretchedFlexHeight = toLayoutFlexibleBox(cb->parent())->childLogicalHei ghtForPercentageResolution(*cb);
2729 2729
2730 if (isHorizontalWritingMode() != cb->isHorizontalWritingMode()) { 2730 if (isHorizontalWritingMode() != cb->isHorizontalWritingMode()) {
2731 availableHeight = containingBlockChild->containingBlockLogicalWidthForCo ntent(); 2731 availableHeight = containingBlockChild->containingBlockLogicalWidthForCo ntent();
2732 } else if (stretchedFlexHeight != LayoutUnit(-1)) { 2732 } else if (stretchedFlexHeight != LayoutUnit(-1)) {
2733 availableHeight = stretchedFlexHeight; 2733 availableHeight = stretchedFlexHeight;
2734 } else if (hasOverrideContainingBlockLogicalHeight()) { 2734 } else if (hasOverrideContainingBlockLogicalHeight() && !isOutOfFlowPosition edWithSpecifiedHeight) {
cbiesinger 2016/06/07 20:21:12 BTW, why is this change necessary? Seems like an u
Manuel Rego 2016/06/08 12:10:24 It's actually fixing bug #538513. That's why the
2735 availableHeight = overrideContainingBlockContentLogicalHeight(); 2735 availableHeight = overrideContainingBlockContentLogicalHeight();
2736 } else if (cbstyle.logicalHeight().isFixed()) { 2736 } else if (cbstyle.logicalHeight().isFixed()) {
2737 LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSiz ing(cbstyle.logicalHeight().value()); 2737 LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSiz ing(cbstyle.logicalHeight().value());
2738 availableHeight = cb->constrainContentBoxLogicalHeightByMinMax( 2738 availableHeight = cb->constrainContentBoxLogicalHeightByMinMax(
2739 contentBoxHeight - cb->scrollbarLogicalHeight(), LayoutUnit(-1)).cla mpNegativeToZero(); 2739 contentBoxHeight - cb->scrollbarLogicalHeight(), LayoutUnit(-1)).cla mpNegativeToZero();
2740 if (cb->isTableCell()) { 2740 if (cb->isTableCell()) {
2741 includeBorderPadding = true; 2741 includeBorderPadding = true;
2742 // We're sizing content to the height from the cell's style so don't involve the intrinsic padding used to align the content. 2742 // We're sizing content to the height from the cell's style so don't involve the intrinsic padding used to align the content.
2743 availableHeight -= cb->computedCSSPaddingBefore() + cb->computedCSSP addingAfter() + cb->borderBefore() + cb->borderAfter(); 2743 availableHeight -= cb->computedCSSPaddingBefore() + cb->computedCSSP addingAfter() + cb->borderBefore() + cb->borderAfter();
2744 } 2744 }
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after
4275 { 4275 {
4276 return logicalWidthIsResolvable(*this); 4276 return logicalWidthIsResolvable(*this);
4277 } 4277 }
4278 4278
4279 bool LayoutBox::percentageLogicalHeightIsResolvable() const 4279 bool LayoutBox::percentageLogicalHeightIsResolvable() const
4280 { 4280 {
4281 Length fakeLength(100, Percent); 4281 Length fakeLength(100, Percent);
4282 return computePercentageLogicalHeight(fakeLength) != -1; 4282 return computePercentageLogicalHeight(fakeLength) != -1;
4283 } 4283 }
4284 4284
4285 bool LayoutBox::hasDefiniteLogicalHeight() const
4286 {
4287 const Length& logicalHeight = style()->logicalHeight();
4288 if (logicalHeight.isIntrinsicOrAuto())
4289 return false;
4290 if (logicalHeight.isFixed())
4291 return true;
4292 // The size of the containing block of an absolutely positioned element is a lways definite with respect to that
4293 // element (http://dev.w3.org/csswg/css-sizing-3/#definite).
4294 if (isOutOfFlowPositioned())
4295 return true;
4296 if (hasOverrideContainingBlockLogicalHeight())
4297 return overrideContainingBlockContentLogicalHeight() != -1;
4298
4299 return percentageLogicalHeightIsResolvable();
4300 }
4301
4302 bool LayoutBox::hasUnsplittableScrollingOverflow() const 4285 bool LayoutBox::hasUnsplittableScrollingOverflow() const
4303 { 4286 {
4304 // We will paginate as long as we don't scroll overflow in the pagination di rection. 4287 // We will paginate as long as we don't scroll overflow in the pagination di rection.
4305 bool isHorizontal = isHorizontalWritingMode(); 4288 bool isHorizontal = isHorizontalWritingMode();
4306 if ((isHorizontal && !scrollsOverflowY()) || (!isHorizontal && !scrollsOverf lowX())) 4289 if ((isHorizontal && !scrollsOverflowY()) || (!isHorizontal && !scrollsOverf lowX()))
4307 return false; 4290 return false;
4308 4291
4309 // We do have overflow. We'll still be willing to paginate as long as the bl ock 4292 // We do have overflow. We'll still be willing to paginate as long as the bl ock
4310 // has auto logical height, auto or undefined max-logical-height and a zero or auto min-logical-height. 4293 // has auto logical height, auto or undefined max-logical-height and a zero or auto min-logical-height.
4311 // Note this is just a heuristic, and it's still possible to have overflow u nder these 4294 // Note this is just a heuristic, and it's still possible to have overflow u nder these
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
4921 m_rareData->m_snapAreas->remove(&snapArea); 4904 m_rareData->m_snapAreas->remove(&snapArea);
4922 } 4905 }
4923 } 4906 }
4924 4907
4925 SnapAreaSet* LayoutBox::snapAreas() const 4908 SnapAreaSet* LayoutBox::snapAreas() const
4926 { 4909 {
4927 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; 4910 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr;
4928 } 4911 }
4929 4912
4930 } // namespace blink 4913 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698