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

Unified Diff: third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp

Issue 1386413002: Added TODOs to StyleImage::create() to take PassRefPtrWillBeRawPtr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@make_styleresolverstate_styleImage_take_a_const_reference
Patch Set: Added comments to const_cast calls Created 5 years, 2 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 | « no previous file | third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp b/third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp
index e7c97033812eedc79e26e428fdb11b7d3a73a6ef..a63d36cfc71a959b73a1fa0b7d69960577d15292 100644
--- a/third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp
@@ -34,6 +34,16 @@
namespace blink {
+namespace {
+
+PassRefPtrWillBeRawPtr<StylePendingImage> createStylePendingImage(const CSSValue& value)
+{
+ // TODO(sashab): Remove this const_cast and this function once create() can take a PassRefPtrWillBeRawPtr<const CSSValue>.
+ return StylePendingImage::create(const_cast<CSSValue*>(&value));
+}
+
+} // namespace
+
ElementStyleResources::ElementStyleResources()
: m_deviceScaleFactor(1)
{
@@ -60,16 +70,17 @@ PassRefPtrWillBeRawPtr<StyleImage> ElementStyleResources::generatedOrPendingFrom
{
if (value.isPending()) {
m_pendingImageProperties.add(property);
- return StylePendingImage::create(value);
+ return createStylePendingImage(value);
}
- return StyleGeneratedImage::create(value);
+ // TODO(sashab): Remove this const_cast once create() can take a PassRefPtrWillBeRawPtr<const CSSValue>.
+ return StyleGeneratedImage::create(const_cast<CSSImageGeneratorValue*>(&value));
}
PassRefPtrWillBeRawPtr<StyleImage> ElementStyleResources::setOrPendingFromValue(CSSPropertyID property, const CSSImageSetValue& value)
{
if (value.isCachePending(m_deviceScaleFactor)) {
m_pendingImageProperties.add(property);
- return StylePendingImage::create(value);
+ return createStylePendingImage(value);
}
return value.cachedImageSet(m_deviceScaleFactor);
}
@@ -78,7 +89,7 @@ PassRefPtrWillBeRawPtr<StyleImage> ElementStyleResources::cachedOrPendingFromVal
{
if (value.isCachePending()) {
m_pendingImageProperties.add(property);
- return StylePendingImage::create(value);
+ return createStylePendingImage(value);
}
value.restoreCachedResourceIfNeeded(document);
return value.cachedImage();
@@ -88,7 +99,7 @@ PassRefPtrWillBeRawPtr<StyleImage> ElementStyleResources::cursorOrPendingFromVal
{
if (value.isCachePending(m_deviceScaleFactor)) {
m_pendingImageProperties.add(property);
- return StylePendingImage::create(value);
+ return createStylePendingImage(value);
}
return value.cachedImage(m_deviceScaleFactor);
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698