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

Side by Side Diff: Source/core/css/CSSImageValue.h

Issue 1308953009: Move Image ownership out of CSSValue (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSImageGeneratorValue.cpp ('k') | Source/core/css/CSSImageValue.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21 #ifndef CSSImageValue_h 21 #ifndef CSSImageValue_h
22 #define CSSImageValue_h 22 #define CSSImageValue_h
23 23
24 #include "core/css/CSSValue.h" 24 #include "core/css/CSSValue.h"
25 #include "core/style/StyleImage.h"
25 #include "core/fetch/ResourceFetcher.h" 26 #include "core/fetch/ResourceFetcher.h"
26 #include "platform/weborigin/Referrer.h" 27 #include "platform/weborigin/Referrer.h"
27 #include "wtf/RefPtr.h" 28 #include "wtf/RefPtr.h"
28 29
29 namespace blink { 30 namespace blink {
30 31
31 class Document; 32 class Document;
32 class KURL; 33 class KURL;
33 class StyleFetchedImage; 34 class StyleFetchedImage;
34 class StyleImage; 35 class StyleImage;
35 class LayoutObject; 36 class LayoutObject;
36 37
37 class CSSImageValue : public CSSValue { 38 class CSSImageValue : public CSSValue {
38 public: 39 public:
40 static PassRefPtrWillBeRawPtr<CSSImageValue> create(const String& relativeUr l, const String& absoluteUrl, StyleImage* image = 0)
41 {
42 return adoptRefWillBeNoop(new CSSImageValue(relativeUrl, absoluteUrl, im age));
43 }
39 static PassRefPtrWillBeRawPtr<CSSImageValue> create(const KURL& url, StyleIm age* image = 0) 44 static PassRefPtrWillBeRawPtr<CSSImageValue> create(const KURL& url, StyleIm age* image = 0)
40 { 45 {
41 return adoptRefWillBeNoop(new CSSImageValue(url, url, image)); 46 return adoptRefWillBeNoop(new CSSImageValue(url.string(), url.string(), image));
42 } 47 }
43 static PassRefPtrWillBeRawPtr<CSSImageValue> create(const String& rawValue, const KURL& url, StyleImage* image = 0) 48 static PassRefPtrWillBeRawPtr<CSSImageValue> create(const String& rawValue, const KURL& url, StyleImage* image = 0)
44 { 49 {
45 return adoptRefWillBeNoop(new CSSImageValue(rawValue, url, image)); 50 return adoptRefWillBeNoop(new CSSImageValue(rawValue, url.string(), imag e));
46 } 51 }
47 ~CSSImageValue(); 52 ~CSSImageValue();
48 53
49 StyleFetchedImage* cachedImage(Document*, const ResourceLoaderOptions&); 54 StyleFetchedImage* cachedImage(Document*, const ResourceLoaderOptions&, CSSS tyleImageMap&);
50 StyleFetchedImage* cachedImage(Document* document) { return cachedImage(docu ment, ResourceFetcher::defaultResourceOptions()); } 55 StyleFetchedImage* cachedImage(Document* document, CSSStyleImageMap& imageMa p) { return cachedImage(document, ResourceFetcher::defaultResourceOptions(), ima geMap); }
51 // Returns a StyleFetchedImage if the image is cached already, otherwise a S tylePendingImage. 56 // Returns a StyleFetchedImage if the image is cached already, otherwise a S tylePendingImage.
52 StyleImage* cachedOrPendingImage(); 57 StyleImage* cachedOrPendingImage();
58 StyleImage* cachedOrPendingImage(CSSStyleImageMap&);
53 59
54 const String& url() { return m_absoluteURL; } 60 const String& relativeUrl() const { return m_relativeURL; }
61 const String& url() const { return m_absoluteURL; }
55 62
56 void setReferrer(const Referrer& referrer) { m_referrer = referrer; } 63 void setReferrer(const Referrer& referrer) { m_referrer = referrer; }
57 const Referrer& referrer() const { return m_referrer; } 64 const Referrer& referrer() const { return m_referrer; }
58 65
59 void reResolveURL(const Document&); 66 //void reResolveURL(const Document&);
60 67
61 String customCSSText() const; 68 String customCSSText() const;
62 69
63 bool hasFailedOrCanceledSubresources() const; 70 bool hasFailedOrCanceledSubresources() const;
64 71
65 bool equals(const CSSImageValue&) const; 72 bool equals(const CSSImageValue&) const;
66 73
67 bool knownToBeOpaque(const LayoutObject*) const; 74 bool knownToBeOpaque(const LayoutObject*) const;
68 75
69 void setInitiator(const AtomicString& name) { m_initiatorName = name; } 76 void setInitiator(const AtomicString& name) { m_initiatorName = name; }
70 77
71 DECLARE_TRACE_AFTER_DISPATCH(); 78 DECLARE_TRACE_AFTER_DISPATCH();
72 void restoreCachedResourceIfNeeded(Document&); 79 void restoreCachedResourceIfNeeded(Document&, CSSStyleImageMap&);
73 80
74 private: 81 private:
75 CSSImageValue(const String& rawValue, const KURL&, StyleImage*); 82 CSSImageValue(const String& rawValue, const String& url, StyleImage*);
76 83
77 String m_relativeURL; 84 String m_relativeURL;
78 String m_absoluteURL; 85 String m_absoluteURL;
79 Referrer m_referrer; 86 Referrer m_referrer;
80 RefPtrWillBeMember<StyleImage> m_image; 87 RefPtrWillBeMember<StyleImage> m_image;
81 bool m_accessedImage; 88 bool m_accessedImage;
82 AtomicString m_initiatorName; 89 AtomicString m_initiatorName;
83 }; 90 };
84 91
85 DEFINE_CSS_VALUE_TYPE_CASTS(CSSImageValue, isImageValue()); 92 DEFINE_CSS_VALUE_TYPE_CASTS(CSSImageValue, isImageValue());
86 93
87 } // namespace blink 94 } // namespace blink
88 95
89 #endif // CSSImageValue_h 96 #endif // CSSImageValue_h
OLDNEW
« no previous file with comments | « Source/core/css/CSSImageGeneratorValue.cpp ('k') | Source/core/css/CSSImageValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698