⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 285885 in webkit


Ignore:
Timestamp:
Nov 16, 2021, 2:32:39 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

[css-contain] Support contain:paint
https://bugs.webkit.org/show_bug.cgi?id=224742

Patch by Rob Buis <rbuis@igalia.com> on 2021-11-16
Reviewed by Alan Bujtas.

LayoutTests/imported/w3c:

Adjust test expectation now that contain: strict is supported.

  • web-platform-tests/css/css-flexbox/flex-item-contains-strict-expected.txt:

Source/WebCore:

This patch implements paint containment as specified[1].

It adds shouldApplyPaintContainment to check whether the element applies for paint containment. Is so, then:

  • an independent formatting context is established.
  • an absolute positioning and fixed positioning containing block is established.
  • a stacking context is created.
  • implements clipping on the overflow clip edge.

This patch also adds effectiveOverflowX/effectiveOverflowY on RenderElement to take
the effect of paint containment on overflow-x/y into account.

[1] https://drafts.csswg.org/css-contain-2/#paint-containment

  • page/FrameView.cpp:

(WebCore::FrameView::applyOverflowToViewport):
(WebCore::FrameView::applyPaginationToViewport):
(WebCore::FrameView::calculateScrollbarModesForLayout):

  • rendering/GridTrackSizingAlgorithm.cpp:

(WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const):

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::updateFromStyle):
(WebCore::RenderBox::constrainLogicalWidthInFragmentByMinMax const):
(WebCore::RenderBox::constrainLogicalHeightByMinMax const):
(WebCore::RenderBox::createsNewFormattingContext const):
(WebCore::RenderBox::addOverflowFromChild):

  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::updateFromStyle):

  • rendering/RenderElement.cpp:

(WebCore::includeNonFixedHeight):
(WebCore::RenderElement::effectiveOverflowX const):
(WebCore::RenderElement::effectiveOverflowY const):

  • rendering/RenderElement.h:

(WebCore::RenderElement::effectiveOverflowInlineDirection const):
(WebCore::RenderElement::effectiveOverflowBlockDirection const):
(WebCore::RenderElement::canContainFixedPositionObjects const):
(WebCore::RenderElement::canContainAbsolutelyPositionedObjects const):

  • rendering/RenderFlexibleBox.cpp:

(WebCore::RenderFlexibleBox::mainAxisOverflowForChild const):
(WebCore::RenderFlexibleBox::crossAxisOverflowForChild const):

  • rendering/RenderFragmentContainer.cpp:

(WebCore::RenderFragmentContainer::overflowRectForFragmentedFlowPortion):

  • rendering/RenderInline.h:
  • rendering/RenderLayer.cpp:

(WebCore::canCreateStackingContext):
(WebCore::RenderLayer::shouldBeCSSStackingContext const):
(WebCore::RenderLayer::setAncestorChainHasSelfPaintingLayerDescendant):
(WebCore::RenderLayer::setAncestorChainHasVisibleDescendant):
(WebCore::RenderLayer::calculateClipRects const):

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::setPaintContainmentApplies):
(WebCore::RenderObject::RenderObjectRareData::RenderObjectRareData):
(WebCore::shouldApplyPaintContainment):

  • rendering/RenderObject.h:

(WebCore::RenderObject::paintContainmentApplies const):

  • rendering/style/RenderStyle.h:

(WebCore::RenderStyle::overflowY const):
(WebCore::RenderStyle::containsPaint const):
(WebCore::RenderStyle::overflowInlineDirection const): Deleted.
(WebCore::RenderStyle::overflowBlockDirection const): Deleted.

  • rendering/svg/RenderSVGRoot.cpp:

(WebCore::RenderSVGRoot::shouldApplyViewportClip const):

LayoutTests:

Unskip tests that pass now.

