| 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 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 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 WILL_BE_USING_PRE_FINALIZER(StyleFetchedImageSet, dispose); |
| 43 public: | 44 public: |
| 44 static PassRefPtrWillBeRawPtr<StyleFetchedImageSet> create(ImageResource* im
age, float imageScaleFactor, CSSImageSetValue* value, const KURL& url) | 45 static PassRefPtrWillBeRawPtr<StyleFetchedImageSet> create(ImageResource* im
age, float imageScaleFactor, CSSImageSetValue* value, const KURL& url) |
| 45 { | 46 { |
| 46 return adoptRefWillBeNoop(new StyleFetchedImageSet(image, imageScaleFact
or, value, url)); | 47 return adoptRefWillBeNoop(new StyleFetchedImageSet(image, imageScaleFact
or, value, url)); |
| 47 } | 48 } |
| 48 ~StyleFetchedImageSet() override; | 49 ~StyleFetchedImageSet() override; |
| 49 | 50 |
| 50 PassRefPtrWillBeRawPtr<CSSValue> cssValue() const override; | 51 PassRefPtrWillBeRawPtr<CSSValue> cssValue() const override; |
| 51 PassRefPtrWillBeRawPtr<CSSValue> computedCSSValue() const override; | 52 PassRefPtrWillBeRawPtr<CSSValue> computedCSSValue() const override; |
| 52 | 53 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 67 bool imageHasRelativeHeight() const override; | 68 bool imageHasRelativeHeight() const override; |
| 68 void computeIntrinsicDimensions(const LayoutObject*, Length& intrinsicWidth,
Length& intrinsicHeight, FloatSize& intrinsicRatio) override; | 69 void computeIntrinsicDimensions(const LayoutObject*, Length& intrinsicWidth,
Length& intrinsicHeight, FloatSize& intrinsicRatio) override; |
| 69 bool usesImageContainerSize() const override; | 70 bool usesImageContainerSize() const override; |
| 70 void addClient(LayoutObject*) override; | 71 void addClient(LayoutObject*) override; |
| 71 void removeClient(LayoutObject*) override; | 72 void removeClient(LayoutObject*) override; |
| 72 PassRefPtr<Image> image(const LayoutObject*, const IntSize&, float) const ov
erride; | 73 PassRefPtr<Image> image(const LayoutObject*, const IntSize&, float) const ov
erride; |
| 73 float imageScaleFactor() const override { return m_imageScaleFactor; } | 74 float imageScaleFactor() const override { return m_imageScaleFactor; } |
| 74 bool knownToBeOpaque(const LayoutObject*) const override; | 75 bool knownToBeOpaque(const LayoutObject*) const override; |
| 75 ImageResource* cachedImage() const override; | 76 ImageResource* cachedImage() const override; |
| 76 | 77 |
| 77 #if ENABLE(OILPAN) | |
| 78 // Promptly remove as a ImageResource client. | |
| 79 EAGERLY_FINALIZE(); | |
| 80 DECLARE_EAGER_FINALIZATION_OPERATOR_NEW(); | |
| 81 #endif | |
| 82 DECLARE_VIRTUAL_TRACE(); | 78 DECLARE_VIRTUAL_TRACE(); |
| 83 | 79 |
| 84 private: | 80 private: |
| 85 StyleFetchedImageSet(ImageResource*, float imageScaleFactor, CSSImageSetValu
e*, const KURL&); | 81 StyleFetchedImageSet(ImageResource*, float imageScaleFactor, CSSImageSetValu
e*, const KURL&); |
| 86 | 82 |
| 83 void dispose(); |
| 84 |
| 87 String debugName() const override { return "StyleFetchedImageSet"; } | 85 String debugName() const override { return "StyleFetchedImageSet"; } |
| 88 | 86 |
| 89 ResourcePtr<ImageResource> m_bestFitImage; | 87 ResourcePtr<ImageResource> m_bestFitImage; |
| 90 float m_imageScaleFactor; | 88 float m_imageScaleFactor; |
| 91 | 89 |
| 92 RawPtrWillBeMember<CSSImageSetValue> m_imageSetValue; // Not retained; it ow
ns us. | 90 RawPtrWillBeMember<CSSImageSetValue> m_imageSetValue; // Not retained; it ow
ns us. |
| 93 const KURL m_url; | 91 const KURL m_url; |
| 94 }; | 92 }; |
| 95 | 93 |
| 96 DEFINE_STYLE_IMAGE_TYPE_CASTS(StyleFetchedImageSet, isImageResourceSet()); | 94 DEFINE_STYLE_IMAGE_TYPE_CASTS(StyleFetchedImageSet, isImageResourceSet()); |
| 97 | 95 |
| 98 } // namespace blink | 96 } // namespace blink |
| 99 | 97 |
| 100 #endif // StyleFetchedImageSet_h | 98 #endif // StyleFetchedImageSet_h |
| OLD | NEW |