OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/css/CSSURIValue.h" | 5 #include "core/css/CSSURIValue.h" |
6 | 6 |
7 #include "core/css/CSSMarkup.h" | 7 #include "core/css/CSSMarkup.h" |
| 8 #include "core/dom/Document.h" |
| 9 #include "core/fetch/FetchInitiatorTypeNames.h" |
| 10 #include "core/fetch/FetchRequest.h" |
| 11 #include "core/fetch/ResourceFetcher.h" |
8 #include "wtf/text/WTFString.h" | 12 #include "wtf/text/WTFString.h" |
9 | 13 |
10 namespace blink { | 14 namespace blink { |
11 | 15 |
12 CSSURIValue::CSSURIValue(const String& str) | 16 CSSURIValue::CSSURIValue(const String& urlString) |
13 : CSSValue(URIClass) | 17 : CSSValue(URIClass) |
14 , m_string(str) { } | 18 , m_url(urlString) |
| 19 , m_loadRequested(false) |
| 20 { |
| 21 } |
| 22 |
| 23 CSSURIValue::~CSSURIValue() |
| 24 { |
| 25 } |
| 26 |
| 27 DocumentResource* CSSURIValue::load(Document& document) const |
| 28 { |
| 29 if (!m_loadRequested) { |
| 30 m_loadRequested = true; |
| 31 |
| 32 FetchRequest request(ResourceRequest(document.completeURL(m_url)), Fetch
InitiatorTypeNames::css); |
| 33 m_document = DocumentResource::fetchSVGDocument(request, document.fetche
r()); |
| 34 } |
| 35 return m_document; |
| 36 } |
15 | 37 |
16 String CSSURIValue::customCSSText() const | 38 String CSSURIValue::customCSSText() const |
17 { | 39 { |
18 return serializeURI(m_string); | 40 return serializeURI(m_url); |
| 41 } |
| 42 |
| 43 bool CSSURIValue::equals(const CSSURIValue& other) const |
| 44 { |
| 45 return m_url == other.m_url; |
19 } | 46 } |
20 | 47 |
21 DEFINE_TRACE_AFTER_DISPATCH(CSSURIValue) | 48 DEFINE_TRACE_AFTER_DISPATCH(CSSURIValue) |
22 { | 49 { |
| 50 visitor->trace(m_document); |
23 CSSValue::traceAfterDispatch(visitor); | 51 CSSValue::traceAfterDispatch(visitor); |
24 } | 52 } |
25 | 53 |
26 } // namespace blink | 54 } // namespace blink |
OLD | NEW |