Diff
Modified: trunk/LayoutTests/ChangeLog (285884 => 285885)
--- trunk/LayoutTests/ChangeLog 2021-11-16 22:19:49 UTC (rev 285884)
+++ trunk/LayoutTests/ChangeLog 2021-11-16 22:32:39 UTC (rev 285885)
@@ -1,3 +1,14 @@
+2021-11-16 Rob Buis <rb...@igalia.com>
+
+ [css-contain] Support contain:paint
+ https://bugs.webkit.org/show_bug.cgi?id=224742
+
+ Reviewed by Alan Bujtas.
+
+ Unskip tests that pass now.
+
+ * TestExpectations:
+
2021-11-16 Tyler Wilcock <tyle...@apple.com>
AX: Simplify tests changed in https://bugs.webkit.org/show_bug.cgi?id=233085
Modified: trunk/LayoutTests/TestExpectations (285884 => 285885)
--- trunk/LayoutTests/TestExpectations 2021-11-16 22:19:49 UTC (rev 285884)
+++ trunk/LayoutTests/TestExpectations 2021-11-16 22:32:39 UTC (rev 285885)
@@ -4733,6 +4733,10 @@
# CSS containment tests that fail
# webkit-ruby-text
imported/w3c/web-platform-tests/css/css-contain/contain-layout-017.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-contain/contain-paint-005.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-contain/contain-paint-006.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-contain/contain-paint-008.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-contain/contain-paint-021.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-001.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-003.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-004.html [ ImageOnlyFailure ]
@@ -4747,49 +4751,9 @@
imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-020.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-021.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-022.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-004.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-005.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-006.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-008.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-009.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-010.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-014.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-019.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-020.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-022.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-023.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-047.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-048.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-cell-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-cell-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-006.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-011.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-012.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-013.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-014.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-015.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-016.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-017.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-018.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-clip-019.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-containing-block-absolute-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-containing-block-fixed-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-formatting-context-float-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-formatting-context-margin-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-ifc-011.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-independent-formatting-context-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-size-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-size-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-size-003.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-stacking-context-001a.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-table-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-paint-table-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-strict-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-strict-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-strict-011.html [ ImageOnlyFailure ]
+webkit.org/b/233193 imported/w3c/web-platform-tests/css/css-contain/contain-strict-011.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-032.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-033.sub.https.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-034.html [ ImageOnlyFailure ]
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (285884 => 285885)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-11-16 22:19:49 UTC (rev 285884)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-11-16 22:32:39 UTC (rev 285885)
@@ -1,3 +1,14 @@
+2021-11-16 Rob Buis <rb...@igalia.com>
+
+ [css-contain] Support contain:paint
+ https://bugs.webkit.org/show_bug.cgi?id=224742
+
+ Reviewed by Alan Bujtas.
+
+ Adjust test expectation now that contain: strict is supported.
+
+ * web-platform-tests/css/css-flexbox/flex-item-contains-strict-expected.txt:
+
2021-11-16 Andreu Botella <and...@andreubotella.com>
Empty <input type=file> is represented incorrectly in FormData
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-item-contains-strict-expected.txt (285884 => 285885)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-item-contains-strict-expected.txt 2021-11-16 22:19:49 UTC (rev 285884)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-item-contains-strict-expected.txt 2021-11-16 22:32:39 UTC (rev 285885)
@@ -1,8 +1,6 @@
Stretched:
-Column
-Row
Column
@@ -9,9 +7,7 @@
Row
Flex-start:
-Column
-Row
Column
Modified: trunk/Source/WebCore/ChangeLog (285884 => 285885)
--- trunk/Source/WebCore/ChangeLog 2021-11-16 22:19:49 UTC (rev 285884)
+++ trunk/Source/WebCore/ChangeLog 2021-11-16 22:32:39 UTC (rev 285885)
@@ -1,3 +1,72 @@
+2021-11-16 Rob Buis <rb...@igalia.com>
+
+ [css-contain] Support contain:paint
+ https://bugs.webkit.org/show_bug.cgi?id=224742
+
+ Reviewed by Alan Bujtas.
+
+ 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):
+
2021-11-16 Simon Fraser <simon.fra...@apple.com>
Use IOHIDEvent timestamps for momentum velocity computation
Modified: trunk/Source/WebCore/page/FrameView.cpp (285884 => 285885)
--- trunk/Source/WebCore/page/FrameView.cpp 2021-11-16 22:19:49 UTC (rev 285884)
+++ trunk/Source/WebCore/page/FrameView.cpp 2021-11-16 22:32:39 UTC (rev 285885)
@@ -644,8 +644,8 @@
bool overrideHidden = frame().isMainFrame() && ((frame().frameScaleFactor() > 1) || headerHeight() || footerHeight());
- Overflow overflowX = renderer.style().overflowX();
- Overflow overflowY = renderer.style().overflowY();
+ Overflow overflowX = renderer.effectiveOverflowX();
+ Overflow overflowY = renderer.effectiveOverflowY();
if (is<RenderSVGRoot>(renderer)) {
// FIXME: evaluate if we can allow overflow for these cases too.
@@ -709,12 +709,12 @@
auto* body = document->body();
if (body && body->renderer()) {
- documentOrBodyRenderer = documentRenderer.style().overflowX() == Overflow::Visible && is<HTMLHtmlElement>(*documentElement) ?
+ documentOrBodyRenderer = documentRenderer.effectiveOverflowX() == Overflow::Visible && is<HTMLHtmlElement>(*documentElement) ?
body->renderer() : &documentRenderer;
}
Pagination pagination;
- Overflow overflowY = documentOrBodyRenderer->style().overflowY();
+ Overflow overflowY = documentOrBodyRenderer->effectiveOverflowY();
if (overflowY == Overflow::PagedX || overflowY == Overflow::PagedY) {
pagination.mode = WebCore::paginationModeForRenderStyle(documentOrBodyRenderer->style());
GapLength columnGapLength = documentOrBodyRenderer->style().columnGap();
@@ -776,7 +776,7 @@
if (is<HTMLBodyElement>(*bodyOrFrameset) && rootRenderer) {
// It's sufficient to just check the X overflow,
// since it's illegal to have visible in only one direction.
- if (rootRenderer->style().overflowX() == Overflow::Visible && is<HTMLHtmlElement>(documentElement)) {
+ if (rootRenderer->effectiveOverflowX() == Overflow::Visible && is<HTMLHtmlElement>(documentElement)) {
auto* bodyRenderer = bodyOrFrameset->renderer();
if (bodyRenderer) {
applyOverflowToViewport(*bodyRenderer, hMode, vMode);
Modified: trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp (285884 => 285885)
--- trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp 2021-11-16 22:19:49 UTC (rev 285884)
+++ trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp 2021-11-16 22:32:39 UTC (rev 285885)
@@ -846,7 +846,7 @@
return minContentForChild(child);
const Length& childMinSize = isRowAxis ? child.style().logicalMinWidth() : child.style().logicalMinHeight();
- bool overflowIsVisible = isRowAxis ? child.style().overflowInlineDirection() == Overflow::Visible : child.style().overflowBlockDirection() == Overflow::Visible;
+ bool overflowIsVisible = isRowAxis ? child.effectiveOverflowInlineDirection() == Overflow::Visible : child.effectiveOverflowBlockDirection() == Overflow::Visible;
LayoutUnit baselineShim = m_algorithm.baselineOffsetForChild(child, gridAxisForDirection(direction()));
if (childMinSize.isAuto() && overflowIsVisible) {
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (285884 => 285885)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2021-11-16 22:19:49 UTC (rev 285884)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2021-11-16 22:32:39 UTC (rev 285885)
@@ -487,7 +487,7 @@
setFloating(!isOutOfFlowPositioned() && styleToUse.isFloating());
// We also handle <body> and <html>, whose overflow applies to the viewport.
- if (!(styleToUse.overflowX() == Overflow::Visible && styleToUse.overflowY() == Overflow::Visible) && !isDocElementRenderer && isRenderBlock()) {
+ if (!(effectiveOverflowX() == Overflow::Visible && effectiveOverflowY() == Overflow::Visible) && !isDocElementRenderer && isRenderBlock()) {
bool boxHasNonVisibleOverflow = true;
if (isBody()) {
// Overflow on the body can propagate to the viewport under the following conditions.
@@ -496,7 +496,7 @@
// (3) The root element has visible overflow.
if (is<HTMLHtmlElement>(*document().documentElement())
&& document().body() == element()
- && document().documentElement()->renderer()->style().overflowX() == Overflow::Visible) {
+ && document().documentElement()->renderer()->effectiveOverflowX() == Overflow::Visible) {
boxHasNonVisibleOverflow = false;
}
}
@@ -666,7 +666,7 @@
if (allowIntrinsic == AllowIntrinsic::No && styleToUse.logicalMinWidth().isIntrinsic())
return logicalWidth;
auto minLength = styleToUse.logicalMinWidth();
- if (styleToUse.hasAspectRatio() && minLength.isAuto() && (styleToUse.logicalWidth().isAuto() || styleToUse.logicalWidth().isMinContent() || styleToUse.logicalWidth().isMaxContent()) && styleToUse.overflowInlineDirection() == Overflow::Visible) {
+ if (styleToUse.hasAspectRatio() && minLength.isAuto() && (styleToUse.logicalWidth().isAuto() || styleToUse.logicalWidth().isMinContent() || styleToUse.logicalWidth().isMaxContent()) && effectiveOverflowInlineDirection() == Overflow::Visible) {
// Make sure we actually used the aspect ratio.
if (shouldComputeLogicalWidthFromAspectRatio())
minLength = Length(LengthType::MinContent);
@@ -682,7 +682,7 @@
logicalHeight = std::min(logicalHeight, maxH.value());
}
auto logicalMinHeight = styleToUse.logicalMinHeight();
- if (logicalMinHeight.isAuto() && shouldComputeLogicalHeightFromAspectRatio() && intrinsicContentHeight && styleToUse.overflowBlockDirection() == Overflow::Visible) {
+ if (logicalMinHeight.isAuto() && shouldComputeLogicalHeightFromAspectRatio() && intrinsicContentHeight && effectiveOverflowBlockDirection() == Overflow::Visible) {
auto heightFromAspectRatio = blockSizeFromAspectRatio(horizontalBorderAndPaddingExtent(), verticalBorderAndPaddingExtent(), LayoutUnit(style().logicalAspectRatio()), style().boxSizingForAspectRatio(), logicalWidth()) - borderAndPaddingLogicalHeight();
if (firstChild())
heightFromAspectRatio = std::max(heightFromAspectRatio, *intrinsicContentHeight);
@@ -4906,7 +4906,7 @@
{
return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() || hasPotentiallyScrollableOverflow() || isFlexItemIncludingDeprecated()
|| isTableCell() || isTableCaption() || isFieldset() || isWritingModeRoot() || isDocumentElementRenderer() || isRenderFragmentedFlow()
- || style().containsLayout() || isGridItem() || style().specifiesColumns() || style().columnSpan() == ColumnSpan::All || style().display() == DisplayType::FlowRoot;
+ || style().containsLayout() || paintContainmentApplies() || isGridItem() || style().specifiesColumns() || style().columnSpan() == ColumnSpan::All || style().display() == DisplayType::FlowRoot;
}
bool RenderBox::avoidsFloats() const
@@ -4974,6 +4974,8 @@
void RenderBox::addOverflowFromChild(const RenderBox* child, const LayoutSize& delta)
{
+ if (paintContainmentApplies())
+ return;
// Never allow flow threads to propagate overflow up to a parent.
if (child->isRenderFragmentedFlow())
return;
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (285884 => 285885)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2021-11-16 22:19:49 UTC (rev 285884)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2021-11-16 22:32:39 UTC (rev 285885)
@@ -211,6 +211,7 @@
setHorizontalWritingMode(styleToUse.isHorizontalWritingMode());
if (styleToUse.isFlippedBlocksWritingMode())
view().frameView().setHasFlippedBlockRenderers(true);
+ setPaintContainmentApplies(shouldApplyPaintContainment(*this));
}
static LayoutSize accumulateInFlowPositionOffsets(const RenderObject* child)
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (285884 => 285885)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2021-11-16 22:19:49 UTC (rev 285884)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2021-11-16 22:32:39 UTC (rev 285885)
@@ -2317,7 +2317,7 @@
if (is<RenderBlock>(renderer)) {
// For fixed height styles, if the overflow size of the element spills out of the specified
// height, assume we can apply text auto-sizing.
- if (style.overflowY() == Overflow::Visible
+ if (downcast<RenderBlock>(renderer).effectiveOverflowY() == Overflow::Visible
&& style.height().value() < downcast<RenderBlock>(renderer).layoutOverflowRect().maxY())
return RenderObject::OverflowHeight;
}
@@ -2407,4 +2407,20 @@
ensureRareData().backdropRenderer = renderer;
}
+Overflow RenderElement::effectiveOverflowX() const
+{
+ auto overflowX = style().overflowX();
+ if (paintContainmentApplies() && overflowX == Overflow::Visible)
+ return Overflow::Clip;
+ return overflowX;
}
+
+Overflow RenderElement::effectiveOverflowY() const
+{
+ auto overflowY = style().overflowY();
+ if (paintContainmentApplies() && overflowY == Overflow::Visible)
+ return Overflow::Clip;
+ return overflowY;
+}
+
+}
Modified: trunk/Source/WebCore/rendering/RenderElement.h (285884 => 285885)
--- trunk/Source/WebCore/rendering/RenderElement.h 2021-11-16 22:19:49 UTC (rev 285884)
+++ trunk/Source/WebCore/rendering/RenderElement.h 2021-11-16 22:32:39 UTC (rev 285885)
@@ -268,6 +268,11 @@
ReferencedSVGResources& ensureReferencedSVGResources();
+ Overflow effectiveOverflowX() const;
+ Overflow effectiveOverflowY() const;
+ Overflow effectiveOverflowInlineDirection() const { return style().isHorizontalWritingMode() ? effectiveOverflowX() : effectiveOverflowY(); }
+ Overflow effectiveOverflowBlockDirection() const { return style().isHorizontalWritingMode() ? effectiveOverflowY() : effectiveOverflowX(); }
+
protected:
enum BaseTypeFlag {
RenderLayerModelObjectFlag = 1 << 0,
@@ -456,7 +461,8 @@
// FIXME: will-change should create containing blocks on inline boxes (bug 225035)
|| (isRenderBlock() && style().willChange() && style().willChange()->createsContainingBlockForOutOfFlowPositioned())
|| isSVGForeignObject()
- || shouldApplyLayoutContainment(*this);
+ || shouldApplyLayoutContainment(*this)
+ || shouldApplyPaintContainment(*this);
}
inline bool RenderElement::canContainAbsolutelyPositionedObjects() const
@@ -467,6 +473,7 @@
|| (isRenderBlock() && style().willChange() && style().willChange()->createsContainingBlockForAbsolutelyPositioned())
|| isSVGForeignObject()
|| shouldApplyLayoutContainment(*this)
+ || shouldApplyPaintContainment(*this)
|| isRenderView();
}
Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (285884 => 285885)
--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2021-11-16 22:19:49 UTC (rev 285884)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2021-11-16 22:32:39 UTC (rev 285885)
@@ -1844,15 +1844,15 @@
Overflow RenderFlexibleBox::mainAxisOverflowForChild(const RenderBox& child) const
{
if (isHorizontalFlow())
- return child.style().overflowX();
- return child.style().overflowY();
+ return child.effectiveOverflowX();
+ return child.effectiveOverflowY();
}
Overflow RenderFlexibleBox::crossAxisOverflowForChild(const RenderBox& child) const
{
if (isHorizontalFlow())
- return child.style().overflowY();
- return child.style().overflowX();
+ return child.effectiveOverflowY();
+ return child.effectiveOverflowX();
}
bool RenderFlexibleBox::childHasPercentHeightDescendants(const RenderBox& renderer) const
Modified: trunk/Source/WebCore/rendering/RenderFragmentContainer.cpp (285884 => 285885)
--- trunk/Source/WebCore/rendering/RenderFragmentContainer.cpp 2021-11-16 22:19:49 UTC (rev 285884)
+++ trunk/Source/WebCore/rendering/RenderFragmentContainer.cpp 2021-11-16 22:32:39 UTC (rev 285885)
@@ -157,7 +157,7 @@
if (m_fragmentedFlow->isHorizontalWritingMode()) {
LayoutUnit minY = isFirstPortion ? fragmentedFlowOverflow.y() : fragmentedFlowPortionRect.y();
LayoutUnit maxY = isLastPortion ? std::max(fragmentedFlowPortionRect.maxY(), fragmentedFlowOverflow.maxY()) : fragmentedFlowPortionRect.maxY();
- bool clipX = style().overflowX() != Overflow::Visible;
+ bool clipX = effectiveOverflowX() != Overflow::Visible;
LayoutUnit minX = clipX ? fragmentedFlowPortionRect.x() : std::min(fragmentedFlowPortionRect.x(), fragmentedFlowOverflow.x());
LayoutUnit maxX = clipX ? fragmentedFlowPortionRect.maxX() : std::max(fragmentedFlowPortionRect.maxX(), fragmentedFlowOverflow.maxX());
clipRect = LayoutRect(minX, minY, maxX - minX, maxY - minY);
@@ -164,7 +164,7 @@
} else {
LayoutUnit minX = isFirstPortion ? fragmentedFlowOverflow.x() : fragmentedFlowPortionRect.x();
LayoutUnit maxX = isLastPortion ? std::max(fragmentedFlowPortionRect.maxX(), fragmentedFlowOverflow.maxX()) : fragmentedFlowPortionRect.maxX();
- bool clipY = style().overflowY() != Overflow::Visible;
+ bool clipY = effectiveOverflowY() != Overflow::Visible;
LayoutUnit minY = clipY ? fragmentedFlowPortionRect.y() : std::min(fragmentedFlowPortionRect.y(), fragmentedFlowOverflow.y());
LayoutUnit maxY = clipY ? fragmentedFlowPortionRect.maxY() : std::max(fragmentedFlowPortionRect.y(), fragmentedFlowOverflow.maxY());
clipRect = LayoutRect(minX, minY, maxX - minX, maxY - minY);
Modified: trunk/Source/WebCore/rendering/RenderInline.h (285884 => 285885)
--- trunk/Source/WebCore/rendering/RenderInline.h 2021-11-16 22:19:49 UTC (rev 285884)
+++ trunk/Source/WebCore/rendering/RenderInline.h 2021-11-16 22:32:39 UTC (rev 285885)
@@ -82,7 +82,7 @@
bool mayAffectLayout() const;
- bool requiresLayer() const override { return isInFlowPositioned() || createsGroup() || hasClipPath() || willChangeCreatesStackingContext() || hasRunningAcceleratedAnimations(); }
+ bool requiresLayer() const override { return isInFlowPositioned() || createsGroup() || hasClipPath() || shouldApplyPaintContainment(*this) || willChangeCreatesStackingContext() || hasRunningAcceleratedAnimations(); }
protected:
void willBeDestroyed() override;
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (285884 => 285885)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2021-11-16 22:19:49 UTC (rev 285884)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2021-11-16 22:32:39 UTC (rev 285885)
@@ -556,6 +556,7 @@
|| renderer.isPositioned() // Note that this only creates stacking context in conjunction with explicit z-index.
|| renderer.hasReflection()
|| renderer.style().hasIsolation()
+ || shouldApplyPaintContainment(renderer)
|| !renderer.style().hasAutoUsedZIndex()
|| (renderer.style().willChange() && renderer.style().willChange()->canCreateStackingContext())
|| layer.establishesTopLayer();
@@ -587,7 +588,7 @@
bool RenderLayer::shouldBeCSSStackingContext() const
{
- return !renderer().style().hasAutoUsedZIndex() || isRenderViewLayer();
+ return !renderer().style().hasAutoUsedZIndex() || shouldApplyPaintContainment(renderer()) || isRenderViewLayer();
}
bool RenderLayer::setIsNormalFlowOnly(bool isNormalFlowOnly)
@@ -1089,6 +1090,11 @@
void RenderLayer::setAncestorChainHasSelfPaintingLayerDescendant()
{
for (RenderLayer* layer = this; layer; layer = layer->parent()) {
+ if (shouldApplyPaintContainment(renderer())) {
+ m_hasSelfPaintingLayerDescendant = true;
+ m_hasSelfPaintingLayerDescendantDirty = false;
+ break;
+ }
if (!layer->m_hasSelfPaintingLayerDescendantDirty && layer->hasSelfPaintingLayerDescendant())
break;
@@ -1489,6 +1495,11 @@
void RenderLayer::setAncestorChainHasVisibleDescendant()
{
for (RenderLayer* layer = this; layer; layer = layer->parent()) {
+ if (shouldApplyPaintContainment(renderer())) {
+ m_hasVisibleDescendant = true;
+ m_visibleDescendantStatusDirty = false;
+ break;
+ }
if (!layer->m_visibleDescendantStatusDirty && layer->hasVisibleDescendant())
break;
@@ -4529,6 +4540,10 @@
clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.overflowClipRect()));
if (renderer().isPositioned())
clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect()));
+ if (shouldApplyPaintContainment(renderer())) {
+ clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect()));
+ clipRects.setFixedClipRect(intersection(newOverflowClip, clipRects.fixedClipRect()));
+ }
}
if (renderer().hasClip()) {
LayoutRect newPosClip = downcast<RenderBox>(renderer()).clipRect(offset, nullptr);
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (285884 => 285885)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2021-11-16 22:19:49 UTC (rev 285884)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2021-11-16 22:32:39 UTC (rev 285885)
@@ -1919,6 +1919,12 @@
ensureRareData().setHasOutlineAutoAncestor(hasOutlineAutoAncestor);
}
+void RenderObject::setPaintContainmentApplies(bool paintContainmentApplies)
+{
+ if (paintContainmentApplies || hasRareData())
+ ensureRareData().setPaintContainmentApplies(paintContainmentApplies);
+}
+
RenderObject::RareDataMap& RenderObject::rareDataMap()
{
static NeverDestroyed<RareDataMap> map;
@@ -1947,6 +1953,7 @@
: m_hasReflection(false)
, m_isRenderFragmentedFlow(false)
, m_hasOutlineAutoAncestor(false)
+ , m_paintContainmentApplies(false)
{
}
@@ -2546,3 +2553,9 @@
return false;
return (!renderer.isInline() || renderer.isAtomicInlineLevelBox()) && !renderer.isRubyText() && (!renderer.isTablePart() || renderer.isTableCaption()) && !renderer.isTable();
}
+
+bool WebCore::shouldApplyPaintContainment(const WebCore::RenderObject& renderer)
+{
+ return renderer.style().containsPaint() && (!renderer.isInline() || renderer.isAtomicInlineLevelBox()) && !renderer.isRubyText() && (!renderer.isTablePart() || renderer.isRenderBlockFlow());
+}
+
Modified: trunk/Source/WebCore/rendering/RenderObject.h (285884 => 285885)
--- trunk/Source/WebCore/rendering/RenderObject.h 2021-11-16 22:19:49 UTC (rev 285884)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2021-11-16 22:32:39 UTC (rev 285885)
@@ -408,6 +408,7 @@
bool hasReflection() const { return m_bitfields.hasRareData() && rareData().hasReflection(); }
bool isRenderFragmentedFlow() const { return m_bitfields.hasRareData() && rareData().isRenderFragmentedFlow(); }
bool hasOutlineAutoAncestor() const { return m_bitfields.hasRareData() && rareData().hasOutlineAutoAncestor(); }
+ bool paintContainmentApplies() const { return m_bitfields.hasRareData() && rareData().paintContainmentApplies(); }
bool isExcludedFromNormalLayout() const { return m_bitfields.isExcludedFromNormalLayout(); }
void setIsExcludedFromNormalLayout(bool excluded) { m_bitfields.setIsExcludedFromNormalLayout(excluded); }
@@ -505,6 +506,7 @@
void setHasReflection(bool = true);
void setIsRenderFragmentedFlow(bool = true);
void setHasOutlineAutoAncestor(bool = true);
+ void setPaintContainmentApplies(bool = true);
// Hook so that RenderTextControl can return the line height of its inner renderer.
// For other renderers, the value is the same as lineHeight(false).
@@ -935,6 +937,7 @@
ADD_BOOLEAN_BITFIELD(hasReflection, HasReflection);
ADD_BOOLEAN_BITFIELD(isRenderFragmentedFlow, IsRenderFragmentedFlow);
ADD_BOOLEAN_BITFIELD(hasOutlineAutoAncestor, HasOutlineAutoAncestor);
+ ADD_BOOLEAN_BITFIELD(paintContainmentApplies, PaintContainmentApplies);
// From RenderElement
std::unique_ptr<RenderStyle> cachedFirstLineStyle;
@@ -1209,6 +1212,7 @@
bool shouldApplyLayoutContainment(const RenderObject&);
bool shouldApplySizeContainment(const RenderObject&);
bool shouldApplyStyleContainment(const RenderObject&);
+bool shouldApplyPaintContainment(const RenderObject&);
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (285884 => 285885)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2021-11-16 22:19:49 UTC (rev 285884)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2021-11-16 22:32:39 UTC (rev 285885)
@@ -332,8 +332,6 @@
Overflow overflowX() const { return static_cast<Overflow>(m_nonInheritedFlags.overflowX); }
Overflow overflowY() const { return static_cast<Overflow>(m_nonInheritedFlags.overflowY); }
- Overflow overflowInlineDirection() const { return isHorizontalWritingMode() ? overflowX() : overflowY(); }
- Overflow overflowBlockDirection() const { return isHorizontalWritingMode() ? overflowY() : overflowX(); }
bool isOverflowVisible() const { return overflowX() == Overflow::Visible || overflowY() == Overflow::Visible; }
OverscrollBehavior overscrollBehaviorX() const { return static_cast<OverscrollBehavior>(m_rareNonInheritedData->overscrollBehaviorX); }
@@ -533,6 +531,7 @@
bool containsLayout() const { return m_rareNonInheritedData->contain.contains(Containment::Layout); }
bool containsSize() const { return m_rareNonInheritedData->contain.contains(Containment::Size); }
bool containsStyle() const { return m_rareNonInheritedData->contain.contains(Containment::Style); }
+ bool containsPaint() const { return m_rareNonInheritedData->contain.contains(Containment::Paint); }
BoxAlignment boxAlign() const { return static_cast<BoxAlignment>(m_rareNonInheritedData->deprecatedFlexibleBox->align); }
BoxDirection boxDirection() const { return static_cast<BoxDirection>(m_inheritedFlags.boxDirection); }
float boxFlex() const { return m_rareNonInheritedData->deprecatedFlexibleBox->flex; }
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (285884 => 285885)
--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2021-11-16 22:19:49 UTC (rev 285884)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2021-11-16 22:32:39 UTC (rev 285885)
@@ -215,7 +215,7 @@
// the outermost svg is clipped if auto, and svg document roots are always clipped
// When the svg is stand-alone (isDocumentElement() == true) the viewport clipping should always
// be applied, noting that the window scrollbars should be hidden if overflow=hidden.
- return style().overflowX() == Overflow::Hidden
+ return effectiveOverflowX() == Overflow::Hidden
|| style().overflowX() == Overflow::Auto
|| style().overflowX() == Overflow::Scroll
|| this->isDocumentElementRenderer();