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

Side by Side Diff: Source/core/rendering/RenderBox.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: 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
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 4158 matching lines...) Expand 10 before | Expand all | Expand 10 after
4169 return; 4169 return;
4170 4170
4171 if (!hasVisualOverflow() && contentsVisualOverflowRect().isEmpty()) { 4171 if (!hasVisualOverflow() && contentsVisualOverflowRect().isEmpty()) {
4172 clearAllOverflows(); 4172 clearAllOverflows();
4173 return; 4173 return;
4174 } 4174 }
4175 4175
4176 m_overflow->setLayoutOverflow(noOverflowRect()); 4176 m_overflow->setLayoutOverflow(noOverflowRect());
4177 } 4177 }
4178 4178
4179 bool RenderBox::logicalWidthIsResolvableFromBlock(const RenderBlock* containingB lock) 4179 bool RenderBox::logicalWidthIsResolvableFromBlock(const RenderBlock* containingB lock)
Julien - ping for review 2015/02/18 22:13:16 This function looks like it could have static link
Manuel Rego 2015/02/25 16:57:59 This is marked as static in LayoutBox.h like perce
4180 { 4180 {
4181 const RenderBlock* cb = containingBlock; 4181 const RenderBlock* cb = containingBlock;
4182 while (!cb->isRenderView() && !cb->isOutOfFlowPositioned() && (cb->style()-> logicalWidth().isAuto() || cb->isAnonymousBlock())) 4182 while (!cb->isRenderView() && !cb->isOutOfFlowPositioned() && (cb->style()-> logicalWidth().isAuto() || cb->isAnonymousBlock())) {
4183 if (cb->hasOverrideContainingBlockLogicalWidth())
4184 return cb->overrideContainingBlockContentLogicalWidth() != -1;
Julien - ping for review 2015/02/18 22:13:16 I am concerned about this logic needing the bits i
Manuel Rego 2015/02/25 16:57:59 Done.
4185
4183 cb = cb->containingBlock(); 4186 cb = cb->containingBlock();
4187 }
4184 4188
4185 if (cb->style()->logicalWidth().isFixed()) 4189 if (cb->style()->logicalWidth().isFixed())
4186 return true; 4190 return true;
4187 if (cb->isRenderView()) 4191 if (cb->isRenderView())
4188 return true; 4192 return true;
4189 if (cb->isOutOfFlowPositioned()) 4193 if (cb->isOutOfFlowPositioned())
4190 return true; 4194 return true;
4191 if (cb->style()->logicalWidth().isPercent()) 4195 if (cb->style()->logicalWidth().isPercent())
4192 return logicalWidthIsResolvableFromBlock(cb->containingBlock()); 4196 return logicalWidthIsResolvableFromBlock(cb->containingBlock());
4193 4197
4194 return false; 4198 return false;
4195 } 4199 }
4196 4200
4197 bool RenderBox::hasDefiniteLogicalWidth() const 4201 bool RenderBox::hasDefiniteLogicalWidth() const
4198 { 4202 {
4199 const Length& logicalWidth = style()->logicalWidth(); 4203 const Length& logicalWidth = style()->logicalWidth();
4200 if (logicalWidth.isIntrinsic() || logicalWidth.isLegacyIntrinsic()) 4204 if (logicalWidth.isIntrinsic() || logicalWidth.isLegacyIntrinsic())
4201 return false; 4205 return false;
4202 if (logicalWidth.isFixed()) 4206 if (logicalWidth.isFixed())
4203 return true; 4207 return true;
4204 // The size of the containing block of an absolutely positioned element is a lways definite with respect to that 4208 // The size of the containing block of an absolutely positioned element is a lways definite with respect to that
4205 // element (http://dev.w3.org/csswg/css-sizing-3/#definite). 4209 // element (http://dev.w3.org/csswg/css-sizing-3/#definite).
4206 if (isOutOfFlowPositioned()) 4210 if (isOutOfFlowPositioned())
4207 return true; 4211 return true;
4212 if (hasOverrideContainingBlockLogicalWidth())
4213 return overrideContainingBlockContentLogicalWidth() != -1;
4208 4214
4209 return RenderBox::logicalWidthIsResolvableFromBlock(containingBlock()); 4215 return RenderBox::logicalWidthIsResolvableFromBlock(containingBlock());
4210 } 4216 }
4211 4217
4212 inline static bool percentageLogicalHeightIsResolvable(const RenderBox* box) 4218 inline static bool percentageLogicalHeightIsResolvable(const RenderBox* box)
4213 { 4219 {
4214 return RenderBox::percentageLogicalHeightIsResolvableFromBlock(box->containi ngBlock(), box->isOutOfFlowPositioned()); 4220 return RenderBox::percentageLogicalHeightIsResolvableFromBlock(box->containi ngBlock(), box->isOutOfFlowPositioned());
4215 } 4221 }
4216 4222
4217 bool RenderBox::percentageLogicalHeightIsResolvableFromBlock(const RenderBlock* containingBlock, bool isOutOfFlowPositioned) 4223 bool RenderBox::percentageLogicalHeightIsResolvableFromBlock(const RenderBlock* containingBlock, bool isOutOfFlowPositioned)
4218 { 4224 {
4219 // In quirks mode, blocks with auto height are skipped, and we keep looking for an enclosing 4225 // In quirks mode, blocks with auto height are skipped, and we keep looking for an enclosing
4220 // block that may have a specified height and then use it. In strict mode, t his violates the 4226 // block that may have a specified height and then use it. In strict mode, t his violates the
4221 // specification, which states that percentage heights just revert to auto i f the containing 4227 // specification, which states that percentage heights just revert to auto i f the containing
4222 // block has an auto height. We still skip anonymous containing blocks in bo th modes, though, and look 4228 // block has an auto height. We still skip anonymous containing blocks in bo th modes, though, and look
4223 // only at explicit containers. 4229 // only at explicit containers.
4224 const RenderBlock* cb = containingBlock; 4230 const RenderBlock* cb = containingBlock;
4225 bool inQuirksMode = cb->document().inQuirksMode(); 4231 bool inQuirksMode = cb->document().inQuirksMode();
4226 while (!cb->isRenderView() && !cb->isBody() && !cb->isTableCell() && !cb->is OutOfFlowPositioned() && cb->style()->logicalHeight().isAuto()) { 4232 while (!cb->isRenderView() && !cb->isBody() && !cb->isTableCell() && !cb->is OutOfFlowPositioned() && cb->style()->logicalHeight().isAuto()) {
4227 if (!inQuirksMode && !cb->isAnonymousBlock()) 4233 if (!inQuirksMode && !cb->isAnonymousBlock())
4228 break; 4234 break;
4235 if (cb->hasOverrideContainingBlockLogicalHeight())
4236 return cb->overrideContainingBlockContentLogicalHeight() != -1;
4237
4229 cb = cb->containingBlock(); 4238 cb = cb->containingBlock();
4230 } 4239 }
4231 4240
4232 // A positioned element that specified both top/bottom or that specifies hei ght should be treated as though it has a height 4241 // A positioned element that specified both top/bottom or that specifies hei ght should be treated as though it has a height
4233 // explicitly specified that can be used for any percentage computations. 4242 // explicitly specified that can be used for any percentage computations.
4234 // FIXME: We can't just check top/bottom here. 4243 // FIXME: We can't just check top/bottom here.
4235 // https://bugs.webkit.org/show_bug.cgi?id=46500 4244 // https://bugs.webkit.org/show_bug.cgi?id=46500
4236 bool isOutOfFlowPositionedWithSpecifiedHeight = cb->isOutOfFlowPositioned() && (!cb->style()->logicalHeight().isAuto() || (!cb->style()->top().isAuto() && ! cb->style()->bottom().isAuto())); 4245 bool isOutOfFlowPositionedWithSpecifiedHeight = cb->isOutOfFlowPositioned() && (!cb->style()->logicalHeight().isAuto() || (!cb->style()->top().isAuto() && ! cb->style()->bottom().isAuto()));
4237 4246
4238 // Table cells violate what the CSS spec says to do with heights. Basically we 4247 // Table cells violate what the CSS spec says to do with heights. Basically we
(...skipping 23 matching lines...) Expand all
4262 { 4271 {
4263 const Length& logicalHeight = style()->logicalHeight(); 4272 const Length& logicalHeight = style()->logicalHeight();
4264 if (logicalHeight.isIntrinsicOrAuto()) 4273 if (logicalHeight.isIntrinsicOrAuto())
4265 return false; 4274 return false;
4266 if (logicalHeight.isFixed()) 4275 if (logicalHeight.isFixed())
4267 return true; 4276 return true;
4268 // The size of the containing block of an absolutely positioned element is a lways definite with respect to that 4277 // The size of the containing block of an absolutely positioned element is a lways definite with respect to that
4269 // element (http://dev.w3.org/csswg/css-sizing-3/#definite). 4278 // element (http://dev.w3.org/csswg/css-sizing-3/#definite).
4270 if (isOutOfFlowPositioned()) 4279 if (isOutOfFlowPositioned())
4271 return true; 4280 return true;
4281 if (hasOverrideContainingBlockLogicalHeight())
4282 return overrideContainingBlockContentLogicalHeight() != -1;
4272 4283
4273 return percentageLogicalHeightIsResolvable(this); 4284 return percentageLogicalHeightIsResolvable(this);
4274 } 4285 }
4275 4286
4276 bool RenderBox::hasUnsplittableScrollingOverflow() const 4287 bool RenderBox::hasUnsplittableScrollingOverflow() const
4277 { 4288 {
4278 // We will paginate as long as we don't scroll overflow in the pagination di rection. 4289 // We will paginate as long as we don't scroll overflow in the pagination di rection.
4279 bool isHorizontal = isHorizontalWritingMode(); 4290 bool isHorizontal = isHorizontalWritingMode();
4280 if ((isHorizontal && !scrollsOverflowY()) || (!isHorizontal && !scrollsOverf lowX())) 4291 if ((isHorizontal && !scrollsOverflowY()) || (!isHorizontal && !scrollsOverf lowX()))
4281 return false; 4292 return false;
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
4607 } 4618 }
4608 4619
4609 void RenderBox::invalidateDisplayItemClients(DisplayItemList* displayItemList) c onst 4620 void RenderBox::invalidateDisplayItemClients(DisplayItemList* displayItemList) c onst
4610 { 4621 {
4611 RenderBoxModelObject::invalidateDisplayItemClients(displayItemList); 4622 RenderBoxModelObject::invalidateDisplayItemClients(displayItemList);
4612 if (LayerScrollableArea* area = scrollableArea()) 4623 if (LayerScrollableArea* area = scrollableArea())
4613 displayItemList->invalidate(area->displayItemClient()); 4624 displayItemList->invalidate(area->displayItemClient());
4614 } 4625 }
4615 4626
4616 } // namespace blink 4627 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698