Title: [96770] trunk
Revision
96770
Author
simon.fra...@apple.com
Date
2011-10-05 17:08:04 -0700 (Wed, 05 Oct 2011)

Log Message

In WebKitTestRunner, text has font smoothing in pixel snapshots
https://bugs.webkit.org/show_bug.cgi?id=69396

Source/WebKit2:

Reviewed by Darin Adler.

Plumb through a method on WKContext that controls whether font smoothing
is enabled. Since this is a global setting, such a method is more appropriate
than a preference.

Remove leading underscores on some WKContext functions, but keep
exported versions of same for binary compatibility.

* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::WebProcessCreationParameters):
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/API/C/WKContext.cpp:
(WKContextSetAlwaysUsesComplexTextCodePath):
(WKContextSetShouldUseFontSmoothing):
(WKContextSetAdditionalPluginsDirectory):
(WKContextRegisterURLSchemeAsEmptyDocument):
(WKContextSetHTTPPipeliningEnabled):
(_WKContextSetAdditionalPluginsDirectory):
(_WKContextRegisterURLSchemeAsEmptyDocument):
(_WKContextSetAlwaysUsesComplexTextCodePath):
(_WKContextSetHTTPPipeliningEnabled):
* UIProcess/API/C/WKContextPrivate.h:
* UIProcess/WebContext.cpp:
(WebKit::WebContext::WebContext):
(WebKit::WebContext::ensureWebProcess):
(WebKit::WebContext::setShouldUseFontSmoothing):
(WebKit::WebContext::httpPipeliningEnabled):
* UIProcess/WebContext.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
(WebKit::WebProcess::setShouldUseFontSmoothing):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:

Tools:

Reviewed by Darin Adler.

Call the new WKContext method that disables font smoothing in
WebKitTestRunner, so that pixel snapshots don't have font smoothing
enabled. Remove leading underscore from a WKContext function call.

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (96769 => 96770)


--- trunk/Source/WebKit2/ChangeLog	2011-10-06 00:01:28 UTC (rev 96769)
+++ trunk/Source/WebKit2/ChangeLog	2011-10-06 00:08:04 UTC (rev 96770)
@@ -1,3 +1,45 @@
+2011-10-05  Simon Fraser  <simon.fra...@apple.com>
+
+        In WebKitTestRunner, text has font smoothing in pixel snapshots
+        https://bugs.webkit.org/show_bug.cgi?id=69396
+
+        Reviewed by Darin Adler.
+        
+        Plumb through a method on WKContext that controls whether font smoothing
+        is enabled. Since this is a global setting, such a method is more appropriate
+        than a preference.
+        
+        Remove leading underscores on some WKContext functions, but keep
+        exported versions of same for binary compatibility.
+
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::WebProcessCreationParameters):
+        (WebKit::WebProcessCreationParameters::encode):
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.h:
+        * UIProcess/API/C/WKContext.cpp:
+        (WKContextSetAlwaysUsesComplexTextCodePath):
+        (WKContextSetShouldUseFontSmoothing):
+        (WKContextSetAdditionalPluginsDirectory):
+        (WKContextRegisterURLSchemeAsEmptyDocument):
+        (WKContextSetHTTPPipeliningEnabled):
+        (_WKContextSetAdditionalPluginsDirectory):
+        (_WKContextRegisterURLSchemeAsEmptyDocument):
+        (_WKContextSetAlwaysUsesComplexTextCodePath):
+        (_WKContextSetHTTPPipeliningEnabled):
+        * UIProcess/API/C/WKContextPrivate.h:
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::WebContext):
+        (WebKit::WebContext::ensureWebProcess):
+        (WebKit::WebContext::setShouldUseFontSmoothing):
+        (WebKit::WebContext::httpPipeliningEnabled):
+        * UIProcess/WebContext.h:
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::initializeWebProcess):
+        (WebKit::WebProcess::setShouldUseFontSmoothing):
+        * WebProcess/WebProcess.h:
+        * WebProcess/WebProcess.messages.in:
+
 2011-10-05  Anders Carlsson  <ander...@apple.com>
 
         Flash of white when unminimizing windows

Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp (96769 => 96770)


--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp	2011-10-06 00:01:28 UTC (rev 96769)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp	2011-10-06 00:08:04 UTC (rev 96770)
@@ -36,6 +36,7 @@
 WebProcessCreationParameters::WebProcessCreationParameters()
     : shouldTrackVisitedLinks(false)
     , shouldAlwaysUseComplexTextCodePath(false)
+    , shouldUseFontSmoothing(true)
     , defaultRequestTimeoutInterval(INT_MAX)
 #if PLATFORM(MAC)
     , nsURLCacheMemoryCapacity(0)
