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 | 292 |
293 // Ensure we aren't bigger than our max-width style. | 293 // Ensure we aren't bigger than our max-width style. |
294 Length styleMaxLogicalWidth = style()->logicalMaxWidth(); | 294 Length styleMaxLogicalWidth = style()->logicalMaxWidth(); |
295 if ((styleMaxLogicalWidth.isSpecified() && !styleMaxLogicalWidth.isNegative(
)) || styleMaxLogicalWidth.isIntrinsic()) { | 295 if ((styleMaxLogicalWidth.isSpecified() && !styleMaxLogicalWidth.isNegative(
)) || styleMaxLogicalWidth.isIntrinsic()) { |
296 LayoutUnit computedMaxLogicalWidth = convertStyleLogicalWidthToComputedW
idth(styleMaxLogicalWidth, availableLogicalWidth); | 296 LayoutUnit computedMaxLogicalWidth = convertStyleLogicalWidthToComputedW
idth(styleMaxLogicalWidth, availableLogicalWidth); |
297 setLogicalWidth(std::min<int>(logicalWidth(), computedMaxLogicalWidth)); | 297 setLogicalWidth(std::min<int>(logicalWidth(), computedMaxLogicalWidth)); |
298 } | 298 } |
299 | 299 |
300 // Ensure we aren't smaller than our min preferred width. This MUST be done
after 'max-width' as | 300 // Ensure we aren't smaller than our min preferred width. This MUST be done
after 'max-width' as |
301 // we ignore it if it means we wouldn't accomodate our content. | 301 // we ignore it if it means we wouldn't accommodate our content. |
302 setLogicalWidth(std::max<int>(logicalWidth(), minPreferredLogicalWidth())); | 302 setLogicalWidth(std::max<int>(logicalWidth(), minPreferredLogicalWidth())); |
303 | 303 |
304 // Ensure we aren't smaller than our min-width style. | 304 // Ensure we aren't smaller than our min-width style. |
305 Length styleMinLogicalWidth = style()->logicalMinWidth(); | 305 Length styleMinLogicalWidth = style()->logicalMinWidth(); |
306 if ((styleMinLogicalWidth.isSpecified() && !styleMinLogicalWidth.isNegative(
)) || styleMinLogicalWidth.isIntrinsic()) { | 306 if ((styleMinLogicalWidth.isSpecified() && !styleMinLogicalWidth.isNegative(
)) || styleMinLogicalWidth.isIntrinsic()) { |
307 LayoutUnit computedMinLogicalWidth = convertStyleLogicalWidthToComputedW
idth(styleMinLogicalWidth, availableLogicalWidth); | 307 LayoutUnit computedMinLogicalWidth = convertStyleLogicalWidthToComputedW
idth(styleMinLogicalWidth, availableLogicalWidth); |
308 setLogicalWidth(std::max<int>(logicalWidth(), computedMinLogicalWidth)); | 308 setLogicalWidth(std::max<int>(logicalWidth(), computedMinLogicalWidth)); |
309 } | 309 } |
310 | 310 |
311 // Finally, with our true width determined, compute our margins for real. | 311 // Finally, with our true width determined, compute our margins for real. |
312 ComputedMarginValues marginValues; | 312 ComputedMarginValues marginValues; |
313 computeMarginsForDirection(InlineDirection, cb, availableLogicalWidth, logic
alWidth(), marginValues.m_start, marginValues.m_end, style()->marginStart(), sty
le()->marginEnd()); | 313 computeMarginsForDirection(InlineDirection, cb, availableLogicalWidth, logic
alWidth(), marginValues.m_start, marginValues.m_end, style()->marginStart(), sty
le()->marginEnd()); |
314 setMarginStart(marginValues.m_start); | 314 setMarginStart(marginValues.m_start); |
315 setMarginEnd(marginValues.m_end); | 315 setMarginEnd(marginValues.m_end); |
316 | 316 |
317 // We should NEVER shrink the table below the min-content logical width, or
else the table can't accomodate | 317 // We should NEVER shrink the table below the min-content logical width, or
else the table can't accommodate |
318 // its own content which doesn't match CSS nor what authors expect. | 318 // its own content which doesn't match CSS nor what authors expect. |
319 // FIXME: When we convert to sub-pixel layout for tables we can remove the i
nt conversion | 319 // FIXME: When we convert to sub-pixel layout for tables we can remove the i
nt conversion |
320 // https://code.google.com/p/chromium/issues/detail?id=241198 | 320 // https://code.google.com/p/chromium/issues/detail?id=241198 |
321 ASSERT(logicalWidth().toInt() >= minPreferredLogicalWidth().toInt()); | 321 ASSERT(logicalWidth().toInt() >= minPreferredLogicalWidth().toInt()); |
322 } | 322 } |
323 | 323 |
324 // This method takes a ComputedStyle's logical width, min-width, or max-width le
ngth and computes its actual value. | 324 // This method takes a ComputedStyle's logical width, min-width, or max-width le
ngth and computes its actual value. |
325 LayoutUnit LayoutTable::convertStyleLogicalWidthToComputedWidth(const Length& st
yleLogicalWidth, LayoutUnit availableWidth) | 325 LayoutUnit LayoutTable::convertStyleLogicalWidthToComputedWidth(const Length& st
yleLogicalWidth, LayoutUnit availableWidth) |
326 { | 326 { |
327 if (styleLogicalWidth.isIntrinsic()) | 327 if (styleLogicalWidth.isIntrinsic()) |
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1456 | 1456 |
1457 LayoutUnit LayoutTable::paddingRight() const | 1457 LayoutUnit LayoutTable::paddingRight() const |
1458 { | 1458 { |
1459 if (collapseBorders()) | 1459 if (collapseBorders()) |
1460 return LayoutUnit(); | 1460 return LayoutUnit(); |
1461 | 1461 |
1462 return LayoutBlock::paddingRight(); | 1462 return LayoutBlock::paddingRight(); |
1463 } | 1463 } |
1464 | 1464 |
1465 } | 1465 } |
OLD | NEW |