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. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. |
8 * All rights reserved. | 8 * All rights reserved. |
9 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 9 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
10 * | 10 * |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
290 | 290 |
291 // Subtract out our margins to get the available content width. | 291 // Subtract out our margins to get the available content width. |
292 LayoutUnit availableContentLogicalWidth = | 292 LayoutUnit availableContentLogicalWidth = |
293 (containerWidthInInlineDirection - marginTotal).clampNegativeToZero(); | 293 (containerWidthInInlineDirection - marginTotal).clampNegativeToZero(); |
294 if (shrinkToAvoidFloats() && cb->isLayoutBlockFlow() && | 294 if (shrinkToAvoidFloats() && cb->isLayoutBlockFlow() && |
295 toLayoutBlockFlow(cb)->containsFloats() && | 295 toLayoutBlockFlow(cb)->containsFloats() && |
296 !hasPerpendicularContainingBlock) | 296 !hasPerpendicularContainingBlock) |
297 availableContentLogicalWidth = shrinkLogicalWidthToAvoidFloats( | 297 availableContentLogicalWidth = shrinkLogicalWidthToAvoidFloats( |
298 marginStart, marginEnd, toLayoutBlockFlow(cb)); | 298 marginStart, marginEnd, toLayoutBlockFlow(cb)); |
299 | 299 |
300 // Ensure we aren't bigger than our available width. | 300 if (hasStretchedLogicalWidth()) { |
301 LayoutUnit maxWidth = maxPreferredLogicalWidth(); | 301 setLogicalWidth(availableContentLogicalWidth); |
302 // scaledWidthFromPercentColumns depends on m_layoutStruct in | 302 } else { |
303 // TableLayoutAlgorithmAuto, which maxPreferredLogicalWidth fills in. So | 303 // Ensure we aren't bigger than our available width. |
304 // scaledWidthFromPercentColumns has to be called after | 304 LayoutUnit maxWidth = maxPreferredLogicalWidth(); |
305 // maxPreferredLogicalWidth. | 305 // scaledWidthFromPercentColumns depends on m_layoutStruct in |
306 LayoutUnit scaledWidth = m_tableLayout->scaledWidthFromPercentColumns() + | 306 // TableLayoutAlgorithmAuto, which maxPreferredLogicalWidth fills in. So |
307 bordersPaddingAndSpacingInRowDirection(); | 307 // scaledWidthFromPercentColumns has to be called after |
308 maxWidth = std::max(scaledWidth, maxWidth); | 308 // maxPreferredLogicalWidth. |
309 setLogicalWidth( | 309 LayoutUnit scaledWidth = m_tableLayout->scaledWidthFromPercentColumns() + |
310 LayoutUnit(std::min(availableContentLogicalWidth, maxWidth).floor())); | 310 bordersPaddingAndSpacingInRowDirection(); |
311 maxWidth = std::max(scaledWidth, maxWidth); | |
312 setLogicalWidth( | |
313 LayoutUnit(std::min(availableContentLogicalWidth, maxWidth).floor())); | |
314 } | |
311 } | 315 } |
312 | 316 |
313 // Ensure we aren't bigger than our max-width style. | 317 // Ensure we aren't bigger than our max-width style. |
314 Length styleMaxLogicalWidth = style()->logicalMaxWidth(); | 318 Length styleMaxLogicalWidth = style()->logicalMaxWidth(); |
315 if ((styleMaxLogicalWidth.isSpecified() && | 319 if ((styleMaxLogicalWidth.isSpecified() && |
316 !styleMaxLogicalWidth.isNegative()) || | 320 !styleMaxLogicalWidth.isNegative()) || |
317 styleMaxLogicalWidth.isIntrinsic()) { | 321 styleMaxLogicalWidth.isIntrinsic()) { |
318 LayoutUnit computedMaxLogicalWidth = | 322 LayoutUnit computedMaxLogicalWidth = |
319 convertStyleLogicalWidthToComputedWidth(styleMaxLogicalWidth, | 323 convertStyleLogicalWidthToComputedWidth(styleMaxLogicalWidth, |
320 availableLogicalWidth); | 324 availableLogicalWidth); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
458 if (neededLayout || tableHeightChanging == TableHeightChanging) | 462 if (neededLayout || tableHeightChanging == TableHeightChanging) |
459 section.setLogicalHeight(LayoutUnit(section.calcRowLogicalHeight())); | 463 section.setLogicalHeight(LayoutUnit(section.calcRowLogicalHeight())); |
460 | 464 |
461 if (view()->layoutState()->isPaginated()) | 465 if (view()->layoutState()->isPaginated()) |
462 updateFragmentationInfoForChild(section); | 466 updateFragmentationInfoForChild(section); |
463 setLogicalHeight(logicalHeight() + section.logicalHeight()); | 467 setLogicalHeight(logicalHeight() + section.logicalHeight()); |
464 } | 468 } |
465 | 469 |
466 LayoutUnit LayoutTable::logicalHeightFromStyle() const { | 470 LayoutUnit LayoutTable::logicalHeightFromStyle() const { |
467 LayoutUnit computedLogicalHeight; | 471 LayoutUnit computedLogicalHeight; |
468 Length logicalHeightLength = style()->logicalHeight(); | 472 if (hasOverrideLogicalContentHeight()) { |
469 if (logicalHeightLength.isIntrinsic() || | 473 computedLogicalHeight = overrideLogicalContentHeight(); |
470 (logicalHeightLength.isSpecified() && logicalHeightLength.isPositive())) { | 474 } else { |
471 computedLogicalHeight = | 475 Length logicalHeightLength = style()->logicalHeight(); |
472 convertStyleLogicalHeightToComputedHeight(logicalHeightLength); | 476 if (logicalHeightLength.isIntrinsic() || |
477 (logicalHeightLength.isSpecified() && | |
478 logicalHeightLength.isPositive())) { | |
479 computedLogicalHeight = | |
480 convertStyleLogicalHeightToComputedHeight(logicalHeightLength); | |
481 } | |
473 } | 482 } |
474 | 483 |
475 Length logicalMaxHeightLength = style()->logicalMaxHeight(); | 484 Length logicalMaxHeightLength = style()->logicalMaxHeight(); |
476 if (logicalMaxHeightLength.isIntrinsic() || | 485 if (logicalMaxHeightLength.isIntrinsic() || |
477 (logicalMaxHeightLength.isSpecified() && | 486 (logicalMaxHeightLength.isSpecified() && |
478 !logicalMaxHeightLength.isNegative())) { | 487 !logicalMaxHeightLength.isNegative())) { |
479 LayoutUnit computedMaxLogicalHeight = | 488 LayoutUnit computedMaxLogicalHeight = |
480 convertStyleLogicalHeightToComputedHeight(logicalMaxHeightLength); | 489 convertStyleLogicalHeightToComputedHeight(logicalMaxHeightLength); |
481 computedLogicalHeight = | 490 computedLogicalHeight = |
482 std::min(computedLogicalHeight, computedMaxLogicalHeight); | 491 std::min(computedLogicalHeight, computedMaxLogicalHeight); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
620 borderAfter() + (collapsing ? LayoutUnit() : paddingAfter()); | 629 borderAfter() + (collapsing ? LayoutUnit() : paddingAfter()); |
621 | 630 |
622 setLogicalHeight(tableBoxLogicalTop + borderAndPaddingBefore); | 631 setLogicalHeight(tableBoxLogicalTop + borderAndPaddingBefore); |
623 | 632 |
624 LayoutUnit sectionLogicalLeft = LayoutUnit( | 633 LayoutUnit sectionLogicalLeft = LayoutUnit( |
625 style()->isLeftToRightDirection() ? borderStart() : borderEnd()); | 634 style()->isLeftToRightDirection() ? borderStart() : borderEnd()); |
626 if (!collapsing) { | 635 if (!collapsing) { |
627 sectionLogicalLeft += | 636 sectionLogicalLeft += |
628 style()->isLeftToRightDirection() ? paddingStart() : paddingEnd(); | 637 style()->isLeftToRightDirection() ? paddingStart() : paddingEnd(); |
629 } | 638 } |
630 LayoutUnit currentAvailableLogicalHeight = | 639 LayoutUnit currentAvailableLogicalHeight = |
mstensho (USE GERRIT)
2017/03/02 12:26:01
In the future, please push separate patch sets for
| |
631 availableLogicalHeight(IncludeMarginBorderPadding); | 640 availableLogicalHeight(IncludeMarginBorderPadding); |
632 TableHeightChangingValue tableHeightChanging = | 641 TableHeightChangingValue tableHeightChanging = |
633 m_oldAvailableLogicalHeight && | 642 m_oldAvailableLogicalHeight && |
634 m_oldAvailableLogicalHeight != currentAvailableLogicalHeight | 643 m_oldAvailableLogicalHeight != currentAvailableLogicalHeight |
635 ? TableHeightChanging | 644 ? TableHeightChanging |
636 : TableHeightNotChanging; | 645 : TableHeightNotChanging; |
637 m_oldAvailableLogicalHeight = currentAvailableLogicalHeight; | 646 m_oldAvailableLogicalHeight = currentAvailableLogicalHeight; |
638 | 647 |
639 // Lay out table header group. | 648 // Lay out table header group. |
640 if (LayoutTableSection* section = header()) { | 649 if (LayoutTableSection* section = header()) { |
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1711 } | 1720 } |
1712 | 1721 |
1713 LayoutUnit LayoutTable::paddingRight() const { | 1722 LayoutUnit LayoutTable::paddingRight() const { |
1714 if (collapseBorders()) | 1723 if (collapseBorders()) |
1715 return LayoutUnit(); | 1724 return LayoutUnit(); |
1716 | 1725 |
1717 return LayoutBlock::paddingRight(); | 1726 return LayoutBlock::paddingRight(); |
1718 } | 1727 } |
1719 | 1728 |
1720 } // namespace blink | 1729 } // namespace blink |
OLD | NEW |