OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2092 | 2092 |
2093 // Width calculations | 2093 // Width calculations |
2094 if (treatAsReplaced) { | 2094 if (treatAsReplaced) { |
2095 computedValues.m_extent = LayoutUnit(logicalWidthLength.value()) + borde
rAndPaddingLogicalWidth(); | 2095 computedValues.m_extent = LayoutUnit(logicalWidthLength.value()) + borde
rAndPaddingLogicalWidth(); |
2096 } else if (parent()->isLayoutGrid() && style()->logicalWidth().isAuto() && s
tyle()->logicalMinWidth().isAuto() && style()->overflowX() == OVISIBLE && contai
nerLogicalWidth < minPreferredLogicalWidth()) { | 2096 } else if (parent()->isLayoutGrid() && style()->logicalWidth().isAuto() && s
tyle()->logicalMinWidth().isAuto() && style()->overflowX() == OVISIBLE && contai
nerLogicalWidth < minPreferredLogicalWidth()) { |
2097 // TODO (lajava) Move this logic to the LayoutGrid class. | 2097 // TODO (lajava) Move this logic to the LayoutGrid class. |
2098 // Implied minimum size of Grid items. | 2098 // Implied minimum size of Grid items. |
2099 computedValues.m_extent = constrainLogicalWidthByMinMax(minPreferredLogi
calWidth(), containerLogicalWidth, cb); | 2099 computedValues.m_extent = constrainLogicalWidthByMinMax(minPreferredLogi
calWidth(), containerLogicalWidth, cb); |
2100 } else { | 2100 } else { |
2101 LayoutUnit containerWidthInInlineDirection = containerLogicalWidth; | 2101 LayoutUnit containerWidthInInlineDirection = containerLogicalWidth; |
2102 if (hasPerpendicularContainingBlock) | 2102 if (hasPerpendicularContainingBlock) { |
2103 containerWidthInInlineDirection = perpendicularContainingBlockLogica
lHeight(); | 2103 containerWidthInInlineDirection = perpendicularContainingBlockLogica
lHeight(); |
| 2104 } else if (cb->isFlexItem() && styleToUse.logicalWidth().hasPercent() &&
!isOutOfFlowPositioned()) { |
| 2105 LayoutUnit stretchedWidth = toLayoutFlexibleBox(cb->parent())->child
LogicalWidthForPercentageResolution(*cb); |
| 2106 if (stretchedWidth != LayoutUnit(-1)) |
| 2107 containerWidthInInlineDirection = stretchedWidth; |
| 2108 } |
2104 LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize
, styleToUse.logicalWidth(), containerWidthInInlineDirection, cb); | 2109 LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize
, styleToUse.logicalWidth(), containerWidthInInlineDirection, cb); |
2105 computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth,
containerWidthInInlineDirection, cb); | 2110 computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth,
containerWidthInInlineDirection, cb); |
2106 } | 2111 } |
2107 | 2112 |
2108 // Margin calculations. | 2113 // Margin calculations. |
2109 computeMarginsForDirection(InlineDirection, cb, containerLogicalWidth, compu
tedValues.m_extent, computedValues.m_margins.m_start, | 2114 computeMarginsForDirection(InlineDirection, cb, containerLogicalWidth, compu
tedValues.m_extent, computedValues.m_margins.m_start, |
2110 computedValues.m_margins.m_end, style()->marginStart(), style()->marginE
nd()); | 2115 computedValues.m_margins.m_end, style()->marginStart(), style()->marginE
nd()); |
2111 | 2116 |
2112 if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLo
gicalWidth != (computedValues.m_extent + computedValues.m_margins.m_start + comp
utedValues.m_margins.m_end) | 2117 if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLo
gicalWidth != (computedValues.m_extent + computedValues.m_margins.m_start + comp
utedValues.m_margins.m_end) |
2113 && !isFloating() && !isInline() && !cb->isFlexibleBoxIncludingDeprecated
() && !cb->isLayoutGrid()) { | 2118 && !isFloating() && !isInline() && !cb->isFlexibleBoxIncludingDeprecated
() && !cb->isLayoutGrid()) { |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2593 cb->addPercentHeightDescendant(const_cast<LayoutBox*>(this)); | 2598 cb->addPercentHeightDescendant(const_cast<LayoutBox*>(this)); |
2594 | 2599 |
2595 const ComputedStyle& cbstyle = cb->styleRef(); | 2600 const ComputedStyle& cbstyle = cb->styleRef(); |
2596 | 2601 |
2597 // A positioned element that specified both top/bottom or that specifies hei
ght should be treated as though it has a height | 2602 // A positioned element that specified both top/bottom or that specifies hei
ght should be treated as though it has a height |
2598 // explicitly specified that can be used for any percentage computations. | 2603 // explicitly specified that can be used for any percentage computations. |
2599 bool isOutOfFlowPositionedWithSpecifiedHeight = cb->isOutOfFlowPositioned()
&& (!cbstyle.logicalHeight().isAuto() || (!cbstyle.logicalTop().isAuto() && !cbs
tyle.logicalBottom().isAuto())); | 2604 bool isOutOfFlowPositionedWithSpecifiedHeight = cb->isOutOfFlowPositioned()
&& (!cbstyle.logicalHeight().isAuto() || (!cbstyle.logicalTop().isAuto() && !cbs
tyle.logicalBottom().isAuto())); |
2600 | 2605 |
2601 bool includeBorderPadding = isTable(); | 2606 bool includeBorderPadding = isTable(); |
2602 | 2607 |
| 2608 LayoutUnit stretchedFlexHeight(-1); |
| 2609 if (cb->isFlexItem()) |
| 2610 stretchedFlexHeight = toLayoutFlexibleBox(cb->parent())->childLogicalHei
ghtForPercentageResolution(*cb); |
| 2611 |
2603 if (isHorizontalWritingMode() != cb->isHorizontalWritingMode()) { | 2612 if (isHorizontalWritingMode() != cb->isHorizontalWritingMode()) { |
2604 availableHeight = containingBlockChild->containingBlockLogicalWidthForCo
ntent(); | 2613 availableHeight = containingBlockChild->containingBlockLogicalWidthForCo
ntent(); |
| 2614 } else if (stretchedFlexHeight != LayoutUnit(-1)) { |
| 2615 availableHeight = stretchedFlexHeight; |
2605 } else if (hasOverrideContainingBlockLogicalHeight()) { | 2616 } else if (hasOverrideContainingBlockLogicalHeight()) { |
2606 availableHeight = overrideContainingBlockContentLogicalHeight(); | 2617 availableHeight = overrideContainingBlockContentLogicalHeight(); |
2607 } else if (cb->isTableCell()) { | 2618 } else if (cb->isTableCell()) { |
2608 if (!skippedAutoHeightContainingBlock) { | 2619 if (!skippedAutoHeightContainingBlock) { |
2609 // The second clause in this conditional (after the ||) is to suppor
t this line from the | 2620 // The second clause in this conditional (after the ||) is to suppor
t this line from the |
2610 // definition of height in CSS 2.2: | 2621 // definition of height in CSS 2.2: |
2611 // "If the height of the containing block is not specified explicitl
y (i.e., it depends on | 2622 // "If the height of the containing block is not specified explicitl
y (i.e., it depends on |
2612 // content height), and this element is not absolutely positioned, t
he used height is | 2623 // content height), and this element is not absolutely positioned, t
he used height is |
2613 // calculated as if 'auto' was specified." | 2624 // calculated as if 'auto' was specified." |
2614 // But FF doesn't apply this logic (1) in quirks mode or (2) when "t
his element" is a table. | 2625 // But FF doesn't apply this logic (1) in quirks mode or (2) when "t
his element" is a table. |
(...skipping 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4682 } | 4693 } |
4683 | 4694 |
4684 void LayoutBox::IntrinsicSizingInfo::transpose() | 4695 void LayoutBox::IntrinsicSizingInfo::transpose() |
4685 { | 4696 { |
4686 size = size.transposedSize(); | 4697 size = size.transposedSize(); |
4687 aspectRatio = aspectRatio.transposedSize(); | 4698 aspectRatio = aspectRatio.transposedSize(); |
4688 std::swap(hasWidth, hasHeight); | 4699 std::swap(hasWidth, hasHeight); |
4689 } | 4700 } |
4690 | 4701 |
4691 } // namespace blink | 4702 } // namespace blink |
OLD | NEW |