Title: [199200] trunk
Revision
199200
Author
[email protected]
Date
2016-04-07 16:14:25 -0700 (Thu, 07 Apr 2016)

Log Message

Make it possible to test effect of view exposed rect on tiled backing
https://bugs.webkit.org/show_bug.cgi?id=156365

Reviewed by Tim Horton.

Source/WebCore:

Implement Internals::setViewExposedRect().

When the viewExposedRect is non-null, assume that we're scrollable on both axes
to avoid creation of huge tiles in this scenario.

We also need to call adjustTiledBackingScrollability() when setViewExposedRect()
has been called.

Tests: tiled-drawing/tile-coverage-view-exposed-rect.html
       tiled-drawing/tile-size-view-exposed-rect.html

* page/FrameView.cpp:
(WebCore::FrameView::adjustTiledBackingScrollability):
(WebCore::FrameView::setViewExposedRect):
* testing/Internals.cpp:
(WebCore::Internals::setViewExposedRect):
* testing/Internals.h:
* testing/Internals.idl:

Tools:

Expose testRunner.setViewSize() and internals.setViewExposedRect() to enable
testing of tile coverage when setViewExposedRect() is passed a non-null rectangle.

testRunner.setViewSize() is used instead of using window.resizeTo(), since we
can't easily resize a window to larger than the screen being tested on.

* DumpRenderTree/TestRunner.cpp:
(setViewSizeCallback):
(TestRunner::staticFunctions):
* DumpRenderTree/TestRunner.h:
* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::setViewSize):
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::postSetViewSize):
* WebKitTestRunner/InjectedBundle/InjectedBundle.h:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setViewSize):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

LayoutTests:

Tests for tile size and tile coverage when we have an exposed view rect.

* tiled-drawing/tile-coverage-view-exposed-rect-expected.txt: Added.
* tiled-drawing/tile-coverage-view-exposed-rect.html: Added.
* tiled-drawing/tile-size-view-exposed-rect-expected.txt: Added.
* tiled-drawing/tile-size-view-exposed-rect.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (199199 => 199200)


--- trunk/LayoutTests/ChangeLog	2016-04-07 22:44:37 UTC (rev 199199)
+++ trunk/LayoutTests/ChangeLog	2016-04-07 23:14:25 UTC (rev 199200)
@@ -1,3 +1,17 @@
+2016-04-07  Simon Fraser  <[email protected]>
+
+        Make it possible to test effect of view exposed rect on tiled backing
+        https://bugs.webkit.org/show_bug.cgi?id=156365
+
+        Reviewed by Tim Horton.
+
+        Tests for tile size and tile coverage when we have an exposed view rect.
+
+        * tiled-drawing/tile-coverage-view-exposed-rect-expected.txt: Added.
+        * tiled-drawing/tile-coverage-view-exposed-rect.html: Added.
+        * tiled-drawing/tile-size-view-exposed-rect-expected.txt: Added.
+        * tiled-drawing/tile-size-view-exposed-rect.html: Added.
+
 2016-04-07  Jiewen Tan  <[email protected]>
 
         fast/loader/opaque-base-url.html crashing during mac and ios debug tests

Added: trunk/LayoutTests/tiled-drawing/tile-coverage-view-exposed-rect-expected.txt (0 => 199200)


--- trunk/LayoutTests/tiled-drawing/tile-coverage-view-exposed-rect-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/tiled-drawing/tile-coverage-view-exposed-rect-expected.txt	2016-04-07 23:14:25 UTC (rev 199200)
@@ -0,0 +1,14 @@
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 2500.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 2500.00)
+      (contentsOpaque 1)
+      (tile cache coverage 0, 1024 800 x 512)
+      (tile size 512 x 512)
+      (top left tile 0, 2 tiles grid 2 x 1)
+    )
+  )
+)
+

Added: trunk/LayoutTests/tiled-drawing/tile-coverage-view-exposed-rect.html (0 => 199200)


--- trunk/LayoutTests/tiled-drawing/tile-coverage-view-exposed-rect.html	                        (rev 0)
+++ trunk/LayoutTests/tiled-drawing/tile-coverage-view-exposed-rect.html	2016-04-07 23:14:25 UTC (rev 199200)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+
+            if (window.internals)
+                internals.setViewExposedRect(0, 1025, 800, 200);
+
+            testRunner.setViewSize(800, 2500);
+            testRunner.waitUntilDone();
+        }
+
+        function doTest()
+        {
+            window.setTimeout(function() {
+                if (window.internals) {
+                    document.getElementById('layers').innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_TILE_CACHES);
+                }
+
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            }, 0);
+        }
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+<pre id="layers">Layer tree goes here</p>
+</body>
+</html>

