Title: [227011] trunk
Revision
227011
Author
[email protected]
Date
2018-01-16 17:34:42 -0800 (Tue, 16 Jan 2018)

Log Message

Can't scroll iframe after toggling it to display:none and back
https://bugs.webkit.org/show_bug.cgi?id=181708
rdar://problem/13234778

Reviewed by Tim Horton.

Source/WebCore:

Nothing updated the FrameView's set of scrollable areas when a subframe came back from display:none.
Mirror the existing virtual removeChild() by making addChild() virtual, and using it to mark
the FrameView's scrollable area set as dirty.

Test: tiled-drawing/scrolling/non-fast-region/non-fast-scrollable-region-hide-show-iframe.html

* page/FrameView.cpp:
(WebCore::FrameView::addChild):
* page/FrameView.h:
* platform/ScrollView.h:

LayoutTests:

* tiled-drawing/scrolling/non-fast-region/non-fast-scrollable-region-hide-show-iframe-expected.txt: Added.
* tiled-drawing/scrolling/non-fast-region/non-fast-scrollable-region-hide-show-iframe.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (227010 => 227011)


--- trunk/LayoutTests/ChangeLog	2018-01-17 00:49:56 UTC (rev 227010)
+++ trunk/LayoutTests/ChangeLog	2018-01-17 01:34:42 UTC (rev 227011)
@@ -1,3 +1,14 @@
+2018-01-16  Simon Fraser  <[email protected]>
+
+        Can't scroll iframe after toggling it to display:none and back
+        https://bugs.webkit.org/show_bug.cgi?id=181708
+        rdar://problem/13234778
+
+        Reviewed by Tim Horton.
+
+        * tiled-drawing/scrolling/non-fast-region/non-fast-scrollable-region-hide-show-iframe-expected.txt: Added.
+        * tiled-drawing/scrolling/non-fast-region/non-fast-scrollable-region-hide-show-iframe.html: Added.
+
 2018-01-16  Jer Noble  <[email protected]>
 
         Reset MediaSourcePrivateAVFObjC's m_sourceBufferWithSelectedVideo when the underlying SourceBufferPrivate is removed.

Added: trunk/LayoutTests/tiled-drawing/scrolling/non-fast-region/non-fast-scrollable-region-hide-show-iframe-expected.txt (0 => 227011)


--- trunk/LayoutTests/tiled-drawing/scrolling/non-fast-region/non-fast-scrollable-region-hide-show-iframe-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/tiled-drawing/scrolling/non-fast-region/non-fast-scrollable-region-hide-show-iframe-expected.txt	2018-01-17 01:34:42 UTC (rev 227011)
@@ -0,0 +1,5 @@
+
+before: 10, 10 - 310, 160
+after hide: 
+after show: 10, 10 - 310, 160
+

Added: trunk/LayoutTests/tiled-drawing/scrolling/non-fast-region/non-fast-scrollable-region-hide-show-iframe.html (0 => 227011)


--- trunk/LayoutTests/tiled-drawing/scrolling/non-fast-region/non-fast-scrollable-region-hide-show-iframe.html	                        (rev 0)
+++ trunk/LayoutTests/tiled-drawing/scrolling/non-fast-region/non-fast-scrollable-region-hide-show-iframe.html	2018-01-17 01:34:42 UTC (rev 227011)
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+    if (window.testRunner)
+        testRunner.waitUntilDone();
+
+    function dumpRegion(prefix)
+    {
+        if (window.internals) {
+            var rects = window.internals.nonFastScrollableRects();
+            document.getElementById('output').textContent += prefix + rectsAsString(rects) + '\n';
+        }
+    }
+
+    function doTest()
+    {
+        var frame = document.getElementById('frame');
+        dumpRegion('before: ');
+        frame.style.display = 'none';
+        dumpRegion('after hide: ');
+        
+        setTimeout(function() {
+            frame.style.display = 'inline';
+            dumpRegion('after show: ');
+
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }, 0);
+    }
+    window.addEventListener('load', doTest, false);
+</script>
+</head>
+<body>
+<iframe id="frame" srcdoc="<html><body style='width:1000px;height:1000px;'></body></html>"></iframe>
+<pre id="output"></pre>
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (227010 => 227011)


