Move suppressesIncrementalRendering to WKWebViewConfiguration
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Jun 2014 17:44:56 +0000 (17:44 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Jun 2014 17:44:56 +0000 (17:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=133707
<rdar://problem/17271468>

Reviewed by Sam Weinig.

* UIProcess/API/Cocoa/WKPreferences.h:
Get rid of suppressesIncrementalRendering.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithFrame:configuration:]):
Set the suppressesIncrementalRenderingKey key in webPageConfiguration.preferenceValues.

* UIProcess/API/Cocoa/WKWebViewConfiguration.h:
Add suppressesIncrementalRendering.

* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration copyWithZone:]):
Assign suppressesIncrementalRendering.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
Copy webPageConfiguration.preferenceValues to m_configurationPreferenceValues.

(WebKit::WebPageProxy::preferencesStore):
If m_configurationPreferenceValues is empty, just return m_preferences->store(). Otherwise,
copy the store and apply the configuration preference values.

(WebKit::WebPageProxy::preferencesDidChange):
Call preferencesStore() so we'll get the configuration preference values as well.

(WebKit::WebPageProxy::creationParameters):
Ditto.

* UIProcess/WebPageProxy.h:

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.h
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h

index b0254bc..42f2229 100644 (file)
@@ -1,3 +1,41 @@
+2014-06-10  Anders Carlsson  <andersca@apple.com>
+
+        Move suppressesIncrementalRendering to WKWebViewConfiguration
+        https://bugs.webkit.org/show_bug.cgi?id=133707
+        <rdar://problem/17271468>
+
+        Reviewed by Sam Weinig.
+
+        * UIProcess/API/Cocoa/WKPreferences.h:
+        Get rid of suppressesIncrementalRendering.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView initWithFrame:configuration:]):
+        Set the suppressesIncrementalRenderingKey key in webPageConfiguration.preferenceValues.
+
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
+        Add suppressesIncrementalRendering.
+
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+        (-[WKWebViewConfiguration copyWithZone:]):
+        Assign suppressesIncrementalRendering.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy):
+        Copy webPageConfiguration.preferenceValues to m_configurationPreferenceValues.
+
+        (WebKit::WebPageProxy::preferencesStore):
+        If m_configurationPreferenceValues is empty, just return m_preferences->store(). Otherwise,
+        copy the store and apply the configuration preference values.
+
+        (WebKit::WebPageProxy::preferencesDidChange):
+        Call preferencesStore() so we'll get the configuration preference values as well.
+
+        (WebKit::WebPageProxy::creationParameters):
+        Ditto.
+
+        * UIProcess/WebPageProxy.h:
+
 2014-06-11  Antti Koivisto  <antti@apple.com>
 
         Wrap NSURLRequest in bundle API
index f420a75..de68f3e 100644 (file)
@@ -67,12 +67,6 @@ WK_CLASS_AVAILABLE(10_10, 8_0)
  */
 @property (nonatomic) BOOL javaScriptCanOpenWindowsAutomatically;
 
-/*! @abstract A Boolean value indicating whether the web view suppresses
- content rendering until it is fully loaded into memory.
- @discussion The default value is NO.
- */
-@property (nonatomic) BOOL suppressesIncrementalRendering;
-
 #if TARGET_OS_IPHONE
 /*! @abstract A Boolean value indicating whether HTML5 videos play inline
  (YES) or use the native full-screen controller (NO).
index 025cb8d..22e63b2 100644 (file)
@@ -60,6 +60,7 @@
 #import "WebKitSystemInterface.h"
 #import "WebPageGroup.h"
 #import "WebPageProxy.h"
+#import "WebPreferencesKeys.h"
 #import "WebProcessProxy.h"
 #import "WebSerializedScriptValue.h"
 #import "_WKFindDelegate.h"
@@ -249,6 +250,8 @@ static int32_t deviceOrientation()
         webPageConfiguration.pageGroup = pageGroup.get();
     }
 
+    webPageConfiguration.preferenceValues.set(WebKit::WebPreferencesKey::suppressesIncrementalRenderingKey(), WebKit::WebPreferencesStore::Value(!![_configuration suppressesIncrementalRendering]));
+
 #if PLATFORM(IOS)
     _scrollView = adoptNS([[WKScrollView alloc] initWithFrame:bounds]);
     [_scrollView setInternalDelegate:self];
index a416f2d..78132e4 100644 (file)
@@ -56,6 +56,12 @@ WK_CLASS_AVAILABLE(10_10, 8_0)
 */
 @property (nonatomic, strong) WKUserContentController *userContentController;
 
