| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Torch Mobile, Inc. | 3 * Copyright (C) 2009 Torch Mobile, Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "core/fetch/ResourceClientWalker.h" | 30 #include "core/fetch/ResourceClientWalker.h" |
| 31 #include "core/html/parser/TextResourceDecoder.h" | 31 #include "core/html/parser/TextResourceDecoder.h" |
| 32 #include "platform/SharedBuffer.h" | 32 #include "platform/SharedBuffer.h" |
| 33 #include "platform/fonts/FontCustomPlatformData.h" | 33 #include "platform/fonts/FontCustomPlatformData.h" |
| 34 #include "platform/fonts/FontPlatformData.h" | 34 #include "platform/fonts/FontPlatformData.h" |
| 35 #include "public/platform/Platform.h" | 35 #include "public/platform/Platform.h" |
| 36 #include "wtf/CurrentTime.h" | 36 #include "wtf/CurrentTime.h" |
| 37 | 37 |
| 38 #if ENABLE(SVG_FONTS) | 38 #if ENABLE(SVG_FONTS) |
| 39 #include "SVGNames.h" | 39 #include "SVGNames.h" |
| 40 #include "core/dom/XMLDocument.h" |
| 40 #include "core/html/HTMLCollection.h" | 41 #include "core/html/HTMLCollection.h" |
| 41 #include "core/svg/SVGDocument.h" | |
| 42 #include "core/svg/SVGFontElement.h" | 42 #include "core/svg/SVGFontElement.h" |
| 43 #endif | 43 #endif |
| 44 | 44 |
| 45 namespace WebCore { | 45 namespace WebCore { |
| 46 | 46 |
| 47 static const double fontLoadWaitLimitSec = 3.0; | 47 static const double fontLoadWaitLimitSec = 3.0; |
| 48 | 48 |
| 49 FontResource::FontResource(const ResourceRequest& resourceRequest) | 49 FontResource::FontResource(const ResourceRequest& resourceRequest) |
| 50 : Resource(resourceRequest, Font) | 50 : Resource(resourceRequest, Font) |
| 51 , m_loadInitiated(false) | 51 , m_loadInitiated(false) |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 #endif | 106 #endif |
| 107 ASSERT(m_fontData); | 107 ASSERT(m_fontData); |
| 108 return m_fontData->fontPlatformData(size, bold, italic, orientation, widthVa
riant); | 108 return m_fontData->fontPlatformData(size, bold, italic, orientation, widthVa
riant); |
| 109 } | 109 } |
| 110 | 110 |
| 111 #if ENABLE(SVG_FONTS) | 111 #if ENABLE(SVG_FONTS) |
| 112 bool FontResource::ensureSVGFontData() | 112 bool FontResource::ensureSVGFontData() |
| 113 { | 113 { |
| 114 if (!m_externalSVGDocument && !errorOccurred() && !isLoading()) { | 114 if (!m_externalSVGDocument && !errorOccurred() && !isLoading()) { |
| 115 if (m_data) { | 115 if (m_data) { |
| 116 m_externalSVGDocument = SVGDocument::create(); | 116 m_externalSVGDocument = XMLDocument::createSVG(); |
| 117 | 117 |
| 118 OwnPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("a
pplication/xml"); | 118 OwnPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("a
pplication/xml"); |
| 119 String svgSource = decoder->decode(m_data->data(), m_data->size()); | 119 String svgSource = decoder->decode(m_data->data(), m_data->size()); |
| 120 svgSource = svgSource + decoder->flush(); | 120 svgSource = svgSource + decoder->flush(); |
| 121 | 121 |
| 122 m_externalSVGDocument->setContent(svgSource); | 122 m_externalSVGDocument->setContent(svgSource); |
| 123 | 123 |
| 124 if (decoder->sawError()) | 124 if (decoder->sawError()) |
| 125 m_externalSVGDocument = nullptr; | 125 m_externalSVGDocument = nullptr; |
| 126 } | 126 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 if (m_corsFailed) { | 191 if (m_corsFailed) { |
| 192 while (FontResourceClient* client = w.next()) | 192 while (FontResourceClient* client = w.next()) |
| 193 client->corsFailed(this); | 193 client->corsFailed(this); |
| 194 } else { | 194 } else { |
| 195 while (FontResourceClient* c = w.next()) | 195 while (FontResourceClient* c = w.next()) |
| 196 c->fontLoaded(this); | 196 c->fontLoaded(this); |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 | 199 |
| 200 } | 200 } |
| OLD | NEW |