Changeset 96770 in webkit


Ignore:
Timestamp:
Oct 5, 2011 5:08:04 PM (12 years ago)
Author:
Simon Fraser
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):

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r96765 r96770  
     12011-10-05  Simon Fraser  <simon.fraser@apple.com>
     2
     3        In WebKitTestRunner, text has font smoothing in pixel snapshots
     4        https://bugs.webkit.org/show_bug.cgi?id=69396
     5
     6        Reviewed by Darin Adler.
     7       
     8        Plumb through a method on WKContext that controls whether font smoothing
     9        is enabled. Since this is a global setting, such a method is more appropriate
     10        than a preference.
     11       
     12        Remove leading underscores on some WKContext functions, but keep
     13        exported versions of same for binary compatibility.
     14
     15        * Shared/WebProcessCreationParameters.cpp:
     16        (WebKit::WebProcessCreationParameters::WebProcessCreationParameters):
     17        (WebKit::WebProcessCreationParameters::encode):
     18        (WebKit::WebProcessCreationParameters::decode):
     19        * Shared/WebProcessCreationParameters.h:
     20        * UIProcess/API/C/WKContext.cpp:
     21        (WKContextSetAlwaysUsesComplexTextCodePath):
     22        (WKContextSetShouldUseFontSmoothing):
     23        (WKContextSetAdditionalPluginsDirectory):
     24        (WKContextRegisterURLSchemeAsEmptyDocument):
     25        (WKContextSetHTTPPipeliningEnabled):
     26        (_WKContextSetAdditionalPluginsDirectory):
     27        (_WKContextRegisterURLSchemeAsEmptyDocument):
     28        (_WKContextSetAlwaysUsesComplexTextCodePath):
     29        (_WKContextSetHTTPPipeliningEnabled):
     30        * UIProcess/API/C/WKContextPrivate.h:
     31        * UIProcess/WebContext.cpp:
     32        (WebKit::WebContext::WebContext):
     33        (WebKit::WebContext::ensureWebProcess):
     34        (WebKit::WebContext::setShouldUseFontSmoothing):
     35        (WebKit::WebContext::httpPipeliningEnabled):
     36        * UIProcess/WebContext.h:
     37        * WebProcess/WebProcess.cpp:
     38        (WebKit::WebProcess::initializeWebProcess):
     39        (WebKit::WebProcess::setShouldUseFontSmoothing):
     40        * WebProcess/WebProcess.h:
     41        * WebProcess/WebProcess.messages.in:
     42
    1432011-10-05  Anders Carlsson  <andersca@apple.com>
    244
  • trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp

    r95901 r96770  
    3737    : shouldTrackVisitedLinks(false)
    3838    , shouldAlwaysUseComplexTextCodePath(false)
     39    , shouldUseFontSmoothing(true)
    3940    , defaultRequestTimeoutInterval(INT_MAX)
    4041#if PLATFORM(MAC)
     
    6162    encoder->encode(shouldTrackVisitedLinks);
    6263    encoder->encode(shouldAlwaysUseComplexTextCodePath);
     64    encoder->encode(shouldUseFontSmoothing);
    6365    encoder->encode(iconDatabaseEnabled);
    6466#if ENABLE(PLUGIN_PROCESS)
     
    122124        return false;
    123125    if (!decoder->decode(parameters.shouldAlwaysUseComplexTextCodePath))
     126        return false;
     127    if (!decoder->decode(parameters.shouldUseFontSmoothing))
    124128        return false;
    125129    if (!decoder->decode(parameters.iconDatabaseEnabled))
  • trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h

    r95901 r96770  
    6868
    6969    bool shouldAlwaysUseComplexTextCodePath;
     70    bool shouldUseFontSmoothing;
    7071
    7172    bool iconDatabaseEnabled;
  • trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp

    r95901 r96770  
    3737using namespace WebKit;
    3838
     39// For binary compatibility with Safari 5.1. Should be removed eventually.
     40WK_EXPORT void _WKContextSetAdditionalPluginsDirectory(WKContextRef context, WKStringRef pluginsDirectory);
     41WK_EXPORT void _WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef context, WKStringRef urlScheme);
     42WK_EXPORT void _WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef context, bool alwaysUseComplexTextCodePath);
     43WK_EXPORT void _WKContextSetHTTPPipeliningEnabled(WKContextRef context, bool enabled);
     44
    3945WKTypeID WKContextGetTypeID()
    4046{
     
    118124}
    119125
    120 void _WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef contextRef, bool alwaysUseComplexTextCodePath)
     126void WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef contextRef, bool alwaysUseComplexTextCodePath)
    121127{
    122128    toImpl(contextRef)->setAlwaysUsesComplexTextCodePath(alwaysUseComplexTextCodePath);
    123129}
    124130
    125 void _WKContextSetAdditionalPluginsDirectory(WKContextRef contextRef, WKStringRef pluginsDirectory)
     131void WKContextSetShouldUseFontSmoothing(WKContextRef contextRef, bool useFontSmoothing)
     132{
     133    toImpl(contextRef)->setShouldUseFontSmoothing(useFontSmoothing);
     134}
     135
     136void WKContextSetAdditionalPluginsDirectory(WKContextRef contextRef, WKStringRef pluginsDirectory)
    126137{
    127138    toImpl(contextRef)->setAdditionalPluginsDirectory(toImpl(pluginsDirectory)->string());
    128139}
    129140
    130 void _WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef contextRef, WKStringRef urlScheme)
     141void WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef contextRef, WKStringRef urlScheme)
    131142{
    132143    toImpl(contextRef)->registerURLSchemeAsEmptyDocument(toImpl(urlScheme)->string());
     
    223234}
    224235
    225 void _WKContextSetHTTPPipeliningEnabled(WKContextRef contextRef, bool enabled)
     236void WKContextSetHTTPPipeliningEnabled(WKContextRef contextRef, bool enabled)
    226237{
    227238    toImpl(contextRef)->setHTTPPipeliningEnabled(enabled);
     
    243254}
    244255
     256// Deprecated functions.
     257void _WKContextSetAdditionalPluginsDirectory(WKContextRef context, WKStringRef pluginsDirectory)
     258{
     259    WKContextSetAdditionalPluginsDirectory(context, pluginsDirectory);
     260}
     261
     262void _WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef context, WKStringRef urlScheme)
     263{
     264    WKContextRegisterURLSchemeAsEmptyDocument(context, urlScheme);
     265}
     266
     267void _WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef context, bool alwaysUseComplexTextCodePath)
     268{
     269    WKContextSetAlwaysUsesComplexTextCodePath(context, alwaysUseComplexTextCodePath);
     270}
     271
     272void _WKContextSetHTTPPipeliningEnabled(WKContextRef context, bool enabled)
     273{
     274    WKContextSetHTTPPipeliningEnabled(context, enabled);
     275}
  • trunk/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h

    r95901 r96770  
    4545WK_EXPORT WKContextRef WKContextGetSharedThreadContext();
    4646
    47 WK_EXPORT void _WKContextSetAdditionalPluginsDirectory(WKContextRef context, WKStringRef pluginsDirectory);
     47WK_EXPORT void WKContextSetAdditionalPluginsDirectory(WKContextRef context, WKStringRef pluginsDirectory);
    4848
    49 WK_EXPORT void _WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef context, WKStringRef urlScheme);
     49WK_EXPORT void WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef context, WKStringRef urlScheme);
    5050
    51 WK_EXPORT void _WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef context, bool alwaysUseComplexTextCodePath);
     51WK_EXPORT void WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef context, bool alwaysUseComplexTextCodePath);
     52
     53WK_EXPORT void WKContextSetShouldUseFontSmoothing(WKContextRef context, bool useFontSmoothing);
    5254
    5355WK_EXPORT void WKContextRegisterURLSchemeAsSecure(WKContextRef context, WKStringRef urlScheme);
     
    6769WK_EXPORT void WKContextEnableProcessTermination(WKContextRef context);
    6870
    69 WK_EXPORT void _WKContextSetHTTPPipeliningEnabled(WKContextRef context, bool enabled);
    70    
     71WK_EXPORT void WKContextSetHTTPPipeliningEnabled(WKContextRef context, bool enabled);
     72
    7173WK_EXPORT void WKContextWarmInitialProcess(WKContextRef context);
    7274
  • trunk/Source/WebKit2/UIProcess/WebContext.cpp

    r96653 r96770  
    123123    , m_visitedLinkProvider(this)
    124124    , m_alwaysUsesComplexTextCodePath(false)
     125    , m_shouldUseFontSmoothing(true)
    125126    , m_cacheModel(CacheModelDocumentViewer)
    126127    , m_memorySamplerEnabled(false)
     
    255256
    256257    parameters.shouldAlwaysUseComplexTextCodePath = m_alwaysUsesComplexTextCodePath;
     258    parameters.shouldUseFontSmoothing = m_shouldUseFontSmoothing;
    257259   
    258260    parameters.iconDatabaseEnabled = !iconDatabasePath().isEmpty();
     
    509511}
    510512
     513void WebContext::setShouldUseFontSmoothing(bool useFontSmoothing)
     514{
     515    m_shouldUseFontSmoothing = useFontSmoothing;
     516    sendToAllProcesses(Messages::WebProcess::SetShouldUseFontSmoothing(useFontSmoothing));
     517}
     518
    511519void WebContext::registerURLSchemeAsEmptyDocument(const String& urlScheme)
    512520{
     
    804812}
    805813
    806 bool WebContext::httpPipeliningEnabled()
     814bool WebContext::httpPipeliningEnabled() const
    807815{
    808816#if PLATFORM(MAC)
  • trunk/Source/WebKit2/UIProcess/WebContext.h

    r95901 r96770  
    114114
    115115    void setAlwaysUsesComplexTextCodePath(bool);
     116    void setShouldUseFontSmoothing(bool);
    116117   
    117118    void registerURLSchemeAsEmptyDocument(const String&);
     
    179180    // Defaults to false.
    180181    void setHTTPPipeliningEnabled(bool);
    181     bool httpPipeliningEnabled();
     182    bool httpPipeliningEnabled() const;
    182183   
    183184    void getWebCoreStatistics(PassRefPtr<DictionaryCallback>);
     
    245246
    246247    bool m_alwaysUsesComplexTextCodePath;
     248    bool m_shouldUseFontSmoothing;
    247249
    248250    Vector<pair<String, RefPtr<APIObject> > > m_pendingMessagesToPostToInjectedBundle;
  • trunk/Source/WebKit2/WebProcess/WebProcess.cpp

    r95919 r96770  
    238238        setAlwaysUsesComplexTextCodePath(true);
    239239
     240    if (parameters.shouldUseFontSmoothing)
     241        setShouldUseFontSmoothing(true);
     242
    240243#if USE(CFURLSTORAGESESSIONS)
    241244    WebCore::ResourceHandle::setPrivateBrowsingStorageSessionIdentifierBase(parameters.uiProcessBundleIdentifier);
     
    275278{
    276279    WebCore::Font::setCodePath(alwaysUseComplexText ? WebCore::Font::Complex : WebCore::Font::Auto);
     280}
     281
     282void WebProcess::setShouldUseFontSmoothing(bool useFontSmoothing)
     283{
     284    WebCore::Font::setShouldUseSmoothing(useFontSmoothing);
    277285}
    278286
  • trunk/Source/WebKit2/WebProcess/WebProcess.h

    r95919 r96770  
    142142    void setDefaultRequestTimeoutInterval(double);
    143143    void setAlwaysUsesComplexTextCodePath(bool);
     144    void setShouldUseFontSmoothing(bool);
    144145    void languageChanged(const String&) const;
    145146#if PLATFORM(WIN)
  • trunk/Source/WebKit2/WebProcess/WebProcess.messages.in

    r94476 r96770  
    4141    SetDefaultRequestTimeoutInterval(double timeoutInterval)
    4242    SetAlwaysUsesComplexTextCodePath(bool alwaysUseComplexText)
     43    SetShouldUseFontSmoothing(bool useFontSmoothing)
    4344    LanguageChanged(WTF::String language)
    4445#if PLATFORM(WIN)
  • trunk/Tools/ChangeLog

    r96768 r96770  
     12011-10-05  Simon Fraser  <simon.fraser@apple.com>
     2
     3        In WebKitTestRunner, text has font smoothing in pixel snapshots
     4        https://bugs.webkit.org/show_bug.cgi?id=69396
     5
     6        Reviewed by Darin Adler.
     7       
     8        Call the new WKContext method that disables font smoothing in
     9        WebKitTestRunner, so that pixel snapshots don't have font smoothing
     10        enabled. Remove leading underscore from a WKContext function call.
     11
     12        * WebKitTestRunner/TestController.cpp:
     13        (WTR::TestController::resetStateToConsistentValues):
     14
    1152011-10-05  David Levin  <levin@chromium.org>
    216
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r96645 r96770  
    294294    WKContextSetInjectedBundleClient(m_context.get(), &injectedBundleClient);
    295295
    296     _WKContextSetAdditionalPluginsDirectory(m_context.get(), testPluginDirectory());
     296    WKContextSetAdditionalPluginsDirectory(m_context.get(), testPluginDirectory());
    297297
    298298    m_mainWebView = adoptPtr(new PlatformWebView(m_context.get(), m_pageGroup.get()));
     
    392392    WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), resetMessageBody.get());
    393393
     394    WKContextSetShouldUseFontSmoothing(TestController::shared().context(), false);
     395
    394396    // FIXME: This function should also ensure that there is only one page open.
    395397
Note: See TracChangeset for help on using the changeset viewer.