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

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

Issue 1383003002: [css-grid] Fix definite/indefinite size detection for abspos elements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 2381 matching lines...) Expand 10 before | Expand all | Expand 10 after
2392 return intrinsicContentHeight; 2392 return intrinsicContentHeight;
2393 } 2393 }
2394 if (logicalHeightLength.isFillAvailable()) 2394 if (logicalHeightLength.isFillAvailable())
2395 return containingBlock()->availableLogicalHeight(ExcludeMarginBorderPadd ing) - borderAndPadding; 2395 return containingBlock()->availableLogicalHeight(ExcludeMarginBorderPadd ing) - borderAndPadding;
2396 ASSERT_NOT_REACHED(); 2396 ASSERT_NOT_REACHED();
2397 return 0; 2397 return 0;
2398 } 2398 }
2399 2399
2400 LayoutUnit LayoutBox::computeContentAndScrollbarLogicalHeightUsing(SizeType heig htType, const Length& height, LayoutUnit intrinsicContentHeight) const 2400 LayoutUnit LayoutBox::computeContentAndScrollbarLogicalHeightUsing(SizeType heig htType, const Length& height, LayoutUnit intrinsicContentHeight) const
2401 { 2401 {
2402 if (isOutOfFlowPositioned() && height.isAuto() && !style()->logicalTop().isA uto() && !style()->logicalBottom().isAuto()) {
2403 LogicalExtentComputedValues computedValues;
2404 computeLogicalHeight(logicalHeight(), 0, computedValues);
mstensho (USE GERRIT) 2015/10/02 09:08:50 I don't think this is the right place to do this.
cbiesinger 2015/10/02 16:40:19 Yes, this is handled in computePositionedLogicalHe
Manuel Rego 2016/04/08 07:53:14 It seems this is not needed anymore, so I'm removi
2405 return computedValues.m_extent - borderAndPaddingLogicalHeight() - scrol lbarLogicalHeight();
2406 }
2407
2402 if (height.isAuto()) 2408 if (height.isAuto())
2403 return heightType == MinSize ? 0 : -1; 2409 return heightType == MinSize ? 0 : -1;
2404 // FIXME(cbiesinger): The css-sizing spec is considering changing what min-c ontent/max-content should resolve to. 2410 // FIXME(cbiesinger): The css-sizing spec is considering changing what min-c ontent/max-content should resolve to.
2405 // If that happens, this code will have to change. 2411 // If that happens, this code will have to change.
2406 if (height.isIntrinsic()) { 2412 if (height.isIntrinsic()) {
2407 if (intrinsicContentHeight == -1) 2413 if (intrinsicContentHeight == -1)
2408 return -1; // Intrinsic height isn't available. 2414 return -1; // Intrinsic height isn't available.
2409 return computeIntrinsicLogicalContentHeightUsing(height, intrinsicConten tHeight, borderAndPaddingLogicalHeight()) + scrollbarLogicalHeight(); 2415 return computeIntrinsicLogicalContentHeightUsing(height, intrinsicConten tHeight, borderAndPaddingLogicalHeight()) + scrollbarLogicalHeight();
2410 } 2416 }
2411 if (height.isFixed()) 2417 if (height.isFixed())
(...skipping 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after
4256 const LayoutBox* box = &layoutBox; 4262 const LayoutBox* box = &layoutBox;
4257 while (!box->isLayoutView() && !box->isOutOfFlowPositioned() 4263 while (!box->isLayoutView() && !box->isOutOfFlowPositioned()
4258 && (box->style()->logicalWidth().isAuto() || box->isAnonymousBlock()) 4264 && (box->style()->logicalWidth().isAuto() || box->isAnonymousBlock())
4259 && !box->hasOverrideContainingBlockLogicalWidth()) 4265 && !box->hasOverrideContainingBlockLogicalWidth())
4260 box = box->containingBlock(); 4266 box = box->containingBlock();
4261 4267
4262 if (box->style()->logicalWidth().isFixed()) 4268 if (box->style()->logicalWidth().isFixed())
4263 return true; 4269 return true;
4264 if (box->isLayoutView()) 4270 if (box->isLayoutView())
4265 return true; 4271 return true;
4266 // The size of the containing block of an absolutely positioned element is a lways definite with respect to that 4272 if (box->isOutOfFlowPositioned() && box->style()->logicalWidth().isAuto() && !box->style()->logicalLeft().isAuto() && !box->style()->logicalRight().isAuto() )
mstensho (USE GERRIT) 2015/10/02 09:08:50 The box->style()->logicalWidth().isAuto() confuses
cbiesinger 2015/10/02 16:40:19 I too am skeptical that this is correct... do you
Manuel Rego 2016/04/08 07:53:14 Yeah, we don't need to check if width is auto too,
4267 // element (http://dev.w3.org/csswg/css-sizing-3/#definite).
4268 if (box->isOutOfFlowPositioned())
4269 return true; 4273 return true;
4270 if (box->hasOverrideContainingBlockLogicalWidth()) 4274 if (box->hasOverrideContainingBlockLogicalWidth())
4271 return box->overrideContainingBlockContentLogicalWidth() != -1; 4275 return box->overrideContainingBlockContentLogicalWidth() != -1;
4272 if (box->style()->logicalWidth().hasPercent()) 4276 if (box->style()->logicalWidth().hasPercent())
4273 return logicalWidthIsResolvable(*box->containingBlock()); 4277 return logicalWidthIsResolvable(*box->containingBlock());
4274 4278
4275 return false; 4279 return false;
4276 } 4280 }
4277 4281
4278 bool LayoutBox::hasDefiniteLogicalWidth() const 4282 bool LayoutBox::hasDefiniteLogicalWidth() const
4279 { 4283 {
4280 return logicalWidthIsResolvable(*this); 4284 return logicalWidthIsResolvable(*this);
4281 } 4285 }
4282 4286
4283 bool LayoutBox::percentageLogicalHeightIsResolvable() const 4287 bool LayoutBox::percentageLogicalHeightIsResolvable() const
4284 { 4288 {
4285 Length fakeLength(100, Percent); 4289 Length fakeLength(100, Percent);
4286 return computePercentageLogicalHeight(fakeLength) != -1; 4290 return computePercentageLogicalHeight(fakeLength) != -1;
4287 } 4291 }
4288 4292
4289 bool LayoutBox::hasDefiniteLogicalHeight() const 4293 bool LayoutBox::hasDefiniteLogicalHeight() const
4290 { 4294 {
4291 const Length& logicalHeight = style()->logicalHeight(); 4295 const Length& logicalHeight = style()->logicalHeight();
4292 if (logicalHeight.isIntrinsicOrAuto())
4293 return false;
4294 if (logicalHeight.isFixed()) 4296 if (logicalHeight.isFixed())
4295 return true; 4297 return true;
4296 // The size of the containing block of an absolutely positioned element is a lways definite with respect to that 4298 if (isOutOfFlowPositioned() && logicalHeight.isAuto() && !style()->logicalTo p().isAuto() && !style()->logicalBottom().isAuto())
mstensho (USE GERRIT) 2015/10/02 09:08:50 Same question as in logicalWidthIsResolvable().
cbiesinger 2015/10/02 16:40:19 As I wrote in the other patch: I don't believe tha
Manuel Rego 2016/04/08 07:53:14 Again I've removed here the condition to check if
4297 // element (http://dev.w3.org/csswg/css-sizing-3/#definite).
4298 if (isOutOfFlowPositioned())
4299 return true; 4299 return true;
4300 if (hasOverrideContainingBlockLogicalHeight()) 4300 if (hasOverrideContainingBlockLogicalHeight())
4301 return overrideContainingBlockContentLogicalHeight() != -1; 4301 return overrideContainingBlockContentLogicalHeight() != -1;
4302 if (logicalHeight.isIntrinsicOrAuto())
4303 return false;
4302 4304
4303 return percentageLogicalHeightIsResolvable(); 4305 return percentageLogicalHeightIsResolvable();
4304 } 4306 }
4305 4307
4306 bool LayoutBox::hasUnsplittableScrollingOverflow() const 4308 bool LayoutBox::hasUnsplittableScrollingOverflow() const
4307 { 4309 {
4308 // We will paginate as long as we don't scroll overflow in the pagination di rection. 4310 // We will paginate as long as we don't scroll overflow in the pagination di rection.
4309 bool isHorizontal = isHorizontalWritingMode(); 4311 bool isHorizontal = isHorizontalWritingMode();
4310 if ((isHorizontal && !scrollsOverflowY()) || (!isHorizontal && !scrollsOverf lowX())) 4312 if ((isHorizontal && !scrollsOverflowY()) || (!isHorizontal && !scrollsOverf lowX()))
4311 return false; 4313 return false;
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
4754 StyleImage* borderImage = style()->borderImage().image(); 4756 StyleImage* borderImage = style()->borderImage().image();
4755 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); 4757 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded();
4756 } 4758 }
4757 4759
4758 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const 4760 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const
4759 { 4761 {
4760 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr; 4762 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr;
4761 } 4763 }
4762 4764
4763 } // namespace blink 4765 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-container-percentage-tracks-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698