Changeset 64888 in webkit


Ignore:
Timestamp:
Aug 6, 2010 5:34:39 PM (14 years ago)
Author:
jhoneycutt@apple.com
Message:

WebKitTestRunner needs to be able to set the font smoothing type
https://bugs.webkit.org/show_bug.cgi?id=43406

Reviewed by Adam Roben.

WebKit2:

  • Shared/FontSmoothingLevel.h: Added.

(WebKit::):

  • Shared/WebPreferencesStore.cpp:

(WebKit::WebPreferencesStore::WebPreferencesStore):
Initialize fontSmoothingLevel.
(WebKit::WebPreferencesStore::swap):
Copy fontSmoothingLevel.

  • Shared/WebPreferencesStore.h:

(WebKit::WebPreferencesStore::encode):
Encode fontSmoothingLevel.
(WebKit::WebPreferencesStore::decode):
Decode it.

  • UIProcess/API/C/WKPreferencesPrivate.cpp: Added.

(WKPreferencesSetFontSmoothingLevel):
Get the font smoothing level from the WKFontSmoothingLevel, and call
WebPreferences::setFontSmoothingLevel().
(WKPreferencesGetFontSmoothingLevel):
Get the font smoothing level from WebPreferences, and translate it to a
WKFontSmoothingLevel.

  • UIProcess/API/C/WKPreferencesPrivate.h: Added.

Declare the font smoothing levels, and declare functions to get and set
the level.

  • UIProcess/WebPreferences.cpp:

(WebKit::WebPreferences::setFontSmoothingLevel):
Set fontSmoothingLevel and call update().
(WebKit::WebPreferences::fontSmoothingLevel):
Return the level.

  • UIProcess/WebPreferences.h:

Declare getter and setter for fontSmoothingLevel.

  • WebKit2.xcodeproj/project.pbxproj:

Add new files to project.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::preferencesDidChange):
Call platformPreferencesDidChange().

  • WebProcess/WebPage/WebPage.h:

Declare platformPreferencesDidChange().

  • WebProcess/WebPage/mac/WebPageMac.mm:

(WebKit::WebPage::platformPreferencesDidChange):
Stubbed.

  • WebProcess/WebPage/qt/WebPageQt.cpp:

(WebKit::WebPage::platformPreferencesDidChange):
Stubbed.

  • WebProcess/WebPage/win/WebPageWin.cpp:

(WebKit::WebPage::platformPreferencesDidChange):
On CG platforms, call wkSetFontSmoothingLevel(). This matches the code
in old WebKit's WebPreferences. Set the font rendering mode to either
normal (CG) or alternative (GDI) based on the font smoothing level. This
matches what was done in old WebKit's WebView.

  • win/WebKit2.vcproj:

Add FontSmoothingLevel.h and WKPreferencesPrivate.{h,cpp} to project.

  • win/WebKit2Generated.make:

Copy WKPreferencesPrivate.h.

WebKitTools:

  • WebKitTestRunner/TestInvocation.cpp:

(WTR::TestInvocation::resetPreferencesToConsistentValues):
Set the font smoothing level to
kWKFontSmoothingLevelNoSubpixelAntiAliasing to match DRT.

