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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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()) { |
295 LayoutUnit computedMaxLogicalWidth = convertStyleLogicalWidthToComputedW
idth(styleMaxLogicalWidth, availableLogicalWidth); | 295 LayoutUnit computedMaxLogicalWidth = convertStyleLogicalWidthToComputedW
idth(styleMaxLogicalWidth, availableLogicalWidth); |
296 setLogicalWidth(LayoutUnit(std::min(logicalWidth(), computedMaxLogicalWi
dth).floor())); | 296 setLogicalWidth(LayoutUnit(std::min(logicalWidth(), computedMaxLogicalWi
dth).floor())); |
297 } | 297 } |
298 | 298 |
299 // Ensure we aren't smaller than our min preferred width. This MUST be done
after 'max-width' as | 299 // Ensure we aren't smaller than our min preferred width. This MUST be done
after 'max-width' as |
300 // we ignore it if it means we wouldn't accommodate our content. | 300 // we ignore it if it means we wouldn't accommodate our content. |
301 setLogicalWidth(std::max(logicalWidth(), minPreferredLogicalWidth()).floor()
); | 301 setLogicalWidth(LayoutUnit(std::max(logicalWidth(), minPreferredLogicalWidth
()).floor())); |
302 | 302 |
303 // Ensure we aren't smaller than our min-width style. | 303 // Ensure we aren't smaller than our min-width style. |
304 Length styleMinLogicalWidth = style()->logicalMinWidth(); | 304 Length styleMinLogicalWidth = style()->logicalMinWidth(); |
305 if ((styleMinLogicalWidth.isSpecified() && !styleMinLogicalWidth.isNegative(
)) || styleMinLogicalWidth.isIntrinsic()) { | 305 if ((styleMinLogicalWidth.isSpecified() && !styleMinLogicalWidth.isNegative(
)) || styleMinLogicalWidth.isIntrinsic()) { |
306 LayoutUnit computedMinLogicalWidth = convertStyleLogicalWidthToComputedW
idth(styleMinLogicalWidth, availableLogicalWidth); | 306 LayoutUnit computedMinLogicalWidth = convertStyleLogicalWidthToComputedW
idth(styleMinLogicalWidth, availableLogicalWidth); |
307 setLogicalWidth(LayoutUnit(std::max(logicalWidth(), computedMinLogicalWi
dth).floor())); | 307 setLogicalWidth(LayoutUnit(std::max(logicalWidth(), computedMinLogicalWi
dth).floor())); |
308 } | 308 } |
309 | 309 |
310 // Finally, with our true width determined, compute our margins for real. | 310 // Finally, with our true width determined, compute our margins for real. |
311 ComputedMarginValues marginValues; | 311 ComputedMarginValues marginValues; |
(...skipping 29 matching lines...) Expand all Loading... |
341 LayoutUnit borderAndPaddingAfter = borderAfter() + (collapseBorders() ? Layo
utUnit() : paddingAfter()); | 341 LayoutUnit borderAndPaddingAfter = borderAfter() + (collapseBorders() ? Layo
utUnit() : paddingAfter()); |
342 LayoutUnit borderAndPadding = borderAndPaddingBefore + borderAndPaddingAfter
; | 342 LayoutUnit borderAndPadding = borderAndPaddingBefore + borderAndPaddingAfter
; |
343 LayoutUnit computedLogicalHeight; | 343 LayoutUnit computedLogicalHeight; |
344 if (styleLogicalHeight.isFixed()) { | 344 if (styleLogicalHeight.isFixed()) { |
345 // HTML tables size as though CSS height includes border/padding, CSS ta
bles do not. | 345 // HTML tables size as though CSS height includes border/padding, CSS ta
bles do not. |
346 LayoutUnit borders = LayoutUnit(); | 346 LayoutUnit borders = LayoutUnit(); |
347 // FIXME: We cannot apply box-sizing: content-box on <table> which other
browsers allow. | 347 // FIXME: We cannot apply box-sizing: content-box on <table> which other
browsers allow. |
348 if (isHTMLTableElement(node()) || style()->boxSizing() == BORDER_BOX) { | 348 if (isHTMLTableElement(node()) || style()->boxSizing() == BORDER_BOX) { |
349 borders = borderAndPadding; | 349 borders = borderAndPadding; |
350 } | 350 } |
351 computedLogicalHeight = styleLogicalHeight.value() - borders; | 351 computedLogicalHeight = LayoutUnit(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 computedLogicalHeight.clampNegativeToZero(); | 359 return computedLogicalHeight.clampNegativeToZero(); |
360 } | 360 } |
361 | 361 |
(...skipping 1093 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 |