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

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

Issue 2441373002: Percent height content should respect the height of its containing cell (Closed)
Patch Set: bug 637811 Created 4 years, 1 month 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 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 1348
1349 void LayoutBox::clearExtraInlineAndBlockOffests() { 1349 void LayoutBox::clearExtraInlineAndBlockOffests() {
1350 if (gExtraInlineOffsetMap) 1350 if (gExtraInlineOffsetMap)
1351 gExtraInlineOffsetMap->remove(this); 1351 gExtraInlineOffsetMap->remove(this);
1352 if (gExtraBlockOffsetMap) 1352 if (gExtraBlockOffsetMap)
1353 gExtraBlockOffsetMap->remove(this); 1353 gExtraBlockOffsetMap->remove(this);
1354 } 1354 }
1355 1355
1356 LayoutUnit LayoutBox::adjustBorderBoxLogicalWidthForBoxSizing( 1356 LayoutUnit LayoutBox::adjustBorderBoxLogicalWidthForBoxSizing(
1357 float width) const { 1357 float width) const {
1358 LayoutUnit bordersPlusPadding = borderAndPaddingLogicalWidth(); 1358 LayoutUnit bordersPlusPadding = collapsedBorderAndCSSPaddingLogicalWidth();
1359 LayoutUnit result(width); 1359 LayoutUnit result(width);
1360 if (style()->boxSizing() == BoxSizingContentBox) 1360 if (style()->boxSizing() == BoxSizingContentBox)
1361 return result + bordersPlusPadding; 1361 return result + bordersPlusPadding;
1362 return std::max(result, bordersPlusPadding); 1362 return std::max(result, bordersPlusPadding);
1363 } 1363 }
1364 1364
1365 LayoutUnit LayoutBox::adjustBorderBoxLogicalHeightForBoxSizing( 1365 LayoutUnit LayoutBox::adjustBorderBoxLogicalHeightForBoxSizing(
1366 float height) const { 1366 float height) const {
1367 LayoutUnit bordersPlusPadding = borderAndPaddingLogicalHeight(); 1367 LayoutUnit bordersPlusPadding = collapsedBorderAndCSSPaddingLogicalHeight();
1368 LayoutUnit result(height); 1368 LayoutUnit result(height);
1369 if (style()->boxSizing() == BoxSizingContentBox) 1369 if (style()->boxSizing() == BoxSizingContentBox)
1370 return result + bordersPlusPadding; 1370 return result + bordersPlusPadding;
1371 return std::max(result, bordersPlusPadding); 1371 return std::max(result, bordersPlusPadding);
1372 } 1372 }
1373 1373
1374 LayoutUnit LayoutBox::adjustContentBoxLogicalWidthForBoxSizing( 1374 LayoutUnit LayoutBox::adjustContentBoxLogicalWidthForBoxSizing(
1375 float width) const { 1375 float width) const {
1376 LayoutUnit result(width); 1376 LayoutUnit result(width);
1377 if (style()->boxSizing() == BoxSizingBorderBox) 1377 if (style()->boxSizing() == BoxSizingBorderBox)
1378 result -= borderAndPaddingLogicalWidth(); 1378 result -= collapsedBorderAndCSSPaddingLogicalWidth();
1379 return std::max(LayoutUnit(), result); 1379 return std::max(LayoutUnit(), result);
1380 } 1380 }
1381 1381
1382 LayoutUnit LayoutBox::adjustContentBoxLogicalHeightForBoxSizing( 1382 LayoutUnit LayoutBox::adjustContentBoxLogicalHeightForBoxSizing(
1383 float height) const { 1383 float height) const {
1384 LayoutUnit result(height); 1384 LayoutUnit result(height);
1385 if (style()->boxSizing() == BoxSizingBorderBox) 1385 if (style()->boxSizing() == BoxSizingBorderBox)
1386 result -= borderAndPaddingLogicalHeight(); 1386 result -= collapsedBorderAndCSSPaddingLogicalHeight();
1387 return std::max(LayoutUnit(), result); 1387 return std::max(LayoutUnit(), result);
1388 } 1388 }
1389 1389
1390 // Hit Testing 1390 // Hit Testing
1391 bool LayoutBox::nodeAtPoint(HitTestResult& result, 1391 bool LayoutBox::nodeAtPoint(HitTestResult& result,
1392 const HitTestLocation& locationInContainer, 1392 const HitTestLocation& locationInContainer,
1393 const LayoutPoint& accumulatedOffset, 1393 const LayoutPoint& accumulatedOffset,
1394 HitTestAction action) { 1394 HitTestAction action) {
1395 LayoutPoint adjustedLocation = accumulatedOffset + location(); 1395 LayoutPoint adjustedLocation = accumulatedOffset + location();
1396 1396
(...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after
3186 // overflow has to be treated differently, since WinIE lets scrolled 3186 // overflow has to be treated differently, since WinIE lets scrolled
3187 // overflow regions shrink as needed. 3187 // overflow regions shrink as needed.
3188 // While we can't get all cases right, we can at least detect when the 3188 // While we can't get all cases right, we can at least detect when the
3189 // cell has a specified height or when the table has a specified height. 3189 // cell has a specified height or when the table has a specified height.
3190 // In these cases we want to initially have no size and allow the 3190 // In these cases we want to initially have no size and allow the
3191 // flexing of the table or the cell to its specified height to cause us 3191 // flexing of the table or the cell to its specified height to cause us
3192 // to grow to fill the space. This could end up being wrong in some 3192 // to grow to fill the space. This could end up being wrong in some
3193 // cases, but it is preferable to the alternative (sizing intrinsically 3193 // cases, but it is preferable to the alternative (sizing intrinsically
3194 // and making the row end up too big). 3194 // and making the row end up too big).
3195 LayoutTableCell* cell = toLayoutTableCell(cb); 3195 LayoutTableCell* cell = toLayoutTableCell(cb);
3196 if (scrollsOverflowY() && 3196 if (style()->overflowY() != OverflowVisible &&
3197 style()->overflowY() != OverflowHidden &&
3197 (!cell->style()->logicalHeight().isAuto() || 3198 (!cell->style()->logicalHeight().isAuto() ||
3198 !cell->table()->style()->logicalHeight().isAuto())) 3199 !cell->table()->style()->logicalHeight().isAuto()))
3199 return LayoutUnit(); 3200 return LayoutUnit();
3200 return LayoutUnit(-1); 3201 return LayoutUnit(-1);
3201 } 3202 }
3202 availableHeight = cb->overrideLogicalContentHeight(); 3203 availableHeight = cb->overrideLogicalContentHeight();
3203 } 3204 }
3204 } else { 3205 } else {
3205 availableHeight = cb->availableLogicalHeightForPercentageComputation(); 3206 availableHeight = cb->availableLogicalHeightForPercentageComputation();
3206 } 3207 }
(...skipping 2381 matching lines...) Expand 10 before | Expand all | Expand 10 after
5588 LayoutRect rect = frameRect(); 5589 LayoutRect rect = frameRect();
5589 5590
5590 LayoutBlock* block = containingBlock(); 5591 LayoutBlock* block = containingBlock();
5591 if (block) 5592 if (block)
5592 block->adjustChildDebugRect(rect); 5593 block->adjustChildDebugRect(rect);
5593 5594
5594 return rect; 5595 return rect;
5595 } 5596 }
5596 5597
5597 } // namespace blink 5598 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698