Changeset 203075 in webkit


Ignore:
Timestamp:
Jul 11, 2016 12:08:24 PM (8 years ago)
Author:
n_wang@apple.com
Message:

AX: WKWebView should have API to prevent pinch-to-zoom always being allowed
https://bugs.webkit.org/show_bug.cgi?id=158364

Reviewed by Anders Carlsson.

Source/WebCore:

Removed the internals settings for viewport force always user scalable.

Changes are covered in modified tests.

  • testing/Internals.cpp:

(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::Internals):
(WebCore::Internals::composedTreeAsText):
(WebCore::Internals::setLinkPreloadSupport):
(WebCore::Internals::setViewportForceAlwaysUserScalable): Deleted.

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

Source/WebKit2:

Added a property in WKWebViewConfiguration so that developers can toggle the ignoring
viewport scale limits setting.

Changes are covered in modified tests.

  • Shared/WebPageCreationParameters.cpp:

(WebKit::WebPageCreationParameters::encode):
(WebKit::WebPageCreationParameters::decode):

  • Shared/WebPageCreationParameters.h:
  • UIProcess/API/C/WKPage.cpp:

(WKPageSetResourceCachingDisabled):
(WKPageSetIgnoresViewportScaleLimits):

  • UIProcess/API/C/WKPagePrivate.h:
  • UIProcess/API/Cocoa/WKWebView.mm:

(shouldAllowPictureInPictureMediaPlayback):
(-[WKWebView _initializeWithConfiguration:]):
(-[WKWebView _navigationGestureDidEnd]):
(forceAlwaysUserScalableChangedCallback): Deleted.
(-[WKWebView _updateForceAlwaysUserScalable]): Deleted.

  • UIProcess/API/Cocoa/WKWebViewConfiguration.h:
  • UIProcess/API/Cocoa/WKWebViewConfiguration.mm:

(-[WKWebViewConfiguration init]):
(-[WKWebViewConfiguration encodeWithCoder:]):
(-[WKWebViewConfiguration initWithCoder:]):
(-[WKWebViewConfiguration copyWithZone:]):

  • UIProcess/API/Cocoa/WKWebViewInternal.h:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::creationParameters):

  • UIProcess/WebPageProxy.h:
  • UIProcess/ios/WebPageProxyIOS.mm:

(WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize):
(WebKit::WebPageProxy::setForceAlwaysUserScalable):
(WebKit::WebPageProxy::setMaximumUnobscuredSize):
(WebKit::WebPageProxy::updateForceAlwaysUserScalable): Deleted.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::updatePreferences):

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:
  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::disableInspectorNodeSearch):
(WebKit::WebPage::setForceAlwaysUserScalable):
(WebKit::innerFrameQuad):
(WebKit::WebPage::updateForceAlwaysUserScalable): Deleted.

Tools:

Added a function in TestRunner so that we can toggle the ignoring viewport
scale limits setting. Also added a test option for that in order to change the
configuration of the webview in test.

  • WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
  • WebKitTestRunner/InjectedBundle/TestRunner.cpp:

(WTR::TestRunner::setNavigationGesturesEnabled):
(WTR::TestRunner::setIgnoresViewportScaleLimits):
(WTR::nextUIScriptCallbackID):

  • WebKitTestRunner/InjectedBundle/TestRunner.h:

(WTR::TestRunner::shouldDecideNavigationPolicyAfterDelay):

  • WebKitTestRunner/TestController.cpp:

(WTR::TestController::resetStateToConsistentValues):
(WTR::updateTestOptionsFromTestHeader):
(WTR::TestController::setNavigationGesturesEnabled):
(WTR::TestController::setIgnoresViewportScaleLimits):
(WTR::TestController::platformWillRunTest):

  • WebKitTestRunner/TestController.h:

(WTR::TestController::setShouldDecideNavigationPolicyAfterDelay):

  • WebKitTestRunner/TestInvocation.cpp:

(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):

  • WebKitTestRunner/TestOptions.h:
  • WebKitTestRunner/cocoa/TestControllerCocoa.mm:

(WTR::TestController::platformCreateWebView):

