https://bugs.webkit.org/show_bug.cgi?id=48540, support the text-orientation CSS property.
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Mar 2011 20:53:58 +0000 (20:53 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Mar 2011 20:53:58 +0000 (20:53 +0000)
commitac0b1d8d1b27e50dfd90030fb423562ec5e749de
tree6fd52e38a15a7fe018db67e3ba3378f73fbbefad
parent615e954c6d2d0205767e4caf72ae5060c093a58c
https://bugs.webkit.org/show_bug.cgi?id=48540, support the text-orientation CSS property.

Reviewed by Dan Bernstein.

This patch adds support for two values of the text-orientation property (the ones that actually matter): vertical-right and upright.
The TextOrientation is part of the FontDescription and used to look up fonts (similar to FontOrientation).

Orientation of non-CJK characters is done using fallback font data of the appropriate orientation type, e.g., verticalRightOrientation and
uprightOrientation fallback font data.  Vertical right is just implemented as a normal horizontal font.  Upright is implemented as a
vertically oriented font that rotates all glyphs.

The main complication implementing text-orientation is that fonts have "baked-in" vertical glyphs for letters that are hardcoded to
a vertical right facing.  This means that you can use those special vertical glyphs for vertical-right orientation without having to
fall back, but then for upright orientation you have to ignore them and still fall back.  As you can see from the test case, this doesn't
work very well, but hopefully it won't be all that common.  Limitations of CoreText prevent this case from rendering properly in either the
simple or complex code paths, although the simple code path at least gets close.

Added fast/blockflow/text-orientation-basic.html

Source/WebCore:

* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* css/CSSFontFaceSource.cpp:
(WebCore::CSSFontFaceSource::getFontData):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator TextOrientation):
* css/CSSPropertyNames.in:
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyDeclarations):
(WebCore::CSSStyleSelector::applyProperty):
* css/CSSValueKeywords.in:
* loader/cache/CachedFont.cpp:
(WebCore::CachedFont::platformDataFromCustomData):
* loader/cache/CachedFont.h:
* platform/graphics/FontCache.cpp:
(WebCore::FontPlatformDataCacheKey::FontPlatformDataCacheKey):
(WebCore::FontPlatformDataCacheKey::operator==):
(WebCore::computeHash):
(WebCore::FontCache::getCachedFontPlatformData):
* platform/graphics/FontDescription.h:
(WebCore::FontDescription::FontDescription):
(WebCore::FontDescription::textOrientation):
(WebCore::FontDescription::setTextOrientation):
(WebCore::FontDescription::operator==):
* platform/graphics/FontFastPath.cpp:
(WebCore::Font::glyphDataForCharacter):
(WebCore::offsetToMiddleOfGlyph):
* platform/graphics/SimpleFontData.cpp:
(WebCore::SimpleFontData::SimpleFontData):
(WebCore::SimpleFontData::verticalRightOrientationFontData):
(WebCore::SimpleFontData::uprightOrientationFontData):
(WebCore::SimpleFontData::brokenIdeographFontData):
(WebCore::SimpleFontData::DerivedFontData::~DerivedFontData):
* platform/graphics/SimpleFontData.h:
(WebCore::SimpleFontData::hasVerticalGlyphs):
(WebCore::SimpleFontData::isTextOrientationFallback):
* platform/graphics/cairo/FontCustomPlatformData.h:
* platform/graphics/cocoa/FontPlatformData.h:
(WebCore::FontPlatformData::FontPlatformData):
(WebCore::FontPlatformData::textOrientation):
(WebCore::FontPlatformData::hash):
(WebCore::FontPlatformData::operator==):
* platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::FontPlatformData::FontPlatformData):
(WebCore::FontPlatformData::operator=):
* platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData):
* platform/graphics/haiku/FontCustomPlatformData.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData):
* platform/graphics/haiku/FontCustomPlatformData.h:
* platform/graphics/mac/ComplexTextControllerCoreText.cpp:
(WebCore::ComplexTextController::collectComplexTextRunsForCharactersCoreText):
* platform/graphics/mac/FontCacheMac.mm:
(WebCore::FontCache::createFontPlatformData):
* platform/graphics/mac/FontCustomPlatformData.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData):
* platform/graphics/mac/FontCustomPlatformData.h:
* platform/graphics/mac/FontMac.mm:
(WebCore::showGlyphsWithAdvances):
(WebCore::Font::drawGlyphs):
* platform/graphics/mac/GlyphPageTreeNodeMac.cpp:
(WebCore::shouldUseCoreText):
(WebCore::GlyphPage::fill):
* platform/graphics/mac/SimpleFontDataCoreText.cpp:
(WebCore::SimpleFontData::getCFStringAttributes):
* platform/graphics/mac/SimpleFontDataMac.mm:
(WebCore::SimpleFontData::platformInit):
(WebCore::SimpleFontData::platformBoundsForGlyph):
(WebCore::SimpleFontData::platformWidthForGlyph):
* platform/graphics/pango/FontCustomPlatformDataPango.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData):
* platform/graphics/qt/FontCustomPlatformData.h:
* platform/graphics/qt/FontCustomPlatformDataQt.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData):
* platform/graphics/skia/FontCustomPlatformData.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData):
* platform/graphics/skia/FontCustomPlatformData.h:
* platform/graphics/win/FontCustomPlatformData.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData):
* platform/graphics/win/FontCustomPlatformData.h:
* platform/graphics/win/FontCustomPlatformDataCairo.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData):
* platform/graphics/win/FontCustomPlatformDataCairo.h:
* platform/graphics/wince/FontCustomPlatformData.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData):
* platform/graphics/wince/FontCustomPlatformData.h:
* platform/text/TextOrientation.h: Added.
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::requiresIdeographicBaseline):
* rendering/style/RenderStyle.h:
(WebCore::InheritedFlags::initialTextOrientation):

