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

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

Issue 2199703002: [Typed-OM] Add CSSStyleImageValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@CSSResourceValue
Patch Set: Rebase Created 4 years, 4 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.h
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSStyleImageValue.h b/third_party/WebKit/Source/core/css/cssom/CSSStyleImageValue.h
new file mode 100644
index 0000000000000000000000000000000000000000..ccba062dd12237b76dab1ab9efcc37416cc96390
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/cssom/CSSStyleImageValue.h
@@ -0,0 +1,61 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CSSStyleImageValue_h
+#define CSSStyleImageValue_h
+
+#include "core/css/CSSImageValue.h"
+#include "core/css/cssom/CSSResourceValue.h"
+#include "core/fetch/ImageResource.h"
+#include "core/style/StyleImage.h"
+
+
+namespace blink {
+
+class CORE_EXPORT CSSStyleImageValue : public CSSResourceValue {
+ WTF_MAKE_NONCOPYABLE(CSSStyleImageValue);
+ DEFINE_WRAPPERTYPEINFO();
+public:
+ virtual ~CSSStyleImageValue() { }
+
+ StyleValueType type() const override { return ImageType; }
+
+ double intrinsicWidth(bool& isNull);
+ double intrinsicHeight(bool& isNull);
+ double intrinsicRatio(bool& isNull);
+
+ DEFINE_INLINE_VIRTUAL_TRACE()
+ {
+ visitor->trace(m_imageValue);
+ CSSStyleValue::trace(visitor);
+ CSSResourceValue::trace(visitor);
+ }
+
+protected:
+ CSSStyleImageValue(const CSSImageValue* imageValue)
+ : m_imageValue(imageValue)
+ {
+ }
+
+ Member<const CSSImageValue> m_imageValue;
+
+ virtual LayoutSize imageLayoutSize() const
+ {
+ DCHECK(!m_imageValue->isCachePending());
+ return m_imageValue->cachedImage()->cachedImage()->imageSize(DoNotRespectImageOrientation, 1, ImageResource::IntrinsicSize);
+ }
+
+ virtual bool isCachePending() const { return m_imageValue->isCachePending(); }
+
+ Resource::Status status() const override
+ {
+ if (isCachePending())
+ return Resource::Status::NotStarted;
+ return m_imageValue->cachedImage()->cachedImage()->getStatus();
+ }
+};
+
+} // namespace blink
+
+#endif // CSSResourceValue_h

Powered by Google App Engine
This is Rietveld 408576698