@@ -60,6 +61,7 @@
     encoder->encodeEnum(cacheModel);
     encoder->encode(shouldTrackVisitedLinks);
     encoder->encode(shouldAlwaysUseComplexTextCodePath);
+    encoder->encode(shouldUseFontSmoothing);
     encoder->encode(iconDatabaseEnabled);
 #if ENABLE(PLUGIN_PROCESS)
     encoder->encode(disablePluginProcessMessageTimeout);
@@ -122,6 +124,8 @@
         return false;
     if (!decoder->decode(parameters.shouldAlwaysUseComplexTextCodePath))
         return false;
+    if (!decoder->decode(parameters.shouldUseFontSmoothing))
+        return false;
     if (!decoder->decode(parameters.iconDatabaseEnabled))
         return false;
 #if ENABLE(PLUGIN_PROCESS)

Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h (96769 => 96770)


--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h	2011-10-06 00:01:28 UTC (rev 96769)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h	2011-10-06 00:08:04 UTC (rev 96770)
@@ -67,6 +67,7 @@
     bool shouldTrackVisitedLinks;
 
     bool shouldAlwaysUseComplexTextCodePath;
+    bool shouldUseFontSmoothing;
 
     bool iconDatabaseEnabled;
 

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp (96769 => 96770)


--- trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp	2011-10-06 00:01:28 UTC (rev 96769)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp	2011-10-06 00:08:04 UTC (rev 96770)
@@ -36,6 +36,12 @@
 
 using namespace WebKit;
 
+// For binary compatibility with Safari 5.1. Should be removed eventually.
+WK_EXPORT void _WKContextSetAdditionalPluginsDirectory(WKContextRef context, WKStringRef pluginsDirectory);
+WK_EXPORT void _WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef context, WKStringRef urlScheme);
+WK_EXPORT void _WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef context, bool alwaysUseComplexTextCodePath);
+WK_EXPORT void _WKContextSetHTTPPipeliningEnabled(WKContextRef context, bool enabled);
+
 WKTypeID WKContextGetTypeID()
 {
     return toAPI(WebContext::APIType);
@@ -117,17 +123,22 @@
     return toAPI(toImpl(contextRef)->cacheModel());
 }
 
-void _WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef contextRef, bool alwaysUseComplexTextCodePath)
+void WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef contextRef, bool alwaysUseComplexTextCodePath)
 {
     toImpl(contextRef)->setAlwaysUsesComplexTextCodePath(alwaysUseComplexTextCodePath);
 }
 
-void _WKContextSetAdditionalPluginsDirectory(WKContextRef contextRef, WKStringRef pluginsDirectory)
+void WKContextSetShouldUseFontSmoothing(WKContextRef contextRef, bool useFontSmoothing)
 {
+    toImpl(contextRef)->setShouldUseFontSmoothing(useFontSmoothing);
+}
+
+void WKContextSetAdditionalPluginsDirectory(WKContextRef contextRef, WKStringRef pluginsDirectory)
+{
     toImpl(contextRef)->setAdditionalPluginsDirectory(toImpl(pluginsDirectory)->string());
 }
 
-void _WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef contextRef, WKStringRef urlScheme)
+void WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef contextRef, WKStringRef urlScheme)
 {
     toImpl(contextRef)->registerURLSchemeAsEmptyDocument(toImpl(urlScheme)->string());
 }
@@ -222,7 +233,7 @@
     toImpl(contextRef)->enableProcessTermination();
 }
 
-void _WKContextSetHTTPPipeliningEnabled(WKContextRef contextRef, bool enabled)
+void WKContextSetHTTPPipeliningEnabled(WKContextRef contextRef, bool enabled)
 {
     toImpl(contextRef)->setHTTPPipeliningEnabled(enabled);
 }
@@ -242,3 +253,23 @@
     toImpl(contextRef)->garbageCollectJavaScriptObjects();
 }
 
+// Deprecated functions.
+void _WKContextSetAdditionalPluginsDirectory(WKContextRef context, WKStringRef pluginsDirectory)
+{
+    WKContextSetAdditionalPluginsDirectory(context, pluginsDirectory);
+}
+
+void _WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef context, WKStringRef urlScheme)
+{
+    WKContextRegisterURLSchemeAsEmptyDocument(context, urlScheme);
+}
+
+void _WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef context, bool alwaysUseComplexTextCodePath)
+{
+    WKContextSetAlwaysUsesComplexTextCodePath(context, alwaysUseComplexTextCodePath);
+}
+
+void _WKContextSetHTTPPipeliningEnabled(WKContextRef context, bool enabled)
+{
+    WKContextSetHTTPPipeliningEnabled(context, enabled);
+}

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h (96769 => 96770)


