Correctly set the "inWindow" flag for TileControllers that aren't the page tiles...
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Feb 2017 01:53:38 +0000 (01:53 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Feb 2017 01:53:38 +0000 (01:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=167774

Reviewed by Tim Horton.
Source/WebCore:

RenderLayerBacking had some very confusing "usingTiledCacheLayer" uses.

Its member variable, m_usingTiledCacheLayer, really meant "m_isMainFrameLayerWithTiledBacking" so make it so.
It had a usingTiledBacking(), which returned the same thing, which this patch replaces with isMainFrameLayerWithTiledBacking().

The fact that usingTiledBacking() was only true for the page tiled layer tripped up
RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants(), which would only ever call setIsInWindow()
on the page tiled layer. These changes fix that.

Also make a way for tests to unparent the web view via UIScriptController, and dump out the "in window"
status of TileBackings when dumping tile caches.

Test: tiled-drawing/tiled-backing-in-window.html

* platform/graphics/TiledBacking.h:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::dumpAdditionalProperties):
* platform/graphics/ca/TileController.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::RenderLayerBacking):
(WebCore::computePageTiledBackingCoverage):
(WebCore::RenderLayerBacking::adjustTiledBackingCoverage):
(WebCore::RenderLayerBacking::setTiledBackingHasMargins):
(WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
(WebCore::RenderLayerBacking::shouldClipCompositedBounds):
(WebCore::RenderLayerBacking::updateDescendantClippingLayer):
(WebCore::RenderLayerBacking::updateRootLayerConfiguration):
(WebCore::RenderLayerBacking::paintsIntoWindow):
(WebCore::computeTileCoverage): Deleted.
* rendering/RenderLayerBacking.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::flushPendingLayerChanges):
(WebCore::RenderLayerCompositor::rootFixedBackgroundsChanged):
(WebCore::RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants):
(WebCore::RenderLayerCompositor::supportsFixedRootBackgroundCompositing):
(WebCore::RenderLayerCompositor::documentUsesTiledBacking):

Tools:

Implement UIScriptController removeViewFromWindow() and addViewToWindow(), and hook
up for Mac WK1 and WK2, and iOS WK2. It takes a callback because view state updates to the
web process are async, so the callback fires after the web process gets the new state.

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::removeViewFromWindow):
(WTR::UIScriptController::addViewToWindow):
* DumpRenderTree/mac/DumpRenderTree.mm:
(createWebViewAndOffscreenWindow):
(resetWebViewToConsistentStateBeforeTesting):
* DumpRenderTree/mac/DumpRenderTreeMac.h:
* DumpRenderTree/mac/UIScriptControllerMac.mm:
(WTR::UIScriptController::removeViewFromWindow):
(WTR::UIScriptController::addViewToWindow):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::removeViewFromWindow):
(WTR::UIScriptController::addViewToWindow):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/PlatformWebView.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):
* WebKitTestRunner/ios/PlatformWebViewIOS.mm:
(WTR::PlatformWebView::removeFromWindow):
(WTR::PlatformWebView::addToWindow):
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::removeViewFromWindow):
(WTR::UIScriptController::addViewToWindow):
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::removeFromWindow):
(WTR::PlatformWebView::addToWindow):
* WebKitTestRunner/mac/UIScriptControllerMac.mm:
(WTR::UIScriptController::removeViewFromWindow):
(WTR::UIScriptController::addViewToWindow):

LayoutTests:

Rebase to include the "in window" output.

tiled-drawing/background-transparency-toggle.html was sensitive to the length of the output, so give the body
a fixed size.

* compositing/tiling/offscreen-tiled-layer-expected.txt:
* compositing/tiling/transform-origin-tiled-expected.txt:
* platform/mac-wk1/compositing/tiling/offscreen-tiled-layer-expected.txt:
* platform/mac-wk1/compositing/tiling/transform-origin-tiled-expected.txt:
* platform/mac-wk2/compositing/tiling/rotated-tiled-clamped-expected.txt:
* platform/mac-wk2/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt:
* platform/mac-wk2/compositing/tiling/tile-cache-zoomed-expected.txt:
* platform/mac-wk2/compositing/tiling/tiled-layer-resize-expected.txt:
* platform/mac/compositing/tiling/rotated-tiled-clamped-expected.txt:
* platform/mac/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt:
* platform/mac/compositing/tiling/tiled-layer-resize-expected.txt:
* tiled-drawing/background-transparency-toggle-expected.txt:
* tiled-drawing/background-transparency-toggle.html:
* tiled-drawing/scrolling/fast-scroll-div-latched-div-expected.txt:
* tiled-drawing/scrolling/fast-scroll-div-latched-div-with-handler-expected.txt:
* tiled-drawing/scrolling/fast-scroll-div-latched-mainframe-expected.txt:
* tiled-drawing/scrolling/fast-scroll-div-latched-mainframe-with-handler-expected.txt:
* tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-expected.txt:
* tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-with-handler-expected.txt:
* tiled-drawing/scrolling/fast-scroll-iframe-latched-mainframe-expected.txt:
* tiled-drawing/scrolling/fast-scroll-iframe-latched-mainframe-with-handler-expected.txt:
* tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-expected.txt:
* tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler-expected.txt:
* tiled-drawing/scrolling/fast-scroll-select-latched-select-expected.txt:
* tiled-drawing/scrolling/fast-scroll-select-latched-select-with-handler-expected.txt:
* tiled-drawing/scrolling/fixed-background/fixed-background-no-image-expected.txt:
* tiled-drawing/scrolling/fixed-background/fixed-body-background-body-layer-expected.txt:
* tiled-drawing/scrolling/fixed-background/fixed-body-background-expected.txt:
* tiled-drawing/scrolling/fixed-background/fixed-body-background-opacity-expected.txt:
* tiled-drawing/scrolling/fixed-background/fixed-body-background-positioned-expected.txt:
* tiled-drawing/scrolling/fixed-background/fixed-body-background-transformed-expected.txt:
* tiled-drawing/scrolling/fixed-background/fixed-body-background-zoomed-expected.txt:
* tiled-drawing/scrolling/fixed-background/fixed-html-background-expected.txt:
* tiled-drawing/scrolling/fixed-background/fixed-non-propagated-body-background-expected.txt:
* tiled-drawing/scrolling/fixed/four-bars-zoomed-expected.txt:
* tiled-drawing/simple-document-with-margin-tiles-expected.txt:
* tiled-drawing/tile-coverage-after-scroll-expected.txt:
* tiled-drawing/tile-coverage-after-scroll-speculative-expected.txt:
* tiled-drawing/tile-coverage-scroll-to-bottom-expected.txt:
* tiled-drawing/tile-coverage-slow-scrolling-expected.txt:
* tiled-drawing/tile-coverage-speculative-expected.txt:
* tiled-drawing/tile-coverage-view-exposed-rect-expected.txt:
* tiled-drawing/tile-size-both-scrollable-expected.txt:
* tiled-drawing/tile-size-horizontally-scrollable-expected.txt:
* tiled-drawing/tile-size-slow-zoomed-expected.txt:
* tiled-drawing/tile-size-unscrollable-expected.txt:
* tiled-drawing/tile-size-vertically-scrollable-expected.txt:
* tiled-drawing/tile-size-view-exposed-rect-expected.txt:
* tiled-drawing/tiled-backing-in-window-expected.txt: Added.
* tiled-drawing/tiled-backing-in-window.html: Added.
* tiled-drawing/tiled-drawing-scroll-position-page-cache-restoration-expected.txt:
* tiled-drawing/tiled-drawing-zoom-expected.txt:
* tiled-drawing/tiled-drawing-zoom-scrolled-expected.txt:
* tiled-drawing/use-tiled-drawing-expected.txt:
* tiled-drawing/visible-rect-content-inset-expected.txt:

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

