Changeset 195523 in webkit
- Timestamp:
- Jan 24, 2016 9:23:49 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r195520 r195523 1 2016-01-24 Myles C. Maxfield <mmaxfield@apple.com> 2 3 [Font Loading] General cleanup 4 https://bugs.webkit.org/show_bug.cgi?id=153403 5 6 Reviewed by Darin Adler. 7 8 It turns out that CSSFontFaceSource::m_hasExternalSVGFont exactly equals 9 whether or not CSSFontFaceSource::m_font is a CachedSVGFont. Therefore, 10 the variable is redundant. 11 12 In addition, it was being passed to functions on CSSFontFaceSource::m_font, 13 which means it was always true inside the CachedSVGFont subclass and 14 always false for the CachedFont. Therefore, there is no reason pass this 15 variable to these functions because its value can be determined at 16 authorship time. 17 18 No new tests because there is no behavior change. 19 20 * css/CSSFontFaceSource.cpp: 21 (WebCore::CSSFontFaceSource::font): 22 (WebCore::CSSFontFaceSource::CSSFontFaceSource): Deleted. 23 * css/CSSFontFaceSource.h: 24 * css/CSSFontSelector.cpp: 25 (WebCore::createFontFace): 26 * loader/cache/CachedFont.cpp: 27 (WebCore::CachedFont::ensureCustomFontData): 28 (WebCore::CachedFont::createFont): 29 * loader/cache/CachedFont.h: 30 * loader/cache/CachedSVGFont.cpp: 31 (WebCore::CachedSVGFont::createFont): 32 (WebCore::CachedSVGFont::ensureCustomFontData): 33 * loader/cache/CachedSVGFont.h: 34 * platform/network/HTTPParsers.cpp: 35 (WebCore::isValidHTTPToken): 36 * xml/XMLHttpRequest.cpp: 37 (WebCore::XMLHttpRequest::uppercaseKnownHTTPMethod): 38 1 39 2016-01-24 Chris Dumez <cdumez@apple.com> 2 40 -
trunk/Source/WebCore/css/CSSFontFaceSource.cpp
r194923 r195523 58 58 , m_font(font) 59 59 , m_face(0) 60 #if ENABLE(SVG_FONTS)61 , m_hasExternalSVGFont(false)62 #endif63 60 { 64 61 if (m_font) … … 120 117 if (!m_font || m_font->isLoaded()) { 121 118 if (m_font) { 122 bool hasExternalSVGFont = false; 123 #if ENABLE(SVG_FONTS) 124 hasExternalSVGFont = m_hasExternalSVGFont; 125 #endif 126 if (!m_font->ensureCustomFontData(hasExternalSVGFont, m_string)) 119 if (!m_font->ensureCustomFontData(m_string)) 127 120 return nullptr; 128 121 129 font = m_font->createFont(fontDescription, m_string, syntheticBold, syntheticItalic, hasExternalSVGFont,fontFaceFeatures, fontFaceVariantSettings);122 font = m_font->createFont(fontDescription, m_string, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings); 130 123 } else { 131 124 #if ENABLE(SVG_FONTS) … … 165 158 } 166 159 160 #if ENABLE(SVG_FONTS) 161 bool CSSFontFaceSource::isSVGFontFaceSource() const 162 { 163 return m_svgFontFaceElement || is<CachedSVGFont>(m_font.get()); 164 } 165 #endif 166 167 167 #if ENABLE(FONT_LOAD_EVENTS) 168 168 bool CSSFontFaceSource::isDecodeError() const -
trunk/Source/WebCore/css/CSSFontFaceSource.h
r194923 r195523 40 40 namespace WebCore { 41 41 42 class CachedFont;43 42 class CSSFontFace; 44 43 class CSSFontSelector; … … 69 68 SVGFontFaceElement* svgFontFaceElement() const { return m_svgFontFaceElement.get(); } 70 69 void setSVGFontFaceElement(PassRefPtr<SVGFontFaceElement> element) { m_svgFontFaceElement = element; } 71 bool isSVGFontFaceSource() const { return m_svgFontFaceElement || m_hasExternalSVGFont; } 72 void setHasExternalSVGFont() { m_hasExternalSVGFont = true; } 70 bool isSVGFontFaceSource() const; 73 71 #endif 74 72 … … 92 90 #if ENABLE(SVG_FONTS) || ENABLE(SVG_OTF_CONVERTER) 93 91 RefPtr<SVGFontFaceElement> m_svgFontFaceElement; 94 bool m_hasExternalSVGFont;95 92 #endif 96 93 }; -
trunk/Source/WebCore/css/CSSFontSelector.cpp
r195164 r195523 181 181 bool allowDownloading = foundSVGFont || (settings && settings->downloadableBinaryFontsEnabled()); 182 182 if (allowDownloading && item.isSupportedFormat() && document) { 183 CachedFont* cachedFont = item.cachedFont(document, foundSVGFont, isInitiatingElementInUserAgentShadowTree); 184 if (cachedFont) { 183 if (CachedFont* cachedFont = item.cachedFont(document, foundSVGFont, isInitiatingElementInUserAgentShadowTree)) 185 184 source = std::make_unique<CSSFontFaceSource>(item.resource(), cachedFont); 186 #if ENABLE(SVG_FONTS)187 if (foundSVGFont)188 source->setHasExternalSVGFont();189 #endif190 }191 185 } 192 } else {186 } else 193 187 source = std::make_unique<CSSFontFaceSource>(item.resource()); 194 }195 188 196 189 if (source) { -
trunk/Source/WebCore/loader/cache/CachedFont.cpp
r194318 r195523 93 93 } 94 94 95 bool CachedFont::ensureCustomFontData( bool,const AtomicString&)95 bool CachedFont::ensureCustomFontData(const AtomicString&) 96 96 { 97 97 return ensureCustomFontData(m_data.get()); … … 122 122 } 123 123 124 RefPtr<Font> CachedFont::createFont(const FontDescription& fontDescription, const AtomicString&, bool syntheticBold, bool syntheticItalic, bool,const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings)124 RefPtr<Font> CachedFont::createFont(const FontDescription& fontDescription, const AtomicString&, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings) 125 125 { 126 126 return Font::create(platformDataFromCustomData(fontDescription, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings), true, false); -
trunk/Source/WebCore/loader/cache/CachedFont.h
r191968 r195523 50 50 virtual bool stillNeedsLoad() const override { return !m_loadInitiated; } 51 51 52 virtual bool ensureCustomFontData( bool externalSVG,const AtomicString& remoteURI);52 virtual bool ensureCustomFontData(const AtomicString& remoteURI); 53 53 54 virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG,const FontFeatureSettings&, const FontVariantSettings&);54 virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings&, const FontVariantSettings&); 55 55 56 56 protected: -
trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp
r194839 r195523 52 52 } 53 53 54 RefPtr<Font> CachedSVGFont::createFont(const FontDescription& fontDescription, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG,const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings)54 RefPtr<Font> CachedSVGFont::createFont(const FontDescription& fontDescription, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings) 55 55 { 56 56 #if ENABLE(SVG_OTF_CONVERTER) 57 if ( !externalSVG ||firstFontFace(remoteURI))58 return CachedFont::createFont(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG,fontFaceFeatures, fontFaceVariantSettings);57 if (firstFontFace(remoteURI)) 58 return CachedFont::createFont(fontDescription, remoteURI, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings); 59 59 #else 60 if (!externalSVG) 61 return CachedFont::createFont(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG, fontFaceFeatures, fontFaceVariantSettings); 62 60 UNUSED_PARAM(fontFaceFeatures); 61 UNUSED_PARAM(fontFaceVariantSettings); 63 62 if (SVGFontFaceElement* firstFontFace = this->firstFontFace(remoteURI)) 64 63 return Font::create(std::make_unique<SVGFontData>(firstFontFace), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic); … … 74 73 } 75 74 76 bool CachedSVGFont::ensureCustomFontData( bool externalSVG,const AtomicString& remoteURI)75 bool CachedSVGFont::ensureCustomFontData(const AtomicString& remoteURI) 77 76 { 78 if (!externalSVG)79 return CachedFont::ensureCustomFontData(externalSVG, remoteURI);80 81 77 if (!m_externalSVGDocument && !errorOccurred() && !isLoading() && m_data) { 82 78 m_externalSVGDocument = SVGDocument::create(nullptr, URL()); 83 79 RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("application/xml"); 84 80 m_externalSVGDocument->setContent(decoder->decodeAndFlush(m_data->data(), m_data->size())); 85 #if !ENABLE(SVG_OTF_CONVERTER)86 81 if (decoder->sawError()) 87 82 m_externalSVGDocument = nullptr; 88 #else 89 if (decoder->sawError()) 90 m_externalSVGDocument = nullptr; 91 else 83 #if ENABLE(SVG_OTF_CONVERTER) 84 if (m_externalSVGDocument) 92 85 maybeInitializeExternalSVGFontElement(remoteURI); 93 86 if (!m_externalSVGFontElement) … … 99 92 return false; 100 93 } 94 #else 95 UNUSED_PARAM(remoteURI); 101 96 #endif 102 97 } -
trunk/Source/WebCore/loader/cache/CachedSVGFont.h
r191968 r195523 39 39 CachedSVGFont(const ResourceRequest&, SessionID); 40 40 41 virtual bool ensureCustomFontData( bool externalSVG,const AtomicString& remoteURI) override;41 virtual bool ensureCustomFontData(const AtomicString& remoteURI) override; 42 42 43 virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG,const FontFeatureSettings&, const FontVariantSettings&) override;43 virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings&, const FontVariantSettings&) override; 44 44 45 45 private: -
trunk/Source/WebCore/platform/network/HTTPParsers.cpp
r195452 r195523 126 126 if (value.isEmpty()) 127 127 return false; 128 for (unsigned i = 0; i < value.length(); ++i) {129 UChar c = value[i];128 auto valueStringView = StringView(value); 129 for (UChar c : valueStringView.codeUnits()) { 130 130 if (c <= 0x20 || c >= 0x7F 131 131 || c == '(' || c == ')' || c == '<' || c == '>' || c == '@'
Note: See TracChangeset
for help on using the changeset viewer.