+/*! @abstract A Boolean value indicating whether the web view suppresses
+ content rendering until it is fully loaded into memory.
+ @discussion The default value is NO.
+ */
+@property (nonatomic) BOOL suppressesIncrementalRendering;
+
 @end
 
 #endif
index 11af898..3acf13e 100644 (file)
@@ -98,6 +98,8 @@ private:
     configuration._contentProviderRegistry = self._contentProviderRegistry;
 #endif
 
+    configuration->_suppressesIncrementalRendering = self->_suppressesIncrementalRendering;
+
     return configuration;
 }
 
index eab78c3..448b13a 100644 (file)
@@ -364,6 +364,7 @@ WebPageProxy::WebPageProxy(PageClient& pageClient, WebProcessProxy& process, uin
     , m_waitingForDidUpdateViewState(false)
     , m_scrollPinningBehavior(DoNotPin)
     , m_navigationID(0)
+    , m_configurationPreferenceValues(configuration.preferenceValues)
 {
     if (m_process->state() == WebProcessProxy::State::Running) {
         if (m_userContentController)
@@ -1498,6 +1499,18 @@ uint64_t WebPageProxy::generateNavigationID()
     return ++m_navigationID;
 }
 
+WebPreferencesStore WebPageProxy::preferencesStore() const
+{
+    if (m_configurationPreferenceValues.isEmpty())
+        return m_preferences->store();
+
+    WebPreferencesStore store = m_preferences->store();
+    for (const auto& preference : m_configurationPreferenceValues)
+        store.m_values.set(preference.key, preference.value);
+
+    return store;
+}
+
 #if ENABLE(NETSCAPE_PLUGIN_API)
 void WebPageProxy::findPlugin(const String& mimeType, uint32_t processType, const String& urlString, const String& frameURLString, const String& pageURLString, bool allowOnlyApplicationPlugins, uint64_t& pluginProcessToken, String& newMimeType, uint32_t& pluginLoadPolicy, String& unavailabilityDescription)
 {
@@ -2322,7 +2335,7 @@ void WebPageProxy::preferencesDidChange()
     // even if nothing changed in UI process, so that overrides get removed.
 
     // Preferences need to be updated during synchronous printing to make "print backgrounds" preference work when toggled from a print dialog checkbox.
-    m_process->send(Messages::WebPage::PreferencesDidChange(m_preferences->store()), m_pageID, m_isPerformingDOMPrintOperation ? IPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
+    m_process->send(Messages::WebPage::PreferencesDidChange(preferencesStore()), m_pageID, m_isPerformingDOMPrintOperation ? IPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
 }
 
 void WebPageProxy::didCreateMainFrame(uint64_t frameID)
@@ -4339,7 +4352,7 @@ WebPageCreationParameters WebPageProxy::creationParameters()
     parameters.viewSize = m_pageClient.viewSize();
     parameters.viewState = m_viewState;
     parameters.drawingAreaType = m_drawingArea->type();
-    parameters.store = m_preferences->store();
+    parameters.store = preferencesStore();
     parameters.pageGroupData = m_pageGroup->data();
     parameters.drawsBackground = m_drawsBackground;
     parameters.drawsTransparentBackground = m_drawsTransparentBackground;
index b4933c8..710928f 100644 (file)
@@ -433,6 +433,8 @@ struct WebPageConfiguration {
 
     API::Session* session = nullptr;
     WebPageProxy* relatedPage = nullptr;
+
+    WebPreferencesStore::ValueMap preferenceValues;
 };
 
 class WebPageProxy : public API::ObjectImpl<API::Object::Type::Page>
@@ -1454,6 +1456,8 @@ private:
 
     uint64_t generateNavigationID();
 
+    WebPreferencesStore preferencesStore() const;
+
     PageClient& m_pageClient;
     std::unique_ptr<API::LoaderClient> m_loaderClient;
     std::unique_ptr<API::PolicyClient> m_policyClient;
@@ -1717,6 +1721,8 @@ private:
     WebCore::ScrollPinningBehavior m_scrollPinningBehavior;
 
     uint64_t m_navigationID;
+
+    WebPreferencesStore::ValueMap m_configurationPreferenceValues;
 };
 
 } // namespace WebKit