85 files changed:
LayoutTests/ChangeLog
LayoutTests/compositing/tiling/offscreen-tiled-layer-expected.txt
LayoutTests/compositing/tiling/transform-origin-tiled-expected.txt
LayoutTests/platform/ios-simulator-wk2/compositing/tiling/offscreen-tiled-layer-expected.txt
LayoutTests/platform/ios-simulator-wk2/compositing/tiling/rotated-tiled-clamped-expected.txt
LayoutTests/platform/ios-simulator-wk2/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt
LayoutTests/platform/ios-simulator-wk2/compositing/tiling/tile-cache-zoomed-expected.txt
LayoutTests/platform/ios-simulator-wk2/compositing/tiling/tiled-layer-resize-expected.txt
LayoutTests/platform/ios-simulator-wk2/compositing/tiling/transform-origin-tiled-expected.txt
LayoutTests/platform/mac-wk1/compositing/tiling/offscreen-tiled-layer-expected.txt
LayoutTests/platform/mac-wk1/compositing/tiling/transform-origin-tiled-expected.txt
LayoutTests/platform/mac-wk2/compositing/tiling/rotated-tiled-clamped-expected.txt
LayoutTests/platform/mac-wk2/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt
LayoutTests/platform/mac-wk2/compositing/tiling/tile-cache-zoomed-expected.txt
LayoutTests/platform/mac-wk2/compositing/tiling/tiled-layer-resize-expected.txt
LayoutTests/platform/mac/compositing/tiling/rotated-tiled-clamped-expected.txt
LayoutTests/platform/mac/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt
LayoutTests/platform/mac/compositing/tiling/tiled-layer-resize-expected.txt
LayoutTests/tiled-drawing/background-transparency-toggle-expected.txt
LayoutTests/tiled-drawing/background-transparency-toggle.html
LayoutTests/tiled-drawing/scrolling/fast-scroll-div-latched-div-expected.txt
LayoutTests/tiled-drawing/scrolling/fast-scroll-div-latched-div-with-handler-expected.txt
LayoutTests/tiled-drawing/scrolling/fast-scroll-div-latched-mainframe-expected.txt
LayoutTests/tiled-drawing/scrolling/fast-scroll-div-latched-mainframe-with-handler-expected.txt
LayoutTests/tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-expected.txt
LayoutTests/tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-with-handler-expected.txt
LayoutTests/tiled-drawing/scrolling/fast-scroll-iframe-latched-mainframe-expected.txt
LayoutTests/tiled-drawing/scrolling/fast-scroll-iframe-latched-mainframe-with-handler-expected.txt
LayoutTests/tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-expected.txt
LayoutTests/tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler-expected.txt
LayoutTests/tiled-drawing/scrolling/fast-scroll-select-latched-select-expected.txt
LayoutTests/tiled-drawing/scrolling/fast-scroll-select-latched-select-with-handler-expected.txt
LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-background-no-image-expected.txt
LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-body-background-body-layer-expected.txt
LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-body-background-expected.txt
LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-body-background-opacity-expected.txt
LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-body-background-positioned-expected.txt
LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-body-background-transformed-expected.txt
LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-body-background-zoomed-expected.txt
LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-html-background-expected.txt
LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-non-propagated-body-background-expected.txt
LayoutTests/tiled-drawing/scrolling/fixed/four-bars-zoomed-expected.txt
LayoutTests/tiled-drawing/simple-document-with-margin-tiles-expected.txt
LayoutTests/tiled-drawing/tile-coverage-after-scroll-expected.txt
LayoutTests/tiled-drawing/tile-coverage-after-scroll-speculative-expected.txt
LayoutTests/tiled-drawing/tile-coverage-scroll-to-bottom-expected.txt
LayoutTests/tiled-drawing/tile-coverage-slow-scrolling-expected.txt
LayoutTests/tiled-drawing/tile-coverage-speculative-expected.txt
LayoutTests/tiled-drawing/tile-coverage-view-exposed-rect-expected.txt
LayoutTests/tiled-drawing/tile-size-both-scrollable-expected.txt
LayoutTests/tiled-drawing/tile-size-horizontally-scrollable-expected.txt
LayoutTests/tiled-drawing/tile-size-slow-zoomed-expected.txt
LayoutTests/tiled-drawing/tile-size-unscrollable-expected.txt
LayoutTests/tiled-drawing/tile-size-vertically-scrollable-expected.txt
LayoutTests/tiled-drawing/tile-size-view-exposed-rect-expected.txt
LayoutTests/tiled-drawing/tiled-backing-in-window-expected.txt [new file with mode: 0644]
LayoutTests/tiled-drawing/tiled-backing-in-window.html [new file with mode: 0644]
LayoutTests/tiled-drawing/tiled-drawing-scroll-position-page-cache-restoration-expected.txt
LayoutTests/tiled-drawing/tiled-drawing-zoom-expected.txt
LayoutTests/tiled-drawing/tiled-drawing-zoom-scrolled-expected.txt
LayoutTests/tiled-drawing/use-tiled-drawing-expected.txt
LayoutTests/tiled-drawing/visible-rect-content-inset-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/TiledBacking.h
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/graphics/ca/TileController.h
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerBacking.h
Source/WebCore/rendering/RenderLayerCompositor.cpp
Tools/ChangeLog
Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/DumpRenderTree/mac/DumpRenderTreeMac.h
Tools/DumpRenderTree/mac/UIScriptControllerMac.mm
Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp
Tools/TestRunnerShared/UIScriptContext/UIScriptController.h
Tools/WebKitTestRunner/PlatformWebView.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp
Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp
Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm
Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm
Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm
Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm

index 44a567d..8d69a0c 100644 (file)
@@ -1,3 +1,71 @@
+2017-02-03  Simon Fraser  <simon.fraser@apple.com>
+
+        Correctly set the "inWindow" flag for TileControllers that aren't the page tiles, and clarify "usingTiledBacking" logic
+        https://bugs.webkit.org/show_bug.cgi?id=167774
+
+        Reviewed by Tim Horton.
+        
+        Rebase to include the "in window" output.
+        
+        tiled-drawing/background-transparency-toggle.html was sensitive to the length of the output, so give the body
+        a fixed size.
+
+        * compositing/tiling/offscreen-tiled-layer-expected.txt:
+        * compositing/tiling/transform-origin-tiled-expected.txt:
+        * platform/mac-wk1/compositing/tiling/offscreen-tiled-layer-expected.txt:
+        * platform/mac-wk1/compositing/tiling/transform-origin-tiled-expected.txt:
+        * platform/mac-wk2/compositing/tiling/rotated-tiled-clamped-expected.txt:
+        * platform/mac-wk2/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt:
+        * platform/mac-wk2/compositing/tiling/tile-cache-zoomed-expected.txt:
+        * platform/mac-wk2/compositing/tiling/tiled-layer-resize-expected.txt:
+        * platform/mac/compositing/tiling/rotated-tiled-clamped-expected.txt:
+        * platform/mac/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt:
+        * platform/mac/compositing/tiling/tiled-layer-resize-expected.txt:
+        * tiled-drawing/background-transparency-toggle-expected.txt:
+        * tiled-drawing/background-transparency-toggle.html:
+        * tiled-drawing/scrolling/fast-scroll-div-latched-div-expected.txt:
+        * tiled-drawing/scrolling/fast-scroll-div-latched-div-with-handler-expected.txt:
+        * tiled-drawing/scrolling/fast-scroll-div-latched-mainframe-expected.txt:
+        * tiled-drawing/scrolling/fast-scroll-div-latched-mainframe-with-handler-expected.txt:
+        * tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-expected.txt:
+        * tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-with-handler-expected.txt:
+        * tiled-drawing/scrolling/fast-scroll-iframe-latched-mainframe-expected.txt:
+        * tiled-drawing/scrolling/fast-scroll-iframe-latched-mainframe-with-handler-expected.txt:
+        * tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-expected.txt:
+        * tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler-expected.txt:
+        * tiled-drawing/scrolling/fast-scroll-select-latched-select-expected.txt:
+        * tiled-drawing/scrolling/fast-scroll-select-latched-select-with-handler-expected.txt:
+        * tiled-drawing/scrolling/fixed-background/fixed-background-no-image-expected.txt:
+        * tiled-drawing/scrolling/fixed-background/fixed-body-background-body-layer-expected.txt:
+        * tiled-drawing/scrolling/fixed-background/fixed-body-background-expected.txt:
+        * tiled-drawing/scrolling/fixed-background/fixed-body-background-opacity-expected.txt:
+        * tiled-drawing/scrolling/fixed-background/fixed-body-background-positioned-expected.txt:
+        * tiled-drawing/scrolling/fixed-background/fixed-body-background-transformed-expected.txt:
+        * tiled-drawing/scrolling/fixed-background/fixed-body-background-zoomed-expected.txt:
+        * tiled-drawing/scrolling/fixed-background/fixed-html-background-expected.txt:
+        * tiled-drawing/scrolling/fixed-background/fixed-non-propagated-body-background-expected.txt:
+        * tiled-drawing/scrolling/fixed/four-bars-zoomed-expected.txt:
+        * tiled-drawing/simple-document-with-margin-tiles-expected.txt:
+        * tiled-drawing/tile-coverage-after-scroll-expected.txt:
+        * tiled-drawing/tile-coverage-after-scroll-speculative-expected.txt:
+        * tiled-drawing/tile-coverage-scroll-to-bottom-expected.txt:
+        * tiled-drawing/tile-coverage-slow-scrolling-expected.txt:
+        * tiled-drawing/tile-coverage-speculative-expected.txt:
+        * tiled-drawing/tile-coverage-view-exposed-rect-expected.txt:
+        * tiled-drawing/tile-size-both-scrollable-expected.txt:
+        * tiled-drawing/tile-size-horizontally-scrollable-expected.txt:
+        * tiled-drawing/tile-size-slow-zoomed-expected.txt:
+        * tiled-drawing/tile-size-unscrollable-expected.txt:
+        * tiled-drawing/tile-size-vertically-scrollable-expected.txt:
+        * tiled-drawing/tile-size-view-exposed-rect-expected.txt:
+        * tiled-drawing/tiled-backing-in-window-expected.txt: Added.
+        * tiled-drawing/tiled-backing-in-window.html: Added.
+        * tiled-drawing/tiled-drawing-scroll-position-page-cache-restoration-expected.txt:
+        * tiled-drawing/tiled-drawing-zoom-expected.txt:
+        * tiled-drawing/tiled-drawing-zoom-scrolled-expected.txt:
+        * tiled-drawing/use-tiled-drawing-expected.txt:
+        * tiled-drawing/visible-rect-content-inset-expected.txt:
+
 2017-02-03  Zalan Bujtas  <zalan@apple.com>
 
         Simple line layout: Bail out from Simple Line Layout when the primary font is insufficient.
index f6d1397..bde2b8e 100644 (file)
@@ -16,6 +16,7 @@
       (tile cache coverage 0, 0 1024 x 1024)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 2 x 2)
+      (in window 1)
       (children 1
         (GraphicsLayer
           (position 8.00 1800.00)
@@ -30,6 +31,7 @@
           (tile cache coverage 0, 0 0 x 0)
           (tile size 512 x 512)
           (top left tile 0, 0 tiles grid 0 x 0)
+          (in window 1)
         )
       )
     )
