Title: [191014] trunk/Source
Revision
191014
Author
mmaxfi...@apple.com
Date
2015-10-13 16:40:38 -0700 (Tue, 13 Oct 2015)

Log Message

Split TypesettingFeatures into kerning and ligatures bools
https://bugs.webkit.org/show_bug.cgi?id=150074

Reviewed by Simon Fraser.

Source/WebCore:

Our TypesettingFeatures type represents whether kerning or ligatures are enabled
when laying out text. However, now that I have implemented font-feature-settings
and font-variant-*, this type is wildly inadequate. There are now multiple kinds
of ligatures, and many other features which are neither kerning nor ligatures.
Adding tons of information to this type doesn't make sense because 1) We already
have a FontVariantSettings struct which contains this information, and 2) None
of the users of TypesettingFeatures care about most of these new features.

In this new world of font features, the font-kerning property isn't changing.
Therefore, all the code which relies only on the Kerning value in
TypesettingFeatures doesn't need to change. The places which rely on Ligatures,
however, need to be updated to understand that there are many different kinds
of ligatures.

Indeed, after inspection, all of the places which inspect ligatures are more
interested in a high-level concept of whether or not we can trust some simple
computation. Therefore, we really have two things we care about: Kerning, and
this high-level concept.

This patch is the second step to update our view of the world to include
font-feature-settings and font-variant-*. In particular, this patch simply
splits TypesettingFeatures into two Booleans, one for Kerning, and one for
Ligatures (which has no behavior change). Then, once they are separated, I can
migrate the Ligatures Boolean to take on its new meaning.

This change is purely mechanical.

No new tests because there is no behavior change.

* WebCore.xcodeproj/project.pbxproj:
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator FontCascadeDescription::Kerning):
* platform/graphics/Font.cpp:
(WebCore::Font::applyTransforms):
* platform/graphics/Font.h:
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::FontCascade):
(WebCore::FontCascade::operator=):
(WebCore::FontCascade::update):
(WebCore::FontCascade::drawText):
(WebCore::FontCascade::drawEmphasisMarks):
(WebCore::FontCascade::width):
(WebCore::FontCascade::adjustSelectionRectForText):
(WebCore::FontCascade::offsetForPosition):
(WebCore::FontCascade::setDefaultKerning):
(WebCore::FontCascade::setDefaultLigatures):
(WebCore::FontCascade::codePath):
(WebCore::FontCascade::floatWidthForSimpleText):
(WebCore::FontCascade::setDefaultTypesettingFeatures): Deleted.
(WebCore::FontCascade::defaultTypesettingFeatures): Deleted.
* platform/graphics/FontCascade.h:
(WebCore::FontCascade::enableKerning):
(WebCore::FontCascade::enableLigatures):
(WebCore::FontCascade::computeEnableKerning):
(WebCore::FontCascade::computeEnableLigatures):
(WebCore::FontCascade::typesettingFeatures): Deleted.
(WebCore::FontCascade::computeTypesettingFeatures): Deleted.
* platform/graphics/FontDescription.cpp:
(WebCore::FontCascadeDescription::FontCascadeDescription):
* platform/graphics/FontDescription.h:
(WebCore::FontCascadeDescription::setKerning):
(WebCore::FontCascadeDescription::initialKerning):
* platform/graphics/TypesettingFeatures.h: Removed.
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::WidthIterator):
(WebCore::WidthIterator::applyFontTransforms):
(WebCore::WidthIterator::advanceInternal):
* platform/graphics/WidthIterator.h:
* platform/graphics/cocoa/FontCocoa.mm:
(WebCore::Font::canRenderCombiningCharacterSequence):
* platform/graphics/mac/ComplexTextControllerCoreText.mm:
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
* platform/graphics/mac/SimpleFontDataCoreText.cpp:
(WebCore::Font::getCFStringAttributes):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::setLogicalWidthForTextRun):
* rendering/line/BreakingContext.h:
(WebCore::WordTrailingSpace::width):
* svg/SVGFontData.h:

Source/WebKit/mac:

* WebView/WebView.mm:
(+[WebView initialize]):

Source/WebKit2:

* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::WebProcessCreationParameters):
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (191013 => 191014)


