Index: third_party/WebKit/Source/core/css/cssom/CSSStyleImageValue.cpp |
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSStyleImageValue.cpp b/third_party/WebKit/Source/core/css/cssom/CSSStyleImageValue.cpp |
index 3f6a5c0ba3b60ddc465ce67fd99193080fca459a..f1831239f20580b6583eaa550557035ad1b080d1 100644 |
--- a/third_party/WebKit/Source/core/css/cssom/CSSStyleImageValue.cpp |
+++ b/third_party/WebKit/Source/core/css/cssom/CSSStyleImageValue.cpp |
@@ -6,7 +6,7 @@ |
namespace blink { |
-double CSSStyleImageValue::intrinsicWidth(bool& isNull) |
+double CSSStyleImageValue::intrinsicWidth(bool& isNull) const |
{ |
isNull = isCachePending(); |
if (isNull) |
@@ -14,7 +14,7 @@ double CSSStyleImageValue::intrinsicWidth(bool& isNull) |
return imageLayoutSize().width().toDouble(); |
} |
-double CSSStyleImageValue::intrinsicHeight(bool& isNull) |
+double CSSStyleImageValue::intrinsicHeight(bool& isNull) const |
{ |
isNull = isCachePending(); |
if (isNull) |
@@ -35,4 +35,40 @@ double CSSStyleImageValue::intrinsicRatio(bool& isNull) |
return intrinsicWidth(isNull) / intrinsicHeight(isNull); |
} |
+FloatSize CSSStyleImageValue::elementSize(const FloatSize& defaultObjectSize) const |
+{ |
+ bool notUsed; |
+ return FloatSize(intrinsicWidth(notUsed), intrinsicHeight(notUsed)); |
+} |
+ |
+bool CSSStyleImageValue::isAccelerated() const |
+{ |
+ return image() && image()->isTextureBacked(); |
+} |
+ |
+int CSSStyleImageValue::sourceHeight() |
+{ |
+ bool notUsed; |
+ return intrinsicHeight(notUsed); |
+} |
+ |
+int CSSStyleImageValue::sourceWidth() |
+{ |
+ bool notUsed; |
+ return intrinsicWidth(notUsed); |
+} |
+ |
+PassRefPtr<Image> CSSStyleImageValue::image() const |
+{ |
+ if (isCachePending()) |
+ return nullptr; |
+ // cachedImage can be null if image is StyleInvalidImage |
+ ImageResource* cachedImage = m_imageValue->cachedImage()->cachedImage(); |
+ if (cachedImage) { |
+ // getImage() returns the nullImage() if the image is not available yet |
+ return cachedImage->getImage()->imageForDefaultFrame(); |
+ } |
+ return nullptr; |
+} |
+ |
} // namespace blink |