Title: [197766] trunk
Revision
197766
Author
n_w...@apple.com
Date
2016-03-08 08:13:12 -0800 (Tue, 08 Mar 2016)

Log Message

AX: Force allow user zoom
https://bugs.webkit.org/show_bug.cgi?id=155056

Reviewed by Chris Fleizach.

Source/WebCore:

Override the maximum scale factor when forceAlwaysUserScalable is true.

Test: accessibility/ios-simulator/force-user-scalable.html

* page/ViewportConfiguration.h:
(WebCore::ViewportConfiguration::maximumScale):
* testing/Internals.cpp:
(WebCore::Internals::composedTreeAsText):
(WebCore::Internals::setViewportForceAlwaysUserScalable):
(WebCore::Internals::viewportConfigurationMaximumScale):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit2:

Soft linked libAccessibility library so that we can observe the accessibility
setting change for the force always user scalable feature.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::forceAlwaysUserScalableChangedCallback):
(WebKit::WebPage::create):
(WebKit::m_shouldDispatchFakeMouseMoveEvents):
(WebKit::WebPage::~WebPage):
(WebKit::WebPage::preferencesDidChange):
(WebKit::WebPage::updateForceAlwaysUserScalable):
(WebKit::WebPage::updatePreferences):
* WebProcess/WebPage/WebPage.h:

LayoutTests:

* accessibility/ios-simulator/force-user-scalable-expected.txt: Added.
* accessibility/ios-simulator/force-user-scalable.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (197765 => 197766)


--- trunk/LayoutTests/ChangeLog	2016-03-08 15:14:54 UTC (rev 197765)
+++ trunk/LayoutTests/ChangeLog	2016-03-08 16:13:12 UTC (rev 197766)
@@ -1,3 +1,13 @@
+2016-03-08  Nan Wang  <n_w...@apple.com>
+
+        AX: Force allow user zoom
+        https://bugs.webkit.org/show_bug.cgi?id=155056
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/ios-simulator/force-user-scalable-expected.txt: Added.
+        * accessibility/ios-simulator/force-user-scalable.html: Added.
+
 2016-03-08  Andreas Kling  <akl...@apple.com>
 
         ImageDocuments leak their world.

Added: trunk/LayoutTests/accessibility/ios-simulator/force-user-scalable-expected.txt (0 => 197766)


--- trunk/LayoutTests/accessibility/ios-simulator/force-user-scalable-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/force-user-scalable-expected.txt	2016-03-08 16:13:12 UTC (rev 197766)
@@ -0,0 +1,10 @@
+This tests that when we set force always user scalable, the maximum scale will be changed too.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.internals.viewportConfigurationMaximumScale() is 10
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/ios-simulator/force-user-scalable.html (0 => 197766)


--- trunk/LayoutTests/accessibility/ios-simulator/force-user-scalable.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/force-user-scalable.html	2016-03-08 16:13:12 UTC (rev 197766)
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script>
+var successfullyParsed = false;
+</script>
+<meta name="viewport" content="width=device-width, user-scalable=no, maximum-scale=3, minimum-scale=1">
+</head>
+<body id="body">
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that when we set force always user scalable, the maximum scale will be changed too.");
+
+    if (window.accessibilityController) {
+        window.internals.setViewportForceAlwaysUserScalable(true);
+        shouldBe("window.internals.viewportConfigurationMaximumScale()", "10");
+    }
+    
+    successfullyParsed = true;
+</script>
+
+<script src=""
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (197765 => 197766)


--- trunk/Source/WebCore/ChangeLog	2016-03-08 15:14:54 UTC (rev 197765)
+++ trunk/Source/WebCore/ChangeLog	2016-03-08 16:13:12 UTC (rev 197766)
@@ -1,3 +1,23 @@
+2016-03-08  Nan Wang  <n_w...@apple.com>
+
+        AX: Force allow user zoom
+        https://bugs.webkit.org/show_bug.cgi?id=155056
+
+        Reviewed by Chris Fleizach.
+
+        Override the maximum scale factor when forceAlwaysUserScalable is true.
+
+        Test: accessibility/ios-simulator/force-user-scalable.html
+
+        * page/ViewportConfiguration.h:
+        (WebCore::ViewportConfiguration::maximumScale):
+        * testing/Internals.cpp:
+        (WebCore::Internals::composedTreeAsText):
+        (WebCore::Internals::setViewportForceAlwaysUserScalable):
+        (WebCore::Internals::viewportConfigurationMaximumScale):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2016-03-08  Andreas Kling  <akl...@apple.com>
 
         ImageDocuments leak their world.

Modified: trunk/Source/WebCore/page/ViewportConfiguration.h (197765 => 197766)


