OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 19 matching lines...) Expand all Loading... |
30 namespace blink { | 30 namespace blink { |
31 | 31 |
32 class Document; | 32 class Document; |
33 class KURL; | 33 class KURL; |
34 class StyleImage; | 34 class StyleImage; |
35 class LayoutObject; | 35 class LayoutObject; |
36 | 36 |
37 class CORE_EXPORT CSSImageValue : public CSSValue { | 37 class CORE_EXPORT CSSImageValue : public CSSValue { |
38 public: | 38 public: |
39 static CSSImageValue* create(const KURL& url, StyleImage* image = 0) { | 39 static CSSImageValue* create(const KURL& url, StyleImage* image = 0) { |
40 return create(url.getString(), url, image); | 40 return create(url.getString(), url, Referrer(), image); |
41 } | 41 } |
42 static CSSImageValue* create(const String& rawValue, | 42 static CSSImageValue* create(const String& rawValue, |
43 const KURL& url, | 43 const KURL& url, |
| 44 const Referrer& referrer, |
44 StyleImage* image = 0) { | 45 StyleImage* image = 0) { |
45 return create(AtomicString(rawValue), url, image); | 46 return create(AtomicString(rawValue), url, referrer, image); |
46 } | 47 } |
47 static CSSImageValue* create(const AtomicString& rawValue, | 48 static CSSImageValue* create(const AtomicString& rawValue, |
48 const KURL& url, | 49 const KURL& url, |
| 50 const Referrer& referrer, |
49 StyleImage* image = 0) { | 51 StyleImage* image = 0) { |
50 return new CSSImageValue(rawValue, url, image); | 52 return new CSSImageValue(rawValue, url, referrer, image); |
51 } | 53 } |
52 static CSSImageValue* create(const AtomicString& absoluteURL) { | 54 static CSSImageValue* create(const AtomicString& absoluteURL) { |
53 return new CSSImageValue(absoluteURL); | 55 return new CSSImageValue(absoluteURL); |
54 } | 56 } |
55 ~CSSImageValue(); | 57 ~CSSImageValue(); |
56 | 58 |
57 bool isCachePending() const { return !m_cachedImage; } | 59 bool isCachePending() const { return !m_cachedImage; } |
58 StyleImage* cachedImage() const { | 60 StyleImage* cachedImage() const { |
59 ASSERT(!isCachePending()); | 61 ASSERT(!isCachePending()); |
60 return m_cachedImage.get(); | 62 return m_cachedImage.get(); |
61 } | 63 } |
62 StyleImage* cacheImage( | 64 StyleImage* cacheImage( |
63 const Document&, | 65 const Document&, |
64 CrossOriginAttributeValue = CrossOriginAttributeNotSet); | 66 CrossOriginAttributeValue = CrossOriginAttributeNotSet); |
65 | 67 |
66 const String& url() const { return m_absoluteURL; } | 68 const String& url() const { return m_absoluteURL; } |
67 | 69 |
68 void setReferrer(const Referrer& referrer) { m_referrer = referrer; } | |
69 const Referrer& referrer() const { return m_referrer; } | 70 const Referrer& referrer() const { return m_referrer; } |
70 | 71 |
71 void reResolveURL(const Document&) const; | 72 void reResolveURL(const Document&) const; |
72 | 73 |
73 String customCSSText() const; | 74 String customCSSText() const; |
74 | 75 |
75 bool hasFailedOrCanceledSubresources() const; | 76 bool hasFailedOrCanceledSubresources() const; |
76 | 77 |
77 bool equals(const CSSImageValue&) const; | 78 bool equals(const CSSImageValue&) const; |
78 | 79 |
79 bool knownToBeOpaque(const LayoutObject&) const; | 80 bool knownToBeOpaque(const LayoutObject&) const; |
80 | 81 |
81 CSSImageValue* valueWithURLMadeAbsolute() const { | 82 CSSImageValue* valueWithURLMadeAbsolute() const { |
82 return create(KURL(ParsedURLString, m_absoluteURL), m_cachedImage.get()); | 83 return create(KURL(ParsedURLString, m_absoluteURL), m_cachedImage.get()); |
83 } | 84 } |
84 | 85 |
85 void setInitiator(const AtomicString& name) { m_initiatorName = name; } | 86 void setInitiator(const AtomicString& name) { m_initiatorName = name; } |
86 | 87 |
87 DECLARE_TRACE_AFTER_DISPATCH(); | 88 DECLARE_TRACE_AFTER_DISPATCH(); |
88 void restoreCachedResourceIfNeeded(const Document&) const; | 89 void restoreCachedResourceIfNeeded(const Document&) const; |
89 | 90 |
90 private: | 91 private: |
91 CSSImageValue(const AtomicString& rawValue, const KURL&, StyleImage*); | 92 CSSImageValue(const AtomicString& rawValue, |
| 93 const KURL&, |
| 94 const Referrer&, |
| 95 StyleImage*); |
92 CSSImageValue(const AtomicString& absoluteURL); | 96 CSSImageValue(const AtomicString& absoluteURL); |
93 | 97 |
94 AtomicString m_relativeURL; | 98 AtomicString m_relativeURL; |
95 Referrer m_referrer; | 99 Referrer m_referrer; |
96 AtomicString m_initiatorName; | 100 AtomicString m_initiatorName; |
97 | 101 |
98 // Cached image data. | 102 // Cached image data. |
99 mutable AtomicString m_absoluteURL; | 103 mutable AtomicString m_absoluteURL; |
100 mutable Member<StyleImage> m_cachedImage; | 104 mutable Member<StyleImage> m_cachedImage; |
101 }; | 105 }; |
102 | 106 |
103 DEFINE_CSS_VALUE_TYPE_CASTS(CSSImageValue, isImageValue()); | 107 DEFINE_CSS_VALUE_TYPE_CASTS(CSSImageValue, isImageValue()); |
104 | 108 |
105 } // namespace blink | 109 } // namespace blink |
106 | 110 |
107 #endif // CSSImageValue_h | 111 #endif // CSSImageValue_h |
OLD | NEW |