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

Unified Diff: Source/core/css/CSSImageValue.h

Issue 164803002: Handle CSSImageValue URLs in inline styles in templates correctly (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Ready for review Created 6 years, 10 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/css/CSSImageValue.h
diff --git a/Source/core/css/CSSImageValue.h b/Source/core/css/CSSImageValue.h
index 18e57f4f26ea6bc966d17ce7052c557c395f9934..4863966c5843e324d87cf0d3a1af1b3ba4f1b611 100644
--- a/Source/core/css/CSSImageValue.h
+++ b/Source/core/css/CSSImageValue.h
@@ -23,25 +23,25 @@
#include "core/css/CSSValue.h"
#include "core/fetch/ResourceFetcher.h"
+#include "platform/weborigin/KURL.h"
#include "wtf/RefPtr.h"
namespace WebCore {
class Element;
-class KURL;
class StyleFetchedImage;
class StyleImage;
class RenderObject;
class CSSImageValue : public CSSValue {
public:
- static PassRefPtrWillBeRawPtr<CSSImageValue> create(const KURL& url)
+ static PassRefPtrWillBeRawPtr<CSSImageValue> create(const KURL& url, StyleImage* image = 0)
{
- return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSImageValue(url));
+ return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSImageValue(url, url, image));
}
- static PassRefPtrWillBeRawPtr<CSSImageValue> create(const KURL& url, StyleImage* image)
+ static PassRefPtrWillBeRawPtr<CSSImageValue> create(const String& rawValue, const KURL& url, StyleImage* image = 0)
{
- return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSImageValue(url, image));
+ return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSImageValue(rawValue, url, image));
}
~CSSImageValue();
@@ -50,7 +50,10 @@ public:
// Returns a StyleFetchedImage if the image is cached already, otherwise a StylePendingImage.
StyleImage* cachedOrPendingImage();
- const String& url() { return m_url; }
+ const String& url() { return m_absoluteURL; }
+
+ template<typename URLResolver> // Avoids a dependency on Document
ojan 2014/02/26 03:00:30 templates scare me. Avoiding a Document dependency
adamk 2014/02/26 17:00:20 This may be overkill, given the other dependencies
+ void reResolveURL(const URLResolver& resolver) { reResolveURLInternal(resolver.completeURL(m_relativeURL)); }
String customCSSText() const;
@@ -67,10 +70,12 @@ public:
void traceAfterDispatch(Visitor*);
private:
- explicit CSSImageValue(const KURL&);
- CSSImageValue(const KURL&, StyleImage*);
+ CSSImageValue(const String& rawValue, const KURL&, StyleImage*);
+
+ void reResolveURLInternal(const KURL&);
- String m_url;
+ String m_relativeURL;
+ String m_absoluteURL;
RefPtr<StyleImage> m_image;
bool m_accessedImage;
AtomicString m_initiatorName;
« no previous file with comments | « LayoutTests/fast/css/resolve-inline-style-url-on-adopt-expected.html ('k') | Source/core/css/CSSImageValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698