Chromium Code Reviews| 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 LayoutUnit marginStart = minimumValueForLength(style()->marginStart(), a vailableLogicalWidth); | 285 LayoutUnit marginStart = minimumValueForLength(style()->marginStart(), a vailableLogicalWidth); |
| 286 LayoutUnit marginEnd = minimumValueForLength(style()->marginEnd(), avail ableLogicalWidth); | 286 LayoutUnit marginEnd = minimumValueForLength(style()->marginEnd(), avail ableLogicalWidth); |
| 287 LayoutUnit marginTotal = marginStart + marginEnd; | 287 LayoutUnit marginTotal = marginStart + marginEnd; |
| 288 | 288 |
| 289 // Subtract out our margins to get the available content width. | 289 // Subtract out our margins to get the available content width. |
| 290 LayoutUnit availableContentLogicalWidth = (containerWidthInInlineDirecti on - marginTotal).clampNegativeToZero(); | 290 LayoutUnit availableContentLogicalWidth = (containerWidthInInlineDirecti on - marginTotal).clampNegativeToZero(); |
| 291 if (shrinkToAvoidFloats() && cb->isLayoutBlockFlow() && toLayoutBlockFlo w(cb)->containsFloats() && !hasPerpendicularContainingBlock) | 291 if (shrinkToAvoidFloats() && cb->isLayoutBlockFlow() && toLayoutBlockFlo w(cb)->containsFloats() && !hasPerpendicularContainingBlock) |
| 292 availableContentLogicalWidth = shrinkLogicalWidthToAvoidFloats(margi nStart, marginEnd, toLayoutBlockFlow(cb)); | 292 availableContentLogicalWidth = shrinkLogicalWidthToAvoidFloats(margi nStart, marginEnd, toLayoutBlockFlow(cb)); |
| 293 | 293 |
| 294 // Ensure we aren't bigger than our available width. | 294 // Ensure we aren't bigger than our available width. |
| 295 setLogicalWidth(LayoutUnit(std::min(availableContentLogicalWidth, maxPre ferredLogicalWidth()).floor())); | 295 LayoutUnit maxWidth = maxPreferredLogicalWidth(); |
| 296 // scaledWidthFromPercentColumns depends on m_layoutStruct in TableLayou tAlgorithmAuto, which | |
| 297 // maxPreferredLogicalWidth fills in. So scaledWidthFromPercentColumns h as to be called after | |
| 298 // maxPreferredLogicalWidth. | |
| 299 LayoutUnit scaledWidth = m_tableLayout->scaledWidthFromPercentColumns() + bordersPaddingAndSpacingInRowDirection(); | |
|
dgrogan
2016/04/29 23:20:40
This one.
| |
| 300 maxWidth = std::max(scaledWidth, maxWidth); | |
| 301 setLogicalWidth(LayoutUnit(std::min(availableContentLogicalWidth, maxWid th).floor())); | |
| 296 } | 302 } |
| 297 | 303 |
| 298 // Ensure we aren't bigger than our max-width style. | 304 // Ensure we aren't bigger than our max-width style. |
| 299 Length styleMaxLogicalWidth = style()->logicalMaxWidth(); | 305 Length styleMaxLogicalWidth = style()->logicalMaxWidth(); |
| 300 if ((styleMaxLogicalWidth.isSpecified() && !styleMaxLogicalWidth.isNegative( )) || styleMaxLogicalWidth.isIntrinsic()) { | 306 if ((styleMaxLogicalWidth.isSpecified() && !styleMaxLogicalWidth.isNegative( )) || styleMaxLogicalWidth.isIntrinsic()) { |
| 301 LayoutUnit computedMaxLogicalWidth = convertStyleLogicalWidthToComputedW idth(styleMaxLogicalWidth, availableLogicalWidth); | 307 LayoutUnit computedMaxLogicalWidth = convertStyleLogicalWidthToComputedW idth(styleMaxLogicalWidth, availableLogicalWidth); |
| 302 setLogicalWidth(LayoutUnit(std::min(logicalWidth(), computedMaxLogicalWi dth).floor())); | 308 setLogicalWidth(LayoutUnit(std::min(logicalWidth(), computedMaxLogicalWi dth).floor())); |
| 303 } | 309 } |
| 304 | 310 |
| 305 // Ensure we aren't smaller than our min preferred width. This MUST be done after 'max-width' as | 311 // Ensure we aren't smaller than our min preferred width. This MUST be done after 'max-width' as |
| (...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1480 | 1486 |
| 1481 LayoutUnit LayoutTable::paddingRight() const | 1487 LayoutUnit LayoutTable::paddingRight() const |
| 1482 { | 1488 { |
| 1483 if (collapseBorders()) | 1489 if (collapseBorders()) |
| 1484 return LayoutUnit(); | 1490 return LayoutUnit(); |
| 1485 | 1491 |
| 1486 return LayoutBlock::paddingRight(); | 1492 return LayoutBlock::paddingRight(); |
| 1487 } | 1493 } |
| 1488 | 1494 |
| 1489 } // namespace blink | 1495 } // namespace blink |
| OLD | NEW |