Title: [130585] trunk/Source
Revision
130585
Author
[email protected]
Date
2012-10-06 11:37:38 -0700 (Sat, 06 Oct 2012)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (130584 => 130585)


--- trunk/Source/WebCore/ChangeLog	2012-10-06 18:27:56 UTC (rev 130584)
+++ trunk/Source/WebCore/ChangeLog	2012-10-06 18:37:38 UTC (rev 130585)
@@ -1,3 +1,19 @@
+2012-10-06  Dan Bernstein  <[email protected]>
+
+        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.
+
 2012-10-04  Geoffrey Garen  <[email protected]>
 
         If Node X is reachable from _javascript_, all Nodes in the same tree should be kept alive

Modified: trunk/Source/WebCore/WebCore.exp.in (130584 => 130585)


--- trunk/Source/WebCore/WebCore.exp.in	2012-10-06 18:27:56 UTC (rev 130584)
+++ trunk/Source/WebCore/WebCore.exp.in	2012-10-06 18:37:38 UTC (rev 130585)
@@ -647,6 +647,7 @@
 __ZN7WebCore4Font11setCodePathENS0_8CodePathE
 __ZN7WebCore4Font18shouldUseSmoothingEv
 __ZN7WebCore4Font21setShouldUseSmoothingEb
+__ZN7WebCore4Font29setDefaultTypesettingFeaturesEj
 __ZN7WebCore4FontC1ERKNS_16FontPlatformDataEbNS_17FontSmoothingModeE
 __ZN7WebCore4FontC1Ev
 __ZN7WebCore4FontaSERKS0_

Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (130584 => 130585)


--- trunk/Source/WebCore/platform/graphics/Font.cpp	2012-10-06 18:27:56 UTC (rev 130584)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp	2012-10-06 18:37:38 UTC (rev 130585)
@@ -64,6 +64,8 @@
 
 Font::CodePath Font::s_codePath = Auto;
 
+TypesettingFeatures Font::s_defaultTypesettingFeatures = 0;
+
 // ============================================================================================
 // Font Implementation (Cross-Platform Portion)
 // ============================================================================================
@@ -289,6 +291,16 @@
     return s_codePath;
 }
 