index 4c2f368..1bf0f0e 100644 (file)
@@ -16,6 +16,7 @@
       (tile cache coverage 0, 0 800 x 600)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 2 x 2)
+      (in window 1)
       (children 1
         (GraphicsLayer
           (position 58.00 50.00)
@@ -48,6 +49,7 @@
                   (tile cache coverage 1024, 0 1024 x 300)
                   (tile size 512 x 512)
                   (top left tile 2, 0 tiles grid 2 x 1)
+                  (in window 1)
                 )
               )
             )
index 3abc126..4f753ed 100644 (file)
@@ -16,6 +16,7 @@
       (tile cache coverage 0, 0 1024 x 1024)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 2 x 2)
+      (in window 1)
       (children 1
         (GraphicsLayer
           (position 8.00 1800.00)
@@ -30,6 +31,7 @@
           (tile cache coverage 0, 0 0 x 0)
           (tile size 512 x 512)
           (top left tile 0, 0 tiles grid 0 x 0)
+          (in window 1)
         )
       )
     )
index c7aa0c3..92ceb42 100644 (file)
@@ -16,6 +16,7 @@
       (tile cache coverage 0, 0 800 x 600)
       (tile size 800 x 600)
       (top left tile 0, 0 tiles grid 1 x 1)
+      (in window 1)
       (children 1
         (GraphicsLayer
           (position 58.00 50.00)
@@ -49,6 +50,7 @@
                   (tile cache coverage 0, 0 2800 x 300)
                   (tile size 512 x 512)
                   (top left tile 0, 0 tiles grid 6 x 1)
+                  (in window 1)
                 )
               )
             )
index 0cc19a4..780241d 100644 (file)
@@ -16,6 +16,7 @@
       (tile cache coverage 0, 0 800 x 600)
       (tile size 800 x 600)
       (top left tile 0, 0 tiles grid 1 x 1)
+      (in window 1)
       (children 1
         (GraphicsLayer
           (position 58.00 50.00)
@@ -56,6 +57,7 @@
                       (tile cache coverage 0, 0 2800 x 300)
                       (tile size 512 x 512)
                       (top left tile 0, 0 tiles grid 6 x 1)
+                      (in window 1)
                     )
                   )
                 )
index 2da5575..6b8bcbc 100644 (file)
@@ -16,6 +16,7 @@
       (tile cache coverage 0, 0 1024 x 1024)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 2 x 2)
+      (in window 1)
       (children 1
         (GraphicsLayer
           (position 8.00 8.00)
index 02a371c..88f0d23 100644 (file)
@@ -9,6 +9,7 @@ Tiled layer
       (tile cache coverage 0, 0 808 x 1024)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 2 x 2)
+      (in window 1)
       (children 1
         (GraphicsLayer
           (position 8.00 8.00)
@@ -19,6 +20,7 @@ Tiled layer
           (tile cache coverage 0, 0 800 x 1024)
           (tile size 512 x 512)
           (top left tile 0, 0 tiles grid 2 x 2)
+          (in window 1)
         )
       )
     )
index 1f8fd73..3683f49 100644 (file)
@@ -16,6 +16,7 @@
       (tile cache coverage 0, 0 800 x 600)
       (tile size 800 x 600)
       (top left tile 0, 0 tiles grid 1 x 1)
+      (in window 1)
       (children 1
         (GraphicsLayer
           (position 58.00 50.00)
@@ -48,6 +49,7 @@
                   (tile cache coverage 1024, 0 1024 x 300)
                   (tile size 512 x 512)
                   (top left tile 2, 0 tiles grid 2 x 1)
+                  (in window 1)
                 )
               )
             )
index 310178c..143576c 100644 (file)
@@ -27,6 +27,7 @@
           (tile cache coverage 0, 0 0 x 0)
           (tile size 512 x 512)
           (top left tile 0, 0 tiles grid 0 x 0)
+          (in window 1)
         )
       )
     )
index 72eaccf..f83c42b 100644 (file)
@@ -45,6 +45,7 @@
                   (tile cache coverage 1024, 0 1024 x 300)
                   (tile size 512 x 512)
                   (top left tile 2, 0 tiles grid 2 x 1)
+                  (in window 1)
                 )
               )
             )
index 2f29c1e..1907a17 100644 (file)
@@ -16,6 +16,7 @@
       (tile cache coverage 0, 0 800 x 600)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 2 x 2)
+      (in window 1)
       (children 1
         (GraphicsLayer
           (position 58.00 50.00)
@@ -49,6 +50,7 @@
                   (tile cache coverage 0, 0 2800 x 300)
                   (tile size 512 x 512)
                   (top left tile 0, 0 tiles grid 6 x 1)
+                  (in window 1)
                 )
               )
             )
index b83272a..68ce20f 100644 (file)
@@ -16,6 +16,7 @@
       (tile cache coverage 0, 0 800 x 600)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 2 x 2)
+      (in window 1)
       (children 1
         (GraphicsLayer
           (position 58.00 50.00)
@@ -56,6 +57,7 @@
                       (tile cache coverage 0, 0 2800 x 300)
                       (tile size 512 x 512)
                       (top left tile 0, 0 tiles grid 6 x 1)
+                      (in window 1)
                     )
                   )
                 )
index 37a81aa..51be690 100644 (file)
@@ -18,6 +18,7 @@
       (tile cache coverage 0, 0 640 x 640)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 2 x 2)
+      (in window 1)
       (children 1
         (GraphicsLayer
           (position 8.00 8.00)
index 02a371c..88f0d23 100644 (file)
@@ -9,6 +9,7 @@ Tiled layer
       (tile cache coverage 0, 0 808 x 1024)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 2 x 2)
+      (in window 1)
       (children 1
         (GraphicsLayer
           (position 8.00 8.00)
@@ -19,6 +20,7 @@ Tiled layer
           (tile cache coverage 0, 0 800 x 1024)
           (tile size 512 x 512)
           (top left tile 0, 0 tiles grid 2 x 2)
+          (in window 1)
         )
       )
     )
index 80c54ed..b3bca27 100644 (file)
@@ -46,6 +46,7 @@
                   (tile cache coverage 0, 0 2800 x 300)
                   (tile size 512 x 512)
                   (top left tile 0, 0 tiles grid 6 x 1)
+                  (in window 1)
                 )
               )
             )
index d4d8129..77cb5fa 100644 (file)
@@ -53,6 +53,7 @@
                       (tile cache coverage 0, 0 2800 x 300)
                       (tile size 512 x 512)
                       (top left tile 0, 0 tiles grid 6 x 1)
+                      (in window 1)
                     )
                   )
                 )
index 5922b9c..2841aa5 100644 (file)
@@ -16,6 +16,7 @@ Tiled layer
           (tile cache coverage 0, 0 800 x 1024)
           (tile size 512 x 512)
           (top left tile 0, 0 tiles grid 2 x 2)
+          (in window 1)
         )
       )
     )
index 5b81002..d58edb6 100644 (file)
@@ -2,53 +2,57 @@ Page tiles should be transparent if the body's background has alpha.
 
 (GraphicsLayer
   (anchor 0.00 0.00)
-  (bounds 800.00 600.00)
+  (bounds 785.00 1024.00)
   (children 1
     (GraphicsLayer
-      (bounds 800.00 600.00)
+      (bounds 785.00 1024.00)
       (contentsOpaque 1)
-      (tile cache coverage 0, 0 800 x 600)
-      (tile size 800 x 600)
-      (top left tile 0, 0 tiles grid 1 x 1)
+      (tile cache coverage 0, 0 785 x 1024)
+      (tile size 785 x 512)
+      (top left tile 0, 0 tiles grid 1 x 2)
+      (in window 1)
     )
   )
 )
 (GraphicsLayer
   (anchor 0.00 0.00)
-  (bounds 800.00 600.00)
+  (bounds 785.00 1024.00)
   (children 1
     (GraphicsLayer
-      (bounds 800.00 600.00)
+      (bounds 785.00 1024.00)
       (backgroundColor #00000033)
-      (tile cache coverage 0, 0 800 x 600)
-      (tile size 800 x 600)
-      (top left tile 0, 0 tiles grid 1 x 1)
+      (tile cache coverage 0, 0 785 x 1024)
+      (tile size 785 x 512)
+      (top left tile 0, 0 tiles grid 1 x 2)
+      (in window 1)
     )
   )
 )
 (GraphicsLayer
   (anchor 0.00 0.00)
-  (bounds 800.00 600.00)
+  (bounds 785.00 1024.00)
   (children 1
     (GraphicsLayer
-      (bounds 800.00 600.00)
+      (bounds 785.00 1024.00)
       (contentsOpaque 1)
-      (tile cache coverage 0, 0 800 x 600)
-      (tile size 800 x 600)
-      (top left tile 0, 0 tiles grid 1 x 1)
+      (tile cache coverage 0, 0 785 x 1024)
+      (tile size 785 x 512)
+      (top left tile 0, 0 tiles grid 1 x 2)
+      (in window 1)
     )
   )
 )
 (GraphicsLayer
   (anchor 0.00 0.00)
-  (bounds 785.00 648.00)
+  (bounds 785.00 1024.00)
   (children 1
     (GraphicsLayer
-      (bounds 785.00 648.00)
+      (bounds 785.00 1024.00)
       (contentsOpaque 1)
-      (tile cache coverage 0, 0 785 x 600)
-      (tile size 800 x 600)
-      (top left tile 0, 0 tiles grid 1 x 1)
+      (tile cache coverage 0, 0 785 x 1024)
+      (tile size 785 x 512)
+      (top left tile 0, 0 tiles grid 1 x 2)
+      (in window 1)
     )
   )
 )
index c27ebdd..f0f8ec9 100644 (file)
@@ -5,6 +5,7 @@
     <style>
         body {
             background-color: white;
+            height: 1000px;
         }
         
         body.transparent {
index b944d2e..2f2205e 100644 (file)
@@ -71,6 +71,7 @@ PASS Page did not receive wheel events.
       (tile cache coverage 0, 0 2008 x 2048)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 4 x 4)
+      (in window 1)
     )
   )
 )
