Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: Source/core/style/StyleFetchedImageSet.h

Issue 1339183003: NOT FOR LANDING Experiment with allocating SVGImageForContainer on demand (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/style/StyleFetchedImage.cpp ('k') | Source/core/style/StyleFetchedImageSet.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(StyleFetchedImageSet); 42 WTF_MAKE_FAST_ALLOCATED_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& urlWithFragmen t)
45 { 45 {
46 return adoptRefWillBeNoop(new StyleFetchedImageSet(image, imageScaleFact or, value)); 46 return adoptRefWillBeNoop(new StyleFetchedImageSet(image, imageScaleFact or, value, urlWithFragment));
47 } 47 }
48 ~StyleFetchedImageSet() override; 48 ~StyleFetchedImageSet() override;
49 49
50 PassRefPtrWillBeRawPtr<CSSValue> cssValue() const override; 50 PassRefPtrWillBeRawPtr<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 WrappedImagePtr data() const override { return m_bestFitImage.get(); } 55 WrappedImagePtr data() const override { return m_bestFitImage.get(); }
56 56
57 #if !ENABLE(OILPAN) 57 #if !ENABLE(OILPAN)
58 void clearImageSetValue() { m_imageSetValue = nullptr; } 58 void clearImageSetValue() { m_imageSetValue = nullptr; }
59 #endif 59 #endif
60 60
61 bool canRender(const LayoutObject&, float multiplier) const override; 61 bool canRender(const LayoutObject&, float multiplier) const override;
62 bool isLoaded() const override; 62 bool isLoaded() const override;
63 bool errorOccurred() const override; 63 bool errorOccurred() const override;
64 LayoutSize imageSize(const LayoutObject*, float multiplier) const override; 64 LayoutSize imageSize(const LayoutObject*, float multiplier) const override;
65 bool imageHasRelativeWidth() const override; 65 bool imageHasRelativeWidth() const override;
66 bool imageHasRelativeHeight() const override; 66 bool imageHasRelativeHeight() const override;
67 void computeIntrinsicDimensions(const LayoutObject*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) override; 67 void computeIntrinsicDimensions(const LayoutObject*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) override;
68 bool usesImageContainerSize() const override; 68 bool usesImageContainerSize() const override;
69 void setContainerSizeForLayoutObject(const LayoutObject*, const IntSize&, fl oat) 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(LayoutObject*, const IntSize&) const override; 71 PassRefPtr<Image> image(LayoutObject*, const IntSize&) const override;
73 float imageScaleFactor() const override { return m_imageScaleFactor; } 72 float imageScaleFactor() const override { return m_imageScaleFactor; }
74 bool knownToBeOpaque(const LayoutObject*) const override; 73 bool knownToBeOpaque(const LayoutObject*) const override;
75 ImageResource* cachedImage() const override { return m_bestFitImage.get(); } 74 ImageResource* cachedImage() const override { return m_bestFitImage.get(); }
75 KURL url() const override { return m_urlWithFragment; }
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 ResourcePtr<ImageResource> m_bestFitImage; 82 ResourcePtr<ImageResource> m_bestFitImage;
83 float m_imageScaleFactor; 83 float m_imageScaleFactor;
84 84
85 RawPtrWillBeMember<CSSImageSetValue> m_imageSetValue; // Not retained; it ow ns us. 85 RawPtrWillBeMember<CSSImageSetValue> m_imageSetValue; // Not retained; it ow ns us.
86 KURL m_urlWithFragment;
86 }; 87 };
87 88
88 DEFINE_STYLE_IMAGE_TYPE_CASTS(StyleFetchedImageSet, isImageResourceSet()); 89 DEFINE_STYLE_IMAGE_TYPE_CASTS(StyleFetchedImageSet, isImageResourceSet());
89 90
90 } // namespace blink 91 } // namespace blink
91 92
92 #endif // StyleFetchedImageSet_h 93 #endif // StyleFetchedImageSet_h
OLDNEW
« no previous file with comments | « Source/core/style/StyleFetchedImage.cpp ('k') | Source/core/style/StyleFetchedImageSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698