Added: trunk/LayoutTests/tiled-drawing/tile-size-view-exposed-rect-expected.txt (0 => 199200)


--- trunk/LayoutTests/tiled-drawing/tile-size-view-exposed-rect-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/tiled-drawing/tile-size-view-exposed-rect-expected.txt	2016-04-07 23:14:25 UTC (rev 199200)
@@ -0,0 +1,14 @@
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (tile cache coverage 0, 0 800 x 512)
+      (tile size 512 x 512)
+      (top left tile 0, 0 tiles grid 2 x 1)
+    )
+  )
+)
+

Added: trunk/LayoutTests/tiled-drawing/tile-size-view-exposed-rect.html (0 => 199200)


--- trunk/LayoutTests/tiled-drawing/tile-size-view-exposed-rect.html	                        (rev 0)
+++ trunk/LayoutTests/tiled-drawing/tile-size-view-exposed-rect.html	2016-04-07 23:14:25 UTC (rev 199200)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+
+        if (window.internals)
+            internals.setViewExposedRect(0, 200, 800, 200);
+
+        function doTest()
+        {
+            if (window.internals) {
+                document.getElementById('layers').innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_TILE_CACHES);
+            }
+        }
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+<pre id="layers">Layer tree goes here</p>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (199199 => 199200)


--- trunk/Source/WebCore/ChangeLog	2016-04-07 22:44:37 UTC (rev 199199)
+++ trunk/Source/WebCore/ChangeLog	2016-04-07 23:14:25 UTC (rev 199200)
@@ -1,3 +1,29 @@
+2016-04-07  Simon Fraser  <[email protected]>
+
+        Make it possible to test effect of view exposed rect on tiled backing
+        https://bugs.webkit.org/show_bug.cgi?id=156365
+
+        Reviewed by Tim Horton.
+
+        Implement Internals::setViewExposedRect().
+
+        When the viewExposedRect is non-null, assume that we're scrollable on both axes
+        to avoid creation of huge tiles in this scenario.
+
+        We also need to call adjustTiledBackingScrollability() when setViewExposedRect()
+        has been called.
+
+        Tests: tiled-drawing/tile-coverage-view-exposed-rect.html
+               tiled-drawing/tile-size-view-exposed-rect.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::adjustTiledBackingScrollability):
+        (WebCore::FrameView::setViewExposedRect):
+        * testing/Internals.cpp:
+        (WebCore::Internals::setViewExposedRect):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2016-04-07  Jiewen Tan  <[email protected]>
 
         fast/loader/opaque-base-url.html crashing during mac and ios debug tests

Modified: trunk/Source/WebCore/page/FrameView.cpp (199199 => 199200)


--- trunk/Source/WebCore/page/FrameView.cpp	2016-04-07 22:44:37 UTC (rev 199199)
+++ trunk/Source/WebCore/page/FrameView.cpp	2016-04-07 23:14:25 UTC (rev 199200)
@@ -2483,16 +2483,17 @@
     
     bool horizontallyScrollable;
     bool verticallyScrollable;
+    bool clippedByAncestorView = static_cast<bool>(m_viewExposedRect);
 
     if (delegatesScrolling()) {
         IntSize documentSize = contentsSize();
         IntSize visibleSize = this->visibleSize();
         
-        horizontallyScrollable = documentSize.width() > visibleSize.width();
-        verticallyScrollable = documentSize.height() > visibleSize.height();
+        horizontallyScrollable = clippedByAncestorView || documentSize.width() > visibleSize.width();
+        verticallyScrollable = clippedByAncestorView || documentSize.height() > visibleSize.height();
     } else {
-        horizontallyScrollable = horizontalScrollbar();
-        verticallyScrollable = verticalScrollbar();
+        horizontallyScrollable = clippedByAncestorView || horizontalScrollbar();
+        verticallyScrollable = clippedByAncestorView || verticalScrollbar();
     }
 
     TiledBacking::Scrollability scrollability = TiledBacking::NotScrollable;
@@ -4913,6 +4914,9 @@
     if (m_viewExposedRect == viewExposedRect)
         return;
 
