Changeset 189465 in webkit
- Timestamp:
- Sep 7, 2015, 10:42:50 AM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/Source/WebCore/ChangeLog ¶
r189452 r189465 1 2015-09-07 Antti Koivisto <antti@apple.com> 2 3 Remove unneeded offset and length arguments from glyph page filling functions 4 https://bugs.webkit.org/show_bug.cgi?id=148929 5 6 Reviewed by Andreas Kling. 7 8 They are always passed 0/GlyphPage::size. 9 10 * platform/graphics/Font.cpp: 11 (WebCore::Font::~Font): 12 (WebCore::fillGlyphPage): 13 (WebCore::createAndFillGlyphPage): 14 * platform/graphics/Font.h: 15 * platform/graphics/GlyphPage.h: 16 (WebCore::GlyphPage::setGlyphDataForIndex): 17 * platform/graphics/mac/GlyphPageMac.cpp: 18 (WebCore::GlyphPage::mayUseMixedFontsWhenFilling): 19 (WebCore::GlyphPage::fill): 20 * platform/graphics/win/GlyphPageTreeNodeCGWin.cpp: 21 (WebCore::GlyphPage::fill): 22 * platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp: 23 (WebCore::GlyphPage::fill): 24 * svg/SVGFontData.cpp: 25 (WebCore::SVGFontData::applySVGGlyphSelection): 26 (WebCore::SVGFontData::fillSVGGlyphPage): 27 (WebCore::SVGFontData::fillBMPGlyphs): 28 (WebCore::SVGFontData::fillNonBMPGlyphs): 29 * svg/SVGFontData.h: 30 (WebCore::SVGFontData::verticalAdvanceY): 31 1 32 2015-09-06 Chris Dumez <cdumez@apple.com> 2 33 -
TabularUnified trunk/Source/WebCore/platform/graphics/Font.cpp ¶
r188797 r189465 150 150 } 151 151 152 static bool fillGlyphPage(GlyphPage& pageToFill, unsigned offset, unsigned length,UChar* buffer, unsigned bufferLength, const Font* font)152 static bool fillGlyphPage(GlyphPage& pageToFill, UChar* buffer, unsigned bufferLength, const Font* font) 153 153 { 154 154 #if ENABLE(SVG_FONTS) 155 155 if (auto* svgData = font->svgData()) 156 return svgData->fillSVGGlyphPage(&pageToFill, offset, length,buffer, bufferLength, font);157 #endif 158 bool hasGlyphs = pageToFill.fill( offset, length,buffer, bufferLength, font);156 return svgData->fillSVGGlyphPage(&pageToFill, buffer, bufferLength, font); 157 #endif 158 bool hasGlyphs = pageToFill.fill(buffer, bufferLength, font); 159 159 #if ENABLE(OPENTYPE_VERTICAL) 160 160 if (hasGlyphs && font->verticalData()) 161 font->verticalData()->substituteWithVerticalGlyphs(font, &pageToFill , offset, length);161 font->verticalData()->substituteWithVerticalGlyphs(font, &pageToFill); 162 162 #endif 163 163 return hasGlyphs; … … 233 233 glyphPage = GlyphPage::createForSingleFont(font); 234 234 235 bool haveGlyphs = fillGlyphPage(*glyphPage, 0, GlyphPage::size,buffer, bufferLength, font);235 bool haveGlyphs = fillGlyphPage(*glyphPage, buffer, bufferLength, font); 236 236 if (!haveGlyphs) 237 237 return nullptr; -
TabularUnified trunk/Source/WebCore/platform/graphics/Font.h ¶
r188797 r189465 77 77 virtual void initializeFont(Font*, float fontSize) = 0; 78 78 virtual float widthForSVGGlyph(Glyph, float fontSize) const = 0; 79 virtual bool fillSVGGlyphPage(GlyphPage*, unsigned offset, unsigned length,UChar* buffer, unsigned bufferLength, const Font*) const = 0;79 virtual bool fillSVGGlyphPage(GlyphPage*, UChar* buffer, unsigned bufferLength, const Font*) const = 0; 80 80 }; 81 81 -
TabularUnified trunk/Source/WebCore/platform/graphics/GlyphPage.h ¶
r181597 r189465 157 157 158 158 // Implemented by the platform. 159 bool fill( unsigned offset, unsigned length,UChar* characterBuffer, unsigned bufferLength, const Font*);159 bool fill(UChar* characterBuffer, unsigned bufferLength, const Font*); 160 160 #if PLATFORM(COCOA) 161 161 static bool mayUseMixedFontsWhenFilling(const UChar* characterBuffer, unsigned bufferLength, const Font*); -
TabularUnified trunk/Source/WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp ¶
r178940 r189465 40 40 namespace WebCore { 41 41 42 bool GlyphPage::fill( unsigned offset, unsigned length,UChar* buffer, unsigned bufferLength, const Font* fontData)42 bool GlyphPage::fill(UChar* buffer, unsigned bufferLength, const Font* fontData) 43 43 { 44 44 cairo_scaled_font_t* scaledFont = fontData->platformData().scaledFont(); … … 51 51 bool haveGlyphs = false; 52 52 UTF16UChar32Iterator iterator(buffer, bufferLength); 53 for (unsigned i = 0; i < length; i++) {53 for (unsigned i = 0; i < GlyphPage::size; i++) { 54 54 UChar32 character = iterator.next(); 55 55 if (character == iterator.end()) … … 58 58 Glyph glyph = FcFreeTypeCharIndex(face, character); 59 59 if (!glyph) 60 setGlyphDataForIndex( offset +i, 0, 0);60 setGlyphDataForIndex(i, 0, 0); 61 61 else { 62 setGlyphDataForIndex( offset +i, glyph, fontData);62 setGlyphDataForIndex(i, glyph, fontData); 63 63 haveGlyphs = true; 64 64 } -
TabularUnified trunk/Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp ¶
r188566 r189465 72 72 } 73 73 74 bool GlyphPage::fill( unsigned offset, unsigned length,UChar* buffer, unsigned bufferLength, const Font* fontData)74 bool GlyphPage::fill(UChar* buffer, unsigned bufferLength, const Font* fontData) 75 75 { 76 76 bool haveGlyphs = false; … … 83 83 // this should not happen as the only time we pass in 512 characters is when they are surrogates. 84 84 CGFontGetGlyphsForUnichars(fontData->platformData().cgFont(), buffer, glyphs.data(), bufferLength); 85 for (unsigned i = 0; i < length; ++i) {85 for (unsigned i = 0; i < GlyphPage::size; ++i) { 86 86 if (!glyphs[i]) 87 setGlyphDataForIndex( offset +i, 0, 0);87 setGlyphDataForIndex(i, 0, 0); 88 88 else { 89 setGlyphDataForIndex( offset +i, glyphs[i], fontData);89 setGlyphDataForIndex(i, glyphs[i], fontData); 90 90 haveGlyphs = true; 91 91 } … … 100 100 // When buffer consists of surrogate pairs, CTFontGetVerticalGlyphsForCharacters and CTFontGetGlyphsForCharacters 101 101 // place the glyphs at indices corresponding to the first character of each pair. 102 ASSERT( !(bufferLength % length) && (bufferLength / length == 1 || bufferLength / length == 2));103 unsigned glyphStep = bufferLength / length;104 for (unsigned i = 0; i < length; ++i) {102 ASSERT(bufferLength == GlyphPage::size || bufferLength == 2 * GlyphPage::size); 103 unsigned glyphStep = bufferLength / GlyphPage::size; 104 for (unsigned i = 0; i < GlyphPage::size; ++i) { 105 105 if (!glyphs[i * glyphStep]) 106 setGlyphDataForIndex( offset +i, 0, 0);106 setGlyphDataForIndex(i, 0, 0); 107 107 else { 108 setGlyphDataForIndex( offset +i, glyphs[i * glyphStep], fontData);108 setGlyphDataForIndex(i, glyphs[i * glyphStep], fontData); 109 109 haveGlyphs = true; 110 110 } -
TabularUnified trunk/Source/WebCore/platform/graphics/opentype/OpenTypeVerticalData.cpp ¶
r178986 r189465 536 536 } 537 537 538 void OpenTypeVerticalData::substituteWithVerticalGlyphs(const Font* font, GlyphPage* glyphPage , unsigned offset, unsigned length) const538 void OpenTypeVerticalData::substituteWithVerticalGlyphs(const Font* font, GlyphPage* glyphPage) const 539 539 { 540 540 const HashMap<Glyph, Glyph>& map = m_verticalGlyphMap; … … 542 542 return; 543 543 544 for (unsigned index = offset, end = offset + length; index < end; ++index) {544 for (unsigned index = 0; index < GlyphPage::size; ++index) { 545 545 Glyph glyph = glyphPage->glyphAt(index); 546 546 if (glyph) { -
TabularUnified trunk/Source/WebCore/platform/graphics/opentype/OpenTypeVerticalData.h ¶
r178940 r189465 51 51 float advanceHeight(const Font*, Glyph) const; 52 52 void getVerticalTranslationsForGlyphs(const Font*, const Glyph*, size_t, float* outXYArray) const; 53 void substituteWithVerticalGlyphs(const Font*, GlyphPage* , unsigned offset, unsigned length) const;53 void substituteWithVerticalGlyphs(const Font*, GlyphPage*) const; 54 54 55 55 private: -
TabularUnified trunk/Source/WebCore/platform/graphics/win/GlyphPageTreeNodeCGWin.cpp ¶
r178940 r189465 35 35 namespace WebCore { 36 36 37 bool GlyphPage::fill( unsigned offset, unsigned length,UChar* buffer, unsigned bufferLength, const Font* fontData)37 bool GlyphPage::fill(UChar* buffer, unsigned bufferLength, const Font* fontData) 38 38 { 39 39 // bufferLength will be greater than the requested number of glyphs if the buffer contains surrogate pairs. 40 40 // We won't support this for now. 41 if (bufferLength > length)41 if (bufferLength > GlyphPage::size) 42 42 return false; 43 43 … … 45 45 CGGlyph localGlyphBuffer[GlyphPage::size]; 46 46 wkGetGlyphs(fontData->platformData().cgFont(), buffer, localGlyphBuffer, bufferLength); 47 for (unsigned i = 0; i < length; i++) {47 for (unsigned i = 0; i < GlyphPage::size; i++) { 48 48 Glyph glyph = localGlyphBuffer[i]; 49 49 if (!glyph) 50 setGlyphDataForIndex( offset +i, 0, 0);50 setGlyphDataForIndex(i, 0, 0); 51 51 else { 52 setGlyphDataForIndex( offset +i, glyph, fontData);52 setGlyphDataForIndex(i, glyph, fontData); 53 53 haveGlyphs = true; 54 54 } -
TabularUnified trunk/Source/WebCore/platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp ¶
r186862 r189465 35 35 namespace WebCore { 36 36 37 bool GlyphPage::fill( unsigned offset, unsigned length,UChar* buffer, unsigned bufferLength, const Font* fontData)37 bool GlyphPage::fill(UChar* buffer, unsigned bufferLength, const Font* fontData) 38 38 { 39 39 // bufferLength will be greater than the requested number of glyphs if the buffer contains surrogate pairs. 40 40 // We won't support this for now. 41 if (bufferLength > length)41 if (bufferLength > GlyphPage::size) 42 42 return false; 43 43 … … 52 52 bool success = result != GDI_ERROR && static_cast<unsigned>(result) == bufferLength; 53 53 if (success) { 54 for (unsigned i = 0; i < length; i++) {54 for (unsigned i = 0; i < GlyphPage::size; i++) { 55 55 Glyph glyph = localGlyphBuffer[i]; 56 56 if (glyph == 0xffff) 57 setGlyphDataForIndex( offset +i, 0, 0);57 setGlyphDataForIndex(i, 0, 0); 58 58 else { 59 setGlyphDataForIndex( offset +i, glyph, fontData);59 setGlyphDataForIndex(i, glyph, fontData); 60 60 haveGlyphs = true; 61 61 } -
TabularUnified trunk/Source/WebCore/svg/SVGFontData.cpp ¶
r184844 r189465 205 205 } 206 206 207 bool SVGFontData::fillSVGGlyphPage(GlyphPage* pageToFill, unsigned offset, unsigned length,UChar* buffer, unsigned bufferLength, const Font* font) const207 bool SVGFontData::fillSVGGlyphPage(GlyphPage* pageToFill, UChar* buffer, unsigned bufferLength, const Font* font) const 208 208 { 209 209 ASSERT(font->isCustomFont()); … … 216 216 ASSERT(fontElement); 217 217 218 if (bufferLength == length)219 return fillBMPGlyphs(fontElement, pageToFill, offset, length,buffer, font);220 221 ASSERT(bufferLength == 2 * length);222 return fillNonBMPGlyphs(fontElement, pageToFill, offset, length,buffer, font);223 } 224 225 bool SVGFontData::fillBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageToFill, unsigned offset, unsigned length,UChar* buffer, const Font* font) const218 if (bufferLength == GlyphPage::size) 219 return fillBMPGlyphs(fontElement, pageToFill, buffer, font); 220 221 ASSERT(bufferLength == 2 * GlyphPage::size); 222 return fillNonBMPGlyphs(fontElement, pageToFill, buffer, font); 223 } 224 225 bool SVGFontData::fillBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageToFill, UChar* buffer, const Font* font) const 226 226 { 227 227 bool haveGlyphs = false; 228 228 Vector<SVGGlyph> glyphs; 229 for (unsigned i = 0; i < length; ++i) {229 for (unsigned i = 0; i < GlyphPage::size; ++i) { 230 230 String lookupString(buffer + i, 1); 231 231 fontElement->collectGlyphsForString(lookupString, glyphs); 232 232 if (glyphs.isEmpty()) { 233 pageToFill->setGlyphDataForIndex( offset +i, 0, 0);233 pageToFill->setGlyphDataForIndex(i, 0, 0); 234 234 continue; 235 235 } … … 240 240 // only possible within the context of a string (eg. arabic form matching). 241 241 haveGlyphs = true; 242 pageToFill->setGlyphDataForIndex( offset +i, glyphs.first().tableEntry, font);242 pageToFill->setGlyphDataForIndex(i, glyphs.first().tableEntry, font); 243 243 glyphs.clear(); 244 244 } … … 247 247 } 248 248 249 bool SVGFontData::fillNonBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageToFill, unsigned offset, unsigned length,UChar* buffer, const Font* font) const249 bool SVGFontData::fillNonBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageToFill, UChar* buffer, const Font* font) const 250 250 { 251 251 bool haveGlyphs = false; 252 252 Vector<SVGGlyph> glyphs; 253 for (unsigned i = 0; i < length; ++i) {253 for (unsigned i = 0; i < GlyphPage::size; ++i) { 254 254 // Each character here consists of a surrogate pair 255 255 String lookupString(buffer + i * 2, 2); 256 256 fontElement->collectGlyphsForString(lookupString, glyphs); 257 257 if (glyphs.isEmpty()) { 258 pageToFill->setGlyphDataForIndex( offset +i, 0, 0);258 pageToFill->setGlyphDataForIndex(i, 0, 0); 259 259 continue; 260 260 } … … 265 265 // only possible within the context of a string (eg. arabic form matching). 266 266 haveGlyphs = true; 267 pageToFill->setGlyphDataForIndex( offset +i, glyphs.first().tableEntry, font);267 pageToFill->setGlyphDataForIndex(i, glyphs.first().tableEntry, font); 268 268 glyphs.clear(); 269 269 } -
TabularUnified trunk/Source/WebCore/svg/SVGFontData.h ¶
r178940 r189465 36 36 virtual void initializeFont(Font*, float fontSize) override; 37 37 virtual float widthForSVGGlyph(Glyph, float fontSize) const override; 38 virtual bool fillSVGGlyphPage(GlyphPage*, unsigned offset, unsigned length,UChar* buffer, unsigned bufferLength, const Font*) const override;38 virtual bool fillSVGGlyphPage(GlyphPage*, UChar* buffer, unsigned bufferLength, const Font*) const override; 39 39 40 40 bool applySVGGlyphSelection(WidthIterator&, GlyphData&, bool mirror, int currentCharacter, unsigned& advanceLength, String& normalizedSpacesStringCache) const; … … 51 51 52 52 private: 53 bool fillBMPGlyphs(SVGFontElement*, GlyphPage* , unsigned offset, unsigned length, UChar* buffer, const Font*) const;54 bool fillNonBMPGlyphs(SVGFontElement*, GlyphPage* , unsigned offset, unsigned length, UChar* buffer, const Font*) const;53 bool fillBMPGlyphs(SVGFontElement*, GlyphPage*, UChar* buffer, const Font*) const; 54 bool fillNonBMPGlyphs(SVGFontElement*, GlyphPage*, UChar* buffer, const Font*) const; 55 55 56 56 bool applyTransforms(GlyphBufferGlyph*, GlyphBufferAdvance*, size_t, TypesettingFeatures) const = delete;
Note:
See TracChangeset
for help on using the changeset viewer.