Skip to content

Commit

Permalink
Cherry-pick 259548.465@safari-7615-branch (cf0b343). rdar://104064235
Browse files Browse the repository at this point in the history
    Increase max scrollbar update passes
    rdar://104064235

    Reviewed by Simon Fraser.

    Scrollbars are not fully updated in a single layout which
    can lead to an additional layout in the scriptDisallowedScope
    in FrameView::scrollRectToVisibleInChildView.

    * LayoutTests/fast/editing/frame-selection-in-child-view-crash-expected.txt: Added.
    * LayoutTests/fast/editing/frame-selection-in-child-view-crash.html: Added.
    * Source/WebCore/platform/ScrollView.cpp:
    (WebCore::ScrollView::updateScrollbars):

    * Tools/TestWebKitAPI/Tests/WebKitCocoa/CSSViewportUnits.mm:
    (TEST):
    Add scrollbarSize to width in WritingMode tests because we should
    expect vertical overflow in these cases. This test would pass prior
    to this patch despite the displayed WebView having both a vertical
    and horizontal scroll bar.

    Canonical link: https://commits.webkit.org/259548.465@safari-7615-branch
  • Loading branch information
jace0x21 authored and aperezdc committed May 22, 2023
1 parent cbdc482 commit dda2fc0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
@@ -0,0 +1 @@
This test passes if it does not crash
19 changes: 19 additions & 0 deletions LayoutTests/fast/editing/frame-selection-in-child-view-crash.html
@@ -0,0 +1,19 @@
<style>
body {
width: 0vmin;
overflow-y: -webkit-paged-x;
}
</style>
<script>
if (window.testRunner)
testRunner.dumpAsText();
function main() {
x1.src = window.location;
x1.height = "10";
window.find("crash", false, false);
}
</script>

<body onload=main()>
<embed id="x1">This test passes if it does not crash</embed>
</body>
2 changes: 1 addition & 1 deletion Source/WebCore/platform/ScrollView.cpp
Expand Up @@ -711,7 +711,7 @@ void ScrollView::updateScrollbars(const ScrollPosition& desiredPosition)
}
}

const unsigned cMaxUpdateScrollbarsPass = 2;
const unsigned cMaxUpdateScrollbarsPass = 3;
if ((sendContentResizedNotification || needAnotherPass) && m_updateScrollbarsPass < cMaxUpdateScrollbarsPass) {
m_updateScrollbarsPass++;
availableContentSizeChanged(AvailableSizeChangeReason::ScrollbarsChanged);
Expand Down
4 changes: 2 additions & 2 deletions Tools/TestWebKitAPI/Tests/WebKitCocoa/CSSViewportUnits.mm
Expand Up @@ -499,7 +499,7 @@ static void changeCSSPropertyOfElements(RetainPtr<TestWKWebView>& webView, NSStr
EXPECT_FLOAT_EQ(458, viewportUnitLength(webView, @"lvi"));

{
double fixedWidth = widthOfElementWithID(webView, @"fixed"); // No vertical overflow.
double fixedWidth = widthOfElementWithID(webView, @"fixed") + scrollbarSize;
double fixedHeight = heightOfElementWithID(webView, @"fixed") + scrollbarSize;
EXPECT_FLOAT_EQ(fixedWidth, viewportUnitLength(webView, @"dvw"));
EXPECT_FLOAT_EQ(fixedHeight, viewportUnitLength(webView, @"dvh"));
Expand Down Expand Up @@ -576,7 +576,7 @@ static void changeCSSPropertyOfElements(RetainPtr<TestWKWebView>& webView, NSStr
EXPECT_FLOAT_EQ(500, viewportUnitLength(webView, @"lvi"));

{
double fixedWidth = widthOfElementWithID(webView, @"fixed"); // No vertical overflow.
double fixedWidth = widthOfElementWithID(webView, @"fixed") + scrollbarSize;
double fixedHeight = heightOfElementWithID(webView, @"fixed") + scrollbarSize;
EXPECT_FLOAT_EQ(fixedWidth, viewportUnitLength(webView, @"dvw"));
EXPECT_FLOAT_EQ(fixedHeight, viewportUnitLength(webView, @"dvh"));
Expand Down

0 comments on commit dda2fc0

Please sign in to comment.