LayoutTests:

  • fast/viewport/ios/force-always-user-scalable.html:
  • fast/viewport/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale.html:
  • fast/viewport/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html:
Location:
trunk
Files:
33 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r203074 r203075  
     12016-07-11  Nan Wang  <n_wang@apple.com>
     2
     3        AX: WKWebView should have API to prevent pinch-to-zoom always being allowed
     4        https://bugs.webkit.org/show_bug.cgi?id=158364
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * fast/viewport/ios/force-always-user-scalable.html:
     9        * fast/viewport/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale.html:
     10        * fast/viewport/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html:
     11
    1122016-07-11  Frederic Wang  <fwang@igalia.com>
    213
  • trunk/LayoutTests/fast/viewport/ios/force-always-user-scalable.html

    r197986 r203075  
    1 <!DOCTYPE html>
     1<!DOCTYPE html><!-- webkit-test-runner [ ignoresViewportScaleLimits=true ] -->
    22<html>
    33<head>
     
    2828    description("This tests that after we set forceAlwaysUserScalable, maximum-scale will be ignored.");
    2929
    30     window.internals.setViewportForceAlwaysUserScalable(true);
    3130    if (window.testRunner) {
    3231        window.jsTestIsAsync = true;
     
    4544                    debug("Maximum zoom scale was: " + result);
    4645                   
    47                     window.internals.setViewportForceAlwaysUserScalable(false);
     46                    testRunner.setIgnoresViewportScaleLimits(false);
    4847                    testRunner.runUIScript(uiScript2, function(result) {
    4948                        debug("Maximum zoom scale was reset to: " + result);
  • trunk/LayoutTests/fast/viewport/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale.html

    r201294 r203075  
    2121    description("This tests that even though force user scalable = true, we won't scale if a text field gets focus by default.");
    2222
    23     window.internals.setViewportForceAlwaysUserScalable(true);
    2423    if (window.testRunner) {
    2524        window.jsTestIsAsync = true;
     25        testRunner.setIgnoresViewportScaleLimits(true);
    2626    }
    2727
     
    3030        if (testRunner.runUIScript) {
    3131            var uiScript = document.getElementById('ui-script').text;
    32             window.internals.setViewportForceAlwaysUserScalable(false);
     32            testRunner.setIgnoresViewportScaleLimits(false);
    3333            document.getElementById("textfield").focus();
    3434            testRunner.runUIScript(document.getElementById('ui-script').text, function(result) {
  • trunk/LayoutTests/fast/viewport/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html

    r201294 r203075  
    2121    description("This tests that when the author does not define a scale or width, that zooming in on focused nodes changes the scale.");
    2222
    23     window.internals.setViewportForceAlwaysUserScalable(true);
    2423    if (window.testRunner) {
    2524        window.jsTestIsAsync = true;
     25        testRunner.setIgnoresViewportScaleLimits(true);
    2626    }
    2727
     
    3030        if (testRunner.runUIScript) {
    3131            var uiScript = document.getElementById('ui-script').text;
    32             window.internals.setViewportForceAlwaysUserScalable(false);
     32            testRunner.setIgnoresViewportScaleLimits(false);
    3333            document.getElementById("textfield").focus();
    3434            testRunner.runUIScript(document.getElementById('ui-script').text, function(result) {
  • trunk/Source/WebCore/ChangeLog

    r203074 r203075  
     12016-07-11  Nan Wang  <n_wang@apple.com>
     2
     3        AX: WKWebView should have API to prevent pinch-to-zoom always being allowed
     4        https://bugs.webkit.org/show_bug.cgi?id=158364
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Removed the internals settings for viewport force always user scalable.
     9
     10        Changes are covered in modified tests.
     11
     12        * testing/Internals.cpp:
     13        (WebCore::Internals::resetToConsistentState):
     14        (WebCore::Internals::Internals):
     15        (WebCore::Internals::composedTreeAsText):
     16        (WebCore::Internals::setLinkPreloadSupport):
     17        (WebCore::Internals::setViewportForceAlwaysUserScalable): Deleted.
     18        * testing/Internals.h:
     19        * testing/Internals.idl:
     20
    1212016-07-11  Frederic Wang  <fwang@igalia.com>
    222
  • trunk/Source/WebCore/testing/Internals.cpp

    r202183 r203075  
    212212#endif
    213213
    214 #if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
    215 #if __has_include(<AccessibilitySupport.h>)
    216 #include <AccessibilitySupport.h>
    217 #else
    218 extern "C" {
    219 void _AXSSetForceAllowWebScaling(Boolean);
    220 }
    221 #endif
    222 #endif
    223 
    224214using JSC::CallData;
    225215using JSC::CallType;
     
    416406
    417407    page.setShowAllPlugins(false);
    418    
    419 #if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
    420     _AXSSetForceAllowWebScaling(false);
    421 #endif
    422408}
    423409
     
    32893275}
    32903276
    3291 void Internals::setViewportForceAlwaysUserScalable(bool scalable)
    3292 {
    3293 #if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
    3294     _AXSSetForceAllowWebScaling(scalable);
    3295 #else
    3296     UNUSED_PARAM(scalable);
    3297 #endif
    3298 }
    3299 
    33003277void Internals::setLinkPreloadSupport(bool enable)
    33013278{
  • trunk/Source/WebCore/testing/Internals.h

    r202183 r203075  
    470470    String composedTreeAsText(Node&);
    471471   
    472     void setViewportForceAlwaysUserScalable(bool);
    473472    void setLinkPreloadSupport(bool);
    474473    void setResourceTimingSupport(bool);
  • trunk/Source/WebCore/testing/Internals.idl

    r202183 r203075  
    447447    DOMString composedTreeAsText(Node parent);
    448448
    449     void setViewportForceAlwaysUserScalable(boolean scalable);
    450449    void setLinkPreloadSupport(boolean scalable);
    451450
  • trunk/Source/WebKit2/ChangeLog

    r203064 r203075  
     12016-07-11  Nan Wang  <n_wang@apple.com>
     2
     3        AX: WKWebView should have API to prevent pinch-to-zoom always being allowed
     4        https://bugs.webkit.org/show_bug.cgi?id=158364
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Added a property in WKWebViewConfiguration so that developers can toggle the ignoring
     9        viewport scale limits setting.
     10
     11        Changes are covered in modified tests.
     12
     13        * Shared/WebPageCreationParameters.cpp:
     14        (WebKit::WebPageCreationParameters::encode):
     15        (WebKit::WebPageCreationParameters::decode):
     16        * Shared/WebPageCreationParameters.h:
     17        * UIProcess/API/C/WKPage.cpp:
     18        (WKPageSetResourceCachingDisabled):
     19        (WKPageSetIgnoresViewportScaleLimits):
     20        * UIProcess/API/C/WKPagePrivate.h:
     21        * UIProcess/API/Cocoa/WKWebView.mm:
     22        (shouldAllowPictureInPictureMediaPlayback):
     23        (-[WKWebView _initializeWithConfiguration:]):
     24        (-[WKWebView _navigationGestureDidEnd]):
     25        (forceAlwaysUserScalableChangedCallback): Deleted.
     26        (-[WKWebView _updateForceAlwaysUserScalable]): Deleted.
     27        * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
     28        * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
     29        (-[WKWebViewConfiguration init]):
     30        (-[WKWebViewConfiguration encodeWithCoder:]):
     31        (-[WKWebViewConfiguration initWithCoder:]):
     32        (-[WKWebViewConfiguration copyWithZone:]):
     33        * UIProcess/API/Cocoa/WKWebViewInternal.h:
     34        * UIProcess/WebPageProxy.cpp:
     35        (WebKit::WebPageProxy::creationParameters):
     36        * UIProcess/WebPageProxy.h:
     37        * UIProcess/ios/WebPageProxyIOS.mm:
     38        (WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize):
     39        (WebKit::WebPageProxy::setForceAlwaysUserScalable):
     40        (WebKit::WebPageProxy::setMaximumUnobscuredSize):
     41        (WebKit::WebPageProxy::updateForceAlwaysUserScalable): Deleted.
     42        * WebProcess/WebPage/WebPage.cpp:
     43        (WebKit::WebPage::updatePreferences):
     44        * WebProcess/WebPage/WebPage.h:
     45        * WebProcess/WebPage/WebPage.messages.in:
     46        * WebProcess/WebPage/ios/WebPageIOS.mm:
     47        (WebKit::WebPage::disableInspectorNodeSearch):
     48        (WebKit::WebPage::setForceAlwaysUserScalable):
     49        (WebKit::innerFrameQuad):
     50        (WebKit::WebPage::updateForceAlwaysUserScalable): Deleted.
     51
    1522016-07-08  Alex Christensen  <achristensen@webkit.org>
    253
  • trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp

    r202129 r203075  
    8484    encoder << availableScreenSize;
    8585    encoder << textAutosizingWidth;
     86    encoder << ignoresViewportScaleLimits;
    8687#endif
    8788    encoder << appleMailPaginationQuirkEnabled;
     
    188189    if (!decoder.decode(parameters.textAutosizingWidth))
    189190        return false;
     191    if (!decoder.decode(parameters.ignoresViewportScaleLimits))
     192        return false;
    190193#endif
    191194
  • trunk/Source/WebKit2/Shared/WebPageCreationParameters.h

    r202183 r203075  
    132132    WebCore::FloatSize availableScreenSize;
    133133    float textAutosizingWidth;
     134    bool ignoresViewportScaleLimits;
    134135#endif
    135136    bool appleMailPaginationQuirkEnabled;
  • trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp

    r202724 r203075  
    27452745}
    27462746
     2747void WKPageSetIgnoresViewportScaleLimits(WKPageRef page, bool ignoresViewportScaleLimits)
     2748{
     2749#if PLATFORM(IOS)
     2750    toImpl(page)->setForceAlwaysUserScalable(ignoresViewportScaleLimits);
     2751#endif
     2752}
     2753
    27472754#if ENABLE(NETSCAPE_PLUGIN_API)
    27482755
  • trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h

    r202724 r203075  
    148148WK_EXPORT void WKPageRestoreFromSessionStateWithoutNavigation(WKPageRef page, WKTypeRef sessionState);
    149149
     150WK_EXPORT void WKPageSetIgnoresViewportScaleLimits(WKPageRef page, bool ignoresViewportScaleLimits);
     151
    150152#ifdef __cplusplus
    151153}
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r203014 r203075  
    334334}
    335335
    336 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
    337 static void forceAlwaysUserScalableChangedCallback(CFNotificationCenterRef, void* observer, CFStringRef, const void*, CFDictionaryRef)
    338 {
    339     ASSERT(observer);
    340     WKWebView* webview = static_cast<WKWebView*>(observer);
    341     [webview _updateForceAlwaysUserScalable];
    342 }
    343 #endif
    344 
    345336#endif
    346337
     
    534525    [center addObserver:self selector:@selector(_contentSizeCategoryDidChange:) name:UIContentSizeCategoryDidChangeNotification object:nil];
    535526    _page->contentSizeCategoryDidChange([self _contentSizeCategory]);
    536    
    537 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
    538     CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), (__bridge const void *)(self), forceAlwaysUserScalableChangedCallback, kAXSAllowForceWebScalingEnabledNotification, 0, CFNotificationSuspensionBehaviorDeliverImmediately);
    539 #endif
    540527
    541528    [[_configuration _contentProviderRegistry] addPage:*_page];
     529    _page->setForceAlwaysUserScalable([_configuration ignoresViewportScaleLimits]);
    542530#endif
    543531
     
    22342222    _frozenVisibleContentRect = Nullopt;
    22352223    _frozenUnobscuredContentRect = Nullopt;
    2236 }
    2237 
    2238 - (void)_updateForceAlwaysUserScalable
    2239 {
    2240     _page->updateForceAlwaysUserScalable();
    22412224}
    22422225
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h

    r202789 r203075  
    183183@property (nonatomic) WKDataDetectorTypes dataDetectorTypes WK_API_AVAILABLE(ios(WK_IOS_TBA));
    184184
     185/*! @abstract A Boolean value indicating whether the WKWebView should always allow scaling of the web page, regardless of author intent.
     186 @discussion This will override the user-scalable property.
     187 */
     188@property (nonatomic) BOOL ignoresViewportScaleLimits WK_API_AVAILABLE(ios(WK_IOS_TBA));
     189
    185190#else
    186191
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm

    r202444 r203075  
    145145    else
    146146        _mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeAll;
     147    _ignoresViewportScaleLimits = NO;
    147148#else
    148149    _mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone;
     
    214215    [coder encodeInteger:self.selectionGranularity forKey:@"selectionGranularity"];
    215216    [coder encodeBool:self.allowsPictureInPictureMediaPlayback forKey:@"allowsPictureInPictureMediaPlayback"];
     217    [coder encodeBool:self.ignoresViewportScaleLimits forKey:@"ignoresViewportScaleLimits"];
    216218#else
    217219    [coder encodeInteger:self.userInterfaceDirectionPolicy forKey:@"userInterfaceDirectionPolicy"];
     
    240242    self.selectionGranularity = static_cast<WKSelectionGranularity>([coder decodeIntegerForKey:@"selectionGranularity"]);
    241243    self.allowsPictureInPictureMediaPlayback = [coder decodeBoolForKey:@"allowsPictureInPictureMediaPlayback"];
     244    self.ignoresViewportScaleLimits = [coder decodeBoolForKey:@"ignoresViewportScaleLimits"];
    242245#else
    243246    auto userInterfaceDirectionPolicyCandidate = static_cast<WKUserInterfaceDirectionPolicy>([coder decodeIntegerForKey:@"userInterfaceDirectionPolicy"]);
     
    290293    configuration->_alwaysRunsAtForegroundPriority = _alwaysRunsAtForegroundPriority;
    291294    configuration->_selectionGranularity = self->_selectionGranularity;
     295    configuration->_ignoresViewportScaleLimits = self->_ignoresViewportScaleLimits;
    292296#endif
    293297#if PLATFORM(MAC)
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h

    r202695 r203075  
    117117- (void)_navigationGestureDidEnd;
    118118
    119 - (void)_updateForceAlwaysUserScalable;
    120 
    121119@property (nonatomic, readonly) BOOL _isBackground;
    122120
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r202894 r203075  
    54315431    parameters.textAutosizingWidth = textAutosizingWidth();
    54325432    parameters.mimeTypesWithCustomContentProviders = m_pageClient.mimeTypesWithCustomContentProviders();
     5433    parameters.ignoresViewportScaleLimits = m_forceAlwaysUserScalable;
    54335434#endif
    54345435
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r202889 r203075  
    522522    void getSelectionContext(std::function<void(const String&, const String&, const String&, CallbackBase::Error)>);
    523523    void handleTwoFingerTapAtPoint(const WebCore::IntPoint&, std::function<void(const String&, CallbackBase::Error)>);
    524     void updateForceAlwaysUserScalable();
     524    void setForceAlwaysUserScalable(bool);
    525525#endif
    526526#if ENABLE(DATA_DETECTION)
     
    18561856    bool m_hasDeferredStartAssistingNode { false };
    18571857    std::unique_ptr<NodeAssistanceArguments> m_deferredNodeAssistanceArguments;
     1858    bool m_forceAlwaysUserScalable { false };
    18581859#endif
    18591860
  • trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm

    r202347 r203075  
    315315}
    316316
    317 void WebPageProxy::updateForceAlwaysUserScalable()
    318 {
    319     m_process->send(Messages::WebPage::UpdateForceAlwaysUserScalable(), m_pageID);
     317void WebPageProxy::setForceAlwaysUserScalable(bool userScalable)
     318{
     319    if (m_forceAlwaysUserScalable == userScalable)
     320        return;
     321    m_forceAlwaysUserScalable = userScalable;
     322    m_process->send(Messages::WebPage::SetForceAlwaysUserScalable(userScalable), m_pageID);
    320323}
    321324
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r202930 r203075  
    358358    , m_useTestingViewportConfiguration(false)
    359359    , m_isInStableState(true)
     360    , m_forceAlwaysUserScalable(parameters.ignoresViewportScaleLimits)
    360361    , m_oldestNonStableUpdateVisibleContentRectsTimestamp(std::chrono::milliseconds::zero())
    361362    , m_estimatedLatency(std::chrono::milliseconds::zero())
     
    31973198    m_ignoreViewportScalingConstraints = store.getBoolValueForKey(WebPreferencesKey::ignoreViewportScalingConstraintsKey());
    31983199    m_viewportConfiguration.setCanIgnoreScalingConstraints(m_ignoreViewportScalingConstraints);
    3199     m_forceAlwaysUserScalable = store.getBoolValueForKey(WebPreferencesKey::forceAlwaysUserScalableKey());
    3200     updateForceAlwaysUserScalable();
     3200    setForceAlwaysUserScalable(m_forceAlwaysUserScalable || store.getBoolValueForKey(WebPreferencesKey::forceAlwaysUserScalableKey()));
    32013201#endif
    32023202}
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r202889 r203075  
    580580    void disableInspectorNodeSearch();
    581581   
    582     void updateForceAlwaysUserScalable();
     582    void setForceAlwaysUserScalable(bool);
    583583#endif
    584584
     
    14171417    bool m_useTestingViewportConfiguration;
    14181418    bool m_isInStableState;
    1419     bool m_forceAlwaysUserScalable { false };
     1419    bool m_forceAlwaysUserScalable;
    14201420    std::chrono::milliseconds m_oldestNonStableUpdateVisibleContentRectsTimestamp;
    14211421    std::chrono::milliseconds m_estimatedLatency;
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

    r202889 r203075  
    9898    SetAllowsMediaDocumentInlinePlayback(bool allows)
    9999    HandleTwoFingerTapAtPoint(WebCore::IntPoint point, uint64_t callbackID)
    100     UpdateForceAlwaysUserScalable()
     100    SetForceAlwaysUserScalable(bool userScalable)
    101101#endif
    102102
  • trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

    r202757 r203075  
    102102#import <wtf/TemporaryChange.h>
    103103
    104 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
    105 #if __has_include(<AccessibilitySupport.h>)
    106 #include <AccessibilitySupport.h>
    107 #else
    108 extern "C" {
    109 Boolean _AXSForceAllowWebScaling();
    110 }
    111 #endif
    112 #endif
    113 
    114104using namespace WebCore;
    115105
     
    804794}
    805795
    806 void WebPage::updateForceAlwaysUserScalable()
    807 {
    808     bool forceAlwaysUserScalable = m_forceAlwaysUserScalable;
    809 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
    810     forceAlwaysUserScalable |= _AXSForceAllowWebScaling();
    811 #endif
    812     m_viewportConfiguration.setForceAlwaysUserScalable(forceAlwaysUserScalable);
     796void WebPage::setForceAlwaysUserScalable(bool userScalable)
     797{
     798    m_forceAlwaysUserScalable = userScalable;
     799    m_viewportConfiguration.setForceAlwaysUserScalable(userScalable);
    813800}
    814801
  • trunk/Tools/ChangeLog

    r203070 r203075  
     12016-07-11  Nan Wang  <n_wang@apple.com>
     2
     3        AX: WKWebView should have API to prevent pinch-to-zoom always being allowed
     4        https://bugs.webkit.org/show_bug.cgi?id=158364
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Added a function in TestRunner so that we can toggle the ignoring viewport
     9        scale limits setting. Also added a test option for that in order to change the
     10        configuration of the webview in test.
     11
     12        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
     13        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
     14        (WTR::TestRunner::setNavigationGesturesEnabled):
     15        (WTR::TestRunner::setIgnoresViewportScaleLimits):
     16        (WTR::nextUIScriptCallbackID):
     17        * WebKitTestRunner/InjectedBundle/TestRunner.h:
     18        (WTR::TestRunner::shouldDecideNavigationPolicyAfterDelay):
     19        * WebKitTestRunner/TestController.cpp:
     20        (WTR::TestController::resetStateToConsistentValues):
     21        (WTR::updateTestOptionsFromTestHeader):
     22        (WTR::TestController::setNavigationGesturesEnabled):
     23        (WTR::TestController::setIgnoresViewportScaleLimits):
     24        (WTR::TestController::platformWillRunTest):
     25        * WebKitTestRunner/TestController.h:
     26        (WTR::TestController::setShouldDecideNavigationPolicyAfterDelay):
     27        * WebKitTestRunner/TestInvocation.cpp:
     28        (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
     29        * WebKitTestRunner/TestOptions.h:
     30        * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
     31        (WTR::TestController::platformCreateWebView):
     32
    1332016-07-11  Konstantin Tokarev  <annulen@yandex.ru>
    234
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl

    r202511 r203075  
    8080    void setShouldDecideNavigationPolicyAfterDelay(boolean value);
    8181    void setNavigationGesturesEnabled(boolean value);
     82    void setIgnoresViewportScaleLimits(boolean value);
    8283
    8384    // Special DOM functions.
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp

    r202728 r203075  
    988988}
    989989
     990void TestRunner::setIgnoresViewportScaleLimits(bool value)
     991{
     992    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetIgnoresViewportScaleLimits"));
     993    WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(value));
     994    WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
     995}
     996
    990997static unsigned nextUIScriptCallbackID()
    991998{
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h

    r202728 r203075  
    309309    void setShouldDecideNavigationPolicyAfterDelay(bool);
    310310    void setNavigationGesturesEnabled(bool);
     311    void setIgnoresViewportScaleLimits(bool);
    311312
    312313    void runUIScript(JSStringRef script, JSValueRef callback);
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r202772 r203075  
    785785
    786786    setNavigationGesturesEnabled(false);
     787   
     788    setIgnoresViewportScaleLimits(options.ignoresViewportScaleLimits);
    787789
    788790    WKPageLoadURL(m_mainWebView->page(), blankURL());
     
    938940        if (key == "needsSiteSpecificQuirks")
    939941            testOptions.needsSiteSpecificQuirks = parseBooleanTestHeaderValue(value);
     942        if (key == "ignoresViewportScaleLimits")
     943            testOptions.ignoresViewportScaleLimits = parseBooleanTestHeaderValue(value);
    940944        pairStart = pairEnd + 1;
    941945    }
     
    21252129}
    21262130
     2131void TestController::setIgnoresViewportScaleLimits(bool ignoresViewportScaleLimits)
     2132{
     2133    WKPageSetIgnoresViewportScaleLimits(m_mainWebView->page(), ignoresViewportScaleLimits);
     2134}
     2135
    21272136#if !PLATFORM(COCOA)
    21282137void TestController::platformWillRunTest(const TestInvocation&)
  • trunk/Tools/WebKitTestRunner/TestController.h

    r202511 r203075  
    140140
    141141    void setNavigationGesturesEnabled(bool value);
     142    void setIgnoresViewportScaleLimits(bool);
    142143
    143144private:
  • trunk/Tools/WebKitTestRunner/TestInvocation.cpp

    r202532 r203075  
    648648        return;
    649649    }
     650   
     651    if (WKStringIsEqualToUTF8CString(messageName, "SetIgnoresViewportScaleLimits")) {
     652        ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
     653        WKBooleanRef value = static_cast<WKBooleanRef>(messageBody);
     654        TestController::singleton().setIgnoresViewportScaleLimits(WKBooleanGetValue(value));
     655        return;
     656    }
    650657
    651658    if (WKStringIsEqualToUTF8CString(messageName, "RunUIProcessScript")) {
  • trunk/Tools/WebKitTestRunner/TestOptions.h

    r201904 r203075  
    4242    bool useMockScrollbars { true };
    4343    bool needsSiteSpecificQuirks { false };
     44    bool ignoresViewportScaleLimits { false };
    4445
    4546    float deviceScaleFactor { 1 };
  • trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm

    r200951 r203075  
    8787    if (options.useDataDetection)
    8888        [copiedConfiguration setDataDetectorTypes:WKDataDetectorTypeAll];
     89    if (options.ignoresViewportScaleLimits)
     90        [copiedConfiguration setIgnoresViewportScaleLimits:YES];
    8991#endif
    9092
Note: See TracChangeset for help on using the changeset viewer.