Diff
Modified: trunk/Source/WebCore/ChangeLog (233850 => 233851)
--- trunk/Source/WebCore/ChangeLog 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/ChangeLog 2018-07-16 17:59:29 UTC (rev 233851)
@@ -1,3 +1,92 @@
+2018-07-16 Simon Fraser <simon.fra...@apple.com>
+
+ Shrink some font-related classes and enums
+ https://bugs.webkit.org/show_bug.cgi?id=187686
+
+ Reviewed by Myles Maxfield.
+
+ Use enum class for enums in TextFlags.h and make them one byte big.
+
+ Re-order members of Font to shrink it from 360 to 328 bytes.
+
+ * css/CSSPrimitiveValueMappings.h:
+ (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+ (WebCore::CSSPrimitiveValue::operator FontSmoothingMode const):
+ (WebCore::CSSPrimitiveValue::operator FontSmallCaps const):
+ (WebCore::CSSPrimitiveValue::operator TextRenderingMode const):
+ * platform/graphics/Font.cpp:
+ (WebCore::Font::Font):
+ (WebCore::Font::verticalRightOrientationFont const):
+ * platform/graphics/Font.h:
+ * platform/graphics/FontCascade.cpp:
+ (WebCore::offsetToMiddleOfGlyph):
+ * platform/graphics/FontCascade.h:
+ (WebCore::FontCascade::advancedTextRenderingMode const):
+ * platform/graphics/FontCascadeFonts.cpp:
+ (WebCore::FontCascadeFonts::glyphDataForSystemFallback):
+ (WebCore::FontCascadeFonts::glyphDataForVariant):
+ (WebCore::glyphPageFromFontRanges):
+ * platform/graphics/FontDescription.cpp:
+ (WebCore::FontCascadeDescription::FontCascadeDescription):
+ * platform/graphics/FontDescription.h:
+ (WebCore::FontDescription::setTextRenderingMode):
+ (WebCore::FontDescription::setOrientation):
+ (WebCore::FontDescription::setWidthVariant):
+ (WebCore::FontCascadeDescription::setFontSmoothing):
+ (WebCore::FontCascadeDescription::initialSmallCaps):
+ (WebCore::FontCascadeDescription::initialFontSmoothing):
+ (WebCore::FontCascadeDescription::initialTextRenderingMode):
+ * platform/graphics/FontPlatformData.h:
+ (WebCore::FontPlatformData::isForTextCombine const):
+ * platform/graphics/cocoa/FontCacheCoreText.cpp:
+ (WebCore::preparePlatformFont):
+ * platform/graphics/cocoa/FontCascadeCocoa.mm:
+ (WebCore::showLetterpressedGlyphsWithAdvances):
+ (WebCore::showGlyphsWithAdvances):
+ (WebCore::FontCascade::drawGlyphs):
+ (WebCore::FontCascade::fontForCombiningCharacterSequence const):
+ * platform/graphics/cocoa/FontCocoa.mm:
+ (WebCore::Font::platformInit):
+ (WebCore::Font::platformBoundsForGlyph const):
+ (WebCore::Font::platformWidthForGlyph const):
+ * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
+ (WebCore::FontPlatformData::hash const):
+ (WebCore::mapFontWidthVariantToCTFeatureSelector):
+ (WebCore::FontPlatformData::ctFont const):
+ (WebCore::FontPlatformData::description const):
+ * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
+ (WebCore::FontPlatformData::buildScaledFont):
+ * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
+ (WebCore::Font::platformInit):
+ (WebCore::Font::platformWidthForGlyph const):
+ * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
+ (WebCore::fontFeatures):
+ (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
+ * platform/graphics/mac/SimpleFontDataCoreText.cpp:
+ (WebCore::Font::getCFStringAttributes const):
+ * platform/graphics/win/FontCGWin.cpp:
+ (WebCore::FontCascade::drawGlyphs):
+ * platform/graphics/win/FontCascadeDirect2D.cpp:
+ (WebCore::FontCascade::drawGlyphs):
+ * platform/graphics/win/GlyphPageTreeNodeDirect2D.cpp:
+ (WebCore::GlyphPage::fill):
+ * platform/graphics/win/SimpleFontDataDirect2D.cpp:
+ (WebCore::Font::platformInit):
+ (WebCore::Font::platformBoundsForGlyph const):
+ (WebCore::Font::platformWidthForGlyph const):
+ * platform/text/TextFlags.h:
+ * rendering/RenderCombineText.cpp:
+ (WebCore::RenderCombineText::combineTextIfNeeded):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::calculateClipRects const):
+ * rendering/TextPainter.cpp:
+ (WebCore::TextPainter::paintTextWithShadows):
+ * rendering/TextPainter.h:
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::fontAndGlyphOrientation):
+ * rendering/svg/RenderSVGInlineText.cpp:
+ (WebCore::RenderSVGInlineText::computeNewScaledFontForStyle):
+
2018-07-16 Sergio Villar Senin <svil...@igalia.com>
[WebVR] Add support for connect/disconnect and mount/unmount device events
Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (233850 => 233851)
--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h 2018-07-16 17:59:29 UTC (rev 233851)
@@ -3605,16 +3605,16 @@
{
m_primitiveUnitType = CSS_VALUE_ID;
switch (smoothing) {
- case AutoSmoothing:
+ case FontSmoothingMode::AutoSmoothing:
m_value.valueID = CSSValueAuto;
return;
- case NoSmoothing:
+ case FontSmoothingMode::NoSmoothing:
m_value.valueID = CSSValueNone;
return;
- case Antialiased:
+ case FontSmoothingMode::Antialiased:
m_value.valueID = CSSValueAntialiased;
return;
- case SubpixelAntialiased:
+ case FontSmoothingMode::SubpixelAntialiased:
m_value.valueID = CSSValueSubpixelAntialiased;
return;
}
@@ -3629,19 +3629,19 @@
switch (m_value.valueID) {
case CSSValueAuto:
- return AutoSmoothing;
+ return FontSmoothingMode::AutoSmoothing;
case CSSValueNone:
- return NoSmoothing;
+ return FontSmoothingMode::NoSmoothing;
case CSSValueAntialiased:
- return Antialiased;
+ return FontSmoothingMode::Antialiased;
case CSSValueSubpixelAntialiased:
- return SubpixelAntialiased;
+ return FontSmoothingMode::SubpixelAntialiased;
default:
break;
}
ASSERT_NOT_REACHED();
- return AutoSmoothing;
+ return FontSmoothingMode::AutoSmoothing;
}
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmallCaps smallCaps)
@@ -3649,10 +3649,10 @@
{
m_primitiveUnitType = CSS_VALUE_ID;
switch (smallCaps) {
- case FontSmallCapsOff:
+ case FontSmallCaps::Off:
m_value.valueID = CSSValueNormal;
return;
- case FontSmallCapsOn:
+ case FontSmallCaps::On:
m_value.valueID = CSSValueSmallCaps;
return;
}
@@ -3667,14 +3667,14 @@
switch (m_value.valueID) {
case CSSValueSmallCaps:
- return FontSmallCapsOn;
+ return FontSmallCaps::On;
case CSSValueNormal:
- return FontSmallCapsOff;
+ return FontSmallCaps::Off;
default:
break;
}
ASSERT_NOT_REACHED();
- return FontSmallCapsOff;
+ return FontSmallCaps::Off;
}
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextRenderingMode e)
@@ -3682,16 +3682,16 @@
{
m_primitiveUnitType = CSS_VALUE_ID;
switch (e) {
- case AutoTextRendering:
+ case TextRenderingMode::AutoTextRendering:
m_value.valueID = CSSValueAuto;
break;
- case OptimizeSpeed:
+ case TextRenderingMode::OptimizeSpeed:
m_value.valueID = CSSValueOptimizeSpeed;
break;
- case OptimizeLegibility:
+ case TextRenderingMode::OptimizeLegibility:
m_value.valueID = CSSValueOptimizeLegibility;
break;
- case GeometricPrecision:
+ case TextRenderingMode::GeometricPrecision:
m_value.valueID = CSSValueGeometricPrecision;
break;
}
@@ -3703,19 +3703,19 @@
switch (m_value.valueID) {
case CSSValueAuto:
- return AutoTextRendering;
+ return TextRenderingMode::AutoTextRendering;
case CSSValueOptimizeSpeed:
- return OptimizeSpeed;
+ return TextRenderingMode::OptimizeSpeed;
case CSSValueOptimizeLegibility:
- return OptimizeLegibility;
+ return TextRenderingMode::OptimizeLegibility;
case CSSValueGeometricPrecision:
- return GeometricPrecision;
+ return TextRenderingMode::GeometricPrecision;
default:
break;
}
ASSERT_NOT_REACHED();
- return AutoTextRendering;
+ return TextRenderingMode::AutoTextRendering;
}
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Hyphens hyphens)
Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (233850 => 233851)
--- trunk/Source/WebCore/platform/graphics/Font.cpp 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp 2018-07-16 17:59:29 UTC (rev 233851)
@@ -56,10 +56,7 @@
const float emphasisMarkFontSizeMultiplier = 0.5f;
Font::Font(const FontPlatformData& platformData, Origin origin, Interstitial interstitial, Visibility visibility, OrientationFallback orientationFallback)
- : m_maxCharWidth(-1)
- , m_avgCharWidth(-1)
- , m_platformData(platformData)
- , m_mathData(nullptr)
+ : m_platformData(platformData)
, m_origin(origin)
, m_visibility(visibility)
, m_treatAsFixedPitch(false)
@@ -76,7 +73,7 @@
platformGlyphInit();
platformCharWidthInit();
#if ENABLE(OPENTYPE_VERTICAL)
- if (platformData.orientation() == Vertical && orientationFallback == OrientationFallback::No) {
+ if (platformData.orientation() == FontOrientation::Vertical && orientationFallback == OrientationFallback::No) {
m_verticalData = FontCache::singleton().verticalData(platformData);
m_hasVerticalGlyphs = m_verticalData.get() && m_verticalData->hasVerticalMetrics();
}
@@ -390,7 +387,7 @@
{
DerivedFonts& derivedFontData = ensureDerivedFontData();
if (!derivedFontData.verticalRightOrientationFont) {
- auto verticalRightPlatformData = FontPlatformData::cloneWithOrientation(m_platformData, Horizontal);
+ auto verticalRightPlatformData = FontPlatformData::cloneWithOrientation(m_platformData, FontOrientation::Horizontal);
derivedFontData.verticalRightOrientationFont = create(verticalRightPlatformData, origin(), Interstitial::No, Visibility::Visible, OrientationFallback::Yes);
}
ASSERT(derivedFontData.verticalRightOrientationFont != this);
Modified: trunk/Source/WebCore/platform/graphics/Font.h (233850 => 233851)
--- trunk/Source/WebCore/platform/graphics/Font.h 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/graphics/Font.h 2018-07-16 17:59:29 UTC (rev 233851)
@@ -69,19 +69,19 @@
class Font : public RefCounted<Font> {
public:
// Used to create platform fonts.
- enum class Origin {
+ enum class Origin : uint8_t {
Remote,
Local
};
- enum class Interstitial {
+ enum class Interstitial : uint8_t {
Yes,
No
};
- enum class Visibility {
+ enum class Visibility : uint8_t {
Visible,
Invisible
};
- enum class OrientationFallback {
+ enum class OrientationFallback : uint8_t {
Yes,
No
};
@@ -244,8 +244,8 @@
#endif
FontMetrics m_fontMetrics;
- float m_maxCharWidth;
- float m_avgCharWidth;
+ float m_maxCharWidth { -1 };
+ float m_avgCharWidth { -1 };
const FontPlatformData m_platformData;
@@ -260,13 +260,6 @@
RefPtr<OpenTypeVerticalData> m_verticalData;
#endif
- Glyph m_spaceGlyph { 0 };
- float m_spaceWidth { 0 };
- Glyph m_zeroGlyph { 0 };
- float m_adjustedSpaceWidth { 0 };
-
- Glyph m_zeroWidthSpaceGlyph { 0 };
-
struct DerivedFonts {
#if !COMPILER(MSVC)
WTF_MAKE_FAST_ALLOCATED;
@@ -284,10 +277,6 @@
mutable std::unique_ptr<DerivedFonts> m_derivedFontData;
-#if USE(CG) || USE(DIRECT2D) || USE(CAIRO)
- float m_syntheticBoldOffset;
-#endif
-
#if PLATFORM(COCOA)
mutable RetainPtr<CFMutableDictionaryRef> m_nonKernedCFStringAttributes;
mutable RetainPtr<CFMutableDictionaryRef> m_kernedCFStringAttributes;
@@ -302,9 +291,20 @@
mutable SCRIPT_FONTPROPERTIES* m_scriptFontProperties;
#endif
+ Glyph m_spaceGlyph { 0 };
+ Glyph m_zeroGlyph { 0 };
+ Glyph m_zeroWidthSpaceGlyph { 0 };
+
Origin m_origin; // Whether or not we are custom font loaded via @font-face
Visibility m_visibility; // @font-face's internal timer can cause us to show fonts even when a font is being downloaded.
+ float m_spaceWidth { 0 };
+ float m_adjustedSpaceWidth { 0 };
+
+#if USE(CG) || USE(DIRECT2D) || USE(CAIRO)
+ float m_syntheticBoldOffset { 0 };
+#endif
+
unsigned m_treatAsFixedPitch : 1;
unsigned m_isInterstitial : 1; // Whether or not this custom font is the last resort placeholder for a loading font
Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (233850 => 233851)
--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp 2018-07-16 17:59:29 UTC (rev 233851)
@@ -1450,7 +1450,7 @@
inline static float offsetToMiddleOfGlyph(const Font* fontData, Glyph glyph)
{
- if (fontData->platformData().orientation() == Horizontal) {
+ if (fontData->platformData().orientation() == FontOrientation::Horizontal) {
FloatRect bounds = fontData->boundsForGlyph(glyph);
return bounds.x() + bounds.width() / 2;
}
Modified: trunk/Source/WebCore/platform/graphics/FontCascade.h (233850 => 233851)
--- trunk/Source/WebCore/platform/graphics/FontCascade.h 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.h 2018-07-16 17:59:29 UTC (rev 233851)
@@ -103,7 +103,7 @@
WEBCORE_EXPORT FontCascade();
WEBCORE_EXPORT FontCascade(FontCascadeDescription&&, float letterSpacing = 0, float wordSpacing = 0);
// This constructor is only used if the platform wants to start with a native font.
- WEBCORE_EXPORT FontCascade(const FontPlatformData&, FontSmoothingMode = AutoSmoothing);
+ WEBCORE_EXPORT FontCascade(const FontPlatformData&, FontSmoothingMode = FontSmoothingMode::AutoSmoothing);
FontCascade(const FontCascade&);
WEBCORE_EXPORT FontCascade& operator=(const FontCascade&);
@@ -275,9 +275,9 @@
bool advancedTextRenderingMode() const
{
auto textRenderingMode = m_fontDescription.textRenderingMode();
- if (textRenderingMode == GeometricPrecision || textRenderingMode == OptimizeLegibility)
+ if (textRenderingMode == TextRenderingMode::GeometricPrecision || textRenderingMode == TextRenderingMode::OptimizeLegibility)
return true;
- if (textRenderingMode == OptimizeSpeed)
+ if (textRenderingMode == TextRenderingMode::OptimizeSpeed)
return false;
#if PLATFORM(COCOA) || USE(FREETYPE)
return true;
Modified: trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp (233850 => 233851)
--- trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp 2018-07-16 17:59:29 UTC (rev 233851)
@@ -352,7 +352,7 @@
if (systemFallbackShouldBeInvisible)
systemFallbackFont = const_cast<Font*>(&systemFallbackFont->invisibleFont());
- if (systemFallbackFont->platformData().orientation() == Vertical && !systemFallbackFont->hasVerticalGlyphs() && FontCascade::isCJKIdeographOrSymbol(character))
+ if (systemFallbackFont->platformData().orientation() == FontOrientation::Vertical && !systemFallbackFont->hasVerticalGlyphs() && FontCascade::isCJKIdeographOrSymbol(character))
variant = BrokenIdeographVariant;
GlyphData fallbackGlyphData;
@@ -361,7 +361,7 @@
else
fallbackGlyphData = systemFallbackFont->variantFont(description, variant)->glyphDataForCharacter(character);
- if (fallbackGlyphData.font && fallbackGlyphData.font->platformData().orientation() == Vertical && !fallbackGlyphData.font->isTextOrientationFallback()) {
+ if (fallbackGlyphData.font && fallbackGlyphData.font->platformData().orientation() == FontOrientation::Vertical && !fallbackGlyphData.font->isTextOrientationFallback()) {
if (variant == NormalVariant && !FontCascade::isCJKIdeographOrSymbol(character))
fallbackGlyphData = glyphDataForNonCJKCharacterWithGlyphOrientation(character, description.nonCJKGlyphOrientation(), fallbackGlyphData);
}
@@ -421,7 +421,7 @@
data.font = &data.font->invisibleFont();
if (variant == NormalVariant) {
- if (data.font->platformData().orientation() == Vertical && !data.font->isTextOrientationFallback()) {
+ if (data.font->platformData().orientation() == FontOrientation::Vertical && !data.font->isTextOrientationFallback()) {
if (!FontCascade::isCJKIdeographOrSymbol(character))
return glyphDataForNonCJKCharacterWithGlyphOrientation(character, description.nonCJKGlyphOrientation(), data);
@@ -476,7 +476,7 @@
}
break;
}
- if (!font || font->platformData().orientation() == Vertical)
+ if (!font || font->platformData().orientation() == FontOrientation::Vertical)
return nullptr;
if (desiredVisibility == FallbackVisibility::Invisible && font->visibility() == Font::Visibility::Visible)
Modified: trunk/Source/WebCore/platform/graphics/FontDescription.cpp (233850 => 233851)
--- trunk/Source/WebCore/platform/graphics/FontDescription.cpp 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/graphics/FontDescription.cpp 2018-07-16 17:59:29 UTC (rev 233851)
@@ -56,11 +56,11 @@
FontDescription::FontDescription()
: m_fontSelectionRequest { FontCascadeDescription::initialWeight(), FontCascadeDescription::initialStretch(), FontCascadeDescription::initialItalic() }
- , m_orientation(Horizontal)
+ , m_orientation(static_cast<unsigned>(FontOrientation::Horizontal))
, m_nonCJKGlyphOrientation(static_cast<unsigned>(NonCJKGlyphOrientation::Mixed))
- , m_widthVariant(RegularWidth)
+ , m_widthVariant(static_cast<unsigned>(FontWidthVariant::RegularWidth))
, m_renderingMode(static_cast<unsigned>(FontRenderingMode::Normal))
- , m_textRendering(AutoTextRendering)
+ , m_textRendering(static_cast<unsigned>(TextRenderingMode::AutoTextRendering))
, m_script(USCRIPT_COMMON)
, m_fontSynthesis(FontSynthesisWeight | FontSynthesisStyle | FontSynthesisSmallCaps)
, m_variantCommonLigatures(static_cast<unsigned>(FontVariantLigatures::Normal))
@@ -94,7 +94,7 @@
: m_isAbsoluteSize(false)
, m_kerning(static_cast<unsigned>(Kerning::Auto))
, m_keywordSize(0)
- , m_fontSmoothing(AutoSmoothing)
+ , m_fontSmoothing(static_cast<unsigned>(FontSmoothingMode::AutoSmoothing))
, m_isSpecifiedFont(false)
{
}
Modified: trunk/Source/WebCore/platform/graphics/FontDescription.h (233850 => 233851)
--- trunk/Source/WebCore/platform/graphics/FontDescription.h 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/graphics/FontDescription.h 2018-07-16 17:59:29 UTC (rev 233851)
@@ -122,10 +122,10 @@
void setIsItalic(bool i) { setItalic(i ? italicValue() : normalItalicValue()); }
void setWeight(FontSelectionValue weight) { m_fontSelectionRequest.weight = weight; }
void setRenderingMode(FontRenderingMode mode) { m_renderingMode = static_cast<unsigned>(mode); }
- void setTextRenderingMode(TextRenderingMode rendering) { m_textRendering = rendering; }
- void setOrientation(FontOrientation orientation) { m_orientation = orientation; }
+ void setTextRenderingMode(TextRenderingMode rendering) { m_textRendering = static_cast<unsigned>(rendering); }
+ void setOrientation(FontOrientation orientation) { m_orientation = static_cast<unsigned>(orientation); }
void setNonCJKGlyphOrientation(NonCJKGlyphOrientation orientation) { m_nonCJKGlyphOrientation = static_cast<unsigned>(orientation); }
- void setWidthVariant(FontWidthVariant widthVariant) { m_widthVariant = widthVariant; } // Make sure new callers of this sync with FontPlatformData::isForTextCombine()!
+ void setWidthVariant(FontWidthVariant widthVariant) { m_widthVariant = static_cast<unsigned>(widthVariant); } // Make sure new callers of this sync with FontPlatformData::isForTextCombine()!
void setLocale(const AtomicString&);
void setFeatureSettings(FontFeatureSettings&& settings) { m_featureSettings = WTFMove(settings); }
#if ENABLE(VARIATION_FONTS)
@@ -282,7 +282,7 @@
static_assert(CSSValueWebkitXxxLarge - CSSValueXxSmall + 1 == 8, "Maximum keyword size should be 8.");
setKeywordSize(identifier ? identifier - CSSValueXxSmall + 1 : 0);
}
- void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoothing; }
+ void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = static_cast<unsigned>(smoothing); }
void setIsSpecifiedFont(bool isSpecifiedFont) { m_isSpecifiedFont = isSpecifiedFont; }
#if ENABLE(TEXT_AUTOSIZING)
@@ -302,10 +302,10 @@
static FontStyleAxis initialFontStyleAxis() { return FontStyleAxis::slnt; }
static FontSelectionValue initialWeight() { return normalWeightValue(); }
static FontSelectionValue initialStretch() { return normalStretchValue(); }
- static FontSmallCaps initialSmallCaps() { return FontSmallCapsOff; }
+ static FontSmallCaps initialSmallCaps() { return FontSmallCaps::Off; }
static Kerning initialKerning() { return Kerning::Auto; }
- static FontSmoothingMode initialFontSmoothing() { return AutoSmoothing; }
- static TextRenderingMode initialTextRenderingMode() { return AutoTextRendering; }
+ static FontSmoothingMode initialFontSmoothing() { return FontSmoothingMode::AutoSmoothing; }
+ static TextRenderingMode initialTextRenderingMode() { return TextRenderingMode::AutoTextRendering; }
static FontSynthesis initialFontSynthesis() { return FontSynthesisWeight | FontSynthesisStyle | FontSynthesisSmallCaps; }
static FontVariantPosition initialVariantPosition() { return FontVariantPosition::Normal; }
static FontVariantCaps initialVariantCaps() { return FontVariantCaps::Normal; }
Modified: trunk/Source/WebCore/platform/graphics/FontPlatformData.h (233850 => 233851)
--- trunk/Source/WebCore/platform/graphics/FontPlatformData.h 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/graphics/FontPlatformData.h 2018-07-16 17:59:29 UTC (rev 233851)
@@ -76,10 +76,10 @@
FontPlatformData();
FontPlatformData(const FontDescription&, const AtomicString& family);
- FontPlatformData(float size, bool syntheticBold, bool syntheticOblique, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, TextRenderingMode = AutoTextRendering);
+ FontPlatformData(float size, bool syntheticBold, bool syntheticOblique, FontOrientation = FontOrientation::Horizontal, FontWidthVariant = FontWidthVariant::RegularWidth, TextRenderingMode = TextRenderingMode::AutoTextRendering);
#if PLATFORM(COCOA)
- WEBCORE_EXPORT FontPlatformData(CTFontRef, float size, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, TextRenderingMode = AutoTextRendering);
+ WEBCORE_EXPORT FontPlatformData(CTFontRef, float size, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = FontOrientation::Horizontal, FontWidthVariant = FontWidthVariant::RegularWidth, TextRenderingMode = TextRenderingMode::AutoTextRendering);
#endif
static FontPlatformData cloneWithOrientation(const FontPlatformData&, FontOrientation);
@@ -155,7 +155,7 @@
FontOrientation orientation() const { return m_orientation; }
FontWidthVariant widthVariant() const { return m_widthVariant; }
TextRenderingMode textRenderingMode() const { return m_textRenderingMode; }
- bool isForTextCombine() const { return widthVariant() != RegularWidth; } // Keep in sync with callers of FontDescription::setWidthVariant().
+ bool isForTextCombine() const { return widthVariant() != FontWidthVariant::RegularWidth; } // Keep in sync with callers of FontDescription::setWidthVariant().
#if USE(CAIRO)
cairo_scaled_font_t* scaledFont() const { return m_scaledFont.get(); }
@@ -248,9 +248,9 @@
// FIXME: If they're common to all ports, they should move to Font
float m_size { 0 };
- FontOrientation m_orientation { Horizontal };
- FontWidthVariant m_widthVariant { RegularWidth };
- TextRenderingMode m_textRenderingMode { AutoTextRendering };
+ FontOrientation m_orientation { FontOrientation::Horizontal };
+ FontWidthVariant m_widthVariant { FontWidthVariant::RegularWidth };
+ TextRenderingMode m_textRenderingMode { TextRenderingMode::AutoTextRendering };
bool m_syntheticBold { false };
bool m_syntheticOblique { false };
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (233850 => 233851)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2018-07-16 17:59:29 UTC (rev 233851)
@@ -542,7 +542,7 @@
const auto& variations = fontDescription.variationSettings();
auto textRenderingMode = fontDescription.textRenderingMode();
- if (!originalFont || (!features.size() && (!alwaysAddVariations && variations.isEmpty()) && (textRenderingMode == AutoTextRendering) && variantSettings.isAllNormal()
+ if (!originalFont || (!features.size() && (!alwaysAddVariations && variations.isEmpty()) && (textRenderingMode == TextRenderingMode::AutoTextRendering) && variantSettings.isAllNormal()
&& (!fontFaceFeatures || !fontFaceFeatures->size()) && (!fontFaceVariantSettings || fontFaceVariantSettings->isAllNormal())))
return originalFont;
@@ -566,7 +566,7 @@
featuresToBeApplied.set(newFeature.key, newFeature.value);
// Step 5: Other properties (text-rendering)
- if (textRenderingMode == OptimizeSpeed) {
+ if (textRenderingMode == TextRenderingMode::OptimizeSpeed) {
featuresToBeApplied.set(fontFeatureTag("liga"), 0);
featuresToBeApplied.set(fontFeatureTag("clig"), 0);
featuresToBeApplied.set(fontFeatureTag("dlig"), 0);
@@ -653,7 +653,7 @@
}
#endif
- if (textRenderingMode == OptimizeLegibility) {
+ if (textRenderingMode == TextRenderingMode::OptimizeLegibility) {
CGFloat size = CTFontGetSize(originalFont);
auto sizeNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberCGFloatType, &size));
CFDictionaryAddValue(attributes.get(), kCTFontOpticalSizeAttribute, sizeNumber.get());
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm (233850 => 233851)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm 2018-07-16 17:59:29 UTC (rev 233851)
@@ -95,7 +95,7 @@
return;
const FontPlatformData& platformData = font.platformData();
- if (platformData.orientation() == Vertical) {
+ if (platformData.orientation() == FontOrientation::Vertical) {
// FIXME: Implement support for vertical text. See <rdar://problem/13737298>.
return;
}
@@ -143,7 +143,7 @@
const FontPlatformData& platformData = font.platformData();
Vector<CGPoint, 256> positions(count);
- if (platformData.orientation() == Vertical) {
+ if (platformData.orientation() == FontOrientation::Vertical) {
CGAffineTransform rotateLeftTransform = CGAffineTransformMake(0, -1, 1, 0, 0, 0);
CGAffineTransform textMatrix = CGContextGetTextMatrix(context);
CGAffineTransform runMatrix = CGAffineTransformConcat(textMatrix, rotateLeftTransform);
@@ -194,25 +194,25 @@
bool changeFontSmoothing;
switch (smoothingMode) {
- case Antialiased: {
+ case FontSmoothingMode::Antialiased: {
context.setShouldAntialias(true);
shouldSmoothFonts = false;
changeFontSmoothing = true;
break;
}
- case SubpixelAntialiased: {
+ case FontSmoothingMode::SubpixelAntialiased: {
context.setShouldAntialias(true);
shouldSmoothFonts = true;
changeFontSmoothing = true;
break;
}
- case NoSmoothing: {
+ case FontSmoothingMode::NoSmoothing: {
context.setShouldAntialias(false);
shouldSmoothFonts = false;
changeFontSmoothing = true;
break;
}
- case AutoSmoothing: {
+ case FontSmoothingMode::AutoSmoothing: {
shouldSmoothFonts = true;
changeFontSmoothing = false;
break;
@@ -242,7 +242,7 @@
matrix.d = -matrix.d;
if (platformData.syntheticOblique()) {
static float obliqueSkew = tanf(syntheticObliqueAngle() * piFloat / 180);
- if (platformData.orientation() == Vertical) {
+ if (platformData.orientation() == FontOrientation::Vertical) {
if (font.isTextOrientationFallback())
matrix = CGAffineTransformConcat(matrix, CGAffineTransformMake(1, obliqueSkew, 0, 1, 0, 0));
else
@@ -515,7 +515,7 @@
if (baseCharacter >= 0x0600 && baseCharacter <= 0x06ff && font->shouldNotBeUsedForArabic())
continue;
#endif
- if (font->platformData().orientation() == Vertical) {
+ if (font->platformData().orientation() == FontOrientation::Vertical) {
if (isCJKIdeographOrSymbol(baseCharacter) && !font->hasVerticalGlyphs())
font = &font->brokenIdeographFont();
else if (m_fontDescription.nonCJKGlyphOrientation() == NonCJKGlyphOrientation::Mixed) {
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm (233850 => 233851)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm 2018-07-16 17:59:29 UTC (rev 233851)
@@ -163,7 +163,7 @@
}
#endif
- if (platformData().orientation() == Vertical && !isTextOrientationFallback())
+ if (platformData().orientation() == FontOrientation::Vertical && !isTextOrientationFallback())
m_hasVerticalGlyphs = fontHasVerticalGlyphs(m_platformData.ctFont());
#if PLATFORM(IOS)
@@ -179,7 +179,7 @@
CGFloat xHeight = 0;
if (m_platformData.size()) {
- if (platformData().orientation() == Horizontal) {
+ if (platformData().orientation() == FontOrientation::Horizontal) {
// Measure the actual character "x", since it's possible for it to extend below the baseline, and we need the
// reported x-height to only include the portion of the glyph that is above the baseline.
Glyph xGlyph = glyphForCharacter('x');
@@ -572,7 +572,7 @@
FloatRect Font::platformBoundsForGlyph(Glyph glyph) const
{
FloatRect boundingBox;
- boundingBox = CTFontGetBoundingRectsForGlyphs(m_platformData.ctFont(), platformData().orientation() == Vertical ? kCTFontOrientationVertical : kCTFontOrientationHorizontal, &glyph, 0, 1);
+ boundingBox = CTFontGetBoundingRectsForGlyphs(m_platformData.ctFont(), platformData().orientation() == FontOrientation::Vertical ? kCTFontOrientationVertical : kCTFontOrientationHorizontal, &glyph, 0, 1);
boundingBox.setY(-boundingBox.maxY());
if (m_syntheticBoldOffset)
boundingBox.setWidth(boundingBox.width() + m_syntheticBoldOffset);
@@ -583,7 +583,7 @@
float Font::platformWidthForGlyph(Glyph glyph) const
{
CGSize advance = CGSizeZero;
- bool horizontal = platformData().orientation() == Horizontal;
+ bool horizontal = platformData().orientation() == FontOrientation::Horizontal;
CGFontRenderingStyle style = kCGFontRenderingStyleAntialiasing | kCGFontRenderingStyleSubpixelPositioning | kCGFontRenderingStyleSubpixelQuantization | kCGFontAntialiasingStyleUnfiltered;
if (platformData().size()) {
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm (233850 => 233851)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm 2018-07-16 17:59:29 UTC (rev 233851)
@@ -55,7 +55,13 @@
unsigned FontPlatformData::hash() const
{
- uintptr_t flags = static_cast<uintptr_t>(m_widthVariant << 6 | m_isHashTableDeletedValue << 5 | m_textRenderingMode << 3 | m_orientation << 2 | m_syntheticBold << 1 | m_syntheticOblique);
+ uintptr_t flags = static_cast<uintptr_t>(static_cast<unsigned>(m_widthVariant) << 6
+ | m_isHashTableDeletedValue << 5
+ | static_cast<unsigned>(m_textRenderingMode) << 3
+ | static_cast<unsigned>(m_orientation) << 2
+ | m_syntheticBold << 1
+ | m_syntheticOblique);
+
uintptr_t fontHash = reinterpret_cast<uintptr_t>(CFHash(m_font.get()));
uintptr_t hashCodes[] = { fontHash, flags };
return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes);
@@ -80,16 +86,16 @@
inline int mapFontWidthVariantToCTFeatureSelector(FontWidthVariant variant)
{
switch(variant) {
- case RegularWidth:
+ case FontWidthVariant::RegularWidth:
return TextSpacingProportional;
- case HalfWidth:
+ case FontWidthVariant::HalfWidth:
return TextSpacingHalfWidth;
- case ThirdWidth:
+ case FontWidthVariant::ThirdWidth:
return TextSpacingThirdWidth;
- case QuarterWidth:
+ case FontWidthVariant::QuarterWidth:
return TextSpacingQuarterWidth;
}
@@ -151,7 +157,7 @@
ASSERT(m_font);
m_ctFont = adoptCF(CTFontCreateCopyWithAttributes(m_font.get(), m_size, 0, cascadeToLastResortAndVariationsFontDescriptor(m_font.get()).get()));
- if (m_widthVariant != RegularWidth) {
+ if (m_widthVariant != FontWidthVariant::RegularWidth) {
int featureTypeValue = kTextSpacingType;
int featureSelectorValue = mapFontWidthVariantToCTFeatureSelector(m_widthVariant);
RetainPtr<CTFontDescriptorRef> sourceDescriptor = adoptCF(CTFontCopyFontDescriptor(m_ctFont.get()));
@@ -195,7 +201,7 @@
{
auto fontDescription = adoptCF(CFCopyDescription(font()));
return String(fontDescription.get()) + " " + String::number(m_size)
- + (m_syntheticBold ? " synthetic bold" : "") + (m_syntheticOblique ? " synthetic oblique" : "") + (m_orientation ? " vertical orientation" : "");
+ + (m_syntheticBold ? " synthetic bold" : "") + (m_syntheticOblique ? " synthetic oblique" : "") + (m_orientation == FontOrientation::Vertical ? " vertical orientation" : "");
}
#endif
Modified: trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp (233850 => 233851)
--- trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp 2018-07-16 17:59:29 UTC (rev 233851)
@@ -303,10 +303,10 @@
static const float syntheticObliqueSkew = -tanf(14 * acosf(0) / 90);
static const cairo_matrix_t skew = {1, 0, syntheticObliqueSkew, 1, 0, 0};
static const cairo_matrix_t verticalSkew = {1, -syntheticObliqueSkew, 0, 1, 0, 0};
- cairo_matrix_multiply(&fontMatrix, m_orientation == Vertical ? &verticalSkew : &skew, &fontMatrix);
+ cairo_matrix_multiply(&fontMatrix, m_orientation == FontOrientation::Vertical ? &verticalSkew : &skew, &fontMatrix);
}
- if (m_orientation == Vertical) {
+ if (m_orientation == FontOrientation::Vertical) {
// The resulting transformation matrix for vertical glyphs (V) is a
// combination of rotation (R) and translation (T) applied on the
// horizontal matrix (H). V = H . R . T, where R rotates by -90 degrees
Modified: trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp (233850 => 233851)
--- trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp 2018-07-16 17:59:29 UTC (rev 233851)
@@ -110,7 +110,7 @@
if (!xHeight) {
cairo_text_extents_t textExtents;
cairo_scaled_font_text_extents(m_platformData.scaledFont(), "x", &textExtents);
- xHeight = narrowPrecisionToFloat((platformData().orientation() == Horizontal) ? textExtents.height : textExtents.width);
+ xHeight = narrowPrecisionToFloat((platformData().orientation() == FontOrientation::Horizontal) ? textExtents.height : textExtents.width);
}
m_fontMetrics.setAscent(ascent);
@@ -122,9 +122,9 @@
cairo_text_extents_t textExtents;
cairo_scaled_font_text_extents(m_platformData.scaledFont(), " ", &textExtents);
- m_spaceWidth = narrowPrecisionToFloat((platformData().orientation() == Horizontal) ? textExtents.x_advance : -textExtents.y_advance);
+ m_spaceWidth = narrowPrecisionToFloat((platformData().orientation() == FontOrientation::Horizontal) ? textExtents.x_advance : -textExtents.y_advance);
- if ((platformData().orientation() == Vertical) && !isTextOrientationFallback()) {
+ if ((platformData().orientation() == FontOrientation::Vertical) && !isTextOrientationFallback()) {
CairoFtFaceLocker cairoFtFaceLocker(m_platformData.scaledFont());
FT_Face freeTypeFace = cairoFtFaceLocker.ftFace();
m_fontMetrics.setUnitsPerEm(freeTypeFace->units_per_EM);
@@ -183,7 +183,7 @@
cairo_glyph_t cairoGlyph = { glyph, 0, 0 };
cairo_text_extents_t extents;
cairo_scaled_font_glyph_extents(m_platformData.scaledFont(), &cairoGlyph, 1, &extents);
- float width = platformData().orientation() == Horizontal ? extents.x_advance : -extents.y_advance;
+ float width = platformData().orientation() == FontOrientation::Horizontal ? extents.x_advance : -extents.y_advance;
return width ? width : m_spaceWidth;
}
Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp (233850 => 233851)
--- trunk/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp 2018-07-16 17:59:29 UTC (rev 233851)
@@ -89,7 +89,7 @@
{
Vector<hb_feature_t, 4> features;
- if (orientation == Vertical) {
+ if (orientation == FontOrientation::Vertical) {
features.append({ HarfBuzzFace::vertTag, 1, 0, hbEnd });
features.append({ HarfBuzzFace::vrt2Tag, 1, 0, hbEnd });
}
@@ -208,7 +208,7 @@
hb_buffer_add_utf16(buffer.get(), reinterpret_cast<const uint16_t*>(characters), length, run.startIndex, run.endIndex - run.startIndex);
auto& face = fontPlatformData.harfBuzzFace();
- if (fontPlatformData.orientation() == Vertical)
+ if (fontPlatformData.orientation() == FontOrientation::Vertical)
face.setScriptForVerticalGlyphSubstitution(buffer.get());
HbUniquePtr<hb_font_t> harfBuzzFont(face.createFont());
Modified: trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp (233850 => 233851)
--- trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp 2018-07-16 17:59:29 UTC (rev 233851)
@@ -47,7 +47,7 @@
CFDictionarySetValue(attributesDictionary.get(), kCTKernAttributeName, zeroKerningValue);
}
- if (orientation == Vertical)
+ if (orientation == FontOrientation::Vertical)
CFDictionarySetValue(attributesDictionary.get(), kCTVerticalFormsAttributeName, kCFBooleanTrue);
return attributesDictionary.get();
Modified: trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp (233850 => 233851)
--- trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp 2018-07-16 17:59:29 UTC (rev 233851)
@@ -133,22 +133,22 @@
bool shouldUseFontSmoothing = WebCoreShouldUseFontSmoothing();
switch (smoothingMode) {
- case Antialiased: {
+ case FontSmoothingMode::Antialiased: {
graphicsContext.setShouldAntialias(true);
shouldUseFontSmoothing = false;
break;
}
- case SubpixelAntialiased: {
+ case FontSmoothingMode::SubpixelAntialiased: {
graphicsContext.setShouldAntialias(true);
shouldUseFontSmoothing = true;
break;
}
- case NoSmoothing: {
+ case FontSmoothingMode::NoSmoothing: {
graphicsContext.setShouldAntialias(false);
shouldUseFontSmoothing = false;
break;
}
- case AutoSmoothing: {
+ case FontSmoothingMode::AutoSmoothing: {
// For the AutoSmooth case, don't do anything! Keep the default settings.
break;
}
Modified: trunk/Source/WebCore/platform/graphics/win/FontCascadeDirect2D.cpp (233850 => 233851)
--- trunk/Source/WebCore/platform/graphics/win/FontCascadeDirect2D.cpp 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/graphics/win/FontCascadeDirect2D.cpp 2018-07-16 17:59:29 UTC (rev 233851)
@@ -51,19 +51,19 @@
bool shouldUseFontSmoothing = WebCoreShouldUseFontSmoothing();
switch (smoothingMode) {
- case Antialiased:
+ case FontSmoothingMode::Antialiased:
graphicsContext.setShouldAntialias(true);
shouldUseFontSmoothing = false;
break;
- case SubpixelAntialiased:
+ case FontSmoothingMode::SubpixelAntialiased:
graphicsContext.setShouldAntialias(true);
shouldUseFontSmoothing = true;
break;
- case NoSmoothing:
+ case FontSmoothingMode::NoSmoothing:
graphicsContext.setShouldAntialias(false);
shouldUseFontSmoothing = false;
break;
- case AutoSmoothing:
+ case FontSmoothingMode::AutoSmoothing:
// For the AutoSmooth case, don't do anything! Keep the default settings.
break;
default:
@@ -111,7 +111,7 @@
glyphRun.glyphIndices = glyphBuffer.glyphs(from);
glyphRun.glyphAdvances = horizontalAdvances.data();
glyphRun.glyphOffsets = nullptr;
- glyphRun.isSideways = platformData.orientation() == Vertical;
+ glyphRun.isSideways = platformData.orientation() == FontOrientation::Vertical;
glyphRun.bidiLevel = 0;
FloatSize shadowOffset;
Modified: trunk/Source/WebCore/platform/graphics/win/GlyphPageTreeNodeDirect2D.cpp (233850 => 233851)
--- trunk/Source/WebCore/platform/graphics/win/GlyphPageTreeNodeDirect2D.cpp 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/graphics/win/GlyphPageTreeNodeDirect2D.cpp 2018-07-16 17:59:29 UTC (rev 233851)
@@ -64,7 +64,7 @@
Vector<DWRITE_SHAPING_TEXT_PROPERTIES> textProperties(GlyphPage::size);
Vector<DWRITE_SHAPING_GLYPH_PROPERTIES> glyphProperties(GlyphPage::size);
- hr = analyzer->GetGlyphs(buffer, bufferLength, fontPlatformData.dwFontFace(), fontPlatformData.orientation() == Vertical, false,
+ hr = analyzer->GetGlyphs(buffer, bufferLength, fontPlatformData.dwFontFace(), fontPlatformData.orientation() == FontOrientation::Vertical, false,
&helper.m_analysis, nullptr, nullptr, nullptr, nullptr, 0, GlyphPage::size, clusterMap, textProperties.data(),
localGlyphBuffer, glyphProperties.data(), &returnedCount);
if (!SUCCEEDED(hr))
Modified: trunk/Source/WebCore/platform/graphics/win/SimpleFontDataDirect2D.cpp (233850 => 233851)
--- trunk/Source/WebCore/platform/graphics/win/SimpleFontDataDirect2D.cpp 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/graphics/win/SimpleFontDataDirect2D.cpp 2018-07-16 17:59:29 UTC (rev 233851)
@@ -151,7 +151,7 @@
// Measure the actual character "x", since it's possible for it to extend below the baseline, and we need the
// reported x-height to only include the portion of the glyph that is above the baseline.
Vector<DWRITE_GLYPH_METRICS> glyphMetrics(1);
- HRESULT hr = fontFace->GetDesignGlyphMetrics(&xGlyph, 1, glyphMetrics.data(), m_platformData.orientation() == Vertical);
+ HRESULT hr = fontFace->GetDesignGlyphMetrics(&xGlyph, 1, glyphMetrics.data(), m_platformData.orientation() == FontOrientation::Vertical);
RELEASE_ASSERT(SUCCEEDED(hr));
m_fontMetrics.setXHeight(scaleEmToUnits(glyphMetrics.first().verticalOriginY, unitsPerEm) * pointSize);
} else {
@@ -177,10 +177,10 @@
RELEASE_ASSERT(fontFace);
float pointSize = m_platformData.size();
- bool vertical = m_platformData.orientation() == Vertical;
+ bool vertical = m_platformData.orientation() == FontOrientation::Vertical;
Vector<DWRITE_GLYPH_METRICS> glyphMetrics(1);
- HRESULT hr = fontFace->GetDesignGlyphMetrics(&glyph, 1, glyphMetrics.data(), m_platformData.orientation() == Vertical);
+ HRESULT hr = fontFace->GetDesignGlyphMetrics(&glyph, 1, glyphMetrics.data(), m_platformData.orientation() == FontOrientation::Vertical);
RELEASE_ASSERT(SUCCEEDED(hr));
const auto& metrics = glyphMetrics.first();
@@ -214,7 +214,7 @@
auto fontFace = m_platformData.dwFontFace();
RELEASE_ASSERT(fontFace);
- bool isVertical = m_platformData.orientation() == Vertical;
+ bool isVertical = m_platformData.orientation() == FontOrientation::Vertical;
Vector<DWRITE_GLYPH_METRICS> glyphMetrics(1);
HRESULT hr = fontFace->GetDesignGlyphMetrics(&glyph, 1, glyphMetrics.data(), isVertical);
Modified: trunk/Source/WebCore/platform/text/TextFlags.h (233850 => 233851)
--- trunk/Source/WebCore/platform/text/TextFlags.h 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/platform/text/TextFlags.h 2018-07-16 17:59:29 UTC (rev 233851)
@@ -27,17 +27,36 @@
namespace WebCore {
-enum TextRenderingMode { AutoTextRendering, OptimizeSpeed, OptimizeLegibility, GeometricPrecision };
+enum class TextRenderingMode : uint8_t {
+ AutoTextRendering,
+ OptimizeSpeed,
+ OptimizeLegibility,
+ GeometricPrecision
+};
-enum FontSmoothingMode { AutoSmoothing, NoSmoothing, Antialiased, SubpixelAntialiased };
+enum class FontSmoothingMode : uint8_t {
+ AutoSmoothing,
+ NoSmoothing,
+ Antialiased,
+ SubpixelAntialiased
+};
// This setting is used to provide ways of switching between multiple rendering modes that may have different
// metrics. It is used to switch between CG and GDI text on Windows.
-enum class FontRenderingMode { Normal, Alternate };
+enum class FontRenderingMode : uint8_t {
+ Normal,
+ Alternate
+};
-enum FontOrientation { Horizontal, Vertical };
+enum class FontOrientation : uint8_t {
+ Horizontal,
+ Vertical
+};
-enum class NonCJKGlyphOrientation { Mixed, Upright };
+enum class NonCJKGlyphOrientation : uint8_t {
+ Mixed,
+ Upright
+};
// Here, "Leading" and "Trailing" are relevant after the line has been rearranged for bidi.
// ("Leading" means "left" and "Trailing" means "right.")
@@ -329,7 +348,7 @@
FontVariantEastAsianRuby ruby;
};
-enum FontWidthVariant {
+enum class FontWidthVariant : uint8_t {
RegularWidth,
HalfWidth,
ThirdWidth,
@@ -339,11 +358,11 @@
const unsigned FontWidthVariantWidth = 2;
-COMPILE_ASSERT(!(LastFontWidthVariant >> FontWidthVariantWidth), FontWidthVariantWidth_is_correct);
+COMPILE_ASSERT(!(static_cast<unsigned>(FontWidthVariant::LastFontWidthVariant) >> FontWidthVariantWidth), FontWidthVariantWidth_is_correct);
-enum FontSmallCaps {
- FontSmallCapsOff = 0,
- FontSmallCapsOn = 1
+enum class FontSmallCaps : uint8_t {
+ Off = 0,
+ On = 1
};
enum class Kerning : uint8_t {
Modified: trunk/Source/WebCore/rendering/RenderCombineText.cpp (233850 => 233851)
--- trunk/Source/WebCore/rendering/RenderCombineText.cpp 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/rendering/RenderCombineText.cpp 2018-07-16 17:59:29 UTC (rev 233851)
@@ -122,7 +122,7 @@
FontSelector* fontSelector = style().fontCascade().fontSelector();
- description.setOrientation(Horizontal); // We are going to draw combined text horizontally.
+ description.setOrientation(FontOrientation::Horizontal); // We are going to draw combined text horizontally.
FontCascade horizontalFont(FontCascadeDescription { description }, style().fontCascade().letterSpacing(), style().fontCascade().wordSpacing());
horizontalFont.update(fontSelector);
@@ -140,7 +140,7 @@
shouldUpdateFont = m_combineFontStyle->setFontDescription(WTFMove(description)); // Need to change font orientation to horizontal.
else {
// Need to try compressed glyphs.
- static const FontWidthVariant widthVariants[] = { HalfWidth, ThirdWidth, QuarterWidth };
+ static const FontWidthVariant widthVariants[] = { FontWidthVariant::HalfWidth, FontWidthVariant::ThirdWidth, FontWidthVariant::QuarterWidth };
for (auto widthVariant : widthVariants) {
description.setWidthVariant(widthVariant); // When modifying this, make sure to keep it in sync with FontPlatformData::isForTextCombine()!
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (233850 => 233851)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2018-07-16 17:59:29 UTC (rev 233851)
@@ -6405,7 +6405,7 @@
static bool styleHasSmoothingTextMode(const RenderStyle& style)
{
FontSmoothingMode smoothingMode = style.fontDescription().fontSmoothing();
- return smoothingMode == AutoSmoothing || smoothingMode == SubpixelAntialiased;
+ return smoothingMode == FontSmoothingMode::AutoSmoothing || smoothingMode == FontSmoothingMode::SubpixelAntialiased;
}
// Constrain the depth and breadth of the search for performance.
Modified: trunk/Source/WebCore/rendering/TextPainter.cpp (233850 => 233851)
--- trunk/Source/WebCore/rendering/TextPainter.cpp 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/rendering/TextPainter.cpp 2018-07-16 17:59:29 UTC (rev 233851)
@@ -46,8 +46,8 @@
return;
}
- int shadowX = orientation == Horizontal ? shadow->x() : shadow->y();
- int shadowY = orientation == Horizontal ? shadow->y() : -shadow->x();
+ int shadowX = orientation == FontOrientation::Horizontal ? shadow->x() : shadow->y();
+ int shadowY = orientation == FontOrientation::Horizontal ? shadow->y() : -shadow->x();
FloatSize shadowOffset(shadowX, shadowY);
int shadowRadius = shadow->radius();
Color shadowColor = shadow->color();
@@ -130,7 +130,7 @@
if (!opaque)
m_context.setFillColor(Color::black);
while (shadow) {
- ShadowApplier shadowApplier(m_context, shadow, colorFilter, boxRect, lastShadowIterationShouldDrawText, opaque, m_textBoxIsHorizontal ? Horizontal : Vertical);
+ ShadowApplier shadowApplier(m_context, shadow, colorFilter, boxRect, lastShadowIterationShouldDrawText, opaque, m_textBoxIsHorizontal ? FontOrientation::Horizontal : FontOrientation::Vertical);
if (!shadowApplier.nothingToDraw())
paintTextOrEmphasisMarks(font, textRun, emphasisMark, emphasisMarkOffset, textOrigin + shadowApplier.extraOffset(), startOffset, endOffset);
shadow = shadow->next();
Modified: trunk/Source/WebCore/rendering/TextPainter.h (233850 => 233851)
--- trunk/Source/WebCore/rendering/TextPainter.h 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/rendering/TextPainter.h 2018-07-16 17:59:29 UTC (rev 233851)
@@ -104,7 +104,7 @@
class ShadowApplier {
public:
- ShadowApplier(GraphicsContext&, const ShadowData*, const FilterOperations* colorFilter, const FloatRect& textRect, bool lastShadowIterationShouldDrawText = true, bool opaque = false, FontOrientation = Horizontal);
+ ShadowApplier(GraphicsContext&, const ShadowData*, const FilterOperations* colorFilter, const FloatRect& textRect, bool lastShadowIterationShouldDrawText = true, bool opaque = false, FontOrientation = FontOrientation::Horizontal);
FloatSize extraOffset() const { return m_extraOffset; }
bool nothingToDraw() const { return m_nothingToDraw; }
bool didSaveContext() const { return m_didSaveContext; }
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (233850 => 233851)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2018-07-16 17:59:29 UTC (rev 233851)
@@ -2015,18 +2015,18 @@
// FIXME: TextOrientationSideways should map to sideways-left in vertical-lr, which is not supported yet.
if (isHorizontalWritingMode())
- return { Horizontal, NonCJKGlyphOrientation::Mixed };
+ return { FontOrientation::Horizontal, NonCJKGlyphOrientation::Mixed };
switch (textOrientation()) {
case TextOrientation::Mixed:
- return { Vertical, NonCJKGlyphOrientation::Mixed };
+ return { FontOrientation::Vertical, NonCJKGlyphOrientation::Mixed };
case TextOrientation::Upright:
- return { Vertical, NonCJKGlyphOrientation::Upright };
+ return { FontOrientation::Vertical, NonCJKGlyphOrientation::Upright };
case TextOrientation::Sideways:
- return { Horizontal, NonCJKGlyphOrientation::Mixed };
+ return { FontOrientation::Horizontal, NonCJKGlyphOrientation::Mixed };
default:
ASSERT_NOT_REACHED();
- return { Horizontal, NonCJKGlyphOrientation::Mixed };
+ return { FontOrientation::Horizontal, NonCJKGlyphOrientation::Mixed };
}
}
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp (233850 => 233851)
--- trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp 2018-07-16 17:51:28 UTC (rev 233850)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp 2018-07-16 17:59:29 UTC (rev 233851)
@@ -231,7 +231,7 @@
{
// Alter font-size to the right on-screen value to avoid scaling the glyphs themselves, except when GeometricPrecision is specified
scalingFactor = SVGRenderingContext::calculateScreenFontSizeScalingFactor(renderer);
- if (!scalingFactor || style.fontDescription().textRenderingMode() == GeometricPrecision) {
+ if (!scalingFactor || style.fontDescription().textRenderingMode() == TextRenderingMode::GeometricPrecision) {
scalingFactor = 1;
scaledFont = style.fontCascade();
return;