Title: [277193] branches/safari-611-branch
Revision
277193
Author
repst...@apple.com
Date
2021-05-07 11:48:46 -0700 (Fri, 07 May 2021)

Log Message

Cherry-pick r276739. rdar://problem/77581103

    Don't create custom scrollbars for fullscreen placeholders.
    https://bugs.webkit.org/show_bug.cgi?id=225141
    Source/WebCore:

    <rdar://64800098>

    Reviewed by Darin Adler.

    We can end up calling RenderScrollbar::createCustomScrollbar with
    `element = nullptr` from RenderLayer::createScrollbar,
    when the renderer is a RenderFullscreenPlaceholder.

    We don't need to bother with scrollbars for the placeholder, so check to
    make sure we have a valid element before creating custom scollbars.

    Test: fullscreen/full-screen-crash-custom-scrollbars.html

    * rendering/RenderLayer.cpp:
    (WebCore::RenderLayer::createScrollbar):

    LayoutTests:

    Reviewed by Darin Adler.

    * fullscreen/full-screen-crash-custom-scrollbars-expected.txt: Added.
    * fullscreen/full-screen-crash-custom-scrollbars.html: Added.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276739 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-611-branch/LayoutTests/ChangeLog (277192 => 277193)


--- branches/safari-611-branch/LayoutTests/ChangeLog	2021-05-07 18:48:40 UTC (rev 277192)
+++ branches/safari-611-branch/LayoutTests/ChangeLog	2021-05-07 18:48:46 UTC (rev 277193)
@@ -1,5 +1,48 @@
 2021-05-07  Russell Epstein  <repst...@apple.com>
 
+        Cherry-pick r276739. rdar://problem/77581103
+
+    Don't create custom scrollbars for fullscreen placeholders.
+    https://bugs.webkit.org/show_bug.cgi?id=225141
+    Source/WebCore:
+    
+    <rdar://64800098>
+    
+    Reviewed by Darin Adler.
+    
+    We can end up calling RenderScrollbar::createCustomScrollbar with
+    `element = nullptr` from RenderLayer::createScrollbar,
+    when the renderer is a RenderFullscreenPlaceholder.
+    
+    We don't need to bother with scrollbars for the placeholder, so check to
+    make sure we have a valid element before creating custom scollbars.
+    
+    Test: fullscreen/full-screen-crash-custom-scrollbars.html
+    
+    * rendering/RenderLayer.cpp:
+    (WebCore::RenderLayer::createScrollbar):
+    
+    LayoutTests:
+    
+    Reviewed by Darin Adler.
+    
+    * fullscreen/full-screen-crash-custom-scrollbars-expected.txt: Added.
+    * fullscreen/full-screen-crash-custom-scrollbars.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276739 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-04-28  Cameron McCormack  <hey...@apple.com>
+
+            Don't create custom scrollbars for fullscreen placeholders.
+            https://bugs.webkit.org/show_bug.cgi?id=225141
+
+            Reviewed by Darin Adler.
+
+            * fullscreen/full-screen-crash-custom-scrollbars-expected.txt: Added.
+            * fullscreen/full-screen-crash-custom-scrollbars.html: Added.
+
+2021-05-07  Russell Epstein  <repst...@apple.com>
+
         Cherry-pick r276627. rdar://problem/77580982
 
     Create a containing block when relevant properties are set in the current element will-change

Added: branches/safari-611-branch/LayoutTests/fullscreen/full-screen-crash-custom-scrollbars-expected.txt (0 => 277193)


--- branches/safari-611-branch/LayoutTests/fullscreen/full-screen-crash-custom-scrollbars-expected.txt	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fullscreen/full-screen-crash-custom-scrollbars-expected.txt	2021-05-07 18:48:46 UTC (rev 277193)
@@ -0,0 +1,4 @@
+Passes if the test does not crash.
+
+END OF TEST
+

Added: branches/safari-611-branch/LayoutTests/fullscreen/full-screen-crash-custom-scrollbars.html (0 => 277193)


