[Vertical Writing Mode] Rename "vertical-right" CSS value to match spec
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Nov 2015 03:53:33 +0000 (03:53 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Nov 2015 03:53:33 +0000 (03:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150766

Reviewed by Darin Adler.

Source/WebCore:

The spec has changed the initial value of text-orientation from "vertical-right"
to "mixed." This patch follows this movement, but also keeps the existing
property working (the parser will treat both values the same).

Test: fast/text/vertical-mixed.html

* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator TextOrientation):
* css/CSSValueKeywords.in:
* css/StyleResolver.cpp:
(WebCore::checkForOrientationChange):
* platform/graphics/FontCascadeFonts.cpp:
(WebCore::glyphDataForNonCJKCharacterWithGlyphOrientation):
* platform/graphics/FontDescription.cpp:
(WebCore::FontDescription::FontDescription):
* platform/graphics/cocoa/FontCascadeCocoa.mm:
(WebCore::FontCascade::fontForCombiningCharacterSequence):
* platform/text/TextFlags.h:
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::getFontAndGlyphOrientation):
* rendering/style/RenderStyle.h:
* rendering/style/RenderStyleConstants.h:
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
* style/StyleResolveForDocument.cpp:
(WebCore::Style::resolveForDocument):

LayoutTests:

* fast/css/getComputedStyle/computed-style-expected.txt:
* fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* fast/css/inherited-properties-rare-text-expected.txt:
* fast/text/vertical-mixed-expected.html: Added.
* fast/text/vertical-mixed.html: Added.
* svg/css/getComputedStyle-basic-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191935 268f45cc-cd09-0410-ab3c-d52691b4dbfc

30 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt
LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
LayoutTests/fast/css/inherited-properties-rare-text-expected.txt
LayoutTests/fast/text/vertical-mixed-expected.html [new file with mode: 0644]
LayoutTests/fast/text/vertical-mixed.html [new file with mode: 0644]
LayoutTests/svg/css/getComputedStyle-basic-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/page/Settings.cpp
Source/WebCore/platform/graphics/FontCascadeFonts.cpp
Source/WebCore/platform/graphics/FontDescription.cpp
Source/WebCore/platform/graphics/FontDescription.h
Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm
Source/WebCore/platform/graphics/win/FontCacheWin.cpp
Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp
Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp
Source/WebCore/platform/text/TextFlags.h
Source/WebCore/platform/win/DragImageWin.cpp
Source/WebCore/rendering/InlineFlowBox.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/RenderStyleConstants.h
Source/WebCore/rendering/style/StyleRareInheritedData.cpp
Source/WebCore/style/StyleResolveForDocument.cpp
Source/WebKit/win/WebKitGraphics.cpp
Source/WebKit/win/WebView.cpp

index 85bd13e..8baf6b0 100644 (file)
@@ -1,5 +1,19 @@
 2015-11-02  Myles C. Maxfield  <mmaxfield@apple.com>
 
+        [Vertical Writing Mode] Rename "vertical-right" CSS value to match spec
+        https://bugs.webkit.org/show_bug.cgi?id=150766
+
+        Reviewed by Darin Adler.
+
+        * fast/css/getComputedStyle/computed-style-expected.txt:
+        * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+        * fast/css/inherited-properties-rare-text-expected.txt:
+        * fast/text/vertical-mixed-expected.html: Added.
+        * fast/text/vertical-mixed.html: Added.
+        * svg/css/getComputedStyle-basic-expected.txt:
+
+2015-11-02  Myles C. Maxfield  <mmaxfield@apple.com>
+
         [Cocoa] Support WOFF2
         https://bugs.webkit.org/show_bug.cgi?id=150830
 
index ac233c0..f99784e 100644 (file)
@@ -217,7 +217,7 @@ perspective-origin: 392px 288px;
 -webkit-text-emphasis-position: over right;
 -webkit-text-emphasis-style: none;
 -webkit-text-fill-color: rgb(0, 0, 0);
--webkit-text-orientation: vertical-right;
+-webkit-text-orientation: mixed;
 -webkit-text-security: none;
 -webkit-text-stroke-color: rgb(0, 0, 0);
 -webkit-text-stroke-width: 0px;
index ab39550..1742169 100644 (file)
@@ -216,7 +216,7 @@ perspective-origin: 50% 50%
 -webkit-text-emphasis-position: over right
 -webkit-text-emphasis-style: none
 -webkit-text-fill-color: rgb(0, 0, 0)