+    LOG_WITH_STREAM(Scrolling, stream << "FrameView " << this << " setViewExposedRect " << (viewExposedRect ? viewExposedRect.value() : FloatRect()));
+
+    bool hasRectChanged = !m_viewExposedRect == !viewExposedRect;
     m_viewExposedRect = viewExposedRect;
 
     // FIXME: We should support clipping to the exposed rect for subframes as well.
@@ -4920,6 +4924,8 @@
         return;
 
     if (TiledBacking* tiledBacking = this->tiledBacking()) {
+        if (hasRectChanged)
+            adjustTiledBackingScrollability();
         adjustTiledBackingCoverage();
         tiledBacking->setTiledScrollingIndicatorPosition(m_viewExposedRect ? m_viewExposedRect.value().location() : FloatPoint());
     }

Modified: trunk/Source/WebCore/testing/Internals.cpp (199199 => 199200)


--- trunk/Source/WebCore/testing/Internals.cpp	2016-04-07 22:44:37 UTC (rev 199199)
+++ trunk/Source/WebCore/testing/Internals.cpp	2016-04-07 23:14:25 UTC (rev 199200)
@@ -2389,6 +2389,18 @@
     frameView->setFixedLayoutSize(IntSize(width, height));
 }
 
+void Internals::setViewExposedRect(float x, float y, float width, float height, ExceptionCode& ec)
+{
+    Document* document = contextDocument();
+    if (!document || !document->view()) {
+        ec = INVALID_ACCESS_ERR;
+        return;
+    }
+
+    FrameView* frameView = document->view();
+    frameView->setViewExposedRect(FloatRect(x, y, width, height));
+}
+
 void Internals::setHeaderHeight(float height)
 {
     Document* document = contextDocument();

Modified: trunk/Source/WebCore/testing/Internals.h (199199 => 199200)


--- trunk/Source/WebCore/testing/Internals.h	2016-04-07 22:44:37 UTC (rev 199199)
+++ trunk/Source/WebCore/testing/Internals.h	2016-04-07 23:14:25 UTC (rev 199200)
@@ -303,6 +303,7 @@
 
     void setUseFixedLayout(bool useFixedLayout, ExceptionCode&);
     void setFixedLayoutSize(int width, int height, ExceptionCode&);
+    void setViewExposedRect(float left, float top, float width, float height, ExceptionCode&);
 
     void setHeaderHeight(float);
     void setFooterHeight(float);

Modified: trunk/Source/WebCore/testing/Internals.idl (199199 => 199200)


--- trunk/Source/WebCore/testing/Internals.idl	2016-04-07 22:44:37 UTC (rev 199199)
+++ trunk/Source/WebCore/testing/Internals.idl	2016-04-07 23:14:25 UTC (rev 199200)
@@ -287,6 +287,8 @@
     [RaisesException] void setUseFixedLayout(boolean useFixedLayout);
     [RaisesException] void setFixedLayoutSize(long width, long height);
 
+    [RaisesException] void setViewExposedRect(unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height);
+
     void setHeaderHeight(unrestricted float height);
     void setFooterHeight(unrestricted float height);
 

Modified: trunk/Tools/ChangeLog (199199 => 199200)


--- trunk/Tools/ChangeLog	2016-04-07 22:44:37 UTC (rev 199199)
+++ trunk/Tools/ChangeLog	2016-04-07 23:14:25 UTC (rev 199200)
@@ -1,3 +1,32 @@
+2016-04-07  Simon Fraser  <[email protected]>
+
+        Make it possible to test effect of view exposed rect on tiled backing
+        https://bugs.webkit.org/show_bug.cgi?id=156365
+
+        Reviewed by Tim Horton.
+
+        Expose testRunner.setViewSize() and internals.setViewExposedRect() to enable
+        testing of tile coverage when setViewExposedRect() is passed a non-null rectangle.
+
+        testRunner.setViewSize() is used instead of using window.resizeTo(), since we
+        can't easily resize a window to larger than the screen being tested on.
+
+        * DumpRenderTree/TestRunner.cpp:
+        (setViewSizeCallback):
+        (TestRunner::staticFunctions):
+        * DumpRenderTree/TestRunner.h:
+        * DumpRenderTree/mac/TestRunnerMac.mm:
+        (TestRunner::setViewSize):
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::postSetViewSize):
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setViewSize):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+
 2016-04-07  Jason Marcell  <[email protected]>
 
         Adding layout tests for the bot watcher's dashboard QUnit tests.

Modified: trunk/Tools/DumpRenderTree/TestRunner.cpp (199199 => 199200)


