Title: [193665] branches/safari-601-branch/Source
Revision
193665
Author
matthew_han...@apple.com
Date
2015-12-07 16:23:20 -0800 (Mon, 07 Dec 2015)

Log Message

Merge r191014. rdar://problem/23769801

Modified Paths

Removed Paths

Diff

Modified: branches/safari-601-branch/Source/WebCore/ChangeLog (193664 => 193665)


--- branches/safari-601-branch/Source/WebCore/ChangeLog	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebCore/ChangeLog	2015-12-08 00:23:20 UTC (rev 193665)
@@ -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-12-07  David Kilzer  <ddkil...@apple.com>
 
         Merge r193635. rdar://problem/23581586

Modified: branches/safari-601-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (193664 => 193665)


--- branches/safari-601-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-12-08 00:23:20 UTC (rev 193665)
@@ -1404,7 +1404,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 */; };
@@ -8617,7 +8616,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>"; };
@@ -21105,7 +21103,6 @@
 				CDD1E525167BA56400CE820B /* TextTrackRepresentation.h */,
 				1AF89A411518FDEA00E547B5 /* TiledBacking.h */,
 				BE913D7F181EF8E500DCB09E /* TrackPrivateBase.h */,
-				37C28A6710F659CC008C7813 /* TypesettingFeatures.h */,
 				E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */,
 				BEF29EEA1715DD0900C4B4C9 /* VideoTrackPrivate.h */,
 				1411DCB0164C39A800D49BC1 /* WidthCache.h */,
@@ -27177,7 +27174,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: branches/safari-601-branch/Source/WebCore/css/CSSPrimitiveValueMappings.h (193664 => 193665)


--- branches/safari-601-branch/Source/WebCore/css/CSSPrimitiveValueMappings.h	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebCore/css/CSSPrimitiveValueMappings.h	2015-12-08 00:23:20 UTC (rev 193665)
@@ -3438,18 +3438,18 @@
     return PE_ALL;
 }
 
-template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontDescription::Kerning kerning)
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Kerning kerning)
     : CSSValue(PrimitiveClass)
 {
     m_primitiveUnitType = CSS_VALUE_ID;
     switch (kerning) {
-    case FontDescription::AutoKerning:
+    case Kerning::Auto:
         m_value.valueID = CSSValueAuto;
         return;
-    case FontDescription::NormalKerning:
+    case Kerning::Normal:
         m_value.valueID = CSSValueNormal;
         return;
-    case FontDescription::NoneKerning:
+    case Kerning::NoShift:
         m_value.valueID = CSSValueNone;
         return;
     }
@@ -3458,23 +3458,23 @@
     m_value.valueID = CSSValueAuto;
 }
 
-template<> inline CSSPrimitiveValue::operator FontDescription::Kerning() const
+template<> inline CSSPrimitiveValue::operator Kerning() const
 {
     ASSERT(isValueID());
 
     switch (m_value.valueID) {
     case CSSValueAuto:
-        return FontDescription::AutoKerning;
+        return Kerning::Auto;
     case CSSValueNormal:
-        return FontDescription::NormalKerning;
+        return Kerning::Normal;
     case CSSValueNone:
-        return FontDescription::NoneKerning;
+        return Kerning::NoShift;
     default:
         break;
     }
 
     ASSERT_NOT_REACHED();
-    return FontDescription::AutoKerning;
+    return Kerning::Auto;
 }
 
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ObjectFit fit)

Modified: branches/safari-601-branch/Source/WebCore/platform/graphics/Font.cpp (193664 => 193665)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/Font.cpp	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/Font.cpp	2015-12-08 00:23:20 UTC (rev 193665)
@@ -380,18 +380,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: branches/safari-601-branch/Source/WebCore/platform/graphics/Font.h (193664 => 193665)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/Font.h	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/Font.h	2015-12-08 00:23:20 UTC (rev 193665)
@@ -35,7 +35,6 @@
 #if ENABLE(OPENTYPE_VERTICAL)
 #include "OpenTypeVerticalData.h"
 #endif
-#include "TypesettingFeatures.h"
 #include <wtf/TypeCasts.h>
 #include <wtf/text/StringHash.h>
 
@@ -194,7 +193,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
 
@@ -202,7 +201,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: branches/safari-601-branch/Source/WebCore/platform/graphics/FontCascade.cpp (193664 => 193665)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/FontCascade.cpp	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/FontCascade.cpp	2015-12-08 00:23:20 UTC (rev 193665)
@@ -91,7 +91,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)
@@ -102,7 +103,8 @@
     , m_letterSpacing(0)
     , m_wordSpacing(0)
     , m_useBackslashAsYenSymbol(false)
-    , m_typesettingFeatures(0)
+    , m_enableKerning(false)
+    , m_enableLigatures(false)
 {
 }
 