--webkit-text-orientation: vertical-right
+-webkit-text-orientation: mixed
 -webkit-text-security: none
 -webkit-text-stroke-color: rgb(0, 0, 0)
 -webkit-text-stroke-width: 0px
index c9b7837..6023b13 100644 (file)
@@ -3,5 +3,5 @@ test2 font-feature-settings: normal
 test1 -webkit-font-smoothing: antialiased
 test2 -webkit-font-smoothing: auto
 test1 -webkit-text-orientation: upright
-test2 -webkit-text-orientation: vertical-right
+test2 -webkit-text-orientation: mixed
 
diff --git a/LayoutTests/fast/text/vertical-mixed-expected.html b/LayoutTests/fast/text/vertical-mixed-expected.html
new file mode 100644 (file)
index 0000000..e46bbdd
--- /dev/null
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that text-orientation: mixed works the same as text-orientation: vertical-right.
+<div style="font-size: 100px; -webkit-writing-mode: vertical-rl; -webkit-text-orientation: vertical-right;">asdf&#x7f51;</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/vertical-mixed.html b/LayoutTests/fast/text/vertical-mixed.html
new file mode 100644 (file)
index 0000000..4d23d31
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that text-orientation: mixed works the same as text-orientation: vertical-right.
+<div style="-webkit-text-orientation: upright;">
+<div style="font-size: 100px; -webkit-writing-mode: vertical-rl; -webkit-text-orientation: mixed;">asdf&#x7f51;</div>
+</div>
+</body>
+</html>
index 9d87827..a13ef29 100644 (file)
@@ -432,7 +432,7 @@ rect: style.getPropertyValue(-webkit-text-emphasis-style) : none
 rect: style.getPropertyCSSValue(-webkit-text-emphasis-style) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-text-fill-color) : rgb(0, 0, 0)
 rect: style.getPropertyCSSValue(-webkit-text-fill-color) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(-webkit-text-orientation) : vertical-right
+rect: style.getPropertyValue(-webkit-text-orientation) : mixed
 rect: style.getPropertyCSSValue(-webkit-text-orientation) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-text-security) : none
 rect: style.getPropertyCSSValue(-webkit-text-security) : [object CSSPrimitiveValue]
@@ -966,7 +966,7 @@ g: style.getPropertyValue(-webkit-text-emphasis-style) : none
 g: style.getPropertyCSSValue(-webkit-text-emphasis-style) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-text-fill-color) : rgb(0, 0, 0)
 g: style.getPropertyCSSValue(-webkit-text-fill-color) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(-webkit-text-orientation) : vertical-right
+g: style.getPropertyValue(-webkit-text-orientation) : mixed
 g: style.getPropertyCSSValue(-webkit-text-orientation) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-text-security) : none
 g: style.getPropertyCSSValue(-webkit-text-security) : [object CSSPrimitiveValue]
index 3ca7c12..6f89dd1 100644 (file)
@@ -1,5 +1,42 @@
 2015-11-02  Myles C. Maxfield  <mmaxfield@apple.com>
 
+        [Vertical Writing Mode] Rename "vertical-right" CSS value to match spec
+        https://bugs.webkit.org/show_bug.cgi?id=150766
+
+        Reviewed by Darin Adler.
+
+        The spec has changed the initial value of text-orientation from "vertical-right"
+        to "mixed." This patch follows this movement, but also keeps the existing
+        property working (the parser will treat both values the same).
+
+        Test: fast/text/vertical-mixed.html
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue):
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::operator TextOrientation):
+        * css/CSSValueKeywords.in:
+        * css/StyleResolver.cpp:
+        (WebCore::checkForOrientationChange):
+        * platform/graphics/FontCascadeFonts.cpp:
+        (WebCore::glyphDataForNonCJKCharacterWithGlyphOrientation):
+        * platform/graphics/FontDescription.cpp:
+        (WebCore::FontDescription::FontDescription):
+        * platform/graphics/cocoa/FontCascadeCocoa.mm:
+        (WebCore::FontCascade::fontForCombiningCharacterSequence):
+        * platform/text/TextFlags.h:
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::getFontAndGlyphOrientation):
+        * rendering/style/RenderStyle.h:
+        * rendering/style/RenderStyleConstants.h:
+        * rendering/style/StyleRareInheritedData.cpp:
+        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
+        * style/StyleResolveForDocument.cpp:
+        (WebCore::Style::resolveForDocument):
+
+2015-11-02  Myles C. Maxfield  <mmaxfield@apple.com>
+
         [Cocoa] Support WOFF2
         https://bugs.webkit.org/show_bug.cgi?id=150830
 
