Changeset 280509 in webkit


Ignore:
Timestamp:
Jul 30, 2021 11:07:09 PM (12 months ago)
Author:
commit-queue@webkit.org
Message:

[css-overflow] Implement clip value for overflow
https://bugs.webkit.org/show_bug.cgi?id=198230

Patch by Rob Buis <rbuis@igalia.com> on 2021-07-30
Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

  • web-platform-tests/css/css-overflow/overflow-clip-hit-testing-expected.txt: Added.
  • web-platform-tests/css/css-overflow/overflow-clip-scroll-size-expected.txt: Added.
  • web-platform-tests/css/css-overflow/parsing/overflow-computed-expected.txt:
  • web-platform-tests/css/css-overflow/parsing/overflow-valid-expected.txt:

Source/WebCore:

Implement overflow: clip. Parsing is like the other
overflow values but special logic is added to handle
the case where only one of overflow-x/overflow-y uses
'clip' [1]. Also adjusts code that computes layout and
visual overflow to take overflow: clip into account.

This matches Chrome and Firefox.

[1] https://drafts.csswg.org/css-overflow/#propdef-overflow-x

  • css/CSSPrimitiveValueMappings.h:

(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator Overflow const):

  • css/CSSProperties.json:
  • css/parser/CSSParserContext.cpp:

(WebCore::operator==):
(WebCore::add):

  • css/parser/CSSParserContext.h:
  • css/parser/CSSParserFastPaths.cpp:

(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):

  • page/FrameView.cpp: handle scrollbars

on viewport element same as overflow: hidden.
(WebCore::FrameView::applyOverflowToViewport):

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::updateFromStyle):
(WebCore::RenderBox::scrollWidth const): overflow clip
forbids all scrolling.
(WebCore::RenderBox::scrollHeight const): Ditto.
(WebCore::RenderBox::setScrollLeft): Ditto.
(WebCore::RenderBox::setScrollTop): Ditto.
(WebCore::RenderBox::setScrollPosition): Ditto.
(WebCore::RenderBox::requiresLayerWithScrollableArea const): do
not create layer with scrollable area for overflow: clip.
(WebCore::RenderBox::canBeProgramaticallyScrolled const): overflow clip
forbids all scrolling.
(WebCore::RenderBox::scrollPosition const): overflow clip
forbids all scrolling.
(WebCore::RenderBox::overflowClipRect const): only clip the rect horizontally
for overflow-x: clip and only vertically for overflow-y: clip.
(WebCore::RenderBox::createsNewFormattingContext const): do
not create formatting context for overflow: clip.
(WebCore::RenderBox::addOverflowFromChild):
(WebCore::RenderBox::addLayoutOverflow):
(WebCore::RenderBox::layoutOverflowRectForPropagation const):

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::enclosingScrollableContainerForSnapping const):

  • rendering/RenderObject.h: Add helper method that excludes overflow-x/y: clip.

(WebCore::RenderObject::hasPotentiallyScrollableOverflow const):

  • rendering/style/RenderStyleConstants.cpp:

(WebCore::operator<<):

  • rendering/style/RenderStyleConstants.h:
  • style/StyleAdjuster.cpp: Add special logic is to handle the case where only

one of overflow-x/overflow-y uses 'clip'.
(WebCore::Style::Adjuster::adjust const):

Source/WTF:

Add preference for overflow: clip support.

  • Scripts/Preferences/WebPreferencesExperimental.yaml:

LayoutTests:

