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 2106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2117 | 2117 |
2118 if (isInline() && !isInlineBlockOrInlineTable()) { | 2118 if (isInline() && !isInlineBlockOrInlineTable()) { |
2119 // just calculate margins | 2119 // just calculate margins |
2120 computedValues.m_margins.m_start = minimumValueForLength(styleToUse.marg
inStart(), containerLogicalWidth); | 2120 computedValues.m_margins.m_start = minimumValueForLength(styleToUse.marg
inStart(), containerLogicalWidth); |
2121 computedValues.m_margins.m_end = minimumValueForLength(styleToUse.margin
End(), containerLogicalWidth); | 2121 computedValues.m_margins.m_end = minimumValueForLength(styleToUse.margin
End(), containerLogicalWidth); |
2122 if (treatAsReplaced) | 2122 if (treatAsReplaced) |
2123 computedValues.m_extent = std::max(LayoutUnit(floatValueForLength(lo
gicalWidthLength, 0)) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth
()); | 2123 computedValues.m_extent = std::max(LayoutUnit(floatValueForLength(lo
gicalWidthLength, 0)) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth
()); |
2124 return; | 2124 return; |
2125 } | 2125 } |
2126 | 2126 |
| 2127 LayoutUnit containerWidthInInlineDirection = containerLogicalWidth; |
| 2128 if (hasPerpendicularContainingBlock) |
| 2129 containerWidthInInlineDirection = perpendicularContainingBlockLogicalHei
ght(); |
| 2130 |
2127 // Width calculations | 2131 // Width calculations |
2128 if (treatAsReplaced) { | 2132 if (treatAsReplaced) { |
2129 computedValues.m_extent = LayoutUnit(logicalWidthLength.value()) + borde
rAndPaddingLogicalWidth(); | 2133 computedValues.m_extent = LayoutUnit(logicalWidthLength.value()) + borde
rAndPaddingLogicalWidth(); |
2130 } else if (parent()->isLayoutGrid() && style()->logicalWidth().isAuto() && s
tyle()->logicalMinWidth().isAuto() && style()->overflowX() == OverflowVisible &&
containerLogicalWidth < minPreferredLogicalWidth()) { | 2134 } else if (parent()->isLayoutGrid() && style()->logicalWidth().isAuto() && s
tyle()->logicalMinWidth().isAuto() && style()->overflowX() == OverflowVisible &&
containerWidthInInlineDirection < minPreferredLogicalWidth()) { |
2131 // TODO (lajava) Move this logic to the LayoutGrid class. | 2135 // TODO (lajava) Move this logic to the LayoutGrid class. |
2132 // Implied minimum size of Grid items. | 2136 // Implied minimum size of Grid items. |
2133 computedValues.m_extent = constrainLogicalWidthByMinMax(minPreferredLogi
calWidth(), containerLogicalWidth, cb); | 2137 computedValues.m_extent = constrainLogicalWidthByMinMax(minPreferredLogi
calWidth(), containerWidthInInlineDirection, cb); |
2134 } else { | 2138 } else { |
2135 LayoutUnit containerWidthInInlineDirection = containerLogicalWidth; | 2139 if (!hasPerpendicularContainingBlock && cb->isFlexItem() && styleToUse.l
ogicalWidth().hasPercent() && !isOutOfFlowPositioned()) { |
2136 if (hasPerpendicularContainingBlock) { | |
2137 containerWidthInInlineDirection = perpendicularContainingBlockLogica
lHeight(); | |
2138 } else if (cb->isFlexItem() && styleToUse.logicalWidth().hasPercent() &&
!isOutOfFlowPositioned()) { | |
2139 LayoutUnit stretchedWidth = toLayoutFlexibleBox(cb->parent())->child
LogicalWidthForPercentageResolution(*cb); | 2140 LayoutUnit stretchedWidth = toLayoutFlexibleBox(cb->parent())->child
LogicalWidthForPercentageResolution(*cb); |
2140 if (stretchedWidth != LayoutUnit(-1)) | 2141 if (stretchedWidth != LayoutUnit(-1)) |
2141 containerWidthInInlineDirection = stretchedWidth; | 2142 containerWidthInInlineDirection = stretchedWidth; |
2142 } | 2143 } |
2143 LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize
, styleToUse.logicalWidth(), containerWidthInInlineDirection, cb); | 2144 LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize
, styleToUse.logicalWidth(), containerWidthInInlineDirection, cb); |
2144 computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth,
containerWidthInInlineDirection, cb); | 2145 computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth,
containerWidthInInlineDirection, cb); |
2145 } | 2146 } |
2146 | 2147 |
2147 // Margin calculations. | 2148 // Margin calculations. |
2148 computeMarginsForDirection(InlineDirection, cb, containerLogicalWidth, compu
tedValues.m_extent, computedValues.m_margins.m_start, | 2149 computeMarginsForDirection(InlineDirection, cb, containerLogicalWidth, compu
tedValues.m_extent, computedValues.m_margins.m_start, |
(...skipping 2573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4722 } | 4723 } |
4723 | 4724 |
4724 void LayoutBox::IntrinsicSizingInfo::transpose() | 4725 void LayoutBox::IntrinsicSizingInfo::transpose() |
4725 { | 4726 { |
4726 size = size.transposedSize(); | 4727 size = size.transposedSize(); |
4727 aspectRatio = aspectRatio.transposedSize(); | 4728 aspectRatio = aspectRatio.transposedSize(); |
4728 std::swap(hasWidth, hasHeight); | 4729 std::swap(hasWidth, hasHeight); |
4729 } | 4730 } |
4730 | 4731 |
4731 } // namespace blink | 4732 } // namespace blink |
OLD | NEW |