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" | 8 #include "core/CoreExport.h" |
9 #include "core/css/CSSImageValue.h" | 9 #include "core/css/CSSImageValue.h" |
10 #include "core/css/CSSImageValue.h" | 10 #include "core/css/CSSImageValue.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 visitor->trace(m_imageValue); | 49 visitor->trace(m_imageValue); |
50 CSSResourceValue::trace(visitor); | 50 CSSResourceValue::trace(visitor); |
51 } | 51 } |
52 | 52 |
53 protected: | 53 protected: |
54 CSSStyleImageValue(const CSSImageValue* imageValue) | 54 CSSStyleImageValue(const CSSImageValue* imageValue) |
55 : m_imageValue(imageValue) {} | 55 : m_imageValue(imageValue) {} |
56 | 56 |
57 virtual LayoutSize imageLayoutSize() const { | 57 virtual LayoutSize imageLayoutSize() const { |
58 DCHECK(!isCachePending()); | 58 DCHECK(!isCachePending()); |
59 return m_imageValue->cachedImage()->cachedImage()->imageSize( | 59 ImageResourceContent* resourceContent = |
60 DoNotRespectImageOrientation, 1, ImageResourceContent::IntrinsicSize); | 60 m_imageValue->cachedImage()->cachedImage(); |
| 61 return resourceContent |
| 62 ? resourceContent->imageSize(DoNotRespectImageOrientation, 1, |
| 63 ImageResourceContent::IntrinsicSize) |
| 64 : LayoutSize(0, 0); |
61 } | 65 } |
62 | 66 |
63 virtual bool isCachePending() const { return m_imageValue->isCachePending(); } | 67 virtual bool isCachePending() const { return m_imageValue->isCachePending(); } |
64 | 68 |
65 ResourceStatus status() const override { | 69 ResourceStatus status() const override { |
66 if (isCachePending()) | 70 if (isCachePending()) |
67 return ResourceStatus::NotStarted; | 71 return ResourceStatus::NotStarted; |
68 return m_imageValue->cachedImage()->cachedImage()->getStatus(); | 72 return m_imageValue->cachedImage()->cachedImage()->getStatus(); |
69 } | 73 } |
70 | 74 |
71 const CSSImageValue* cssImageValue() const { return m_imageValue.get(); }; | 75 const CSSImageValue* cssImageValue() const { return m_imageValue.get(); }; |
72 | 76 |
73 private: | 77 private: |
74 PassRefPtr<Image> image() const; | 78 PassRefPtr<Image> image() const; |
75 | 79 |
76 Member<const CSSImageValue> m_imageValue; | 80 Member<const CSSImageValue> m_imageValue; |
77 }; | 81 }; |
78 | 82 |
79 } // namespace blink | 83 } // namespace blink |
80 | 84 |
81 #endif // CSSResourceValue_h | 85 #endif // CSSResourceValue_h |
OLD | NEW |