index 1ad1b2f..c84d781 100644 (file)
@@ -3107,8 +3107,7 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
         return parseTextEmphasisPosition(important);
 
     case CSSPropertyWebkitTextOrientation:
-        // FIXME: For now just support sideways, sideways-right, upright and vertical-right.
-        if (id == CSSValueSideways || id == CSSValueSidewaysRight || id == CSSValueVerticalRight || id == CSSValueUpright)
+        if (id == CSSValueSideways || id == CSSValueSidewaysRight || id == CSSValueVerticalRight || id == CSSValueMixed || id == CSSValueUpright)
             validPrimitive = true;
         break;
 
index 6fdc5b4..dc8b4d5 100644 (file)
@@ -3331,16 +3331,16 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextOrientation e)
 {
     m_primitiveUnitType = CSS_VALUE_ID;
     switch (e) {
-    case TextOrientationSideways:
+    case TextOrientation::Sideways:
         m_value.valueID = CSSValueSideways;
         break;
-    case TextOrientationSidewaysRight:
+    case TextOrientation::SidewaysRight:
         m_value.valueID = CSSValueSidewaysRight;
         break;
-    case TextOrientationVerticalRight:
-        m_value.valueID = CSSValueVerticalRight;
+    case TextOrientation::Mixed:
+        m_value.valueID = CSSValueMixed;
         break;
-    case TextOrientationUpright:
+    case TextOrientation::Upright:
         m_value.valueID = CSSValueUpright;
         break;
     }
@@ -3352,19 +3352,21 @@ template<> inline CSSPrimitiveValue::operator TextOrientation() const
 
     switch (m_value.valueID) {
     case CSSValueSideways:
-        return TextOrientationSideways;
+        return TextOrientation::Sideways;
     case CSSValueSidewaysRight:
-        return TextOrientationSidewaysRight;
+        return TextOrientation::SidewaysRight;
     case CSSValueVerticalRight:
-        return TextOrientationVerticalRight;
+        return TextOrientation::Mixed;
+    case CSSValueMixed:
+        return TextOrientation::Mixed;
     case CSSValueUpright:
-        return TextOrientationUpright;
+        return TextOrientation::Upright;
     default:
         break;
     }
 
     ASSERT_NOT_REACHED();
-    return TextOrientationVerticalRight;
+    return TextOrientation::Mixed;
 }
 
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPointerEvents e)
index b4aa125..bdc4259 100644 (file)
@@ -1035,6 +1035,7 @@ sideways
 sideways-right
 upright
 vertical-right
+mixed
 
 // -webkit-line-box-contain
 font