index b944d2e..2f2205e 100644 (file)
@@ -71,6 +71,7 @@ PASS Page did not receive wheel events.
       (tile cache coverage 0, 0 2008 x 2048)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 4 x 4)
+      (in window 1)
     )
   )
 )
index 02aacbb..fd7ff8f 100644 (file)
@@ -71,6 +71,7 @@ PASS Scrollable div did not receive wheel events.
       (tile cache coverage 0, 0 2008 x 2048)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 4 x 4)
+      (in window 1)
     )
   )
 )
index cb38461..09c1116 100644 (file)
@@ -72,6 +72,7 @@ PASS Scrollable div did not receive wheel events.
       (tile cache coverage 0, 0 2008 x 2048)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 4 x 4)
+      (in window 1)
     )
   )
 )
index 494019c..9dab43c 100644 (file)
@@ -27,6 +27,7 @@ PASS Page did not receive wheel events.
       (tile cache coverage 0, 0 785 x 2048)
       (tile size 785 x 512)
       (top left tile 0, 0 tiles grid 1 x 4)
+      (in window 1)
     )
   )
 )
index 494019c..9dab43c 100644 (file)
@@ -27,6 +27,7 @@ PASS Page did not receive wheel events.
       (tile cache coverage 0, 0 785 x 2048)
       (tile size 785 x 512)
       (top left tile 0, 0 tiles grid 1 x 4)
+      (in window 1)
     )
   )
 )
index 41b032b..7af8b44 100644 (file)
@@ -27,6 +27,7 @@ PASS IFrame did not receive wheel events.
       (tile cache coverage 0, 0 785 x 2048)
       (tile size 785 x 512)
       (top left tile 0, 0 tiles grid 1 x 4)
+      (in window 1)
     )
   )
 )
index 41b032b..7af8b44 100644 (file)
@@ -27,6 +27,7 @@ PASS IFrame did not receive wheel events.
       (tile cache coverage 0, 0 785 x 2048)
       (tile size 785 x 512)
       (top left tile 0, 0 tiles grid 1 x 4)
+      (in window 1)
     )
   )
 )
index efc73ce..aa77b7f 100644 (file)
@@ -29,6 +29,7 @@ PASS Select did not receive wheel events.
       (tile cache coverage 0, 0 2008 x 2048)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 4 x 4)
+      (in window 1)
     )
   )
 )
index efc73ce..aa77b7f 100644 (file)
@@ -29,6 +29,7 @@ PASS Select did not receive wheel events.
       (tile cache coverage 0, 0 2008 x 2048)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 4 x 4)
+      (in window 1)
     )
   )
 )
index ce69e5f..ad6bbb4 100644 (file)
@@ -31,6 +31,7 @@ PASS Page did not receive wheel events.
       (tile cache coverage 0, 0 2008 x 2048)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 4 x 4)
+      (in window 1)
     )
   )
 )
index ce69e5f..ad6bbb4 100644 (file)
@@ -31,6 +31,7 @@ PASS Page did not receive wheel events.
       (tile cache coverage 0, 0 2008 x 2048)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 4 x 4)
+      (in window 1)
     )
   )
 )
index b1187dc..7812bcd 100644 (file)
@@ -8,6 +8,7 @@
       (tile cache coverage 0, 0 785 x 1024)
       (tile size 785 x 512)
       (top left tile 0, 0 tiles grid 1 x 2)
+      (in window 1)
     )
   )
 )
index 7764648..33727df 100644 (file)
@@ -18,6 +18,7 @@
           (tile cache coverage 0, 0 785 x 1024)
           (tile size 785 x 512)
           (top left tile 0, 0 tiles grid 1 x 2)
+          (in window 1)
         )
       )
     )
index 55935a3..e198fee 100644 (file)
@@ -18,6 +18,7 @@
           (tile cache coverage 0, 0 785 x 1024)
           (tile size 785 x 512)
           (top left tile 0, 0 tiles grid 1 x 2)
+          (in window 1)
         )
       )
     )
index 55935a3..e198fee 100644 (file)
@@ -18,6 +18,7 @@
           (tile cache coverage 0, 0 785 x 1024)
           (tile size 785 x 512)
           (top left tile 0, 0 tiles grid 1 x 2)
+          (in window 1)
         )
       )
     )
index 560fdd6..647682d 100644 (file)
@@ -18,6 +18,7 @@
           (tile cache coverage 0, 0 785 x 1024)
           (tile size 785 x 512)
           (top left tile 0, 0 tiles grid 1 x 2)
+          (in window 1)
         )
       )
     )
index 6aa0d3a..0cd5f2f 100644 (file)
@@ -18,6 +18,7 @@
           (tile cache coverage 0, 0 795 x 1024)
           (tile size 512 x 512)
           (top left tile 0, 0 tiles grid 2 x 2)
+          (in window 1)
         )
       )
     )
index 9b62bbe..e2d0c61 100644 (file)
@@ -19,6 +19,7 @@
           (tile cache coverage 0, 0 445 x 667)
           (tile size 512 x 512)
           (top left tile 0, 0 tiles grid 2 x 3)
+          (in window 1)
         )
       )
     )
index 4746451..1d4dd96 100644 (file)
@@ -18,6 +18,7 @@
           (tile cache coverage 0, 0 785 x 1024)
           (tile size 785 x 512)
           (top left tile 0, 0 tiles grid 1 x 2)
+          (in window 1)
         )
       )
     )
index 46d5176..8ff6aef 100644 (file)
@@ -49,6 +49,7 @@
       (tile cache coverage 0, 0 341 x 445)
       (tile size 785 x 512)
       (top left tile 0, 0 tiles grid 1 x 2)
+      (in window 1)
       (children 4
         (GraphicsLayer
           (position -4.00 -4.00)
index 063c128..01b8a8b 100644 (file)
@@ -16,6 +16,7 @@
       (tile cache coverage -512, -512 2048 x 2048)
       (tile size 512 x 512)
       (top left tile -1, -1 tiles grid 4 x 4)
+      (in window 1)
     )
   )
 )
index 1857e4f..12ca4ee 100644 (file)
@@ -16,6 +16,7 @@
       (tile cache coverage 0, 2560 785 x 1536)
       (tile size 785 x 512)
       (top left tile 0, 5 tiles grid 1 x 3)
+      (in window 1)
     )
   )
 )
index 1857e4f..12ca4ee 100644 (file)
@@ -16,6 +16,7 @@
       (tile cache coverage 0, 2560 785 x 1536)
       (tile size 785 x 512)
       (top left tile 0, 5 tiles grid 1 x 3)
+      (in window 1)
     )
   )
 )
index 1de1202..fa45359 100644 (file)
@@ -16,6 +16,7 @@
       (tile cache coverage 0, 4096 785 x 925)
       (tile size 785 x 512)
       (top left tile 0, 8 tiles grid 1 x 2)
+      (in window 1)
     )
   )
 )
index d1ec668..a29c9d4 100644 (file)
@@ -16,6 +16,7 @@
       (tile cache coverage 0, 0 800 x 600)
       (tile size 800 x 600)
       (top left tile 0, 0 tiles grid 1 x 1)
+      (in window 1)
     )
   )
 )
index 1f95d2b..f165e2c 100644 (file)
@@ -16,6 +16,7 @@
       (tile cache coverage 0, 0 785 x 1024)
       (tile size 785 x 512)
       (top left tile 0, 0 tiles grid 1 x 2)
+      (in window 1)
     )
   )
 )
index 2d37bbc..f312011 100644 (file)
@@ -8,6 +8,7 @@
       (tile cache coverage 0, 1024 800 x 512)
       (tile size 512 x 512)
       (top left tile 0, 2 tiles grid 2 x 1)
+      (in window 1)
     )
   )
 )
index d46743c..1709392 100644 (file)
@@ -8,6 +8,7 @@
       (tile cache coverage 0, 0 1024 x 1024)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 2 x 2)
+      (in window 1)
     )
   )
 )
index 184ce31..87ae9f4 100644 (file)
@@ -8,6 +8,7 @@
       (tile cache coverage 0, 0 1024 x 585)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 2 x 2)
+      (in window 1)
     )
   )
 )
index 5c33e41..7ea55f6 100644 (file)
@@ -18,6 +18,7 @@
       (tile cache coverage 0, 0 602 x 584)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 2 x 2)
+      (in window 1)
     )
   )
 )
index 058faee..844a779 100644 (file)
@@ -8,6 +8,7 @@
       (tile cache coverage 0, 0 800 x 600)
       (tile size 800 x 600)
       (top left tile 0, 0 tiles grid 1 x 1)
+      (in window 1)
     )
   )
 )
index 48b1aa2..3dfbbcd 100644 (file)
@@ -8,6 +8,7 @@
       (tile cache coverage 0, 0 785 x 1024)
       (tile size 785 x 512)
       (top left tile 0, 0 tiles grid 1 x 2)