--- trunk/Source/WebCore/ChangeLog	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebCore/ChangeLog	2015-10-13 23:40:38 UTC (rev 191014)
@@ -1,3 +1,91 @@
+2015-10-13  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Split TypesettingFeatures into kerning and ligatures bools
+        https://bugs.webkit.org/show_bug.cgi?id=150074
+
+        Reviewed by Simon Fraser.
+
+        Our TypesettingFeatures type represents whether kerning or ligatures are enabled
+        when laying out text. However, now that I have implemented font-feature-settings
+        and font-variant-*, this type is wildly inadequate. There are now multiple kinds
+        of ligatures, and many other features which are neither kerning nor ligatures.
+        Adding tons of information to this type doesn't make sense because 1) We already
+        have a FontVariantSettings struct which contains this information, and 2) None
+        of the users of TypesettingFeatures care about most of these new features.
+
+        In this new world of font features, the font-kerning property isn't changing.
+        Therefore, all the code which relies only on the Kerning value in
+        TypesettingFeatures doesn't need to change. The places which rely on Ligatures,
+        however, need to be updated to understand that there are many different kinds
+        of ligatures.
+
+        Indeed, after inspection, all of the places which inspect ligatures are more
+        interested in a high-level concept of whether or not we can trust some simple
+        computation. Therefore, we really have two things we care about: Kerning, and
+        this high-level concept.
+
+        This patch is the second step to update our view of the world to include
+        font-feature-settings and font-variant-*. In particular, this patch simply
+        splits TypesettingFeatures into two Booleans, one for Kerning, and one for
+        Ligatures (which has no behavior change). Then, once they are separated, I can
+        migrate the Ligatures Boolean to take on its new meaning.
+
+        This change is purely mechanical.
+
+        No new tests because there is no behavior change.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::operator FontCascadeDescription::Kerning):
+        * platform/graphics/Font.cpp:
+        (WebCore::Font::applyTransforms):
+        * platform/graphics/Font.h:
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::FontCascade::FontCascade):
+        (WebCore::FontCascade::operator=):
+        (WebCore::FontCascade::update):
+        (WebCore::FontCascade::drawText):
+        (WebCore::FontCascade::drawEmphasisMarks):
+        (WebCore::FontCascade::width):
+        (WebCore::FontCascade::adjustSelectionRectForText):
+        (WebCore::FontCascade::offsetForPosition):
+        (WebCore::FontCascade::setDefaultKerning):
+        (WebCore::FontCascade::setDefaultLigatures):
+        (WebCore::FontCascade::codePath):
+        (WebCore::FontCascade::floatWidthForSimpleText):
+        (WebCore::FontCascade::setDefaultTypesettingFeatures): Deleted.
+        (WebCore::FontCascade::defaultTypesettingFeatures): Deleted.
+        * platform/graphics/FontCascade.h:
+        (WebCore::FontCascade::enableKerning):
+        (WebCore::FontCascade::enableLigatures):
+        (WebCore::FontCascade::computeEnableKerning):
+        (WebCore::FontCascade::computeEnableLigatures):
+        (WebCore::FontCascade::typesettingFeatures): Deleted.
+        (WebCore::FontCascade::computeTypesettingFeatures): Deleted.
+        * platform/graphics/FontDescription.cpp:
+        (WebCore::FontCascadeDescription::FontCascadeDescription):
+        * platform/graphics/FontDescription.h:
+        (WebCore::FontCascadeDescription::setKerning):
+        (WebCore::FontCascadeDescription::initialKerning):
+        * platform/graphics/TypesettingFeatures.h: Removed.
+        * platform/graphics/WidthIterator.cpp:
+        (WebCore::WidthIterator::WidthIterator):
+        (WebCore::WidthIterator::applyFontTransforms):
+        (WebCore::WidthIterator::advanceInternal):
+        * platform/graphics/WidthIterator.h:
+        * platform/graphics/cocoa/FontCocoa.mm:
+        (WebCore::Font::canRenderCombiningCharacterSequence):
+        * platform/graphics/mac/ComplexTextControllerCoreText.mm:
+        (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
+        * platform/graphics/mac/SimpleFontDataCoreText.cpp:
+        (WebCore::Font::getCFStringAttributes):
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::setLogicalWidthForTextRun):
+        * rendering/line/BreakingContext.h:
+        (WebCore::WordTrailingSpace::width):
+        * svg/SVGFontData.h:
+
 2015-10-13  Zalan Bujtas  <za...@apple.com>
 
         Anonymous table objects: inline parent box requires inline-table child.

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (191013 => 191014)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-10-13 23:40:38 UTC (rev 191014)
@@ -1422,7 +1422,6 @@
 		37C236101097EE7700EF9F72 /* ComplexTextController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37C2360E1097EE7700EF9F72 /* ComplexTextController.cpp */; };
 		37C236111097EE7700EF9F72 /* ComplexTextController.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C2360F1097EE7700EF9F72 /* ComplexTextController.h */; };
 		37C238221098C84200EF9F72 /* ComplexTextControllerCoreText.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37C238201098C84200EF9F72 /* ComplexTextControllerCoreText.mm */; };
-		37C28A6810F659CC008C7813 /* TypesettingFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C28A6710F659CC008C7813 /* TypesettingFeatures.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		37C61F0112095C87007A3C67 /* AtomicStringKeyedMRUCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C61F0012095C87007A3C67 /* AtomicStringKeyedMRUCache.h */; };
 		37D456FD1A9A50D8003330A1 /* LocalizableStrings.pm in Copy Scripts */ = {isa = PBXBuildFile; fileRef = 37D456FB1A9A50B6003330A1 /* LocalizableStrings.pm */; };
 		37DDCD9413844FD50008B793 /* MIMEHeader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37DDCD9213844FD50008B793 /* MIMEHeader.cpp */; };
@@ -8733,7 +8732,6 @@
 		37C2360E1097EE7700EF9F72 /* ComplexTextController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ComplexTextController.cpp; sourceTree = "<group>"; };
 		37C2360F1097EE7700EF9F72 /* ComplexTextController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ComplexTextController.h; sourceTree = "<group>"; };
 		37C238201098C84200EF9F72 /* ComplexTextControllerCoreText.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ComplexTextControllerCoreText.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
-		37C28A6710F659CC008C7813 /* TypesettingFeatures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypesettingFeatures.h; sourceTree = "<group>"; };
 		37C61F0012095C87007A3C67 /* AtomicStringKeyedMRUCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AtomicStringKeyedMRUCache.h; sourceTree = "<group>"; };
 		37D456FB1A9A50B6003330A1 /* LocalizableStrings.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = LocalizableStrings.pm; sourceTree = "<group>"; };
 		37DDCD9213844FD50008B793 /* MIMEHeader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MIMEHeader.cpp; sourceTree = "<group>"; };
@@ -21467,7 +21465,6 @@
 				CDD1E525167BA56400CE820B /* TextTrackRepresentation.h */,
 				1AF89A411518FDEA00E547B5 /* TiledBacking.h */,
 				BE913D7F181EF8E500DCB09E /* TrackPrivateBase.h */,
-				37C28A6710F659CC008C7813 /* TypesettingFeatures.h */,
 				E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */,
 				BEF29EEA1715DD0900C4B4C9 /* VideoTrackPrivate.h */,
 				1411DCB0164C39A800D49BC1 /* WidthCache.h */,
@@ -27616,7 +27613,6 @@
 				2D232C001A326F02006BF2DB /* TUCallSPI.h in Headers */,
 				C375D7FE16639519006184AB /* TypeAhead.h in Headers */,
 				E46A2B1C17CA65B9000DBCD8 /* TypedElementDescendantIterator.h in Headers */,
-				37C28A6810F659CC008C7813 /* TypesettingFeatures.h in Headers */,
 				93309E1A099E64920056E581 /* TypingCommand.h in Headers */,
 				31DF63591AF194F00078FD91 /* UIColorSPI.h in Headers */,
 				85031B4E0A44EFC700F992E0 /* UIEvent.h in Headers */,

Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (191013 => 191014)


--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2015-10-13 23:40:38 UTC (rev 191014)
@@ -3438,18 +3438,18 @@
     return PE_ALL;
 }
 
-template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontCascadeDescription::Kerning kerning)
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Kerning kerning)
     : CSSValue(PrimitiveClass)
 {
     m_primitiveUnitType = CSS_VALUE_ID;
     switch (kerning) {
-    case FontCascadeDescription::AutoKerning:
+    case Kerning::Auto:
         m_value.valueID = CSSValueAuto;
         return;
-    case FontCascadeDescription::NormalKerning:
+    case Kerning::Normal:
         m_value.valueID = CSSValueNormal;
         return;
-    case FontCascadeDescription::NoneKerning:
+    case Kerning::NoShift:
         m_value.valueID = CSSValueNone;
         return;
     }
@@ -3458,23 +3458,23 @@
     m_value.valueID = CSSValueAuto;
 }
 