--- trunk/Source/WebCore/page/ViewportConfiguration.h	2016-03-08 15:14:54 UTC (rev 197765)
+++ trunk/Source/WebCore/page/ViewportConfiguration.h	2016-03-08 16:13:12 UTC (rev 197766)
@@ -33,6 +33,8 @@
 
 namespace WebCore {
 
+static const double forceAlwaysUserScalableMaximumScale = 10.0;
+
 class TextStream;
 
 class ViewportConfiguration {
@@ -88,7 +90,7 @@
     WEBCORE_EXPORT double initialScale() const;
     WEBCORE_EXPORT double initialScaleIgnoringContentSize() const;
     WEBCORE_EXPORT double minimumScale() const;
-    double maximumScale() const { return m_configuration.maximumScale; }
+    double maximumScale() const { return m_forceAlwaysUserScalable ? forceAlwaysUserScalableMaximumScale : m_configuration.maximumScale; }
     WEBCORE_EXPORT bool allowsUserScaling() const;
     bool allowsShrinkToFit() const;
 

Modified: trunk/Source/WebCore/testing/Internals.cpp (197765 => 197766)


--- trunk/Source/WebCore/testing/Internals.cpp	2016-03-08 15:14:54 UTC (rev 197765)
+++ trunk/Source/WebCore/testing/Internals.cpp	2016-03-08 16:13:12 UTC (rev 197766)
@@ -3518,4 +3518,22 @@
     return WebCore::composedTreeAsText(downcast<ContainerNode>(*node));
 }
 
+void Internals::setViewportForceAlwaysUserScalable(bool forceAlwaysUserScalableEnabled)
+{
+#if PLATFORM(IOS) || PLATFORM(MAC)
+    m_viewportConfiguration.setForceAlwaysUserScalable(forceAlwaysUserScalableEnabled);
+#else
+    UNUSED_PARAM(forceAlwaysUserScalableEnabled);
+#endif
 }
+
+double Internals::viewportConfigurationMaximumScale()
+{
+#if PLATFORM(IOS) || PLATFORM(MAC)
+    return m_viewportConfiguration.maximumScale();
+#else
+    return 0;
+#endif
+}
+
+}

Modified: trunk/Source/WebCore/testing/Internals.h (197765 => 197766)


--- trunk/Source/WebCore/testing/Internals.h	2016-03-08 15:14:54 UTC (rev 197765)
+++ trunk/Source/WebCore/testing/Internals.h	2016-03-08 16:13:12 UTC (rev 197766)
@@ -39,6 +39,10 @@
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 
+#if PLATFORM(IOS) || PLATFORM(MAC)
+#include "ViewportConfiguration.h"
+#endif
+
 namespace WebCore {
 
 class AudioContext;
@@ -476,6 +480,9 @@
 
     String composedTreeAsText(Node*);
 
+    void setViewportForceAlwaysUserScalable(bool);
+    double viewportConfigurationMaximumScale();
+
 private:
     explicit Internals(Document*);
     Document* contextDocument() const;
@@ -484,6 +491,9 @@
     RenderedDocumentMarker* markerAt(Node*, const String& markerType, unsigned index, ExceptionCode&);
 
     std::unique_ptr<InspectorStubFrontend> m_inspectorFrontend;
+#if PLATFORM(IOS) || PLATFORM(MAC)
+    ViewportConfiguration m_viewportConfiguration;
+#endif
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/testing/Internals.idl (197765 => 197766)


--- trunk/Source/WebCore/testing/Internals.idl	2016-03-08 15:14:54 UTC (rev 197765)
+++ trunk/Source/WebCore/testing/Internals.idl	2016-03-08 16:13:12 UTC (rev 197766)
@@ -443,4 +443,7 @@
     [RaisesException] void setCanShowModalDialogOverride(boolean allow);
 
     DOMString composedTreeAsText(Node parent);
+
+    void setViewportForceAlwaysUserScalable(boolean enable);
+    double viewportConfigurationMaximumScale();
 };

Modified: trunk/Source/WebKit2/ChangeLog (197765 => 197766)


--- trunk/Source/WebKit2/ChangeLog	2016-03-08 15:14:54 UTC (rev 197765)
+++ trunk/Source/WebKit2/ChangeLog	2016-03-08 16:13:12 UTC (rev 197766)
@@ -1,3 +1,23 @@
+2016-03-08  Nan Wang  <n_w...@apple.com>
+
+        AX: Force allow user zoom
+        https://bugs.webkit.org/show_bug.cgi?id=155056
+
+        Reviewed by Chris Fleizach.
+
+        Soft linked libAccessibility library so that we can observe the accessibility
+        setting change for the force always user scalable feature.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::forceAlwaysUserScalableChangedCallback):
+        (WebKit::WebPage::create):
+        (WebKit::m_shouldDispatchFakeMouseMoveEvents):
+        (WebKit::WebPage::~WebPage):
+        (WebKit::WebPage::preferencesDidChange):
+        (WebKit::WebPage::updateForceAlwaysUserScalable):
+        (WebKit::WebPage::updatePreferences):
+        * WebProcess/WebPage/WebPage.h:
+
 2016-03-08  Csaba Osztrogonác  <o...@webkit.org>
 
         One more unreviewed speculative buildfix after r197728.

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (197765 => 197766)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-03-08 15:14:54 UTC (rev 197765)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-03-08 16:13:12 UTC (rev 197766)
@@ -210,8 +210,17 @@
 #include <CoreGraphics/CoreGraphics.h>
 #include <WebCore/CoreTextSPI.h>
 #include <WebCore/Icon.h>
