Changeset 208207 in webkit


Ignore:
Timestamp:
Oct 31, 2016 7:43:47 PM (8 years ago)
Author:
Simon Fraser
Message:

Make UIScriptController::zoomToScale() work on Mac WK1 and WK2
https://bugs.webkit.org/show_bug.cgi?id=164238

Reviewed by Dean Jackson.

Source/WebCore:

Test: fast/zooming/uiscript-zooming.html

Expose pageScaleFactor() for tests.

  • testing/Internals.cpp:

(WebCore::Internals::pageScaleFactor):

  • testing/Internals.h:
  • testing/Internals.idl:

Tools:

Implement UIScriptController::zoomToScale() for WTR and DRT on Mac.

  • DumpRenderTree/mac/UIScriptControllerMac.mm:

(WTR::UIScriptController::zoomToScale):

  • TestRunnerShared/UIScriptContext/UIScriptController.cpp:
  • WebKitTestRunner/mac/UIScriptControllerMac.mm:

(WTR::UIScriptController::zoomToScale):

LayoutTests:

  • fast/zooming/uiscript-zooming-expected.txt: Added.
  • fast/zooming/uiscript-zooming.html: Added.
  • platform/ios-simulator-wk1/TestExpectations:
Location:
trunk
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r208204 r208207  
     12016-10-31  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Make UIScriptController::zoomToScale() work on Mac WK1 and WK2
     4        https://bugs.webkit.org/show_bug.cgi?id=164238
     5
     6        Reviewed by Dean Jackson.
     7
     8        * fast/zooming/uiscript-zooming-expected.txt: Added.
     9        * fast/zooming/uiscript-zooming.html: Added.
     10        * platform/ios-simulator-wk1/TestExpectations:
     11
    1122016-10-31  Joseph Pecoraro  <pecoraro@apple.com>
    213
  • trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations

    r207155 r208207  
    100100editing/unsupported-content/table-type-after.html
    101101editing/unsupported-content/table-type-before.html
     102
     103# Zooming works differently in iOS DRT
     104fast/zooming/uiscript-zooming.html [ Failure ]
    102105
    103106# FIXME: Tests that fail due to lack of textInputController <rdar://problem/5106287>
  • trunk/Source/WebCore/ChangeLog

    r208206 r208207  
     12016-10-31  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Make UIScriptController::zoomToScale() work on Mac WK1 and WK2
     4        https://bugs.webkit.org/show_bug.cgi?id=164238
     5
     6        Reviewed by Dean Jackson.
     7
     8        Test: fast/zooming/uiscript-zooming.html
     9       
     10        Expose pageScaleFactor() for tests.
     11
     12        * testing/Internals.cpp:
     13        (WebCore::Internals::pageScaleFactor):
     14        * testing/Internals.h:
     15        * testing/Internals.idl:
     16
    1172016-10-31  Myles C. Maxfield  <mmaxfield@apple.com>
    218
  • trunk/Source/WebCore/testing/Internals.cpp

    r208149 r208207  
    20182018}
    20192019
     2020ExceptionOr<float> Internals::pageScaleFactor() const
     2021{
     2022    Document* document = contextDocument();
     2023    if (!document || !document->page())
     2024        return Exception { INVALID_ACCESS_ERR };
     2025
     2026    return document->page()->pageScaleFactor();
     2027}
     2028
    20202029ExceptionOr<void> Internals::setPageScaleFactor(float scaleFactor, int x, int y)
    20212030{
  • trunk/Source/WebCore/testing/Internals.h

    r208145 r208207  
    285285    ExceptionOr<String> pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) const;
    286286
     287    ExceptionOr<float> pageScaleFactor() const;
     288
    287289    ExceptionOr<void> setPageScaleFactor(float scaleFactor, int x, int y);
    288290    ExceptionOr<void> setPageZoomFactor(float);
  • trunk/Source/WebCore/testing/Internals.idl

    r208135 r208207  
    279279
    280280    [MayThrowException] void setPageScaleFactor(unrestricted float scaleFactor, long x, long y);
     281    [MayThrowException] float pageScaleFactor();
     282
    281283    [MayThrowException] void setPageZoomFactor(unrestricted float zoomFactor);
    282284    [MayThrowException] void setTextZoomFactor(unrestricted float zoomFactor);
  • trunk/Tools/ChangeLog

    r208205 r208207  
     12016-10-31  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Make UIScriptController::zoomToScale() work on Mac WK1 and WK2
     4        https://bugs.webkit.org/show_bug.cgi?id=164238
     5
     6        Reviewed by Dean Jackson.
     7
     8        Implement UIScriptController::zoomToScale() for WTR and DRT on Mac.
     9
     10        * DumpRenderTree/mac/UIScriptControllerMac.mm:
     11        (WTR::UIScriptController::zoomToScale):
     12        * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
     13        * WebKitTestRunner/mac/UIScriptControllerMac.mm:
     14        (WTR::UIScriptController::zoomToScale):
     15
    1162016-10-31  Dewei Zhu  <dewei_zhu@apple.com>
    217
  • trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm

    r208143 r208207  
    2727#import "UIScriptController.h"
    2828
     29#import "DumpRenderTree.h"
    2930#import "UIScriptContext.h"
     31#import <WebKit/WebKit.h>
     32#import <WebKit/WebViewPrivate.h>
    3033
    3134#if PLATFORM(MAC)
     
    4851}
    4952
     53void UIScriptController::zoomToScale(double scale, JSValueRef callback)
     54{
     55    unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
     56
     57    WebView *webView = [mainFrame webView];
     58    [webView _scaleWebView:scale atOrigin:NSZeroPoint];
     59
     60    dispatch_async(dispatch_get_main_queue(), ^ {
     61        if (!m_context)
     62            return;
     63        m_context->asyncTaskComplete(callbackID);
     64    });
     65}
     66
    5067}
    5168
  • trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp

    r208143 r208207  
    158158}
    159159
     160#if !PLATFORM(COCOA)
     161void UIScriptController::zoomToScale(double, JSValueRef)
     162{
     163}
     164#endif
     165
    160166#if !PLATFORM(IOS)
    161 void UIScriptController::zoomToScale(double, JSValueRef)
    162 {
    163 }
    164 
    165167void UIScriptController::touchDownAtPoint(long x, long y, long touchCount, JSValueRef)
    166168{
  • trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm

    r208143 r208207  
    6767}
    6868
     69void UIScriptController::zoomToScale(double scale, JSValueRef callback)
     70{
     71#if WK_API_ENABLED
     72    unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
     73
     74    auto* webView = TestController::singleton().mainWebView()->platformView();
     75    [webView _setPageScale:scale withOrigin:CGPointZero];
     76
     77    [webView _doAfterNextPresentationUpdate: ^ {
     78        if (!m_context)
     79            return;
     80        m_context->asyncTaskComplete(callbackID);
     81    }];
     82#else
     83    UNUSED_PARAM(scale);
     84    UNUSED_PARAM(callback);
     85#endif
    6986}
     87
     88} // namespace WTR
Note: See TracChangeset for help on using the changeset viewer.