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

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

Issue 164803002: Handle CSSImageValue URLs in inline styles in templates correctly (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removed template usage 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
« no previous file with comments | « Source/core/css/CSSImageValue.h ('k') | Source/core/css/parser/BisonCSSParser-in.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSImageValue.cpp
diff --git a/Source/core/css/CSSImageValue.cpp b/Source/core/css/CSSImageValue.cpp
index 184f46a53cf4e8f3b332844d792993be94834910..8e47d509cbbda375000783809f4a85ba7b9e39d2 100644
--- a/Source/core/css/CSSImageValue.cpp
+++ b/Source/core/css/CSSImageValue.cpp
@@ -33,18 +33,12 @@
namespace WebCore {
-CSSImageValue::CSSImageValue(const KURL& url)
+CSSImageValue::CSSImageValue(const String& rawValue, const KURL& url, StyleImage* image)
: CSSValue(ImageClass)
- , m_url(url.string())
- , m_accessedImage(false)
-{
-}
-
-CSSImageValue::CSSImageValue(const KURL& url, StyleImage* image)
- : CSSValue(ImageClass)
- , m_url(url.string())
+ , m_relativeURL(rawValue)
+ , m_absoluteURL(url.string())
, m_image(image)
- , m_accessedImage(true)
+ , m_accessedImage(image)
{
}
@@ -67,7 +61,7 @@ StyleFetchedImage* CSSImageValue::cachedImage(ResourceFetcher* fetcher, const Re
if (!m_accessedImage) {
m_accessedImage = true;
- FetchRequest request(ResourceRequest(m_url), m_initiatorName.isEmpty() ? FetchInitiatorTypeNames::css : m_initiatorName, options);
+ FetchRequest request(ResourceRequest(m_absoluteURL), m_initiatorName.isEmpty() ? FetchInitiatorTypeNames::css : m_initiatorName, options);
if (options.corsEnabled == IsCORSEnabled)
request.setCrossOriginAccessControl(fetcher->document()->securityOrigin(), options.allowCredentials);
@@ -90,18 +84,18 @@ bool CSSImageValue::hasFailedOrCanceledSubresources() const
bool CSSImageValue::equals(const CSSImageValue& other) const
{
- return m_url == other.m_url;
+ return m_absoluteURL == other.m_absoluteURL;
}
String CSSImageValue::customCSSText() const
{
- return "url(" + quoteCSSURLIfNeeded(m_url) + ")";
+ return "url(" + quoteCSSURLIfNeeded(m_absoluteURL) + ")";
}
PassRefPtrWillBeRawPtr<CSSValue> CSSImageValue::cloneForCSSOM() const
{
// NOTE: We expose CSSImageValues as URI primitive values in CSSOM to maintain old behavior.
- RefPtrWillBeRawPtr<CSSPrimitiveValue> uriValue = CSSPrimitiveValue::create(m_url, CSSPrimitiveValue::CSS_URI);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> uriValue = CSSPrimitiveValue::create(m_absoluteURL, CSSPrimitiveValue::CSS_URI);
uriValue->setCSSOMSafe();
return uriValue.release();
}
@@ -116,4 +110,14 @@ void CSSImageValue::traceAfterDispatch(Visitor* visitor)
CSSValue::traceAfterDispatch(visitor);
}
+void CSSImageValue::reResolveURL(const Document& document)
+{
+ KURL url = document.completeURL(m_relativeURL);
+ if (url == m_absoluteURL)
+ return;
+ m_absoluteURL = url.string();
+ m_accessedImage = false;
+ m_image.clear();
+}
+
} // namespace WebCore
« no previous file with comments | « Source/core/css/CSSImageValue.h ('k') | Source/core/css/parser/BisonCSSParser-in.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698