+      (in window 1)
     )
   )
 )
index d8891c3..3ddafab 100644 (file)
@@ -8,6 +8,7 @@
       (tile cache coverage 0, 0 800 x 512)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 2 x 1)
+      (in window 1)
     )
   )
 )
diff --git a/LayoutTests/tiled-drawing/tiled-backing-in-window-expected.txt b/LayoutTests/tiled-drawing/tiled-backing-in-window-expected.txt
new file mode 100644 (file)
index 0000000..d5cd7fb
--- /dev/null
@@ -0,0 +1,78 @@
+Tiled box
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 2208.00 1016.00)
+  (visible rect 0.00, 0.00 785.00 x 585.00)
+  (coverage rect 0.00, 0.00 785.00 x 585.00)
+  (intersects coverage rect 1)
+  (contentsScale 1.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 2208.00 1016.00)
+      (contentsOpaque 1)
+      (visible rect 0.00, 0.00 785.00 x 585.00)
+      (coverage rect 0.00, 0.00 785.00 x 585.00)
+      (intersects coverage rect 1)
+      (contentsScale 1.00)
+      (tile cache coverage 0, 0 1024 x 1016)
+      (tile size 512 x 512)
+      (top left tile 0, 0 tiles grid 2 x 2)
+      (in window 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 2200.00 200.00)
+          (usingTiledLayer 1)
+          (drawsContent 1)
+          (visible rect 0.00, 0.00 777.00 x 200.00)
+          (coverage rect -8.00, -8.00 785.00 x 585.00)
+          (intersects coverage rect 1)
+          (contentsScale 1.00)
+          (tile cache coverage 0, 0 1024 x 200)
+          (tile size 512 x 512)
+          (top left tile 0, 0 tiles grid 2 x 1)
+          (in window 1)
+        )
+      )
+    )
+  )
+)
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 2208.00 1016.00)
+  (visible rect 0.00, 0.00 785.00 x 585.00)
+  (coverage rect 0.00, 0.00 785.00 x 585.00)
+  (intersects coverage rect 1)
+  (contentsScale 1.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 2208.00 1016.00)
+      (contentsOpaque 1)
+      (visible rect 0.00, 0.00 785.00 x 585.00)
+      (coverage rect 0.00, 0.00 785.00 x 585.00)
+      (intersects coverage rect 1)
+      (contentsScale 1.00)
+      (tile cache coverage 0, 0 1024 x 1016)
+      (tile size 512 x 512)
+      (top left tile 0, 0 tiles grid 2 x 2)
+      (in window 0)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 2200.00 200.00)
+          (usingTiledLayer 1)
+          (drawsContent 1)
+          (visible rect 0.00, 0.00 777.00 x 200.00)
+          (coverage rect -8.00, -8.00 785.00 x 585.00)
+          (intersects coverage rect 1)
+          (contentsScale 1.00)
+          (tile cache coverage 0, 0 1024 x 200)
+          (tile size 512 x 512)
+          (top left tile 0, 0 tiles grid 2 x 1)
+          (in window 0)
+        )
+      )
+    )
+  )
+)
+
diff --git a/LayoutTests/tiled-drawing/tiled-backing-in-window.html b/LayoutTests/tiled-drawing/tiled-backing-in-window.html
new file mode 100644 (file)
index 0000000..8d0f632
--- /dev/null
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        body {
+            height: 1000px;
+        }
+
+        .box {
+            height: 200px;
+            width: 2200px;
+            background: repeating-linear-gradient(to right, white, blue 400px);
+        }
+        
+        .composited {
+            transform: translateZ(0);
+        }
+    </style>
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+        
+        function getUIScript()
+        {
+            return `
+            (function() {
+                uiController.removeViewFromWindow(function() {
+                    uiController.uiScriptComplete('');
+                });
+            })();`
+        }
+
+        function dumpTiles(outputId)
+        {
+            if (window.internals) {
+                document.getElementById(outputId).innerText = internals.layerTreeAsText(document,
+                    internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS | internals.LAYER_TREE_INCLUDES_TILE_CACHES);
+            }
+        }
+        function doTest()
+        {
+            if (!testRunner.runUIScript)
+                return;
+
+            dumpTiles('before-layers');
+
+            testRunner.runUIScript(getUIScript(), function(result) {
+                dumpTiles('after-layers');
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            });
+        }
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+    <div class="composited box">Tiled box</div>
+
+<pre id="before-layers">Layer tree goes here</pre>
+<pre id="after-layers">Layer tree goes here</pre>
+</body>
+</html>
index 46dc9d5..46c4e99 100644 (file)
@@ -18,6 +18,7 @@ document.body.scrollTop = 1000
       (tile cache coverage 512, 0 2048 x 2560)
       (tile size 512 x 512)
       (top left tile 1, 0 tiles grid 4 x 5)
+      (in window 1)
     )
   )
 )
index cf98c74..7877710 100644 (file)
@@ -18,6 +18,7 @@
       (tile cache coverage 0, 0 445 x 445)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 2 x 2)
+      (in window 1)
     )
   )
 )
index 42a6fd3..cb75282 100644 (file)
@@ -18,6 +18,7 @@
       (tile cache coverage 667, 890 540 x 445)
       (tile size 512 x 512)
       (top left tile 3, 4 tiles grid 3 x 2)
+      (in window 1)
     )
   )
 )
index 1e3f799..418703f 100644 (file)
@@ -16,6 +16,7 @@
       (tile cache coverage 0, 0 1024 x 1024)
       (tile size 512 x 512)
       (top left tile 0, 0 tiles grid 2 x 2)
+      (in window 1)
     )
   )
 )
index eb05a90..3ae2528 100644 (file)
@@ -17,6 +17,7 @@ This test applies a content inset and then dumps the layer tree including visibl
       (tile cache coverage 0, 0 800 x 500)
       (tile size 800 x 512)
       (top left tile 0, 0 tiles grid 1 x 1)
+      (in window 1)
     )
   )
 )