@@ -112,7 +114,8 @@
     , m_letterSpacing(letterSpacing)
     , m_wordSpacing(wordSpacing)
     , m_useBackslashAsYenSymbol(useBackslashAsYenSignForFamily(fd.firstFamily()))
-    , m_typesettingFeatures(computeTypesettingFeatures())
+    , m_enableKerning(computeEnableKerning())
+    , m_enableLigatures(computeEnableKerning())
 {
 }
 
@@ -123,7 +126,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)
@@ -158,7 +162,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())
 {
 }
 
@@ -169,7 +174,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;
 }
 
@@ -314,7 +320,8 @@
 {
     m_fonts = retrieveOrAddCachedFonts(m_fontDescription, fontSelector.get());
     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
@@ -329,7 +336,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)
@@ -348,7 +355,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)
@@ -369,7 +376,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))
@@ -521,7 +528,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)
@@ -533,7 +540,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);
@@ -596,14 +603,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
@@ -621,7 +628,7 @@
         return Complex;
 
 #if !PLATFORM(COCOA)
-    if (run.length() > 1 && typesettingFeatures())
+    if (run.length() > 1 && (enableKerning() || enableLigatures()))
         return Complex;
 #endif
 
@@ -1443,7 +1450,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: branches/safari-601-branch/Source/WebCore/platform/graphics/FontCascade.h (193664 => 193665)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/FontCascade.h	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/FontCascade.h	2015-12-08 00:23:20 UTC (rev 193665)
@@ -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>
@@ -163,7 +162,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(); }
@@ -270,9 +270,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)
     {
@@ -305,49 +304,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 FontDescription::NoneKerning:
-            features &= ~Kerning;
-            break;
-        case FontDescription::NormalKerning:
-            features |= Kerning;
-            break;
-        case FontDescription::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;
 
     FontDescription m_fontDescription;
     mutable RefPtr<FontCascadeFonts> m_fonts;
@@ -355,7 +343,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: branches/safari-601-branch/Source/WebCore/platform/graphics/FontDescription.h (193664 => 193665)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/FontDescription.h	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/FontDescription.h	2015-12-08 00:23:20 UTC (rev 193665)
@@ -40,8 +40,6 @@
 
 class FontDescription {
 public:
-    enum Kerning { AutoKerning, NormalKerning, NoneKerning };
-
     FontDescription()
         : m_families(1)
         , m_specifiedSize(0)
@@ -54,7 +52,7 @@
         , m_isAbsoluteSize(false)
         , m_weight(FontWeightNormal)
         , m_renderingMode(NormalRenderingMode)
-        , m_kerning(AutoKerning)
+        , m_kerning(static_cast<unsigned>(Kerning::Auto))
         , m_keywordSize(0)
         , m_fontSmoothing(AutoSmoothing)
         , m_textRendering(AutoTextRendering)
@@ -164,7 +162,7 @@
     void setIsAbsoluteSize(bool s) { m_isAbsoluteSize = s; }
     void setWeight(FontWeight w) { m_weight = w; }
     void setRenderingMode(FontRenderingMode mode) { m_renderingMode = mode; }
-    void setKerning(Kerning kerning) { m_kerning = kerning; }
+    void setKerning(Kerning kerning) { m_kerning = static_cast<unsigned>(kerning); }
     void setKeywordSize(unsigned size)
     {
         ASSERT(size <= 8);
@@ -218,7 +216,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: branches/safari-601-branch/Source/WebCore/platform/graphics/TypesettingFeatures.h (193664 => 193665)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/TypesettingFeatures.h	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/TypesettingFeatures.h	2015-12-08 00:23:20 UTC (rev 193665)
@@ -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: branches/safari-601-branch/Source/WebCore/platform/graphics/WidthIterator.cpp (193664 => 193665)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/WidthIterator.cpp	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/WidthIterator.cpp	2015-12-08 00:23:20 UTC (rev 193665)
@@ -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
@@ -97,10 +94,8 @@
 
 typedef Vector<std::pair<int, OriginalAdvancesForCharacterTreatedAsSpace>, 64> CharactersTreatedAsSpace;
 
-static inline float applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int& lastGlyphCount, const Font* font, WidthIterator& iterator, TypesettingFeatures typesettingFeatures, bool force, CharactersTreatedAsSpace& charactersTreatedAsSpace)
+static inline float applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int& lastGlyphCount, const Font* font, WidthIterator& iterator, bool force, CharactersTreatedAsSpace& charactersTreatedAsSpace)
 {
-    ASSERT(typesettingFeatures & (Kerning | Ligatures));
-
     if (!glyphBuffer)
         return 0;
 
@@ -124,14 +119,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 (iterator.run().renderingContext() && (typesettingFeatures & Kerning)) {
+        if (iterator.run().renderingContext() && iterator.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.
             iterator.run().renderingContext()->applySVGKerning(font, iterator, glyphBuffer, lastGlyphCount);
         }
     } else
 #endif
-        font->applyTransforms(glyphBuffer->glyphs(lastGlyphCount), advances + lastGlyphCount, glyphBufferSize - lastGlyphCount, typesettingFeatures);
+        font->applyTransforms(glyphBuffer->glyphs(lastGlyphCount), advances + lastGlyphCount, glyphBufferSize - lastGlyphCount, iterator.enableKerning(), iterator.enableLigatures());
 
     if (!ltr)
         glyphBuffer->reverse(lastGlyphCount, glyphBufferSize - lastGlyphCount);
@@ -203,7 +198,7 @@
 {
     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;
 }
@@ -269,7 +264,7 @@
         if (font != lastFontData && width) {
             auto transformsType = shouldApplyFontTransforms(glyphBuffer, lastGlyphCount, previousCharacter);
             if (transformsType != TransformsType::None) {
-                m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, *this, m_typesettingFeatures, transformsType == TransformsType::Forced, charactersTreatedAsSpace);
+                m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, *this, transformsType == TransformsType::Forced, charactersTreatedAsSpace);
                 if (glyphBuffer)
                     glyphBuffer->shrink(lastGlyphCount);
             }
@@ -427,7 +422,7 @@
 
     auto transformsType = shouldApplyFontTransforms(glyphBuffer, lastGlyphCount, previousCharacter);
     if (transformsType != TransformsType::None) {
-        m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, *this, m_typesettingFeatures, transformsType == TransformsType::Forced, charactersTreatedAsSpace);
+        m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, *this, transformsType == TransformsType::Forced, charactersTreatedAsSpace);
         if (glyphBuffer)
             glyphBuffer->shrink(lastGlyphCount);
     }

