OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 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 15 matching lines...) Expand all Loading... |
26 #ifndef StyleFetchedImageSet_h | 26 #ifndef StyleFetchedImageSet_h |
27 #define StyleFetchedImageSet_h | 27 #define StyleFetchedImageSet_h |
28 | 28 |
29 #include "core/fetch/ImageResourceObserver.h" | 29 #include "core/fetch/ImageResourceObserver.h" |
30 #include "core/style/StyleImage.h" | 30 #include "core/style/StyleImage.h" |
31 #include "platform/geometry/LayoutSize.h" | 31 #include "platform/geometry/LayoutSize.h" |
32 #include "platform/weborigin/KURL.h" | 32 #include "platform/weborigin/KURL.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 class ImageResource; | |
37 class CSSImageSetValue; | 36 class CSSImageSetValue; |
38 | 37 |
39 // This class keeps one cached image and has access to a set of alternatives. | 38 // This class keeps one cached image and has access to a set of alternatives. |
40 | 39 |
41 class StyleFetchedImageSet final : public StyleImage, | 40 class StyleFetchedImageSet final : public StyleImage, |
42 public ImageResourceObserver { | 41 public ImageResourceObserver { |
43 USING_PRE_FINALIZER(StyleFetchedImageSet, dispose); | 42 USING_PRE_FINALIZER(StyleFetchedImageSet, dispose); |
44 | 43 |
45 public: | 44 public: |
46 static StyleFetchedImageSet* create(ImageResource* image, | 45 static StyleFetchedImageSet* create(ImageResourceContent* image, |
47 float imageScaleFactor, | 46 float imageScaleFactor, |
48 CSSImageSetValue* value, | 47 CSSImageSetValue* value, |
49 const KURL& url) { | 48 const KURL& url) { |
50 return new StyleFetchedImageSet(image, imageScaleFactor, value, url); | 49 return new StyleFetchedImageSet(image, imageScaleFactor, value, url); |
51 } | 50 } |
52 ~StyleFetchedImageSet() override; | 51 ~StyleFetchedImageSet() override; |
53 | 52 |
54 CSSValue* cssValue() const override; | 53 CSSValue* cssValue() const override; |
55 CSSValue* computedCSSValue() const override; | 54 CSSValue* computedCSSValue() const override; |
56 | 55 |
(...skipping 10 matching lines...) Expand all Loading... |
67 const LayoutSize& defaultObjectSize) const override; | 66 const LayoutSize& defaultObjectSize) const override; |
68 bool imageHasRelativeSize() const override; | 67 bool imageHasRelativeSize() const override; |
69 bool usesImageContainerSize() const override; | 68 bool usesImageContainerSize() const override; |
70 void addClient(LayoutObject*) override; | 69 void addClient(LayoutObject*) override; |
71 void removeClient(LayoutObject*) override; | 70 void removeClient(LayoutObject*) override; |
72 PassRefPtr<Image> image(const LayoutObject&, | 71 PassRefPtr<Image> image(const LayoutObject&, |
73 const IntSize&, | 72 const IntSize&, |
74 float) const override; | 73 float) const override; |
75 float imageScaleFactor() const override { return m_imageScaleFactor; } | 74 float imageScaleFactor() const override { return m_imageScaleFactor; } |
76 bool knownToBeOpaque(const LayoutObject&) const override; | 75 bool knownToBeOpaque(const LayoutObject&) const override; |
77 ImageResource* cachedImage() const override; | 76 ImageResourceContent* cachedImage() const override; |
78 | 77 |
79 DECLARE_VIRTUAL_TRACE(); | 78 DECLARE_VIRTUAL_TRACE(); |
80 | 79 |
81 private: | 80 private: |
82 StyleFetchedImageSet(ImageResource*, | 81 StyleFetchedImageSet(ImageResourceContent*, |
83 float imageScaleFactor, | 82 float imageScaleFactor, |
84 CSSImageSetValue*, | 83 CSSImageSetValue*, |
85 const KURL&); | 84 const KURL&); |
86 | 85 |
87 void dispose(); | 86 void dispose(); |
88 | 87 |
89 String debugName() const override { return "StyleFetchedImageSet"; } | 88 String debugName() const override { return "StyleFetchedImageSet"; } |
90 | 89 |
91 Member<ImageResource> m_bestFitImage; | 90 Member<ImageResourceContent> m_bestFitImage; |
92 float m_imageScaleFactor; | 91 float m_imageScaleFactor; |
93 | 92 |
94 Member<CSSImageSetValue> m_imageSetValue; // Not retained; it owns us. | 93 Member<CSSImageSetValue> m_imageSetValue; // Not retained; it owns us. |
95 const KURL m_url; | 94 const KURL m_url; |
96 }; | 95 }; |
97 | 96 |
98 DEFINE_STYLE_IMAGE_TYPE_CASTS(StyleFetchedImageSet, isImageResourceSet()); | 97 DEFINE_STYLE_IMAGE_TYPE_CASTS(StyleFetchedImageSet, isImageResourceSet()); |
99 | 98 |
100 } // namespace blink | 99 } // namespace blink |
101 | 100 |
102 #endif // StyleFetchedImageSet_h | 101 #endif // StyleFetchedImageSet_h |
OLD | NEW |