--- trunk/Source/WebCore/ChangeLog	2018-01-17 00:49:56 UTC (rev 227010)
+++ trunk/Source/WebCore/ChangeLog	2018-01-17 01:34:42 UTC (rev 227011)
@@ -1,3 +1,22 @@
+2018-01-16  Simon Fraser  <[email protected]>
+
+        Can't scroll iframe after toggling it to display:none and back
+        https://bugs.webkit.org/show_bug.cgi?id=181708
+        rdar://problem/13234778
+
+        Reviewed by Tim Horton.
+
+        Nothing updated the FrameView's set of scrollable areas when a subframe came back from display:none.
+        Mirror the existing virtual removeChild() by making addChild() virtual, and using it to mark
+        the FrameView's scrollable area set as dirty.
+
+        Test: tiled-drawing/scrolling/non-fast-region/non-fast-scrollable-region-hide-show-iframe.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::addChild):
+        * page/FrameView.h:
+        * platform/ScrollView.h:
+
 2018-01-16  Chris Dumez  <[email protected]>
 
         SWServerWorker::m_contextConnectionIdentifier may get out of date

Modified: trunk/Source/WebCore/page/FrameView.cpp (227010 => 227011)


--- trunk/Source/WebCore/page/FrameView.cpp	2018-01-17 00:49:56 UTC (rev 227010)
+++ trunk/Source/WebCore/page/FrameView.cpp	2018-01-17 01:34:42 UTC (rev 227011)
@@ -4645,6 +4645,14 @@
 #endif
 }
 
+void FrameView::addChild(Widget& widget)
+{
+    if (is<FrameView>(widget))
+        addScrollableArea(&downcast<FrameView>(widget));
+
+    ScrollView::addChild(widget);
+}
+
 void FrameView::removeChild(Widget& widget)
 {
     if (is<FrameView>(widget))

Modified: trunk/Source/WebCore/page/FrameView.h (227010 => 227011)


--- trunk/Source/WebCore/page/FrameView.h	2018-01-17 00:49:56 UTC (rev 227010)
+++ trunk/Source/WebCore/page/FrameView.h	2018-01-17 01:34:42 UTC (rev 227011)
@@ -521,7 +521,8 @@
     bool containsScrollableArea(ScrollableArea*) const;
     const ScrollableAreaSet* scrollableAreas() const { return m_scrollableAreas.get(); }
 
-    void removeChild(Widget&) final;
+    WEBCORE_EXPORT void addChild(Widget&) final;
+    WEBCORE_EXPORT void removeChild(Widget&) final;
 
     // This function exists for ports that need to handle wheel events manually.
     // On Mac WebKit1 the underlying NSScrollView just does the scrolling, but on most other platforms

Modified: trunk/Source/WebCore/platform/ScrollView.h (227010 => 227011)


--- trunk/Source/WebCore/platform/ScrollView.h	2018-01-17 00:49:56 UTC (rev 227010)
+++ trunk/Source/WebCore/platform/ScrollView.h	2018-01-17 01:34:42 UTC (rev 227011)
@@ -87,8 +87,8 @@
 
     // Functions for child manipulation and inspection.
     const HashSet<Ref<Widget>>& children() const { return m_children; }
-    WEBCORE_EXPORT void addChild(Widget&);
-    virtual void removeChild(Widget&);
+    WEBCORE_EXPORT virtual void addChild(Widget&);
+    WEBCORE_EXPORT virtual void removeChild(Widget&);
 
     // If the scroll view does not use a native widget, then it will have cross-platform Scrollbars. These functions
     // can be used to obtain those scrollbars.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to