Hide service controls for selection behind a runtime switch
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Apr 2014 18:45:44 +0000 (18:45 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Apr 2014 18:45:44 +0000 (18:45 +0000)
<rdar://problem/16736616> and https://bugs.webkit.org/show_bug.cgi?id=132291

Reviewed by Tim Horton.

* Shared/WebPreferencesStore.h:

* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::selectionRectsDidChange): Do nothing if the UI is disabled.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::updatePreferences):

* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::serviceControlsEnabled):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167896 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesStore.h
Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h

index 63553c5..4ee331c 100644 (file)
@@ -1,3 +1,22 @@
+2014-04-28  Brady Eidson  <beidson@apple.com>
+
+        Hide service controls for selection behind a runtime switch
+        <rdar://problem/16736616> and https://bugs.webkit.org/show_bug.cgi?id=132291
+
+        Reviewed by Tim Horton.
+
+        * Shared/WebPreferencesStore.h:
+
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        (WebKit::WebEditorClient::selectionRectsDidChange): Do nothing if the UI is disabled.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage):
+        (WebKit::WebPage::updatePreferences):
+
+        * WebProcess/WebPage/WebPage.h:
+        (WebKit::WebPage::serviceControlsEnabled):
+
 2014-04-28  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r167853.
index 774c527..b9e15de 100644 (file)
@@ -225,6 +225,7 @@ namespace WebKit {
     macro(PasswordEchoEnabled, passwordEchoEnabled, Bool, bool, DEFAULT_PASSWORD_ECHO_ENABLED) \
     macro(ImageControlsEnabled, imageControlsEnabled, Bool, bool, false) \
     macro(EnableInheritURIQueryComponent, enableInheritURIQueryComponent, Bool, bool, false) \
+    macro(ServiceControlsEnabled, serviceControlsEnabled, Bool, bool, false) \
 
 #define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \
     macro(PDFScaleFactor, pdfScaleFactor, Double, double, 0) \
index 7dad7c4..9df5925 100644 (file)
@@ -535,7 +535,8 @@ void WebEditorClient::selectedTelephoneNumberRangesChanged(const Vector<RefPtr<R
 #if ENABLE(SERVICE_CONTROLS)
 void WebEditorClient::selectionRectsDidChange(const Vector<LayoutRect>& rects)
 {
-    m_page->selectionOverlayController().selectionRectsDidChange(rects);
+    if (m_page->serviceControlsEnabled())
+        m_page->selectionOverlayController().selectionRectsDidChange(rects);
 }
 #endif // ENABLE(SERVICE_CONTROLS)
 
index 46d2937..6fb93b0 100644 (file)
@@ -249,6 +249,9 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
     , m_numberOfPrimarySnapshotDetectionAttempts(0)
     , m_determinePrimarySnapshottedPlugInTimer(RunLoop::main(), this, &WebPage::determinePrimarySnapshottedPlugInTimerFired)
 #endif
+#if ENABLE(SERVICE_CONTROLS)
+    , m_serviceControlsEnabled(false)
+#endif
     , m_layerHostingMode(parameters.layerHostingMode)
 #if PLATFORM(COCOA)
     , m_pdfPluginEnabled(false)
@@ -2497,6 +2500,10 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
     m_pdfPluginEnabled = store.getBoolValueForKey(WebPreferencesKey::pdfPluginEnabledKey());
 #endif
 
+#if ENABLE(SERVICE_CONTROLS)
+    m_serviceControlsEnabled = store.getBoolValueForKey(WebPreferencesKey::serviceControlsEnabledKey());
+#endif
+
     // FIXME: This should be generated from macro expansion for all preferences,
     // but we currently don't match the naming of WebCore exactly so we are
     // handrolling the boolean and integer preferences until that is fixed.
index 5f7a6f2..669c915 100644 (file)
@@ -787,6 +787,7 @@ public:
 #endif
 #if ENABLE(SERVICE_CONTROLS)
     SelectionOverlayController& selectionOverlayController();
+    bool serviceControlsEnabled() const { return m_serviceControlsEnabled; }
 #endif
 
     void didChangeScrollOffsetForFrame(WebCore::Frame*);
@@ -1040,6 +1041,10 @@ private:
     RunLoop::Timer<WebPage> m_determinePrimarySnapshottedPlugInTimer;
 #endif
 
+#if ENABLE(SERVICE_CONTROLS)
+    bool m_serviceControlsEnabled;
+#endif
+
     // The layer hosting mode.
     LayerHostingMode m_layerHostingMode;