--- branches/safari-611-branch/LayoutTests/fullscreen/full-screen-crash-custom-scrollbars.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fullscreen/full-screen-crash-custom-scrollbars.html	2021-05-07 18:48:46 UTC (rev 277193)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<style>
+div { width: 100px; height: 100px; overflow: scroll; background-color: #ccc; }
+div::-webkit-scrollbar { width: 20px; height: 20px; background-color: yellow; }
+</style>
+<p>Passes if the test does not crash.</p>
+<div id=div></div>
+<script src=""
+<script>
+document.addEventListener("webkitfullscreenchange", endTest, { once: true });
+runWithKeyDown(() => div.webkitRequestFullScreen());
+</script>

Modified: branches/safari-611-branch/Source/WebCore/ChangeLog (277192 => 277193)


--- branches/safari-611-branch/Source/WebCore/ChangeLog	2021-05-07 18:48:40 UTC (rev 277192)
+++ branches/safari-611-branch/Source/WebCore/ChangeLog	2021-05-07 18:48:46 UTC (rev 277193)
@@ -1,5 +1,58 @@
 2021-05-07  Russell Epstein  <repst...@apple.com>
 
+        Cherry-pick r276739. rdar://problem/77581103
+
+    Don't create custom scrollbars for fullscreen placeholders.
+    https://bugs.webkit.org/show_bug.cgi?id=225141
+    Source/WebCore:
+    
+    <rdar://64800098>
+    
+    Reviewed by Darin Adler.
+    
+    We can end up calling RenderScrollbar::createCustomScrollbar with
+    `element = nullptr` from RenderLayer::createScrollbar,
+    when the renderer is a RenderFullscreenPlaceholder.
+    
+    We don't need to bother with scrollbars for the placeholder, so check to
+    make sure we have a valid element before creating custom scollbars.
+    
+    Test: fullscreen/full-screen-crash-custom-scrollbars.html
+    
+    * rendering/RenderLayer.cpp:
+    (WebCore::RenderLayer::createScrollbar):
+    
+    LayoutTests:
+    
+    Reviewed by Darin Adler.
+    
+    * fullscreen/full-screen-crash-custom-scrollbars-expected.txt: Added.
+    * fullscreen/full-screen-crash-custom-scrollbars.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276739 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-04-28  Cameron McCormack  <hey...@apple.com>
+
+            Don't create custom scrollbars for fullscreen placeholders.
+            https://bugs.webkit.org/show_bug.cgi?id=225141
+            <rdar://64800098>
+
+            Reviewed by Darin Adler.
+
+            We can end up calling RenderScrollbar::createCustomScrollbar with
+            `element = nullptr` from RenderLayerScrollableArea::createScrollbar,
+            when the renderer is a RenderFullscreenPlaceholder.
+
+            We don't need to bother with scrollbars for the placeholder, so check to
+            make sure we have a valid element before creating custom scollbars.
+
+            Test: fullscreen/full-screen-crash-custom-scrollbars.html
+
+            * rendering/RenderLayerScrollableArea.cpp:
+            (WebCore::RenderLayerScrollableArea::createScrollbar):
+
+2021-05-07  Russell Epstein  <repst...@apple.com>
+
         Cherry-pick r276627. rdar://problem/77580982
 
     Create a containing block when relevant properties are set in the current element will-change

Modified: branches/safari-611-branch/Source/WebCore/rendering/RenderLayer.cpp (277192 => 277193)


--- branches/safari-611-branch/Source/WebCore/rendering/RenderLayer.cpp	2021-05-07 18:48:40 UTC (rev 277192)
+++ branches/safari-611-branch/Source/WebCore/rendering/RenderLayer.cpp	2021-05-07 18:48:46 UTC (rev 277193)
@@ -3509,8 +3509,9 @@
     ASSERT(rendererForScrollbar(renderer()));
     auto& actualRenderer = *rendererForScrollbar(renderer());
     bool hasCustomScrollbarStyle = is<RenderBox>(actualRenderer) && downcast<RenderBox>(actualRenderer).style().hasPseudoStyle(PseudoId::Scrollbar);
-    if (hasCustomScrollbarStyle)
-        widget = RenderScrollbar::createCustomScrollbar(*this, orientation, downcast<RenderBox>(actualRenderer).element());
+    auto element = downcast<RenderBox>(actualRenderer).element();
+    if (hasCustomScrollbarStyle && element)
+        widget = RenderScrollbar::createCustomScrollbar(*this, orientation, element);
     else {
         widget = Scrollbar::createNativeScrollbar(*this, orientation, ScrollbarControlSize::Regular);
         didAddScrollbar(widget.get(), orientation);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to