--- trunk/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h	2011-10-06 00:01:28 UTC (rev 96769)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h	2011-10-06 00:08:04 UTC (rev 96770)
@@ -44,12 +44,14 @@
 
 WK_EXPORT WKContextRef WKContextGetSharedThreadContext();
 
-WK_EXPORT void _WKContextSetAdditionalPluginsDirectory(WKContextRef context, WKStringRef pluginsDirectory);
+WK_EXPORT void WKContextSetAdditionalPluginsDirectory(WKContextRef context, WKStringRef pluginsDirectory);
 
-WK_EXPORT void _WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef context, WKStringRef urlScheme);
+WK_EXPORT void WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef context, WKStringRef urlScheme);
 
-WK_EXPORT void _WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef context, bool alwaysUseComplexTextCodePath);
+WK_EXPORT void WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef context, bool alwaysUseComplexTextCodePath);
 
+WK_EXPORT void WKContextSetShouldUseFontSmoothing(WKContextRef context, bool useFontSmoothing);
+
 WK_EXPORT void WKContextRegisterURLSchemeAsSecure(WKContextRef context, WKStringRef urlScheme);
 
 WK_EXPORT void WKContextSetDomainRelaxationForbiddenForURLScheme(WKContextRef context, WKStringRef urlScheme);
@@ -66,8 +68,8 @@
 WK_EXPORT void WKContextDisableProcessTermination(WKContextRef context);
 WK_EXPORT void WKContextEnableProcessTermination(WKContextRef context);
 
-WK_EXPORT void _WKContextSetHTTPPipeliningEnabled(WKContextRef context, bool enabled);
-    
+WK_EXPORT void WKContextSetHTTPPipeliningEnabled(WKContextRef context, bool enabled);
+
 WK_EXPORT void WKContextWarmInitialProcess(WKContextRef context);
 
 #ifdef __cplusplus

Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (96769 => 96770)


--- trunk/Source/WebKit2/UIProcess/WebContext.cpp	2011-10-06 00:01:28 UTC (rev 96769)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp	2011-10-06 00:08:04 UTC (rev 96770)
@@ -122,6 +122,7 @@
     , m_injectedBundlePath(injectedBundlePath)
     , m_visitedLinkProvider(this)
     , m_alwaysUsesComplexTextCodePath(false)
+    , m_shouldUseFontSmoothing(true)
     , m_cacheModel(CacheModelDocumentViewer)
     , m_memorySamplerEnabled(false)
     , m_memorySamplerInterval(1400.0)
@@ -254,6 +255,7 @@
     copyToVector(m_schemesToSetDomainRelaxationForbiddenFor, parameters.urlSchemesForWhichDomainRelaxationIsForbidden);
 
     parameters.shouldAlwaysUseComplexTextCodePath = m_alwaysUsesComplexTextCodePath;
+    parameters.shouldUseFontSmoothing = m_shouldUseFontSmoothing;
     
     parameters.iconDatabaseEnabled = !iconDatabasePath().isEmpty();
 
@@ -508,6 +510,12 @@
     sendToAllProcesses(Messages::WebProcess::SetAlwaysUsesComplexTextCodePath(alwaysUseComplexText));
 }
 
+void WebContext::setShouldUseFontSmoothing(bool useFontSmoothing)
+{
+    m_shouldUseFontSmoothing = useFontSmoothing;
+    sendToAllProcesses(Messages::WebProcess::SetShouldUseFontSmoothing(useFontSmoothing));
+}
+
 void WebContext::registerURLSchemeAsEmptyDocument(const String& urlScheme)
 {
     m_schemesToRegisterAsEmptyDocument.add(urlScheme);
@@ -803,7 +811,7 @@
 #endif
 }
 