-template<> inline CSSPrimitiveValue::operator FontCascadeDescription::Kerning() const
+template<> inline CSSPrimitiveValue::operator Kerning() const
 {
     ASSERT(isValueID());
 
     switch (m_value.valueID) {
     case CSSValueAuto:
-        return FontCascadeDescription::AutoKerning;
+        return Kerning::Auto;
     case CSSValueNormal:
-        return FontCascadeDescription::NormalKerning;
+        return Kerning::Normal;
     case CSSValueNone:
-        return FontCascadeDescription::NoneKerning;
+        return Kerning::NoShift;
     default:
         break;
     }
 
     ASSERT_NOT_REACHED();
-    return FontCascadeDescription::AutoKerning;
+    return Kerning::Auto;
 }
 
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ObjectFit fit)

Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (191013 => 191014)


--- trunk/Source/WebCore/platform/graphics/Font.cpp	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp	2015-10-13 23:40:38 UTC (rev 191014)
@@ -371,18 +371,19 @@
     return platformCreateScaledFont(fontDescription, scaleFactor);
 }
 
-bool Font::applyTransforms(GlyphBufferGlyph* glyphs, GlyphBufferAdvance* advances, size_t glyphCount, TypesettingFeatures typesettingFeatures) const
+bool Font::applyTransforms(GlyphBufferGlyph* glyphs, GlyphBufferAdvance* advances, size_t glyphCount, bool enableKerning, bool enableLigatures) const
 {
     // We need to handle transforms on SVG fonts internally, since they are rendered internally.
     ASSERT(!isSVGFont());
 #if PLATFORM(COCOA)
-    CTFontTransformOptions options = (typesettingFeatures & Kerning ? kCTFontTransformApplyPositioning : 0) | (typesettingFeatures & Ligatures ? kCTFontTransformApplyShaping : 0);
+    CTFontTransformOptions options = (enableKerning ? kCTFontTransformApplyPositioning : 0) | (enableLigatures ? kCTFontTransformApplyShaping : 0);
     return CTFontTransformGlyphs(m_platformData.ctFont(), glyphs, reinterpret_cast<CGSize*>(advances), glyphCount, options);
 #else
     UNUSED_PARAM(glyphs);
     UNUSED_PARAM(advances);
     UNUSED_PARAM(glyphCount);
-    UNUSED_PARAM(typesettingFeatures);
+    UNUSED_PARAM(enableKerning);
+    UNUSED_PARAM(enableLigatures);
     return false;
 #endif
 }

Modified: trunk/Source/WebCore/platform/graphics/Font.h (191013 => 191014)


--- trunk/Source/WebCore/platform/graphics/Font.h	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebCore/platform/graphics/Font.h	2015-10-13 23:40:38 UTC (rev 191014)
@@ -35,7 +35,6 @@
 #if ENABLE(OPENTYPE_VERTICAL)
 #include "OpenTypeVerticalData.h"
 #endif
-#include "TypesettingFeatures.h"
 #include <wtf/TypeCasts.h>
 #include <wtf/text/StringHash.h>
 
@@ -193,7 +192,7 @@
     bool shouldNotBeUsedForArabic() const { return m_shouldNotBeUsedForArabic; };
 #endif
 #if PLATFORM(COCOA)
-    CFDictionaryRef getCFStringAttributes(TypesettingFeatures, FontOrientation) const;
+    CFDictionaryRef getCFStringAttributes(bool enableKerning, bool enableLigatures, FontOrientation) const;
     bool hasCustomTracking() const { return isSystemFont(); }
 #endif
 
@@ -201,7 +200,7 @@
     bool canRenderCombiningCharacterSequence(const UChar*, size_t) const;
 #endif
 
-    bool applyTransforms(GlyphBufferGlyph*, GlyphBufferAdvance*, size_t glyphCount, TypesettingFeatures) const;
+    bool applyTransforms(GlyphBufferGlyph*, GlyphBufferAdvance*, size_t glyphCount, bool enableKerning, bool enableLigatures) const;
 
 #if PLATFORM(COCOA) || PLATFORM(WIN)
     bool isSystemFont() const { return m_isSystemFont; }

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (191013 => 191014)


--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2015-10-13 23:40:38 UTC (rev 191014)
@@ -92,7 +92,8 @@
 
 FontCascade::CodePath FontCascade::s_codePath = Auto;
 
-TypesettingFeatures FontCascade::s_defaultTypesettingFeatures = 0;
+bool FontCascade::s_defaultKerning = false;
+bool FontCascade::s_defaultLigatures = false;
 
 // ============================================================================================
 // FontCascade Implementation (Cross-Platform Portion)
@@ -103,7 +104,8 @@
     , m_letterSpacing(0)
     , m_wordSpacing(0)
     , m_useBackslashAsYenSymbol(false)
-    , m_typesettingFeatures(0)
+    , m_enableKerning(false)
+    , m_enableLigatures(false)
 {
 }
 
@@ -113,7 +115,8 @@
     , m_letterSpacing(letterSpacing)
     , m_wordSpacing(wordSpacing)
     , m_useBackslashAsYenSymbol(useBackslashAsYenSignForFamily(fd.firstFamily()))
-    , m_typesettingFeatures(computeTypesettingFeatures())
+    , m_enableKerning(computeEnableKerning())
+    , m_enableLigatures(computeEnableKerning())
 {
 }
 
@@ -124,7 +127,8 @@
     , m_letterSpacing(0)
     , m_wordSpacing(0)
     , m_useBackslashAsYenSymbol(false)
-    , m_typesettingFeatures(computeTypesettingFeatures())
+    , m_enableKerning(computeEnableKerning())
+    , m_enableLigatures(computeEnableKerning())
 {
     m_fontDescription.setFontSmoothing(fontSmoothingMode);
 #if PLATFORM(IOS)
@@ -142,7 +146,8 @@
     , m_letterSpacing(other.m_letterSpacing)
     , m_wordSpacing(other.m_wordSpacing)
     , m_useBackslashAsYenSymbol(other.m_useBackslashAsYenSymbol)
-    , m_typesettingFeatures(computeTypesettingFeatures())
+    , m_enableKerning(computeEnableKerning())
+    , m_enableLigatures(computeEnableKerning())
 {
 }
 
@@ -153,7 +158,8 @@
     m_letterSpacing = other.m_letterSpacing;
     m_wordSpacing = other.m_wordSpacing;
     m_useBackslashAsYenSymbol = other.m_useBackslashAsYenSymbol;
-    m_typesettingFeatures = other.m_typesettingFeatures;
+    m_enableKerning = other.m_enableKerning;
+    m_enableLigatures = other.m_enableLigatures;
     return *this;
 }
 
