| 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 23 matching lines...) Expand all Loading... |
| 34 namespace blink { | 34 namespace blink { |
| 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 final : public StyleImage, private ImageResourceClien
t { | 41 class StyleFetchedImageSet final : public StyleImage, private ImageResourceClien
t { |
| 42 USING_FAST_MALLOC_WILL_BE_REMOVED(StyleFetchedImageSet); | 42 USING_FAST_MALLOC_WILL_BE_REMOVED(StyleFetchedImageSet); |
| 43 public: | 43 public: |
| 44 static PassRefPtrWillBeRawPtr<StyleFetchedImageSet> create(ImageResource* im
age, float imageScaleFactor, CSSImageSetValue* value) | 44 static PassRefPtrWillBeRawPtr<StyleFetchedImageSet> create(ImageResource* im
age, float imageScaleFactor, CSSImageSetValue* value, const KURL& url) |
| 45 { | 45 { |
| 46 return adoptRefWillBeNoop(new StyleFetchedImageSet(image, imageScaleFact
or, value)); | 46 return adoptRefWillBeNoop(new StyleFetchedImageSet(image, imageScaleFact
or, value, url)); |
| 47 } | 47 } |
| 48 ~StyleFetchedImageSet() override; | 48 ~StyleFetchedImageSet() override; |
| 49 | 49 |
| 50 PassRefPtrWillBeRawPtr<CSSValue> cssValue() const override; | 50 PassRefPtrWillBeRawPtr<CSSValue> cssValue() const override; |
| 51 PassRefPtrWillBeRawPtr<CSSValue> computedCSSValue() const override; | 51 PassRefPtrWillBeRawPtr<CSSValue> computedCSSValue() const override; |
| 52 | 52 |
| 53 // FIXME: This is used by StyleImage for equals comparison, but this impleme
ntation | 53 // FIXME: This is used by StyleImage for equals comparison, but this impleme
ntation |
| 54 // only looks at the image from the set that we have loaded. I'm not sure if
that is | 54 // only looks at the image from the set that we have loaded. I'm not sure if
that is |
| 55 // meaningful enough or not. | 55 // meaningful enough or not. |
| 56 WrappedImagePtr data() const override; | 56 WrappedImagePtr data() const override; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 70 void addClient(LayoutObject*) override; | 70 void addClient(LayoutObject*) override; |
| 71 void removeClient(LayoutObject*) override; | 71 void removeClient(LayoutObject*) override; |
| 72 PassRefPtr<Image> image(const LayoutObject*, const IntSize&, float) const ov
erride; | 72 PassRefPtr<Image> image(const LayoutObject*, const IntSize&, float) const ov
erride; |
| 73 float imageScaleFactor() const override { return m_imageScaleFactor; } | 73 float imageScaleFactor() const override { return m_imageScaleFactor; } |
| 74 bool knownToBeOpaque(const LayoutObject*) const override; | 74 bool knownToBeOpaque(const LayoutObject*) const override; |
| 75 ImageResource* cachedImage() const override; | 75 ImageResource* cachedImage() const override; |
| 76 | 76 |
| 77 DECLARE_VIRTUAL_TRACE(); | 77 DECLARE_VIRTUAL_TRACE(); |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 StyleFetchedImageSet(ImageResource*, float imageScaleFactor, CSSImageSetValu
e*); | 80 StyleFetchedImageSet(ImageResource*, float imageScaleFactor, CSSImageSetValu
e*, const KURL&); |
| 81 | 81 |
| 82 String debugName() const override { return "StyleFetchedImageSet"; } | 82 String debugName() const override { return "StyleFetchedImageSet"; } |
| 83 | 83 |
| 84 ResourcePtr<ImageResource> m_bestFitImage; | 84 ResourcePtr<ImageResource> m_bestFitImage; |
| 85 float m_imageScaleFactor; | 85 float m_imageScaleFactor; |
| 86 | 86 |
| 87 RawPtrWillBeMember<CSSImageSetValue> m_imageSetValue; // Not retained; it ow
ns us. | 87 RawPtrWillBeMember<CSSImageSetValue> m_imageSetValue; // Not retained; it ow
ns us. |
| 88 const KURL m_url; |
| 88 }; | 89 }; |
| 89 | 90 |
| 90 DEFINE_STYLE_IMAGE_TYPE_CASTS(StyleFetchedImageSet, isImageResourceSet()); | 91 DEFINE_STYLE_IMAGE_TYPE_CASTS(StyleFetchedImageSet, isImageResourceSet()); |
| 91 | 92 |
| 92 } // namespace blink | 93 } // namespace blink |
| 93 | 94 |
| 94 #endif // StyleFetchedImageSet_h | 95 #endif // StyleFetchedImageSet_h |
| OLD | NEW |