-bool WebContext::httpPipeliningEnabled()
+bool WebContext::httpPipeliningEnabled() const
 {
 #if PLATFORM(MAC)
     return ResourceRequest::httpPipeliningEnabled();

Modified: trunk/Source/WebKit2/UIProcess/WebContext.h (96769 => 96770)


--- trunk/Source/WebKit2/UIProcess/WebContext.h	2011-10-06 00:01:28 UTC (rev 96769)
+++ trunk/Source/WebKit2/UIProcess/WebContext.h	2011-10-06 00:08:04 UTC (rev 96770)
@@ -113,6 +113,7 @@
     String applicationCacheDirectory();
 
     void setAlwaysUsesComplexTextCodePath(bool);
+    void setShouldUseFontSmoothing(bool);
     
     void registerURLSchemeAsEmptyDocument(const String&);
     void registerURLSchemeAsSecure(const String&);
@@ -178,7 +179,7 @@
 
     // Defaults to false.
     void setHTTPPipeliningEnabled(bool);
-    bool httpPipeliningEnabled();
+    bool httpPipeliningEnabled() const;
     
     void getWebCoreStatistics(PassRefPtr<DictionaryCallback>);
     void garbageCollectJavaScriptObjects();
@@ -244,6 +245,7 @@
     HashSet<String> m_schemesToSetDomainRelaxationForbiddenFor;
 
     bool m_alwaysUsesComplexTextCodePath;
+    bool m_shouldUseFontSmoothing;
 
     Vector<pair<String, RefPtr<APIObject> > > m_pendingMessagesToPostToInjectedBundle;
 

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (96769 => 96770)


--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2011-10-06 00:01:28 UTC (rev 96769)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2011-10-06 00:08:04 UTC (rev 96770)
@@ -237,6 +237,9 @@
     if (parameters.shouldAlwaysUseComplexTextCodePath)
         setAlwaysUsesComplexTextCodePath(true);
 
+    if (parameters.shouldUseFontSmoothing)
+        setShouldUseFontSmoothing(true);
+
 #if USE(CFURLSTORAGESESSIONS)
     WebCore::ResourceHandle::setPrivateBrowsingStorageSessionIdentifierBase(parameters.uiProcessBundleIdentifier);
 #endif
@@ -276,6 +279,11 @@
     WebCore::Font::setCodePath(alwaysUseComplexText ? WebCore::Font::Complex : WebCore::Font::Auto);
 }
 
+void WebProcess::setShouldUseFontSmoothing(bool useFontSmoothing)
+{
+    WebCore::Font::setShouldUseSmoothing(useFontSmoothing);
+}
+
 void WebProcess::languageChanged(const String& language) const
 {
     overrideDefaultLanguage(language);

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (96769 => 96770)


--- trunk/Source/WebKit2/WebProcess/WebProcess.h	2011-10-06 00:01:28 UTC (rev 96769)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h	2011-10-06 00:08:04 UTC (rev 96770)
@@ -141,6 +141,7 @@
     void setDomainRelaxationForbiddenForURLScheme(const String&) const;
     void setDefaultRequestTimeoutInterval(double);
     void setAlwaysUsesComplexTextCodePath(bool);
+    void setShouldUseFontSmoothing(bool);
     void languageChanged(const String&) const;
 #if PLATFORM(WIN)
     void setShouldPaintNativeControls(bool);

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.messages.in (96769 => 96770)


--- trunk/Source/WebKit2/WebProcess/WebProcess.messages.in	2011-10-06 00:01:28 UTC (rev 96769)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.messages.in	2011-10-06 00:08:04 UTC (rev 96770)
@@ -40,6 +40,7 @@
     SetDomainRelaxationForbiddenForURLScheme(WTF::String scheme)
     SetDefaultRequestTimeoutInterval(double timeoutInterval)
     SetAlwaysUsesComplexTextCodePath(bool alwaysUseComplexText)
+    SetShouldUseFontSmoothing(bool useFontSmoothing)
     LanguageChanged(WTF::String language)
 #if PLATFORM(WIN)
     SetShouldPaintNativeControls(bool shouldPaintNativeControls)

Modified: trunk/Tools/ChangeLog (96769 => 96770)


--- trunk/Tools/ChangeLog	2011-10-06 00:01:28 UTC (rev 96769)
+++ trunk/Tools/ChangeLog	2011-10-06 00:08:04 UTC (rev 96770)
@@ -1,3 +1,17 @@
+2011-10-05  Simon Fraser  <simon.fra...@apple.com>
+
+        In WebKitTestRunner, text has font smoothing in pixel snapshots
+        https://bugs.webkit.org/show_bug.cgi?id=69396
+
+        Reviewed by Darin Adler.
+        
+        Call the new WKContext method that disables font smoothing in
+        WebKitTestRunner, so that pixel snapshots don't have font smoothing
+        enabled. Remove leading underscore from a WKContext function call.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::resetStateToConsistentValues):
+
 2011-10-05  David Levin  <le...@chromium.org>
 
         Improve the watchlist for threading entries.

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (96769 => 96770)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2011-10-06 00:01:28 UTC (rev 96769)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2011-10-06 00:08:04 UTC (rev 96770)
@@ -293,7 +293,7 @@
     };
     WKContextSetInjectedBundleClient(m_context.get(), &injectedBundleClient);
 
-    _WKContextSetAdditionalPluginsDirectory(m_context.get(), testPluginDirectory());
+    WKContextSetAdditionalPluginsDirectory(m_context.get(), testPluginDirectory());
 
     m_mainWebView = adoptPtr(new PlatformWebView(m_context.get(), m_pageGroup.get()));
 
@@ -391,6 +391,8 @@
 
     WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), resetMessageBody.get());
 
+    WKContextSetShouldUseFontSmoothing(TestController::shared().context(), false);
+
     // FIXME: This function should also ensure that there is only one page open.
 
     // Reset preferences
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to