@@ -298,7 +304,8 @@
 {
     m_fonts = retrieveOrAddCachedFonts(m_fontDescription, WTF::move(fontSelector));
     m_useBackslashAsYenSymbol = useBackslashAsYenSignForFamily(firstFamily());
-    m_typesettingFeatures = computeTypesettingFeatures();
+    m_enableKerning = computeEnableKerning();
+    m_enableLigatures = computeEnableLigatures();
 }
 
 float FontCascade::drawText(GraphicsContext& context, const TextRun& run, const FloatPoint& point, int from, int to, CustomFontNotReadyAction customFontNotReadyAction) const
@@ -313,7 +320,7 @@
 
     CodePath codePathToUse = codePath(run);
     // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050
-    if (codePathToUse != Complex && typesettingFeatures() && (from || static_cast<unsigned>(to) != run.length()) && !isDrawnWithSVGFont(run))
+    if (codePathToUse != Complex && (enableKerning() || enableLigatures()) && (from || static_cast<unsigned>(to) != run.length()) && !isDrawnWithSVGFont(run))
         codePathToUse = Complex;
 
     if (codePathToUse != Complex)
@@ -332,7 +339,7 @@
 
     CodePath codePathToUse = codePath(run);
     // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050
-    if (codePathToUse != Complex && typesettingFeatures() && (from || static_cast<unsigned>(to) != run.length()) && !isDrawnWithSVGFont(run))
+    if (codePathToUse != Complex && (enableKerning() || enableLigatures()) && (from || static_cast<unsigned>(to) != run.length()) && !isDrawnWithSVGFont(run))
         codePathToUse = Complex;
 
     if (codePathToUse != Complex)
@@ -353,7 +360,7 @@
             glyphOverflow = 0;
     }
 
-    bool hasKerningOrLigatures = typesettingFeatures() & (Kerning | Ligatures);
+    bool hasKerningOrLigatures = enableKerning() || enableLigatures();
     bool hasWordSpacingOrLetterSpacing = wordSpacing() || letterSpacing();
     float* cacheEntry = m_fonts->widthCache().add(run, std::numeric_limits<float>::quiet_NaN(), hasKerningOrLigatures, hasWordSpacingOrLetterSpacing, glyphOverflow);
     if (cacheEntry && !std::isnan(*cacheEntry))
@@ -505,7 +512,7 @@
 
     CodePath codePathToUse = codePath(run);
     // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050
-    if (codePathToUse != Complex && typesettingFeatures() && (from || static_cast<unsigned>(to) != run.length()) && !isDrawnWithSVGFont(run))
+    if (codePathToUse != Complex && (enableKerning() || enableLigatures()) && (from || static_cast<unsigned>(to) != run.length()) && !isDrawnWithSVGFont(run))
         codePathToUse = Complex;
 
     if (codePathToUse != Complex)
@@ -517,7 +524,7 @@
 int FontCascade::offsetForPosition(const TextRun& run, float x, bool includePartialGlyphs) const
 {
     // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050
-    if (codePath(run) != Complex && (!typesettingFeatures() || isDrawnWithSVGFont(run)))
+    if (codePath(run) != Complex && (!(enableKerning() || enableLigatures()) || isDrawnWithSVGFont(run)))
         return offsetForPositionForSimpleText(run, x, includePartialGlyphs);
 
     return offsetForPositionForComplexText(run, x, includePartialGlyphs);
@@ -580,14 +587,14 @@
     return s_codePath;
 }
 
-void FontCascade::setDefaultTypesettingFeatures(TypesettingFeatures typesettingFeatures)
+void FontCascade::setDefaultKerning(bool enable)
 {
-    s_defaultTypesettingFeatures = typesettingFeatures;
+    s_defaultKerning = enable;
 }
 
-TypesettingFeatures FontCascade::defaultTypesettingFeatures()
+void FontCascade::setDefaultLigatures(bool enable)
 {
-    return s_defaultTypesettingFeatures;
+    s_defaultLigatures = enable;
 }
 
 FontCascade::CodePath FontCascade::codePath(const TextRun& run) const
@@ -605,7 +612,7 @@
         return Complex;
 
 #if !PLATFORM(COCOA)
-    if (run.length() > 1 && typesettingFeatures())
+    if (run.length() > 1 && (enableKerning() || enableLigatures()))
         return Complex;
 #endif
 
