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. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. |
7 * All rights reserved. | 7 * All rights reserved. |
8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
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 2461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2472 | 2472 |
2473 DISABLE_CFI_PERF | 2473 DISABLE_CFI_PERF |
2474 void LayoutBox::computeLogicalWidth( | 2474 void LayoutBox::computeLogicalWidth( |
2475 LogicalExtentComputedValues& computedValues) const { | 2475 LogicalExtentComputedValues& computedValues) const { |
2476 computedValues.m_extent = | 2476 computedValues.m_extent = |
2477 style()->containsSize() ? borderAndPaddingLogicalWidth() : logicalWidth(); | 2477 style()->containsSize() ? borderAndPaddingLogicalWidth() : logicalWidth(); |
2478 computedValues.m_position = logicalLeft(); | 2478 computedValues.m_position = logicalLeft(); |
2479 computedValues.m_margins.m_start = marginStart(); | 2479 computedValues.m_margins.m_start = marginStart(); |
2480 computedValues.m_margins.m_end = marginEnd(); | 2480 computedValues.m_margins.m_end = marginEnd(); |
2481 | 2481 |
| 2482 // The parent box is flexing us, so it has increased or decreased our |
| 2483 // width. Use the width from the style context. |
| 2484 if (hasOverrideLogicalContentWidth()) { |
| 2485 computedValues.m_extent = |
| 2486 overrideLogicalContentWidth() + borderAndPaddingLogicalWidth(); |
| 2487 return; |
| 2488 } |
| 2489 |
2482 if (isOutOfFlowPositioned()) { | 2490 if (isOutOfFlowPositioned()) { |
2483 computePositionedLogicalWidth(computedValues); | 2491 computePositionedLogicalWidth(computedValues); |
2484 return; | 2492 return; |
2485 } | 2493 } |
2486 | 2494 |
2487 // The parent box is flexing us, so it has increased or decreased our | |
2488 // width. Use the width from the style context. | |
2489 // FIXME: Account for writing-mode in flexible boxes. | |
2490 // https://bugs.webkit.org/show_bug.cgi?id=46418 | |
2491 if (hasOverrideLogicalContentWidth() && | |
2492 parent()->isFlexibleBoxIncludingDeprecated()) { | |
2493 computedValues.m_extent = | |
2494 overrideLogicalContentWidth() + borderAndPaddingLogicalWidth(); | |
2495 return; | |
2496 } | |
2497 | |
2498 // FIXME: Account for writing-mode in flexible boxes. | 2495 // FIXME: Account for writing-mode in flexible boxes. |
2499 // https://bugs.webkit.org/show_bug.cgi?id=46418 | 2496 // https://bugs.webkit.org/show_bug.cgi?id=46418 |
2500 bool inVerticalBox = parent()->isDeprecatedFlexibleBox() && | 2497 bool inVerticalBox = parent()->isDeprecatedFlexibleBox() && |
2501 (parent()->style()->boxOrient() == VERTICAL); | 2498 (parent()->style()->boxOrient() == VERTICAL); |
2502 bool stretching = (parent()->style()->boxAlign() == BSTRETCH); | 2499 bool stretching = (parent()->style()->boxAlign() == BSTRETCH); |
2503 // TODO (lajava): Stretching is the only reason why we don't want the box to | 2500 // TODO (lajava): Stretching is the only reason why we don't want the box to |
2504 // be treated as a replaced element, so we could perhaps refactor all this | 2501 // be treated as a replaced element, so we could perhaps refactor all this |
2505 // logic, not only for flex and grid since alignment is intended to be applied | 2502 // logic, not only for flex and grid since alignment is intended to be applied |
2506 // to any block. | 2503 // to any block. |
2507 bool treatAsReplaced = shouldComputeSizeAsReplaced() && | 2504 bool treatAsReplaced = shouldComputeSizeAsReplaced() && |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2972 // https://bugs.webkit.org/show_bug.cgi?id=46418 | 2969 // https://bugs.webkit.org/show_bug.cgi?id=46418 |
2973 bool inHorizontalBox = parent()->isDeprecatedFlexibleBox() && | 2970 bool inHorizontalBox = parent()->isDeprecatedFlexibleBox() && |
2974 parent()->style()->boxOrient() == HORIZONTAL; | 2971 parent()->style()->boxOrient() == HORIZONTAL; |
2975 bool stretching = parent()->style()->boxAlign() == BSTRETCH; | 2972 bool stretching = parent()->style()->boxAlign() == BSTRETCH; |
2976 bool treatAsReplaced = | 2973 bool treatAsReplaced = |
2977 shouldComputeSizeAsReplaced() && (!inHorizontalBox || !stretching); | 2974 shouldComputeSizeAsReplaced() && (!inHorizontalBox || !stretching); |
2978 bool checkMinMaxHeight = false; | 2975 bool checkMinMaxHeight = false; |
2979 | 2976 |
2980 // The parent box is flexing us, so it has increased or decreased our | 2977 // The parent box is flexing us, so it has increased or decreased our |
2981 // height. We have to grab our cached flexible height. | 2978 // height. We have to grab our cached flexible height. |
2982 // FIXME: Account for writing-mode in flexible boxes. | |
2983 // https://bugs.webkit.org/show_bug.cgi?id=46418 | |
2984 if (hasOverrideLogicalContentHeight()) { | 2979 if (hasOverrideLogicalContentHeight()) { |
2985 h = Length(overrideLogicalContentHeight(), Fixed); | 2980 h = Length(overrideLogicalContentHeight(), Fixed); |
2986 } else if (treatAsReplaced) { | 2981 } else if (treatAsReplaced) { |
2987 h = Length(computeReplacedLogicalHeight(), Fixed); | 2982 h = Length(computeReplacedLogicalHeight(), Fixed); |
2988 } else { | 2983 } else { |
2989 h = style()->logicalHeight(); | 2984 h = style()->logicalHeight(); |
2990 checkMinMaxHeight = true; | 2985 checkMinMaxHeight = true; |
2991 } | 2986 } |
2992 | 2987 |
2993 // Block children of horizontal flexible boxes fill the height of the box. | 2988 // Block children of horizontal flexible boxes fill the height of the box. |
(...skipping 2700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5694 block->adjustChildDebugRect(rect); | 5689 block->adjustChildDebugRect(rect); |
5695 | 5690 |
5696 return rect; | 5691 return rect; |
5697 } | 5692 } |
5698 | 5693 |
5699 bool LayoutBox::shouldClipOverflow() const { | 5694 bool LayoutBox::shouldClipOverflow() const { |
5700 return hasOverflowClip() || styleRef().containsPaint() || hasControlClip(); | 5695 return hasOverflowClip() || styleRef().containsPaint() || hasControlClip(); |
5701 } | 5696 } |
5702 | 5697 |
5703 } // namespace blink | 5698 } // namespace blink |
OLD | NEW |