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

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

Issue 1081433005: LayoutBox::hasDefiniteLogicalHeight() should not consider abspos boxes as definite (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove flexbox change 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/LayoutBox.h ('k') | Source/core/layout/LayoutGrid.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4247 matching lines...) Expand 10 before | Expand all | Expand 10 after
4258 return logicalWidthIsResolvable(*box->containingBlock()); 4258 return logicalWidthIsResolvable(*box->containingBlock());
4259 4259
4260 return false; 4260 return false;
4261 } 4261 }
4262 4262
4263 bool LayoutBox::hasDefiniteLogicalWidth() const 4263 bool LayoutBox::hasDefiniteLogicalWidth() const
4264 { 4264 {
4265 return logicalWidthIsResolvable(*this); 4265 return logicalWidthIsResolvable(*this);
4266 } 4266 }
4267 4267
4268 bool LayoutBox::percentageLogicalHeightIsResolvable() const 4268 bool LayoutBox::logicalHeightIsDefinite(const Length& length) const
4269 { 4269 {
4270 Length fakeLength(100, Percent); 4270 if (length.isIntrinsicOrAuto())
Manuel Rego 2015/09/23 10:22:02 I think this still has the original problem. If t
cbiesinger 2015/10/02 16:16:43 I don't believe that's a correct interpretation of
4271 return computePercentageLogicalHeight(fakeLength) != -1; 4271 return false;
4272 } 4272 if (length.isFixed())
4273 return true;
4274 if (length.hasPercent()) {
4275 if (hasOverrideContainingBlockLogicalHeight())
4276 return overrideContainingBlockContentLogicalHeight() != -1;
4273 4277
4274 bool LayoutBox::hasDefiniteLogicalHeight() const 4278 return computePercentageLogicalHeight(length) != -1;
4275 { 4279 }
4276 const Length& logicalHeight = style()->logicalHeight(); 4280 if (length.isMaxSizeNone())
Manuel Rego 2015/09/23 10:22:02 I don't get what the max-height has to do in order
4277 if (logicalHeight.isIntrinsicOrAuto())
4278 return false;
4279 if (logicalHeight.isFixed())
4280 return true; 4281 return true;
4281 // The size of the containing block of an absolutely positioned element is a lways definite with respect to that 4282 return false;
4282 // element (http://dev.w3.org/csswg/css-sizing-3/#definite).
4283 if (isOutOfFlowPositioned())
4284 return true;
4285 if (hasOverrideContainingBlockLogicalHeight())
4286 return overrideContainingBlockContentLogicalHeight() != -1;
4287
4288 return percentageLogicalHeightIsResolvable();
4289 } 4283 }
4290 4284
4291 bool LayoutBox::hasUnsplittableScrollingOverflow() const 4285 bool LayoutBox::hasUnsplittableScrollingOverflow() const
4292 { 4286 {
4293 // 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.
4294 bool isHorizontal = isHorizontalWritingMode(); 4288 bool isHorizontal = isHorizontalWritingMode();
4295 if ((isHorizontal && !scrollsOverflowY()) || (!isHorizontal && !scrollsOverf lowX())) 4289 if ((isHorizontal && !scrollsOverflowY()) || (!isHorizontal && !scrollsOverf lowX()))
4296 return false; 4290 return false;
4297 4291
4298 // 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
4299 // 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.
4300 // 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
4301 // conditions, but it should work out to be good enough for common cases. Pa ginating overflow 4295 // conditions, but it should work out to be good enough for common cases. Pa ginating overflow
4302 // with scrollbars present is not the end of the world and is what we used t o do in the old model anyway. 4296 // with scrollbars present is not the end of the world and is what we used t o do in the old model anyway.
4303 return !style()->logicalHeight().isIntrinsicOrAuto() 4297 return !style()->logicalHeight().isIntrinsicOrAuto()
4304 || (!style()->logicalMaxHeight().isIntrinsicOrAuto() && !style()->logica lMaxHeight().isMaxSizeNone() && (!style()->logicalMaxHeight().hasPercent() || pe rcentageLogicalHeightIsResolvable())) 4298 || (logicalHeightIsDefinite(style()->logicalMaxHeight()) && !style()->lo gicalMaxHeight().isMaxSizeNone())
4305 || (!style()->logicalMinHeight().isIntrinsicOrAuto() && style()->logical MinHeight().isPositive() && (!style()->logicalMinHeight().hasPercent() || percen tageLogicalHeightIsResolvable())); 4299 || (logicalHeightIsDefinite(style()->logicalMinHeight()) && style()->log icalMinHeight().isPositive());
4306 } 4300 }
4307 4301
4308 bool LayoutBox::isUnsplittableForPagination() const 4302 bool LayoutBox::isUnsplittableForPagination() const
4309 { 4303 {
4310 return isReplaced() || hasUnsplittableScrollingOverflow() || (parent() && is WritingModeRoot()); 4304 return isReplaced() || hasUnsplittableScrollingOverflow() || (parent() && is WritingModeRoot());
4311 } 4305 }
4312 4306
4313 LayoutUnit LayoutBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction , LinePositionMode /*linePositionMode*/) const 4307 LayoutUnit LayoutBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction , LinePositionMode /*linePositionMode*/) const
4314 { 4308 {
4315 if (isReplaced()) 4309 if (isReplaced())
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
4739 StyleImage* borderImage = style()->borderImage().image(); 4733 StyleImage* borderImage = style()->borderImage().image();
4740 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); 4734 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded();
4741 } 4735 }
4742 4736
4743 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const 4737 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const
4744 { 4738 {
4745 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr; 4739 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr;
4746 } 4740 }
4747 4741
4748 } // namespace blink 4742 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBox.h ('k') | Source/core/layout/LayoutGrid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698