Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (176266 => 176267)
--- trunk/Source/WebCore/CMakeLists.txt 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/CMakeLists.txt 2014-11-18 18:52:38 UTC (rev 176267)
@@ -1842,7 +1842,6 @@
loader/archive/mhtml/MHTMLParser.cpp
loader/cache/CachedCSSStyleSheet.cpp
- loader/cache/CachedSVGFont.cpp
loader/cache/CachedFont.cpp
loader/cache/CachedImage.cpp
loader/cache/CachedRawResource.cpp
Modified: trunk/Source/WebCore/ChangeLog (176266 => 176267)
--- trunk/Source/WebCore/ChangeLog 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/ChangeLog 2014-11-18 18:52:38 UTC (rev 176267)
@@ -1,3 +1,16 @@
+2014-11-18 Commit Queue <[email protected]>
+
+ Unreviewed, rolling out r176264.
+ https://bugs.webkit.org/show_bug.cgi?id=138837
+
+ caused many test failures (Requested by litherum on #webkit).
+
+ Reverted changeset:
+
+ "Subclass CachedFont for SVG fonts"
+ https://bugs.webkit.org/show_bug.cgi?id=138686
+ http://trac.webkit.org/changeset/176264
+
2014-11-18 Daniel Bates <[email protected]>
[iOS] Libdispatch, Dyld, IOKit, Mach, NSPointerFunctions, MobileGestalt
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (176266 => 176267)
--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj 2014-11-18 18:52:38 UTC (rev 176267)
@@ -7328,7 +7328,6 @@
<ClCompile Include="..\loader\archive\mhtml\MHTMLParser.cpp" />
<ClCompile Include="..\loader\cache\CachedCSSStyleSheet.cpp" />
<ClCompile Include="..\loader\cache\CachedFont.cpp" />
- <ClCompile Include="..\loader\cache\CachedSVGFont.cpp" />
<ClCompile Include="..\loader\cache\CachedImage.cpp" />
<ClCompile Include="..\loader\cache\CachedRawResource.cpp" />
<ClCompile Include="..\loader\cache\CachedResource.cpp" />
@@ -19280,7 +19279,6 @@
<ClInclude Include="..\loader\archive\mhtml\MHTMLParser.h" />
<ClInclude Include="..\loader\cache\CachedCSSStyleSheet.h" />
<ClInclude Include="..\loader\cache\CachedFont.h" />
- <ClInclude Include="..\loader\cache\CachedSVGFont.h" />
<ClInclude Include="..\loader\cache\CachedImage.h" />
<ClInclude Include="..\loader\cache\CachedRawResource.h" />
<ClInclude Include="..\loader\cache\CachedRawResourceClient.h" />
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (176266 => 176267)
--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters 2014-11-18 18:52:38 UTC (rev 176267)
@@ -1026,9 +1026,6 @@
<ClCompile Include="..\loader\cache\CachedCSSStyleSheet.cpp">
<Filter>loader\cache</Filter>
</ClCompile>
- <ClCompile Include="..\loader\cache\CachedSVGFont.cpp">
- <Filter>loader\cache</Filter>
- </ClCompile>
<ClCompile Include="..\loader\cache\CachedFont.cpp">
<Filter>loader\cache</Filter>
</ClCompile>
@@ -8055,9 +8052,6 @@
<ClInclude Include="..\loader\cache\CachedCSSStyleSheet.h">
<Filter>loader\cache</Filter>
</ClInclude>
- <ClInclude Include="..\loader\cache\CachedSVGFont.h">
- <Filter>loader\cache</Filter>
- </ClInclude>
<ClInclude Include="..\loader\cache\CachedFont.h">
<Filter>loader\cache</Filter>
</ClInclude>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (176266 => 176267)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2014-11-18 18:52:38 UTC (rev 176267)
@@ -927,8 +927,6 @@
1AFE119A0CBFFCC4003017FA /* JSSQLResultSetRowList.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AFE11980CBFFCC4003017FA /* JSSQLResultSetRowList.h */; };
1C010700192594DF008A4201 /* InlineTextBoxStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C0106FE192594DF008A4201 /* InlineTextBoxStyle.cpp */; };
1C010701192594DF008A4201 /* InlineTextBoxStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C0106FF192594DF008A4201 /* InlineTextBoxStyle.h */; };
- 1C0939EA1A13E12900B788E5 /* CachedSVGFont.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C0939E81A13E12900B788E5 /* CachedSVGFont.cpp */; };
- 1C0939EB1A13E12900B788E5 /* CachedSVGFont.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C0939E91A13E12900B788E5 /* CachedSVGFont.h */; };
1C11CCB50AA6093700DADB20 /* DOMNotation.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 85CA96E80A9624E900690CCF /* DOMNotation.h */; };
1C11CCB60AA6093700DADB20 /* DOMComment.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 85089CD10A98C42700A275AA /* DOMComment.h */; };
1C11CCB70AA6093700DADB20 /* DOMNamedNodeMap.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 8518DD760A9CF31B0091B7A6 /* DOMNamedNodeMap.h */; };
@@ -7934,8 +7932,6 @@
1AFE11980CBFFCC4003017FA /* JSSQLResultSetRowList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLResultSetRowList.h; sourceTree = "<group>"; };
1C0106FE192594DF008A4201 /* InlineTextBoxStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InlineTextBoxStyle.cpp; sourceTree = "<group>"; };
1C0106FF192594DF008A4201 /* InlineTextBoxStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineTextBoxStyle.h; sourceTree = "<group>"; };
- 1C0939E81A13E12900B788E5 /* CachedSVGFont.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedSVGFont.cpp; sourceTree = "<group>"; };
- 1C0939E91A13E12900B788E5 /* CachedSVGFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedSVGFont.h; sourceTree = "<group>"; };
1C18DA56181AF6A500C4EF22 /* TextPainter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextPainter.cpp; sourceTree = "<group>"; };
1C18DA57181AF6A500C4EF22 /* TextPainter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextPainter.h; sourceTree = "<group>"; };
1C21E57A183ED1FF001C289D /* IOSurfacePool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = IOSurfacePool.cpp; path = ../cg/IOSurfacePool.cpp; sourceTree = "<group>"; };
@@ -19601,8 +19597,6 @@
E467680F1A0177F900B9E26B /* CacheValidation.h */,
BCB16BFE0979C3BD00467741 /* MemoryCache.cpp */,
BCB16BFF0979C3BD00467741 /* MemoryCache.h */,
- 1C0939E81A13E12900B788E5 /* CachedSVGFont.cpp */,
- 1C0939E91A13E12900B788E5 /* CachedSVGFont.h */,
);
path = cache;
sourceTree = "<group>";
@@ -26245,7 +26239,6 @@
B22279E90D00BF220071B782 /* SVGFEFuncRElement.h in Headers */,
B22279EC0D00BF220071B782 /* SVGFEGaussianBlurElement.h in Headers */,
B25599850D00D8BA00BB825C /* SVGFEImage.h in Headers */,
- 1C0939EB1A13E12900B788E5 /* CachedSVGFont.h in Headers */,
B22279EF0D00BF220071B782 /* SVGFEImageElement.h in Headers */,
B22279F20D00BF220071B782 /* SVGFELightElement.h in Headers */,
B22279F40D00BF220071B782 /* SVGFEMergeElement.h in Headers */,
@@ -29457,7 +29450,6 @@
51327D6111A33A2B004F9D65 /* SinkDocument.cpp in Sources */,
49E911CC0EF86D47009D0CAF /* SkewTransformOperation.cpp in Sources */,
4150F9F212B6E0E70008C860 /* SliderThumbElement.cpp in Sources */,
- 1C0939EA1A13E12900B788E5 /* CachedSVGFont.cpp in Sources */,
4B6FA6F70C39E4A100087011 /* SmartReplaceCF.cpp in Sources */,
E4AFD00B0DAF335400F5F55C /* SMILTime.cpp in Sources */,
E4AFD00D0DAF335500F5F55C /* SMILTimeContainer.cpp in Sources */,
Modified: trunk/Source/WebCore/css/CSSFontFaceSource.cpp (176266 => 176267)
--- trunk/Source/WebCore/css/CSSFontFaceSource.cpp 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/css/CSSFontFaceSource.cpp 2014-11-18 18:52:38 UTC (rev 176267)
@@ -37,7 +37,6 @@
#include "SimpleFontData.h"
#if ENABLE(SVG_FONTS)
-#include "CachedSVGFont.h"
#include "FontCustomPlatformData.h"
#include "SVGFontData.h"
#include "SVGFontElement.h"
@@ -123,11 +122,42 @@
// If we are still loading, then we let the system pick a font.
if (isLoaded()) {
if (m_font) {
- // Create new FontPlatformData from our CGFontRef, point size and ATSFontRef.
- if (!m_font->ensureCustomFontData(m_hasExternalSVGFont))
- return nullptr;
+#if ENABLE(SVG_FONTS)
+ if (m_hasExternalSVGFont) {
+ // For SVG fonts parse the external SVG document, and extract the <font> element.
+ if (!m_font->ensureSVGFontData())
+ return 0;
- fontData = m_font->getFontData(fontDescription, m_string, syntheticBold, syntheticItalic, m_hasExternalSVGFont);
+ if (!m_externalSVGFontElement) {
+ String fragmentIdentifier;
+ size_t start = m_string.find('#');
+ if (start != notFound)
+ fragmentIdentifier = m_string.string().substring(start + 1);
+ m_externalSVGFontElement = m_font->getSVGFontById(fragmentIdentifier);
+ }
+
+ if (!m_externalSVGFontElement)
+ return 0;
+
+ if (auto firstFontFace = childrenOfType<SVGFontFaceElement>(*m_externalSVGFontElement).first()) {
+ if (!m_svgFontFaceElement) {
+ // We're created using a CSS @font-face rule, that means we're not associated with a SVGFontFaceElement.
+ // Use the imported <font-face> tag as referencing font-face element for these cases.
+ m_svgFontFaceElement = firstFontFace;
+ }
+
+ fontData = SimpleFontData::create(std::make_unique<SVGFontData>(firstFontFace), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);
+ }
+ } else
+#endif
+ {
+ // Create new FontPlatformData from our CGFontRef, point size and ATSFontRef.
+ if (!m_font->ensureCustomFontData())
+ return 0;
+
+ fontData = SimpleFontData::create(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic,
+ fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false);
+ }
} else {
#if ENABLE(SVG_FONTS)
// In-Document SVG Fonts
@@ -149,6 +179,23 @@
return fontData.release();
}
+#if ENABLE(SVG_FONTS)
+SVGFontFaceElement* CSSFontFaceSource::svgFontFaceElement() const
+{
+ return m_svgFontFaceElement.get();
+}
+
+void CSSFontFaceSource::setSVGFontFaceElement(PassRefPtr<SVGFontFaceElement> element)
+{
+ m_svgFontFaceElement = element;
+}
+
+bool CSSFontFaceSource::isSVGFontFaceSource() const
+{
+ return m_svgFontFaceElement || m_hasExternalSVGFont;
+}
+#endif
+
#if ENABLE(FONT_LOAD_EVENTS)
bool CSSFontFaceSource::isDecodeError() const
{
@@ -161,7 +208,11 @@
{
if (!m_font)
return false;
- return m_font->ensureCustomFontData(m_hasExternalSVGFont);
+#if ENABLE(SVG_FONTS)
+ if (m_hasExternalSVGFont)
+ return m_font->ensureSVGFontData();
+#endif
+ return m_font->ensureCustomFontData();
}
#endif
Modified: trunk/Source/WebCore/css/CSSFontFaceSource.h (176266 => 176267)
--- trunk/Source/WebCore/css/CSSFontFaceSource.h 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/css/CSSFontFaceSource.h 2014-11-18 18:52:38 UTC (rev 176267)
@@ -28,11 +28,6 @@
#include "CachedFontClient.h"
#include "CachedResourceHandle.h"
-#include "SharedBuffer.h"
-#if ENABLE(SVG_FONTS)
-#include "SVGFontElement.h"
-#include "SVGFontFaceElement.h"
-#endif
#include "Timer.h"
#include <wtf/HashMap.h>
#include <wtf/text/AtomicString.h>
@@ -44,6 +39,10 @@
class CSSFontSelector;
class FontDescription;
class SimpleFontData;
+#if ENABLE(SVG_FONTS)
+class SVGFontElement;
+class SVGFontFaceElement;
+#endif
class CSSFontFaceSource final : public CachedFontClient {
public:
@@ -64,10 +63,10 @@
void pruneTable();
#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; }
+ SVGFontFaceElement* svgFontFaceElement() const;
+ void setSVGFontFaceElement(PassRefPtr<SVGFontFaceElement>);
+ bool isSVGFontFaceSource() const;
+ void setHasExternalSVGFont(bool value) { m_hasExternalSVGFont = value; }
#endif
#if ENABLE(FONT_LOAD_EVENTS)
@@ -85,6 +84,7 @@
#if ENABLE(SVG_FONTS)
RefPtr<SVGFontFaceElement> m_svgFontFaceElement;
+ RefPtr<SVGFontElement> m_externalSVGFontElement;
bool m_hasExternalSVGFont;
#endif
};
Modified: trunk/Source/WebCore/css/CSSFontFaceSrcValue.cpp (176266 => 176267)
--- trunk/Source/WebCore/css/CSSFontFaceSrcValue.cpp 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/css/CSSFontFaceSrcValue.cpp 2014-11-18 18:52:38 UTC (rev 176267)
@@ -43,11 +43,6 @@
{
return equalIgnoringCase(m_format, "svg");
}
-
-bool CSSFontFaceSrcValue::isSVGFontTarget() const
-{
- return isSVGFontFaceSrc() || svgFontFaceElement();
-}
#endif
bool CSSFontFaceSrcValue::isSupportedFormat() const
@@ -98,12 +93,12 @@
return m_cachedFont->loadFailedOrCanceled();
}
-CachedFont* CSSFontFaceSrcValue::cachedFont(Document* document, bool isSVG)
+CachedFont* CSSFontFaceSrcValue::cachedFont(Document* document)
{
if (!m_cachedFont) {
CachedResourceRequest request(ResourceRequest(document->completeURL(m_resource)));
request.setInitiator(cachedResourceRequestInitiators().css);
- m_cachedFont = document->cachedResourceLoader()->requestFont(request, isSVG);
+ m_cachedFont = document->cachedResourceLoader()->requestFont(request);
}
return m_cachedFont.get();
}
Modified: trunk/Source/WebCore/css/CSSFontFaceSrcValue.h (176266 => 176267)
--- trunk/Source/WebCore/css/CSSFontFaceSrcValue.h 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/css/CSSFontFaceSrcValue.h 2014-11-18 18:52:38 UTC (rev 176267)
@@ -58,7 +58,6 @@
#if ENABLE(SVG_FONTS)
bool isSVGFontFaceSrc() const;
- bool isSVGFontTarget() const;
SVGFontFaceElement* svgFontFaceElement() const { return m_svgFontFaceElement; }
void setSVGFontFaceElement(SVGFontFaceElement* element) { m_svgFontFaceElement = element; }
@@ -70,7 +69,7 @@
bool hasFailedOrCanceledSubresources() const;
- CachedFont* cachedFont(Document*, bool isSVG);
+ CachedFont* cachedFont(Document*);
bool equals(const CSSFontFaceSrcValue&) const;
Modified: trunk/Source/WebCore/css/CSSFontSelector.cpp (176266 => 176267)
--- trunk/Source/WebCore/css/CSSFontSelector.cpp 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/css/CSSFontSelector.cpp 2014-11-18 18:52:38 UTC (rev 176267)
@@ -212,12 +212,12 @@
Settings* settings = m_document ? m_document->frame() ? &m_document->frame()->settings() : 0 : 0;
bool allowDownloading = foundSVGFont || (settings && settings->downloadableBinaryFontsEnabled());
if (allowDownloading && item.isSupportedFormat() && m_document) {
- CachedFont* cachedFont = item.cachedFont(m_document, foundSVGFont);
+ CachedFont* cachedFont = item.cachedFont(m_document);
if (cachedFont) {
source = std::make_unique<CSSFontFaceSource>(item.resource(), cachedFont);
#if ENABLE(SVG_FONTS)
if (foundSVGFont)
- source->setHasExternalSVGFont();
+ source->setHasExternalSVGFont(true);
#endif
}
}
Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (176266 => 176267)
--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp 2014-11-18 18:52:38 UTC (rev 176267)
@@ -297,9 +297,6 @@
switch (cachedResource.type()) {
case CachedResource::ImageResource:
return InspectorPageAgent::ImageResource;
-#if ENABLE(SVG_FONTS)
- case CachedResource::SVGFontResource:
-#endif
case CachedResource::FontResource:
return InspectorPageAgent::FontResource;
case CachedResource::CSSStyleSheet:
@@ -457,9 +454,6 @@
switch (cachedResource->type()) {
case CachedResource::ImageResource:
// Skip images that were not auto loaded (images disabled in the user agent).
-#if ENABLE(SVG_FONTS)
- case CachedResource::SVGFontResource:
-#endif
case CachedResource::FontResource:
// Skip fonts that were referenced in CSS but never used/downloaded.
if (cachedResource->stillNeedsLoad())
Modified: trunk/Source/WebCore/loader/cache/CachedFont.cpp (176266 => 176267)
--- trunk/Source/WebCore/loader/cache/CachedFont.cpp 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/loader/cache/CachedFont.cpp 2014-11-18 18:52:38 UTC (rev 176267)
@@ -31,7 +31,6 @@
#include "CachedResourceClientWalker.h"
#include "CachedResourceLoader.h"
#include "FontCustomPlatformData.h"
-#include "FontDescription.h"
#include "FontPlatformData.h"
#include "MemoryCache.h"
#include "SharedBuffer.h"
@@ -40,10 +39,6 @@
#include "WOFFFileFormat.h"
#include <wtf/Vector.h>
-#if ENABLE(SVG_OTF_CONVERTER)
-#include "SVGToOTFFontConversion.h"
-#endif
-
#if ENABLE(SVG_FONTS)
#include "NodeList.h"
#include "SVGDocument.h"
@@ -55,8 +50,8 @@
namespace WebCore {
-CachedFont::CachedFont(const ResourceRequest& resourceRequest, SessionID sessionID, Type type)
- : CachedResource(resourceRequest, type, sessionID)
+CachedFont::CachedFont(const ResourceRequest& resourceRequest, SessionID sessionID)
+ : CachedResource(resourceRequest, FontResource, sessionID)
, m_loadInitiated(false)
, m_hasCreatedFontDataWrappingResource(false)
{
@@ -96,7 +91,7 @@
}
}
-bool CachedFont::ensureCustomFontData(bool)
+bool CachedFont::ensureCustomFontData()
{
if (!m_fontData && !errorOccurred() && !isLoading() && m_data) {
RefPtr<SharedBuffer> buffer = m_data;
@@ -123,18 +118,46 @@
return m_fontData.get();
}
-PassRefPtr<SimpleFontData> CachedFont::getFontData(const FontDescription& fontDescription, const AtomicString&, bool syntheticBold, bool syntheticItalic, bool)
-{
- return SimpleFontData::create(platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic,
- fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false);
-}
-
FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant widthVariant, FontRenderingMode renderingMode)
{
+#if ENABLE(SVG_FONTS)
+ if (m_externalSVGDocument)
+ return FontPlatformData(size, bold, italic);
+#endif
ASSERT(m_fontData);
return m_fontData->fontPlatformData(static_cast<int>(size), bold, italic, orientation, widthVariant, renderingMode);
}
+#if ENABLE(SVG_FONTS)
+
+bool CachedFont::ensureSVGFontData()
+{
+ 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 (decoder->sawError())
+ m_externalSVGDocument = nullptr;
+ }
+ return m_externalSVGDocument;
+}
+
+SVGFontElement* CachedFont::getSVGFontById(const String& fontName) const
+{
+ auto elements = descendantsOfType<SVGFontElement>(*m_externalSVGDocument);
+
+ if (fontName.isEmpty())
+ return elements.first();
+
+ for (auto& element : elements) {
+ if (element.getIdAttribute() == fontName)
+ return &element;
+ }
+ return nullptr;
+}
+
+#endif
+
void CachedFont::allClientsRemoved()
{
m_fontData = nullptr;
Modified: trunk/Source/WebCore/loader/cache/CachedFont.h (176266 => 176267)
--- trunk/Source/WebCore/loader/cache/CachedFont.h 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/loader/cache/CachedFont.h 2014-11-18 18:52:38 UTC (rev 176267)
@@ -31,32 +31,31 @@
#include "FontOrientation.h"
#include "FontRenderingMode.h"
#include "FontWidthVariant.h"
-#include "SimpleFontData.h"
namespace WebCore {
class CachedResourceLoader;
-class FontDescription;
class FontPlatformData;
class SVGDocument;
class SVGFontElement;
struct FontCustomPlatformData;
-class CachedFont : public CachedResource {
+class CachedFont final : public CachedResource {
public:
- CachedFont(const ResourceRequest&, SessionID, Type = FontResource);
+ CachedFont(const ResourceRequest&, SessionID);
virtual ~CachedFont();
void beginLoadIfNeeded(CachedResourceLoader* dl);
virtual bool stillNeedsLoad() const override { return !m_loadInitiated; }
- virtual bool ensureCustomFontData(bool externalSVG);
+ bool ensureCustomFontData();
+ FontPlatformData platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);
- virtual PassRefPtr<SimpleFontData> getFontData(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG);
+#if ENABLE(SVG_FONTS)
+ bool ensureSVGFontData();
+ SVGFontElement* getSVGFontById(const String&) const;
+#endif
-protected:
- FontPlatformData platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);
-
private:
virtual void checkNotify() override;
virtual bool mayTryReplaceEncodedData() const override;
@@ -72,6 +71,10 @@
bool m_loadInitiated;
bool m_hasCreatedFontDataWrappingResource;
+#if ENABLE(SVG_FONTS)
+ RefPtr<SVGDocument> m_externalSVGDocument;
+#endif
+
friend class MemoryCache;
};
Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (176266 => 176267)
--- trunk/Source/WebCore/loader/cache/CachedResource.cpp 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp 2014-11-18 18:52:38 UTC (rev 176267)
@@ -69,9 +69,6 @@
case CachedResource::CSSStyleSheet:
return ResourceLoadPriorityHigh;
case CachedResource::Script:
-#if ENABLE(SVG_FONTS)
- case CachedResource::SVGFontResource:
-#endif
case CachedResource::FontResource:
case CachedResource::RawResource:
return ResourceLoadPriorityMedium;
Modified: trunk/Source/WebCore/loader/cache/CachedResource.h (176266 => 176267)
--- trunk/Source/WebCore/loader/cache/CachedResource.h 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/loader/cache/CachedResource.h 2014-11-18 18:52:38 UTC (rev 176267)
@@ -66,9 +66,6 @@
CSSStyleSheet,
Script,
FontResource,
-#if ENABLE(SVG_FONTS)
- SVGFontResource,
-#endif
RawResource,
SVGDocumentResource
#if ENABLE(XSLT)
Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (176266 => 176267)
--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2014-11-18 18:52:38 UTC (rev 176267)
@@ -33,7 +33,6 @@
#include "CachedImage.h"
#include "CachedRawResource.h"
#include "CachedResourceRequest.h"
-#include "CachedSVGFont.h"
#include "CachedScript.h"
#include "CachedXSLStyleSheet.h"
#include "Chrome.h"
@@ -85,10 +84,6 @@
return new CachedScript(request, charset, sessionID);
case CachedResource::SVGDocumentResource:
return new CachedSVGDocument(request, sessionID);
-#if ENABLE(SVG_FONTS)
- case CachedResource::SVGFontResource:
- return new CachedSVGFont(request, sessionID);
-#endif
case CachedResource::FontResource:
return new CachedFont(request, sessionID);
case CachedResource::RawResource:
@@ -180,10 +175,8 @@
return downcast<CachedImage>(requestResource(CachedResource::ImageResource, request).get());
}
-CachedResourceHandle<CachedFont> CachedResourceLoader::requestFont(CachedResourceRequest& request, bool isSVG)
+CachedResourceHandle<CachedFont> CachedResourceLoader::requestFont(CachedResourceRequest& request)
{
- if (isSVG)
- return downcast<CachedSVGFont>(requestResource(CachedResource::SVGFontResource, request).get());
return downcast<CachedFont>(requestResource(CachedResource::FontResource, request).get());
}
@@ -281,9 +274,6 @@
#endif
case CachedResource::RawResource:
case CachedResource::ImageResource:
-#if ENABLE(SVG_FONTS)
- case CachedResource::SVGFontResource:
-#endif
case CachedResource::FontResource: {
// These resources can corrupt only the frame's pixels.
if (Frame* f = frame()) {
@@ -324,9 +314,6 @@
case CachedResource::ImageResource:
case CachedResource::CSSStyleSheet:
case CachedResource::Script:
-#if ENABLE(SVG_FONTS)
- case CachedResource::SVGFontResource:
-#endif
case CachedResource::FontResource:
case CachedResource::RawResource:
#if ENABLE(LINK_PREFETCH)
@@ -374,9 +361,6 @@
if (!shouldBypassMainWorldContentSecurityPolicy && !m_document->contentSecurityPolicy()->allowImageFromSource(url))
return false;
break;
-#if ENABLE(SVG_FONTS)
- case CachedResource::SVGFontResource:
-#endif
case CachedResource::FontResource: {
if (!shouldBypassMainWorldContentSecurityPolicy && !m_document->contentSecurityPolicy()->allowFontFromSource(url))
return false;
Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.h (176266 => 176267)
--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.h 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.h 2014-11-18 18:52:38 UTC (rev 176267)
@@ -75,7 +75,7 @@
CachedResourceHandle<CachedCSSStyleSheet> requestCSSStyleSheet(CachedResourceRequest&);
CachedResourceHandle<CachedCSSStyleSheet> requestUserCSSStyleSheet(CachedResourceRequest&);
CachedResourceHandle<CachedScript> requestScript(CachedResourceRequest&);
- CachedResourceHandle<CachedFont> requestFont(CachedResourceRequest&, bool isSVG);
+ CachedResourceHandle<CachedFont> requestFont(CachedResourceRequest&);
CachedResourceHandle<CachedRawResource> requestRawResource(CachedResourceRequest&);
CachedResourceHandle<CachedRawResource> requestMainResource(CachedResourceRequest&);
CachedResourceHandle<CachedSVGDocument> requestSVGDocument(CachedResourceRequest&);
Deleted: trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp (176266 => 176267)
--- trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp 2014-11-18 18:52:38 UTC (rev 176267)
@@ -1,116 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2009 Torch Mobile, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "CachedSVGFont.h"
-
-#if ENABLE(SVG_FONTS)
-
-#include "FontDescription.h"
-#include "FontPlatformData.h"
-#include "SVGDocument.h"
-#include "SVGFontData.h"
-#include "SVGFontElement.h"
-#include "SVGFontFaceElement.h"
-#include "SharedBuffer.h"
-#include "TextResourceDecoder.h"
-#include "TypedElementDescendantIterator.h"
-
-namespace WebCore {
-
-CachedSVGFont::CachedSVGFont(const ResourceRequest& resourceRequest, SessionID sessionID)
- : CachedFont(resourceRequest, sessionID, SVGFontResource)
- , m_externalSVGFontElement(nullptr)
-{
-}
-
-PassRefPtr<SimpleFontData> CachedSVGFont::getFontData(const FontDescription& fontDescription, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG)
-{
- if (!externalSVG)
- return CachedFont::getFontData(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG);
-
- if (SVGFontFaceElement* firstFontFace = this->firstFontFace(remoteURI))
- return SimpleFontData::create(std::make_unique<SVGFontData>(firstFontFace), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);
- return nullptr;
-}
-
-FontPlatformData CachedSVGFont::platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant widthVariant, FontRenderingMode renderingMode)
-{
- if (m_externalSVGDocument)
- return FontPlatformData(size, bold, italic);
- return CachedFont::platformDataFromCustomData(size, bold, italic, orientation, widthVariant, renderingMode);
-}
-
-bool CachedSVGFont::ensureCustomFontData(bool externalSVG)
-{
- if (!externalSVG)
- return CachedFont::ensureCustomFontData(externalSVG);
-
- 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 (decoder->sawError())
- m_externalSVGDocument = nullptr;
- }
- return m_externalSVGDocument;
-}
-
-SVGFontElement* CachedSVGFont::getSVGFontById(const String& fontName) const
-{
- auto elements = descendantsOfType<SVGFontElement>(*m_externalSVGDocument);
-
- if (fontName.isEmpty())
- return elements.first();
-
- for (auto& element : elements) {
- if (element.getIdAttribute() == fontName)
- return &element;
- }
- return nullptr;
-}
-
-SVGFontFaceElement* CachedSVGFont::firstFontFace(const AtomicString& remoteURI)
-{
- if (!m_externalSVGFontElement) {
- String fragmentIdentifier;
- size_t start = remoteURI.find('#');
- if (start != notFound)
- fragmentIdentifier = remoteURI.string().substring(start + 1);
- m_externalSVGFontElement = getSVGFontById(fragmentIdentifier);
- }
-
- if (!m_externalSVGFontElement)
- return nullptr;
-
- if (auto* firstFontFace = childrenOfType<SVGFontFaceElement>(*m_externalSVGFontElement).first())
- return firstFontFace;
- return nullptr;
-}
-
-}
-
-#endif
Deleted: trunk/Source/WebCore/loader/cache/CachedSVGFont.h (176266 => 176267)
--- trunk/Source/WebCore/loader/cache/CachedSVGFont.h 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/loader/cache/CachedSVGFont.h 2014-11-18 18:52:38 UTC (rev 176267)
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef CachedSVGFont_h
-#define CachedSVGFont_h
-
-#if ENABLE(SVG_FONTS)
-
-#include "CachedFont.h"
-
-namespace WebCore {
-
-class SVGFontFaceElement;
-
-class CachedSVGFont final : public CachedFont {
-public:
- CachedSVGFont(const ResourceRequest&, SessionID);
-
- virtual bool ensureCustomFontData(bool externalSVG) override;
-
- virtual PassRefPtr<SimpleFontData> getFontData(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG) override;
-
-private:
- FontPlatformData platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);
-
- SVGFontElement* getSVGFontById(const String&) const;
-
- SVGFontFaceElement* firstFontFace(const AtomicString& remoteURI);
-
- RefPtr<SVGDocument> m_externalSVGDocument;
- SVGFontElement* m_externalSVGFontElement;
-};
-
-}
-
-SPECIALIZE_TYPE_TRAITS_CACHED_RESOURCE(CachedSVGFont, CachedResource::SVGFontResource)
-
-#endif
-
-#endif
Modified: trunk/Source/WebCore/loader/cache/MemoryCache.cpp (176266 => 176267)
--- trunk/Source/WebCore/loader/cache/MemoryCache.cpp 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/loader/cache/MemoryCache.cpp 2014-11-18 18:52:38 UTC (rev 176267)
@@ -824,9 +824,6 @@
stats.xslStyleSheets.addResource(resource);
break;
#endif
-#if ENABLE(SVG_FONTS)
- case CachedResource::SVGFontResource:
-#endif
case CachedResource::FontResource:
stats.fonts.addResource(resource);
break;
Modified: trunk/Source/WebCore/svg/SVGFontFaceUriElement.cpp (176266 => 176267)
--- trunk/Source/WebCore/svg/SVGFontFaceUriElement.cpp 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebCore/svg/SVGFontFaceUriElement.cpp 2014-11-18 18:52:38 UTC (rev 176267)
@@ -88,12 +88,6 @@
return SVGElement::insertedInto(rootParent);
}
-static bool isSVGFontTarget(const SVGFontFaceUriElement& element)
-{
- Ref<CSSFontFaceSrcValue> srcValue(element.srcValue());
- return srcValue->isSVGFontTarget();
-}
-
void SVGFontFaceUriElement::loadFont()
{
if (m_cachedFont)
@@ -104,7 +98,7 @@
CachedResourceLoader* cachedResourceLoader = document().cachedResourceLoader();
CachedResourceRequest request(ResourceRequest(document().completeURL(href)));
request.setInitiator(this);
- m_cachedFont = cachedResourceLoader->requestFont(request, isSVGFontTarget(*this));
+ m_cachedFont = cachedResourceLoader->requestFont(request);
if (m_cachedFont) {
m_cachedFont->addClient(this);
m_cachedFont->beginLoadIfNeeded(cachedResourceLoader);
Modified: trunk/Source/WebKit2/ChangeLog (176266 => 176267)
--- trunk/Source/WebKit2/ChangeLog 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebKit2/ChangeLog 2014-11-18 18:52:38 UTC (rev 176267)
@@ -1,3 +1,16 @@
+2014-11-18 Commit Queue <[email protected]>
+
+ Unreviewed, rolling out r176264.
+ https://bugs.webkit.org/show_bug.cgi?id=138837
+
+ caused many test failures (Requested by litherum on #webkit).
+
+ Reverted changeset:
+
+ "Subclass CachedFont for SVG fonts"
+ https://bugs.webkit.org/show_bug.cgi?id=138686
+ http://trac.webkit.org/changeset/176264
+
2014-11-18 Daniel Bates <[email protected]>
[iOS] Libdispatch, Dyld, IOKit, Mach, NSPointerFunctions, MobileGestalt
Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp (176266 => 176267)
--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp 2014-11-18 18:14:45 UTC (rev 176266)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp 2014-11-18 18:52:38 UTC (rev 176267)
@@ -92,9 +92,6 @@
switch (resource->type()) {
case CachedResource::CSSStyleSheet:
case CachedResource::Script:
-#if ENABLE(SVG_FONTS)
- case CachedResource::SVGFontResource:
-#endif
case CachedResource::FontResource:
return std::chrono::milliseconds::max();
case CachedResource::ImageResource: