Changeset 199200 in webkit


Ignore:
Timestamp:
Apr 7, 2016 4:14:25 PM (8 years ago)
Author:
Simon Fraser
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.
Location:
trunk
Files:
4 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r199199 r199200  
     12016-04-07  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Make it possible to test effect of view exposed rect on tiled backing
     4        https://bugs.webkit.org/show_bug.cgi?id=156365
     5
     6        Reviewed by Tim Horton.
     7
     8        Tests for tile size and tile coverage when we have an exposed view rect.
     9
     10        * tiled-drawing/tile-coverage-view-exposed-rect-expected.txt: Added.
     11        * tiled-drawing/tile-coverage-view-exposed-rect.html: Added.
     12        * tiled-drawing/tile-size-view-exposed-rect-expected.txt: Added.
     13        * tiled-drawing/tile-size-view-exposed-rect.html: Added.
     14
    1152016-04-07  Jiewen Tan  <jiewen_tan@apple.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r199199 r199200  
     12016-04-07  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Make it possible to test effect of view exposed rect on tiled backing
     4        https://bugs.webkit.org/show_bug.cgi?id=156365
     5
     6        Reviewed by Tim Horton.
     7
     8        Implement Internals::setViewExposedRect().
     9
     10        When the viewExposedRect is non-null, assume that we're scrollable on both axes
     11        to avoid creation of huge tiles in this scenario.
     12
     13        We also need to call adjustTiledBackingScrollability() when setViewExposedRect()
     14        has been called.
     15
     16        Tests: tiled-drawing/tile-coverage-view-exposed-rect.html
     17               tiled-drawing/tile-size-view-exposed-rect.html
     18
     19        * page/FrameView.cpp:
     20        (WebCore::FrameView::adjustTiledBackingScrollability):
     21        (WebCore::FrameView::setViewExposedRect):
     22        * testing/Internals.cpp:
     23        (WebCore::Internals::setViewExposedRect):
     24        * testing/Internals.h:
     25        * testing/Internals.idl:
     26
    1272016-04-07  Jiewen Tan  <jiewen_tan@apple.com>
    228
  • trunk/Source/WebCore/page/FrameView.cpp

    r199155 r199200  
    24842484    bool horizontallyScrollable;
    24852485    bool verticallyScrollable;
     2486    bool clippedByAncestorView = static_cast<bool>(m_viewExposedRect);
    24862487
    24872488    if (delegatesScrolling()) {
     
    24892490        IntSize visibleSize = this->visibleSize();
    24902491       
    2491         horizontallyScrollable = documentSize.width() > visibleSize.width();
    2492         verticallyScrollable = documentSize.height() > visibleSize.height();
     2492        horizontallyScrollable = clippedByAncestorView || documentSize.width() > visibleSize.width();
     2493        verticallyScrollable = clippedByAncestorView || documentSize.height() > visibleSize.height();
    24932494    } else {
    2494         horizontallyScrollable = horizontalScrollbar();
    2495         verticallyScrollable = verticalScrollbar();
     2495        horizontallyScrollable = clippedByAncestorView || horizontalScrollbar();
     2496        verticallyScrollable = clippedByAncestorView || verticalScrollbar();
    24962497    }
    24972498
     
    49144915        return;
    49154916
     4917    LOG_WITH_STREAM(Scrolling, stream << "FrameView " << this << " setViewExposedRect " << (viewExposedRect ? viewExposedRect.value() : FloatRect()));
     4918
     4919    bool hasRectChanged = !m_viewExposedRect == !viewExposedRect;
    49164920    m_viewExposedRect = viewExposedRect;
    49174921
     
    49214925
    49224926    if (TiledBacking* tiledBacking = this->tiledBacking()) {
     4927        if (hasRectChanged)
     4928            adjustTiledBackingScrollability();
    49234929        adjustTiledBackingCoverage();
    49244930        tiledBacking->setTiledScrollingIndicatorPosition(m_viewExposedRect ? m_viewExposedRect.value().location() : FloatPoint());
  • trunk/Source/WebCore/testing/Internals.cpp

    r199076 r199200  
    23902390}
    23912391
     2392void Internals::setViewExposedRect(float x, float y, float width, float height, ExceptionCode& ec)
     2393{
     2394    Document* document = contextDocument();
     2395    if (!document || !document->view()) {
     2396        ec = INVALID_ACCESS_ERR;
     2397        return;
     2398    }
     2399
     2400    FrameView* frameView = document->view();
     2401    frameView->setViewExposedRect(FloatRect(x, y, width, height));
     2402}
     2403
    23922404void Internals::setHeaderHeight(float height)
    23932405{
  • trunk/Source/WebCore/testing/Internals.h

    r198859 r199200  
    304304    void setUseFixedLayout(bool useFixedLayout, ExceptionCode&);
    305305    void setFixedLayoutSize(int width, int height, ExceptionCode&);
     306    void setViewExposedRect(float left, float top, float width, float height, ExceptionCode&);
    306307
    307308    void setHeaderHeight(float);
  • trunk/Source/WebCore/testing/Internals.idl

    r198859 r199200  
    288288    [RaisesException] void setFixedLayoutSize(long width, long height);
    289289
     290    [RaisesException] void setViewExposedRect(unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height);
     291
    290292    void setHeaderHeight(unrestricted float height);
    291293    void setFooterHeight(unrestricted float height);
  • trunk/Tools/ChangeLog

    r199180 r199200  
     12016-04-07  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Make it possible to test effect of view exposed rect on tiled backing
     4        https://bugs.webkit.org/show_bug.cgi?id=156365
     5
     6        Reviewed by Tim Horton.
     7
     8        Expose testRunner.setViewSize() and internals.setViewExposedRect() to enable
     9        testing of tile coverage when setViewExposedRect() is passed a non-null rectangle.
     10
     11        testRunner.setViewSize() is used instead of using window.resizeTo(), since we
     12        can't easily resize a window to larger than the screen being tested on.
     13
     14        * DumpRenderTree/TestRunner.cpp:
     15        (setViewSizeCallback):
     16        (TestRunner::staticFunctions):
     17        * DumpRenderTree/TestRunner.h:
     18        * DumpRenderTree/mac/TestRunnerMac.mm:
     19        (TestRunner::setViewSize):
     20        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
     21        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
     22        (WTR::InjectedBundle::postSetViewSize):
     23        * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
     24        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
     25        (WTR::TestRunner::setViewSize):
     26        * WebKitTestRunner/InjectedBundle/TestRunner.h:
     27        * WebKitTestRunner/TestInvocation.cpp:
     28        (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
     29
    1302016-04-07  Jason Marcell  <jmarcell@apple.com>
    231
  • trunk/Tools/DumpRenderTree/TestRunner.cpp

    r191530 r199200  
    13821382    TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
    13831383    controller->setWindowIsKey(JSValueToBoolean(context, arguments[0]));
     1384
     1385    return JSValueMakeUndefined(context);
     1386}
     1387
     1388static JSValueRef setViewSizeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     1389{
     1390    if (argumentCount < 2)
     1391        return JSValueMakeUndefined(context);
     1392
     1393    double width = JSValueToNumber(context, arguments[0], exception);
     1394    ASSERT(!*exception);
     1395    double height = JSValueToNumber(context, arguments[1], exception);
     1396    ASSERT(!*exception);
     1397
     1398    TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
     1399    controller->setViewSize(width, height);
    13841400
    13851401    return JSValueMakeUndefined(context);
     
    21282144        { "setWillSendRequestReturnsNullOnRedirect", setWillSendRequestReturnsNullOnRedirectCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    21292145        { "setWindowIsKey", setWindowIsKeyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     2146        { "setViewSize", setViewSizeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    21302147        { "setJavaScriptCanAccessClipboard", setJavaScriptCanAccessClipboardCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    21312148        { "setXSSAuditorEnabled", setXSSAuditorEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/Tools/DumpRenderTree/TestRunner.h

    r199081 r199200  
    260260    void setWindowIsKey(bool);
    261261
     262    void setViewSize(double width, double height);
     263
    262264    bool alwaysAcceptCookies() const { return m_alwaysAcceptCookies; }
    263265    void setAlwaysAcceptCookies(bool);
  • trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm

    r197942 r199200  
    617617}
    618618
     619void TestRunner::setViewSize(double width, double height)
     620{
     621    [[mainFrame webView] setFrameSize:NSMakeSize(width, height)];
     622}
     623
    619624static void waitUntilDoneWatchdogFired(CFRunLoopTimerRef timer, void* info)
    620625{
  • trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp

    r198501 r199200  
    895895}
    896896
     897void TestRunner::setViewSize(double width, double height)
     898{
     899    COMPtr<IWebView> webView;
     900    if (FAILED(frame->webView(&webView)))
     901        return;
     902
     903    COMPtr<IWebViewPrivate2> viewPrivate;
     904    if (FAILED(webView->QueryInterface(&viewPrivate)))
     905        return;
     906
     907    HWND webViewWindow;
     908    if (FAILED(viewPrivate->viewWindow(&webViewWindow)))
     909        return;
     910
     911    ::SetWindowPos(webViewWindow, 0, 0, 0, width, height, SWP_NOMOVE);
     912}
     913
    897914static const CFTimeInterval waitToDumpWatchdogInterval = 30.0;
    898915
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl

    r198955 r199200  
    149149    void focusWebView(object callback);
    150150
    151     void clearTestRunnerCallbacks();
    152 
     151    // Window/view state
    153152    void setBackingScaleFactor(double backingScaleFactor, object callback);
    154153
    155154    void setWindowIsKey(boolean isKey);
     155    void setViewSize(double width, double height);
    156156
    157157    // Cookies testing
     
    221221    // UI Process Testing
    222222    void runUIScript(DOMString script, object callback);
     223
     224    void clearTestRunnerCallbacks();
    223225};
    224226
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp

    r199081 r199200  
    443443}
    444444
     445void InjectedBundle::postSetViewSize(double width, double height)
     446{
     447    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetViewSize"));
     448
     449    WKRetainPtr<WKStringRef> widthKey(AdoptWK, WKStringCreateWithUTF8CString("width"));
     450    WKRetainPtr<WKStringRef> heightKey(AdoptWK, WKStringCreateWithUTF8CString("height"));
     451
     452    WKRetainPtr<WKMutableDictionaryRef> messageBody(AdoptWK, WKMutableDictionaryCreate());
     453
     454    WKRetainPtr<WKDoubleRef> widthWK(AdoptWK, WKDoubleCreate(width));
     455    WKDictionarySetItem(messageBody.get(), widthKey.get(), widthWK.get());
     456
     457    WKRetainPtr<WKDoubleRef> heightWK(AdoptWK, WKDoubleCreate(height));
     458    WKDictionarySetItem(messageBody.get(), heightKey.get(), heightWK.get());
     459
     460    WKBundlePagePostSynchronousMessageForTesting(page()->page(), messageName.get(), messageBody.get(), 0);
     461}
     462
    445463void InjectedBundle::postSimulateWebNotificationClick(uint64_t notificationID)
    446464{
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h

    r197114 r199200  
    8686    void postSetBackingScaleFactor(double);
    8787    void postSetWindowIsKey(bool);
     88    void postSetViewSize(double width, double height);
    8889    void postSimulateWebNotificationClick(uint64_t notificationID);
    8990    void postSetAddsVisitedLinks(bool);
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp

    r199081 r199200  
    624624}
    625625
     626void TestRunner::setViewSize(double width, double height)
     627{
     628    InjectedBundle::singleton().postSetViewSize(width, height);
     629}
     630
    626631void TestRunner::callAddChromeInputFieldCallback()
    627632{
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h

    r199081 r199200  
    247247    void setWindowIsKey(bool);
    248248
     249    void setViewSize(double width, double height);
     250
    249251    void callAddChromeInputFieldCallback();
    250252    void callRemoveChromeInputFieldCallback();
  • trunk/Tools/WebKitTestRunner/TestInvocation.cpp

    r198955 r199200  
    666666    }
    667667
     668    if (WKStringIsEqualToUTF8CString(messageName, "SetViewSize")) {
     669        ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
     670
     671        WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody);
     672        WKRetainPtr<WKStringRef> widthKey(AdoptWK, WKStringCreateWithUTF8CString("width"));
     673        WKRetainPtr<WKStringRef> heightKey(AdoptWK, WKStringCreateWithUTF8CString("height"));
     674
     675        WKDoubleRef widthWK = static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, widthKey.get()));
     676        WKDoubleRef heightWK = static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, heightKey.get()));
     677
     678        TestController::singleton().mainWebView()->resizeTo(WKDoubleGetValue(widthWK), WKDoubleGetValue(heightWK));
     679        return nullptr;
     680    }
     681
    668682    if (WKStringIsEqualToUTF8CString(messageName, "IsGeolocationClientActive")) {
    669683        bool isActive = TestController::singleton().isGeolocationProviderActive();
Note: See TracChangeset for help on using the changeset viewer.