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 10 matching lines...) Expand all Loading... |
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
23 * THE POSSIBILITY OF SUCH DAMAGE. | 23 * THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "core/rendering/style/StyleFetchedImageSet.h" | 27 #include "core/rendering/style/StyleFetchedImageSet.h" |
28 | 28 |
29 #include "core/css/CSSImageSetValue.h" | 29 #include "core/css/CSSImageSetValue.h" |
30 #include "core/fetch/ImageResource.h" | 30 #include "core/fetch/ImageResource.h" |
31 #include "core/rendering/RenderObject.h" | 31 #include "core/layout/LayoutObject.h" |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 StyleFetchedImageSet::StyleFetchedImageSet(ImageResource* image, float imageScal
eFactor, CSSImageSetValue* value) | 35 StyleFetchedImageSet::StyleFetchedImageSet(ImageResource* image, float imageScal
eFactor, CSSImageSetValue* value) |
36 : m_bestFitImage(image) | 36 : m_bestFitImage(image) |
37 , m_imageScaleFactor(imageScaleFactor) | 37 , m_imageScaleFactor(imageScaleFactor) |
38 , m_imageSetValue(value) | 38 , m_imageSetValue(value) |
39 { | 39 { |
40 m_isImageResourceSet = true; | 40 m_isImageResourceSet = true; |
41 m_bestFitImage->addClient(this); | 41 m_bestFitImage->addClient(this); |
42 } | 42 } |
43 | 43 |
44 | 44 |
45 StyleFetchedImageSet::~StyleFetchedImageSet() | 45 StyleFetchedImageSet::~StyleFetchedImageSet() |
46 { | 46 { |
47 m_bestFitImage->removeClient(this); | 47 m_bestFitImage->removeClient(this); |
48 } | 48 } |
49 | 49 |
50 PassRefPtrWillBeRawPtr<CSSValue> StyleFetchedImageSet::cssValue() const | 50 PassRefPtrWillBeRawPtr<CSSValue> StyleFetchedImageSet::cssValue() const |
51 { | 51 { |
52 return m_imageSetValue; | 52 return m_imageSetValue; |
53 } | 53 } |
54 | 54 |
55 bool StyleFetchedImageSet::canRender(const RenderObject& renderer, float multipl
ier) const | 55 bool StyleFetchedImageSet::canRender(const LayoutObject& renderer, float multipl
ier) const |
56 { | 56 { |
57 return m_bestFitImage->canRender(renderer, multiplier); | 57 return m_bestFitImage->canRender(renderer, multiplier); |
58 } | 58 } |
59 | 59 |
60 bool StyleFetchedImageSet::isLoaded() const | 60 bool StyleFetchedImageSet::isLoaded() const |
61 { | 61 { |
62 return m_bestFitImage->isLoaded(); | 62 return m_bestFitImage->isLoaded(); |
63 } | 63 } |
64 | 64 |
65 bool StyleFetchedImageSet::errorOccurred() const | 65 bool StyleFetchedImageSet::errorOccurred() const |
66 { | 66 { |
67 return m_bestFitImage->errorOccurred(); | 67 return m_bestFitImage->errorOccurred(); |
68 } | 68 } |
69 | 69 |
70 LayoutSize StyleFetchedImageSet::imageSize(const RenderObject* renderer, float m
ultiplier) const | 70 LayoutSize StyleFetchedImageSet::imageSize(const LayoutObject* renderer, float m
ultiplier) const |
71 { | 71 { |
72 LayoutSize scaledImageSize = m_bestFitImage->imageSizeForRenderer(renderer,
multiplier); | 72 LayoutSize scaledImageSize = m_bestFitImage->imageSizeForRenderer(renderer,
multiplier); |
73 scaledImageSize.scale(1 / m_imageScaleFactor); | 73 scaledImageSize.scale(1 / m_imageScaleFactor); |
74 return scaledImageSize; | 74 return scaledImageSize; |
75 } | 75 } |
76 | 76 |
77 bool StyleFetchedImageSet::imageHasRelativeWidth() const | 77 bool StyleFetchedImageSet::imageHasRelativeWidth() const |
78 { | 78 { |
79 return m_bestFitImage->imageHasRelativeWidth(); | 79 return m_bestFitImage->imageHasRelativeWidth(); |
80 } | 80 } |
81 | 81 |
82 bool StyleFetchedImageSet::imageHasRelativeHeight() const | 82 bool StyleFetchedImageSet::imageHasRelativeHeight() const |
83 { | 83 { |
84 return m_bestFitImage->imageHasRelativeHeight(); | 84 return m_bestFitImage->imageHasRelativeHeight(); |
85 } | 85 } |
86 | 86 |
87 void StyleFetchedImageSet::computeIntrinsicDimensions(const RenderObject*, Lengt
h& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) | 87 void StyleFetchedImageSet::computeIntrinsicDimensions(const LayoutObject*, Lengt
h& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) |
88 { | 88 { |
89 m_bestFitImage->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight,
intrinsicRatio); | 89 m_bestFitImage->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight,
intrinsicRatio); |
90 } | 90 } |
91 | 91 |
92 bool StyleFetchedImageSet::usesImageContainerSize() const | 92 bool StyleFetchedImageSet::usesImageContainerSize() const |
93 { | 93 { |
94 return m_bestFitImage->usesImageContainerSize(); | 94 return m_bestFitImage->usesImageContainerSize(); |
95 } | 95 } |
96 | 96 |
97 void StyleFetchedImageSet::setContainerSizeForRenderer(const RenderObject* rende
rer, const IntSize& imageContainerSize, float imageContainerZoomFactor) | 97 void StyleFetchedImageSet::setContainerSizeForRenderer(const LayoutObject* rende
rer, const IntSize& imageContainerSize, float imageContainerZoomFactor) |
98 { | 98 { |
99 m_bestFitImage->setContainerSizeForRenderer(renderer, imageContainerSize, im
ageContainerZoomFactor); | 99 m_bestFitImage->setContainerSizeForRenderer(renderer, imageContainerSize, im
ageContainerZoomFactor); |
100 } | 100 } |
101 | 101 |
102 void StyleFetchedImageSet::addClient(RenderObject* renderer) | 102 void StyleFetchedImageSet::addClient(LayoutObject* renderer) |
103 { | 103 { |
104 m_bestFitImage->addClient(renderer); | 104 m_bestFitImage->addClient(renderer); |
105 } | 105 } |
106 | 106 |
107 void StyleFetchedImageSet::removeClient(RenderObject* renderer) | 107 void StyleFetchedImageSet::removeClient(LayoutObject* renderer) |
108 { | 108 { |
109 m_bestFitImage->removeClient(renderer); | 109 m_bestFitImage->removeClient(renderer); |
110 } | 110 } |
111 | 111 |
112 PassRefPtr<Image> StyleFetchedImageSet::image(RenderObject* renderer, const IntS
ize&) const | 112 PassRefPtr<Image> StyleFetchedImageSet::image(LayoutObject* renderer, const IntS
ize&) const |
113 { | 113 { |
114 return m_bestFitImage->imageForRenderer(renderer); | 114 return m_bestFitImage->imageForRenderer(renderer); |
115 } | 115 } |
116 | 116 |
117 bool StyleFetchedImageSet::knownToBeOpaque(const RenderObject* renderer) const | 117 bool StyleFetchedImageSet::knownToBeOpaque(const LayoutObject* renderer) const |
118 { | 118 { |
119 return m_bestFitImage->currentFrameKnownToBeOpaque(renderer); | 119 return m_bestFitImage->currentFrameKnownToBeOpaque(renderer); |
120 } | 120 } |
121 | 121 |
122 } // namespace blink | 122 } // namespace blink |
OLD | NEW |