@@ -1427,7 +1434,7 @@
 {
     WidthIterator it(this, run, fallbackFonts, glyphOverflow);
     GlyphBuffer glyphBuffer;
-    it.advance(run.length(), (typesettingFeatures() & (Kerning | Ligatures)) ? &glyphBuffer : 0);
+    it.advance(run.length(), (enableKerning() || enableLigatures()) ? &glyphBuffer : nullptr);
 
     if (glyphOverflow) {
         glyphOverflow->top = std::max<int>(glyphOverflow->top, ceilf(-it.minGlyphBoundingBoxY()) - (glyphOverflow->computeBounds ? 0 : fontMetrics().ascent()));

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.h (191013 => 191014)


--- trunk/Source/WebCore/platform/graphics/FontCascade.h	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.h	2015-10-13 23:40:38 UTC (rev 191014)
@@ -31,7 +31,6 @@
 #include "FontDescription.h"
 #include "Path.h"
 #include "TextFlags.h"
-#include "TypesettingFeatures.h"
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 #include <wtf/WeakPtr.h>
@@ -158,7 +157,8 @@
     
     FontRenderingMode renderingMode() const { return m_fontDescription.renderingMode(); }
 
-    TypesettingFeatures typesettingFeatures() const { return static_cast<TypesettingFeatures>(m_typesettingFeatures); }
+    bool enableKerning() const { return m_enableKerning; }
+    bool enableLigatures() const { return m_enableLigatures; }
 
     const AtomicString& firstFamily() const { return m_fontDescription.firstFamily(); }
     unsigned familyCount() const { return m_fontDescription.familyCount(); }
@@ -265,9 +265,8 @@
     static CodePath codePath();
     static CodePath s_codePath;
 
-    WEBCORE_EXPORT static void setDefaultTypesettingFeatures(TypesettingFeatures);
-    static TypesettingFeatures defaultTypesettingFeatures();
-
+    WEBCORE_EXPORT static void setDefaultKerning(bool);
+    WEBCORE_EXPORT static void setDefaultLigatures(bool);
     static const uint8_t s_roundingHackCharacterTable[256];
     static bool isRoundingHackCharacter(UChar32 c)
     {
@@ -300,49 +299,38 @@
 private:
     bool isLoadingCustomFonts() const;
 
-    TypesettingFeatures computeTypesettingFeatures() const
+    bool advancedTextRenderingMode() const
     {
-        TextRenderingMode textRenderingMode = m_fontDescription.textRenderingMode();
-        TypesettingFeatures features = s_defaultTypesettingFeatures;
+        auto textRenderingMode = m_fontDescription.textRenderingMode();
+        if (textRenderingMode == GeometricPrecision || textRenderingMode == OptimizeLegibility)
+            return true;
+        if (textRenderingMode == OptimizeSpeed)
+            return false;
+        return s_defaultKerning;
+    }
 
-        switch (textRenderingMode) {
-        case AutoTextRendering:
-            break;
-        case OptimizeSpeed:
-            features &= ~(Kerning | Ligatures);
-            break;
-        case GeometricPrecision:
-        case OptimizeLegibility:
-            features |= Kerning | Ligatures;
-            break;
-        }
+    bool computeEnableKerning() const
+    {
+        auto kerning = m_fontDescription.kerning();
+        if (kerning == Kerning::Normal)
+            return true;
+        if (kerning == Kerning::NoShift)
+            return false;
+        return advancedTextRenderingMode();
+    }
 
-        switch (m_fontDescription.kerning()) {
-        case FontCascadeDescription::NoneKerning:
-            features &= ~Kerning;
-            break;
-        case FontCascadeDescription::NormalKerning:
-            features |= Kerning;
-            break;
-        case FontCascadeDescription::AutoKerning:
-            break;
-        }
-
-        switch (m_fontDescription.variantCommonLigatures()) {
-        case FontVariantLigatures::No:
-            features &= ~Ligatures;
-            break;
-        case FontVariantLigatures::Yes:
-            features |= Ligatures;
-            break;
-        default:
-            break;
-        }
-
-        return features;
+    bool computeEnableLigatures() const
+    {
+        auto ligatures = m_fontDescription.variantCommonLigatures();
+        if (ligatures == FontVariantLigatures::Yes)
+            return true;
+        if (ligatures == FontVariantLigatures::No)
+            return false;
+        return advancedTextRenderingMode();
     }
 
-    static TypesettingFeatures s_defaultTypesettingFeatures;
+    static bool s_defaultKerning;
+    static bool s_defaultLigatures;
 
     FontCascadeDescription m_fontDescription;
     mutable RefPtr<FontCascadeFonts> m_fonts;
@@ -350,7 +338,8 @@
     float m_letterSpacing;
     float m_wordSpacing;
     mutable bool m_useBackslashAsYenSymbol;
-    mutable unsigned m_typesettingFeatures : 2; // (TypesettingFeatures) Caches values computed from m_fontDescription.
+    mutable unsigned m_enableKerning : 1; // Computed from m_fontDescription.
+    mutable unsigned m_enableLigatures : 1; // Computed from m_fontDescription.
 };
 
 void invalidateFontCascadeCache();

Modified: trunk/Source/WebCore/platform/graphics/FontDescription.cpp (191013 => 191014)


--- trunk/Source/WebCore/platform/graphics/FontDescription.cpp	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebCore/platform/graphics/FontDescription.cpp	2015-10-13 23:40:38 UTC (rev 191014)
@@ -83,7 +83,7 @@
 
 FontCascadeDescription::FontCascadeDescription()
     : m_isAbsoluteSize(false)
-    , m_kerning(AutoKerning)
+    , m_kerning(static_cast<unsigned>(Kerning::Auto))
     , m_keywordSize(0)
     , m_fontSmoothing(AutoSmoothing)
     , m_isSpecifiedFont(false)

Modified: trunk/Source/WebCore/platform/graphics/FontDescription.h (191013 => 191014)


--- trunk/Source/WebCore/platform/graphics/FontDescription.h	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebCore/platform/graphics/FontDescription.h	2015-10-13 23:40:38 UTC (rev 191014)
@@ -192,8 +192,6 @@
 // FIXME: Move to a file of its own.
 class FontCascadeDescription : public FontDescription {
 public:
-    enum Kerning { AutoKerning, NormalKerning, NoneKerning };
-
     FontCascadeDescription();
 
     bool operator==(const FontCascadeDescription&) const;
@@ -228,7 +226,7 @@
     void setFamilies(const RefCountedArray<AtomicString>& families) { m_families = families; }
     void setSpecifiedSize(float s) { m_specifiedSize = clampToFloat(s); }
     void setIsAbsoluteSize(bool s) { m_isAbsoluteSize = s; }
-    void setKerning(Kerning kerning) { m_kerning = kerning; }
+    void setKerning(Kerning kerning) { m_kerning = static_cast<unsigned>(kerning); }
     void setKeywordSize(unsigned size)
     {
         ASSERT(size <= 8);
@@ -259,7 +257,7 @@
     // Initial values for font properties.
     static FontItalic initialItalic() { return FontItalicOff; }
     static FontSmallCaps initialSmallCaps() { return FontSmallCapsOff; }
-    static Kerning initialKerning() { return AutoKerning; }
+    static Kerning initialKerning() { return Kerning::Auto; }
     static FontSmoothingMode initialFontSmoothing() { return AutoSmoothing; }
     static TextRenderingMode initialTextRenderingMode() { return AutoTextRendering; }
     static FontSynthesis initialFontSynthesis() { return FontSynthesisWeight | FontSynthesisStyle; }

Deleted: trunk/Source/WebCore/platform/graphics/TypesettingFeatures.h (191013 => 191014)


--- trunk/Source/WebCore/platform/graphics/TypesettingFeatures.h	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebCore/platform/graphics/TypesettingFeatures.h	2015-10-13 23:40:38 UTC (rev 191014)
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef TypesettingFeatures_h
-#define TypesettingFeatures_h
-
-namespace WebCore {
-    enum TypesettingFeature {
-        Kerning = 1 << 0,
-        Ligatures = 1 << 1,
-    };
-
-    typedef unsigned TypesettingFeatures;
-} // namespace WebCore
-
-#endif // TypesettingFeatures_h

Modified: trunk/Source/WebCore/platform/graphics/WidthIterator.cpp (191013 => 191014)


--- trunk/Source/WebCore/platform/graphics/WidthIterator.cpp	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebCore/platform/graphics/WidthIterator.cpp	2015-10-13 23:40:38 UTC (rev 191014)
@@ -41,13 +41,10 @@
     , m_runWidthSoFar(0)
     , m_isAfterExpansion((run.expansionBehavior() & LeadingExpansionMask) == ForbidLeadingExpansion)
     , m_finalRoundingWidth(0)
-    , m_typesettingFeatures(font->typesettingFeatures())
     , m_fallbackFonts(fallbackFonts)
     , m_accountForGlyphBounds(accountForGlyphBounds)
-    , m_maxGlyphBoundingBoxY(std::numeric_limits<float>::min())
-    , m_minGlyphBoundingBoxY(std::numeric_limits<float>::max())
-    , m_firstGlyphOverflow(0)
-    , m_lastGlyphOverflow(0)
+    , m_enableKerning(font->enableKerning())
+    , m_enableLigatures(font->enableLigatures())
     , m_forTextEmphasis(forTextEmphasis)
 {
     // If the padding is non-zero, count the number of spaces in the run
@@ -104,12 +101,12 @@
 {
     if (glyphBuffer && glyphBuffer->size() == (lastGlyphCount + 1) && isSoftBankEmoji(previousCharacter))
         return TransformsType::Forced;
-    if (m_run.length() <= 1 || !(m_typesettingFeatures & (Kerning | Ligatures)))
+    if (m_run.length() <= 1 || !(m_enableKerning || m_enableLigatures))
         return TransformsType::None;
     return TransformsType::NotForced;
 }
 
-inline float WidthIterator::applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int& lastGlyphCount, const Font* font, TypesettingFeatures typesettingFeatures, UChar32 previousCharacter, bool force, CharactersTreatedAsSpace& charactersTreatedAsSpace)
+inline float WidthIterator::applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int& lastGlyphCount, const Font* font, UChar32 previousCharacter, bool force, CharactersTreatedAsSpace& charactersTreatedAsSpace)
 {
     ASSERT_UNUSED(previousCharacter, shouldApplyFontTransforms(glyphBuffer, lastGlyphCount, previousCharacter) != WidthIterator::TransformsType::None);
 
@@ -134,14 +131,14 @@
     // We need to handle transforms on SVG fonts internally, since they are rendered internally.
     if (font->isSVGFont()) {
         // SVG font ligatures are handled during glyph selection, only kerning remaining.
-        if (run().renderingContext() && (typesettingFeatures & Kerning)) {
+        if (run().renderingContext() && m_enableKerning) {
             // FIXME: We could pass the necessary context down to this level so we can lazily create rendering contexts at this point.
             // However, a larger refactoring of SVG fonts might necessary to sidestep this problem completely.
             run().renderingContext()->applySVGKerning(font, *this, glyphBuffer, lastGlyphCount);
         }
     } else
 #endif
-        font->applyTransforms(glyphBuffer->glyphs(lastGlyphCount), advances + lastGlyphCount, glyphBufferSize - lastGlyphCount, typesettingFeatures);
+        font->applyTransforms(glyphBuffer->glyphs(lastGlyphCount), advances + lastGlyphCount, glyphBufferSize - lastGlyphCount, m_enableKerning, m_enableLigatures);
 
     if (!ltr)
         glyphBuffer->reverse(lastGlyphCount, glyphBufferSize - lastGlyphCount);
@@ -252,7 +249,7 @@
         if (font != lastFontData && width) {
             auto transformsType = shouldApplyFontTransforms(glyphBuffer, lastGlyphCount, previousCharacter);
             if (transformsType != TransformsType::None) {
-                m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, m_typesettingFeatures, previousCharacter, transformsType == TransformsType::Forced, charactersTreatedAsSpace);
+                m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, previousCharacter, transformsType == TransformsType::Forced, charactersTreatedAsSpace);
                 if (glyphBuffer)
                     glyphBuffer->shrink(lastGlyphCount);
             }
@@ -410,7 +407,7 @@
 
     auto transformsType = shouldApplyFontTransforms(glyphBuffer, lastGlyphCount, previousCharacter);
     if (transformsType != TransformsType::None) {
-        m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, m_typesettingFeatures, previousCharacter, transformsType == TransformsType::Forced, charactersTreatedAsSpace);
+        m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, previousCharacter, transformsType == TransformsType::Forced, charactersTreatedAsSpace);
         if (glyphBuffer)
             glyphBuffer->shrink(lastGlyphCount);
     }

Modified: trunk/Source/WebCore/platform/graphics/WidthIterator.h (191013 => 191014)


--- trunk/Source/WebCore/platform/graphics/WidthIterator.h	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebCore/platform/graphics/WidthIterator.h	2015-10-13 23:40:38 UTC (rev 191014)
@@ -84,16 +84,17 @@
 
     enum class TransformsType { None, Forced, NotForced };
     TransformsType shouldApplyFontTransforms(const GlyphBuffer*, int lastGlyphCount, UChar32 previousCharacter) const;
-    float applyFontTransforms(GlyphBuffer*, bool ltr, int& lastGlyphCount, const Font*, TypesettingFeatures, UChar32 previousCharacter, bool force, CharactersTreatedAsSpace&);
+    float applyFontTransforms(GlyphBuffer*, bool ltr, int& lastGlyphCount, const Font*, UChar32 previousCharacter, bool force, CharactersTreatedAsSpace&);
 
-    TypesettingFeatures m_typesettingFeatures;
-    HashSet<const Font*>* m_fallbackFonts;
-    bool m_accountForGlyphBounds;
-    float m_maxGlyphBoundingBoxY;
-    float m_minGlyphBoundingBoxY;
-    float m_firstGlyphOverflow;
-    float m_lastGlyphOverflow;
-    bool m_forTextEmphasis;
+    HashSet<const Font*>* m_fallbackFonts { nullptr };
+    bool m_accountForGlyphBounds { false };
+    bool m_enableKerning { false };
+    bool m_enableLigatures { false };
+    bool m_forTextEmphasis { false };
+    float m_maxGlyphBoundingBoxY { std::numeric_limits<float>::min() };
+    float m_minGlyphBoundingBoxY { std::numeric_limits<float>::max() };
+    float m_firstGlyphOverflow { 0 };
+    float m_lastGlyphOverflow { 0 };
 };
 
 }

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm (191013 => 191014)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm	2015-10-13 23:40:38 UTC (rev 191014)
@@ -475,7 +475,7 @@
 
     RetainPtr<CFTypeRef> fontEqualityObject = platformData().objectForEqualityCheck();
 
