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

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

Issue 2635143002: Changed EBoxSizing to an enum class and renamed its members (Closed)
Patch Set: Aded k prefix Created 3 years, 11 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. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 if (gExtraInlineOffsetMap) 1335 if (gExtraInlineOffsetMap)
1336 gExtraInlineOffsetMap->remove(this); 1336 gExtraInlineOffsetMap->remove(this);
1337 if (gExtraBlockOffsetMap) 1337 if (gExtraBlockOffsetMap)
1338 gExtraBlockOffsetMap->remove(this); 1338 gExtraBlockOffsetMap->remove(this);
1339 } 1339 }
1340 1340
1341 LayoutUnit LayoutBox::adjustBorderBoxLogicalWidthForBoxSizing( 1341 LayoutUnit LayoutBox::adjustBorderBoxLogicalWidthForBoxSizing(
1342 float width) const { 1342 float width) const {
1343 LayoutUnit bordersPlusPadding = collapsedBorderAndCSSPaddingLogicalWidth(); 1343 LayoutUnit bordersPlusPadding = collapsedBorderAndCSSPaddingLogicalWidth();
1344 LayoutUnit result(width); 1344 LayoutUnit result(width);
1345 if (style()->boxSizing() == BoxSizingContentBox) 1345 if (style()->boxSizing() == EBoxSizing::kContentBox)
1346 return result + bordersPlusPadding; 1346 return result + bordersPlusPadding;
1347 return std::max(result, bordersPlusPadding); 1347 return std::max(result, bordersPlusPadding);
1348 } 1348 }
1349 1349
1350 LayoutUnit LayoutBox::adjustBorderBoxLogicalHeightForBoxSizing( 1350 LayoutUnit LayoutBox::adjustBorderBoxLogicalHeightForBoxSizing(
1351 float height) const { 1351 float height) const {
1352 LayoutUnit bordersPlusPadding = collapsedBorderAndCSSPaddingLogicalHeight(); 1352 LayoutUnit bordersPlusPadding = collapsedBorderAndCSSPaddingLogicalHeight();
1353 LayoutUnit result(height); 1353 LayoutUnit result(height);
1354 if (style()->boxSizing() == BoxSizingContentBox) 1354 if (style()->boxSizing() == EBoxSizing::kContentBox)
1355 return result + bordersPlusPadding; 1355 return result + bordersPlusPadding;
1356 return std::max(result, bordersPlusPadding); 1356 return std::max(result, bordersPlusPadding);
1357 } 1357 }
1358 1358
1359 LayoutUnit LayoutBox::adjustContentBoxLogicalWidthForBoxSizing( 1359 LayoutUnit LayoutBox::adjustContentBoxLogicalWidthForBoxSizing(
1360 float width) const { 1360 float width) const {
1361 LayoutUnit result(width); 1361 LayoutUnit result(width);
1362 if (style()->boxSizing() == BoxSizingBorderBox) 1362 if (style()->boxSizing() == EBoxSizing::kBorderBox)
1363 result -= collapsedBorderAndCSSPaddingLogicalWidth(); 1363 result -= collapsedBorderAndCSSPaddingLogicalWidth();
1364 return std::max(LayoutUnit(), result); 1364 return std::max(LayoutUnit(), result);
1365 } 1365 }
1366 1366
1367 LayoutUnit LayoutBox::adjustContentBoxLogicalHeightForBoxSizing( 1367 LayoutUnit LayoutBox::adjustContentBoxLogicalHeightForBoxSizing(
1368 float height) const { 1368 float height) const {
1369 LayoutUnit result(height); 1369 LayoutUnit result(height);
1370 if (style()->boxSizing() == BoxSizingBorderBox) 1370 if (style()->boxSizing() == EBoxSizing::kBorderBox)
1371 result -= collapsedBorderAndCSSPaddingLogicalHeight(); 1371 result -= collapsedBorderAndCSSPaddingLogicalHeight();
1372 return std::max(LayoutUnit(), result); 1372 return std::max(LayoutUnit(), result);
1373 } 1373 }
1374 1374
1375 // Hit Testing 1375 // Hit Testing
1376 bool LayoutBox::nodeAtPoint(HitTestResult& result, 1376 bool LayoutBox::nodeAtPoint(HitTestResult& result,
1377 const HitTestLocation& locationInContainer, 1377 const HitTestLocation& locationInContainer,
1378 const LayoutPoint& accumulatedOffset, 1378 const LayoutPoint& accumulatedOffset,
1379 HitTestAction action) { 1379 HitTestAction action) {
1380 LayoutPoint adjustedLocation = accumulatedOffset + location(); 1380 LayoutPoint adjustedLocation = accumulatedOffset + location();
(...skipping 1862 matching lines...) Expand 10 before | Expand all | Expand 10 after
3243 LayoutUnit result = valueForLength(height, availableHeight); 3243 LayoutUnit result = valueForLength(height, availableHeight);
3244 // |overrideLogicalContentHeight| is the maximum height made available by the 3244 // |overrideLogicalContentHeight| is the maximum height made available by the
3245 // cell to its percent height children when we decide they can determine the 3245 // cell to its percent height children when we decide they can determine the
3246 // height of the cell. If the percent height child is box-sizing:content-box 3246 // height of the cell. If the percent height child is box-sizing:content-box
3247 // then we must subtract the border and padding from the cell's 3247 // then we must subtract the border and padding from the cell's
3248 // |availableHeight| (given by |overrideLogicalContentHeight|) to arrive 3248 // |availableHeight| (given by |overrideLogicalContentHeight|) to arrive
3249 // at the child's computed height. 3249 // at the child's computed height.
3250 bool subtractBorderAndPadding = 3250 bool subtractBorderAndPadding =
3251 isTable() || (cb->isTableCell() && !skippedAutoHeightContainingBlock && 3251 isTable() || (cb->isTableCell() && !skippedAutoHeightContainingBlock &&
3252 cb->hasOverrideLogicalContentHeight() && 3252 cb->hasOverrideLogicalContentHeight() &&
3253 style()->boxSizing() == BoxSizingContentBox); 3253 style()->boxSizing() == EBoxSizing::kContentBox);
3254 if (subtractBorderAndPadding) { 3254 if (subtractBorderAndPadding) {
3255 result -= borderAndPaddingLogicalHeight(); 3255 result -= borderAndPaddingLogicalHeight();
3256 return std::max(LayoutUnit(), result); 3256 return std::max(LayoutUnit(), result);
3257 } 3257 }
3258 return result; 3258 return result;
3259 } 3259 }
3260 3260
3261 LayoutUnit LayoutBox::computeReplacedLogicalWidth( 3261 LayoutUnit LayoutBox::computeReplacedLogicalWidth(
3262 ShouldComputePreferred shouldComputePreferred) const { 3262 ShouldComputePreferred shouldComputePreferred) const {
3263 return computeReplacedLogicalWidthRespectingMinMaxWidth( 3263 return computeReplacedLogicalWidthRespectingMinMaxWidth(
(...skipping 2431 matching lines...) Expand 10 before | Expand all | Expand 10 after
5695 block->adjustChildDebugRect(rect); 5695 block->adjustChildDebugRect(rect);
5696 5696
5697 return rect; 5697 return rect;
5698 } 5698 }
5699 5699
5700 bool LayoutBox::shouldClipOverflow() const { 5700 bool LayoutBox::shouldClipOverflow() const {
5701 return hasOverflowClip() || styleRef().containsPaint() || hasControlClip(); 5701 return hasOverflowClip() || styleRef().containsPaint() || hasControlClip();
5702 } 5702 }
5703 5703
5704 } // namespace blink 5704 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698