Changeset 156657 in webkit
- Timestamp:
- Sep 30, 2013, 9:21:54 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r156615 r156657 75 75 "${WEBCORE_DIR}/platform/sql" 76 76 "${WEBCORE_DIR}/platform/text" 77 "${WEBCORE_DIR}/platform/text/transcoder"78 77 "${WEBCORE_DIR}/plugins" 79 78 "${WEBCORE_DIR}/rendering" … … 2096 2095 platform/text/UnicodeRange.cpp 2097 2096 2098 platform/text/transcoder/FontTranscoder.cpp2099 2100 2097 plugins/DOMMimeType.cpp 2101 2098 plugins/DOMMimeTypeArray.cpp -
trunk/Source/WebCore/ChangeLog
r156656 r156657 1 2013-09-30 Antti Koivisto <antti@apple.com> 2 3 Remove FontTranscoder 4 https://bugs.webkit.org/show_bug.cgi?id=122088 5 6 Reviewed by Andreas Kling. 7 8 This overly generic class just implements mapping of backslash to yen symbol for some legacy Japanese fonts. 9 10 * CMakeLists.txt: 11 * GNUmakefile.am: 12 * GNUmakefile.list.am: 13 * Target.pri: 14 * WebCore.pri: 15 * WebCore.vcxproj/WebCore.vcxproj: 16 * WebCore.xcodeproj/project.pbxproj: 17 * platform/graphics/Font.cpp: 18 (WebCore::useBackslashAsYenSignForFamily): 19 20 Move the family set to Font.cpp. 21 22 (WebCore::Font::Font): 23 (WebCore::Font::operator=): 24 (WebCore::Font::update): 25 26 Keep the cached boolean up to date. 27 28 * platform/graphics/Font.h: 29 (WebCore::Font::useBackslashAsYenSymbol): 30 31 Use descriptive name instead of talking about "transcoding". 32 33 * platform/text/transcoder: Removed. 34 * platform/text/transcoder/FontTranscoder.cpp: Removed. 35 * platform/text/transcoder/FontTranscoder.h: Removed. 36 * rendering/RenderText.cpp: 37 (WebCore::RenderText::RenderText): 38 (WebCore::RenderText::computeUseBackslashAsYenSymbol): 39 40 Rename for clarity. 41 Avoid unnecessary hash lookup, just check the cached bit in Font. 42 43 (WebCore::RenderText::styleDidChange): 44 (WebCore::RenderText::setTextInternal): 45 46 "Transcoding" here was just a simple character replacement. 47 48 (WebCore::RenderText::textWithoutConvertingBackslashToYenSymbol): 49 50 Renamed. 51 52 * rendering/RenderText.h: 53 1 54 2013-09-27 Jer Noble <jer.noble@apple.com> 2 55 -
trunk/Source/WebCore/GNUmakefile.am
r156406 r156657 87 87 -I$(srcdir)/Source/WebCore/platform/sql \ 88 88 -I$(srcdir)/Source/WebCore/platform/text \ 89 -I$(srcdir)/Source/WebCore/platform/text/transcoder \90 89 -I$(srcdir)/Source/WebCore/platform/win \ 91 90 -I$(srcdir)/Source/WebCore/plugins \ -
trunk/Source/WebCore/GNUmakefile.list.am
r156615 r156657 5958 5958 Source/WebCore/platform/text/enchant/TextCheckerEnchant.h \ 5959 5959 Source/WebCore/platform/text/enchant/TextCheckerEnchant.cpp \ 5960 Source/WebCore/platform/text/transcoder/FontTranscoder.cpp \5961 Source/WebCore/platform/text/transcoder/FontTranscoder.h \5962 5960 Source/WebCore/platform/text/BidiContext.cpp \ 5963 5961 Source/WebCore/platform/text/BidiContext.h \ -
trunk/Source/WebCore/Target.pri
r156615 r156657 1104 1104 platform/Timer.cpp \ 1105 1105 platform/text/UnicodeRange.cpp \ 1106 platform/text/transcoder/FontTranscoder.cpp \1107 1106 platform/UUID.cpp \ 1108 1107 platform/Widget.cpp \ … … 2343 2342 platform/text/TextStream.h \ 2344 2343 platform/text/UnicodeRange.h \ 2345 platform/text/transcoder/FontTranscoder.h \2346 2344 platform/ThreadGlobalData.h \ 2347 2345 platform/ThreadTimers.h \ -
trunk/Source/WebCore/WebCore.pri
r155697 r156657 82 82 $$SOURCE_DIR/platform/sql \ 83 83 $$SOURCE_DIR/platform/text \ 84 $$SOURCE_DIR/platform/text/transcoder \85 84 $$SOURCE_DIR/plugins \ 86 85 $$SOURCE_DIR/rendering \ -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
r156615 r156657 8504 8504 <ClCompile Include="..\platform\text\cf\StringImplCF.cpp" /> 8505 8505 <ClCompile Include="..\platform\text\win\TextBreakIteratorInternalICUWin.cpp" /> 8506 <ClCompile Include="..\platform\text\transcoder\FontTranscoder.cpp" />8507 8506 <ClCompile Include="..\platform\image-decoders\ImageDecoder.cpp"> 8508 8507 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> … … 19543 19542 <ClInclude Include="..\platform\graphics\WidthIterator.h" /> 19544 19543 <ClInclude Include="..\platform\text\WritingMode.h" /> 19545 <ClInclude Include="..\platform\text\transcoder\FontTranscoder.h" />19546 19544 <ClInclude Include="..\platform\image-decoders\ImageDecoder.h"> 19547 19545 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r156652 r156657 4685 4685 B6D9D27C14EAC0860090D75E /* JSFocusEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6D9D27A14EAC0860090D75E /* JSFocusEvent.cpp */; }; 4686 4686 B71FE6DF11091CB300DAEF77 /* PrintContext.h in Headers */ = {isa = PBXBuildFile; fileRef = B776D43A1104525D00BEB0EC /* PrintContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4687 B734B181119B9911006587BD /* FontTranscoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B734B180119B9911006587BD /* FontTranscoder.cpp */; };4688 B734B183119B991D006587BD /* FontTranscoder.h in Headers */ = {isa = PBXBuildFile; fileRef = B734B182119B991D006587BD /* FontTranscoder.h */; };4689 4687 B776D43D1104527500BEB0EC /* PrintContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B776D43C1104527500BEB0EC /* PrintContext.cpp */; }; 4690 4688 B885E8D411E06DD2009FFBF4 /* InspectorApplicationCacheAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B885E8D211E06DD2009FFBF4 /* InspectorApplicationCacheAgent.cpp */; }; … … 11564 11562 B6D9D27914EAC0860090D75E /* JSFocusEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFocusEvent.h; sourceTree = "<group>"; }; 11565 11563 B6D9D27A14EAC0860090D75E /* JSFocusEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFocusEvent.cpp; sourceTree = "<group>"; }; 11566 B734B180119B9911006587BD /* FontTranscoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FontTranscoder.cpp; path = transcoder/FontTranscoder.cpp; sourceTree = "<group>"; };11567 B734B182119B991D006587BD /* FontTranscoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FontTranscoder.h; path = transcoder/FontTranscoder.h; sourceTree = "<group>"; };11568 11564 B776D43A1104525D00BEB0EC /* PrintContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrintContext.h; sourceTree = "<group>"; }; 11569 11565 B776D43C1104527500BEB0EC /* PrintContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrintContext.cpp; sourceTree = "<group>"; }; … … 19105 19101 B2B264590D00A77E000ACC1D /* cf */, 19106 19102 B2C3D9F90D006C1D00EF6F26 /* mac */, 19107 B734B17F119B98DB006587BD /* transcoder */,19108 19103 37C61F0012095C87007A3C67 /* AtomicStringKeyedMRUCache.h */, 19109 19104 B2C3D9F20D006C1D00EF6F26 /* BidiContext.cpp */, … … 19235 19230 ); 19236 19231 name = generic; 19237 sourceTree = "<group>";19238 };19239 B734B17F119B98DB006587BD /* transcoder */ = {19240 isa = PBXGroup;19241 children = (19242 B734B180119B9911006587BD /* FontTranscoder.cpp */,19243 B734B182119B991D006587BD /* FontTranscoder.h */,19244 );19245 name = transcoder;19246 19232 sourceTree = "<group>"; 19247 19233 }; … … 22545 22531 37202199106213C600F25C4B /* FontSmoothingMode.h in Headers */, 22546 22532 3784C34B0E11AA34007D8D48 /* FontTraitsMask.h in Headers */, 22547 B734B183119B991D006587BD /* FontTranscoder.h in Headers */,22548 22533 A80E6CED0A1989CA007FB8C5 /* FontValue.h in Headers */, 22549 22534 BCE4413612F7490B009B84B8 /* FontWidthVariant.h in Headers */, … … 25822 25807 84B62685133138F90095A489 /* FontPlatformData.cpp in Sources */, 25823 25808 B5320D6C122A24E9002D1440 /* FontPlatformDataCocoa.mm in Sources */, 25824 B734B181119B9911006587BD /* FontTranscoder.cpp in Sources */,25825 25809 A80E6CF10A1989CA007FB8C5 /* FontValue.cpp in Sources */, 25826 25810 4A0DA2FE129B241900AB61E1 /* FormAssociatedElement.cpp in Sources */, -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r156622 r156657 3373 3373 3374 3374 // Return the text that is actually being rendered in the input field. 3375 return static_cast<RenderText*>(renderer)->textWithout Transcoding();3375 return static_cast<RenderText*>(renderer)->textWithoutConvertingBackslashToYenSymbol(); 3376 3376 #else 3377 3377 // It seems only GTK is interested in this at the moment. -
trunk/Source/WebCore/editing/TextIterator.cpp
r156285 r156657 1033 1033 { 1034 1034 RenderText* renderer = toRenderText(renderObject); 1035 m_text = m_emitsOriginalText ? renderer->originalText() : (m_emitsTextWithoutTranscoding ? renderer->textWithout Transcoding() : renderer->text());1035 m_text = m_emitsOriginalText ? renderer->originalText() : (m_emitsTextWithoutTranscoding ? renderer->textWithoutConvertingBackslashToYenSymbol() : renderer->text()); 1036 1036 ASSERT(!m_text.isEmpty()); 1037 1037 ASSERT(0 <= textStartOffset && textStartOffset < static_cast<int>(m_text.length())); -
trunk/Source/WebCore/platform/graphics/Font.cpp
r156142 r156657 27 27 #include "FloatRect.h" 28 28 #include "FontCache.h" 29 #include "FontTranscoder.h"30 29 #include "IntPoint.h" 31 30 #include "GlyphBuffer.h" … … 34 33 #include <wtf/MainThread.h> 35 34 #include <wtf/MathExtras.h> 35 #include <wtf/text/AtomicStringHash.h> 36 36 #include <wtf/text/StringBuilder.h> 37 37 … … 62 62 }; 63 63 64 static bool useBackslashAsYenSignForFamily(const AtomicString& family) 65 { 66 if (family.isEmpty()) 67 return false; 68 static HashSet<AtomicString>* set; 69 if (!set) { 70 set = new HashSet<AtomicString>; 71 set->add("MS PGothic"); 72 UChar unicodeNameMSPGothic[] = {0xFF2D, 0xFF33, 0x0020, 0xFF30, 0x30B4, 0x30B7, 0x30C3, 0x30AF}; 73 set->add(AtomicString(unicodeNameMSPGothic, WTF_ARRAY_LENGTH(unicodeNameMSPGothic))); 74 75 set->add("MS PMincho"); 76 UChar unicodeNameMSPMincho[] = {0xFF2D, 0xFF33, 0x0020, 0xFF30, 0x660E, 0x671D}; 77 set->add(AtomicString(unicodeNameMSPMincho, WTF_ARRAY_LENGTH(unicodeNameMSPMincho))); 78 79 set->add("MS Gothic"); 80 UChar unicodeNameMSGothic[] = {0xFF2D, 0xFF33, 0x0020, 0x30B4, 0x30B7, 0x30C3, 0x30AF}; 81 set->add(AtomicString(unicodeNameMSGothic, WTF_ARRAY_LENGTH(unicodeNameMSGothic))); 82 83 set->add("MS Mincho"); 84 UChar unicodeNameMSMincho[] = {0xFF2D, 0xFF33, 0x0020, 0x660E, 0x671D}; 85 set->add(AtomicString(unicodeNameMSMincho, WTF_ARRAY_LENGTH(unicodeNameMSMincho))); 86 87 set->add("Meiryo"); 88 UChar unicodeNameMeiryo[] = {0x30E1, 0x30A4, 0x30EA, 0x30AA}; 89 set->add(AtomicString(unicodeNameMeiryo, WTF_ARRAY_LENGTH(unicodeNameMeiryo))); 90 } 91 return set->contains(family); 92 } 93 64 94 Font::CodePath Font::s_codePath = Auto; 65 95 … … 73 103 : m_letterSpacing(0) 74 104 , m_wordSpacing(0) 75 , m_ needsTranscoding(false)105 , m_useBackslashAsYenSymbol(false) 76 106 , m_typesettingFeatures(0) 77 107 { … … 82 112 , m_letterSpacing(letterSpacing) 83 113 , m_wordSpacing(wordSpacing) 84 , m_ needsTranscoding(fontTranscoder().needsTranscoding(fd))114 , m_useBackslashAsYenSymbol(useBackslashAsYenSignForFamily(fd.firstFamily())) 85 115 , m_typesettingFeatures(computeTypesettingFeatures()) 86 116 { … … 91 121 , m_letterSpacing(0) 92 122 , m_wordSpacing(0) 123 , m_useBackslashAsYenSymbol(false) 93 124 , m_typesettingFeatures(computeTypesettingFeatures()) 94 125 { 95 126 m_fontDescription.setUsePrinterFont(isPrinterFont); 96 127 m_fontDescription.setFontSmoothing(fontSmoothingMode); 97 m_needsTranscoding = fontTranscoder().needsTranscoding(fontDescription());98 128 } 99 129 … … 103 133 , m_letterSpacing(other.m_letterSpacing) 104 134 , m_wordSpacing(other.m_wordSpacing) 105 , m_ needsTranscoding(other.m_needsTranscoding)135 , m_useBackslashAsYenSymbol(other.m_useBackslashAsYenSymbol) 106 136 , m_typesettingFeatures(computeTypesettingFeatures()) 107 137 { … … 114 144 m_letterSpacing = other.m_letterSpacing; 115 145 m_wordSpacing = other.m_wordSpacing; 116 m_ needsTranscoding = other.m_needsTranscoding;146 m_useBackslashAsYenSymbol = other.m_useBackslashAsYenSymbol; 117 147 m_typesettingFeatures = other.m_typesettingFeatures; 118 148 return *this; … … 259 289 { 260 290 m_glyphs = retrieveOrAddCachedFontGlyphs(m_fontDescription, fontSelector.get()); 291 m_useBackslashAsYenSymbol = useBackslashAsYenSignForFamily(firstFamily()); 261 292 m_typesettingFeatures = computeTypesettingFeatures(); 262 293 } -
trunk/Source/WebCore/platform/graphics/Font.h
r155496 r156657 258 258 static String normalizeSpaces(const UChar*, unsigned length); 259 259 260 bool needsTranscoding() const { return m_needsTranscoding; }260 bool useBackslashAsYenSymbol() const { return m_useBackslashAsYenSymbol; } 261 261 FontGlyphs* glyphs() const { return m_glyphs.get(); } 262 262 … … 319 319 short m_letterSpacing; 320 320 short m_wordSpacing; 321 bool m_needsTranscoding;321 mutable bool m_useBackslashAsYenSymbol; 322 322 mutable unsigned m_typesettingFeatures : 2; // (TypesettingFeatures) Caches values computed from m_fontDescription. 323 323 }; -
trunk/Source/WebCore/rendering/RenderText.cpp
r156613 r156657 29 29 #include "EllipsisBox.h" 30 30 #include "FloatQuad.h" 31 #include "FontTranscoder.h"32 31 #include "Frame.h" 33 32 #include "FrameView.h" … … 146 145 , m_isAllASCII(text.containsOnlyASCII()) 147 146 , m_knownToHaveNoOverflowAndNoFallbackFonts(false) 148 , m_ needsTranscoding(false)147 , m_useBackslashAsYenSymbol(false) 149 148 #if ENABLE(IOS_TEXT_AUTOSIZING) 150 149 , m_candidateComputedTextSize(0) … … 201 200 } 202 201 203 void RenderText::updateNeedsTranscoding() 204 { 202 bool RenderText::computeUseBackslashAsYenSymbol() const 203 { 204 const FontDescription& fontDescription = style()->font().fontDescription(); 205 if (style()->font().useBackslashAsYenSymbol()) 206 return true; 207 if (fontDescription.isSpecifiedFont()) 208 return false; 205 209 const TextEncoding* encoding = document().decoder() ? &document().decoder()->encoding() : 0; 206 m_needsTranscoding = fontTranscoder().needsTranscoding(style()->font().fontDescription(), encoding); 210 if (encoding && encoding->backslashAsCurrencySymbol() != '\\') 211 return true; 212 return false; 207 213 } 208 214 … … 221 227 bool needsResetText = false; 222 228 if (!oldStyle) { 223 updateNeedsTranscoding();224 needsResetText = m_ needsTranscoding;225 } else if (oldStyle->font(). needsTranscoding() != newStyle->font().needsTranscoding() || (newStyle->font().needsTranscoding() && oldStyle->font().firstFamily() != newStyle->font().firstFamily())) {226 updateNeedsTranscoding();229 m_useBackslashAsYenSymbol = computeUseBackslashAsYenSymbol(); 230 needsResetText = m_useBackslashAsYenSymbol; 231 } else if (oldStyle->font().useBackslashAsYenSymbol() != newStyle->font().useBackslashAsYenSymbol()) { 232 m_useBackslashAsYenSymbol = computeUseBackslashAsYenSymbol(); 227 233 needsResetText = true; 228 234 } … … 1338 1344 ASSERT(!text.isNull()); 1339 1345 m_text = text; 1340 if (m_needsTranscoding) { 1341 const TextEncoding* encoding = document().decoder() ? &document().decoder()->encoding() : 0;1342 fontTranscoder().convert(m_text, style()->font().fontDescription(), encoding);1343 } 1346 1347 if (m_useBackslashAsYenSymbol) 1348 m_text.replace('\\', yenSign); 1349 1344 1350 ASSERT(m_text); 1345 1351 … … 1406 1412 } 1407 1413 1408 String RenderText::textWithoutTranscoding() const 1409 { 1410 // If m_text isn't transcoded or is secure, we can just return the modified text. 1411 if (!m_needsTranscoding || style()->textSecurity() != TSNONE) 1414 String RenderText::textWithoutConvertingBackslashToYenSymbol() const 1415 { 1416 if (!m_useBackslashAsYenSymbol || style()->textSecurity() != TSNONE) 1412 1417 return text(); 1413 1418 1414 // Otherwise, we should use original text. If text-transform is1415 // specified, we should transform the text on the fly.1416 1419 String text = originalText(); 1417 1420 applyTextTransform(style(), text, previousCharacter()); -
trunk/Source/WebCore/rendering/RenderText.h
r156608 r156657 57 57 58 58 StringImpl* text() const { return m_text.impl(); } 59 String textWithout Transcoding() const;59 String textWithoutConvertingBackslashToYenSymbol() const; 60 60 61 61 InlineTextBox* createInlineTextBox(); … … 180 180 float widthFromCache(const Font&, int start, int len, float xPos, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow*) const; 181 181 bool isAllASCII() const { return m_isAllASCII; } 182 void updateNeedsTranscoding();182 bool computeUseBackslashAsYenSymbol() const; 183 183 184 184 void secureText(UChar mask); … … 200 200 bool m_canUseSimpleFontCodePath : 1; 201 201 mutable bool m_knownToHaveNoOverflowAndNoFallbackFonts : 1; 202 bool m_ needsTranscoding: 1;202 bool m_useBackslashAsYenSymbol : 1; 203 203 204 204 #if ENABLE(IOS_TEXT_AUTOSIZING)
Note:
See TracChangeset
for help on using the changeset viewer.