LayoutTests:

* fast/blockflow/text-orientation-basic.html: Added.
* platform/mac/fast/blockflow/text-orientation-basic-expected.checksum: Added.
* platform/mac/fast/blockflow/text-orientation-basic-expected.png: Added.
* platform/mac/fast/blockflow/text-orientation-basic-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@80582 268f45cc-cd09-0410-ab3c-d52691b4dbfc
50 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/blockflow/text-orientation-basic.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/blockflow/text-orientation-basic-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/blockflow/text-orientation-basic-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/blockflow/text-orientation-basic-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSFontFaceSource.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/CSSStyleSelector.cpp
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/loader/cache/CachedFont.cpp
Source/WebCore/loader/cache/CachedFont.h
Source/WebCore/platform/graphics/FontCache.cpp
Source/WebCore/platform/graphics/FontDescription.h
Source/WebCore/platform/graphics/FontFastPath.cpp
Source/WebCore/platform/graphics/SimpleFontData.cpp
Source/WebCore/platform/graphics/SimpleFontData.h
Source/WebCore/platform/graphics/cairo/FontCustomPlatformData.h
Source/WebCore/platform/graphics/cocoa/FontPlatformData.h
Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp
Source/WebCore/platform/graphics/haiku/FontCustomPlatformData.cpp
Source/WebCore/platform/graphics/haiku/FontCustomPlatformData.h
Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
Source/WebCore/platform/graphics/mac/FontCacheMac.mm
Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h
Source/WebCore/platform/graphics/mac/FontMac.mm
Source/WebCore/platform/graphics/mac/GlyphPageTreeNodeMac.cpp
Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp
Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
Source/WebCore/platform/graphics/pango/FontCustomPlatformDataPango.cpp
Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h
Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp
Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp
Source/WebCore/platform/graphics/skia/FontCustomPlatformData.h
Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp
Source/WebCore/platform/graphics/win/FontCustomPlatformData.h
Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp
Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h
Source/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp
Source/WebCore/platform/graphics/wince/FontCustomPlatformData.h
Source/WebCore/platform/text/TextOrientation.h [new file with mode: 0644]
Source/WebCore/rendering/InlineFlowBox.cpp
Source/WebCore/rendering/style/RenderStyle.h