Modified: branches/safari-601-branch/Source/WebCore/platform/graphics/WidthIterator.h (193664 => 193665)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/WidthIterator.h	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/WidthIterator.h	2015-12-08 00:23:20 UTC (rev 193665)
@@ -51,6 +51,8 @@
 
     const TextRun& run() const { return m_run; }
     float runWidthSoFar() const { return m_runWidthSoFar; }
+    bool enableKerning() const { return m_enableKerning; }
+    bool enableLigatures() const { return m_enableLigatures; }
 
 #if ENABLE(SVG_FONTS)
     String lastGlyphName() const { return m_lastGlyphName; }
@@ -82,14 +84,15 @@
     enum class TransformsType { None, Forced, NotForced };
     TransformsType shouldApplyFontTransforms(const GlyphBuffer*, int lastGlyphCount, UChar32 previousCharacter) const;
 
-    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: branches/safari-601-branch/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm (193664 => 193665)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm	2015-12-08 00:23:20 UTC (rev 193665)
@@ -525,7 +525,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: branches/safari-601-branch/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp (193664 => 193665)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp	2015-12-08 00:23:20 UTC (rev 193665)
@@ -338,15 +338,15 @@
 
     hb_feature_t kerning = { HarfBuzzFace::kernTag, 0, 0, static_cast<unsigned>(-1) };
     switch (description.kerning()) {
-    case FontDescription::NormalKerning:
+    case Kerning::Normal:
         kerning.value = 1;
         m_features.append(kerning);
         break;
-    case FontDescription::NoneKerning:
+    case Kerning::NoShift:
         kerning.value = 0;
         m_features.append(kerning);
         break;
-    case FontDescription::AutoKerning:
+    case Kerning::Auto:
         break;
     default:
         ASSERT_NOT_REACHED();

Modified: branches/safari-601-branch/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm (193664 => 193665)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm	2015-12-08 00:23:20 UTC (rev 193665)
@@ -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: branches/safari-601-branch/Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp (193664 => 193665)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp	2015-12-08 00:23:20 UTC (rev 193665)
@@ -105,7 +105,7 @@
     } else {
         // We ask CoreText for possible vertical variant glyphs
         RetainPtr<CFStringRef> string = adoptCF(CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, buffer, bufferLength, kCFAllocatorNull));
-        RetainPtr<CFAttributedStringRef> attributedString = adoptCF(CFAttributedStringCreate(kCFAllocatorDefault, string.get(), fontData->getCFStringAttributes(0, fontData->hasVerticalGlyphs() ? Vertical : Horizontal)));
+        RetainPtr<CFAttributedStringRef> attributedString = adoptCF(CFAttributedStringCreate(kCFAllocatorDefault, string.get(), fontData->getCFStringAttributes(false, false, fontData->hasVerticalGlyphs() ? Vertical : Horizontal)));
         RetainPtr<CTLineRef> line = adoptCF(CTLineCreateWithAttributedString(attributedString.get()));
 
         CFArrayRef runArray = CTLineGetGlyphRuns(line.get());

