12011-01-19 takano takumi <takano@apple.com>
2
3 Reviewed by NOBODY (OOPS!).
4
5 Implement text-combine rendering code
6 https://bugs.webkit.org/show_bug.cgi?id=50621
7
8 Test: fast/text/international/text-combine-image-test.html
9
10 * Android.mk: Added RenderCombineText.cpp/h
11 * CMakeLists.txt: Added RenderCombineText.cpp/h
12 * GNUmakefile.am: Added RenderCombineText.cpp/h
13 * WebCore.exp.in:
14 * WebCore.gypi: Added RenderCombineText.cpp/h
15 * WebCore.pro: Added RenderCombineText.cpp/h
16 * WebCore.vcproj/WebCore.vcproj: Added RenderCombineText.cpp/h
17 * WebCore.xcodeproj/project.pbxproj: Added RenderCombineText.cpp/h
18 * css/CSSFontFaceSource.cpp:
19 (WebCore::CSSFontFaceSource::getFontData):
20 - Added fontDescription.widthVariant to SimpleFontData creation.
21 * css/CSSStyleSelector.cpp:
22 (WebCore::CSSStyleSelector::applyProperty):
23 - Changed to set "Unique" flag to RenderStyle in case of TextCombine.
24 * dom/Text.cpp:
25 (WebCore::Text::createRenderer):
26 - Changed to create RenderCombineText in case of TextCombine.
27 * loader/cache/CachedFont.cpp:
28 (WebCore::CachedFont::platformDataFromCustomData):
29 - Added FontWidthVariant as an argument for FontPlatformData creation.
30 * loader/cache/CachedFont.h:
31 - Ditto.
32 * platform/graphics/Font.h:
33 (WebCore::Font::widthVariant):
34 - The accessor to FontWidthVariant member variable.
35 * platform/graphics/FontCache.cpp:
36 - Made cache to incorporate FontWidthVariant value.
37 (WebCore::FontPlatformDataCacheKey::FontPlatformDataCacheKey):
38 (WebCore::FontPlatformDataCacheKey::operator==):
39 (WebCore::computeHash):
40 (WebCore::FontCache::getCachedFontPlatformData):
41 * platform/graphics/FontDescription.h:
42 - Add a member variable that holds a width variant - none, half-width, third-width, and quarter-width.
43 (WebCore::FontDescription::FontDescription):
44 (WebCore::FontDescription::widthVariant):
45 (WebCore::FontDescription::setWidthVariant):
46 (WebCore::FontDescription::operator==):
47 * platform/graphics/FontWidthVariant.h: Added.
48 * platform/graphics/cairo/FontCustomPlatformData.h:
49 - Changed to carry FontWidthVariant value.
50 * platform/graphics/cocoa/FontPlatformData.h:
51 - Changed to carry FontWidthVariant value.
52 (WebCore::FontPlatformData::FontPlatformData):
53 (WebCore::FontPlatformData::widthVariant):
54 (WebCore::FontPlatformData::hash):
55 (WebCore::FontPlatformData::operator==):
56 * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
57 (WebCore::FontPlatformData::FontPlatformData):
58 - Changed to carry FontWidthVariant value.
59 (WebCore::FontPlatformData::operator=):
60 - Ditto.
61 (WebCore::FontPlatformData::ctFont):
62 - Changed to create CTFont with text spacing variant based on FontWidthVariant.
63 * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
64 (WebCore::FontCustomPlatformData::fontPlatformData):
65 - Changed to carry FontWidthVariant value.
66 * platform/graphics/haiku/FontCustomPlatformData.cpp:
67 (WebCore::FontCustomPlatformData::fontPlatformData):
68 - Changed to carry FontWidthVariant value.
69 * platform/graphics/haiku/FontCustomPlatformData.h:
70 * platform/graphics/mac/FontCacheMac.mm:
71 (WebCore::FontCache::createFontPlatformData):
72 - Changed to carry FontWidthVariant value.
73 * platform/graphics/mac/FontCustomPlatformData.cpp:
74 (WebCore::FontCustomPlatformData::fontPlatformData):
75 - Changed to carry FontWidthVariant value.
76 * platform/graphics/mac/FontCustomPlatformData.h:
77 - Ditto.
78 * platform/graphics/mac/GlyphPageTreeNodeMac.cpp:
79 (WebCore::shouldUseCoreText):
80 - Changed to skip CT path when width variant is specified.
81 * platform/graphics/pango/FontCustomPlatformDataPango.cpp:
82 (WebCore::FontCustomPlatformData::fontPlatformData):
83 - Ditto.
84 * platform/graphics/qt/FontCustomPlatformData.h:
85 - Ditto.
86 * platform/graphics/qt/FontCustomPlatformDataQt.cpp:
87 (WebCore::FontCustomPlatformData::fontPlatformData):
88 - Ditto.
89 * platform/graphics/skia/FontCustomPlatformData.cpp:
90 (WebCore::FontCustomPlatformData::fontPlatformData):
91 - Ditto.
92 * platform/graphics/skia/FontCustomPlatformData.h:
93 - Ditto.
94 * platform/graphics/win/FontCustomPlatformData.cpp:
95 (WebCore::FontCustomPlatformData::fontPlatformData):
96 - Ditto.
97 * platform/graphics/win/FontCustomPlatformData.h:
98 - Ditto.
99 * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
100 - Ditto.
101 (WebCore::FontCustomPlatformData::fontPlatformData):
102 - Ditto.
103 * platform/graphics/win/FontCustomPlatformDataCairo.h:
104 - Ditto.
105 * platform/graphics/wince/FontCustomPlatformData.cpp:
106 (WebCore::FontCustomPlatformData::fontPlatformData):
107 - Ditto.
108 * platform/graphics/wince/FontCustomPlatformData.h:
109 - Ditto.
110 * platform/graphics/wx/FontCustomPlatformData.cpp:
111 (WebCore::FontCustomPlatformData::fontPlatformData):
112 - Ditto.
113 * platform/graphics/wx/FontCustomPlatformData.h:
114 - Ditto.
115 * rendering/InlineTextBox.cpp:
116 (WebCore::InlineTextBox::paint):
117 - In case of RenderCombineText, we don't rotate text even in vertical writing. Also, we render original text
118 instead of text returned from text().
119 * rendering/RenderBlockLineLayout.cpp:
120 (WebCore::textWidth):
121 - Made to always use the render object's width() in case of TextCombine.
122 (WebCore::RenderBlock::findNextLineBreak):
123 - Made to call RenderCombinedText's prepareTextCombine() here.
124 * rendering/RenderCombineText.cpp: Added. A subclass of RenderText.
125 (WebCore::RenderCombineText::RenderCombineText):
126 (WebCore::RenderCombineText::styleDidChange):
127 - Clear the flag that indicated the font has been prepared for combining. The font will be reinitialized in
128 the next call of RenderBlock::findNextLineBreak().
129 (WebCore::RenderCombineText::setTextInternal):
130 - Ditto.
131 (WebCore::RenderCombineText::widthFromCache):
132 - Returns 1-em width in case of font combine.
133 (WebCore::RenderCombineText::width):
134 - Ditto.
135 (WebCore::RenderCombineText::adjustTextOrigin):
136 - Adjust drawing origin point in case of font combine.
137 (WebCore::RenderCombineText::charactersToRender):
138 - Return original text instead of current text in case of font combine.
139 (WebCore::RenderCombineText::prepareTextCombine):
140 - This function tries to pack passed text with; 1) the current font as is, 2) the font created
141 from the descriptor with half-width variant specified, 3) the font with third-width variant, 4) the font
142 with quarter-width variant.
143 - If a suitable font successfully found, replace the current font with the new font. If no appropriate font found,
144 we give up text-combine as the CSS spec describes.
145 - If a new font found, we replace the text with 0xFFFC. This is needed for a combined text block to be able to
146 behave like a single character against text decorations.
147 * rendering/RenderCombineText.h: Added. A subclass of RenderText.
148 (WebCore::RenderCombineText::rotateWhenVertical):
149 (WebCore::RenderCombineText::renderName):
150 (WebCore::toRenderCombineText):
151 * rendering/RenderText.h:
152 (WebCore::RenderText::rotateWhenVertical):
153 - Added to indicate if the text object is needed to be rotated or not.
154 * rendering/RenderingAllInOne.cpp: Added RenderCombineText.cpp
155 * rendering/style/RenderStyle.h:
156 (WebCore::InheritedFlags::hasTextCombine):
157 - Added for a quick test of TextCombine.
158