| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CSSStyleImageValue_h | 5 #ifndef CSSStyleImageValue_h |
| 6 #define CSSStyleImageValue_h | 6 #define CSSStyleImageValue_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" |
| 9 #include "core/css/CSSImageValue.h" |
| 8 #include "core/css/CSSImageValue.h" | 10 #include "core/css/CSSImageValue.h" |
| 9 #include "core/css/cssom/CSSResourceValue.h" | 11 #include "core/css/cssom/CSSResourceValue.h" |
| 12 #include "core/css/cssom/CSSStyleValue.h" |
| 10 #include "core/fetch/ImageResource.h" | 13 #include "core/fetch/ImageResource.h" |
| 14 #include "core/html/canvas/CanvasImageSource.h" |
| 15 #include "core/imagebitmap/ImageBitmapSource.h" |
| 11 #include "core/style/StyleImage.h" | 16 #include "core/style/StyleImage.h" |
| 12 | 17 |
| 13 | |
| 14 namespace blink { | 18 namespace blink { |
| 15 | 19 |
| 16 class CORE_EXPORT CSSStyleImageValue : public CSSResourceValue { | 20 class CORE_EXPORT CSSStyleImageValue : public CSSResourceValue, public CanvasIma
geSource { |
| 17 WTF_MAKE_NONCOPYABLE(CSSStyleImageValue); | 21 WTF_MAKE_NONCOPYABLE(CSSStyleImageValue); |
| 18 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
| 19 public: | 23 public: |
| 20 virtual ~CSSStyleImageValue() { } | 24 virtual ~CSSStyleImageValue() { } |
| 21 | 25 |
| 22 StyleValueType type() const override { return ImageType; } | 26 StyleValueType type() const override { return ImageType; } |
| 23 | 27 |
| 24 double intrinsicWidth(bool& isNull); | 28 double intrinsicWidth(bool& isNull) const; |
| 25 double intrinsicHeight(bool& isNull); | 29 double intrinsicHeight(bool& isNull) const; |
| 26 double intrinsicRatio(bool& isNull); | 30 double intrinsicRatio(bool& isNull); |
| 27 | 31 |
| 32 // CanvasImageSource |
| 33 bool isCSSImageValue() const final { return true; } |
| 34 int sourceWidth() final; |
| 35 int sourceHeight() final; |
| 36 bool wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigin) const final |
| 37 { |
| 38 return true; |
| 39 } |
| 40 FloatSize elementSize(const FloatSize& defaultObjectSize) const final; |
| 41 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi
nt, SnapshotReason, const FloatSize&) const final; |
| 42 |
| 28 DEFINE_INLINE_VIRTUAL_TRACE() | 43 DEFINE_INLINE_VIRTUAL_TRACE() |
| 29 { | 44 { |
| 30 visitor->trace(m_imageValue); | 45 visitor->trace(m_imageValue); |
| 31 CSSStyleValue::trace(visitor); | 46 CSSStyleValue::trace(visitor); |
| 32 CSSResourceValue::trace(visitor); | 47 CSSResourceValue::trace(visitor); |
| 33 } | 48 } |
| 34 | 49 |
| 35 protected: | 50 protected: |
| 36 CSSStyleImageValue(const CSSImageValue* imageValue) | 51 CSSStyleImageValue(const CSSImageValue* imageValue) |
| 37 : m_imageValue(imageValue) | 52 : m_imageValue(imageValue) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 52 { | 67 { |
| 53 if (isCachePending()) | 68 if (isCachePending()) |
| 54 return Resource::Status::NotStarted; | 69 return Resource::Status::NotStarted; |
| 55 return m_imageValue->cachedImage()->cachedImage()->getStatus(); | 70 return m_imageValue->cachedImage()->cachedImage()->getStatus(); |
| 56 } | 71 } |
| 57 }; | 72 }; |
| 58 | 73 |
| 59 } // namespace blink | 74 } // namespace blink |
| 60 | 75 |
| 61 #endif // CSSResourceValue_h | 76 #endif // CSSResourceValue_h |
| OLD | NEW |