12011-01-28 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::mapFontWidthVariantToCTFeatureSelector):
62 - A function to map a FontWidthVariant value to a CoreText's text spacing feature selector.
63 (WebCore::FontPlatformData::ctFont):
64 - Changed to create CTFont with text spacing variant based on FontWidthVariant.
65 * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
66 (WebCore::FontCustomPlatformData::fontPlatformData):
67 - Changed to carry FontWidthVariant value.
68 * platform/graphics/haiku/FontCustomPlatformData.cpp:
69 (WebCore::FontCustomPlatformData::fontPlatformData):
70 - Changed to carry FontWidthVariant value.
71 * platform/graphics/haiku/FontCustomPlatformData.h:
72 * platform/graphics/mac/FontCacheMac.mm:
73 (WebCore::FontCache::createFontPlatformData):
74 - Changed to carry FontWidthVariant value.
75 * platform/graphics/mac/FontCustomPlatformData.cpp:
76 (WebCore::FontCustomPlatformData::fontPlatformData):
77 - Changed to carry FontWidthVariant value.
78 * platform/graphics/mac/FontCustomPlatformData.h:
79 - Ditto.
80 * platform/graphics/mac/GlyphPageTreeNodeMac.cpp:
81 (WebCore::shouldUseCoreText):
82 - Changed to skip CT path when width variant is specified.
83 * platform/graphics/pango/FontCustomPlatformDataPango.cpp:
84 (WebCore::FontCustomPlatformData::fontPlatformData):
85 - Ditto.
86 * platform/graphics/qt/FontCustomPlatformData.h:
87 - Ditto.
88 * platform/graphics/qt/FontCustomPlatformDataQt.cpp:
89 (WebCore::FontCustomPlatformData::fontPlatformData):
90 - Ditto.
91 * platform/graphics/skia/FontCustomPlatformData.cpp:
92 (WebCore::FontCustomPlatformData::fontPlatformData):
93 - Ditto.
94 * platform/graphics/skia/FontCustomPlatformData.h:
95 - Ditto.
96 * platform/graphics/win/FontCustomPlatformData.cpp:
97 (WebCore::FontCustomPlatformData::fontPlatformData):
98 - Ditto.
99 * platform/graphics/win/FontCustomPlatformData.h:
100 - Ditto.
101 * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
102 - Ditto.
103 (WebCore::FontCustomPlatformData::fontPlatformData):
104 - Ditto.
105 * platform/graphics/win/FontCustomPlatformDataCairo.h:
106 - Ditto.
107 * platform/graphics/wince/FontCustomPlatformData.cpp:
108 (WebCore::FontCustomPlatformData::fontPlatformData):
109 - Ditto.
110 * platform/graphics/wince/FontCustomPlatformData.h:
111 - Ditto.
112 * platform/graphics/wx/FontCustomPlatformData.cpp:
113 (WebCore::FontCustomPlatformData::fontPlatformData):
114 - Ditto.
115 * platform/graphics/wx/FontCustomPlatformData.h:
116 - Ditto.
117 * rendering/InlineTextBox.cpp:
118 (WebCore::InlineTextBox::paint):
119 - In case of RenderCombineText, we don't rotate text even in vertical writing. Also, we render original text
120 instead of text returned from text().
121 * rendering/RenderBlock.cpp:
122 (WebCore::RenderBlock::computeInlinePreferredLogicalWidths):
123 - Made to call RenderCombinedText's prepareTextCombine() here.
124 * rendering/RenderBlockLineLayout.cpp:
125 (WebCore::textWidth):
126 - Made to always use the render object's width() in case of TextCombine.
127 (WebCore::RenderBlock::findNextLineBreak):
128 - Made to call RenderCombinedText's prepareTextCombine() here.
129 * rendering/RenderCombineText.cpp: Added. A subclass of RenderText.
130 (WebCore::RenderCombineText::RenderCombineText):
131 (WebCore::RenderCombineText::styleDidChange):
132 - Clear the flag that indicated the font has been prepared for combining. The font will be reinitialized in
133 the next call of RenderBlock::findNextLineBreak().
134 (WebCore::RenderCombineText::setTextInternal):
135 - Ditto.
136 (WebCore::RenderCombineText::width):
137 - Returns 1-em width in case of font combine.
138 (WebCore::RenderCombineText::adjustTextOrigin):
139 - Adjust drawing origin point in case of font combine.
140 (WebCore::RenderCombineText::charactersToRender):
141 - Return original text instead of current text in case of font combine.
142 (WebCore::RenderCombineText::combineText):
143 - This function tries to pack passed text with; 1) the current font as is, 2) the font created
144 from the descriptor with half-width variant specified, 3) the font with third-width variant, 4) the font
145 with quarter-width variant.
146 - If a suitable font successfully found, replace the current font with the new font. If no appropriate font found,
147 we give up text-combine as the CSS spec describes.
148 - If a new font found, we replace the text with 0xFFFC. This is needed for a combined text block to be able to
149 behave like a single character against text decorations.
150 * rendering/RenderCombineText.h: Added.
151 (WebCore::RenderCombineText::isCombined):
152 (WebCore::RenderCombineText::combinedTextWidth):
153 - Returns 1-em width in case of font combine.
154 (WebCore::RenderCombineText::renderName):
155 (WebCore::toRenderCombineText):
156 * rendering/RenderText.cpp:
157 (WebCore::RenderText::widthFromCache):
158 - Made to call RenderCombineText's combinedTextWidth when the text is combined.
159 * rendering/RenderingAllInOne.cpp: Added RenderCombineText.cpp
160 * rendering/style/RenderStyle.h:
161 (WebCore::InheritedFlags::hasTextCombine):
162 - Added for a quick test of TextCombine.
163