--- trunk/Tools/DumpRenderTree/TestRunner.cpp	2016-04-07 22:44:37 UTC (rev 199199)
+++ trunk/Tools/DumpRenderTree/TestRunner.cpp	2016-04-07 23:14:25 UTC (rev 199200)
@@ -1385,6 +1385,22 @@
     return JSValueMakeUndefined(context);
 }
 
+static JSValueRef setViewSizeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    if (argumentCount < 2)
+        return JSValueMakeUndefined(context);
+
+    double width = JSValueToNumber(context, arguments[0], exception);
+    ASSERT(!*exception);
+    double height = JSValueToNumber(context, arguments[1], exception);
+    ASSERT(!*exception);
+
+    TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
+    controller->setViewSize(width, height);
+
+    return JSValueMakeUndefined(context);
+}
+
 static JSValueRef waitUntilDoneCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     // Has mac & windows implementation
@@ -2127,6 +2143,7 @@
         { "setWillSendRequestReturnsNull", setWillSendRequestReturnsNullCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setWillSendRequestReturnsNullOnRedirect", setWillSendRequestReturnsNullOnRedirectCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setWindowIsKey", setWindowIsKeyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "setViewSize", setViewSizeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setJavaScriptCanAccessClipboard", setJavaScriptCanAccessClipboardCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setXSSAuditorEnabled", setXSSAuditorEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "showWebInspector", showWebInspectorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },

Modified: trunk/Tools/DumpRenderTree/TestRunner.h (199199 => 199200)


--- trunk/Tools/DumpRenderTree/TestRunner.h	2016-04-07 22:44:37 UTC (rev 199199)
+++ trunk/Tools/DumpRenderTree/TestRunner.h	2016-04-07 23:14:25 UTC (rev 199200)
@@ -259,6 +259,8 @@
     bool windowIsKey() const { return m_windowIsKey; }
     void setWindowIsKey(bool);
 
+    void setViewSize(double width, double height);
+
     bool alwaysAcceptCookies() const { return m_alwaysAcceptCookies; }
     void setAlwaysAcceptCookies(bool);
     

Modified: trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm (199199 => 199200)


--- trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm	2016-04-07 22:44:37 UTC (rev 199199)
+++ trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm	2016-04-07 23:14:25 UTC (rev 199200)
@@ -616,6 +616,11 @@
     [[mainFrame webView] _updateActiveState];
 }
 
+void TestRunner::setViewSize(double width, double height)
+{
+    [[mainFrame webView] setFrameSize:NSMakeSize(width, height)];
+}
+
 static void waitUntilDoneWatchdogFired(CFRunLoopTimerRef timer, void* info)
 {
     gTestRunner->waitToDumpWatchdogTimerFired();

Modified: trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp (199199 => 199200)


--- trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp	2016-04-07 22:44:37 UTC (rev 199199)
+++ trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp	2016-04-07 23:14:25 UTC (rev 199200)
@@ -894,6 +894,23 @@
     ::SendMessage(webViewWindow, flag ? WM_SETFOCUS : WM_KILLFOCUS, (WPARAM)::GetDesktopWindow(), 0);
 }
 
+void TestRunner::setViewSize(double width, double height)
+{
+    COMPtr<IWebView> webView;
+    if (FAILED(frame->webView(&webView)))
+        return;
+
+    COMPtr<IWebViewPrivate2> viewPrivate;
+    if (FAILED(webView->QueryInterface(&viewPrivate)))
+        return;
+
+    HWND webViewWindow;
+    if (FAILED(viewPrivate->viewWindow(&webViewWindow)))
+        return;
+
+    ::SetWindowPos(webViewWindow, 0, 0, 0, width, height, SWP_NOMOVE);
+}
+
 static const CFTimeInterval waitToDumpWatchdogInterval = 30.0;
 
 static void CALLBACK waitUntilDoneWatchdogFired(HWND, UINT, UINT_PTR, DWORD)

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (199199 => 199200)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2016-04-07 22:44:37 UTC (rev 199199)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2016-04-07 23:14:25 UTC (rev 199200)
@@ -148,11 +148,11 @@
     void removeChromeInputField(object callback);
     void focusWebView(object callback);
 
-    void clearTestRunnerCallbacks();
-
+    // Window/view state
     void setBackingScaleFactor(double backingScaleFactor, object callback);
 
     void setWindowIsKey(boolean isKey);