index 2adbe04..65fbd45 100644 (file)
@@ -1,3 +1,47 @@
+2017-02-03  Simon Fraser  <simon.fraser@apple.com>
+
+        Correctly set the "inWindow" flag for TileControllers that aren't the page tiles, and clarify "usingTiledBacking" logic
+        https://bugs.webkit.org/show_bug.cgi?id=167774
+
+        Reviewed by Tim Horton.
+
+        RenderLayerBacking had some very confusing "usingTiledCacheLayer" uses.
+
+        Its member variable, m_usingTiledCacheLayer, really meant "m_isMainFrameLayerWithTiledBacking" so make it so.
+        It had a usingTiledBacking(), which returned the same thing, which this patch replaces with isMainFrameLayerWithTiledBacking().
+
+        The fact that usingTiledBacking() was only true for the page tiled layer tripped up
+        RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants(), which would only ever call setIsInWindow()
+        on the page tiled layer. These changes fix that.
+
+        Also make a way for tests to unparent the web view via UIScriptController, and dump out the "in window"
+        status of TileBackings when dumping tile caches.
+
+        Test: tiled-drawing/tiled-backing-in-window.html
+
+        * platform/graphics/TiledBacking.h:
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::dumpAdditionalProperties):
+        * platform/graphics/ca/TileController.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::RenderLayerBacking):
+        (WebCore::computePageTiledBackingCoverage):
+        (WebCore::RenderLayerBacking::adjustTiledBackingCoverage):
+        (WebCore::RenderLayerBacking::setTiledBackingHasMargins):
+        (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
+        (WebCore::RenderLayerBacking::shouldClipCompositedBounds):
+        (WebCore::RenderLayerBacking::updateDescendantClippingLayer):
+        (WebCore::RenderLayerBacking::updateRootLayerConfiguration):
+        (WebCore::RenderLayerBacking::paintsIntoWindow):
+        (WebCore::computeTileCoverage): Deleted.
+        * rendering/RenderLayerBacking.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
+        (WebCore::RenderLayerCompositor::rootFixedBackgroundsChanged):
+        (WebCore::RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants):
+        (WebCore::RenderLayerCompositor::supportsFixedRootBackgroundCompositing):
+        (WebCore::RenderLayerCompositor::documentUsesTiledBacking):
+
 2017-02-03  Zalan Bujtas  <zalan@apple.com>
 
         Simple line layout: Bail out from Simple Line Layout when the primary font is insufficient.
index bb1d331..de55f16 100644 (file)
@@ -97,6 +97,7 @@ public:
     virtual void prepopulateRect(const FloatRect&) = 0;
 
     virtual void setIsInWindow(bool) = 0;
+    virtual bool isInWindow() const = 0;
 
     enum {
         CoverageForVisibleArea = 0,
index f03afac..118ed82 100644 (file)
@@ -3506,6 +3506,9 @@ void GraphicsLayerCA::dumpAdditionalProperties(TextStream& textStream, int inden
         IntRect gridExtent = tiledBacking()->tileGridExtent();
         writeIndent(textStream, indent + 1);
         textStream << "(top left tile " << gridExtent.x() << ", " << gridExtent.y() << " tiles grid " << gridExtent.width() << " x " << gridExtent.height() << ")\n";
+
+        writeIndent(textStream, indent + 1);
+        textStream << "(in window " << tiledBacking()->isInWindow() << ")\n";
     }
     
     if (behavior & LayerTreeAsTextIncludeContentLayers) {
index 8c84c7c..9ed5ad8 100644 (file)
@@ -136,7 +136,6 @@ private:
 
     void scheduleTileRevalidation(double interval);
 
-    bool isInWindow() const { return m_isInWindow; }
     float topContentInset() const { return m_topContentInset; }
 
     // TiledBacking member functions.
@@ -150,6 +149,7 @@ private:
     void setScrollability(Scrollability) override;
     void prepopulateRect(const FloatRect&) override;
     void setIsInWindow(bool) override;
+    bool isInWindow() const override { return m_isInWindow; }
     void setTileCoverage(TileCoverage) override;
     void revalidateTiles() override;
     void forceRepaint() override;
index afcfdd7..cea2a36 100644 (file)
@@ -93,35 +93,22 @@ CanvasCompositingStrategy canvasCompositingStrategy(const RenderObject& renderer
 
 RenderLayerBacking::RenderLayerBacking(RenderLayer& layer)
     : m_owningLayer(layer)
-    , m_viewportConstrainedNodeID(0)
-    , m_scrollingNodeID(0)
-    , m_artificiallyInflatedBounds(false)
-    , m_isMainFrameRenderViewLayer(false)
-    , m_usingTiledCacheLayer(false)
-    , m_requiresOwnBackingStore(true)
-    , m_canCompositeFilters(false)
-#if ENABLE(FILTERS_LEVEL_2)
-    , m_canCompositeBackdropFilters(false)
-#endif
-    , m_backgroundLayerPaintsFixedRootBackground(false)
 {
     if (layer.isRootLayer()) {
         m_isMainFrameRenderViewLayer = renderer().frame().isMainFrame();
-        m_usingTiledCacheLayer = renderer().page().chrome().client().shouldUseTiledBackingForFrameView(renderer().view().frameView());
+        m_isMainFrameLayerWithTiledBacking = renderer().page().chrome().client().shouldUseTiledBackingForFrameView(renderer().view().frameView());
     }
     
     createPrimaryGraphicsLayer();
 
-    if (m_usingTiledCacheLayer) {
-        TiledBacking* tiledBacking = this->tiledBacking();
-
+    if (TiledBacking* tiledBacking = this->tiledBacking()) {
         tiledBacking->setIsInWindow(renderer().page().isInWindow());
 
-        if (m_isMainFrameRenderViewLayer)
+        if (m_isMainFrameLayerWithTiledBacking) {
             tiledBacking->setUnparentsOffscreenTiles(true);
-
-        tiledBacking->setScrollingPerformanceLoggingEnabled(renderer().settings().scrollingPerformanceLoggingEnabled());
-        adjustTiledBackingCoverage();
+            tiledBacking->setScrollingPerformanceLoggingEnabled(renderer().settings().scrollingPerformanceLoggingEnabled());
+            adjustTiledBackingCoverage();
+        }
     }
 }
 
@@ -197,7 +184,7 @@ TiledBacking* RenderLayerBacking::tiledBacking() const
     return m_graphicsLayer->tiledBacking();
 }
 
-static TiledBacking::TileCoverage computeTileCoverage(RenderLayerBacking* backing)
+static TiledBacking::TileCoverage computePageTiledBackingCoverage(RenderLayerBacking* backing)
 {
     // FIXME: When we use TiledBacking for overflow, this should look at RenderView scrollability.
     FrameView& frameView = backing->owningLayer().renderer().view().frameView();
@@ -217,16 +204,16 @@ static TiledBacking::TileCoverage computeTileCoverage(RenderLayerBacking* backin
 
 void RenderLayerBacking::adjustTiledBackingCoverage()
 {
-    if (!m_usingTiledCacheLayer)
+    if (!m_isMainFrameLayerWithTiledBacking)
         return;
 
-    TiledBacking::TileCoverage tileCoverage = computeTileCoverage(this);
+    TiledBacking::TileCoverage tileCoverage = computePageTiledBackingCoverage(this);
     tiledBacking()->setTileCoverage(tileCoverage);
 }
 
 void RenderLayerBacking::setTiledBackingHasMargins(bool hasExtendedBackgroundOnLeftAndRight, bool hasExtendedBackgroundOnTopAndBottom)
 {
-    if (!m_usingTiledCacheLayer)
+    if (!m_isMainFrameLayerWithTiledBacking)
         return;
 
     tiledBacking()->setHasMargins(hasExtendedBackgroundOnTopAndBottom, hasExtendedBackgroundOnTopAndBottom, hasExtendedBackgroundOnLeftAndRight, hasExtendedBackgroundOnLeftAndRight);
@@ -284,10 +271,10 @@ void RenderLayerBacking::createPrimaryGraphicsLayer()
         layerName.truncate(maxLayerNameLength);
         layerName.append("...");
     }
-    m_graphicsLayer = createGraphicsLayer(layerName, m_usingTiledCacheLayer ? GraphicsLayer::Type::PageTiledBacking : GraphicsLayer::Type::Normal);
+    m_graphicsLayer = createGraphicsLayer(layerName, m_isMainFrameLayerWithTiledBacking ? GraphicsLayer::Type::PageTiledBacking : GraphicsLayer::Type::Normal);
 
-    if (m_usingTiledCacheLayer) {
-        m_childContainmentLayer = createGraphicsLayer("TiledBacking containment");
+    if (m_isMainFrameLayerWithTiledBacking) {
+        m_childContainmentLayer = createGraphicsLayer("Page TiledBacking containment");
         m_graphicsLayer->addChild(m_childContainmentLayer.get());
     }
 
@@ -468,7 +455,7 @@ bool RenderLayerBacking::shouldClipCompositedBounds() const
         return false;
 #endif
 
-    if (m_usingTiledCacheLayer)
+    if (m_isMainFrameLayerWithTiledBacking)
         return false;
 
     if (layerOrAncestorIsTransformedOrUsingCompositedScrolling(m_owningLayer))
@@ -1327,7 +1314,7 @@ bool RenderLayerBacking::updateDescendantClippingLayer(bool needsDescendantClip)
     bool layersChanged = false;
 
     if (needsDescendantClip) {
-        if (!m_childContainmentLayer && !m_usingTiledCacheLayer) {
+        if (!m_childContainmentLayer && !m_isMainFrameLayerWithTiledBacking) {
             m_childContainmentLayer = createGraphicsLayer("child clipping");
             m_childContainmentLayer->setMasksToBounds(true);
             layersChanged = true;
@@ -1828,7 +1815,7 @@ void RenderLayerBacking::updateDirectlyCompositedBackgroundImage(bool isSimpleCo
 
 void RenderLayerBacking::updateRootLayerConfiguration()
 {
-    if (!m_usingTiledCacheLayer)
+    if (!m_isMainFrameLayerWithTiledBacking)
         return;
 
     Color backgroundColor;
@@ -2216,7 +2203,7 @@ bool RenderLayerBacking::paintsIntoWindow() const
         return false;
 #endif
 
-    if (m_usingTiledCacheLayer)
+    if (m_isMainFrameLayerWithTiledBacking)
         return false;
 
     if (m_owningLayer.isRootLayer()) {
index 272ef82..8972451 100644 (file)
@@ -87,8 +87,8 @@ public:
     GraphicsLayer* graphicsLayer() const { return m_graphicsLayer.get(); }
 
     // Layer to clip children
-    bool hasClippingLayer() const { return (m_childContainmentLayer && !m_usingTiledCacheLayer); }
-    GraphicsLayer* clippingLayer() const { return !m_usingTiledCacheLayer ? m_childContainmentLayer.get() : nullptr; }
+    bool hasClippingLayer() const { return (m_childContainmentLayer && !m_isMainFrameLayerWithTiledBacking); }
+    GraphicsLayer* clippingLayer() const { return !m_isMainFrameLayerWithTiledBacking ? m_childContainmentLayer.get() : nullptr; }
 
     // Layer to get clipped by ancestor
     bool hasAncestorClippingLayer() const { return m_ancestorClippingLayer != nullptr; }
@@ -181,7 +181,8 @@ public:
     void positionOverflowControlsLayers();
     bool hasUnpositionedOverflowControlsLayers() const;
 
-    bool usingTiledBacking() const { return m_usingTiledCacheLayer; }
+    bool isMainFrameLayerWithTiledBacking() const { return m_isMainFrameLayerWithTiledBacking; }
+
     WEBCORE_EXPORT TiledBacking* tiledBacking() const;
     void adjustTiledBackingCoverage();
     void setTiledBackingHasMargins(bool hasExtendedBackgroundOnLeftAndRight, bool hasExtendedBackgroundOnTopAndBottom);
@@ -330,8 +331,8 @@ private:
 
     bool shouldClipCompositedBounds() const;
 
-    bool hasTiledBackingFlatteningLayer() const { return (m_childContainmentLayer && m_usingTiledCacheLayer); }
-    GraphicsLayer* tileCacheFlatteningLayer() const { return m_usingTiledCacheLayer ? m_childContainmentLayer.get() : nullptr; }
+    bool hasTiledBackingFlatteningLayer() const { return (m_childContainmentLayer && m_isMainFrameLayerWithTiledBacking); }
+    GraphicsLayer* tileCacheFlatteningLayer() const { return m_isMainFrameLayerWithTiledBacking ? m_childContainmentLayer.get() : nullptr; }
 
     void paintIntoLayer(const GraphicsLayer*, GraphicsContext&, const IntRect& paintDirtyRect, PaintBehavior, GraphicsLayerPaintingPhase);
 
@@ -363,22 +364,22 @@ private:
     std::unique_ptr<GraphicsLayer> m_scrollingLayer; // Only used if the layer is using composited scrolling.
     std::unique_ptr<GraphicsLayer> m_scrollingContentsLayer; // Only used if the layer is using composited scrolling.
 
-    ScrollingNodeID m_viewportConstrainedNodeID;
-    ScrollingNodeID m_scrollingNodeID;
-
     LayoutRect m_compositedBounds;
     LayoutSize m_subpixelOffsetFromRenderer; // This is the subpixel distance between the primary graphics layer and the associated renderer's bounds.
     LayoutSize m_compositedBoundsOffsetFromGraphicsLayer; // This is the subpixel distance between the primary graphics layer and the render layer bounds.
 
-    bool m_artificiallyInflatedBounds; // bounds had to be made non-zero to make transform-origin work
-    bool m_isMainFrameRenderViewLayer;
-    bool m_usingTiledCacheLayer;
-    bool m_requiresOwnBackingStore;
-    bool m_canCompositeFilters;
+    ScrollingNodeID m_viewportConstrainedNodeID { 0 };
+    ScrollingNodeID m_scrollingNodeID { 0 };
+
+    bool m_artificiallyInflatedBounds { false }; // bounds had to be made non-zero to make transform-origin work
+    bool m_isMainFrameRenderViewLayer { false };
+    bool m_isMainFrameLayerWithTiledBacking { false };
+    bool m_requiresOwnBackingStore { true };
+    bool m_canCompositeFilters { false };
 #if ENABLE(FILTERS_LEVEL_2)
-    bool m_canCompositeBackdropFilters;
+    bool m_canCompositeBackdropFilters { false };
 #endif
-    bool m_backgroundLayerPaintsFixedRootBackground;
+    bool m_backgroundLayerPaintsFixedRootBackground { false };
 };
 
 enum CanvasCompositingStrategy {
index 15bab8c..1a14223 100644 (file)
@@ -440,7 +440,7 @@ void RenderLayerCompositor::flushPendingLayerChanges(bool isFlushRoot)
     if (GraphicsLayer* rootLayer = rootGraphicsLayer()) {
 #if PLATFORM(IOS)
         FloatRect exposedRect = frameView.exposedContentRect();
-        LOG_WITH_STREAM(Compositing, stream << "RenderLayerCompositor " << this << " flushPendingLayerChanges (root " << isFlushRoot << ") exposedRect " << exposedRect);
+        LOG_WITH_STREAM(Compositing, stream << "\nRenderLayerCompositor " << this << " flushPendingLayerChanges (root " << isFlushRoot << ") exposedRect " << exposedRect);
         rootLayer->flushCompositingState(exposedRect);
 #else
         // Having a m_clipLayer indicates that we're doing scrolling via GraphicsLayers.
@@ -449,8 +449,9 @@ void RenderLayerCompositor::flushPendingLayerChanges(bool isFlushRoot)
         if (frameView.viewExposedRect())
             visibleRect.intersect(frameView.viewExposedRect().value());
 
-        LOG_WITH_STREAM(Compositing,  stream << "RenderLayerCompositor " << this << " flushPendingLayerChanges(" << isFlushRoot << ") " << visibleRect);
+        LOG_WITH_STREAM(Compositing,  stream << "\nRenderLayerCompositor " << this << " flushPendingLayerChanges(" << isFlushRoot << ") " << visibleRect);
         rootLayer->flushCompositingState(visibleRect);
+        LOG_WITH_STREAM(Compositing,  stream << "RenderLayerCompositor " << this << " flush complete\n");
 #endif
     }
     
@@ -1759,7 +1760,7 @@ void RenderLayerCompositor::frameViewDidLayout()
 void RenderLayerCompositor::rootFixedBackgroundsChanged()
 {
     RenderLayerBacking* renderViewBacking = m_renderView.layer()->backing();
-    if (renderViewBacking && renderViewBacking->usingTiledBacking())
+    if (renderViewBacking && renderViewBacking->isMainFrameLayerWithTiledBacking())
         setCompositingLayersNeedRebuild();
 }
 
@@ -2028,11 +2029,13 @@ GraphicsLayer* RenderLayerCompositor::footerLayer() const
 
 void RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants(RenderLayer& layer, bool isInWindow)
 {
-    if (layer.isComposited() && layer.backing()->usingTiledBacking())
-        layer.backing()->tiledBacking()->setIsInWindow(isInWindow);
+    if (layer.isComposited()) {
+        if (auto* backing = layer.backing()->tiledBacking())
+            backing->setIsInWindow(isInWindow);
+    }
 
     // No need to recurse if we don't have any other tiled layers.
-    if (hasNonMainLayersWithTiledBacking())
+    if (!hasNonMainLayersWithTiledBacking())
         return;
 
     for (RenderLayer* childLayer = layer.firstChild(); childLayer; childLayer = childLayer->nextSibling())
@@ -2842,7 +2845,7 @@ void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, Gr
 bool RenderLayerCompositor::supportsFixedRootBackgroundCompositing() const
 {
     RenderLayerBacking* renderViewBacking = m_renderView.layer()->backing();
-    return renderViewBacking && renderViewBacking->usingTiledBacking();
+    return renderViewBacking && renderViewBacking->isMainFrameLayerWithTiledBacking();
 }
 
 bool RenderLayerCompositor::needsFixedRootBackgroundLayer(const RenderLayer& layer) const
@@ -2947,7 +2950,7 @@ bool RenderLayerCompositor::documentUsesTiledBacking() const
     if (!backing)
         return false;
 
-    return backing->usingTiledBacking();
+    return backing->isMainFrameLayerWithTiledBacking();
 }
 
 bool RenderLayerCompositor::isMainFrameCompositor() const
index 37fa254..a1326b1 100644 (file)
@@ -1,3 +1,45 @@
+2017-02-03  Simon Fraser  <simon.fraser@apple.com>
+
+        Correctly set the "inWindow" flag for TileControllers that aren't the page tiles, and clarify "usingTiledBacking" logic
+        https://bugs.webkit.org/show_bug.cgi?id=167774
+
+        Reviewed by Tim Horton.
+
+        Implement UIScriptController removeViewFromWindow() and addViewToWindow(), and hook
+        up for Mac WK1 and WK2, and iOS WK2. It takes a callback because view state updates to the
+        web process are async, so the callback fires after the web process gets the new state.
+
+        * DumpRenderTree/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptController::removeViewFromWindow):
+        (WTR::UIScriptController::addViewToWindow):
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (createWebViewAndOffscreenWindow):
+        (resetWebViewToConsistentStateBeforeTesting):
+        * DumpRenderTree/mac/DumpRenderTreeMac.h:
+        * DumpRenderTree/mac/UIScriptControllerMac.mm:
+        (WTR::UIScriptController::removeViewFromWindow):
+        (WTR::UIScriptController::addViewToWindow):
+        * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+        * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
+        (WTR::UIScriptController::removeViewFromWindow):
+        (WTR::UIScriptController::addViewToWindow):
+        * TestRunnerShared/UIScriptContext/UIScriptController.h:
+        * WebKitTestRunner/PlatformWebView.h:
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::resetStateToConsistentValues):
+        * WebKitTestRunner/ios/PlatformWebViewIOS.mm:
+        (WTR::PlatformWebView::removeFromWindow):
+        (WTR::PlatformWebView::addToWindow):
+        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptController::removeViewFromWindow):
+        (WTR::UIScriptController::addViewToWindow):
+        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+        (WTR::PlatformWebView::removeFromWindow):
+        (WTR::PlatformWebView::addToWindow):
+        * WebKitTestRunner/mac/UIScriptControllerMac.mm:
+        (WTR::UIScriptController::removeViewFromWindow):
+        (WTR::UIScriptController::addViewToWindow):
+
 2017-02-03  Alexey Proskuryakov  <ap@apple.com>
 
         Remove check for SkipSafariExecutableEntitlementChecks
index 803f462..e98114a 100644 (file)
@@ -298,6 +298,14 @@ JSRetainPtr<JSStringRef> UIScriptController::accessibilitySpeakSelectionContent(
     return nullptr;
 }
 
+void UIScriptController::removeViewFromWindow(JSValueRef)
+{
+}
+
+void UIScriptController::addViewToWindow(JSValueRef)
+{
+}
+
 }
 
 #endif // PLATFORM(IOS)
index 3b8f2cb..3370580 100644 (file)
@@ -179,13 +179,16 @@ volatile bool done;
 NavigationController* gNavigationController = nullptr;
 RefPtr<TestRunner> gTestRunner;
 
-WebFrame *mainFrame = nullptr;
+WebFrame *mainFrame = nil;
 // This is the topmost frame that is loading, during a given load, or nil when no load is 
 // in progress.  Usually this is the same as the main frame, but not always.  In the case
 // where a frameset is loaded, and then new content is loaded into one of the child frames,
 // that child frame is the "topmost frame that is loading".
-WebFrame *topLoadingFrame = nullptr; // !nil iff a load is in progress
+WebFrame *topLoadingFrame = nil; // !nil iff a load is in progress
 
+#if PLATFORM(MAC)
+NSWindow *mainWindow = nil;
+#endif
 
 CFMutableSetRef disallowedURLs= nullptr;
 static CFRunLoopTimerRef waitToDumpWatchdog;
@@ -798,6 +801,7 @@ WebView *createWebViewAndOffscreenWindow()
     NSScreen *firstScreen = [[NSScreen screens] firstObject];
     NSRect windowRect = (showWebView) ? NSOffsetRect(rect, 100, 100) : NSOffsetRect(rect, -10000, [firstScreen frame].size.height - rect.size.height + 10000);
     DumpRenderTreeWindow *window = [[DumpRenderTreeWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];
+    mainWindow = window;
 
     [window setColorSpace:[firstScreen colorSpace]];
     [window setCollectionBehavior:NSWindowCollectionBehaviorStationary];
@@ -1841,6 +1845,12 @@ static bool shouldMakeViewportFlexible(const char* pathOrURL)
 static void resetWebViewToConsistentStateBeforeTesting(const TestOptions& options)
 {
     WebView *webView = [mainFrame webView];
+
+#if PLATFORM(MAC)
+    if (![webView superview])
+        [[mainWindow contentView] addSubview:webView];
+#endif
+
 #if PLATFORM(IOS)
     adjustWebDocumentForStandardViewport(gWebBrowserView, gWebScrollView);
     [webView _setAllowsMessaging:YES];
index 5cc3892..fe4e6b2 100644 (file)
@@ -48,6 +48,14 @@ extern NavigationController* gNavigationController;
 extern PolicyDelegate* policyDelegate;
 extern DefaultPolicyDelegate *defaultPolicyDelegate;
 
+#if PLATFORM(IOS)
+OBJC_CLASS UIWindow;
+extern UIWindow *mainWindow;
+#else
+OBJC_CLASS NSWindow;
+extern NSWindow *mainWindow;
+#endif
+
 void setWaitToDumpWatchdog(CFRunLoopTimerRef);
 bool shouldSetWaitToDumpWatchdog();
 
index 4887c7d..fb982cd 100644 (file)
@@ -70,7 +70,7 @@ void UIScriptController::zoomToScale(double scale, JSValueRef callback)
     WebView *webView = [mainFrame webView];
     [webView _scaleWebView:scale atOrigin:NSZeroPoint];
 
-    dispatch_async(dispatch_get_main_queue(), ^ {
+    dispatch_async(dispatch_get_main_queue(), ^{
         if (!m_context)
             return;
         m_context->asyncTaskComplete(callbackID);
@@ -94,6 +94,34 @@ JSObjectRef UIScriptController::contentsOfUserInterfaceItem(JSStringRef interfac
 #endif
 }
 
+void UIScriptController::removeViewFromWindow(JSValueRef callback)
+{
+    unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
+
+    WebView *webView = [mainFrame webView];
+    [webView removeFromSuperview];
+
+    dispatch_async(dispatch_get_main_queue(), ^{
+        if (!m_context)
+            return;
+        m_context->asyncTaskComplete(callbackID);
+    });
+}
+
+void UIScriptController::addViewToWindow(JSValueRef callback)
+{
+    unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
+
+    WebView *webView = [mainFrame webView];
+    [[mainWindow contentView] addSubview:webView];
+
+    dispatch_async(dispatch_get_main_queue(), ^{
+        if (!m_context)
+            return;
+        m_context->asyncTaskComplete(callbackID);
+    });
+}
+
 }
 
 #endif // PLATFORM(MAC)
index f100f1e..eaf0d7e 100644 (file)
@@ -26,6 +26,8 @@
 interface UIScriptController {
 
     void doAsyncTask(object callback); // Used to test the harness.
+    void uiScriptComplete(DOMString result);
+
     void doAfterPresentationUpdate(object callback); // Call the callback after sending a message to the WebProcess and receiving a subsequent update.
     void doAfterNextStablePresentationUpdate(object callback);
 
@@ -213,8 +215,11 @@ interface UIScriptController {
 
     readonly attribute DOMString scrollingTreeAsText;
 
-    void uiScriptComplete(DOMString result);
-
     void retrieveSpeakSelectionContent(object callback);
     readonly attribute DOMString accessibilitySpeakSelectionContent;
+
+    // Unparent and parent the web view, simulating, for example, tab switching.
+    void removeViewFromWindow(object callback);
+    void addViewToWindow(object callback);
+
 };
index 2088ce4..0bb13fa 100644 (file)
@@ -387,6 +387,18 @@ JSRetainPtr<JSStringRef> UIScriptController::accessibilitySpeakSelectionContent(
 
 #endif
 
+#if !PLATFORM(COCOA)
+
+void UIScriptController::removeViewFromWindow(JSValueRef)
+{
+}
+
+void UIScriptController::addViewToWindow(JSValueRef)
+{
+}
+
+#endif // !PLATFORM(COCOA)
+
 #if !PLATFORM(MAC)
 
 void UIScriptController::insertText(JSStringRef, int, int)
index dc22836..0bbf661 100644 (file)
@@ -140,9 +140,13 @@ public:
 
     void uiScriptComplete(JSStringRef result);
     
-    void retrieveSpeakSelectionContent(JSValueRef callback);
+    void retrieveSpeakSelectionContent(JSValueRef);
     JSRetainPtr<JSStringRef> accessibilitySpeakSelectionContent() const;
 
+    // These use a callback to allow the client to know when view visibility state updates get to the web process.
+    void removeViewFromWindow(JSValueRef);
+    void addViewToWindow(JSValueRef);
+
 private:
     UIScriptController(UIScriptContext&);
     
index 2aeb123..aa0ab2e 100644 (file)
@@ -86,6 +86,9 @@ public:
     void makeWebViewFirstResponder();
     void setWindowIsKey(bool);
     bool windowIsKey() const { return m_windowIsKey; }
+    
+    void removeFromWindow();
+    void addToWindow();
 
     bool viewSupportsOptions(const TestOptions&) const;
 
index e92f96e..a685080 100644 (file)
@@ -753,6 +753,9 @@ bool TestController::resetStateToConsistentValues(const TestOptions& options)
     WKTextCheckerContinuousSpellCheckingEnabledStateChanged(true);
 #endif
 
+    // Make sure the view is in the window (a test can unparent it).
+    m_mainWebView->addToWindow();
+
     // In the case that a test using the chrome input field failed, be sure to clean up for the next test.
     m_mainWebView->removeChromeInputField();
     m_mainWebView->focus();
index 7fd4a2b..abe2ecb 100644 (file)
@@ -129,6 +129,14 @@ void PlatformWebView::removeChromeInputField()
 {
 }
 
+void PlatformWebView::addToWindow()
+{
+}
+
+void PlatformWebView::removeFromWindow()
+{
+}
+
 void PlatformWebView::makeWebViewFirstResponder()
 {
 }
index e90a3dd..eb0a08d 100644 (file)
@@ -116,6 +116,14 @@ void PlatformWebView::removeChromeInputField()
 {
 }
 
+void PlatformWebView::addToWindow()
+{
+}
+
+void PlatformWebView::removeFromWindow()
+{
+}
+
 void PlatformWebView::makeWebViewFirstResponder()
 {
 }
index 2055e98..bda91e0 100644 (file)
@@ -166,6 +166,16 @@ void PlatformWebView::setWindowIsKey(bool isKey)
         [m_window makeKeyWindow];
 }
 
+void PlatformWebView::addToWindow()
+{
+    [m_window.rootViewController.view addSubview:m_view];
+}
+
+void PlatformWebView::removeFromWindow()
+{
+    [m_view removeFromSuperview];
+}
+
 void PlatformWebView::resizeTo(unsigned width, unsigned height, WebViewSizingMode viewSizingMode)
 {
     WKRect frame = windowFrame();
index 86b4422..d87ef32 100644 (file)
@@ -536,6 +536,16 @@ JSRetainPtr<JSStringRef> UIScriptController::scrollingTreeAsText() const
     return JSStringCreateWithCFString((CFStringRef)[webView _scrollingTreeAsText]);
 }
 
+void UIScriptController::removeViewFromWindow(JSValueRef callback)
+{
+    TestController::singleton().mainWebView()->removeFromWindow();
+}
+
+void UIScriptController::addViewToWindow(JSValueRef callback)
+{
+    TestController::singleton().mainWebView()->addToWindow();
+}
+
 void UIScriptController::platformSetDidStartFormControlInteractionCallback()
 {
     TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
index c2b278c..24df9f7 100644 (file)
@@ -252,6 +252,16 @@ void PlatformWebView::removeChromeInputField()
     }
 }
 
+void PlatformWebView::addToWindow()
+{
+    [[m_window contentView] addSubview:m_view];
+}
+
+void PlatformWebView::removeFromWindow()
+{
+    [m_view removeFromSuperview];
+}
+
 void PlatformWebView::makeWebViewFirstResponder()
 {
     [m_window makeFirstResponder:platformView()];
index 69840d2..2261ed7 100644 (file)
@@ -131,4 +131,40 @@ JSObjectRef UIScriptController::contentsOfUserInterfaceItem(JSStringRef interfac
 #endif
 }
 
+void UIScriptController::removeViewFromWindow(JSValueRef callback)
+{
+#if WK_API_ENABLED
+    unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
+
+    auto* mainWebView = TestController::singleton().mainWebView();
+    mainWebView->removeFromWindow();
+
+    [mainWebView->platformView() _doAfterNextPresentationUpdate: ^ {
+        if (!m_context)
+            return;
+        m_context->asyncTaskComplete(callbackID);
+    }];
+#else
+    UNUSED_PARAM(callback);
+#endif
+}
+
+void UIScriptController::addViewToWindow(JSValueRef callback)
+{
+#if WK_API_ENABLED
+    unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
+
+    auto* mainWebView = TestController::singleton().mainWebView();
+    mainWebView->addToWindow();
+
+    [mainWebView->platformView() _doAfterNextPresentationUpdate: ^ {
+        if (!m_context)
+            return;
+        m_context->asyncTaskComplete(callbackID);
+    }];
+#else
+    UNUSED_PARAM(callback);
+#endif
+}
+
 } // namespace WTR