+
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
+#include <WebCore/SoftLinking.h>
+SOFT_LINK_LIBRARY(libAccessibility)
+SOFT_LINK(libAccessibility, _AXSForceAllowWebScaling, Boolean, (), ())
+SOFT_LINK_CONSTANT(libAccessibility, kAXSAllowForceWebScalingEnabledNotification, CFStringRef)
+#define kAXSAllowForceWebScalingEnabledNotification getkAXSAllowForceWebScalingEnabledNotification()
 #endif
 
+#endif
+
 #ifndef NDEBUG
 #include <wtf/RefCountedLeakCounter.h>
 #endif
@@ -261,6 +270,15 @@
 
 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, webPageCounter, ("WebPage"));
 
+#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
+static void forceAlwaysUserScalableChangedCallback(CFNotificationCenterRef, void* observer, CFStringRef, const void*, CFDictionaryRef)
+{
+    ASSERT(observer);
+    static_cast<WebPage*>(observer)->updateForceAlwaysUserScalable();
+}
+#endif
+
+    
 Ref<WebPage> WebPage::create(uint64_t pageID, const WebPageCreationParameters& parameters)
 {
     Ref<WebPage> page = adoptRef(*new WebPage(pageID, parameters));
@@ -546,7 +564,10 @@
 
 #if PLATFORM(IOS)
     m_page->settings().setContentDispositionAttachmentSandboxEnabled(true);
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
+    CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), this, forceAlwaysUserScalableChangedCallback, kAXSAllowForceWebScalingEnabledNotification, 0, CFNotificationSuspensionBehaviorDeliverImmediately);
 #endif
+#endif
 }
 
 void WebPage::reinitializeWebPage(const WebPageCreationParameters& parameters)
@@ -578,6 +599,10 @@
 
 WebPage::~WebPage()
 {
+#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
+    CFNotificationCenterRemoveObserver(CFNotificationCenterGetLocalCenter(), this, nullptr, nullptr);
+#endif
+    
     if (m_backForwardList)
         m_backForwardList->detach();
 
@@ -2798,6 +2823,17 @@
     updatePreferences(store);
 }
 
+#if PLATFORM(IOS)
+void WebPage::updateForceAlwaysUserScalable()
+{
+    bool forceAlwaysUserScalableEnabled = m_forceAlwaysUserScalable;
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
+    forceAlwaysUserScalableEnabled |= _AXSForceAllowWebScaling();
+#endif
+    m_viewportConfiguration.setForceAlwaysUserScalable(forceAlwaysUserScalableEnabled);
+}
+#endif
+
 void WebPage::updatePreferences(const WebPreferencesStore& store)
 {
     Settings& settings = m_page->settings();
@@ -3071,7 +3107,8 @@
 #if PLATFORM(IOS)
     m_ignoreViewportScalingConstraints = store.getBoolValueForKey(WebPreferencesKey::ignoreViewportScalingConstraintsKey());
     m_viewportConfiguration.setCanIgnoreScalingConstraints(m_ignoreViewportScalingConstraints);
-    m_viewportConfiguration.setForceAlwaysUserScalable(store.getBoolValueForKey(WebPreferencesKey::forceAlwaysUserScalableKey()));
+    m_forceAlwaysUserScalable = store.getBoolValueForKey(WebPreferencesKey::forceAlwaysUserScalableKey());
+    updateForceAlwaysUserScalable();
 #endif
 }
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (197765 => 197766)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2016-03-08 15:14:54 UTC (rev 197765)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2016-03-08 16:13:12 UTC (rev 197766)
@@ -931,6 +931,10 @@
 
     bool isControlledByAutomation() const;
     void setControlledByAutomation(bool);
+    
+#if PLATFORM(IOS)
+    void updateForceAlwaysUserScalable();
+#endif
 
     void insertNewlineInQuotedContent();
 
@@ -1439,6 +1443,10 @@
     bool m_inputMethodEnabled { false };
 #endif
 
+#if PLATFORM(IOS)
+    bool m_forceAlwaysUserScalable { false };
+#endif
+
 #if ENABLE(VIDEO) && USE(GSTREAMER)
     RefPtr<WebCore::MediaPlayerRequestInstallMissingPluginsCallback> m_installMediaPluginsCallback;
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to