index 63ed223..e3b0f68 100644 (file)
@@ -1375,7 +1375,7 @@ static void checkForOrientationChange(RenderStyle* style)
 {
     FontOrientation fontOrientation;
     NonCJKGlyphOrientation glyphOrientation;
-    style->getFontAndGlyphOrientation(fontOrientation, glyphOrientation);
+    std::tie(fontOrientation, glyphOrientation) = style->fontAndGlyphOrientation();
 
     const auto& fontDescription = style->fontDescription();
     if (fontDescription.orientation() == fontOrientation && fontDescription.nonCJKGlyphOrientation() == glyphOrientation)
index b109503..ccb2af5 100644 (file)
@@ -503,7 +503,7 @@ void Settings::setFontRenderingMode(FontRenderingMode mode)
 {
     if (fontRenderingMode() == mode)
         return;
-    m_fontRenderingMode = mode;
+    m_fontRenderingMode = static_cast<int>(mode);
     if (m_page)
         m_page->setNeedsRecalcStyleInAllFrames();
 }
index a289cf4..61ea0ae 100644 (file)
@@ -294,7 +294,7 @@ static GlyphData glyphDataForCJKCharacterWithoutSyntheticItalic(UChar32 characte
     
 static GlyphData glyphDataForNonCJKCharacterWithGlyphOrientation(UChar32 character, NonCJKGlyphOrientation orientation, const GlyphData& data)
 {
-    if (orientation == NonCJKGlyphOrientationUpright || shouldIgnoreRotation(character)) {
+    if (orientation == NonCJKGlyphOrientation::Upright || shouldIgnoreRotation(character)) {
         GlyphData uprightData = data.font->uprightOrientationFont().glyphDataForCharacter(character);
         // If the glyphs are the same, then we know we can just use the horizontal glyph rotated vertically to be upright.
         if (data.glyph == uprightData.glyph)
@@ -303,7 +303,7 @@ static GlyphData glyphDataForNonCJKCharacterWithGlyphOrientation(UChar32 charact
         // glyph, so we fall back to the upright data and use the horizontal glyph.
         if (uprightData.font)
             return uprightData;
-    } else if (orientation == NonCJKGlyphOrientationVerticalRight) {
+    } else if (orientation == NonCJKGlyphOrientation::Mixed) {
         GlyphData verticalRightData = data.font->verticalRightOrientationFont().glyphDataForCharacter(character);
         // If the glyphs are distinct, we will make the assumption that the font has a vertical-right glyph baked
         // into it.
index ad271d5..40d0744 100644 (file)
@@ -46,12 +46,12 @@ COMPILE_ASSERT(sizeof(FontCascadeDescription) == sizeof(SameSizeAsFontCascadeDes
 
 FontDescription::FontDescription()
     : m_orientation(Horizontal)
-    , m_nonCJKGlyphOrientation(NonCJKGlyphOrientationVerticalRight)
+    , m_nonCJKGlyphOrientation(static_cast<unsigned>(NonCJKGlyphOrientation::Mixed))
     , m_widthVariant(RegularWidth)
     , m_italic(FontItalicOff)
     , m_smallCaps(FontSmallCapsOff)
     , m_weight(FontWeightNormal)
-    , m_renderingMode(NormalRenderingMode)
+    , m_renderingMode(static_cast<unsigned>(FontRenderingMode::Normal))
     , m_textRendering(AutoTextRendering)
     , m_script(USCRIPT_COMMON)
     , m_fontSynthesis(FontSynthesisWeight | FontSynthesisStyle)
index 9cf8549..b3ca70d 100644 (file)
@@ -101,10 +101,10 @@ public:
     void setSmallCaps(FontSmallCaps c) { m_smallCaps = c; }
     void setIsSmallCaps(bool c) { setSmallCaps(c ? FontSmallCapsOn : FontSmallCapsOff); }
     void setWeight(FontWeight w) { m_weight = w; }
-    void setRenderingMode(FontRenderingMode mode) { m_renderingMode = mode; }
+    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 setNonCJKGlyphOrientation(NonCJKGlyphOrientation orientation) { m_nonCJKGlyphOrientation = 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 setScript(UScriptCode s) { m_script = s; }
     void setFeatureSettings(FontFeatureSettings&& settings) { m_featureSettings = WTF::move(settings); }
index 6838695..839ca03 100644 (file)
@@ -700,7 +700,7 @@ const Font* FontCascade::fontForCombiningCharacterSequence(const UChar* characte
     GlyphData baseCharacterGlyphData = glyphDataForCharacter(baseCharacter, false, variant);
 
     if (!baseCharacterGlyphData.glyph)
-        return 0;
+        return nullptr;
 
     if (length == baseCharacterLength)
         return baseCharacterGlyphData.font;
@@ -720,7 +720,7 @@ const Font* FontCascade::fontForCombiningCharacterSequence(const UChar* characte
                 if (isCJKIdeographOrSymbol(baseCharacter) && !font->hasVerticalGlyphs()) {
                     variant = BrokenIdeographVariant;
                     font = &font->brokenIdeographFont();
-                } else if (m_fontDescription.nonCJKGlyphOrientation() == NonCJKGlyphOrientationVerticalRight) {
+                } else if (m_fontDescription.nonCJKGlyphOrientation() == NonCJKGlyphOrientation::Mixed) {
                     const Font& verticalRightFont = font->verticalRightOrientationFont();
                     Glyph verticalRightGlyph = verticalRightFont.glyphForCharacter(baseCharacter);
                     if (verticalRightGlyph == baseCharacterGlyphData.glyph)
index fe02d25..b4f1cb5 100644 (file)
@@ -569,7 +569,7 @@ std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(const FontDe
     if (equalIgnoringCase(family, lucidaStr))
         isLucidaGrande = true;
 
-    bool useGDI = fontDescription.renderingMode() == AlternateRenderingMode && !isLucidaGrande;
+    bool useGDI = fontDescription.renderingMode() == FontRenderingMode::Alternate && !isLucidaGrande;
 
     // The logical size constant is 32. We do this for subpixel precision when rendering using Uniscribe.
     // This masks rounding errors related to the HFONT metrics being  different from the CGFont metrics.
index f770b99..0658a85 100644 (file)
@@ -52,7 +52,7 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription&
     memcpy(logFont.lfFaceName, m_name.charactersWithNullTermination().data(), sizeof(logFont.lfFaceName[0]) * std::min<size_t>(static_cast<size_t>(LF_FACESIZE), 1 + m_name.length()));
 
     logFont.lfHeight = -size;
-    if (renderingMode == NormalRenderingMode)
+    if (renderingMode == FontRenderingMode::Normal)
         logFont.lfHeight *= 32;
     logFont.lfWidth = 0;
     logFont.lfEscapement = 0;
@@ -69,7 +69,7 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription&
     auto hfont = adoptGDIObject(::CreateFontIndirect(&logFont));
 
     RetainPtr<CGFontRef> cgFont = adoptCF(CGFontCreateWithPlatformFont(&logFont));
-    return FontPlatformData(WTF::move(hfont), cgFont.get(), size, bold, italic, renderingMode == AlternateRenderingMode);
+    return FontPlatformData(WTF::move(hfont), cgFont.get(), size, bold, italic, renderingMode == FontRenderingMode::Alternate);
 }
 
 // Creates a unique and unpredictable font name, in order to avoid collisions and to
index 28db21f..d65ea69 100644 (file)
@@ -49,7 +49,7 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription&
     wcsncpy(logFont.lfFaceName, m_name.charactersWithNullTermination().data(), LF_FACESIZE - 1);
 
     logFont.lfHeight = -size;
-    if (renderingMode == NormalRenderingMode)
+    if (renderingMode == FontRenderingMode::Normal)
         logFont.lfHeight *= 32;
     logFont.lfWidth = 0;
     logFont.lfEscapement = 0;
index 043fd2b..c142d4e 100644 (file)
@@ -43,11 +43,11 @@ enum FontSmoothingMode { AutoSmoothing, NoSmoothing, Antialiased, SubpixelAntial
 
 // 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 FontRenderingMode { NormalRenderingMode, AlternateRenderingMode };
+enum class FontRenderingMode { Normal, Alternate };
 
 enum FontOrientation { Horizontal, Vertical };
 
-enum NonCJKGlyphOrientation { NonCJKGlyphOrientationVerticalRight, NonCJKGlyphOrientationUpright };
+enum class NonCJKGlyphOrientation { Mixed, Upright };
 
 // Here, "Leading" and "Trailing" are relevant after the line has been rearranged for bidi.
 // ("Leading" means "left" and "Trailing" means "right.")
index 97b58f1..7f3fe34 100644 (file)
@@ -126,14 +126,14 @@ DragImageRef createDragImageForLink(URL& url, const String& inLabel, FontRenderi
     const FontCascade* labelFont;
     const FontCascade* urlFont;
 
-    if (fontRenderingMode == AlternateRenderingMode) {
-        static const FontCascade alternateRenderingModeLabelFont = dragLabelFont(DragLinkLabelFontsize, true, AlternateRenderingMode);
-        static const FontCascade alternateRenderingModeURLFont = dragLabelFont(DragLinkUrlFontSize, false, AlternateRenderingMode);
+    if (fontRenderingMode == FontRenderingMode::Alternate) {
+        static const FontCascade alternateRenderingModeLabelFont = dragLabelFont(DragLinkLabelFontsize, true, FontRenderingMode::Alternate);
+        static const FontCascade alternateRenderingModeURLFont = dragLabelFont(DragLinkUrlFontSize, false, FontRenderingMode::Alternate);
         labelFont = &alternateRenderingModeLabelFont;
         urlFont = &alternateRenderingModeURLFont;
     } else {
-        static const FontCascade normalRenderingModeLabelFont = dragLabelFont(DragLinkLabelFontsize, true, NormalRenderingMode);
-        static const FontCascade normalRenderingModeURLFont = dragLabelFont(DragLinkUrlFontSize, false, NormalRenderingMode);
+        static const FontCascade normalRenderingModeLabelFont = dragLabelFont(DragLinkLabelFontsize, true, FontRenderingMode::Normal);
+        static const FontCascade normalRenderingModeURLFont = dragLabelFont(DragLinkUrlFontSize, false, FontRenderingMode::Normal);
         labelFont = &normalRenderingModeLabelFont;
         urlFont = &normalRenderingModeURLFont;
     }
index 9a5c58f..3989119 100644 (file)
@@ -455,7 +455,7 @@ bool InlineFlowBox::requiresIdeographicBaseline(const GlyphOverflowAndFallbackFo
         return false;
 
     const RenderStyle& lineStyle = this->lineStyle();
-    if (lineStyle.fontDescription().nonCJKGlyphOrientation() == NonCJKGlyphOrientationUpright
+    if (lineStyle.fontDescription().nonCJKGlyphOrientation() == NonCJKGlyphOrientation::Upright
         || lineStyle.fontCascade().primaryFont().hasVerticalGlyphs())
         return true;
 
index 1fb0058..fecbb59 100644 (file)
@@ -1819,42 +1819,25 @@ LayoutBoxExtent RenderStyle::imageOutsets(const NinePieceImage& image) const
                            NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth()));
 }
 
-void RenderStyle::getFontAndGlyphOrientation(FontOrientation& fontOrientation, NonCJKGlyphOrientation& glyphOrientation)
+std::pair<FontOrientation, NonCJKGlyphOrientation> RenderStyle::fontAndGlyphOrientation()
 {
-    if (isHorizontalWritingMode()) {
-        fontOrientation = Horizontal;
-        glyphOrientation = NonCJKGlyphOrientationVerticalRight;
-        return;
-    }
+    // FIXME: TextOrientationSideways should map to sideways-left in vertical-lr, which is not supported yet.
+
+    if (isHorizontalWritingMode())
+        return { Horizontal, NonCJKGlyphOrientation::Mixed };
 
     switch (textOrientation()) {
-    case TextOrientationVerticalRight:
-        fontOrientation = Vertical;
-        glyphOrientation = NonCJKGlyphOrientationVerticalRight;
-        return;
-    case TextOrientationUpright:
-        fontOrientation = Vertical;
-        glyphOrientation = NonCJKGlyphOrientationUpright;
-        return;
-    case TextOrientationSideways:
-        if (writingMode() == LeftToRightWritingMode) {
-            // FIXME: This should map to sideways-left, which is not supported yet.
-            fontOrientation = Vertical;
-            glyphOrientation = NonCJKGlyphOrientationVerticalRight;
-            return;
-        }
-        fontOrientation = Horizontal;
-        glyphOrientation = NonCJKGlyphOrientationVerticalRight;
-        return;
-    case TextOrientationSidewaysRight:
-        fontOrientation = Horizontal;
-        glyphOrientation = NonCJKGlyphOrientationVerticalRight;
-        return;
+    case TextOrientation::Mixed:
+        return { Vertical, NonCJKGlyphOrientation::Mixed };
+    case TextOrientation::Upright:
+        return { Vertical, NonCJKGlyphOrientation::Upright };
+    case TextOrientation::Sideways:
+        return { Horizontal, NonCJKGlyphOrientation::Mixed };
+    case TextOrientation::SidewaysRight:
+        return { Horizontal, NonCJKGlyphOrientation::Mixed };
     default:
         ASSERT_NOT_REACHED();
-        fontOrientation = Horizontal;
-        glyphOrientation = NonCJKGlyphOrientationVerticalRight;
-        return;
+        return { Horizontal, NonCJKGlyphOrientation::Mixed };
     }
 }
 
index 565f8a4..2b64507 100644 (file)
@@ -710,7 +710,7 @@ public:
     float specifiedFontSize() const;
     float computedFontSize() const;
     int fontSize() const;
-    void getFontAndGlyphOrientation(FontOrientation&, NonCJKGlyphOrientation&);
+    std::pair<FontOrientation, NonCJKGlyphOrientation> fontAndGlyphOrientation();
 
 #if ENABLE(TEXT_AUTOSIZING)
     float textAutosizingMultiplier() const { return visual->m_textAutosizingMultiplier; }
@@ -1904,7 +1904,8 @@ public:
     static TextDirection initialDirection() { return LTR; }
     static WritingMode initialWritingMode() { return TopToBottomWritingMode; }
     static TextCombine initialTextCombine() { return TextCombineNone; }
-    static TextOrientation initialTextOrientation() { return TextOrientationVerticalRight; }
+    static TextOrientation initialTextOrientation() { return TextOrientation::
+    Mixed; }
     static ObjectFit initialObjectFit() { return ObjectFitFill; }
     static EEmptyCell initialEmptyCells() { return SHOW; }
     static EListStylePosition initialListStylePosition() { return OUTSIDE; }
@@ -2286,10 +2287,10 @@ inline bool RenderStyle::setEffectiveZoom(float f)
 
 inline bool RenderStyle::setTextOrientation(TextOrientation textOrientation)
 {
-    if (compareEqual(rareInheritedData->m_textOrientation, textOrientation))
+    if (compareEqual(rareInheritedData->m_textOrientation, static_cast<unsigned>(textOrientation)))
         return false;
 
-    rareInheritedData.access()->m_textOrientation = textOrientation;
+    rareInheritedData.access()->m_textOrientation = static_cast<unsigned>(textOrientation);
     return true;
 }
 
index 3434280..cc4c541 100644 (file)
@@ -586,7 +586,7 @@ enum TextEmphasisPositions {
 };
 typedef unsigned TextEmphasisPosition;
 
-enum TextOrientation { TextOrientationVerticalRight, TextOrientationUpright, TextOrientationSideways, TextOrientationSidewaysRight };
+enum class TextOrientation { Mixed, Upright, Sideways, SidewaysRight };
 
 enum TextOverflow { TextOverflowClip = 0, TextOverflowEllipsis };
 
index 4306f60..ff87796 100644 (file)
@@ -92,7 +92,7 @@ StyleRareInheritedData::StyleRareInheritedData()
     , textEmphasisFill(TextEmphasisFillFilled)
     , textEmphasisMark(TextEmphasisMarkNone)
     , textEmphasisPosition(TextEmphasisPositionOver | TextEmphasisPositionRight)
-    , m_textOrientation(TextOrientationVerticalRight)
+    , m_textOrientation(static_cast<unsigned>(TextOrientation::Mixed))
 #if ENABLE(CSS3_TEXT)
     , m_textIndentLine(RenderStyle::initialTextIndentLine())
     , m_textIndentType(RenderStyle::initialTextIndentType())
index 198cdc8..4bcb4c4 100644 (file)
@@ -109,7 +109,7 @@ Ref<RenderStyle> resolveForDocument(const Document& document)
 
     FontOrientation fontOrientation;
     NonCJKGlyphOrientation glyphOrientation;
-    documentStyle.get().getFontAndGlyphOrientation(fontOrientation, glyphOrientation);
+    std::tie(fontOrientation, glyphOrientation) = documentStyle.get().fontAndGlyphOrientation();
     fontDescription.setOrientation(fontOrientation);
     fontDescription.setNonCJKGlyphOrientation(glyphOrientation);
 
index 04196d2..f94ae8b 100644 (file)
@@ -62,7 +62,7 @@ static FontCascade makeFont(const WebFontDescription& description)
 
     FontSmoothingType smoothingType;
     if (SUCCEEDED(WebPreferences::sharedStandardPreferences()->fontSmoothing(&smoothingType)))
-        f.setRenderingMode(smoothingType == FontSmoothingTypeWindows ? AlternateRenderingMode : NormalRenderingMode);
+        f.setRenderingMode(smoothingType == FontSmoothingTypeWindows ? FontRenderingMode::Alternate : FontRenderingMode::Normal);
 
     FontCascade font(f, 0, 0);
     font.update(0);
index 6fa1a67..9f4c06d 100644 (file)
@@ -5140,7 +5140,7 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
     hr = preferences->fontSmoothing(&smoothingType);
     if (FAILED(hr))
         return hr;
-    settings.setFontRenderingMode(smoothingType != FontSmoothingTypeWindows ? NormalRenderingMode : AlternateRenderingMode);
+    settings.setFontRenderingMode(smoothingType != FontSmoothingTypeWindows ? FontRenderingMode::Normal : FontRenderingMode::Alternate);
 
 #if USE(AVFOUNDATION)
     hr = preferences->avFoundationEnabled(&enabled);