+    void setViewSize(double width, double height);
 
     // Cookies testing
     void setAlwaysAcceptCookies(boolean accept);
@@ -220,5 +220,7 @@
 
     // UI Process Testing
     void runUIScript(DOMString script, object callback);
+
+    void clearTestRunnerCallbacks();
 };
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (199199 => 199200)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2016-04-07 22:44:37 UTC (rev 199199)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2016-04-07 23:14:25 UTC (rev 199200)
@@ -442,6 +442,24 @@
     WKBundlePagePostSynchronousMessageForTesting(page()->page(), messageName.get(), messageBody.get(), 0);
 }
 
+void InjectedBundle::postSetViewSize(double width, double height)
+{
+    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetViewSize"));
+
+    WKRetainPtr<WKStringRef> widthKey(AdoptWK, WKStringCreateWithUTF8CString("width"));
+    WKRetainPtr<WKStringRef> heightKey(AdoptWK, WKStringCreateWithUTF8CString("height"));
+
+    WKRetainPtr<WKMutableDictionaryRef> messageBody(AdoptWK, WKMutableDictionaryCreate());
+
+    WKRetainPtr<WKDoubleRef> widthWK(AdoptWK, WKDoubleCreate(width));
+    WKDictionarySetItem(messageBody.get(), widthKey.get(), widthWK.get());
+
+    WKRetainPtr<WKDoubleRef> heightWK(AdoptWK, WKDoubleCreate(height));
+    WKDictionarySetItem(messageBody.get(), heightKey.get(), heightWK.get());
+
+    WKBundlePagePostSynchronousMessageForTesting(page()->page(), messageName.get(), messageBody.get(), 0);
+}
+
 void InjectedBundle::postSimulateWebNotificationClick(uint64_t notificationID)
 {
     WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SimulateWebNotificationClick"));

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h (199199 => 199200)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h	2016-04-07 22:44:37 UTC (rev 199199)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h	2016-04-07 23:14:25 UTC (rev 199200)
@@ -85,6 +85,7 @@
     void postFocusWebView();
     void postSetBackingScaleFactor(double);
     void postSetWindowIsKey(bool);
+    void postSetViewSize(double width, double height);
     void postSimulateWebNotificationClick(uint64_t notificationID);
     void postSetAddsVisitedLinks(bool);
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (199199 => 199200)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2016-04-07 22:44:37 UTC (rev 199199)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2016-04-07 23:14:25 UTC (rev 199200)
@@ -623,6 +623,11 @@
     InjectedBundle::singleton().postSetWindowIsKey(isKey);
 }
 
+void TestRunner::setViewSize(double width, double height)
+{
+    InjectedBundle::singleton().postSetViewSize(width, height);
+}
+
 void TestRunner::callAddChromeInputFieldCallback()
 {
     callTestRunnerCallback(AddChromeInputFieldCallbackID);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (199199 => 199200)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2016-04-07 22:44:37 UTC (rev 199199)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2016-04-07 23:14:25 UTC (rev 199200)
@@ -246,6 +246,8 @@
 
     void setWindowIsKey(bool);
 
+    void setViewSize(double width, double height);
+
     void callAddChromeInputFieldCallback();
     void callRemoveChromeInputFieldCallback();
     void callFocusWebViewCallback();

Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (199199 => 199200)


--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2016-04-07 22:44:37 UTC (rev 199199)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2016-04-07 23:14:25 UTC (rev 199200)
@@ -665,6 +665,20 @@
         return nullptr;
     }
 
+    if (WKStringIsEqualToUTF8CString(messageName, "SetViewSize")) {
+        ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
+
+        WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody);
+        WKRetainPtr<WKStringRef> widthKey(AdoptWK, WKStringCreateWithUTF8CString("width"));
+        WKRetainPtr<WKStringRef> heightKey(AdoptWK, WKStringCreateWithUTF8CString("height"));
+
+        WKDoubleRef widthWK = static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, widthKey.get()));
+        WKDoubleRef heightWK = static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, heightKey.get()));
+
+        TestController::singleton().mainWebView()->resizeTo(WKDoubleGetValue(widthWK), WKDoubleGetValue(heightWK));
+        return nullptr;
+    }
+
     if (WKStringIsEqualToUTF8CString(messageName, "IsGeolocationClientActive")) {
         bool isActive = TestController::singleton().isGeolocationProviderActive();
         WKRetainPtr<WKTypeRef> result(AdoptWK, WKBooleanCreate(isActive));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to