-    ProviderInfo info = { characters, length, getCFStringAttributes(0, platformData().orientation()) };
+    ProviderInfo info = { characters, length, getCFStringAttributes(false, false, platformData().orientation()) };
     RetainPtr<CTLineRef> line = adoptCF(CTLineCreateWithUniCharProvider(&provideStringAndAttributes, 0, &info));
 
     CFArrayRef runArray = CTLineGetGlyphRuns(line.get());

Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp (191013 => 191014)


--- trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp	2015-10-13 23:40:38 UTC (rev 191014)
@@ -338,15 +338,15 @@
 
     hb_feature_t kerning = { HarfBuzzFace::kernTag, 0, 0, static_cast<unsigned>(-1) };
     switch (description.kerning()) {
-    case FontCascadeDescription::NormalKerning:
+    case Kerning::Normal:
         kerning.value = 1;
         m_features.append(kerning);
         break;
-    case FontCascadeDescription::NoneKerning:
+    case Kerning::NoShift:
         kerning.value = 0;
         m_features.append(kerning);
         break;
-    case FontCascadeDescription::AutoKerning:
+    case Kerning::Auto:
         break;
     default:
         ASSERT_NOT_REACHED();

Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm (191013 => 191014)


--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm	2015-10-13 23:40:38 UTC (rev 191014)
@@ -217,7 +217,7 @@
 
         RetainPtr<WebCascadeList> cascadeList = adoptNS([[WebCascadeList alloc] initWithFont:&m_font character:baseCharacter]);
 
-        stringAttributes = adoptCF(CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, font->getCFStringAttributes(m_font.typesettingFeatures(), font->platformData().orientation())));
+        stringAttributes = adoptCF(CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, font->getCFStringAttributes(m_font.enableKerning(), m_font.enableLigatures(), font->platformData().orientation())));
         static const void* attributeKeys[] = { kCTFontCascadeListAttribute };
         const void* values[] = { cascadeList.get() };
         RetainPtr<CFDictionaryRef> attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, attributeKeys, values, sizeof(attributeKeys) / sizeof(*attributeKeys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
@@ -225,7 +225,7 @@
         RetainPtr<CTFontRef> fontWithCascadeList = adoptCF(CTFontCreateCopyWithAttributes(font->platformData().ctFont(), m_font.pixelSize(), 0, fontDescriptor.get()));
         CFDictionarySetValue(const_cast<CFMutableDictionaryRef>(stringAttributes.get()), kCTFontAttributeName, fontWithCascadeList.get());
     } else
