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 20 matching lines...) Expand all Loading... |
31 #include "core/rendering/style/StyleImage.h" | 31 #include "core/rendering/style/StyleImage.h" |
32 #include "platform/geometry/LayoutSize.h" | 32 #include "platform/geometry/LayoutSize.h" |
33 | 33 |
34 namespace WebCore { | 34 namespace WebCore { |
35 | 35 |
36 class ImageResource; | 36 class ImageResource; |
37 class CSSImageSetValue; | 37 class CSSImageSetValue; |
38 | 38 |
39 // This class keeps one cached image and has access to a set of alternatives. | 39 // This class keeps one cached image and has access to a set of alternatives. |
40 | 40 |
41 class StyleFetchedImageSet : public StyleImage, private ImageResourceClient { | 41 class StyleFetchedImageSet FINAL : public StyleImage, private ImageResourceClien
t { |
42 WTF_MAKE_FAST_ALLOCATED; | 42 WTF_MAKE_FAST_ALLOCATED; |
43 public: | 43 public: |
44 static PassRefPtr<StyleFetchedImageSet> create(ImageResource* image, float i
mageScaleFactor, CSSImageSetValue* value) | 44 static PassRefPtr<StyleFetchedImageSet> create(ImageResource* image, float i
mageScaleFactor, CSSImageSetValue* value) |
45 { | 45 { |
46 return adoptRef(new StyleFetchedImageSet(image, imageScaleFactor, value)
); | 46 return adoptRef(new StyleFetchedImageSet(image, imageScaleFactor, value)
); |
47 } | 47 } |
48 virtual ~StyleFetchedImageSet(); | 48 virtual ~StyleFetchedImageSet(); |
49 | 49 |
50 virtual PassRefPtr<CSSValue> cssValue() const; | 50 virtual PassRefPtr<CSSValue> cssValue() const OVERRIDE; |
51 | 51 |
52 // FIXME: This is used by StyleImage for equals comparison, but this impleme
ntation | 52 // FIXME: This is used by StyleImage for equals comparison, but this impleme
ntation |
53 // only looks at the image from the set that we have loaded. I'm not sure if
that is | 53 // only looks at the image from the set that we have loaded. I'm not sure if
that is |
54 // meaningful enough or not. | 54 // meaningful enough or not. |
55 virtual WrappedImagePtr data() const { return m_bestFitImage.get(); } | 55 virtual WrappedImagePtr data() const OVERRIDE { return m_bestFitImage.get();
} |
56 | 56 |
57 void clearImageSetValue() { m_imageSetValue = 0; } | 57 void clearImageSetValue() { m_imageSetValue = 0; } |
58 | 58 |
59 virtual bool canRender(const RenderObject*, float multiplier) const; | 59 virtual bool canRender(const RenderObject*, float multiplier) const OVERRIDE
; |
60 virtual bool isLoaded() const; | 60 virtual bool isLoaded() const OVERRIDE; |
61 virtual bool errorOccurred() const; | 61 virtual bool errorOccurred() const OVERRIDE; |
62 virtual LayoutSize imageSize(const RenderObject*, float multiplier) const; | 62 virtual LayoutSize imageSize(const RenderObject*, float multiplier) const OV
ERRIDE; |
63 virtual bool imageHasRelativeWidth() const; | 63 virtual bool imageHasRelativeWidth() const OVERRIDE; |
64 virtual bool imageHasRelativeHeight() const; | 64 virtual bool imageHasRelativeHeight() const OVERRIDE; |
65 virtual void computeIntrinsicDimensions(const RenderObject*, Length& intrins
icWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio); | 65 virtual void computeIntrinsicDimensions(const RenderObject*, Length& intrins
icWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) OVERRIDE; |
66 virtual bool usesImageContainerSize() const; | 66 virtual bool usesImageContainerSize() const OVERRIDE; |
67 virtual void setContainerSizeForRenderer(const RenderObject*, const IntSize&
, float); | 67 virtual void setContainerSizeForRenderer(const RenderObject*, const IntSize&
, float) OVERRIDE; |
68 virtual void addClient(RenderObject*); | 68 virtual void addClient(RenderObject*) OVERRIDE; |
69 virtual void removeClient(RenderObject*); | 69 virtual void removeClient(RenderObject*) OVERRIDE; |
70 virtual PassRefPtr<Image> image(RenderObject*, const IntSize&) const; | 70 virtual PassRefPtr<Image> image(RenderObject*, const IntSize&) const OVERRID
E; |
71 virtual float imageScaleFactor() const { return m_imageScaleFactor; } | 71 virtual float imageScaleFactor() const OVERRIDE { return m_imageScaleFactor;
} |
72 virtual bool knownToBeOpaque(const RenderObject*) const OVERRIDE; | 72 virtual bool knownToBeOpaque(const RenderObject*) const OVERRIDE; |
73 virtual ImageResource* cachedImage() const OVERRIDE { return m_bestFitImage.
get(); } | 73 virtual ImageResource* cachedImage() const OVERRIDE { return m_bestFitImage.
get(); } |
74 | 74 |
75 private: | 75 private: |
76 StyleFetchedImageSet(ImageResource*, float imageScaleFactor, CSSImageSetValu
e*); | 76 StyleFetchedImageSet(ImageResource*, float imageScaleFactor, CSSImageSetValu
e*); |
77 | 77 |
78 ResourcePtr<ImageResource> m_bestFitImage; | 78 ResourcePtr<ImageResource> m_bestFitImage; |
79 float m_imageScaleFactor; | 79 float m_imageScaleFactor; |
80 CSSImageSetValue* m_imageSetValue; // Not retained; it owns us. | 80 CSSImageSetValue* m_imageSetValue; // Not retained; it owns us. |
81 }; | 81 }; |
82 | 82 |
83 DEFINE_STYLE_IMAGE_TYPE_CASTS(StyleFetchedImageSet, isImageResourceSet()); | 83 DEFINE_STYLE_IMAGE_TYPE_CASTS(StyleFetchedImageSet, isImageResourceSet()); |
84 | 84 |
85 } // namespace WebCore | 85 } // namespace WebCore |
86 | 86 |
87 #endif // StyleFetchedImageSet_h | 87 #endif // StyleFetchedImageSet_h |
OLD | NEW |