OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 12 matching lines...) Expand all Loading... |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef StylePendingImage_h | 26 #ifndef StylePendingImage_h |
27 #define StylePendingImage_h | 27 #define StylePendingImage_h |
28 | 28 |
29 #include "core/css/CSSCursorImageValue.h" | 29 #include "core/css/CSSCursorImageValue.h" |
30 #include "core/css/CSSImageGeneratorValue.h" | 30 #include "core/css/CSSImageGeneratorValue.h" |
31 #include "core/css/CSSImageSetValue.h" | 31 #include "core/css/CSSImageSetValue.h" |
32 #include "core/css/CSSImageValue.h" | 32 #include "core/css/CSSImageValue.h" |
| 33 #include "core/css/CSSPaintValue.h" |
33 #include "core/style/StyleImage.h" | 34 #include "core/style/StyleImage.h" |
34 #include "platform/graphics/Image.h" | 35 #include "platform/graphics/Image.h" |
35 | 36 |
36 namespace blink { | 37 namespace blink { |
37 | 38 |
38 // StylePendingImage is a placeholder StyleImage that is entered into the Comput
edStyle during | 39 // StylePendingImage is a placeholder StyleImage that is entered into the Comput
edStyle during |
39 // style resolution, in order to avoid loading images that are not referenced by
the final style. | 40 // style resolution, in order to avoid loading images that are not referenced by
the final style. |
40 // They should never exist in a ComputedStyle after it has been returned from th
e style selector. | 41 // They should never exist in a ComputedStyle after it has been returned from th
e style selector. |
41 | 42 |
42 class StylePendingImage final : public StyleImage { | 43 class StylePendingImage final : public StyleImage { |
43 public: | 44 public: |
44 static StylePendingImage* create(const CSSValue& value) | 45 static StylePendingImage* create(const CSSValue& value) |
45 { | 46 { |
46 return new StylePendingImage(value); | 47 return new StylePendingImage(value); |
47 } | 48 } |
48 | 49 |
49 WrappedImagePtr data() const override { return m_value.get(); } | 50 WrappedImagePtr data() const override { return m_value.get(); } |
50 | 51 |
51 CSSValue* cssValue() const override { return m_value; } | 52 CSSValue* cssValue() const override { return m_value; } |
52 | 53 |
53 CSSValue* computedCSSValue() const override | 54 CSSValue* computedCSSValue() const override |
54 { | 55 { |
55 ASSERT_NOT_REACHED(); | 56 ASSERT_NOT_REACHED(); |
56 return nullptr; | 57 return nullptr; |
57 } | 58 } |
58 | 59 |
59 CSSImageValue* cssImageValue() const { return m_value->isImageValue() ? toCS
SImageValue(m_value.get()) : 0; } | 60 CSSImageValue* cssImageValue() const { return m_value->isImageValue() ? toCS
SImageValue(m_value.get()) : 0; } |
| 61 CSSPaintValue* cssPaintValue() const { return m_value->isPaintValue() ? toCS
SPaintValue(m_value.get()) : 0; } |
60 CSSImageGeneratorValue* cssImageGeneratorValue() const { return m_value->isI
mageGeneratorValue() ? toCSSImageGeneratorValue(m_value.get()) : 0; } | 62 CSSImageGeneratorValue* cssImageGeneratorValue() const { return m_value->isI
mageGeneratorValue() ? toCSSImageGeneratorValue(m_value.get()) : 0; } |
61 CSSCursorImageValue* cssCursorImageValue() const { return m_value->isCursorI
mageValue() ? toCSSCursorImageValue(m_value.get()) : 0; } | 63 CSSCursorImageValue* cssCursorImageValue() const { return m_value->isCursorI
mageValue() ? toCSSCursorImageValue(m_value.get()) : 0; } |
62 CSSImageSetValue* cssImageSetValue() const { return m_value->isImageSetValue
() ? toCSSImageSetValue(m_value.get()) : 0; } | 64 CSSImageSetValue* cssImageSetValue() const { return m_value->isImageSetValue
() ? toCSSImageSetValue(m_value.get()) : 0; } |
63 | 65 |
64 LayoutSize imageSize(const LayoutObject&, float /*multiplier*/, const Layout
Size& /*defaultObjectSize*/) const override { return LayoutSize(); } | 66 LayoutSize imageSize(const LayoutObject&, float /*multiplier*/, const Layout
Size& /*defaultObjectSize*/) const override { return LayoutSize(); } |
65 bool imageHasRelativeSize() const override { return false; } | 67 bool imageHasRelativeSize() const override { return false; } |
66 bool usesImageContainerSize() const override { return false; } | 68 bool usesImageContainerSize() const override { return false; } |
67 void addClient(LayoutObject*) override { } | 69 void addClient(LayoutObject*) override { } |
68 void removeClient(LayoutObject*) override { } | 70 void removeClient(LayoutObject*) override { } |
69 PassRefPtr<Image> image(const LayoutObject&, const IntSize&, float) const ov
erride | 71 PassRefPtr<Image> image(const LayoutObject&, const IntSize&, float) const ov
erride |
(...skipping 18 matching lines...) Expand all Loading... |
88 | 90 |
89 // TODO(sashab): Replace this with <const CSSValue> once Member<> | 91 // TODO(sashab): Replace this with <const CSSValue> once Member<> |
90 // supports const types. | 92 // supports const types. |
91 Member<CSSValue> m_value; | 93 Member<CSSValue> m_value; |
92 }; | 94 }; |
93 | 95 |
94 DEFINE_STYLE_IMAGE_TYPE_CASTS(StylePendingImage, isPendingImage()); | 96 DEFINE_STYLE_IMAGE_TYPE_CASTS(StylePendingImage, isPendingImage()); |
95 | 97 |
96 } // namespace blink | 98 } // namespace blink |
97 #endif | 99 #endif |
OLD | NEW |