Diff
Modified: trunk/Source/WebCore/ChangeLog (195522 => 195523)
--- trunk/Source/WebCore/ChangeLog 2016-01-25 04:00:36 UTC (rev 195522)
+++ trunk/Source/WebCore/ChangeLog 2016-01-25 05:23:49 UTC (rev 195523)
@@ -1,3 +1,41 @@
+2016-01-24 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ [Font Loading] General cleanup
+ https://bugs.webkit.org/show_bug.cgi?id=153403
+
+ Reviewed by Darin Adler.
+
+ It turns out that CSSFontFaceSource::m_hasExternalSVGFont exactly equals
+ whether or not CSSFontFaceSource::m_font is a CachedSVGFont. Therefore,
+ the variable is redundant.
+
+ In addition, it was being passed to functions on CSSFontFaceSource::m_font,
+ which means it was always true inside the CachedSVGFont subclass and
+ always false for the CachedFont. Therefore, there is no reason pass this
+ variable to these functions because its value can be determined at
+ authorship time.
+
+ No new tests because there is no behavior change.
+
+ * css/CSSFontFaceSource.cpp:
+ (WebCore::CSSFontFaceSource::font):
+ (WebCore::CSSFontFaceSource::CSSFontFaceSource): Deleted.
+ * css/CSSFontFaceSource.h:
+ * css/CSSFontSelector.cpp:
+ (WebCore::createFontFace):
+ * loader/cache/CachedFont.cpp:
+ (WebCore::CachedFont::ensureCustomFontData):
+ (WebCore::CachedFont::createFont):
+ * loader/cache/CachedFont.h:
+ * loader/cache/CachedSVGFont.cpp:
+ (WebCore::CachedSVGFont::createFont):
+ (WebCore::CachedSVGFont::ensureCustomFontData):
+ * loader/cache/CachedSVGFont.h:
+ * platform/network/HTTPParsers.cpp:
+ (WebCore::isValidHTTPToken):
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::XMLHttpRequest::uppercaseKnownHTTPMethod):
+
2016-01-24 Chris Dumez <cdu...@apple.com>
An XMLDocument interface should be exposed on the global Window object
Modified: trunk/Source/WebCore/css/CSSFontFaceSource.cpp (195522 => 195523)
--- trunk/Source/WebCore/css/CSSFontFaceSource.cpp 2016-01-25 04:00:36 UTC (rev 195522)
+++ trunk/Source/WebCore/css/CSSFontFaceSource.cpp 2016-01-25 05:23:49 UTC (rev 195523)
@@ -57,9 +57,6 @@
: m_string(str)
, m_font(font)
, m_face(0)
-#if ENABLE(SVG_FONTS)
- , m_hasExternalSVGFont(false)
-#endif
{
if (m_font)
m_font->addClient(this);
@@ -119,14 +116,10 @@
if (!m_font || m_font->isLoaded()) {
if (m_font) {
- bool hasExternalSVGFont = false;
-#if ENABLE(SVG_FONTS)
- hasExternalSVGFont = m_hasExternalSVGFont;
-#endif
- if (!m_font->ensureCustomFontData(hasExternalSVGFont, m_string))
+ if (!m_font->ensureCustomFontData(m_string))
return nullptr;
- font = m_font->createFont(fontDescription, m_string, syntheticBold, syntheticItalic, hasExternalSVGFont, fontFaceFeatures, fontFaceVariantSettings);
+ font = m_font->createFont(fontDescription, m_string, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings);
} else {
#if ENABLE(SVG_FONTS)
// In-Document SVG Fonts
@@ -164,6 +157,13 @@
return font.release();
}
+#if ENABLE(SVG_FONTS)
+bool CSSFontFaceSource::isSVGFontFaceSource() const
+{
+ return m_svgFontFaceElement || is<CachedSVGFont>(m_font.get());
+}
+#endif
+
#if ENABLE(FONT_LOAD_EVENTS)
bool CSSFontFaceSource::isDecodeError() const
{
Modified: trunk/Source/WebCore/css/CSSFontFaceSource.h (195522 => 195523)
--- trunk/Source/WebCore/css/CSSFontFaceSource.h 2016-01-25 04:00:36 UTC (rev 195522)
+++ trunk/Source/WebCore/css/CSSFontFaceSource.h 2016-01-25 05:23:49 UTC (rev 195523)
@@ -39,7 +39,6 @@
namespace WebCore {
-class CachedFont;
class CSSFontFace;
class CSSFontSelector;
class Font;
@@ -68,8 +67,7 @@
#if ENABLE(SVG_FONTS)
SVGFontFaceElement* svgFontFaceElement() const { return m_svgFontFaceElement.get(); }
void setSVGFontFaceElement(PassRefPtr<SVGFontFaceElement> element) { m_svgFontFaceElement = element; }
- bool isSVGFontFaceSource() const { return m_svgFontFaceElement || m_hasExternalSVGFont; }
- void setHasExternalSVGFont() { m_hasExternalSVGFont = true; }
+ bool isSVGFontFaceSource() const;
#endif
#if ENABLE(FONT_LOAD_EVENTS)
@@ -91,7 +89,6 @@
#if ENABLE(SVG_FONTS) || ENABLE(SVG_OTF_CONVERTER)
RefPtr<SVGFontFaceElement> m_svgFontFaceElement;
- bool m_hasExternalSVGFont;
#endif
};
Modified: trunk/Source/WebCore/css/CSSFontSelector.cpp (195522 => 195523)
--- trunk/Source/WebCore/css/CSSFontSelector.cpp 2016-01-25 04:00:36 UTC (rev 195522)
+++ trunk/Source/WebCore/css/CSSFontSelector.cpp 2016-01-25 05:23:49 UTC (rev 195523)
@@ -180,18 +180,11 @@
Settings* settings = document ? document->settings() : nullptr;
bool allowDownloading = foundSVGFont || (settings && settings->downloadableBinaryFontsEnabled());
if (allowDownloading && item.isSupportedFormat() && document) {
- CachedFont* cachedFont = item.cachedFont(document, foundSVGFont, isInitiatingElementInUserAgentShadowTree);
- if (cachedFont) {
+ if (CachedFont* cachedFont = item.cachedFont(document, foundSVGFont, isInitiatingElementInUserAgentShadowTree))
source = std::make_unique<CSSFontFaceSource>(item.resource(), cachedFont);
-#if ENABLE(SVG_FONTS)
- if (foundSVGFont)
- source->setHasExternalSVGFont();
-#endif
- }
}
- } else {
+ } else
source = std::make_unique<CSSFontFaceSource>(item.resource());
- }
if (source) {
#if ENABLE(SVG_FONTS)
Modified: trunk/Source/WebCore/loader/cache/CachedFont.cpp (195522 => 195523)
--- trunk/Source/WebCore/loader/cache/CachedFont.cpp 2016-01-25 04:00:36 UTC (rev 195522)
+++ trunk/Source/WebCore/loader/cache/CachedFont.cpp 2016-01-25 05:23:49 UTC (rev 195523)
@@ -92,7 +92,7 @@
}
}
-bool CachedFont::ensureCustomFontData(bool, const AtomicString&)
+bool CachedFont::ensureCustomFontData(const AtomicString&)
{
return ensureCustomFontData(m_data.get());
}
@@ -121,7 +121,7 @@
return m_fontCustomPlatformData.get();
}
-RefPtr<Font> CachedFont::createFont(const FontDescription& fontDescription, const AtomicString&, bool syntheticBold, bool syntheticItalic, bool, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings)
+RefPtr<Font> CachedFont::createFont(const FontDescription& fontDescription, const AtomicString&, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings)
{
return Font::create(platformDataFromCustomData(fontDescription, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings), true, false);
}
Modified: trunk/Source/WebCore/loader/cache/CachedFont.h (195522 => 195523)
--- trunk/Source/WebCore/loader/cache/CachedFont.h 2016-01-25 04:00:36 UTC (rev 195522)
+++ trunk/Source/WebCore/loader/cache/CachedFont.h 2016-01-25 05:23:49 UTC (rev 195523)
@@ -49,9 +49,9 @@
void beginLoadIfNeeded(CachedResourceLoader&);
virtual bool stillNeedsLoad() const override { return !m_loadInitiated; }
- virtual bool ensureCustomFontData(bool externalSVG, const AtomicString& remoteURI);
+ virtual bool ensureCustomFontData(const AtomicString& remoteURI);
- virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG, const FontFeatureSettings&, const FontVariantSettings&);
+ virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings&, const FontVariantSettings&);
protected:
FontPlatformData platformDataFromCustomData(const FontDescription&, bool bold, bool italic, const FontFeatureSettings&, const FontVariantSettings&);
Modified: trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp (195522 => 195523)
--- trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp 2016-01-25 04:00:36 UTC (rev 195522)
+++ trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp 2016-01-25 05:23:49 UTC (rev 195523)
@@ -51,15 +51,14 @@
{
}
-RefPtr<Font> CachedSVGFont::createFont(const FontDescription& fontDescription, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings)
+RefPtr<Font> CachedSVGFont::createFont(const FontDescription& fontDescription, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings)
{
#if ENABLE(SVG_OTF_CONVERTER)
- if (!externalSVG || firstFontFace(remoteURI))
- return CachedFont::createFont(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG, fontFaceFeatures, fontFaceVariantSettings);
+ if (firstFontFace(remoteURI))
+ return CachedFont::createFont(fontDescription, remoteURI, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings);
#else
- if (!externalSVG)
- return CachedFont::createFont(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG, fontFaceFeatures, fontFaceVariantSettings);
-
+ UNUSED_PARAM(fontFaceFeatures);
+ UNUSED_PARAM(fontFaceVariantSettings);
if (SVGFontFaceElement* firstFontFace = this->firstFontFace(remoteURI))
return Font::create(std::make_unique<SVGFontData>(firstFontFace), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);
#endif
@@ -73,22 +72,16 @@
return CachedFont::platformDataFromCustomData(fontDescription, bold, italic, fontFaceFeatures, fontFaceVariantSettings);
}
-bool CachedSVGFont::ensureCustomFontData(bool externalSVG, const AtomicString& remoteURI)
+bool CachedSVGFont::ensureCustomFontData(const AtomicString& remoteURI)
{
- if (!externalSVG)
- return CachedFont::ensureCustomFontData(externalSVG, remoteURI);
-
if (!m_externalSVGDocument && !errorOccurred() && !isLoading() && m_data) {
m_externalSVGDocument = SVGDocument::create(nullptr, URL());
RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("application/xml");
m_externalSVGDocument->setContent(decoder->decodeAndFlush(m_data->data(), m_data->size()));
-#if !ENABLE(SVG_OTF_CONVERTER)
if (decoder->sawError())
m_externalSVGDocument = nullptr;
-#else
- if (decoder->sawError())
- m_externalSVGDocument = nullptr;
- else
+#if ENABLE(SVG_OTF_CONVERTER)
+ if (m_externalSVGDocument)
maybeInitializeExternalSVGFontElement(remoteURI);
if (!m_externalSVGFontElement)
return false;
@@ -98,6 +91,8 @@
m_externalSVGDocument = nullptr;
return false;
}
+#else
+ UNUSED_PARAM(remoteURI);
#endif
}
Modified: trunk/Source/WebCore/loader/cache/CachedSVGFont.h (195522 => 195523)
--- trunk/Source/WebCore/loader/cache/CachedSVGFont.h 2016-01-25 04:00:36 UTC (rev 195522)
+++ trunk/Source/WebCore/loader/cache/CachedSVGFont.h 2016-01-25 05:23:49 UTC (rev 195523)
@@ -38,9 +38,9 @@
public:
CachedSVGFont(const ResourceRequest&, SessionID);
- virtual bool ensureCustomFontData(bool externalSVG, const AtomicString& remoteURI) override;
+ virtual bool ensureCustomFontData(const AtomicString& remoteURI) override;
- virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG, const FontFeatureSettings&, const FontVariantSettings&) override;
+ virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings&, const FontVariantSettings&) override;
private:
FontPlatformData platformDataFromCustomData(const FontDescription&, bool bold, bool italic, const FontFeatureSettings&, const FontVariantSettings&);
Modified: trunk/Source/WebCore/platform/network/HTTPParsers.cpp (195522 => 195523)
--- trunk/Source/WebCore/platform/network/HTTPParsers.cpp 2016-01-25 04:00:36 UTC (rev 195522)
+++ trunk/Source/WebCore/platform/network/HTTPParsers.cpp 2016-01-25 05:23:49 UTC (rev 195523)
@@ -125,8 +125,8 @@
{
if (value.isEmpty())
return false;
- for (unsigned i = 0; i < value.length(); ++i) {
- UChar c = value[i];
+ auto valueStringView = StringView(value);
+ for (UChar c : valueStringView.codeUnits()) {
if (c <= 0x20 || c >= 0x7F
|| c == '(' || c == ')' || c == '<' || c == '>' || c == '@'
|| c == ',' || c == ';' || c == ':' || c == '\\' || c == '"'