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

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

Issue 914993003: [CSS Grid Layout] Determine definite/indefinite size properly in nested grids (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rename isRenderView() calls to isLayoutView() Created 5 years, 10 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
« 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 4177 matching lines...) Expand 10 before | Expand all | Expand 10 after
4188 return; 4188 return;
4189 4189
4190 if (!hasVisualOverflow() && contentsVisualOverflowRect().isEmpty()) { 4190 if (!hasVisualOverflow() && contentsVisualOverflowRect().isEmpty()) {
4191 clearAllOverflows(); 4191 clearAllOverflows();
4192 return; 4192 return;
4193 } 4193 }
4194 4194
4195 m_overflow->setLayoutOverflow(noOverflowRect()); 4195 m_overflow->setLayoutOverflow(noOverflowRect());
4196 } 4196 }
4197 4197
4198 bool LayoutBox::logicalWidthIsResolvableFromBlock(const LayoutBlock* containingB lock) 4198 static bool logicalWidthIsResolvable(const LayoutBox& layoutBox)
4199 { 4199 {
4200 const LayoutBlock* cb = containingBlock; 4200 const LayoutBox* box = &layoutBox;
4201 while (!cb->isLayoutView() && !cb->isOutOfFlowPositioned() && (cb->style()-> logicalWidth().isAuto() || cb->isAnonymousBlock())) 4201 while (!box->isLayoutView() && !box->isOutOfFlowPositioned()
4202 cb = cb->containingBlock(); 4202 && (box->style()->logicalWidth().isAuto() || box->isAnonymousBlock())
4203 && !box->hasOverrideContainingBlockLogicalWidth())
4204 box = box->containingBlock();
4203 4205
4204 if (cb->style()->logicalWidth().isFixed()) 4206 if (box->style()->logicalWidth().isFixed())
4205 return true; 4207 return true;
4206 if (cb->isLayoutView()) 4208 if (box->isLayoutView())
4207 return true; 4209 return true;
4208 if (cb->isOutOfFlowPositioned()) 4210 // The size of the containing block of an absolutely positioned element is a lways definite with respect to that
4211 // element (http://dev.w3.org/csswg/css-sizing-3/#definite).
4212 if (box->isOutOfFlowPositioned())
4209 return true; 4213 return true;
4210 if (cb->style()->logicalWidth().isPercent()) 4214 if (box->hasOverrideContainingBlockLogicalWidth())
4211 return logicalWidthIsResolvableFromBlock(cb->containingBlock()); 4215 return box->overrideContainingBlockContentLogicalWidth() != -1;
4216 if (box->style()->logicalWidth().isPercent())
4217 return logicalWidthIsResolvable(*box->containingBlock());
4212 4218
4213 return false; 4219 return false;
4214 } 4220 }
4215 4221
4216 bool LayoutBox::hasDefiniteLogicalWidth() const 4222 bool LayoutBox::hasDefiniteLogicalWidth() const
4217 { 4223 {
4218 const Length& logicalWidth = style()->logicalWidth(); 4224 return logicalWidthIsResolvable(*this);
4219 if (logicalWidth.isIntrinsic() || logicalWidth.isLegacyIntrinsic())
4220 return false;
4221 if (logicalWidth.isFixed())
4222 return true;
4223 // The size of the containing block of an absolutely positioned element is a lways definite with respect to that
4224 // element (http://dev.w3.org/csswg/css-sizing-3/#definite).
4225 if (isOutOfFlowPositioned())
4226 return true;
4227
4228 return LayoutBox::logicalWidthIsResolvableFromBlock(containingBlock());
4229 } 4225 }
4230 4226
4231 inline static bool percentageLogicalHeightIsResolvable(const LayoutBox* box) 4227 inline static bool percentageLogicalHeightIsResolvable(const LayoutBox* box)
4232 { 4228 {
4233 return LayoutBox::percentageLogicalHeightIsResolvableFromBlock(box->containi ngBlock(), box->isOutOfFlowPositioned()); 4229 return LayoutBox::percentageLogicalHeightIsResolvableFromBlock(box->containi ngBlock(), box->isOutOfFlowPositioned());
4234 } 4230 }
4235 4231
4236 bool LayoutBox::percentageLogicalHeightIsResolvableFromBlock(const LayoutBlock* containingBlock, bool isOutOfFlowPositioned) 4232 bool LayoutBox::percentageLogicalHeightIsResolvableFromBlock(const LayoutBlock* containingBlock, bool isOutOfFlowPositioned)
4237 { 4233 {
4238 // In quirks mode, blocks with auto height are skipped, and we keep looking for an enclosing 4234 // In quirks mode, blocks with auto height are skipped, and we keep looking for an enclosing
4239 // block that may have a specified height and then use it. In strict mode, t his violates the 4235 // block that may have a specified height and then use it. In strict mode, t his violates the
4240 // specification, which states that percentage heights just revert to auto i f the containing 4236 // specification, which states that percentage heights just revert to auto i f the containing
4241 // block has an auto height. We still skip anonymous containing blocks in bo th modes, though, and look 4237 // block has an auto height. We still skip anonymous containing blocks in bo th modes, though, and look
4242 // only at explicit containers. 4238 // only at explicit containers.
4243 const LayoutBlock* cb = containingBlock; 4239 const LayoutBlock* cb = containingBlock;
4244 bool inQuirksMode = cb->document().inQuirksMode(); 4240 bool inQuirksMode = cb->document().inQuirksMode();
4245 while (!cb->isLayoutView() && !cb->isBody() && !cb->isTableCell() && !cb->is OutOfFlowPositioned() && cb->style()->logicalHeight().isAuto()) { 4241 while (!cb->isLayoutView() && !cb->isBody() && !cb->isTableCell() && !cb->is OutOfFlowPositioned() && cb->style()->logicalHeight().isAuto()) {
4246 if (!inQuirksMode && !cb->isAnonymousBlock()) 4242 if (!inQuirksMode && !cb->isAnonymousBlock())
4247 break; 4243 break;
4244 if (cb->hasOverrideContainingBlockLogicalHeight())
4245 return cb->overrideContainingBlockContentLogicalHeight() != -1;
4246
4248 cb = cb->containingBlock(); 4247 cb = cb->containingBlock();
4249 } 4248 }
4250 4249
4251 // A positioned element that specified both top/bottom or that specifies hei ght should be treated as though it has a height 4250 // A positioned element that specified both top/bottom or that specifies hei ght should be treated as though it has a height
4252 // explicitly specified that can be used for any percentage computations. 4251 // explicitly specified that can be used for any percentage computations.
4253 // FIXME: We can't just check top/bottom here. 4252 // FIXME: We can't just check top/bottom here.
4254 // https://bugs.webkit.org/show_bug.cgi?id=46500 4253 // https://bugs.webkit.org/show_bug.cgi?id=46500
4255 bool isOutOfFlowPositionedWithSpecifiedHeight = cb->isOutOfFlowPositioned() && (!cb->style()->logicalHeight().isAuto() || (!cb->style()->top().isAuto() && ! cb->style()->bottom().isAuto())); 4254 bool isOutOfFlowPositionedWithSpecifiedHeight = cb->isOutOfFlowPositioned() && (!cb->style()->logicalHeight().isAuto() || (!cb->style()->top().isAuto() && ! cb->style()->bottom().isAuto()));
4256 4255
4257 // Table cells violate what the CSS spec says to do with heights. Basically we 4256 // Table cells violate what the CSS spec says to do with heights. Basically we
(...skipping 23 matching lines...) Expand all
4281 { 4280 {
4282 const Length& logicalHeight = style()->logicalHeight(); 4281 const Length& logicalHeight = style()->logicalHeight();
4283 if (logicalHeight.isIntrinsicOrAuto()) 4282 if (logicalHeight.isIntrinsicOrAuto())
4284 return false; 4283 return false;
4285 if (logicalHeight.isFixed()) 4284 if (logicalHeight.isFixed())
4286 return true; 4285 return true;
4287 // The size of the containing block of an absolutely positioned element is a lways definite with respect to that 4286 // The size of the containing block of an absolutely positioned element is a lways definite with respect to that
4288 // element (http://dev.w3.org/csswg/css-sizing-3/#definite). 4287 // element (http://dev.w3.org/csswg/css-sizing-3/#definite).
4289 if (isOutOfFlowPositioned()) 4288 if (isOutOfFlowPositioned())
4290 return true; 4289 return true;
4290 if (hasOverrideContainingBlockLogicalHeight())
4291 return overrideContainingBlockContentLogicalHeight() != -1;
4291 4292
4292 return percentageLogicalHeightIsResolvable(this); 4293 return percentageLogicalHeightIsResolvable(this);
4293 } 4294 }
4294 4295
4295 bool LayoutBox::hasUnsplittableScrollingOverflow() const 4296 bool LayoutBox::hasUnsplittableScrollingOverflow() const
4296 { 4297 {
4297 // We will paginate as long as we don't scroll overflow in the pagination di rection. 4298 // We will paginate as long as we don't scroll overflow in the pagination di rection.
4298 bool isHorizontal = isHorizontalWritingMode(); 4299 bool isHorizontal = isHorizontalWritingMode();
4299 if ((isHorizontal && !scrollsOverflowY()) || (!isHorizontal && !scrollsOverf lowX())) 4300 if ((isHorizontal && !scrollsOverflowY()) || (!isHorizontal && !scrollsOverf lowX()))
4300 return false; 4301 return false;
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
4627 } 4628 }
4628 4629
4629 void LayoutBox::invalidateDisplayItemClients(DisplayItemList* displayItemList) c onst 4630 void LayoutBox::invalidateDisplayItemClients(DisplayItemList* displayItemList) c onst
4630 { 4631 {
4631 LayoutBoxModelObject::invalidateDisplayItemClients(displayItemList); 4632 LayoutBoxModelObject::invalidateDisplayItemClients(displayItemList);
4632 if (LayerScrollableArea* area = scrollableArea()) 4633 if (LayerScrollableArea* area = scrollableArea())
4633 displayItemList->invalidate(area->displayItemClient()); 4634 displayItemList->invalidate(area->displayItemClient());
4634 } 4635 }
4635 4636
4636 } // namespace blink 4637 } // 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