+void Font::setDefaultTypesettingFeatures(TypesettingFeatures typesettingFeatures)
+{
+    s_defaultTypesettingFeatures = typesettingFeatures;
+}
+
+TypesettingFeatures Font::defaultTypesettingFeatures()
+{
+    return s_defaultTypesettingFeatures;
+}
+
 Font::CodePath Font::codePath(const TextRun& run) const
 {
     if (s_codePath != Auto)

Modified: trunk/Source/WebCore/platform/graphics/Font.h (130584 => 130585)


--- trunk/Source/WebCore/platform/graphics/Font.h	2012-10-06 18:27:56 UTC (rev 130584)
+++ trunk/Source/WebCore/platform/graphics/Font.h	2012-10-06 18:37:38 UTC (rev 130585)
@@ -124,8 +124,20 @@
     TypesettingFeatures typesettingFeatures() const
     {
         TextRenderingMode textRenderingMode = m_fontDescription.textRenderingMode();
-        TypesettingFeatures features = textRenderingMode == OptimizeLegibility || textRenderingMode == GeometricPrecision ? Kerning | Ligatures : 0;
+        TypesettingFeatures features = s_defaultTypesettingFeatures;
 
+        switch(textRenderingMode) {
+        case AutoTextRendering:
+            break;
+        case OptimizeSpeed:
+            features &= ~(Kerning | Ligatures);
+            break;
+        case GeometricPrecision:
+        case OptimizeLegibility:
+            features |= Kerning | Ligatures;
+            break;
+        }
+
         switch (m_fontDescription.kerning()) {
         case FontDescription::NoneKerning:
             features &= ~Kerning;
@@ -234,6 +246,9 @@
     static CodePath codePath();
     static CodePath s_codePath;
 
+    static void setDefaultTypesettingFeatures(TypesettingFeatures);
+    static TypesettingFeatures defaultTypesettingFeatures();
+
     static const uint8_t s_roundingHackCharacterTable[256];
     static bool isRoundingHackCharacter(UChar32 c)
     {
@@ -273,6 +288,8 @@
     void initFormatForTextLayout(QTextLayout*) const;
 #endif
 
+    static TypesettingFeatures s_defaultTypesettingFeatures;
+
     FontDescription m_fontDescription;
     mutable RefPtr<FontFallbackList> m_fontFallbackList;
     short m_letterSpacing;

Modified: trunk/Source/WebKit/mac/ChangeLog (130584 => 130585)


--- trunk/Source/WebKit/mac/ChangeLog	2012-10-06 18:27:56 UTC (rev 130584)
+++ trunk/Source/WebKit/mac/ChangeLog	2012-10-06 18:37:38 UTC (rev 130585)
@@ -1,3 +1,15 @@
+2012-10-06  Dan Bernstein  <[email protected]>
+
+        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.
+
 2012-10-05  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r130556 and r130564.

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (130584 => 130585)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2012-10-06 18:27:56 UTC (rev 130584)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2012-10-06 18:37:38 UTC (rev 130585)
@@ -3116,6 +3116,8 @@
     continuousSpellCheckingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebContinuousSpellCheckingEnabled];
     grammarCheckingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebGrammarCheckingEnabled];
 
+    Font::setDefaultTypesettingFeatures([[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitKerningAndLigaturesEnabledByDefault"] ? Kerning | Ligatures : 0);
+
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
     automaticQuoteSubstitutionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticQuoteSubstitutionEnabled];
     automaticLinkDetectionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticLinkDetectionEnabled];

Modified: trunk/Source/WebKit2/ChangeLog (130584 => 130585)


--- trunk/Source/WebKit2/ChangeLog	2012-10-06 18:27:56 UTC (rev 130584)
+++ trunk/Source/WebKit2/ChangeLog	2012-10-06 18:37:38 UTC (rev 130585)
@@ -1,3 +1,29 @@
+2012-10-06  Dan Bernstein  <[email protected]>
+
+        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.
+
 2012-10-05  Sudarsana Nagineni  <[email protected]>
 
         [WK2][WTR] WebKitTestRunner needs testRunner.setSerializeHTTPLoads

Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp (130584 => 130585)


--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp	2012-10-06 18:27:56 UTC (rev 130584)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp	2012-10-06 18:37:38 UTC (rev 130585)
@@ -42,6 +42,7 @@
     , nsURLCacheMemoryCapacity(0)
     , nsURLCacheDiskCapacity(0)
     , shouldForceScreenFontSubstitution(false)
+    , shouldEnableKerningAndLigaturesByDefault(false)
 #elif PLATFORM(WIN)
     , shouldPaintNativeControls(false)
 #endif
@@ -90,6 +91,7 @@
     encoder->encode(uiProcessBundleResourcePath);
     encoder->encode(uiProcessBundleResourcePathExtensionHandle);
     encoder->encode(shouldForceScreenFontSubstitution);
+    encoder->encode(shouldEnableKerningAndLigaturesByDefault);
 #elif PLATFORM(WIN)
     encoder->encode(shouldPaintNativeControls);
     encoder->encode(cfURLCachePath);
@@ -193,6 +195,8 @@
         return false;
     if (!decoder->decode(parameters.shouldForceScreenFontSubstitution))
         return false;
+    if (!decoder->decode(parameters.shouldEnableKerningAndLigaturesByDefault))
+        return false;
 #elif PLATFORM(WIN)
     if (!decoder->decode(parameters.shouldPaintNativeControls))
         return false;

Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h (130584 => 130585)


--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h	2012-10-06 18:27:56 UTC (rev 130584)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h	2012-10-06 18:37:38 UTC (rev 130585)
@@ -112,6 +112,7 @@
     SandboxExtension::Handle uiProcessBundleResourcePathExtensionHandle;
 
     bool shouldForceScreenFontSubstitution;
+    bool shouldEnableKerningAndLigaturesByDefault;
 #elif PLATFORM(WIN)
     String cfURLCachePath;
     uint64_t cfURLCacheDiskCapacity;

Modified: trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm (130584 => 130585)


--- trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm	2012-10-06 18:27:56 UTC (rev 130584)
+++ trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm	2012-10-06 18:37:38 UTC (rev 130585)
@@ -100,6 +100,7 @@
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
     parameters.shouldForceScreenFontSubstitution = [[NSUserDefaults standardUserDefaults] boolForKey:@"NSFontDefaultScreenFontSubstitutionEnabled"];
 #endif
+    parameters.shouldEnableKerningAndLigaturesByDefault = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitKerningAndLigaturesEnabledByDefault"];
 
 #if USE(ACCELERATED_COMPOSITING) && HAVE(HOSTED_CORE_ANIMATION)
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070

Modified: trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm (130584 => 130585)


--- trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm	2012-10-06 18:27:56 UTC (rev 130584)
+++ trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm	2012-10-06 18:37:38 UTC (rev 130585)
@@ -33,6 +33,7 @@
 #import "WebProcessCreationParameters.h"
 #import "WebProcessProxyMessages.h"
 #import <WebCore/FileSystem.h>
+#import <WebCore/Font.h>
 #import <WebCore/LocalizedStrings.h>
 #import <WebCore/MemoryCache.h>
 #import <WebCore/PageCache.h>
@@ -272,6 +273,7 @@
     }
 
     m_shouldForceScreenFontSubstitution = parameters.shouldForceScreenFontSubstitution;
+    Font::setDefaultTypesettingFeatures(parameters.shouldEnableKerningAndLigaturesByDefault ? Kerning | Ligatures : 0);
 
     m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port();
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to