Location:
trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r285874 r285885  
     12021-11-16  Rob Buis  <rbuis@igalia.com>
     2
     3        [css-contain] Support contain:paint
     4        https://bugs.webkit.org/show_bug.cgi?id=224742
     5
     6        Reviewed by Alan Bujtas.
     7
     8        Unskip tests that pass now.
     9
     10        * TestExpectations:
     11
    1122021-11-16  Tyler Wilcock  <tyler_w@apple.com>
    213
  • trunk/LayoutTests/TestExpectations

    r285857 r285885  
    47344734# webkit-ruby-text
    47354735imported/w3c/web-platform-tests/css/css-contain/contain-layout-017.html [ ImageOnlyFailure ]
     4736imported/w3c/web-platform-tests/css/css-contain/contain-paint-005.html [ ImageOnlyFailure ]
     4737imported/w3c/web-platform-tests/css/css-contain/contain-paint-006.html [ ImageOnlyFailure ]
     4738imported/w3c/web-platform-tests/css/css-contain/contain-paint-008.html [ ImageOnlyFailure ]
     4739imported/w3c/web-platform-tests/css/css-contain/contain-paint-021.html [ ImageOnlyFailure ]
    47364740imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-001.html [ ImageOnlyFailure ]
    47374741imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-003.html [ ImageOnlyFailure ]
     
    47484752imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-021.html [ ImageOnlyFailure ]
    47494753imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-022.html [ ImageOnlyFailure ]
    4750 imported/w3c/web-platform-tests/css/css-contain/contain-paint-001.html [ ImageOnlyFailure ]
    4751 imported/w3c/web-platform-tests/css/css-contain/contain-paint-004.html [ ImageOnlyFailure ]
    4752 imported/w3c/web-platform-tests/css/css-contain/contain-paint-005.html [ ImageOnlyFailure ]
    4753 imported/w3c/web-platform-tests/css/css-contain/contain-paint-006.html [ ImageOnlyFailure ]
    4754 imported/w3c/web-platform-tests/css/css-contain/contain-paint-008.html [ ImageOnlyFailure ]
    4755 imported/w3c/web-platform-tests/css/css-contain/contain-paint-009.html [ ImageOnlyFailure ]
    4756 imported/w3c/web-platform-tests/css/css-contain/contain-paint-010.html [ ImageOnlyFailure ]
    4757 imported/w3c/web-platform-tests/css/css-contain/contain-paint-014.html [ ImageOnlyFailure ]
    4758 imported/w3c/web-platform-tests/css/css-contain/contain-paint-019.html [ ImageOnlyFailure ]
    4759 imported/w3c/web-platform-tests/css/css-contain/contain-paint-020.html [ ImageOnlyFailure ]
    4760 imported/w3c/web-platform-tests/css/css-contain/contain-paint-022.html [ ImageOnlyFailure ]
    4761 imported/w3c/web-platform-tests/css/css-contain/contain-paint-023.html [ ImageOnlyFailure ]
    4762 imported/w3c/web-platform-tests/css/css-contain/contain-paint-047.html [ ImageOnlyFailure ]
    4763 imported/w3c/web-platform-tests/css/css-contain/contain-paint-048.html [ ImageOnlyFailure ]
    4764 imported/w3c/web-platform-tests/css/css-contain/contain-paint-cell-001.html [ ImageOnlyFailure ]
    4765 imported/w3c/web-platform-tests/css/css-contain/contain-paint-cell-002.html [ ImageOnlyFailure ]
    4766 imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-001.html [ ImageOnlyFailure ]
    4767 imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-002.html [ ImageOnlyFailure ]
    4768 imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-006.html [ ImageOnlyFailure ]
    4769 imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-011.html [ ImageOnlyFailure ]
    4770 imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-012.html [ ImageOnlyFailure ]
    4771 imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-013.html [ ImageOnlyFailure ]
    4772 imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-014.html [ ImageOnlyFailure ]
    47734754imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-015.html [ ImageOnlyFailure ]
    47744755imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-016.html [ ImageOnlyFailure ]
    4775 imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-017.html [ ImageOnlyFailure ]
    4776 imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-018.html [ ImageOnlyFailure ]
    4777 imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-019.html [ ImageOnlyFailure ]
    4778 imported/w3c/web-platform-tests/css/css-contain/contain-paint-containing-block-absolute-001.html [ ImageOnlyFailure ]
    4779 imported/w3c/web-platform-tests/css/css-contain/contain-paint-containing-block-fixed-001.html [ ImageOnlyFailure ]
    4780 imported/w3c/web-platform-tests/css/css-contain/contain-paint-formatting-context-float-001.html [ ImageOnlyFailure ]
    4781 imported/w3c/web-platform-tests/css/css-contain/contain-paint-formatting-context-margin-001.html [ ImageOnlyFailure ]
    4782 imported/w3c/web-platform-tests/css/css-contain/contain-paint-ifc-011.html [ ImageOnlyFailure ]
    4783 imported/w3c/web-platform-tests/css/css-contain/contain-paint-independent-formatting-context-001.html [ ImageOnlyFailure ]
    4784 imported/w3c/web-platform-tests/css/css-contain/contain-paint-size-001.html [ ImageOnlyFailure ]
    4785 imported/w3c/web-platform-tests/css/css-contain/contain-paint-size-002.html [ ImageOnlyFailure ]
    4786 imported/w3c/web-platform-tests/css/css-contain/contain-paint-size-003.html [ ImageOnlyFailure ]
    4787 imported/w3c/web-platform-tests/css/css-contain/contain-paint-stacking-context-001a.html [ ImageOnlyFailure ]
    4788 imported/w3c/web-platform-tests/css/css-contain/contain-paint-table-001.html [ ImageOnlyFailure ]
    4789 imported/w3c/web-platform-tests/css/css-contain/contain-paint-table-002.html [ ImageOnlyFailure ]
    4790 imported/w3c/web-platform-tests/css/css-contain/contain-strict-001.html [ ImageOnlyFailure ]
    4791 imported/w3c/web-platform-tests/css/css-contain/contain-strict-002.html [ ImageOnlyFailure ]
    4792 imported/w3c/web-platform-tests/css/css-contain/contain-strict-011.html [ ImageOnlyFailure ]
     4756webkit.org/b/233193 imported/w3c/web-platform-tests/css/css-contain/contain-strict-011.html [ ImageOnlyFailure ]
    47934757imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-032.html [ ImageOnlyFailure ]
    47944758imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-033.sub.https.html [ ImageOnlyFailure ]
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r285861 r285885  
     12021-11-16  Rob Buis  <rbuis@igalia.com>
     2
     3        [css-contain] Support contain:paint
     4        https://bugs.webkit.org/show_bug.cgi?id=224742
     5
     6        Reviewed by Alan Bujtas.
     7
     8        Adjust test expectation now that contain: strict is supported.
     9
     10        * web-platform-tests/css/css-flexbox/flex-item-contains-strict-expected.txt:
     11
    1122021-11-16  Andreu Botella  <andreu@andreubotella.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-item-contains-strict-expected.txt

    r285745 r285885  
    11Stretched:
    22
    3 Column
    43
    5 Row
    64
    75Column
     
    108Flex-start:
    119
    12 Column
    1310
    14 Row
    1511
    1612Column
  • trunk/Source/WebCore/ChangeLog

    r285883 r285885  
     12021-11-16  Rob Buis  <rbuis@igalia.com>
     2
     3        [css-contain] Support contain:paint
     4        https://bugs.webkit.org/show_bug.cgi?id=224742
     5
     6        Reviewed by Alan Bujtas.
     7
     8        This patch implements paint containment as specified[1].
     9
     10        It adds shouldApplyPaintContainment to check whether the element applies for paint containment. Is so, then:
     11        - an independent formatting context is established.
     12        - an absolute positioning and fixed positioning containing block is established.
     13        - a stacking context is created.
     14        - implements clipping on the overflow clip edge.
     15
     16        This patch also adds effectiveOverflowX/effectiveOverflowY on RenderElement to take
     17        the effect of paint containment on overflow-x/y into account.
     18
     19        [1] https://drafts.csswg.org/css-contain-2/#paint-containment
     20
     21        * page/FrameView.cpp:
     22        (WebCore::FrameView::applyOverflowToViewport):
     23        (WebCore::FrameView::applyPaginationToViewport):
     24        (WebCore::FrameView::calculateScrollbarModesForLayout):
     25        * rendering/GridTrackSizingAlgorithm.cpp:
     26        (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const):
     27        * rendering/RenderBox.cpp:
     28        (WebCore::RenderBox::updateFromStyle):
     29        (WebCore::RenderBox::constrainLogicalWidthInFragmentByMinMax const):
     30        (WebCore::RenderBox::constrainLogicalHeightByMinMax const):
     31        (WebCore::RenderBox::createsNewFormattingContext const):
     32        (WebCore::RenderBox::addOverflowFromChild):
     33        * rendering/RenderBoxModelObject.cpp:
     34        (WebCore::RenderBoxModelObject::updateFromStyle):
     35        * rendering/RenderElement.cpp:
     36        (WebCore::includeNonFixedHeight):
     37        (WebCore::RenderElement::effectiveOverflowX const):
     38        (WebCore::RenderElement::effectiveOverflowY const):
     39        * rendering/RenderElement.h:
     40        (WebCore::RenderElement::effectiveOverflowInlineDirection const):
     41        (WebCore::RenderElement::effectiveOverflowBlockDirection const):
     42        (WebCore::RenderElement::canContainFixedPositionObjects const):
     43        (WebCore::RenderElement::canContainAbsolutelyPositionedObjects const):
     44        * rendering/RenderFlexibleBox.cpp:
     45        (WebCore::RenderFlexibleBox::mainAxisOverflowForChild const):
     46        (WebCore::RenderFlexibleBox::crossAxisOverflowForChild const):
     47        * rendering/RenderFragmentContainer.cpp:
     48        (WebCore::RenderFragmentContainer::overflowRectForFragmentedFlowPortion):
     49        * rendering/RenderInline.h:
     50        * rendering/RenderLayer.cpp:
     51        (WebCore::canCreateStackingContext):
     52        (WebCore::RenderLayer::shouldBeCSSStackingContext const):
     53        (WebCore::RenderLayer::setAncestorChainHasSelfPaintingLayerDescendant):
     54        (WebCore::RenderLayer::setAncestorChainHasVisibleDescendant):
     55        (WebCore::RenderLayer::calculateClipRects const):
     56        * rendering/RenderObject.cpp:
     57        (WebCore::RenderObject::setPaintContainmentApplies):
     58        (WebCore::RenderObject::RenderObjectRareData::RenderObjectRareData):
     59        (WebCore::shouldApplyPaintContainment):
     60        * rendering/RenderObject.h:
     61        (WebCore::RenderObject::paintContainmentApplies const):
     62        * rendering/style/RenderStyle.h:
     63        (WebCore::RenderStyle::overflowY const):
     64        (WebCore::RenderStyle::containsPaint const):
     65        (WebCore::RenderStyle::overflowInlineDirection const): Deleted.
     66        (WebCore::RenderStyle::overflowBlockDirection const): Deleted.
     67        * rendering/svg/RenderSVGRoot.cpp:
     68        (WebCore::RenderSVGRoot::shouldApplyViewportClip const):
     69
    1702021-11-16  Simon Fraser  <simon.fraser@apple.com>
    271
  • trunk/Source/WebCore/page/FrameView.cpp

    r285745 r285885  
    645645    bool overrideHidden = frame().isMainFrame() && ((frame().frameScaleFactor() > 1) || headerHeight() || footerHeight());
    646646
    647     Overflow overflowX = renderer.style().overflowX();
    648     Overflow overflowY = renderer.style().overflowY();
     647    Overflow overflowX = renderer.effectiveOverflowX();
     648    Overflow overflowY = renderer.effectiveOverflowY();
    649649
    650650    if (is<RenderSVGRoot>(renderer)) {
     
    710710    auto* body = document->body();
    711711    if (body && body->renderer()) {
    712         documentOrBodyRenderer = documentRenderer.style().overflowX() == Overflow::Visible && is<HTMLHtmlElement>(*documentElement) ?
     712        documentOrBodyRenderer = documentRenderer.effectiveOverflowX() == Overflow::Visible && is<HTMLHtmlElement>(*documentElement) ?
    713713            body->renderer() : &documentRenderer;
    714714    }
    715715
    716716    Pagination pagination;
    717     Overflow overflowY = documentOrBodyRenderer->style().overflowY();
     717    Overflow overflowY = documentOrBodyRenderer->effectiveOverflowY();
    718718    if (overflowY == Overflow::PagedX || overflowY == Overflow::PagedY) {
    719719        pagination.mode = WebCore::paginationModeForRenderStyle(documentOrBodyRenderer->style());
     
    777777        // It's sufficient to just check the X overflow,
    778778        // since it's illegal to have visible in only one direction.
    779         if (rootRenderer->style().overflowX() == Overflow::Visible && is<HTMLHtmlElement>(documentElement)) {
     779        if (rootRenderer->effectiveOverflowX() == Overflow::Visible && is<HTMLHtmlElement>(documentElement)) {
    780780            auto* bodyRenderer = bodyOrFrameset->renderer();
    781781            if (bodyRenderer) {
  • trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp

    r285745 r285885  
    847847
    848848    const Length& childMinSize = isRowAxis ? child.style().logicalMinWidth() : child.style().logicalMinHeight();
    849     bool overflowIsVisible = isRowAxis ? child.style().overflowInlineDirection() == Overflow::Visible : child.style().overflowBlockDirection() == Overflow::Visible;
     849    bool overflowIsVisible = isRowAxis ? child.effectiveOverflowInlineDirection() == Overflow::Visible : child.effectiveOverflowBlockDirection() == Overflow::Visible;
    850850    LayoutUnit baselineShim = m_algorithm.baselineOffsetForChild(child, gridAxisForDirection(direction()));
    851851
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r285745 r285885  
    488488
    489489    // We also handle <body> and <html>, whose overflow applies to the viewport.
    490     if (!(styleToUse.overflowX() == Overflow::Visible && styleToUse.overflowY() == Overflow::Visible) && !isDocElementRenderer && isRenderBlock()) {
     490    if (!(effectiveOverflowX() == Overflow::Visible && effectiveOverflowY() == Overflow::Visible) && !isDocElementRenderer && isRenderBlock()) {
    491491        bool boxHasNonVisibleOverflow = true;
    492492        if (isBody()) {
     
    497497            if (is<HTMLHtmlElement>(*document().documentElement())
    498498                && document().body() == element()
    499                 && document().documentElement()->renderer()->style().overflowX() == Overflow::Visible) {
     499                && document().documentElement()->renderer()->effectiveOverflowX() == Overflow::Visible) {
    500500                boxHasNonVisibleOverflow = false;
    501501            }
     
    667667        return logicalWidth;
    668668    auto minLength = styleToUse.logicalMinWidth();
    669     if (styleToUse.hasAspectRatio() && minLength.isAuto() && (styleToUse.logicalWidth().isAuto() || styleToUse.logicalWidth().isMinContent() || styleToUse.logicalWidth().isMaxContent()) && styleToUse.overflowInlineDirection() == Overflow::Visible) {
     669    if (styleToUse.hasAspectRatio() && minLength.isAuto() && (styleToUse.logicalWidth().isAuto() || styleToUse.logicalWidth().isMinContent() || styleToUse.logicalWidth().isMaxContent()) && effectiveOverflowInlineDirection() == Overflow::Visible) {
    670670        // Make sure we actually used the aspect ratio.
    671671        if (shouldComputeLogicalWidthFromAspectRatio())
     
    683683    }
    684684    auto logicalMinHeight = styleToUse.logicalMinHeight();
    685     if (logicalMinHeight.isAuto() && shouldComputeLogicalHeightFromAspectRatio() && intrinsicContentHeight && styleToUse.overflowBlockDirection() == Overflow::Visible) {
     685    if (logicalMinHeight.isAuto() && shouldComputeLogicalHeightFromAspectRatio() && intrinsicContentHeight && effectiveOverflowBlockDirection() == Overflow::Visible) {
    686686        auto heightFromAspectRatio = blockSizeFromAspectRatio(horizontalBorderAndPaddingExtent(), verticalBorderAndPaddingExtent(), LayoutUnit(style().logicalAspectRatio()), style().boxSizingForAspectRatio(), logicalWidth()) - borderAndPaddingLogicalHeight();
    687687        if (firstChild())
     
    49074907    return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() || hasPotentiallyScrollableOverflow() || isFlexItemIncludingDeprecated()
    49084908        || isTableCell() || isTableCaption() || isFieldset() || isWritingModeRoot() || isDocumentElementRenderer() || isRenderFragmentedFlow()
    4909         || style().containsLayout() || isGridItem() || style().specifiesColumns() || style().columnSpan() == ColumnSpan::All || style().display() == DisplayType::FlowRoot;
     4909        || style().containsLayout() || paintContainmentApplies() || isGridItem() || style().specifiesColumns() || style().columnSpan() == ColumnSpan::All || style().display() == DisplayType::FlowRoot;
    49104910}
    49114911
     
    49754975void RenderBox::addOverflowFromChild(const RenderBox* child, const LayoutSize& delta)
    49764976{
     4977    if (paintContainmentApplies())
     4978        return;
    49774979    // Never allow flow threads to propagate overflow up to a parent.
    49784980    if (child->isRenderFragmentedFlow())
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r285745 r285885  
    212212    if (styleToUse.isFlippedBlocksWritingMode())
    213213        view().frameView().setHasFlippedBlockRenderers(true);
     214    setPaintContainmentApplies(shouldApplyPaintContainment(*this));
    214215}
    215216
  • trunk/Source/WebCore/rendering/RenderElement.cpp

    r285745 r285885  
    23182318            // For fixed height styles, if the overflow size of the element spills out of the specified
    23192319            // height, assume we can apply text auto-sizing.
    2320             if (style.overflowY() == Overflow::Visible
     2320            if (downcast<RenderBlock>(renderer).effectiveOverflowY() == Overflow::Visible
    23212321                && style.height().value() < downcast<RenderBlock>(renderer).layoutOverflowRect().maxY())
    23222322                return RenderObject::OverflowHeight;
     
    24082408}
    24092409
    2410 }
     2410Overflow RenderElement::effectiveOverflowX() const
     2411{
     2412    auto overflowX = style().overflowX();
     2413    if (paintContainmentApplies() && overflowX == Overflow::Visible)
     2414        return Overflow::Clip;
     2415    return overflowX;
     2416}
     2417
     2418Overflow RenderElement::effectiveOverflowY() const
     2419{
     2420    auto overflowY = style().overflowY();
     2421    if (paintContainmentApplies() && overflowY == Overflow::Visible)
     2422        return Overflow::Clip;
     2423    return overflowY;
     2424}
     2425
     2426}
  • trunk/Source/WebCore/rendering/RenderElement.h

    r285745 r285885  
    269269    ReferencedSVGResources& ensureReferencedSVGResources();
    270270
     271    Overflow effectiveOverflowX() const;
     272    Overflow effectiveOverflowY() const;
     273    Overflow effectiveOverflowInlineDirection() const { return style().isHorizontalWritingMode() ? effectiveOverflowX() : effectiveOverflowY(); }
     274    Overflow effectiveOverflowBlockDirection() const { return style().isHorizontalWritingMode() ? effectiveOverflowY() : effectiveOverflowX(); }
     275
    271276protected:
    272277    enum BaseTypeFlag {
     
    457462        || (isRenderBlock() && style().willChange() && style().willChange()->createsContainingBlockForOutOfFlowPositioned())
    458463        || isSVGForeignObject()
    459         || shouldApplyLayoutContainment(*this);
     464        || shouldApplyLayoutContainment(*this)
     465        || shouldApplyPaintContainment(*this);
    460466}
    461467
     
    468474        || isSVGForeignObject()
    469475        || shouldApplyLayoutContainment(*this)
     476        || shouldApplyPaintContainment(*this)
    470477        || isRenderView();
    471478}
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp

    r285745 r285885  
    18451845{
    18461846    if (isHorizontalFlow())
    1847         return child.style().overflowX();
    1848     return child.style().overflowY();
     1847        return child.effectiveOverflowX();
     1848    return child.effectiveOverflowY();
    18491849}
    18501850
     
    18521852{
    18531853    if (isHorizontalFlow())
    1854         return child.style().overflowY();
    1855     return child.style().overflowX();
     1854        return child.effectiveOverflowY();
     1855    return child.effectiveOverflowX();
    18561856}
    18571857
  • trunk/Source/WebCore/rendering/RenderFragmentContainer.cpp

    r285745 r285885  
    158158        LayoutUnit minY = isFirstPortion ? fragmentedFlowOverflow.y() : fragmentedFlowPortionRect.y();
    159159        LayoutUnit maxY = isLastPortion ? std::max(fragmentedFlowPortionRect.maxY(), fragmentedFlowOverflow.maxY()) : fragmentedFlowPortionRect.maxY();
    160         bool clipX = style().overflowX() != Overflow::Visible;
     160        bool clipX = effectiveOverflowX() != Overflow::Visible;
    161161        LayoutUnit minX = clipX ? fragmentedFlowPortionRect.x() : std::min(fragmentedFlowPortionRect.x(), fragmentedFlowOverflow.x());
    162162        LayoutUnit maxX = clipX ? fragmentedFlowPortionRect.maxX() : std::max(fragmentedFlowPortionRect.maxX(), fragmentedFlowOverflow.maxX());
     
    165165        LayoutUnit minX = isFirstPortion ? fragmentedFlowOverflow.x() : fragmentedFlowPortionRect.x();
    166166        LayoutUnit maxX = isLastPortion ? std::max(fragmentedFlowPortionRect.maxX(), fragmentedFlowOverflow.maxX()) : fragmentedFlowPortionRect.maxX();
    167         bool clipY = style().overflowY() != Overflow::Visible;
     167        bool clipY = effectiveOverflowY() != Overflow::Visible;
    168168        LayoutUnit minY = clipY ? fragmentedFlowPortionRect.y() : std::min(fragmentedFlowPortionRect.y(), fragmentedFlowOverflow.y());
    169169        LayoutUnit maxY = clipY ? fragmentedFlowPortionRect.maxY() : std::max(fragmentedFlowPortionRect.y(), fragmentedFlowOverflow.maxY());
  • trunk/Source/WebCore/rendering/RenderInline.h

    r285745 r285885  
    8383    bool mayAffectLayout() const;
    8484
    85     bool requiresLayer() const override { return isInFlowPositioned() || createsGroup() || hasClipPath() || willChangeCreatesStackingContext() || hasRunningAcceleratedAnimations(); }
     85    bool requiresLayer() const override { return isInFlowPositioned() || createsGroup() || hasClipPath() || shouldApplyPaintContainment(*this) || willChangeCreatesStackingContext() || hasRunningAcceleratedAnimations(); }
    8686
    8787protected:
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r285745 r285885  
    557557        || renderer.hasReflection()
    558558        || renderer.style().hasIsolation()
     559        || shouldApplyPaintContainment(renderer)
    559560        || !renderer.style().hasAutoUsedZIndex()
    560561        || (renderer.style().willChange() && renderer.style().willChange()->canCreateStackingContext())
     
    588589bool RenderLayer::shouldBeCSSStackingContext() const
    589590{
    590     return !renderer().style().hasAutoUsedZIndex() || isRenderViewLayer();
     591    return !renderer().style().hasAutoUsedZIndex() || shouldApplyPaintContainment(renderer()) || isRenderViewLayer();
    591592}
    592593
     
    10901091{
    10911092    for (RenderLayer* layer = this; layer; layer = layer->parent()) {
     1093        if (shouldApplyPaintContainment(renderer())) {
     1094            m_hasSelfPaintingLayerDescendant = true;
     1095            m_hasSelfPaintingLayerDescendantDirty = false;
     1096            break;
     1097        }
    10921098        if (!layer->m_hasSelfPaintingLayerDescendantDirty && layer->hasSelfPaintingLayerDescendant())
    10931099            break;
     
    14901496{
    14911497    for (RenderLayer* layer = this; layer; layer = layer->parent()) {
     1498        if (shouldApplyPaintContainment(renderer())) {
     1499            m_hasVisibleDescendant = true;
     1500            m_visibleDescendantStatusDirty = false;
     1501            break;
     1502        }
    14921503        if (!layer->m_visibleDescendantStatusDirty && layer->hasVisibleDescendant())
    14931504            break;
     
    45304541            if (renderer().isPositioned())
    45314542                clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect()));
     4543            if (shouldApplyPaintContainment(renderer())) {
     4544                clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect()));
     4545                clipRects.setFixedClipRect(intersection(newOverflowClip, clipRects.fixedClipRect()));
     4546            }
    45324547        }
    45334548        if (renderer().hasClip()) {
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r285854 r285885  
    19201920}
    19211921
     1922void RenderObject::setPaintContainmentApplies(bool paintContainmentApplies)
     1923{
     1924    if (paintContainmentApplies || hasRareData())
     1925        ensureRareData().setPaintContainmentApplies(paintContainmentApplies);
     1926}
     1927
    19221928RenderObject::RareDataMap& RenderObject::rareDataMap()
    19231929{
     
    19481954    , m_isRenderFragmentedFlow(false)
    19491955    , m_hasOutlineAutoAncestor(false)
     1956    , m_paintContainmentApplies(false)
    19501957{
    19511958}
     
    25472554    return (!renderer.isInline() || renderer.isAtomicInlineLevelBox()) && !renderer.isRubyText() && (!renderer.isTablePart() || renderer.isTableCaption()) && !renderer.isTable();
    25482555}
     2556
     2557bool WebCore::shouldApplyPaintContainment(const WebCore::RenderObject& renderer)
     2558{
     2559    return renderer.style().containsPaint() && (!renderer.isInline() || renderer.isAtomicInlineLevelBox()) && !renderer.isRubyText() && (!renderer.isTablePart() || renderer.isRenderBlockFlow());
     2560}
     2561
  • trunk/Source/WebCore/rendering/RenderObject.h

    r285745 r285885  
    409409    bool isRenderFragmentedFlow() const { return m_bitfields.hasRareData() && rareData().isRenderFragmentedFlow(); }
    410410    bool hasOutlineAutoAncestor() const { return m_bitfields.hasRareData() && rareData().hasOutlineAutoAncestor(); }
     411    bool paintContainmentApplies() const { return m_bitfields.hasRareData() && rareData().paintContainmentApplies(); }
    411412
    412413    bool isExcludedFromNormalLayout() const { return m_bitfields.isExcludedFromNormalLayout(); }
     
    506507    void setIsRenderFragmentedFlow(bool = true);
    507508    void setHasOutlineAutoAncestor(bool = true);
     509    void setPaintContainmentApplies(bool = true);
    508510
    509511    // Hook so that RenderTextControl can return the line height of its inner renderer.
     
    936938        ADD_BOOLEAN_BITFIELD(isRenderFragmentedFlow, IsRenderFragmentedFlow);
    937939        ADD_BOOLEAN_BITFIELD(hasOutlineAutoAncestor, HasOutlineAutoAncestor);
     940        ADD_BOOLEAN_BITFIELD(paintContainmentApplies, PaintContainmentApplies);
    938941
    939942        // From RenderElement
     
    12101213bool shouldApplySizeContainment(const RenderObject&);
    12111214bool shouldApplyStyleContainment(const RenderObject&);
     1215bool shouldApplyPaintContainment(const RenderObject&);
    12121216
    12131217} // namespace WebCore
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r285822 r285885  
    333333    Overflow overflowX() const { return static_cast<Overflow>(m_nonInheritedFlags.overflowX); }
    334334    Overflow overflowY() const { return static_cast<Overflow>(m_nonInheritedFlags.overflowY); }
    335     Overflow overflowInlineDirection() const { return isHorizontalWritingMode() ? overflowX() : overflowY(); }
    336     Overflow overflowBlockDirection() const { return isHorizontalWritingMode() ? overflowY() : overflowX(); }
    337335    bool isOverflowVisible() const { return overflowX() == Overflow::Visible || overflowY() == Overflow::Visible; }
    338336
     
    534532    bool containsSize() const { return m_rareNonInheritedData->contain.contains(Containment::Size); }
    535533    bool containsStyle() const { return m_rareNonInheritedData->contain.contains(Containment::Style); }
     534    bool containsPaint() const { return m_rareNonInheritedData->contain.contains(Containment::Paint); }
    536535    BoxAlignment boxAlign() const { return static_cast<BoxAlignment>(m_rareNonInheritedData->deprecatedFlexibleBox->align); }
    537536    BoxDirection boxDirection() const { return static_cast<BoxDirection>(m_inheritedFlags.boxDirection); }
  • trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp

    r285745 r285885  
    216216    // When the svg is stand-alone (isDocumentElement() == true) the viewport clipping should always
    217217    // be applied, noting that the window scrollbars should be hidden if overflow=hidden.
    218     return style().overflowX() == Overflow::Hidden
     218    return effectiveOverflowX() == Overflow::Hidden
    219219        || style().overflowX() == Overflow::Auto
    220220        || style().overflowX() == Overflow::Scroll
Note: See TracChangeset for help on using the changeset viewer.