| Index: third_party/WebKit/Source/core/layout/LayoutBox.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
|
| index 62c38203fe8a1a0d5ceba1f1118acb965e115bc6..8367cfd7b8c16d09454b19ec8af774c661ca0810 100644
|
| --- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
|
| @@ -1028,7 +1028,7 @@ void LayoutBox::scrollByRecursively(const DoubleSize& delta, ScrollOffsetClampin
|
|
|
| bool LayoutBox::needsPreferredWidthsRecalculation() const
|
| {
|
| - return style()->paddingStart().hasPercent() || style()->paddingEnd().hasPercent();
|
| + return style()->paddingStart().isPercentOrCalc() || style()->paddingEnd().isPercentOrCalc();
|
| }
|
|
|
| IntSize LayoutBox::originAdjustmentForScrollbars() const
|
| @@ -2702,8 +2702,8 @@ void LayoutBox::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logica
|
| // is specified. When we're printing, we also need this quirk if the body or root has a percentage
|
| // height since we don't set a height in LayoutView when we're printing. So without this quirk, the
|
| // height has nothing to be a percentage of, and it ends up being 0. That is bad.
|
| - bool paginatedContentNeedsBaseHeight = document().printing() && h.hasPercent()
|
| - && (isDocumentElement() || (isBody() && document().documentElement()->layoutObject()->style()->logicalHeight().hasPercent())) && !isInline();
|
| + bool paginatedContentNeedsBaseHeight = document().printing() && h.isPercentOrCalc()
|
| + && (isDocumentElement() || (isBody() && document().documentElement()->layoutObject()->style()->logicalHeight().isPercentOrCalc())) && !isInline();
|
| if (stretchesToViewport() || paginatedContentNeedsBaseHeight) {
|
| LayoutUnit margins = collapsedMarginBefore() + collapsedMarginAfter();
|
| LayoutUnit visibleHeight = view()->viewLogicalHeightForPercentages();
|
| @@ -2778,7 +2778,7 @@ LayoutUnit LayoutBox::computeContentAndScrollbarLogicalHeightUsing(SizeType heig
|
| }
|
| if (height.isFixed())
|
| return LayoutUnit(height.value());
|
| - if (height.hasPercent())
|
| + if (height.isPercentOrCalc())
|
| return computePercentageLogicalHeight(height);
|
| return LayoutUnit(-1);
|
| }
|
| @@ -2885,8 +2885,8 @@ LayoutUnit LayoutBox::computeReplacedLogicalWidth(ShouldComputePreferred shouldC
|
|
|
| LayoutUnit LayoutBox::computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, ShouldComputePreferred shouldComputePreferred) const
|
| {
|
| - LayoutUnit minLogicalWidth = (shouldComputePreferred == ComputePreferred && style()->logicalMinWidth().hasPercent()) ? logicalWidth : computeReplacedLogicalWidthUsing(MinSize, style()->logicalMinWidth());
|
| - LayoutUnit maxLogicalWidth = (shouldComputePreferred == ComputePreferred && style()->logicalMaxWidth().hasPercent()) || style()->logicalMaxWidth().isMaxSizeNone() ? logicalWidth : computeReplacedLogicalWidthUsing(MaxSize, style()->logicalMaxWidth());
|
| + LayoutUnit minLogicalWidth = (shouldComputePreferred == ComputePreferred && style()->logicalMinWidth().isPercentOrCalc()) ? logicalWidth : computeReplacedLogicalWidthUsing(MinSize, style()->logicalMinWidth());
|
| + LayoutUnit maxLogicalWidth = (shouldComputePreferred == ComputePreferred && style()->logicalMaxWidth().isPercentOrCalc()) || style()->logicalMaxWidth().isMaxSizeNone() ? logicalWidth : computeReplacedLogicalWidthUsing(MaxSize, style()->logicalMaxWidth());
|
| return std::max(minLogicalWidth, std::min(logicalWidth, maxLogicalWidth));
|
| }
|
|
|
| @@ -2918,7 +2918,7 @@ LayoutUnit LayoutBox::computeReplacedLogicalWidthUsing(SizeType sizeType, const
|
| // https://bugs.webkit.org/show_bug.cgi?id=91071
|
| if (logicalWidth.isIntrinsic())
|
| return computeIntrinsicLogicalWidthUsing(logicalWidth, cw, borderAndPaddingLogicalWidth()) - borderAndPaddingLogicalWidth();
|
| - if (cw > 0 || (!cw && (containerLogicalWidth.isFixed() || containerLogicalWidth.hasPercent())))
|
| + if (cw > 0 || (!cw && (containerLogicalWidth.isFixed() || containerLogicalWidth.isPercentOrCalc())))
|
| return adjustContentBoxLogicalWidthForBoxSizing(minimumValueForLength(logicalWidth, cw));
|
| return LayoutUnit();
|
| }
|
| @@ -3021,7 +3021,7 @@ LayoutUnit LayoutBox::computeReplacedLogicalHeightUsing(SizeType sizeType, const
|
| // table cells using percentage heights.
|
| // FIXME: This needs to be made writing-mode-aware. If the cell and image are perpendicular writing-modes, this isn't right.
|
| // https://bugs.webkit.org/show_bug.cgi?id=46997
|
| - while (cb && !cb->isLayoutView() && (cb->style()->logicalHeight().isAuto() || cb->style()->logicalHeight().hasPercent())) {
|
| + while (cb && !cb->isLayoutView() && (cb->style()->logicalHeight().isAuto() || cb->style()->logicalHeight().isPercentOrCalc())) {
|
| if (cb->isTableCell()) {
|
| // Don't let table cells squeeze percent-height replaced elements
|
| // <http://bugs.webkit.org/show_bug.cgi?id=15359>
|
| @@ -3062,13 +3062,13 @@ LayoutUnit LayoutBox::availableLogicalHeightUsing(const Length& h, AvailableLogi
|
| // We need to stop here, since we don't want to increase the height of the table
|
| // artificially. We're going to rely on this cell getting expanded to some new
|
| // height, and then when we lay out again we'll use the calculation below.
|
| - if (isTableCell() && (h.isAuto() || h.hasPercent())) {
|
| + if (isTableCell() && (h.isAuto() || h.isPercentOrCalc())) {
|
| if (hasOverrideLogicalContentHeight())
|
| return overrideLogicalContentHeight();
|
| return logicalHeight() - borderAndPaddingLogicalHeight();
|
| }
|
|
|
| - if (h.hasPercent() && isOutOfFlowPositioned()) {
|
| + if (h.isPercentOrCalc() && isOutOfFlowPositioned()) {
|
| // FIXME: This is wrong if the containingBlock has a perpendicular writing mode.
|
| LayoutUnit availableHeight = containingBlockLogicalHeightForPositioned(containingBlock());
|
| return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(h, availableHeight));
|
| @@ -4247,8 +4247,8 @@ bool LayoutBox::hasUnsplittableScrollingOverflow() const
|
| // conditions, but it should work out to be good enough for common cases. Paginating overflow
|
| // with scrollbars present is not the end of the world and is what we used to do in the old model anyway.
|
| return !style()->logicalHeight().isIntrinsicOrAuto()
|
| - || (!style()->logicalMaxHeight().isIntrinsicOrAuto() && !style()->logicalMaxHeight().isMaxSizeNone() && (!style()->logicalMaxHeight().hasPercent() || percentageLogicalHeightIsResolvable()))
|
| - || (!style()->logicalMinHeight().isIntrinsicOrAuto() && style()->logicalMinHeight().isPositive() && (!style()->logicalMinHeight().hasPercent() || percentageLogicalHeightIsResolvable()));
|
| + || (!style()->logicalMaxHeight().isIntrinsicOrAuto() && !style()->logicalMaxHeight().isMaxSizeNone() && (!style()->logicalMaxHeight().isPercentOrCalc() || percentageLogicalHeightIsResolvable()))
|
| + || (!style()->logicalMinHeight().isIntrinsicOrAuto() && style()->logicalMinHeight().isPositive() && (!style()->logicalMinHeight().isPercentOrCalc() || percentageLogicalHeightIsResolvable()));
|
| }
|
|
|
| LayoutBox::PaginationBreakability LayoutBox::getPaginationBreakability() const
|
| @@ -4450,16 +4450,16 @@ LayoutPoint LayoutBox::topLeftLocation(const LayoutBox* flippedBlocksContainer)
|
|
|
| bool LayoutBox::hasRelativeLogicalWidth() const
|
| {
|
| - return style()->logicalWidth().hasPercent()
|
| - || style()->logicalMinWidth().hasPercent()
|
| - || style()->logicalMaxWidth().hasPercent();
|
| + return style()->logicalWidth().isPercentOrCalc()
|
| + || style()->logicalMinWidth().isPercentOrCalc()
|
| + || style()->logicalMaxWidth().isPercentOrCalc();
|
| }
|
|
|
| bool LayoutBox::hasRelativeLogicalHeight() const
|
| {
|
| - return style()->logicalHeight().hasPercent()
|
| - || style()->logicalMinHeight().hasPercent()
|
| - || style()->logicalMaxHeight().hasPercent();
|
| + return style()->logicalHeight().isPercentOrCalc()
|
| + || style()->logicalMinHeight().isPercentOrCalc()
|
| + || style()->logicalMaxHeight().isPercentOrCalc();
|
| }
|
|
|
| static void markBoxForRelayoutAfterSplit(LayoutBox* box)
|
| @@ -4603,7 +4603,7 @@ bool LayoutBox::mustInvalidateFillLayersPaintOnHeightChange(const FillLayer& lay
|
| return true;
|
|
|
| // TODO(alancutter): Make this work correctly for calc lengths.
|
| - if (layer.yPosition().hasPercent() && !layer.yPosition().isZero())
|
| + if (layer.yPosition().isPercentOrCalc() && !layer.yPosition().isZero())
|
| return true;
|
|
|
| if (layer.backgroundYOrigin() != TopEdge)
|
| @@ -4616,7 +4616,7 @@ bool LayoutBox::mustInvalidateFillLayersPaintOnHeightChange(const FillLayer& lay
|
|
|
| if (sizeType == SizeLength) {
|
| // TODO(alancutter): Make this work correctly for calc lengths.
|
| - if (layer.sizeLength().height().hasPercent() && !layer.sizeLength().height().isZero())
|
| + if (layer.sizeLength().height().isPercentOrCalc() && !layer.sizeLength().height().isZero())
|
| return true;
|
| if (img->isGeneratedImage() && layer.sizeLength().height().isAuto())
|
| return true;
|
| @@ -4642,7 +4642,7 @@ bool LayoutBox::mustInvalidateFillLayersPaintOnWidthChange(const FillLayer& laye
|
| return true;
|
|
|
| // TODO(alancutter): Make this work correctly for calc lengths.
|
| - if (layer.xPosition().hasPercent() && !layer.xPosition().isZero())
|
| + if (layer.xPosition().isPercentOrCalc() && !layer.xPosition().isZero())
|
| return true;
|
|
|
| if (layer.backgroundXOrigin() != LeftEdge)
|
| @@ -4655,7 +4655,7 @@ bool LayoutBox::mustInvalidateFillLayersPaintOnWidthChange(const FillLayer& laye
|
|
|
| if (sizeType == SizeLength) {
|
| // TODO(alancutter): Make this work correctly for calc lengths.
|
| - if (layer.sizeLength().width().hasPercent() && !layer.sizeLength().width().isZero())
|
| + if (layer.sizeLength().width().isPercentOrCalc() && !layer.sizeLength().width().isZero())
|
| return true;
|
| if (img->isGeneratedImage() && layer.sizeLength().width().isAuto())
|
| return true;
|
|
|