-        stringAttributes = font->getCFStringAttributes(m_font.typesettingFeatures(), font->platformData().orientation());
+        stringAttributes = font->getCFStringAttributes(m_font.enableKerning(), m_font.enableLigatures(), font->platformData().orientation());
 
     RetainPtr<CTLineRef> line;
 

Modified: trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp (191013 => 191014)


--- trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp	2015-10-13 23:40:38 UTC (rev 191014)
@@ -35,9 +35,9 @@
 
 namespace WebCore {
 
-CFDictionaryRef Font::getCFStringAttributes(TypesettingFeatures typesettingFeatures, FontOrientation orientation) const
+CFDictionaryRef Font::getCFStringAttributes(bool enableKerning, bool enableLigatures, FontOrientation orientation) const
 {
-    unsigned key = typesettingFeatures + 1;
+    unsigned key = (enableKerning << 1 | enableLigatures) + 1;
     HashMap<unsigned, RetainPtr<CFDictionaryRef>>::AddResult addResult = m_CFStringAttributes.add(key, RetainPtr<CFDictionaryRef>());
     RetainPtr<CFDictionaryRef>& attributesDictionary = addResult.iterator->value;
     if (!addResult.isNewEntry)
@@ -48,14 +48,13 @@
 
     CFDictionarySetValue(mutableAttributes, kCTFontAttributeName, platformData().ctFont());
 
-    if (!(typesettingFeatures & Kerning)) {
+    if (!enableKerning) {
         const float zero = 0;
         static CFNumberRef zeroKerningValue = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &zero);
         CFDictionarySetValue(mutableAttributes, kCTKernAttributeName, zeroKerningValue);
     }
 
-    bool allowLigatures = (orientation == Horizontal && platformData().allowsLigatures()) || (typesettingFeatures & Ligatures);
-    if (!allowLigatures) {
+    if (!((orientation == Horizontal && platformData().allowsLigatures()) || enableLigatures)) {
         const int zero = 0;
         static CFNumberRef essentialLigaturesValue = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &zero);
         CFDictionarySetValue(mutableAttributes, kCTLigatureAttributeName, essentialLigaturesValue);

Modified: trunk/Source/WebCore/platform/text/TextFlags.h (191013 => 191014)


--- trunk/Source/WebCore/platform/text/TextFlags.h	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebCore/platform/text/TextFlags.h	2015-10-13 23:40:38 UTC (rev 191014)
@@ -259,6 +259,12 @@
     FontWeightMask = FontWeight100Mask | FontWeight200Mask | FontWeight300Mask | FontWeight400Mask | FontWeight500Mask | FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask
 };
 
+enum class Kerning {
+    Auto,
+    Normal,
+    NoShift
+};
+
 }
 
 #endif

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (191013 => 191014)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2015-10-13 23:40:38 UTC (rev 191014)
@@ -482,7 +482,7 @@
 
     float measuredWidth = 0;
 
-    bool kerningIsEnabled = font.typesettingFeatures() & Kerning;
+    bool kerningIsEnabled = font.enableKerning();
     bool canUseSimpleFontCodePath = renderer.canUseSimpleFontCodePath();
     
     // Since we don't cache glyph overflows, we need to re-measure the run if

Modified: trunk/Source/WebCore/rendering/line/BreakingContext.h (191013 => 191014)


--- trunk/Source/WebCore/rendering/line/BreakingContext.h	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebCore/rendering/line/BreakingContext.h	2015-10-13 23:40:38 UTC (rev 191014)
@@ -78,7 +78,7 @@
             return m_width;
 
         const FontCascade& font = m_style.fontCascade();
-        if ((font.typesettingFeatures() & Kerning) && !m_textLayout)
+        if (font.enableKerning() && !m_textLayout)
             m_width = font.width(RenderBlock::constructTextRun(&m_renderer, font, &space, 1, m_style), &fallbackFonts) + font.wordSpacing();
         m_state = WordTrailingSpaceState::Computed;
         return m_width;

Modified: trunk/Source/WebCore/svg/SVGFontData.h (191013 => 191014)


--- trunk/Source/WebCore/svg/SVGFontData.h	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebCore/svg/SVGFontData.h	2015-10-13 23:40:38 UTC (rev 191014)
@@ -53,7 +53,7 @@
     bool fillBMPGlyphs(SVGFontElement*, GlyphPage*, UChar* buffer) const;
     bool fillNonBMPGlyphs(SVGFontElement*, GlyphPage*, UChar* buffer) const;
 
-    bool applyTransforms(GlyphBufferGlyph*, GlyphBufferAdvance*, size_t, TypesettingFeatures) const = delete;
+    bool applyTransforms(GlyphBufferGlyph*, GlyphBufferAdvance*, size_t, bool enableKerning, bool enableLigatures) const = delete;
 
     // Ths SVGFontFaceElement is kept alive --
     // 1) in the external font case: by the CSSFontFaceSource, which holds a reference to the external SVG document

Modified: trunk/Source/WebKit/mac/ChangeLog (191013 => 191014)


--- trunk/Source/WebKit/mac/ChangeLog	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebKit/mac/ChangeLog	2015-10-13 23:40:38 UTC (rev 191014)
@@ -1,3 +1,13 @@
+2015-10-13  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Split TypesettingFeatures into kerning and ligatures bools
+        https://bugs.webkit.org/show_bug.cgi?id=150074
+
+        Reviewed by Simon Fraser.
+
+        * WebView/WebView.mm:
+        (+[WebView initialize]):
+
 2015-10-13  Chris Dumez  <cdu...@apple.com>
 
         Avoid useless copies in range-loops that are using 'auto'

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (191013 => 191014)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2015-10-13 23:40:38 UTC (rev 191014)
@@ -4708,7 +4708,9 @@
     grammarCheckingEnabled = [defaults boolForKey:WebGrammarCheckingEnabled];
 #endif
 
-    FontCascade::setDefaultTypesettingFeatures([defaults boolForKey:WebKitKerningAndLigaturesEnabledByDefaultDefaultsKey] ? Kerning | Ligatures : 0);
+    bool defaultKerningAndLigatures = [defaults boolForKey:WebKitKerningAndLigaturesEnabledByDefaultDefaultsKey];
+    FontCascade::setDefaultKerning(defaultKerningAndLigatures);
+    FontCascade::setDefaultLigatures(defaultKerningAndLigatures);
 
 #if !PLATFORM(IOS)
     automaticQuoteSubstitutionEnabled = [self _shouldAutomaticQuoteSubstitutionBeEnabled];

Modified: trunk/Source/WebKit2/ChangeLog (191013 => 191014)


--- trunk/Source/WebKit2/ChangeLog	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebKit2/ChangeLog	2015-10-13 23:40:38 UTC (rev 191014)
@@ -1,3 +1,20 @@
+2015-10-13  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Split TypesettingFeatures into kerning and ligatures bools
+        https://bugs.webkit.org/show_bug.cgi?id=150074
+
+        Reviewed by Simon Fraser.
+
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::WebProcessCreationParameters):
+        (WebKit::WebProcessCreationParameters::encode):
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.h:
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::WebProcessPool::platformInitializeWebProcess):
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::platformInitializeWebProcess):
+
 2015-10-13  Dean Jackson  <d...@apple.com>
 
         Fix iOS-family builds.

Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp (191013 => 191014)


