Title: [276739] trunk
Revision
276739
Author
[email protected]
Date
2021-04-28 16:00:57 -0700 (Wed, 28 Apr 2021)

Log Message

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 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):

LayoutTests:

Reviewed by Darin Adler.

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

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (276738 => 276739)


--- trunk/LayoutTests/ChangeLog	2021-04-28 22:50:59 UTC (rev 276738)
+++ trunk/LayoutTests/ChangeLog	2021-04-28 23:00:57 UTC (rev 276739)
@@ -1,3 +1,13 @@
+2021-04-28  Cameron McCormack  <[email protected]>
+
+        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-04-28  Chris Dumez  <[email protected]>
 
         REGRESSION(r276689): [ iOS wk2 ] platform/ios/ios/storage/domstorage/5mb-quota.html is a constant text failure

Added: trunk/LayoutTests/fullscreen/full-screen-crash-custom-scrollbars-expected.txt (0 => 276739)


--- trunk/LayoutTests/fullscreen/full-screen-crash-custom-scrollbars-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fullscreen/full-screen-crash-custom-scrollbars-expected.txt	2021-04-28 23:00:57 UTC (rev 276739)
@@ -0,0 +1,4 @@
+Passes if the test does not crash.
+
+END OF TEST
+

Added: trunk/LayoutTests/fullscreen/full-screen-crash-custom-scrollbars.html (0 => 276739)


--- trunk/LayoutTests/fullscreen/full-screen-crash-custom-scrollbars.html	                        (rev 0)
+++ trunk/LayoutTests/fullscreen/full-screen-crash-custom-scrollbars.html	2021-04-28 23:00:57 UTC (rev 276739)
@@ -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: trunk/Source/WebCore/ChangeLog (276738 => 276739)


--- trunk/Source/WebCore/ChangeLog	2021-04-28 22:50:59 UTC (rev 276738)
+++ trunk/Source/WebCore/ChangeLog	2021-04-28 23:00:57 UTC (rev 276739)
@@ -1,3 +1,23 @@
+2021-04-28  Cameron McCormack  <[email protected]>
+
+        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-04-28  Chris Dumez  <[email protected]>
 
         Make sure we invalidate the iterator in StorageMap::clear()

Modified: trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp (276738 => 276739)


--- trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp	2021-04-28 22:50:59 UTC (rev 276738)
+++ trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp	2021-04-28 23:00:57 UTC (rev 276739)
@@ -818,8 +818,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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to