| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) | 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) |
| 3 * (C) 1997 Torben Weis (weis@kde.org) | 3 * (C) 1997 Torben Weis (weis@kde.org) |
| 4 * (C) 1998 Waldo Bastian (bastian@kde.org) | 4 * (C) 1998 Waldo Bastian (bastian@kde.org) |
| 5 * (C) 1999 Lars Knoll (knoll@kde.org) | 5 * (C) 1999 Lars Knoll (knoll@kde.org) |
| 6 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 6 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc.
All rights reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc.
All rights reserved. |
| 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 Length styleLogicalWidth = style()->logicalWidth(); | 274 Length styleLogicalWidth = style()->logicalWidth(); |
| 275 if ((styleLogicalWidth.isSpecified() && styleLogicalWidth.isPositive()) || s
tyleLogicalWidth.isIntrinsic()) { | 275 if ((styleLogicalWidth.isSpecified() && styleLogicalWidth.isPositive()) || s
tyleLogicalWidth.isIntrinsic()) { |
| 276 setLogicalWidth(convertStyleLogicalWidthToComputedWidth(styleLogicalWidt
h, containerWidthInInlineDirection)); | 276 setLogicalWidth(convertStyleLogicalWidthToComputedWidth(styleLogicalWidt
h, containerWidthInInlineDirection)); |
| 277 } else { | 277 } else { |
| 278 // Subtract out any fixed margins from our available width for auto widt
h tables. | 278 // Subtract out any fixed margins from our available width for auto widt
h tables. |
| 279 LayoutUnit marginStart = minimumValueForLength(style()->marginStart(), a
vailableLogicalWidth); | 279 LayoutUnit marginStart = minimumValueForLength(style()->marginStart(), a
vailableLogicalWidth); |
| 280 LayoutUnit marginEnd = minimumValueForLength(style()->marginEnd(), avail
ableLogicalWidth); | 280 LayoutUnit marginEnd = minimumValueForLength(style()->marginEnd(), avail
ableLogicalWidth); |
| 281 LayoutUnit marginTotal = marginStart + marginEnd; | 281 LayoutUnit marginTotal = marginStart + marginEnd; |
| 282 | 282 |
| 283 // Subtract out our margins to get the available content width. | 283 // Subtract out our margins to get the available content width. |
| 284 LayoutUnit availableContentLogicalWidth = std::max<LayoutUnit>(0, contai
nerWidthInInlineDirection - marginTotal); | 284 LayoutUnit availableContentLogicalWidth = (containerWidthInInlineDirecti
on - marginTotal).clampNegativeToZero(); |
| 285 if (shrinkToAvoidFloats() && cb->isLayoutBlockFlow() && toLayoutBlockFlo
w(cb)->containsFloats() && !hasPerpendicularContainingBlock) | 285 if (shrinkToAvoidFloats() && cb->isLayoutBlockFlow() && toLayoutBlockFlo
w(cb)->containsFloats() && !hasPerpendicularContainingBlock) |
| 286 availableContentLogicalWidth = shrinkLogicalWidthToAvoidFloats(margi
nStart, marginEnd, toLayoutBlockFlow(cb)); | 286 availableContentLogicalWidth = shrinkLogicalWidthToAvoidFloats(margi
nStart, marginEnd, toLayoutBlockFlow(cb)); |
| 287 | 287 |
| 288 // Ensure we aren't bigger than our available width. | 288 // Ensure we aren't bigger than our available width. |
| 289 setLogicalWidth(std::min<int>(availableContentLogicalWidth, maxPreferred
LogicalWidth())); | 289 setLogicalWidth(std::min<int>(availableContentLogicalWidth, maxPreferred
LogicalWidth())); |
| 290 } | 290 } |
| 291 | 291 |
| 292 // Ensure we aren't bigger than our max-width style. | 292 // Ensure we aren't bigger than our max-width style. |
| 293 Length styleMaxLogicalWidth = style()->logicalMaxWidth(); | 293 Length styleMaxLogicalWidth = style()->logicalMaxWidth(); |
| 294 if ((styleMaxLogicalWidth.isSpecified() && !styleMaxLogicalWidth.isNegative(
)) || styleMaxLogicalWidth.isIntrinsic()) { | 294 if ((styleMaxLogicalWidth.isSpecified() && !styleMaxLogicalWidth.isNegative(
)) || styleMaxLogicalWidth.isIntrinsic()) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 borders = borderAndPadding; | 349 borders = borderAndPadding; |
| 350 } | 350 } |
| 351 computedLogicalHeight = styleLogicalHeight.value() - borders; | 351 computedLogicalHeight = styleLogicalHeight.value() - borders; |
| 352 } else if (styleLogicalHeight.hasPercent()) { | 352 } else if (styleLogicalHeight.hasPercent()) { |
| 353 computedLogicalHeight = computePercentageLogicalHeight(styleLogicalHeigh
t); | 353 computedLogicalHeight = computePercentageLogicalHeight(styleLogicalHeigh
t); |
| 354 } else if (styleLogicalHeight.isIntrinsic()) { | 354 } else if (styleLogicalHeight.isIntrinsic()) { |
| 355 computedLogicalHeight = computeIntrinsicLogicalContentHeightUsing(styleL
ogicalHeight, logicalHeight() - borderAndPadding, borderAndPadding); | 355 computedLogicalHeight = computeIntrinsicLogicalContentHeightUsing(styleL
ogicalHeight, logicalHeight() - borderAndPadding, borderAndPadding); |
| 356 } else { | 356 } else { |
| 357 ASSERT_NOT_REACHED(); | 357 ASSERT_NOT_REACHED(); |
| 358 } | 358 } |
| 359 return std::max<LayoutUnit>(0, computedLogicalHeight); | 359 return computedLogicalHeight.clampNegativeToZero(); |
| 360 } | 360 } |
| 361 | 361 |
| 362 void LayoutTable::layoutCaption(LayoutTableCaption& caption) | 362 void LayoutTable::layoutCaption(LayoutTableCaption& caption) |
| 363 { | 363 { |
| 364 if (caption.needsLayout()) { | 364 if (caption.needsLayout()) { |
| 365 // The margins may not be available but ensure the caption is at least l
ocated beneath any previous sibling caption | 365 // The margins may not be available but ensure the caption is at least l
ocated beneath any previous sibling caption |
| 366 // so that it does not mistakenly think any floats in the previous capti
on intrude into it. | 366 // so that it does not mistakenly think any floats in the previous capti
on intrude into it. |
| 367 caption.setLogicalLocation(LayoutPoint(caption.marginStart(), collapsedM
arginBeforeForChild(caption) + logicalHeight())); | 367 caption.setLogicalLocation(LayoutPoint(caption.marginStart(), collapsedM
arginBeforeForChild(caption) + logicalHeight())); |
| 368 // If LayoutTableCaption ever gets a layout() function, use it here. | 368 // If LayoutTableCaption ever gets a layout() function, use it here. |
| 369 caption.layoutIfNeeded(); | 369 caption.layoutIfNeeded(); |
| (...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 | 1455 |
| 1456 LayoutUnit LayoutTable::paddingRight() const | 1456 LayoutUnit LayoutTable::paddingRight() const |
| 1457 { | 1457 { |
| 1458 if (collapseBorders()) | 1458 if (collapseBorders()) |
| 1459 return LayoutUnit(); | 1459 return LayoutUnit(); |
| 1460 | 1460 |
| 1461 return LayoutBlock::paddingRight(); | 1461 return LayoutBlock::paddingRight(); |
| 1462 } | 1462 } |
| 1463 | 1463 |
| 1464 } // namespace blink | 1464 } // namespace blink |
| OLD | NEW |