--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp	2015-10-13 23:40:38 UTC (rev 191014)
@@ -40,7 +40,8 @@
     , shouldUseFontSmoothing(true)
     , defaultRequestTimeoutInterval(INT_MAX)
 #if PLATFORM(COCOA)
-    , shouldEnableKerningAndLigaturesByDefault(false)
+    , shouldEnableKerningByDefault(false)
+    , shouldEnableLigaturesByDefault(false)
     , shouldEnableJIT(false)
     , shouldEnableFTLJIT(false)
 #endif
@@ -122,7 +123,8 @@
     encoder << acceleratedCompositingPort;
     encoder << uiProcessBundleResourcePath;
     encoder << uiProcessBundleResourcePathExtensionHandle;
-    encoder << shouldEnableKerningAndLigaturesByDefault;
+    encoder << shouldEnableKerningByDefault;
+    encoder << shouldEnableLigaturesByDefault;
     encoder << shouldEnableJIT;
     encoder << shouldEnableFTLJIT;
     encoder << !!bundleParameterData;
@@ -267,8 +269,10 @@
         return false;
     if (!decoder.decode(parameters.uiProcessBundleResourcePathExtensionHandle))
         return false;
-    if (!decoder.decode(parameters.shouldEnableKerningAndLigaturesByDefault))
+    if (!decoder.decode(parameters.shouldEnableKerningByDefault))
         return false;
+    if (!decoder.decode(parameters.shouldEnableLigaturesByDefault))
+        return false;
     if (!decoder.decode(parameters.shouldEnableJIT))
         return false;
     if (!decoder.decode(parameters.shouldEnableFTLJIT))

Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h (191013 => 191014)


--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h	2015-10-13 23:40:38 UTC (rev 191014)
@@ -142,7 +142,8 @@
     String uiProcessBundleResourcePath;
     SandboxExtension::Handle uiProcessBundleResourcePathExtensionHandle;
 
-    bool shouldEnableKerningAndLigaturesByDefault;
+    bool shouldEnableKerningByDefault;
+    bool shouldEnableLigaturesByDefault;
     bool shouldEnableJIT;
     bool shouldEnableFTLJIT;
     

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm (191013 => 191014)


--- trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2015-10-13 23:40:38 UTC (rev 191014)
@@ -175,7 +175,9 @@
     parameters.accessibilityEnhancedUserInterfaceEnabled = false;
 #endif
 
-    parameters.shouldEnableKerningAndLigaturesByDefault = [[NSUserDefaults standardUserDefaults] boolForKey:WebKitKerningAndLigaturesEnabledByDefaultDefaultsKey];
+    bool shouldEnableKerningAndLigaturesByDefault = [[NSUserDefaults standardUserDefaults] boolForKey:WebKitKerningAndLigaturesEnabledByDefaultDefaultsKey];
+    parameters.shouldEnableKerningByDefault = shouldEnableKerningAndLigaturesByDefault;
+    parameters.shouldEnableLigaturesByDefault = shouldEnableKerningAndLigaturesByDefault;
     parameters.shouldEnableJIT = [[NSUserDefaults standardUserDefaults] boolForKey:WebKitJSCJITEnabledDefaultsKey];
     parameters.shouldEnableFTLJIT = [[NSUserDefaults standardUserDefaults] boolForKey:WebKitJSCFTLJITEnabledDefaultsKey];
     parameters.shouldEnableMemoryPressureReliefLogging = [[NSUserDefaults standardUserDefaults] boolForKey:@"LogMemoryJetsamDetails"];

Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm (191013 => 191014)


--- trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm	2015-10-13 23:28:03 UTC (rev 191013)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm	2015-10-13 23:40:38 UTC (rev 191014)
@@ -144,7 +144,8 @@
 
     m_compositingRenderServerPort = WTF::move(parameters.acceleratedCompositingPort);
     m_presenterApplicationPid = parameters.presenterApplicationPid;
-    FontCascade::setDefaultTypesettingFeatures(parameters.shouldEnableKerningAndLigaturesByDefault ? Kerning | Ligatures : 0);
+    FontCascade::setDefaultKerning(parameters.shouldEnableKerningByDefault);
+    FontCascade::setDefaultLigatures(parameters.shouldEnableLigaturesByDefault);
 
     MemoryPressureHandler::ReliefLogger::setLoggingEnabled(parameters.shouldEnableMemoryPressureReliefLogging);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to