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 Apple Inc. All r
ights reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r
ights 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 LayoutUnit borders = 0; | 320 LayoutUnit borders = 0; |
321 bool isCSSTable = !node() || !node()->hasTagName(tableTag); | 321 bool isCSSTable = !node() || !node()->hasTagName(tableTag); |
322 if (isCSSTable && styleLogicalWidth.isSpecified() && styleLogicalWidth.isPos
itive() && style()->boxSizing() == CONTENT_BOX) | 322 if (isCSSTable && styleLogicalWidth.isSpecified() && styleLogicalWidth.isPos
itive() && style()->boxSizing() == CONTENT_BOX) |
323 borders = borderStart() + borderEnd() + (collapseBorders() ? LayoutUnit(
) : paddingStart() + paddingEnd()); | 323 borders = borderStart() + borderEnd() + (collapseBorders() ? LayoutUnit(
) : paddingStart() + paddingEnd()); |
324 | 324 |
325 return minimumValueForLength(styleLogicalWidth, availableWidth, view()) + bo
rders; | 325 return minimumValueForLength(styleLogicalWidth, availableWidth, view()) + bo
rders; |
326 } | 326 } |
327 | 327 |
328 LayoutUnit RenderTable::convertStyleLogicalHeightToComputedHeight(const Length&
styleLogicalHeight) | 328 LayoutUnit RenderTable::convertStyleLogicalHeightToComputedHeight(const Length&
styleLogicalHeight) |
329 { | 329 { |
| 330 LayoutUnit borderAndPaddingBefore = borderBefore() + (collapseBorders() ? La
youtUnit() : paddingBefore()); |
| 331 LayoutUnit borderAndPaddingAfter = borderAfter() + (collapseBorders() ? Layo
utUnit() : paddingAfter()); |
| 332 LayoutUnit borderAndPadding = borderAndPaddingBefore + borderAndPaddingAfter
; |
330 LayoutUnit computedLogicalHeight = 0; | 333 LayoutUnit computedLogicalHeight = 0; |
331 if (styleLogicalHeight.isFixed()) { | 334 if (styleLogicalHeight.isFixed()) { |
332 // HTML tables size as though CSS height includes border/padding, CSS ta
bles do not. | 335 // HTML tables size as though CSS height includes border/padding, CSS ta
bles do not. |
333 LayoutUnit borders = LayoutUnit(); | 336 LayoutUnit borders = LayoutUnit(); |
334 // FIXME: We cannot apply box-sizing: content-box on <table> which other
browsers allow. | 337 // FIXME: We cannot apply box-sizing: content-box on <table> which other
browsers allow. |
335 if ((node() && node()->hasTagName(tableTag)) || style()->boxSizing() ==
BORDER_BOX) { | 338 if ((node() && node()->hasTagName(tableTag)) || style()->boxSizing() ==
BORDER_BOX) { |
336 LayoutUnit borderAndPaddingBefore = borderBefore() + (collapseBorder
s() ? LayoutUnit() : paddingBefore()); | 339 borders = borderAndPadding; |
337 LayoutUnit borderAndPaddingAfter = borderAfter() + (collapseBorders(
) ? LayoutUnit() : paddingAfter()); | |
338 borders = borderAndPaddingBefore + borderAndPaddingAfter; | |
339 } | 340 } |
340 computedLogicalHeight = styleLogicalHeight.value() - borders; | 341 computedLogicalHeight = styleLogicalHeight.value() - borders; |
341 } else if (styleLogicalHeight.isPercent()) | 342 } else if (styleLogicalHeight.isPercent()) |
342 computedLogicalHeight = computePercentageLogicalHeight(styleLogicalHeigh
t); | 343 computedLogicalHeight = computePercentageLogicalHeight(styleLogicalHeigh
t); |
343 else if (styleLogicalHeight.isViewportPercentage()) | 344 else if (styleLogicalHeight.isViewportPercentage()) |
344 computedLogicalHeight = minimumValueForLength(styleLogicalHeight, 0, vie
w()); | 345 computedLogicalHeight = minimumValueForLength(styleLogicalHeight, 0, vie
w()); |
| 346 else if (styleLogicalHeight.isIntrinsic()) |
| 347 computedLogicalHeight = computeIntrinsicLogicalContentHeightUsing(styleL
ogicalHeight, logicalHeight() - borderAndPadding, borderAndPadding); |
345 else | 348 else |
346 ASSERT_NOT_REACHED(); | 349 ASSERT_NOT_REACHED(); |
347 return max<LayoutUnit>(0, computedLogicalHeight); | 350 return max<LayoutUnit>(0, computedLogicalHeight); |
348 } | 351 } |
349 | 352 |
350 void RenderTable::layoutCaption(RenderTableCaption* caption) | 353 void RenderTable::layoutCaption(RenderTableCaption* caption) |
351 { | 354 { |
352 LayoutRect captionRect(caption->frameRect()); | 355 LayoutRect captionRect(caption->frameRect()); |
353 | 356 |
354 if (caption->needsLayout()) { | 357 if (caption->needsLayout()) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? LayoutUnit(
) : paddingAfter()); | 472 LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? LayoutUnit(
) : paddingAfter()); |
470 | 473 |
471 setLogicalHeight(logicalHeight() + borderAndPaddingBefore); | 474 setLogicalHeight(logicalHeight() + borderAndPaddingBefore); |
472 | 475 |
473 if (!isOutOfFlowPositioned()) | 476 if (!isOutOfFlowPositioned()) |
474 updateLogicalHeight(); | 477 updateLogicalHeight(); |
475 | 478 |
476 LayoutUnit computedLogicalHeight = 0; | 479 LayoutUnit computedLogicalHeight = 0; |
477 | 480 |
478 Length logicalHeightLength = style()->logicalHeight(); | 481 Length logicalHeightLength = style()->logicalHeight(); |
479 if (logicalHeightLength.isSpecified() && logicalHeightLength.isPositive()) | 482 if (logicalHeightLength.isIntrinsic() || (logicalHeightLength.isSpecified()
&& logicalHeightLength.isPositive())) |
480 computedLogicalHeight = convertStyleLogicalHeightToComputedHeight(logica
lHeightLength); | 483 computedLogicalHeight = convertStyleLogicalHeightToComputedHeight(logica
lHeightLength); |
481 | 484 |
482 Length logicalMaxHeightLength = style()->logicalMaxHeight(); | 485 Length logicalMaxHeightLength = style()->logicalMaxHeight(); |
483 if (logicalMaxHeightLength.isSpecified() && !logicalMaxHeightLength.isNegati
ve()) { | 486 if (logicalMaxHeightLength.isIntrinsic() || (logicalMaxHeightLength.isSpecif
ied() && !logicalMaxHeightLength.isNegative())) { |
484 LayoutUnit computedMaxLogicalHeight = convertStyleLogicalHeightToCompute
dHeight(logicalMaxHeightLength); | 487 LayoutUnit computedMaxLogicalHeight = convertStyleLogicalHeightToCompute
dHeight(logicalMaxHeightLength); |
485 computedLogicalHeight = min(computedLogicalHeight, computedMaxLogicalHei
ght); | 488 computedLogicalHeight = min(computedLogicalHeight, computedMaxLogicalHei
ght); |
486 } | 489 } |
487 | 490 |
488 Length logicalMinHeightLength = style()->logicalMinHeight(); | 491 Length logicalMinHeightLength = style()->logicalMinHeight(); |
489 if (logicalMinHeightLength.isSpecified() && !logicalMinHeightLength.isNegati
ve()) { | 492 if (logicalMinHeightLength.isIntrinsic() || (logicalMinHeightLength.isSpecif
ied() && !logicalMinHeightLength.isNegative())) { |
490 LayoutUnit computedMinLogicalHeight = convertStyleLogicalHeightToCompute
dHeight(logicalMinHeightLength); | 493 LayoutUnit computedMinLogicalHeight = convertStyleLogicalHeightToCompute
dHeight(logicalMinHeightLength); |
491 computedLogicalHeight = max(computedLogicalHeight, computedMinLogicalHei
ght); | 494 computedLogicalHeight = max(computedLogicalHeight, computedMinLogicalHei
ght); |
492 } | 495 } |
493 | 496 |
494 distributeExtraLogicalHeight(floorToInt(computedLogicalHeight - totalSection
LogicalHeight)); | 497 distributeExtraLogicalHeight(floorToInt(computedLogicalHeight - totalSection
LogicalHeight)); |
495 | 498 |
496 for (RenderTableSection* section = topSection(); section; section = sectionB
elow(section)) | 499 for (RenderTableSection* section = topSection(); section; section = sectionB
elow(section)) |
497 section->layoutRows(); | 500 section->layoutRows(); |
498 | 501 |
499 if (!topSection() && computedLogicalHeight > totalSectionLogicalHeight && !d
ocument()->inQuirksMode()) { | 502 if (!topSection() && computedLogicalHeight > totalSectionLogicalHeight && !d
ocument()->inQuirksMode()) { |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1425 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel
l* cell) const | 1428 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel
l* cell) const |
1426 { | 1429 { |
1427 ASSERT(cell->isFirstOrLastCellInRow()); | 1430 ASSERT(cell->isFirstOrLastCellInRow()); |
1428 if (hasSameDirectionAs(cell->row())) | 1431 if (hasSameDirectionAs(cell->row())) |
1429 return style()->borderEnd(); | 1432 return style()->borderEnd(); |
1430 | 1433 |
1431 return style()->borderStart(); | 1434 return style()->borderStart(); |
1432 } | 1435 } |
1433 | 1436 |
1434 } | 1437 } |
OLD | NEW |