Modified: branches/safari-601-branch/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp (193664 => 193665)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp	2015-12-08 00:23:20 UTC (rev 193665)
@@ -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: branches/safari-601-branch/Source/WebCore/platform/text/TextFlags.h (193664 => 193665)


--- branches/safari-601-branch/Source/WebCore/platform/text/TextFlags.h	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebCore/platform/text/TextFlags.h	2015-12-08 00:23:20 UTC (rev 193665)
@@ -259,6 +259,12 @@
     FontWeightMask = FontWeight100Mask | FontWeight200Mask | FontWeight300Mask | FontWeight400Mask | FontWeight500Mask | FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask
 };
 
+enum class Kerning {
+    Auto,
+    Normal,
+    NoShift
+};
+
 }
 
 #endif

Modified: branches/safari-601-branch/Source/WebCore/rendering/RenderBlockLineLayout.cpp (193664 => 193665)


--- branches/safari-601-branch/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2015-12-08 00:23:20 UTC (rev 193665)
@@ -485,7 +485,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: branches/safari-601-branch/Source/WebCore/rendering/line/BreakingContext.h (193664 => 193665)


--- branches/safari-601-branch/Source/WebCore/rendering/line/BreakingContext.h	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebCore/rendering/line/BreakingContext.h	2015-12-08 00:23:20 UTC (rev 193665)
@@ -77,7 +77,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: branches/safari-601-branch/Source/WebCore/svg/SVGFontData.h (193664 => 193665)


--- branches/safari-601-branch/Source/WebCore/svg/SVGFontData.h	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebCore/svg/SVGFontData.h	2015-12-08 00:23:20 UTC (rev 193665)
@@ -53,7 +53,7 @@
     bool fillBMPGlyphs(SVGFontElement*, GlyphPage* , unsigned offset, unsigned length, UChar* buffer, const Font*) const;
     bool fillNonBMPGlyphs(SVGFontElement*, GlyphPage* , unsigned offset, unsigned length, UChar* buffer, const Font*) 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: branches/safari-601-branch/Source/WebKit/mac/ChangeLog (193664 => 193665)


--- branches/safari-601-branch/Source/WebKit/mac/ChangeLog	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebKit/mac/ChangeLog	2015-12-08 00:23:20 UTC (rev 193665)
@@ -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-12-01  Timothy Hatcher  <timo...@apple.com>
 
         Merge r186724. rdar://problem/23221163

Modified: branches/safari-601-branch/Source/WebKit/mac/WebView/WebView.mm (193664 => 193665)


--- branches/safari-601-branch/Source/WebKit/mac/WebView/WebView.mm	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebKit/mac/WebView/WebView.mm	2015-12-08 00:23:20 UTC (rev 193665)
@@ -4700,7 +4700,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: branches/safari-601-branch/Source/WebKit2/ChangeLog (193664 => 193665)


--- branches/safari-601-branch/Source/WebKit2/ChangeLog	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebKit2/ChangeLog	2015-12-08 00:23:20 UTC (rev 193665)
@@ -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-12-05  Matthew Hanson  <matthew_han...@apple.com>
 
         Rollout r193474. rdar://problem/23732400

Modified: branches/safari-601-branch/Source/WebKit2/Shared/WebProcessCreationParameters.cpp (193664 => 193665)


--- branches/safari-601-branch/Source/WebKit2/Shared/WebProcessCreationParameters.cpp	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebKit2/Shared/WebProcessCreationParameters.cpp	2015-12-08 00:23:20 UTC (rev 193665)
@@ -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: branches/safari-601-branch/Source/WebKit2/Shared/WebProcessCreationParameters.h (193664 => 193665)


--- branches/safari-601-branch/Source/WebKit2/Shared/WebProcessCreationParameters.h	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebKit2/Shared/WebProcessCreationParameters.h	2015-12-08 00:23:20 UTC (rev 193665)
@@ -142,7 +142,8 @@
     String uiProcessBundleResourcePath;
     SandboxExtension::Handle uiProcessBundleResourcePathExtensionHandle;
 
-    bool shouldEnableKerningAndLigaturesByDefault;
+    bool shouldEnableKerningByDefault;
+    bool shouldEnableLigaturesByDefault;
     bool shouldEnableJIT;
     bool shouldEnableFTLJIT;
     

Modified: branches/safari-601-branch/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm (193664 => 193665)


--- branches/safari-601-branch/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2015-12-08 00:23:20 UTC (rev 193665)
@@ -173,7 +173,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: branches/safari-601-branch/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm (193664 => 193665)


--- branches/safari-601-branch/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm	2015-12-08 00:22:16 UTC (rev 193664)
+++ branches/safari-601-branch/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm	2015-12-08 00:23:20 UTC (rev 193665)
@@ -143,7 +143,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