Changeset 130585 in webkit


Ignore:
Timestamp:
Oct 6, 2012 11:37:38 AM (12 years ago)
Author:
mitz@apple.com
Message:

Source/WebCore: WebCore part of <rdar://problem/12446507> [mac] WebKit clients cannot change the behavior of text-rendering: auto
https://bugs.webkit.org/show_bug.cgi?id=98601

Reviewed by Darin Adler.

  • WebCore.exp.in: Exported Font::setDefaultTypesettingFeatures().
  • platform/graphics/Font.cpp:

(WebCore::Font::s_defaultTypesettingFeatures): Defined this static.
(WebCore::Font::setDefaultTypesettingFeatures): Added this setter.
(WebCore::Font::defaultTypesettingFeatures): Added this getter.

  • platform/graphics/Font.h:

(WebCore::Font::typesettingFeatures): Changed to use the value of the new static member
s_defaultTypesettingFeatures, rather than 0, if text-redering is set to auto.

Source/WebKit/mac: WebKit/mac part of <rdar://problem/12446507> [mac] WebKit clients cannot change the behavior of text-rendering: auto
https://bugs.webkit.org/show_bug.cgi?id=98601

Reviewed by Darin Adler.

  • WebView/WebView.mm:

(+[WebView initialize]): Added a call to Font::setDefaultTypesettingFeatures() to enable
kerning and ligatures if the WebKitKerningAndLigaturesEnabledByDefault user default key has
the value YES.

Source/WebKit2: WebKit2 part of <rdar://problem/12446507> [mac] WebKit clients cannot change the behavior of text-rendering: auto
https://bugs.webkit.org/show_bug.cgi?id=98601

Reviewed by Darin Adler.

  • Shared/WebProcessCreationParameters.cpp:

(WebKit::WebProcessCreationParameters::WebProcessCreationParameters): Added initializer for
to shouldEnableKerningAndLigaturesByDefault. The initial value is false.
(WebKit::WebProcessCreationParameters::encode): Added encoding of
shouldEnableKerningAndLigaturesByDefault.
(WebKit::WebProcessCreationParameters::decode): Added decoding of
shouldEnableKerningAndLigaturesByDefault.

  • Shared/WebProcessCreationParameters.h:

(WebProcessCreationParameters): Added shouldEnableKerningAndLigaturesByDefault boolean
member variable.

  • UIProcess/mac/WebContextMac.mm:

(WebKit::WebContext::platformInitializeWebProcess): Changed to set
shouldEnableKerningAndLigaturesByDefault in the process creation parameters according to
the value of the WebKitKerningAndLigaturesEnabledByDefault user defaults key.

  • WebProcess/mac/WebProcessMac.mm:

(WebKit::WebProcess::platformInitializeWebProcess): Added a call to
Font::setDefaultTypesettingFeatures() to enable kerning and ligatures if requested in the
process creation parameters.

