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

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: New version Created 4 years, 8 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 | « third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-container-percentage-tracks.html ('k') | no next file » | 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 4127 matching lines...) Expand 10 before | Expand all | Expand 10 after
4138 const LayoutBox* box = &layoutBox; 4138 const LayoutBox* box = &layoutBox;
4139 while (!box->isLayoutView() && !box->isOutOfFlowPositioned() 4139 while (!box->isLayoutView() && !box->isOutOfFlowPositioned()
4140 && (box->style()->logicalWidth().isAuto() || box->isAnonymousBlock()) 4140 && (box->style()->logicalWidth().isAuto() || box->isAnonymousBlock())
4141 && !box->hasOverrideContainingBlockLogicalWidth()) 4141 && !box->hasOverrideContainingBlockLogicalWidth())
4142 box = box->containingBlock(); 4142 box = box->containingBlock();
4143 4143
4144 if (box->style()->logicalWidth().isFixed()) 4144 if (box->style()->logicalWidth().isFixed())
4145 return true; 4145 return true;
4146 if (box->isLayoutView()) 4146 if (box->isLayoutView())
4147 return true; 4147 return true;
4148 // The size of the containing block of an absolutely positioned element is a lways definite with respect to that 4148 if (box->isOutOfFlowPositioned() && !box->style()->logicalLeft().isAuto() && !box->style()->logicalRight().isAuto())
mstensho (USE GERRIT) 2016/04/08 09:06:35 maybe isFixed() would be a better choice than !isA
4149 // element (http://dev.w3.org/csswg/css-sizing-3/#definite).
4150 if (box->isOutOfFlowPositioned())
4151 return true; 4149 return true;
4152 if (box->hasOverrideContainingBlockLogicalWidth()) 4150 if (box->hasOverrideContainingBlockLogicalWidth())
4153 return box->overrideContainingBlockContentLogicalWidth() != -1; 4151 return box->overrideContainingBlockContentLogicalWidth() != -1;
4154 if (box->style()->logicalWidth().hasPercent()) 4152 if (box->style()->logicalWidth().hasPercent())
4155 return logicalWidthIsResolvable(*box->containingBlock()); 4153 return logicalWidthIsResolvable(*box->containingBlock());
4156 4154
4157 return false; 4155 return false;
4158 } 4156 }
4159 4157
4160 bool LayoutBox::hasDefiniteLogicalWidth() const 4158 bool LayoutBox::hasDefiniteLogicalWidth() const
4161 { 4159 {
4162 return logicalWidthIsResolvable(*this); 4160 return logicalWidthIsResolvable(*this);
4163 } 4161 }
4164 4162
4165 bool LayoutBox::percentageLogicalHeightIsResolvable() const 4163 bool LayoutBox::percentageLogicalHeightIsResolvable() const
4166 { 4164 {
4167 Length fakeLength(100, Percent); 4165 Length fakeLength(100, Percent);
4168 return computePercentageLogicalHeight(fakeLength) != -1; 4166 return computePercentageLogicalHeight(fakeLength) != -1;
4169 } 4167 }
4170 4168
4171 bool LayoutBox::hasDefiniteLogicalHeight() const 4169 bool LayoutBox::hasDefiniteLogicalHeight() const
4172 { 4170 {
4173 const Length& logicalHeight = style()->logicalHeight(); 4171 const Length& logicalHeight = style()->logicalHeight();
4174 if (logicalHeight.isIntrinsicOrAuto())
4175 return false;
4176 if (logicalHeight.isFixed()) 4172 if (logicalHeight.isFixed())
4177 return true; 4173 return true;
4178 // The size of the containing block of an absolutely positioned element is a lways definite with respect to that 4174 if (isOutOfFlowPositioned() && !style()->logicalTop().isAuto() && !style()-> logicalBottom().isAuto())
mstensho (USE GERRIT) 2016/04/08 09:06:35 Ditto.
4179 // element (http://dev.w3.org/csswg/css-sizing-3/#definite).
4180 if (isOutOfFlowPositioned())
4181 return true; 4175 return true;
4182 if (hasOverrideContainingBlockLogicalHeight()) 4176 if (hasOverrideContainingBlockLogicalHeight())
4183 return overrideContainingBlockContentLogicalHeight() != -1; 4177 return overrideContainingBlockContentLogicalHeight() != -1;
4178 if (logicalHeight.isIntrinsicOrAuto())
4179 return false;
4184 4180
4185 return percentageLogicalHeightIsResolvable(); 4181 return percentageLogicalHeightIsResolvable();
4186 } 4182 }
4187 4183
4188 bool LayoutBox::hasUnsplittableScrollingOverflow() const 4184 bool LayoutBox::hasUnsplittableScrollingOverflow() const
4189 { 4185 {
4190 // We will paginate as long as we don't scroll overflow in the pagination di rection. 4186 // We will paginate as long as we don't scroll overflow in the pagination di rection.
4191 bool isHorizontal = isHorizontalWritingMode(); 4187 bool isHorizontal = isHorizontalWritingMode();
4192 if ((isHorizontal && !scrollsOverflowY()) || (!isHorizontal && !scrollsOverf lowX())) 4188 if ((isHorizontal && !scrollsOverflowY()) || (!isHorizontal && !scrollsOverf lowX()))
4193 return false; 4189 return false;
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
4703 4699
4704 void LayoutBox::clearPercentHeightDescendants() 4700 void LayoutBox::clearPercentHeightDescendants()
4705 { 4701 {
4706 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) { 4702 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) {
4707 if (curr->isBox()) 4703 if (curr->isBox())
4708 toLayoutBox(curr)->removeFromPercentHeightContainer(); 4704 toLayoutBox(curr)->removeFromPercentHeightContainer();
4709 } 4705 }
4710 } 4706 }
4711 4707
4712 } // namespace blink 4708 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-container-percentage-tracks.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698