Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(987)

Unified Diff: Source/core/fetch/FontResource.cpp

Issue 656913006: Remove SVG fonts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update tests for landing Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/fetch/FontResource.cpp
diff --git a/Source/core/fetch/FontResource.cpp b/Source/core/fetch/FontResource.cpp
index 1e99662cdbb3e9131f258cefe5b562f10c87ccc1..98c9f2f9ec1f374c8c3567bf6e397d5eb8bd340f 100644
--- a/Source/core/fetch/FontResource.cpp
+++ b/Source/core/fetch/FontResource.cpp
@@ -36,13 +36,6 @@
#include "public/platform/Platform.h"
#include "wtf/CurrentTime.h"
-#if ENABLE(SVG_FONTS)
-#include "core/SVGNames.h"
-#include "core/dom/XMLDocument.h"
-#include "core/html/HTMLCollection.h"
-#include "core/svg/SVGFontElement.h"
-#endif
-
namespace blink {
static const double fontLoadWaitLimitSec = 3.0;
@@ -87,14 +80,6 @@ FontResource::~FontResource()
{
}
-void FontResource::trace(Visitor* visitor)
-{
-#if ENABLE(SVG_FONTS)
- visitor->trace(m_externalSVGDocument);
-#endif
- Resource::trace(visitor);
-}
-
void FontResource::didScheduleLoad()
{
if (m_state == Unloaded)
@@ -153,71 +138,10 @@ bool FontResource::ensureCustomFontData()
FontPlatformData FontResource::platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant widthVariant)
{
-#if ENABLE(SVG_FONTS)
- if (m_externalSVGDocument)
- return FontPlatformData(size, bold, italic);
-#endif
ASSERT(m_fontData);
return m_fontData->fontPlatformData(size, bold, italic, orientation, widthVariant);
}
-#if ENABLE(SVG_FONTS)
-bool FontResource::ensureSVGFontData()
-{
- if (!m_externalSVGDocument && !errorOccurred() && !isLoading()) {
- if (m_data) {
- m_externalSVGDocument = XMLDocument::createSVG();
-
- OwnPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("application/xml");
- String svgSource = decoder->decode(m_data->data(), m_data->size());
- svgSource = svgSource + decoder->flush();
-
- m_externalSVGDocument->setContent(svgSource);
-
- if (decoder->sawError())
- m_externalSVGDocument = nullptr;
- }
- if (m_externalSVGDocument) {
- recordPackageFormatHistogram(PackageFormatSVG);
- } else {
- setStatus(DecodeError);
- recordPackageFormatHistogram(PackageFormatUnknown);
- }
- }
-
- return m_externalSVGDocument;
-}
-
-SVGFontElement* FontResource::getSVGFontById(const String& fontName) const
-{
- RefPtrWillBeRawPtr<TagCollection> collection = m_externalSVGDocument->getElementsByTagNameNS(SVGNames::fontTag.namespaceURI(), SVGNames::fontTag.localName());
- if (!collection)
- return 0;
-
- unsigned collectionLength = collection->length();
- if (!collectionLength)
- return 0;
-
-#if ENABLE(ASSERT)
- for (unsigned i = 0; i < collectionLength; ++i) {
- ASSERT(collection->item(i));
- ASSERT(isSVGFontElement(collection->item(i)));
- }
-#endif
-
- if (fontName.isEmpty())
- return toSVGFontElement(collection->item(0));
-
- for (unsigned i = 0; i < collectionLength; ++i) {
- SVGFontElement* element = toSVGFontElement(collection->item(i));
- if (element->getIdAttribute() == fontName)
- return element;
- }
-
- return 0;
-}
-#endif
-
bool FontResource::isSafeToUnlock() const
{
return m_data->hasOneRef();

Powered by Google App Engine
This is Rietveld 408576698