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

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

Issue 2033033002: [css-grid] Percentage columns can always be resolved during layout (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor fixes on tests 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 4229 matching lines...) Expand 10 before | Expand all | Expand 10 after
4240 return; 4240 return;
4241 4241
4242 if (!hasSelfVisualOverflow() && contentsVisualOverflowRect().isEmpty()) { 4242 if (!hasSelfVisualOverflow() && contentsVisualOverflowRect().isEmpty()) {
4243 clearAllOverflows(); 4243 clearAllOverflows();
4244 return; 4244 return;
4245 } 4245 }
4246 4246
4247 m_overflow->setLayoutOverflow(noOverflowRect()); 4247 m_overflow->setLayoutOverflow(noOverflowRect());
4248 } 4248 }
4249 4249
4250 static bool logicalWidthIsResolvable(const LayoutBox& layoutBox)
4251 {
4252 const LayoutBox* box = &layoutBox;
4253 while (!box->isLayoutView() && !box->isOutOfFlowPositioned()
4254 && (box->style()->logicalWidth().isAuto() || box->isAnonymousBlock())
4255 && !box->hasOverrideContainingBlockLogicalWidth())
4256 box = box->containingBlock();
4257
4258 if (box->style()->logicalWidth().isFixed())
4259 return true;
4260 if (box->isLayoutView())
4261 return true;
4262 // The size of the containing block of an absolutely positioned element is a lways definite with respect to that
4263 // element (http://dev.w3.org/csswg/css-sizing-3/#definite).
4264 if (box->isOutOfFlowPositioned())
4265 return true;
4266 if (box->hasOverrideContainingBlockLogicalWidth())
4267 return box->overrideContainingBlockContentLogicalWidth() != -1;
4268 if (box->style()->logicalWidth().hasPercent())
4269 return logicalWidthIsResolvable(*box->containingBlock());
4270
4271 return false;
4272 }
4273
4274 bool LayoutBox::hasDefiniteLogicalWidth() const
4275 {
4276 return logicalWidthIsResolvable(*this);
4277 }
4278
4279 bool LayoutBox::percentageLogicalHeightIsResolvable() const 4250 bool LayoutBox::percentageLogicalHeightIsResolvable() const
4280 { 4251 {
4281 Length fakeLength(100, Percent); 4252 Length fakeLength(100, Percent);
4282 return computePercentageLogicalHeight(fakeLength) != -1; 4253 return computePercentageLogicalHeight(fakeLength) != -1;
4283 } 4254 }
4284 4255
4285 bool LayoutBox::hasDefiniteLogicalHeight() const 4256 bool LayoutBox::hasDefiniteLogicalHeight() const
4286 { 4257 {
4287 const Length& logicalHeight = style()->logicalHeight(); 4258 const Length& logicalHeight = style()->logicalHeight();
4288 if (logicalHeight.isIntrinsicOrAuto()) 4259 if (logicalHeight.isIntrinsicOrAuto())
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
4921 m_rareData->m_snapAreas->remove(&snapArea); 4892 m_rareData->m_snapAreas->remove(&snapArea);
4922 } 4893 }
4923 } 4894 }
4924 4895
4925 SnapAreaSet* LayoutBox::snapAreas() const 4896 SnapAreaSet* LayoutBox::snapAreas() const
4926 { 4897 {
4927 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; 4898 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr;
4928 } 4899 }
4929 4900
4930 } // namespace blink 4901 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.h ('k') | third_party/WebKit/Source/core/layout/LayoutGrid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698