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

Unified Diff: third_party/WebKit/Source/core/css/cssom/CSSStyleImageValue.cpp

Issue 2351363002: Make CSSStyleImageValue a member of CanvasImageSource. (Closed)
Patch Set: Override isAccelerated Created 4 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698