| 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 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 // FIXME: Pass in DoubleSize. crbug.com/414283. | 1021 // FIXME: Pass in DoubleSize. crbug.com/414283. |
| 1022 view()->frameView()->scrollBy(flooredIntSize(delta), UserScroll); | 1022 view()->frameView()->scrollBy(flooredIntSize(delta), UserScroll); |
| 1023 | 1023 |
| 1024 // FIXME: If we didn't scroll the whole way, do we want to try looking a
t the frames ownerElement? | 1024 // FIXME: If we didn't scroll the whole way, do we want to try looking a
t the frames ownerElement? |
| 1025 // https://bugs.webkit.org/show_bug.cgi?id=28237 | 1025 // https://bugs.webkit.org/show_bug.cgi?id=28237 |
| 1026 } | 1026 } |
| 1027 } | 1027 } |
| 1028 | 1028 |
| 1029 bool LayoutBox::needsPreferredWidthsRecalculation() const | 1029 bool LayoutBox::needsPreferredWidthsRecalculation() const |
| 1030 { | 1030 { |
| 1031 return style()->paddingStart().hasPercent() || style()->paddingEnd().hasPerc
ent(); | 1031 return style()->paddingStart().isPercentOrCalc() || style()->paddingEnd().is
PercentOrCalc(); |
| 1032 } | 1032 } |
| 1033 | 1033 |
| 1034 IntSize LayoutBox::originAdjustmentForScrollbars() const | 1034 IntSize LayoutBox::originAdjustmentForScrollbars() const |
| 1035 { | 1035 { |
| 1036 IntSize size; | 1036 IntSize size; |
| 1037 int adjustmentWidth = verticalScrollbarWidth(); | 1037 int adjustmentWidth = verticalScrollbarWidth(); |
| 1038 if (hasFlippedBlocksWritingMode() | 1038 if (hasFlippedBlocksWritingMode() |
| 1039 || (isHorizontalWritingMode() && shouldPlaceBlockDirectionScrollbarOnLog
icalLeft())) { | 1039 || (isHorizontalWritingMode() && shouldPlaceBlockDirectionScrollbarOnLog
icalLeft())) { |
| 1040 size.expand(adjustmentWidth, 0); | 1040 size.expand(adjustmentWidth, 0); |
| 1041 } | 1041 } |
| (...skipping 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2695 computedValues.m_extent = heightResult; | 2695 computedValues.m_extent = heightResult; |
| 2696 computeMarginsForDirection(flowDirection, cb, containingBlockLogicalWidt
hForContent(), computedValues.m_extent, computedValues.m_margins.m_before, | 2696 computeMarginsForDirection(flowDirection, cb, containingBlockLogicalWidt
hForContent(), computedValues.m_extent, computedValues.m_margins.m_before, |
| 2697 computedValues.m_margins.m_after, style()->marginBefore(), style()->
marginAfter()); | 2697 computedValues.m_margins.m_after, style()->marginBefore(), style()->
marginAfter()); |
| 2698 } | 2698 } |
| 2699 | 2699 |
| 2700 // WinIE quirk: The <html> block always fills the entire canvas in quirks mo
de. The <body> always fills the | 2700 // WinIE quirk: The <html> block always fills the entire canvas in quirks mo
de. The <body> always fills the |
| 2701 // <html> block in quirks mode. Only apply this quirk if the block is norma
l flow and no height | 2701 // <html> block in quirks mode. Only apply this quirk if the block is norma
l flow and no height |
| 2702 // is specified. When we're printing, we also need this quirk if the body or
root has a percentage | 2702 // is specified. When we're printing, we also need this quirk if the body or
root has a percentage |
| 2703 // height since we don't set a height in LayoutView when we're printing. So
without this quirk, the | 2703 // height since we don't set a height in LayoutView when we're printing. So
without this quirk, the |
| 2704 // height has nothing to be a percentage of, and it ends up being 0. That is
bad. | 2704 // height has nothing to be a percentage of, and it ends up being 0. That is
bad. |
| 2705 bool paginatedContentNeedsBaseHeight = document().printing() && h.hasPercent
() | 2705 bool paginatedContentNeedsBaseHeight = document().printing() && h.isPercentO
rCalc() |
| 2706 && (isDocumentElement() || (isBody() && document().documentElement()->la
youtObject()->style()->logicalHeight().hasPercent())) && !isInline(); | 2706 && (isDocumentElement() || (isBody() && document().documentElement()->la
youtObject()->style()->logicalHeight().isPercentOrCalc())) && !isInline(); |
| 2707 if (stretchesToViewport() || paginatedContentNeedsBaseHeight) { | 2707 if (stretchesToViewport() || paginatedContentNeedsBaseHeight) { |
| 2708 LayoutUnit margins = collapsedMarginBefore() + collapsedMarginAfter(); | 2708 LayoutUnit margins = collapsedMarginBefore() + collapsedMarginAfter(); |
| 2709 LayoutUnit visibleHeight = view()->viewLogicalHeightForPercentages(); | 2709 LayoutUnit visibleHeight = view()->viewLogicalHeightForPercentages(); |
| 2710 if (isDocumentElement()) { | 2710 if (isDocumentElement()) { |
| 2711 computedValues.m_extent = std::max(computedValues.m_extent, visibleH
eight - margins); | 2711 computedValues.m_extent = std::max(computedValues.m_extent, visibleH
eight - margins); |
| 2712 } else { | 2712 } else { |
| 2713 LayoutUnit marginsBordersPadding = margins + parentBox()->marginBefo
re() + parentBox()->marginAfter() + parentBox()->borderAndPaddingLogicalHeight()
; | 2713 LayoutUnit marginsBordersPadding = margins + parentBox()->marginBefo
re() + parentBox()->marginAfter() + parentBox()->borderAndPaddingLogicalHeight()
; |
| 2714 computedValues.m_extent = std::max(computedValues.m_extent, visibleH
eight - marginsBordersPadding); | 2714 computedValues.m_extent = std::max(computedValues.m_extent, visibleH
eight - marginsBordersPadding); |
| 2715 } | 2715 } |
| 2716 } | 2716 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2771 return heightType == MinSize ? LayoutUnit() : LayoutUnit(-1); | 2771 return heightType == MinSize ? LayoutUnit() : LayoutUnit(-1); |
| 2772 // FIXME(cbiesinger): The css-sizing spec is considering changing what min-c
ontent/max-content should resolve to. | 2772 // FIXME(cbiesinger): The css-sizing spec is considering changing what min-c
ontent/max-content should resolve to. |
| 2773 // If that happens, this code will have to change. | 2773 // If that happens, this code will have to change. |
| 2774 if (height.isIntrinsic()) { | 2774 if (height.isIntrinsic()) { |
| 2775 if (intrinsicContentHeight == -1) | 2775 if (intrinsicContentHeight == -1) |
| 2776 return LayoutUnit(-1); // Intrinsic height isn't available. | 2776 return LayoutUnit(-1); // Intrinsic height isn't available. |
| 2777 return computeIntrinsicLogicalContentHeightUsing(height, intrinsicConten
tHeight, borderAndPaddingLogicalHeight()) + scrollbarLogicalHeight(); | 2777 return computeIntrinsicLogicalContentHeightUsing(height, intrinsicConten
tHeight, borderAndPaddingLogicalHeight()) + scrollbarLogicalHeight(); |
| 2778 } | 2778 } |
| 2779 if (height.isFixed()) | 2779 if (height.isFixed()) |
| 2780 return LayoutUnit(height.value()); | 2780 return LayoutUnit(height.value()); |
| 2781 if (height.hasPercent()) | 2781 if (height.isPercentOrCalc()) |
| 2782 return computePercentageLogicalHeight(height); | 2782 return computePercentageLogicalHeight(height); |
| 2783 return LayoutUnit(-1); | 2783 return LayoutUnit(-1); |
| 2784 } | 2784 } |
| 2785 | 2785 |
| 2786 bool LayoutBox::stretchesToViewportInQuirksMode() const | 2786 bool LayoutBox::stretchesToViewportInQuirksMode() const |
| 2787 { | 2787 { |
| 2788 if (!isDocumentElement() && !isBody()) | 2788 if (!isDocumentElement() && !isBody()) |
| 2789 return false; | 2789 return false; |
| 2790 return style()->logicalHeight().isAuto() && !isFloatingOrOutOfFlowPositioned
() && !isInline() && !flowThreadContainingBlock(); | 2790 return style()->logicalHeight().isAuto() && !isFloatingOrOutOfFlowPositioned
() && !isInline() && !flowThreadContainingBlock(); |
| 2791 } | 2791 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2878 return result; | 2878 return result; |
| 2879 } | 2879 } |
| 2880 | 2880 |
| 2881 LayoutUnit LayoutBox::computeReplacedLogicalWidth(ShouldComputePreferred shouldC
omputePreferred) const | 2881 LayoutUnit LayoutBox::computeReplacedLogicalWidth(ShouldComputePreferred shouldC
omputePreferred) const |
| 2882 { | 2882 { |
| 2883 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogic
alWidthUsing(MainOrPreferredSize, style()->logicalWidth()), shouldComputePreferr
ed); | 2883 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogic
alWidthUsing(MainOrPreferredSize, style()->logicalWidth()), shouldComputePreferr
ed); |
| 2884 } | 2884 } |
| 2885 | 2885 |
| 2886 LayoutUnit LayoutBox::computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUni
t logicalWidth, ShouldComputePreferred shouldComputePreferred) const | 2886 LayoutUnit LayoutBox::computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUni
t logicalWidth, ShouldComputePreferred shouldComputePreferred) const |
| 2887 { | 2887 { |
| 2888 LayoutUnit minLogicalWidth = (shouldComputePreferred == ComputePreferred &&
style()->logicalMinWidth().hasPercent()) ? logicalWidth : computeReplacedLogical
WidthUsing(MinSize, style()->logicalMinWidth()); | 2888 LayoutUnit minLogicalWidth = (shouldComputePreferred == ComputePreferred &&
style()->logicalMinWidth().isPercentOrCalc()) ? logicalWidth : computeReplacedLo
gicalWidthUsing(MinSize, style()->logicalMinWidth()); |
| 2889 LayoutUnit maxLogicalWidth = (shouldComputePreferred == ComputePreferred &&
style()->logicalMaxWidth().hasPercent()) || style()->logicalMaxWidth().isMaxSize
None() ? logicalWidth : computeReplacedLogicalWidthUsing(MaxSize, style()->logic
alMaxWidth()); | 2889 LayoutUnit maxLogicalWidth = (shouldComputePreferred == ComputePreferred &&
style()->logicalMaxWidth().isPercentOrCalc()) || style()->logicalMaxWidth().isMa
xSizeNone() ? logicalWidth : computeReplacedLogicalWidthUsing(MaxSize, style()->
logicalMaxWidth()); |
| 2890 return std::max(minLogicalWidth, std::min(logicalWidth, maxLogicalWidth)); | 2890 return std::max(minLogicalWidth, std::min(logicalWidth, maxLogicalWidth)); |
| 2891 } | 2891 } |
| 2892 | 2892 |
| 2893 LayoutUnit LayoutBox::computeReplacedLogicalWidthUsing(SizeType sizeType, const
Length& logicalWidth) const | 2893 LayoutUnit LayoutBox::computeReplacedLogicalWidthUsing(SizeType sizeType, const
Length& logicalWidth) const |
| 2894 { | 2894 { |
| 2895 ASSERT(sizeType == MinSize || sizeType == MainOrPreferredSize || !logicalWid
th.isAuto()); | 2895 ASSERT(sizeType == MinSize || sizeType == MainOrPreferredSize || !logicalWid
th.isAuto()); |
| 2896 if (sizeType == MinSize && logicalWidth.isAuto()) | 2896 if (sizeType == MinSize && logicalWidth.isAuto()) |
| 2897 return adjustContentBoxLogicalWidthForBoxSizing(LayoutUnit()); | 2897 return adjustContentBoxLogicalWidthForBoxSizing(LayoutUnit()); |
| 2898 | 2898 |
| 2899 switch (logicalWidth.type()) { | 2899 switch (logicalWidth.type()) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2911 case Calculated: { | 2911 case Calculated: { |
| 2912 // FIXME: containingBlockLogicalWidthForContent() is wrong if the replac
ed element's writing-mode is perpendicular to the | 2912 // FIXME: containingBlockLogicalWidthForContent() is wrong if the replac
ed element's writing-mode is perpendicular to the |
| 2913 // containing block's writing-mode. | 2913 // containing block's writing-mode. |
| 2914 // https://bugs.webkit.org/show_bug.cgi?id=46496 | 2914 // https://bugs.webkit.org/show_bug.cgi?id=46496 |
| 2915 const LayoutUnit cw = isOutOfFlowPositioned() ? containingBlockLogicalWi
dthForPositioned(toLayoutBoxModelObject(container())) : containingBlockLogicalWi
dthForContent(); | 2915 const LayoutUnit cw = isOutOfFlowPositioned() ? containingBlockLogicalWi
dthForPositioned(toLayoutBoxModelObject(container())) : containingBlockLogicalWi
dthForContent(); |
| 2916 Length containerLogicalWidth = containingBlock()->style()->logicalWidth(
); | 2916 Length containerLogicalWidth = containingBlock()->style()->logicalWidth(
); |
| 2917 // FIXME: Handle cases when containing block width is calculated or view
port percent. | 2917 // FIXME: Handle cases when containing block width is calculated or view
port percent. |
| 2918 // https://bugs.webkit.org/show_bug.cgi?id=91071 | 2918 // https://bugs.webkit.org/show_bug.cgi?id=91071 |
| 2919 if (logicalWidth.isIntrinsic()) | 2919 if (logicalWidth.isIntrinsic()) |
| 2920 return computeIntrinsicLogicalWidthUsing(logicalWidth, cw, borderAnd
PaddingLogicalWidth()) - borderAndPaddingLogicalWidth(); | 2920 return computeIntrinsicLogicalWidthUsing(logicalWidth, cw, borderAnd
PaddingLogicalWidth()) - borderAndPaddingLogicalWidth(); |
| 2921 if (cw > 0 || (!cw && (containerLogicalWidth.isFixed() || containerLogic
alWidth.hasPercent()))) | 2921 if (cw > 0 || (!cw && (containerLogicalWidth.isFixed() || containerLogic
alWidth.isPercentOrCalc()))) |
| 2922 return adjustContentBoxLogicalWidthForBoxSizing(minimumValueForLengt
h(logicalWidth, cw)); | 2922 return adjustContentBoxLogicalWidthForBoxSizing(minimumValueForLengt
h(logicalWidth, cw)); |
| 2923 return LayoutUnit(); | 2923 return LayoutUnit(); |
| 2924 } | 2924 } |
| 2925 case Auto: | 2925 case Auto: |
| 2926 case MaxSizeNone: | 2926 case MaxSizeNone: |
| 2927 return intrinsicLogicalWidth(); | 2927 return intrinsicLogicalWidth(); |
| 2928 case ExtendToZoom: | 2928 case ExtendToZoom: |
| 2929 case DeviceWidth: | 2929 case DeviceWidth: |
| 2930 case DeviceHeight: | 2930 case DeviceHeight: |
| 2931 break; | 2931 break; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3014 availableHeight = stretchedHeight; | 3014 availableHeight = stretchedHeight; |
| 3015 } else if (hasOverrideContainingBlockLogicalHeight()) { | 3015 } else if (hasOverrideContainingBlockLogicalHeight()) { |
| 3016 availableHeight = overrideContainingBlockContentLogicalHeight(); | 3016 availableHeight = overrideContainingBlockContentLogicalHeight(); |
| 3017 } else { | 3017 } else { |
| 3018 availableHeight = containingBlockLogicalHeightForContent(IncludeMarg
inBorderPadding); | 3018 availableHeight = containingBlockLogicalHeightForContent(IncludeMarg
inBorderPadding); |
| 3019 // It is necessary to use the border-box to match WinIE's broken | 3019 // It is necessary to use the border-box to match WinIE's broken |
| 3020 // box model. This is essential for sizing inside | 3020 // box model. This is essential for sizing inside |
| 3021 // table cells using percentage heights. | 3021 // table cells using percentage heights. |
| 3022 // FIXME: This needs to be made writing-mode-aware. If the cell and
image are perpendicular writing-modes, this isn't right. | 3022 // FIXME: This needs to be made writing-mode-aware. If the cell and
image are perpendicular writing-modes, this isn't right. |
| 3023 // https://bugs.webkit.org/show_bug.cgi?id=46997 | 3023 // https://bugs.webkit.org/show_bug.cgi?id=46997 |
| 3024 while (cb && !cb->isLayoutView() && (cb->style()->logicalHeight().is
Auto() || cb->style()->logicalHeight().hasPercent())) { | 3024 while (cb && !cb->isLayoutView() && (cb->style()->logicalHeight().is
Auto() || cb->style()->logicalHeight().isPercentOrCalc())) { |
| 3025 if (cb->isTableCell()) { | 3025 if (cb->isTableCell()) { |
| 3026 // Don't let table cells squeeze percent-height replaced ele
ments | 3026 // Don't let table cells squeeze percent-height replaced ele
ments |
| 3027 // <http://bugs.webkit.org/show_bug.cgi?id=15359> | 3027 // <http://bugs.webkit.org/show_bug.cgi?id=15359> |
| 3028 availableHeight = std::max(availableHeight, intrinsicLogical
Height()); | 3028 availableHeight = std::max(availableHeight, intrinsicLogical
Height()); |
| 3029 return valueForLength(logicalHeight, availableHeight - borde
rAndPaddingLogicalHeight()); | 3029 return valueForLength(logicalHeight, availableHeight - borde
rAndPaddingLogicalHeight()); |
| 3030 } | 3030 } |
| 3031 toLayoutBlock(cb)->addPercentHeightDescendant(const_cast<LayoutB
ox*>(this)); | 3031 toLayoutBlock(cb)->addPercentHeightDescendant(const_cast<LayoutB
ox*>(this)); |
| 3032 cb = cb->containingBlock(); | 3032 cb = cb->containingBlock(); |
| 3033 } | 3033 } |
| 3034 } | 3034 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 3055 { | 3055 { |
| 3056 if (isLayoutView()) { | 3056 if (isLayoutView()) { |
| 3057 return LayoutUnit(isHorizontalWritingMode() | 3057 return LayoutUnit(isHorizontalWritingMode() |
| 3058 ? toLayoutView(this)->frameView()->visibleContentSize().height() | 3058 ? toLayoutView(this)->frameView()->visibleContentSize().height() |
| 3059 : toLayoutView(this)->frameView()->visibleContentSize().width()); | 3059 : toLayoutView(this)->frameView()->visibleContentSize().width()); |
| 3060 } | 3060 } |
| 3061 | 3061 |
| 3062 // We need to stop here, since we don't want to increase the height of the t
able | 3062 // We need to stop here, since we don't want to increase the height of the t
able |
| 3063 // artificially. We're going to rely on this cell getting expanded to some
new | 3063 // artificially. We're going to rely on this cell getting expanded to some
new |
| 3064 // height, and then when we lay out again we'll use the calculation below. | 3064 // height, and then when we lay out again we'll use the calculation below. |
| 3065 if (isTableCell() && (h.isAuto() || h.hasPercent())) { | 3065 if (isTableCell() && (h.isAuto() || h.isPercentOrCalc())) { |
| 3066 if (hasOverrideLogicalContentHeight()) | 3066 if (hasOverrideLogicalContentHeight()) |
| 3067 return overrideLogicalContentHeight(); | 3067 return overrideLogicalContentHeight(); |
| 3068 return logicalHeight() - borderAndPaddingLogicalHeight(); | 3068 return logicalHeight() - borderAndPaddingLogicalHeight(); |
| 3069 } | 3069 } |
| 3070 | 3070 |
| 3071 if (h.hasPercent() && isOutOfFlowPositioned()) { | 3071 if (h.isPercentOrCalc() && isOutOfFlowPositioned()) { |
| 3072 // FIXME: This is wrong if the containingBlock has a perpendicular writi
ng mode. | 3072 // FIXME: This is wrong if the containingBlock has a perpendicular writi
ng mode. |
| 3073 LayoutUnit availableHeight = containingBlockLogicalHeightForPositioned(c
ontainingBlock()); | 3073 LayoutUnit availableHeight = containingBlockLogicalHeightForPositioned(c
ontainingBlock()); |
| 3074 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(h, avail
ableHeight)); | 3074 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(h, avail
ableHeight)); |
| 3075 } | 3075 } |
| 3076 | 3076 |
| 3077 // FIXME: Should we pass intrinsicContentLogicalHeight() instead of -1 here? | 3077 // FIXME: Should we pass intrinsicContentLogicalHeight() instead of -1 here? |
| 3078 LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeigh
tUsing(MainOrPreferredSize, h, LayoutUnit(-1)); | 3078 LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeigh
tUsing(MainOrPreferredSize, h, LayoutUnit(-1)); |
| 3079 if (heightIncludingScrollbar != -1) | 3079 if (heightIncludingScrollbar != -1) |
| 3080 return std::max(LayoutUnit(), adjustContentBoxLogicalHeightForBoxSizing(
heightIncludingScrollbar) - scrollbarLogicalHeight()); | 3080 return std::max(LayoutUnit(), adjustContentBoxLogicalHeightForBoxSizing(
heightIncludingScrollbar) - scrollbarLogicalHeight()); |
| 3081 | 3081 |
| (...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4240 // non-visible overflow to be paginated as normally. | 4240 // non-visible overflow to be paginated as normally. |
| 4241 if (document().printing()) | 4241 if (document().printing()) |
| 4242 return false; | 4242 return false; |
| 4243 | 4243 |
| 4244 // We do have overflow. We'll still be willing to paginate as long as the bl
ock | 4244 // We do have overflow. We'll still be willing to paginate as long as the bl
ock |
| 4245 // has auto logical height, auto or undefined max-logical-height and a zero
or auto min-logical-height. | 4245 // has auto logical height, auto or undefined max-logical-height and a zero
or auto min-logical-height. |
| 4246 // Note this is just a heuristic, and it's still possible to have overflow u
nder these | 4246 // Note this is just a heuristic, and it's still possible to have overflow u
nder these |
| 4247 // conditions, but it should work out to be good enough for common cases. Pa
ginating overflow | 4247 // conditions, but it should work out to be good enough for common cases. Pa
ginating overflow |
| 4248 // with scrollbars present is not the end of the world and is what we used t
o do in the old model anyway. | 4248 // with scrollbars present is not the end of the world and is what we used t
o do in the old model anyway. |
| 4249 return !style()->logicalHeight().isIntrinsicOrAuto() | 4249 return !style()->logicalHeight().isIntrinsicOrAuto() |
| 4250 || (!style()->logicalMaxHeight().isIntrinsicOrAuto() && !style()->logica
lMaxHeight().isMaxSizeNone() && (!style()->logicalMaxHeight().hasPercent() || pe
rcentageLogicalHeightIsResolvable())) | 4250 || (!style()->logicalMaxHeight().isIntrinsicOrAuto() && !style()->logica
lMaxHeight().isMaxSizeNone() && (!style()->logicalMaxHeight().isPercentOrCalc()
|| percentageLogicalHeightIsResolvable())) |
| 4251 || (!style()->logicalMinHeight().isIntrinsicOrAuto() && style()->logical
MinHeight().isPositive() && (!style()->logicalMinHeight().hasPercent() || percen
tageLogicalHeightIsResolvable())); | 4251 || (!style()->logicalMinHeight().isIntrinsicOrAuto() && style()->logical
MinHeight().isPositive() && (!style()->logicalMinHeight().isPercentOrCalc() || p
ercentageLogicalHeightIsResolvable())); |
| 4252 } | 4252 } |
| 4253 | 4253 |
| 4254 LayoutBox::PaginationBreakability LayoutBox::getPaginationBreakability() const | 4254 LayoutBox::PaginationBreakability LayoutBox::getPaginationBreakability() const |
| 4255 { | 4255 { |
| 4256 // TODO(mstensho): It is wrong to check isAtomicInlineLevel() as we | 4256 // TODO(mstensho): It is wrong to check isAtomicInlineLevel() as we |
| 4257 // actually look for replaced elements. | 4257 // actually look for replaced elements. |
| 4258 if (isAtomicInlineLevel() | 4258 if (isAtomicInlineLevel() |
| 4259 || hasUnsplittableScrollingOverflow() | 4259 || hasUnsplittableScrollingOverflow() |
| 4260 || (parent() && isWritingModeRoot()) | 4260 || (parent() && isWritingModeRoot()) |
| 4261 || (isOutOfFlowPositioned() && style()->position() == FixedPosition)) | 4261 || (isOutOfFlowPositioned() && style()->position() == FixedPosition)) |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4443 LayoutPoint LayoutBox::topLeftLocation(const LayoutBox* flippedBlocksContainer)
const | 4443 LayoutPoint LayoutBox::topLeftLocation(const LayoutBox* flippedBlocksContainer)
const |
| 4444 { | 4444 { |
| 4445 const LayoutBox* containerBox = flippedBlocksContainer ? flippedBlocksContai
ner : containingBlock(); | 4445 const LayoutBox* containerBox = flippedBlocksContainer ? flippedBlocksContai
ner : containingBlock(); |
| 4446 if (!containerBox || containerBox == this) | 4446 if (!containerBox || containerBox == this) |
| 4447 return location(); | 4447 return location(); |
| 4448 return containerBox->flipForWritingModeForChild(this, location()); | 4448 return containerBox->flipForWritingModeForChild(this, location()); |
| 4449 } | 4449 } |
| 4450 | 4450 |
| 4451 bool LayoutBox::hasRelativeLogicalWidth() const | 4451 bool LayoutBox::hasRelativeLogicalWidth() const |
| 4452 { | 4452 { |
| 4453 return style()->logicalWidth().hasPercent() | 4453 return style()->logicalWidth().isPercentOrCalc() |
| 4454 || style()->logicalMinWidth().hasPercent() | 4454 || style()->logicalMinWidth().isPercentOrCalc() |
| 4455 || style()->logicalMaxWidth().hasPercent(); | 4455 || style()->logicalMaxWidth().isPercentOrCalc(); |
| 4456 } | 4456 } |
| 4457 | 4457 |
| 4458 bool LayoutBox::hasRelativeLogicalHeight() const | 4458 bool LayoutBox::hasRelativeLogicalHeight() const |
| 4459 { | 4459 { |
| 4460 return style()->logicalHeight().hasPercent() | 4460 return style()->logicalHeight().isPercentOrCalc() |
| 4461 || style()->logicalMinHeight().hasPercent() | 4461 || style()->logicalMinHeight().isPercentOrCalc() |
| 4462 || style()->logicalMaxHeight().hasPercent(); | 4462 || style()->logicalMaxHeight().isPercentOrCalc(); |
| 4463 } | 4463 } |
| 4464 | 4464 |
| 4465 static void markBoxForRelayoutAfterSplit(LayoutBox* box) | 4465 static void markBoxForRelayoutAfterSplit(LayoutBox* box) |
| 4466 { | 4466 { |
| 4467 // FIXME: The table code should handle that automatically. If not, | 4467 // FIXME: The table code should handle that automatically. If not, |
| 4468 // we should fix it and remove the table part checks. | 4468 // we should fix it and remove the table part checks. |
| 4469 if (box->isTable()) { | 4469 if (box->isTable()) { |
| 4470 // Because we may have added some sections with already computed column
structures, we need to | 4470 // Because we may have added some sections with already computed column
structures, we need to |
| 4471 // sync the table structure with them now. This avoids crashes when addi
ng new cells to the table. | 4471 // sync the table structure with them now. This avoids crashes when addi
ng new cells to the table. |
| 4472 toLayoutTable(box)->forceSectionsRecalc(); | 4472 toLayoutTable(box)->forceSectionsRecalc(); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4596 | 4596 |
| 4597 // Make sure we have a valid image. | 4597 // Make sure we have a valid image. |
| 4598 StyleImage* img = layer.image(); | 4598 StyleImage* img = layer.image(); |
| 4599 if (!img || !img->canRender()) | 4599 if (!img || !img->canRender()) |
| 4600 return false; | 4600 return false; |
| 4601 | 4601 |
| 4602 if (layer.repeatY() != RepeatFill && layer.repeatY() != NoRepeatFill) | 4602 if (layer.repeatY() != RepeatFill && layer.repeatY() != NoRepeatFill) |
| 4603 return true; | 4603 return true; |
| 4604 | 4604 |
| 4605 // TODO(alancutter): Make this work correctly for calc lengths. | 4605 // TODO(alancutter): Make this work correctly for calc lengths. |
| 4606 if (layer.yPosition().hasPercent() && !layer.yPosition().isZero()) | 4606 if (layer.yPosition().isPercentOrCalc() && !layer.yPosition().isZero()) |
| 4607 return true; | 4607 return true; |
| 4608 | 4608 |
| 4609 if (layer.backgroundYOrigin() != TopEdge) | 4609 if (layer.backgroundYOrigin() != TopEdge) |
| 4610 return true; | 4610 return true; |
| 4611 | 4611 |
| 4612 EFillSizeType sizeType = layer.sizeType(); | 4612 EFillSizeType sizeType = layer.sizeType(); |
| 4613 | 4613 |
| 4614 if (sizeType == Contain || sizeType == Cover) | 4614 if (sizeType == Contain || sizeType == Cover) |
| 4615 return true; | 4615 return true; |
| 4616 | 4616 |
| 4617 if (sizeType == SizeLength) { | 4617 if (sizeType == SizeLength) { |
| 4618 // TODO(alancutter): Make this work correctly for calc lengths. | 4618 // TODO(alancutter): Make this work correctly for calc lengths. |
| 4619 if (layer.sizeLength().height().hasPercent() && !layer.sizeLength().heig
ht().isZero()) | 4619 if (layer.sizeLength().height().isPercentOrCalc() && !layer.sizeLength()
.height().isZero()) |
| 4620 return true; | 4620 return true; |
| 4621 if (img->isGeneratedImage() && layer.sizeLength().height().isAuto()) | 4621 if (img->isGeneratedImage() && layer.sizeLength().height().isAuto()) |
| 4622 return true; | 4622 return true; |
| 4623 } else if (img->usesImageContainerSize()) { | 4623 } else if (img->usesImageContainerSize()) { |
| 4624 return true; | 4624 return true; |
| 4625 } | 4625 } |
| 4626 | 4626 |
| 4627 return false; | 4627 return false; |
| 4628 } | 4628 } |
| 4629 | 4629 |
| 4630 bool LayoutBox::mustInvalidateFillLayersPaintOnWidthChange(const FillLayer& laye
r) | 4630 bool LayoutBox::mustInvalidateFillLayersPaintOnWidthChange(const FillLayer& laye
r) |
| 4631 { | 4631 { |
| 4632 // Nobody will use multiple layers without wanting fancy positioning. | 4632 // Nobody will use multiple layers without wanting fancy positioning. |
| 4633 if (layer.next()) | 4633 if (layer.next()) |
| 4634 return true; | 4634 return true; |
| 4635 | 4635 |
| 4636 // Make sure we have a valid image. | 4636 // Make sure we have a valid image. |
| 4637 StyleImage* img = layer.image(); | 4637 StyleImage* img = layer.image(); |
| 4638 if (!img || !img->canRender()) | 4638 if (!img || !img->canRender()) |
| 4639 return false; | 4639 return false; |
| 4640 | 4640 |
| 4641 if (layer.repeatX() != RepeatFill && layer.repeatX() != NoRepeatFill) | 4641 if (layer.repeatX() != RepeatFill && layer.repeatX() != NoRepeatFill) |
| 4642 return true; | 4642 return true; |
| 4643 | 4643 |
| 4644 // TODO(alancutter): Make this work correctly for calc lengths. | 4644 // TODO(alancutter): Make this work correctly for calc lengths. |
| 4645 if (layer.xPosition().hasPercent() && !layer.xPosition().isZero()) | 4645 if (layer.xPosition().isPercentOrCalc() && !layer.xPosition().isZero()) |
| 4646 return true; | 4646 return true; |
| 4647 | 4647 |
| 4648 if (layer.backgroundXOrigin() != LeftEdge) | 4648 if (layer.backgroundXOrigin() != LeftEdge) |
| 4649 return true; | 4649 return true; |
| 4650 | 4650 |
| 4651 EFillSizeType sizeType = layer.sizeType(); | 4651 EFillSizeType sizeType = layer.sizeType(); |
| 4652 | 4652 |
| 4653 if (sizeType == Contain || sizeType == Cover) | 4653 if (sizeType == Contain || sizeType == Cover) |
| 4654 return true; | 4654 return true; |
| 4655 | 4655 |
| 4656 if (sizeType == SizeLength) { | 4656 if (sizeType == SizeLength) { |
| 4657 // TODO(alancutter): Make this work correctly for calc lengths. | 4657 // TODO(alancutter): Make this work correctly for calc lengths. |
| 4658 if (layer.sizeLength().width().hasPercent() && !layer.sizeLength().width
().isZero()) | 4658 if (layer.sizeLength().width().isPercentOrCalc() && !layer.sizeLength().
width().isZero()) |
| 4659 return true; | 4659 return true; |
| 4660 if (img->isGeneratedImage() && layer.sizeLength().width().isAuto()) | 4660 if (img->isGeneratedImage() && layer.sizeLength().width().isAuto()) |
| 4661 return true; | 4661 return true; |
| 4662 } else if (img->usesImageContainerSize()) { | 4662 } else if (img->usesImageContainerSize()) { |
| 4663 return true; | 4663 return true; |
| 4664 } | 4664 } |
| 4665 | 4665 |
| 4666 return false; | 4666 return false; |
| 4667 } | 4667 } |
| 4668 | 4668 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4843 m_rareData->m_snapAreas->remove(&snapArea); | 4843 m_rareData->m_snapAreas->remove(&snapArea); |
| 4844 } | 4844 } |
| 4845 } | 4845 } |
| 4846 | 4846 |
| 4847 SnapAreaSet* LayoutBox::snapAreas() const | 4847 SnapAreaSet* LayoutBox::snapAreas() const |
| 4848 { | 4848 { |
| 4849 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; | 4849 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; |
| 4850 } | 4850 } |
| 4851 | 4851 |
| 4852 } // namespace blink | 4852 } // namespace blink |
| OLD | NEW |