Location:
trunk
Files:
3 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r64879 r64888  
     12010-08-05  Jon Honeycutt  <jhoneycutt@apple.com>
     2
     3        WebKitTestRunner needs to be able to set the font smoothing type
     4        https://bugs.webkit.org/show_bug.cgi?id=43406
     5
     6        Reviewed by Adam Roben.
     7
     8        * Shared/FontSmoothingLevel.h: Added.
     9        (WebKit::):
     10
     11        * Shared/WebPreferencesStore.cpp:
     12        (WebKit::WebPreferencesStore::WebPreferencesStore):
     13        Initialize fontSmoothingLevel.
     14        (WebKit::WebPreferencesStore::swap):
     15        Copy fontSmoothingLevel.
     16
     17        * Shared/WebPreferencesStore.h:
     18        (WebKit::WebPreferencesStore::encode):
     19        Encode fontSmoothingLevel.
     20        (WebKit::WebPreferencesStore::decode):
     21        Decode it.
     22
     23        * UIProcess/API/C/WKPreferencesPrivate.cpp: Added.
     24        (WKPreferencesSetFontSmoothingLevel):
     25        Get the font smoothing level from the WKFontSmoothingLevel, and call
     26        WebPreferences::setFontSmoothingLevel().
     27        (WKPreferencesGetFontSmoothingLevel):
     28        Get the font smoothing level from WebPreferences, and translate it to a
     29        WKFontSmoothingLevel.
     30
     31        * UIProcess/API/C/WKPreferencesPrivate.h: Added.
     32        Declare the font smoothing levels, and declare functions to get and set
     33        the level.
     34
     35        * UIProcess/WebPreferences.cpp:
     36        (WebKit::WebPreferences::setFontSmoothingLevel):
     37        Set fontSmoothingLevel and call update().
     38        (WebKit::WebPreferences::fontSmoothingLevel):
     39        Return the level.
     40
     41        * UIProcess/WebPreferences.h:
     42        Declare getter and setter for fontSmoothingLevel.
     43
     44        * WebKit2.xcodeproj/project.pbxproj:
     45        Add new files to project.
     46
     47        * WebProcess/WebPage/WebPage.cpp:
     48        (WebKit::WebPage::preferencesDidChange):
     49        Call platformPreferencesDidChange().
     50
     51        * WebProcess/WebPage/WebPage.h:
     52        Declare platformPreferencesDidChange().
     53
     54        * WebProcess/WebPage/mac/WebPageMac.mm:
     55        (WebKit::WebPage::platformPreferencesDidChange):
     56        Stubbed.
     57
     58        * WebProcess/WebPage/qt/WebPageQt.cpp:
     59        (WebKit::WebPage::platformPreferencesDidChange):
     60        Stubbed.
     61
     62        * WebProcess/WebPage/win/WebPageWin.cpp:
     63        (WebKit::WebPage::platformPreferencesDidChange):
     64        On CG platforms, call wkSetFontSmoothingLevel(). This matches the code
     65        in old WebKit's WebPreferences. Set the font rendering mode to either
     66        normal (CG) or alternative (GDI) based on the font smoothing level. This
     67        matches what was done in old WebKit's WebView.
     68
     69        * win/WebKit2.vcproj:
     70        Add FontSmoothingLevel.h and WKPreferencesPrivate.{h,cpp} to project.
     71
     72        * win/WebKit2Generated.make:
     73        Copy WKPreferencesPrivate.h.
     74
    1752010-08-06  Anders Carlsson  <andersca@apple.com>
    276
  • trunk/WebKit2/Shared/WebPreferencesStore.cpp

    r64661 r64888  
    2626#include "WebPreferencesStore.h"
    2727
     28#include "FontSmoothingLevel.h"
     29
    2830namespace WebKit {
    2931
     
    3436    , offlineWebApplicationCacheEnabled(false)
    3537    , localStorageEnabled(true)
     38    , fontSmoothingLevel(FontSmoothingLevelMedium)
    3639    , minimumFontSize(1)
    3740    , minimumLogicalFontSize(9)
     
    5457    offlineWebApplicationCacheEnabled = other.offlineWebApplicationCacheEnabled;
    5558    localStorageEnabled = other.localStorageEnabled;
     59    fontSmoothingLevel = other.fontSmoothingLevel;
    5660    minimumFontSize = other.minimumFontSize;
    5761    minimumLogicalFontSize = other.minimumLogicalFontSize;
     
    8185    std::swap(offlineWebApplicationCacheEnabled, other.offlineWebApplicationCacheEnabled);
    8286    std::swap(localStorageEnabled, other.localStorageEnabled);
     87    std::swap(fontSmoothingLevel, other.fontSmoothingLevel);
    8388    std::swap(minimumFontSize, other.minimumFontSize);
    8489    std::swap(minimumLogicalFontSize, other.minimumLogicalFontSize);
  • trunk/WebKit2/Shared/WebPreferencesStore.h

    r64877 r64888  
    4747        encoder->encode(offlineWebApplicationCacheEnabled);
    4848        encoder->encode(localStorageEnabled);
     49        encoder->encode(fontSmoothingLevel);
    4950        encoder->encode(minimumFontSize);
    5051        encoder->encode(minimumLogicalFontSize);
     
    7071            return false;
    7172        if (!decoder->decode(s.localStorageEnabled))
     73            return false;
     74        if (!decoder->decode(s.fontSmoothingLevel))
    7275            return false;
    7376        if (!decoder->decode(s.minimumFontSize))
     
    100103    bool localStorageEnabled;
    101104
     105    uint32_t fontSmoothingLevel;
     106
    102107    uint32_t minimumFontSize;
    103108    uint32_t minimumLogicalFontSize;
  • trunk/WebKit2/UIProcess/WebPreferences.cpp

    r63682 r64888  
    109109}
    110110
     111void WebPreferences::setFontSmoothingLevel(FontSmoothingLevel level)
     112{
     113    m_store.fontSmoothingLevel = level;
     114    update();
     115}
     116
     117FontSmoothingLevel WebPreferences::fontSmoothingLevel() const
     118{
     119    return static_cast<FontSmoothingLevel>(m_store.fontSmoothingLevel);
     120}
     121
    111122} // namespace WebKit
     123
  • trunk/WebKit2/UIProcess/WebPreferences.h

    r64386 r64888  
    2828
    2929#include "APIObject.h"
     30#include "FontSmoothingLevel.h"
    3031#include "WebPreferencesStore.h"
    3132#include <wtf/HashSet.h>
     
    7071    bool localStorageEnabled() const;
    7172
     73    void setFontSmoothingLevel(FontSmoothingLevel);
     74    FontSmoothingLevel fontSmoothingLevel() const;
     75
    7276private:
    7377    WebPreferences();
  • trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r64867 r64888  
    100100                5DAD729C116FF86200EE5396 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; };
    101101                6D8A91A611F0EFD100DD01FE /* com.apple.WebProcess.sb in Resources */ = {isa = PBXBuildFile; fileRef = 6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb */; };
     102                762B748D120BC75C00819339 /* WKPreferencesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 762B7484120BBA2D00819339 /* WKPreferencesPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
     103                762B74AF120BC94F00819339 /* WKPreferencesPrivate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 762B749D120BC8EA00819339 /* WKPreferencesPrivate.cpp */; };
    102104                8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
    103105                8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; };
     
    427429                5DAD73F1116FF90C00EE5396 /* BaseTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = BaseTarget.xcconfig; sourceTree = "<group>"; };
    428430                6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = com.apple.WebProcess.sb; path = WebProcess/com.apple.WebProcess.sb; sourceTree = "<group>"; };
     431                762B7481120BBA0100819339 /* FontSmoothingLevel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontSmoothingLevel.h; sourceTree = "<group>"; };
     432                762B7484120BBA2D00819339 /* WKPreferencesPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPreferencesPrivate.h; sourceTree = "<group>"; };
     433                762B749D120BC8EA00819339 /* WKPreferencesPrivate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKPreferencesPrivate.cpp; sourceTree = "<group>"; };
    429434                8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
    430435                8DC2EF5B0486A6940098B216 /* WebKit2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WebKit2.framework; sourceTree = BUILT_PRODUCTS_DIR; };
     
    823828                                0FB659221208B4DB0044816C /* DrawingAreaBase.h */,
    824829                                1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */,
     830                                762B7481120BBA0100819339 /* FontSmoothingLevel.h */,
    825831                                BC64696D11DBE603006455B0 /* ImmutableArray.cpp */,
    826832                                BC64696E11DBE603006455B0 /* ImmutableArray.h */,
     
    10551061                                BCD597CF112B56AC00EC8C23 /* WKPreferences.cpp */,
    10561062                                BCD597CE112B56AC00EC8C23 /* WKPreferences.h */,
     1063                                762B749D120BC8EA00819339 /* WKPreferencesPrivate.cpp */,
     1064                                762B7484120BBA2D00819339 /* WKPreferencesPrivate.h */,
    10571065                                BC20EBAF116EEB0800094A50 /* WKString.cpp */,
    10581066                                BC20EBAE116EEB0800094A50 /* WKString.h */,
     
    14001408                                BC177465118B9FF4007D9E9A /* WKPagePrivate.h in Headers */,
    14011409                                BCD597D0112B56AC00EC8C23 /* WKPreferences.h in Headers */,
     1410                                762B748D120BC75C00819339 /* WKPreferencesPrivate.h in Headers */,
    14021411                                BC8A501511765F5600757573 /* WKRetainPtr.h in Headers */,
    14031412                                BC20EBB0116EEB0800094A50 /* WKString.h in Headers */,
     
    16221631                                BCEE98CC1133174C006BCC24 /* WKPageNamespace.cpp in Sources */,
    16231632                                BCD597D1112B56AC00EC8C23 /* WKPreferences.cpp in Sources */,
     1633                                762B74AF120BC94F00819339 /* WKPreferencesPrivate.cpp in Sources */,
    16241634                                BC20EBB1116EEB0800094A50 /* WKString.cpp in Sources */,
    16251635                                BC20EC07116EF7FF00094A50 /* WKStringCF.cpp in Sources */,
  • trunk/WebKit2/WebProcess/WebPage/WebPage.cpp

    r64877 r64888  
    454454    m_page->settings()->setOfflineWebApplicationCacheEnabled(store.offlineWebApplicationCacheEnabled);
    455455    m_page->settings()->setLocalStorageEnabled(store.localStorageEnabled);
     456
     457    platformPreferencesDidChange(store);
    456458}
    457459
  • trunk/WebKit2/WebProcess/WebPage/WebPage.h

    r64877 r64888  
    149149    void getRenderTreeExternalRepresentation(uint64_t callbackID);
    150150    void preferencesDidChange(const WebPreferencesStore&);
     151    void platformPreferencesDidChange(const WebPreferencesStore&);
    151152    void didReceivePolicyDecision(WebFrame*, uint64_t listenerID, WebCore::PolicyAction policyAction);
    152153   
  • trunk/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm

    r64086 r64888  
    175175}
    176176
     177void WebPage::platformPreferencesDidChange(const WebPreferencesStore&)
     178{
     179}
     180
    177181} // namespace WebKit
  • trunk/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp

    r62639 r64888  
    201201    return mapKey ? keyPressCommandsMap->get(mapKey) : 0;
    202202}
    203    
     203
     204void WebPage::platformPreferencesDidChange(const WebPreferencesStore&)
     205{
     206}
     207
    204208} // namespace WebKit
  • trunk/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp

    r57707 r64888  
    2626#include "WebPage.h"
    2727
     28#include "FontSmoothingLevel.h"
     29#include "WebPreferencesStore.h"
    2830#include <WebCore/FontRenderingMode.h>
    2931#include <WebCore/KeyboardEvent.h>
     
    3133#include <WebCore/PlatformKeyboardEvent.h>
    3234#include <WebCore/Settings.h>
     35#include <WebKitSystemInterface/WebKitSystemInterface.h>
    3336#include <WinUser.h>
    3437
     
    162165}
    163166
     167void WebPage::platformPreferencesDidChange(const WebPreferencesStore& store)
     168{
     169#if PLATFORM(CG)
     170    FontSmoothingLevel adjustedLevel = static_cast<FontSmoothingLevel>(store.fontSmoothingLevel);
     171    if (adjustedLevel == FontSmoothingLevelWindows)
     172        adjustedLevel = FontSmoothingLevelMedium;
     173    wkSetFontSmoothingLevel(adjustedLevel);
     174#endif
     175
     176    m_page->settings()->setFontRenderingMode(store.fontSmoothingLevel == FontSmoothingLevelWindows ? AlternateRenderingMode : NormalRenderingMode);
     177}
     178
    164179} // namespace WebKit
  • trunk/WebKit2/win/WebKit2.vcproj

    r64862 r64888  
    406406                        </File>
    407407                        <File
     408                                RelativePath="..\Shared\FontSmoothingLevel.h"
     409                                >
     410                        </File>
     411                        <File
    408412                                RelativePath="..\Shared\ImmutableArray.cpp"
    409413                                >
     
    12611265                                        <File
    12621266                                                RelativePath="..\UIProcess\API\C\WKPreferences.h"
     1267                                                >
     1268                                        </File>
     1269                                        <File
     1270                                                RelativePath="..\UIProcess\API\C\WKPreferencesPrivate.cpp"
     1271                                                >
     1272                                        </File>
     1273                                        <File
     1274                                                RelativePath="..\UIProcess\API\C\WKPreferencesPrivate.h"
    12631275                                                >
    12641276                                        </File>
  • trunk/WebKit2/win/WebKit2Generated.make

    r64788 r64888  
    1717    xcopy /y /d "..\UIProcess\API\C\WKPageNamespace.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
    1818    xcopy /y /d "..\UIProcess\API\C\WKPreferences.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     19    xcopy /y /d "..\UIProcess\API\C\WKPreferencesPrivate.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
    1920    xcopy /y /d "..\UIProcess\API\C\WKString.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
    2021    xcopy /y /d "..\UIProcess\API\C\WKType.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
  • trunk/WebKitTools/ChangeLog

    r64878 r64888  
     12010-08-05  Jon Honeycutt  <jhoneycutt@apple.com>
     2
     3        WebKitTestRunner needs to be able to set the font smoothing type
     4        https://bugs.webkit.org/show_bug.cgi?id=43406
     5
     6        Reviewed by Adam Roben.
     7
     8        * WebKitTestRunner/TestInvocation.cpp:
     9        (WTR::TestInvocation::resetPreferencesToConsistentValues):
     10        Set the font smoothing level to
     11        kWKFontSmoothingLevelNoSubpixelAntiAliasing to match DRT.
     12
    1132010-08-06  Jon Honeycutt  <jhoneycutt@apple.com>
    214
  • trunk/WebKitTools/WebKitTestRunner/TestInvocation.cpp

    r64576 r64888  
    3030#include "TestController.h"
    3131#include <WebKit2/WKContextPrivate.h>
     32#include <WebKit2/WKPreferencesPrivate.h>
    3233#include <WebKit2/WKRetainPtr.h>
    3334#include <wtf/RetainPtr.h>
     
    7172    WKPreferencesRef preferences = WKContextGetPreferences(TestController::shared().context());
    7273    WKPreferencesSetOfflineWebApplicationCacheEnabled(preferences, true);
     74    WKPreferencesSetFontSmoothingLevel(preferences, kWKFontSmoothingLevelNoSubpixelAntiAliasing);
    7375}
    7476
Note: See TracChangeset for help on using the changeset viewer.