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 StyleInvalidImage_h | 5 #ifndef StyleInvalidImage_h |
6 #define StyleInvalidImage_h | 6 #define StyleInvalidImage_h |
7 | 7 |
8 #include "core/css/CSSImageValue.h" | 8 #include "core/css/CSSImageValue.h" |
9 #include "core/style/StyleImage.h" | 9 #include "core/style/StyleImage.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class StyleInvalidImage final : public StyleImage { | 13 class StyleInvalidImage final : public StyleImage { |
14 public: | 14 public: |
15 static PassRefPtrWillBeRawPtr<StyleInvalidImage> create(const String& url) | 15 static PassRefPtrWillBeRawPtr<StyleInvalidImage> create(const String& url) |
16 { | 16 { |
17 return adoptRefWillBeNoop(new StyleInvalidImage(url)); | 17 return adoptRefWillBeNoop(new StyleInvalidImage(url)); |
18 } | 18 } |
19 | 19 |
20 WrappedImagePtr data() const override { return m_url.impl(); } | 20 WrappedImagePtr data() const override { return m_url.impl(); } |
21 | 21 |
22 PassRefPtrWillBeRawPtr<CSSValue> cssValue() const override { return CSSImage
Value::create(AtomicString(m_url)); } | 22 PassRefPtrWillBeRawPtr<CSSValue> cssValue() const override { return CSSImage
Value::create(AtomicString(m_url)); } |
23 | 23 |
24 PassRefPtrWillBeRawPtr<CSSValue> computedCSSValue() const override { return
cssValue(); } | 24 PassRefPtrWillBeRawPtr<CSSValue> computedCSSValue() const override { return
cssValue(); } |
25 | 25 |
26 LayoutSize imageSize(const LayoutObject*, float /*multiplier*/, const Layout
Size& /*defaultObjectSize*/) const override { return LayoutSize(); } | 26 LayoutSize imageSize(const LayoutObject*, float /*multiplier*/, const Layout
Size& /*defaultObjectSize*/) const override { return LayoutSize(); } |
27 bool imageHasRelativeSize() const override { return false; } | 27 bool imageHasRelativeSize() const override { return false; } |
28 void computeIntrinsicDimensions(const LayoutObject*, FloatSize& /* intrinsic
Size */, FloatSize& /* intrinsicRatio */) override { } | |
29 bool usesImageContainerSize() const override { return false; } | 28 bool usesImageContainerSize() const override { return false; } |
30 void addClient(LayoutObject*) override { } | 29 void addClient(LayoutObject*) override { } |
31 void removeClient(LayoutObject*) override { } | 30 void removeClient(LayoutObject*) override { } |
32 PassRefPtr<Image> image(const LayoutObject*, const IntSize&, float) const ov
erride | 31 PassRefPtr<Image> image(const LayoutObject*, const IntSize&, float) const ov
erride |
33 { | 32 { |
34 return nullptr; | 33 return nullptr; |
35 } | 34 } |
36 bool knownToBeOpaque(const LayoutObject*) const override { return false; } | 35 bool knownToBeOpaque(const LayoutObject*) const override { return false; } |
37 | 36 |
38 DEFINE_INLINE_VIRTUAL_TRACE() | 37 DEFINE_INLINE_VIRTUAL_TRACE() |
39 { | 38 { |
40 StyleImage::trace(visitor); | 39 StyleImage::trace(visitor); |
41 } | 40 } |
42 | 41 |
43 private: | 42 private: |
44 explicit StyleInvalidImage(const String& url) | 43 explicit StyleInvalidImage(const String& url) |
45 : m_url(url) | 44 : m_url(url) |
46 { | 45 { |
47 m_isInvalidImage = true; | 46 m_isInvalidImage = true; |
48 } | 47 } |
49 | 48 |
50 String m_url; | 49 String m_url; |
51 }; | 50 }; |
52 | 51 |
53 DEFINE_STYLE_IMAGE_TYPE_CASTS(StyleInvalidImage, isInvalidImage()); | 52 DEFINE_STYLE_IMAGE_TYPE_CASTS(StyleInvalidImage, isInvalidImage()); |
54 | 53 |
55 } // namespace blink | 54 } // namespace blink |
56 #endif | 55 #endif |
OLD | NEW |