Location:
trunk/Source
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r130584 r130585  
     12012-10-06  Dan Bernstein  <mitz@apple.com>
     2
     3        WebCore part of <rdar://problem/12446507> [mac] WebKit clients cannot change the behavior of text-rendering: auto
     4        https://bugs.webkit.org/show_bug.cgi?id=98601
     5
     6        Reviewed by Darin Adler.
     7
     8        * WebCore.exp.in: Exported Font::setDefaultTypesettingFeatures().
     9        * platform/graphics/Font.cpp:
     10        (WebCore::Font::s_defaultTypesettingFeatures): Defined this static.
     11        (WebCore::Font::setDefaultTypesettingFeatures): Added this setter.
     12        (WebCore::Font::defaultTypesettingFeatures): Added this getter.
     13        * platform/graphics/Font.h:
     14        (WebCore::Font::typesettingFeatures): Changed to use the value of the new static member
     15        s_defaultTypesettingFeatures, rather than 0, if text-redering is set to auto.
     16
    1172012-10-04  Geoffrey Garen  <ggaren@apple.com>
    218
  • trunk/Source/WebCore/WebCore.exp.in

    r130567 r130585  
    648648__ZN7WebCore4Font18shouldUseSmoothingEv
    649649__ZN7WebCore4Font21setShouldUseSmoothingEb
     650__ZN7WebCore4Font29setDefaultTypesettingFeaturesEj
    650651__ZN7WebCore4FontC1ERKNS_16FontPlatformDataEbNS_17FontSmoothingModeE
    651652__ZN7WebCore4FontC1Ev
  • trunk/Source/WebCore/platform/graphics/Font.cpp

    r130082 r130585  
    6565Font::CodePath Font::s_codePath = Auto;
    6666
     67TypesettingFeatures Font::s_defaultTypesettingFeatures = 0;
     68
    6769// ============================================================================================
    6870// Font Implementation (Cross-Platform Portion)
     
    288290{
    289291    return s_codePath;
     292}
     293
     294void Font::setDefaultTypesettingFeatures(TypesettingFeatures typesettingFeatures)
     295{
     296    s_defaultTypesettingFeatures = typesettingFeatures;
     297}
     298
     299TypesettingFeatures Font::defaultTypesettingFeatures()
     300{
     301    return s_defaultTypesettingFeatures;
    290302}
    291303
  • trunk/Source/WebCore/platform/graphics/Font.h

    r130160 r130585  
    125125    {
    126126        TextRenderingMode textRenderingMode = m_fontDescription.textRenderingMode();
    127         TypesettingFeatures features = textRenderingMode == OptimizeLegibility || textRenderingMode == GeometricPrecision ? Kerning | Ligatures : 0;
     127        TypesettingFeatures features = s_defaultTypesettingFeatures;
     128
     129        switch(textRenderingMode) {
     130        case AutoTextRendering:
     131            break;
     132        case OptimizeSpeed:
     133            features &= ~(Kerning | Ligatures);
     134            break;
     135        case GeometricPrecision:
     136        case OptimizeLegibility:
     137            features |= Kerning | Ligatures;
     138            break;
     139        }
    128140
    129141        switch (m_fontDescription.kerning()) {
     
    235247    static CodePath s_codePath;
    236248
     249    static void setDefaultTypesettingFeatures(TypesettingFeatures);
     250    static TypesettingFeatures defaultTypesettingFeatures();
     251
    237252    static const uint8_t s_roundingHackCharacterTable[256];
    238253    static bool isRoundingHackCharacter(UChar32 c)
     
    273288    void initFormatForTextLayout(QTextLayout*) const;
    274289#endif
     290
     291    static TypesettingFeatures s_defaultTypesettingFeatures;
    275292
    276293    FontDescription m_fontDescription;
  • trunk/Source/WebKit/mac/ChangeLog

    r130567 r130585  
     12012-10-06  Dan Bernstein  <mitz@apple.com>
     2
     3        WebKit/mac part of <rdar://problem/12446507> [mac] WebKit clients cannot change the behavior of text-rendering: auto
     4        https://bugs.webkit.org/show_bug.cgi?id=98601
     5
     6        Reviewed by Darin Adler.
     7
     8        * WebView/WebView.mm:
     9        (+[WebView initialize]): Added a call to Font::setDefaultTypesettingFeatures() to enable
     10        kerning and ligatures if the WebKitKerningAndLigaturesEnabledByDefault user default key has
     11        the value YES.
     12
    1132012-10-05  Sheriff Bot  <webkit.review.bot@gmail.com>
    214
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r130523 r130585  
    31173117    grammarCheckingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebGrammarCheckingEnabled];
    31183118
     3119    Font::setDefaultTypesettingFeatures([[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitKerningAndLigaturesEnabledByDefault"] ? Kerning | Ligatures : 0);
     3120
    31193121#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
    31203122    automaticQuoteSubstitutionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticQuoteSubstitutionEnabled];
  • trunk/Source/WebKit2/ChangeLog

    r130568 r130585  
     12012-10-06  Dan Bernstein  <mitz@apple.com>
     2
     3        WebKit2 part of <rdar://problem/12446507> [mac] WebKit clients cannot change the behavior of text-rendering: auto
     4        https://bugs.webkit.org/show_bug.cgi?id=98601
     5
     6        Reviewed by Darin Adler.
     7
     8        * Shared/WebProcessCreationParameters.cpp:
     9        (WebKit::WebProcessCreationParameters::WebProcessCreationParameters): Added initializer for
     10        to shouldEnableKerningAndLigaturesByDefault. The initial value is false.
     11        (WebKit::WebProcessCreationParameters::encode): Added encoding of
     12        shouldEnableKerningAndLigaturesByDefault.
     13        (WebKit::WebProcessCreationParameters::decode): Added decoding of
     14        shouldEnableKerningAndLigaturesByDefault.
     15        * Shared/WebProcessCreationParameters.h:
     16        (WebProcessCreationParameters): Added shouldEnableKerningAndLigaturesByDefault boolean
     17        member variable.
     18        * UIProcess/mac/WebContextMac.mm:
     19        (WebKit::WebContext::platformInitializeWebProcess): Changed to set
     20        shouldEnableKerningAndLigaturesByDefault in the process creation parameters according to
     21        the value of the WebKitKerningAndLigaturesEnabledByDefault user defaults key.
     22        * WebProcess/mac/WebProcessMac.mm:
     23        (WebKit::WebProcess::platformInitializeWebProcess): Added a call to
     24        Font::setDefaultTypesettingFeatures() to enable kerning and ligatures if requested in the
     25        process creation parameters.
     26
    1272012-10-05  Sudarsana Nagineni  <sudarsana.nagineni@intel.com>
    228
  • trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp

    r130347 r130585  
    4343    , nsURLCacheDiskCapacity(0)
    4444    , shouldForceScreenFontSubstitution(false)
     45    , shouldEnableKerningAndLigaturesByDefault(false)
    4546#elif PLATFORM(WIN)
    4647    , shouldPaintNativeControls(false)
     
    9192    encoder->encode(uiProcessBundleResourcePathExtensionHandle);
    9293    encoder->encode(shouldForceScreenFontSubstitution);
     94    encoder->encode(shouldEnableKerningAndLigaturesByDefault);
    9395#elif PLATFORM(WIN)
    9496    encoder->encode(shouldPaintNativeControls);
     
    194196    if (!decoder->decode(parameters.shouldForceScreenFontSubstitution))
    195197        return false;
     198    if (!decoder->decode(parameters.shouldEnableKerningAndLigaturesByDefault))
     199        return false;
    196200#elif PLATFORM(WIN)
    197201    if (!decoder->decode(parameters.shouldPaintNativeControls))
  • trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h

    r130347 r130585  
    113113
    114114    bool shouldForceScreenFontSubstitution;
     115    bool shouldEnableKerningAndLigaturesByDefault;
    115116#elif PLATFORM(WIN)
    116117    String cfURLCachePath;
  • trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm

    r130347 r130585  
    101101    parameters.shouldForceScreenFontSubstitution = [[NSUserDefaults standardUserDefaults] boolForKey:@"NSFontDefaultScreenFontSubstitutionEnabled"];
    102102#endif
     103    parameters.shouldEnableKerningAndLigaturesByDefault = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitKerningAndLigaturesEnabledByDefault"];
    103104
    104105#if USE(ACCELERATED_COMPOSITING) && HAVE(HOSTED_CORE_ANIMATION)
  • trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm

    r129593 r130585  
    3434#import "WebProcessProxyMessages.h"
    3535#import <WebCore/FileSystem.h>
     36#import <WebCore/Font.h>
    3637#import <WebCore/LocalizedStrings.h>
    3738#import <WebCore/MemoryCache.h>
     
    273274
    274275    m_shouldForceScreenFontSubstitution = parameters.shouldForceScreenFontSubstitution;
     276    Font::setDefaultTypesettingFeatures(parameters.shouldEnableKerningAndLigaturesByDefault ? Kerning | Ligatures : 0);
    275277
    276278    m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port();
Note: See TracChangeset for help on using the changeset viewer.