Location:
trunk
Files:
2 added
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r280504 r280509  
     12021-07-30  Rob Buis  <rbuis@igalia.com>
     2
     3        [css-overflow] Implement clip value for overflow
     4        https://bugs.webkit.org/show_bug.cgi?id=198230
     5
     6        Reviewed by Simon Fraser.
     7
     8        * TestExpectations:
     9
    1102021-07-30  Chris Dumez  <cdumez@apple.com>
    211
  • trunk/LayoutTests/TestExpectations

    r280504 r280509  
    46314631webkit.org/b/214458 imported/w3c/web-platform-tests/css/css-multicol/nested-with-too-tall-line.html [ ImageOnlyFailure ]
    46324632
    4633 webkit.org/b/214459 imported/w3c/web-platform-tests/css/css-overflow/clip-001.html [ ImageOnlyFailure ]
    4634 webkit.org/b/214459 imported/w3c/web-platform-tests/css/css-overflow/dynamic-visible-to-clip-001.html [ ImageOnlyFailure ]
    46354633webkit.org/b/214459 imported/w3c/web-platform-tests/css/css-overflow/text-overflow-ellipsis-editing-input.html [ ImageOnlyFailure ]
    46364634webkit.org/b/214459 imported/w3c/web-platform-tests/css/css-overflow/text-overflow-ellipsis-vertical-001.html [ ImageOnlyFailure ]
     
    50955093webkit.org/b/227849 imported/w3c/web-platform-tests/css/css-overflow/overflow-body-propagation-010.html [ Skip ]
    50965094webkit.org/b/227849 imported/w3c/web-platform-tests/css/css-overflow/overflow-body-propagation-011.html [ Skip ]
    5097 webkit.org/b/198230 imported/w3c/web-platform-tests/css/css-overflow/clip-002.html [ Skip ]
    50985095webkit.org/b/198230 imported/w3c/web-platform-tests/css/css-overflow/clip-003.html [ Skip ]
    5099 webkit.org/b/198230 imported/w3c/web-platform-tests/css/css-overflow/clip-004.html [ Skip ]
    5100 webkit.org/b/198230 imported/w3c/web-platform-tests/css/css-overflow/clip-005.html [ Skip ]
    5101 webkit.org/b/198230 imported/w3c/web-platform-tests/css/css-overflow/clip-006.html [ Skip ]
    5102 webkit.org/b/198230 imported/w3c/web-platform-tests/css/css-overflow/clip-007.html [ Skip ]
    5103 webkit.org/b/198230 imported/w3c/web-platform-tests/css/css-overflow/overflow-clip-cant-scroll.html [ Skip ]
    5104 webkit.org/b/198230 imported/w3c/web-platform-tests/css/css-overflow/overflow-clip-content-visual-overflow.html [ Skip ]
    51055096webkit.org/b/198230 imported/w3c/web-platform-tests/css/css-overflow/overflow-clip-margin-intersection-observer.html [ Skip ]
    5106 webkit.org/b/198230 imported/w3c/web-platform-tests/css/css-overflow/overflow-clip-scroll-size.html [ Skip ]
    5107 webkit.org/b/198230 imported/w3c/web-platform-tests/css/css-overflow/overflow-clip-hit-testing.html [ Skip ]
    51085097webkit.org/b/198230 imported/w3c/web-platform-tests/css/css-overflow/overflow-clip-margin-invalidation.html [ Skip ]
    51095098webkit.org/b/198230 imported/w3c/web-platform-tests/css/css-overflow/overflow-clip-margin-001.html [ Skip ]
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r280504 r280509  
     12021-07-30  Rob Buis  <rbuis@igalia.com>
     2
     3        [css-overflow] Implement clip value for overflow
     4        https://bugs.webkit.org/show_bug.cgi?id=198230
     5
     6        Reviewed by Simon Fraser.
     7
     8        * web-platform-tests/css/css-overflow/overflow-clip-hit-testing-expected.txt: Added.
     9        * web-platform-tests/css/css-overflow/overflow-clip-scroll-size-expected.txt: Added.
     10        * web-platform-tests/css/css-overflow/parsing/overflow-computed-expected.txt:
     11        * web-platform-tests/css/css-overflow/parsing/overflow-valid-expected.txt:
     12
    1132021-07-30  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/parsing/overflow-computed-expected.txt

    r279819 r280509  
    22PASS Property overflow value 'visible'
    33PASS Property overflow value 'hidden'
    4 FAIL Property overflow value 'clip' assert_true: 'clip' is a supported value for overflow. expected true got false
     4PASS Property overflow value 'clip'
    55PASS Property overflow value 'scroll'
    66PASS Property overflow value 'auto'
    77PASS Property overflow value 'auto auto'
    8 FAIL Property overflow value 'auto clip' assert_true: 'auto clip' is a supported value for overflow. expected true got false
     8PASS Property overflow value 'auto clip'
    99PASS Property overflow value 'auto visible'
    10 FAIL Property overflow value 'clip auto' assert_true: 'clip auto' is a supported value for overflow. expected true got false
    11 FAIL Property overflow value 'clip clip' assert_true: 'clip clip' is a supported value for overflow. expected true got false
    12 FAIL Property overflow value 'clip hidden' assert_true: 'clip hidden' is a supported value for overflow. expected true got false
    13 FAIL Property overflow value 'clip scroll' assert_true: 'clip scroll' is a supported value for overflow. expected true got false
    14 FAIL Property overflow value 'clip visible' assert_true: 'clip visible' is a supported value for overflow. expected true got false
    15 FAIL Property overflow value 'hidden clip' assert_true: 'hidden clip' is a supported value for overflow. expected true got false
     10PASS Property overflow value 'clip auto'
     11PASS Property overflow value 'clip clip'
     12PASS Property overflow value 'clip hidden'
     13PASS Property overflow value 'clip scroll'
     14PASS Property overflow value 'clip visible'
     15PASS Property overflow value 'hidden clip'
    1616PASS Property overflow value 'hidden visible'
    1717PASS Property overflow value 'scroll auto'
    18 FAIL Property overflow value 'scroll clip' assert_true: 'scroll clip' is a supported value for overflow. expected true got false
     18PASS Property overflow value 'scroll clip'
    1919PASS Property overflow value 'scroll visible'
    2020PASS Property overflow value 'visible auto'
    2121PASS Property overflow value 'visible hidden'
    2222PASS Property overflow value 'visible scroll'
    23 FAIL Property overflow value 'visible clip' assert_true: 'visible clip' is a supported value for overflow. expected true got false
     23PASS Property overflow value 'visible clip'
    2424PASS Property overflow value 'visible visible'
    2525PASS Property overflow-x value 'scroll'
    2626PASS Property overflow-x value 'hidden'
    2727PASS Property overflow-x value 'visible'
    28 FAIL Property overflow-y value 'clip' assert_true: 'clip' is a supported value for overflow-y. expected true got false
     28PASS Property overflow-y value 'clip'
    2929PASS Property overflow-y value 'auto'
    3030PASS Property overflow-y value 'visible'
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/parsing/overflow-valid-expected.txt

    r267650 r280509  
    22PASS e.style['overflow'] = "visible" should set the property value
    33PASS e.style['overflow'] = "hidden" should set the property value
    4 FAIL e.style['overflow'] = "clip" should set the property value assert_not_equals: property should be set got disallowed value ""
     4PASS e.style['overflow'] = "clip" should set the property value
    55PASS e.style['overflow'] = "scroll" should set the property value
    66PASS e.style['overflow'] = "auto" should set the property value
    77PASS e.style['overflow'] = "visible visible" should set the property value
    88PASS e.style['overflow'] = "hidden visible" should set the property value
    9 FAIL e.style['overflow'] = "clip clip" should set the property value assert_not_equals: property should be set got disallowed value ""
     9PASS e.style['overflow'] = "clip clip" should set the property value
    1010PASS e.style['overflow'] = "scroll auto" should set the property value
    1111PASS e.style['overflow'] = "auto auto" should set the property value
    1212PASS e.style['overflow-x'] = "visible" should set the property value
    1313PASS e.style['overflow-x'] = "scroll" should set the property value
    14 FAIL e.style['overflow-y'] = "clip" should set the property value assert_not_equals: property should be set got disallowed value ""
     14PASS e.style['overflow-y'] = "clip" should set the property value
    1515PASS e.style['overflow-y'] = "auto" should set the property value
    1616FAIL e.style['overflow-block'] = "hidden" should set the property value assert_not_equals: property should be set got disallowed value ""
  • trunk/Source/WTF/ChangeLog

    r280504 r280509  
     12021-07-30  Rob Buis  <rbuis@igalia.com>
     2
     3        [css-overflow] Implement clip value for overflow
     4        https://bugs.webkit.org/show_bug.cgi?id=198230
     5
     6        Reviewed by Simon Fraser.
     7
     8        Add preference for overflow: clip support.
     9
     10        * Scripts/Preferences/WebPreferencesExperimental.yaml:
     11
    1122021-07-30  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml

    r280504 r280509  
    745745      default: true
    746746
     747OverflowClipEnabled:
     748  type: bool
     749  humanReadableName: "CSS overflow: clip support"
     750  humanReadableDescription: "Enable CSS overflow: clip support"
     751  defaultValue:
     752    WebKitLegacy:
     753      default: false
     754    WebKit:
     755      default: false
     756    WebCore:
     757      default: false
     758
    747759OverscrollBehaviorEnabled:
    748760  type: bool
  • trunk/Source/WebCore/ChangeLog

    r280504 r280509  
     12021-07-30  Rob Buis  <rbuis@igalia.com>
     2
     3        [css-overflow] Implement clip value for overflow
     4        https://bugs.webkit.org/show_bug.cgi?id=198230
     5
     6        Reviewed by Simon Fraser.
     7
     8        Implement overflow: clip. Parsing is like the other
     9        overflow values but special logic is added to handle
     10        the case where only one of overflow-x/overflow-y uses
     11        'clip' [1]. Also adjusts code that computes layout and
     12        visual overflow to take overflow: clip into account.
     13
     14        This matches Chrome and Firefox.
     15
     16        [1] https://drafts.csswg.org/css-overflow/#propdef-overflow-x
     17
     18        * css/CSSPrimitiveValueMappings.h:
     19        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
     20        (WebCore::CSSPrimitiveValue::operator Overflow const):
     21        * css/CSSProperties.json:
     22        * css/parser/CSSParserContext.cpp:
     23        (WebCore::operator==):
     24        (WebCore::add):
     25        * css/parser/CSSParserContext.h:
     26        * css/parser/CSSParserFastPaths.cpp:
     27        (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
     28        * page/FrameView.cpp: handle scrollbars
     29        on viewport element same as overflow: hidden.
     30        (WebCore::FrameView::applyOverflowToViewport):
     31        * rendering/RenderBox.cpp:
     32        (WebCore::RenderBox::updateFromStyle):
     33        (WebCore::RenderBox::scrollWidth const): overflow clip
     34        forbids all scrolling.
     35        (WebCore::RenderBox::scrollHeight const): Ditto.
     36        (WebCore::RenderBox::setScrollLeft): Ditto.
     37        (WebCore::RenderBox::setScrollTop): Ditto.
     38        (WebCore::RenderBox::setScrollPosition): Ditto.
     39        (WebCore::RenderBox::requiresLayerWithScrollableArea const): do
     40        not create layer with scrollable area for overflow: clip.
     41        (WebCore::RenderBox::canBeProgramaticallyScrolled const): overflow clip
     42        forbids all scrolling.
     43        (WebCore::RenderBox::scrollPosition const): overflow clip
     44        forbids all scrolling.
     45        (WebCore::RenderBox::overflowClipRect const): only clip the rect horizontally
     46        for overflow-x: clip and only vertically for overflow-y: clip.
     47        (WebCore::RenderBox::createsNewFormattingContext const): do
     48        not create formatting context for overflow: clip.
     49        (WebCore::RenderBox::addOverflowFromChild):
     50        (WebCore::RenderBox::addLayoutOverflow):
     51        (WebCore::RenderBox::layoutOverflowRectForPropagation const):
     52        * rendering/RenderObject.cpp:
     53        (WebCore::RenderObject::enclosingScrollableContainerForSnapping const):
     54        * rendering/RenderObject.h: Add helper method that excludes overflow-x/y: clip.
     55        (WebCore::RenderObject::hasPotentiallyScrollableOverflow const):
     56        * rendering/style/RenderStyleConstants.cpp:
     57        (WebCore::operator<<):
     58        * rendering/style/RenderStyleConstants.h:
     59        * style/StyleAdjuster.cpp: Add special logic is to handle the case where only
     60        one of overflow-x/overflow-y uses 'clip'.
     61        (WebCore::Style::Adjuster::adjust const):
     62
    1632021-07-30  Chris Dumez  <cdumez@apple.com>
    264
  • trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h

    r279218 r280509  
    19531953        m_value.valueID = CSSValueWebkitPagedY;
    19541954        break;
     1955    case Overflow::Clip:
     1956        m_value.valueID = CSSValueClip;
     1957        break;
    19551958    }
    19561959}
     
    19741977    case CSSValueWebkitPagedY:
    19751978        return Overflow::PagedY;
     1979    case CSSValueClip:
     1980        return Overflow::Clip;
    19761981    default:
    19771982        break;
  • trunk/Source/WebCore/css/CSSProperties.json

    r279218 r280509  
    36313631                "visible",
    36323632                "hidden",
     3633                "clip",
    36333634                "scroll",
    36343635                "auto"
     
    36433644                "visible",
    36443645                "hidden",
     3646                "clip",
    36453647                "scroll",
    36463648                "auto",
  • trunk/Source/WebCore/css/parser/CSSParserContext.cpp

    r279050 r280509  
    9898    , attachmentEnabled { RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled() }
    9999#endif
     100    , overflowClipEnabled { document.settings().overflowClipEnabled() }
    100101{
    101102}
     
    140141        && a.attachmentEnabled == b.attachmentEnabled
    141142#endif
     143        && a.overflowClipEnabled == b.overflowClipEnabled
    142144    ;
    143145}
     
    176178        | context.attachmentEnabled                         << 22
    177179#endif
    178         | context.mode                                      << 23; // This is multiple bits, so keep it last.
     180        | context.overflowClipEnabled                       << 23
     181        | context.mode                                      << 24; // This is multiple bits, so keep it last.
    179182    add(hasher, context.baseURL, context.charset, bits);
    180183}
  • trunk/Source/WebCore/css/parser/CSSParserContext.h

    r279050 r280509  
    8888#endif
    8989
     90    bool overflowClipEnabled { false };
     91
    9092    CSSParserContext(CSSParserMode, const URL& baseURL = URL());
    9193    WEBCORE_EXPORT CSSParserContext(const Document&, const URL& baseURL = URL(), const String& charset = emptyString());
  • trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp

    r280316 r280509  
    675675        return valueID == CSSValueNormal || valueID == CSSValueBreakWord;
    676676    case CSSPropertyOverflowX: // visible | hidden | scroll | auto | overlay (overlay is a synonym for auto)
     677        if (context.overflowClipEnabled && valueID == CSSValueClip)
     678            return true;
    677679        return valueID == CSSValueVisible || valueID == CSSValueHidden || valueID == CSSValueScroll || valueID == CSSValueAuto || valueID == CSSValueOverlay;
    678680    case CSSPropertyOverflowY: // visible | hidden | scroll | auto | overlay | -webkit-paged-x | -webkit-paged-y (overlay is a synonym for auto)
     681        if (context.overflowClipEnabled && valueID == CSSValueClip)
     682            return true;
    679683        return valueID == CSSValueVisible || valueID == CSSValueHidden || valueID == CSSValueScroll || valueID == CSSValueAuto || valueID == CSSValueOverlay || valueID == CSSValueWebkitPagedX || valueID == CSSValueWebkitPagedY;
    680684    case CSSPropertyOverscrollBehaviorX:
  • trunk/Source/WebCore/page/FrameView.cpp

    r280306 r280509  
    650650    switch (overflowX) {
    651651    case Overflow::Hidden:
     652    case Overflow::Clip:
    652653        if (overrideHidden)
    653654            hMode = ScrollbarAuto;
     
    668669    switch (overflowY) {
    669670    case Overflow::Hidden:
     671    case Overflow::Clip:
    670672        if (overrideHidden)
    671673            vMode = ScrollbarAuto;
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r280075 r280509  
    483483
    484484    // We also handle <body> and <html>, whose overflow applies to the viewport.
    485     if (styleToUse.overflowX() != Overflow::Visible && !isDocElementRenderer && isRenderBlock()) {
     485    if (!(styleToUse.overflowX() == Overflow::Visible && styleToUse.overflowY() == Overflow::Visible) && !isDocElementRenderer && isRenderBlock()) {
    486486        bool boxHasNonVisibleOverflow = true;
    487487        if (isBody()) {
     
    549549int RenderBox::scrollWidth() const
    550550{
    551     if (hasNonVisibleOverflow() && layer())
     551    if (hasPotentiallyScrollableOverflow() && layer())
    552552        return layer()->scrollWidth();
    553553    // For objects with visible overflow, this matches IE.
     
    562562int RenderBox::scrollHeight() const
    563563{
    564     if (hasNonVisibleOverflow() && layer())
     564    if (hasPotentiallyScrollableOverflow() && layer())
    565565        return layer()->scrollHeight();
    566566    // For objects with visible overflow, this matches IE.
     
    598598void RenderBox::setScrollLeft(int newLeft, const ScrollPositionChangeOptions& options)
    599599{
    600     if (!hasNonVisibleOverflow() || !layer())
     600    if (!hasPotentiallyScrollableOverflow() || !layer())
    601601        return;
    602602    auto* scrollableArea = layer()->scrollableArea();
     
    608608void RenderBox::setScrollTop(int newTop, const ScrollPositionChangeOptions& options)
    609609{
    610     if (!hasNonVisibleOverflow() || !layer())
     610    if (!hasPotentiallyScrollableOverflow() || !layer())
    611611        return;
    612612    auto* scrollableArea = layer()->scrollableArea();
     
    618618void RenderBox::setScrollPosition(const ScrollPosition& position, const ScrollPositionChangeOptions& options)
    619619{
    620     if (!hasNonVisibleOverflow() || !layer())
     620    if (!hasPotentiallyScrollableOverflow() || !layer())
    621621        return;
    622622    auto* scrollableArea = layer()->scrollableArea();
     
    959959        return true;
    960960
    961     if (hasNonVisibleOverflow())
     961    if (hasPotentiallyScrollableOverflow())
    962962        return true;
    963963
     
    977977        return true;
    978978
    979     if (!hasNonVisibleOverflow())
     979    if (!hasPotentiallyScrollableOverflow())
    980980        return false;
    981981
     
    10991099ScrollPosition RenderBox::scrollPosition() const
    11001100{
    1101     if (!hasNonVisibleOverflow())
     1101    if (!hasPotentiallyScrollableOverflow())
    11021102        return { 0, 0 };
    11031103
     
    20432043LayoutRect RenderBox::overflowClipRect(const LayoutPoint& location, RenderFragmentContainer* fragment, OverlayScrollbarSizeRelevancy relevancy, PaintPhase) const
    20442044{
    2045     // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the property
    2046     // here.
    20472045    LayoutRect clipRect = borderBoxRectInFragment(fragment);
    20482046    clipRect.setLocation(location + clipRect.location() + LayoutSize(borderLeft(), borderTop()));
    20492047    clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(), borderTop() + borderBottom()));
     2048    if (style().overflowX() == Overflow::Clip && style().overflowY() == Overflow::Visible) {
     2049        LayoutRect infRect = LayoutRect::infiniteRect();
     2050        clipRect.setY(infRect.y());
     2051        clipRect.setHeight(infRect.height());
     2052    } else if (style().overflowY() == Overflow::Clip && style().overflowX() == Overflow::Visible) {
     2053        LayoutRect infRect = LayoutRect::infiniteRect();
     2054        clipRect.setX(infRect.x());
     2055        clipRect.setWidth(infRect.width());
     2056    }
    20502057
    20512058    // Subtract out scrollbars if we have them.
     
    48044811bool RenderBox::createsNewFormattingContext() const
    48054812{
    4806     return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() || hasNonVisibleOverflow() || isFlexItemIncludingDeprecated()
     4813    return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() || hasPotentiallyScrollableOverflow() || isFlexItemIncludingDeprecated()
    48074814        || isTableCell() || isTableCaption() || isFieldset() || isWritingModeRoot() || isDocumentElementRenderer() || isRenderFragmentedFlow() || isRenderFragmentContainer()
    48084815        || style().containsLayout() || isGridItem() || style().specifiesColumns() || style().columnSpan() == ColumnSpan::All || style().display() == DisplayType::FlowRoot;
     
    48924899    // have visual overflow of its own set from box shadows or reflections. It is unnecessary to propagate this
    48934900    // overflow if we are clipping our own overflow.
    4894     if (child->hasSelfPaintingLayer() || hasNonVisibleOverflow())
     4901    if (child->hasSelfPaintingLayer() || hasPotentiallyScrollableOverflow())
    48954902        return;
    48964903    LayoutRect childVisualOverflowRect = child->visualOverflowRectForPropagation(&style());
     
    49074914    // For overflow clip objects, we don't want to propagate overflow into unreachable areas.
    49084915    LayoutRect overflowRect(rect);
    4909     if (hasNonVisibleOverflow() || isRenderView()) {
     4916    if (hasPotentiallyScrollableOverflow() || isRenderView()) {
    49104917        // Overflow is in the block's coordinate space and thus is flipped for horizontal-bt and vertical-rl
    49114918        // writing modes. At this stage that is actually a simplification, since we can treat horizontal-tb/bt as the same
     
    50525059LayoutRect RenderBox::layoutOverflowRectForPropagation(const RenderStyle* parentStyle) const
    50535060{
    5054     // Only propagate interior layout overflow if we don't clip it.
     5061    // Only propagate interior layout overflow if we don't completely clip it.
    50555062    LayoutRect rect = borderBoxRect();
    5056     if (!shouldApplyLayoutContainment(*this) && !hasNonVisibleOverflow())
    5057         rect.unite(layoutOverflowRect());
     5063    if (!shouldApplyLayoutContainment(*this)) {
     5064        if (style().overflowX() == Overflow::Clip && style().overflowY() == Overflow::Visible) {
     5065            LayoutRect clippedOverflowRect = layoutOverflowRect();
     5066            clippedOverflowRect.setX(rect.x());
     5067            clippedOverflowRect.setWidth(rect.width());
     5068            rect.unite(clippedOverflowRect);
     5069        } else if (style().overflowY() == Overflow::Clip && style().overflowX() == Overflow::Visible) {
     5070            LayoutRect clippedOverflowRect = layoutOverflowRect();
     5071            clippedOverflowRect.setY(rect.y());
     5072            clippedOverflowRect.setHeight(rect.height());
     5073            rect.unite(clippedOverflowRect);
     5074        } else if (!hasNonVisibleOverflow())
     5075            rect.unite(layoutOverflowRect());
     5076    }
    50585077
    50595078    bool hasTransform = this->hasTransform();
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r279958 r280509  
    482482        if (candidate->isRenderView())
    483483            break;
    484         if (candidate->hasNonVisibleOverflow())
     484        if (candidate->hasPotentiallyScrollableOverflow())
    485485            return downcast<RenderBox>(candidate);
    486486    }
  • trunk/Source/WebCore/rendering/RenderObject.h

    r279918 r280509  
    437437
    438438    bool hasNonVisibleOverflow() const { return m_bitfields.hasNonVisibleOverflow(); }
     439
     440    bool hasPotentiallyScrollableOverflow() const;
    439441
    440442    bool hasTransformRelatedProperty() const { return m_bitfields.hasTransformRelatedProperty(); } // Transform, perspective or transform-style: preserve-3d.
     
    11881190}
    11891191
     1192inline bool RenderObject::hasPotentiallyScrollableOverflow() const
     1193{
     1194    // We only need to test one overflow dimension since 'visible' and 'clip' always get accompanied
     1195    // with 'clip' or 'visible' in the other dimension (see Style::Adjuster::adjust).
     1196    return hasNonVisibleOverflow() && style().overflowX() != Overflow::Clip && style().overflowX() != Overflow::Visible;
     1197}
     1198
    11901199WTF::TextStream& operator<<(WTF::TextStream&, const RenderObject&);
    11911200
  • trunk/Source/WebCore/rendering/style/RenderStyleConstants.cpp

    r279941 r280509  
    803803    case Overflow::PagedX: ts << "paged-x"; break;
    804804    case Overflow::PagedY: ts << "paged-y"; break;
     805    case Overflow::Clip: ts << "clip"; break;
    805806    }
    806807    return ts;
  • trunk/Source/WebCore/rendering/style/RenderStyleConstants.h

    r279218 r280509  
    276276    Visible,
    277277    Hidden,
     278    Clip,
    278279    Scroll,
    279280    Auto,
  • trunk/Source/WebCore/style/StyleAdjuster.cpp

    r278698 r280509  
    413413        style.setTextDecorationsInEffect(style.textDecoration());
    414414
    415     // If either overflow value is not visible, change to auto.
    416     if (style.overflowX() == Overflow::Visible && style.overflowY() != Overflow::Visible) {
    417         // FIXME: Once we implement pagination controls, overflow-x should default to hidden
    418         // if overflow-y is set to -webkit-paged-x or -webkit-page-y. For now, we'll let it
    419         // default to auto so we can at least scroll through the pages.
    420         style.setOverflowX(Overflow::Auto);
    421     } else if (style.overflowY() == Overflow::Visible && style.overflowX() != Overflow::Visible)
    422         style.setOverflowY(Overflow::Auto);
     415    auto overflowReplacement = [] (Overflow overflow, Overflow overflowInOtherDimension) -> std::optional<Overflow> {
     416        if (overflow != Overflow::Visible && overflow != Overflow::Clip) {
     417            if (overflowInOtherDimension == Overflow::Visible)
     418                return Overflow::Auto;
     419            if (overflowInOtherDimension == Overflow::Clip)
     420                return Overflow::Hidden;
     421        }
     422        return std::nullopt;
     423    };
     424
     425    // If either overflow value is not visible, change to auto. Similarly if either overflow
     426    // value is not clip, change to hidden.
     427    // FIXME: Once we implement pagination controls, overflow-x should default to hidden
     428    // if overflow-y is set to -webkit-paged-x or -webkit-page-y. For now, we'll let it
     429    // default to auto so we can at least scroll through the pages.
     430    if (auto replacement = overflowReplacement(style.overflowY(), style.overflowX()))
     431        style.setOverflowX(*replacement);
     432    else if (auto replacement = overflowReplacement(style.overflowX(), style.overflowY()))
     433        style.setOverflowY(*replacement);
    423434
    424435    // Call setStylesForPaginationMode() if a pagination mode is set for any non-root elements. If these
Note: See TracChangeset for help on using the changeset viewer.