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 15 matching lines...) Expand all Loading... |
26 #include "config.h" | 26 #include "config.h" |
27 #include "core/style/StyleFetchedImageSet.h" | 27 #include "core/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/layout/LayoutObject.h" | 31 #include "core/layout/LayoutObject.h" |
32 #include "core/svg/graphics/SVGImageForContainer.h" | 32 #include "core/svg/graphics/SVGImageForContainer.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 StyleFetchedImageSet::StyleFetchedImageSet(ImageResource* image, float imageScal
eFactor, CSSImageSetValue* value) | 36 StyleFetchedImageSet::StyleFetchedImageSet(ImageResource* image, float imageScal
eFactor, CSSImageSetValue* value, const KURL& url) |
37 : m_bestFitImage(image) | 37 : m_bestFitImage(image) |
38 , m_imageScaleFactor(imageScaleFactor) | 38 , m_imageScaleFactor(imageScaleFactor) |
39 , m_imageSetValue(value) | 39 , m_imageSetValue(value) |
| 40 , m_url(url) |
40 { | 41 { |
41 m_isImageResourceSet = true; | 42 m_isImageResourceSet = true; |
42 m_bestFitImage->addClient(this); | 43 m_bestFitImage->addClient(this); |
43 } | 44 } |
44 | 45 |
45 | 46 |
46 StyleFetchedImageSet::~StyleFetchedImageSet() | 47 StyleFetchedImageSet::~StyleFetchedImageSet() |
47 { | 48 { |
48 m_bestFitImage->removeClient(this); | 49 m_bestFitImage->removeClient(this); |
49 } | 50 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 118 |
118 void StyleFetchedImageSet::removeClient(LayoutObject* layoutObject) | 119 void StyleFetchedImageSet::removeClient(LayoutObject* layoutObject) |
119 { | 120 { |
120 m_bestFitImage->removeClient(layoutObject); | 121 m_bestFitImage->removeClient(layoutObject); |
121 } | 122 } |
122 | 123 |
123 PassRefPtr<Image> StyleFetchedImageSet::image(const LayoutObject*, const IntSize
& containerSize, float zoom) const | 124 PassRefPtr<Image> StyleFetchedImageSet::image(const LayoutObject*, const IntSize
& containerSize, float zoom) const |
124 { | 125 { |
125 RefPtr<Image> image = m_bestFitImage->image(); | 126 RefPtr<Image> image = m_bestFitImage->image(); |
126 if (image && image->isSVGImage()) | 127 if (image && image->isSVGImage()) |
127 return SVGImageForContainer::create(toSVGImage(image.get()), containerSi
ze, zoom); | 128 return SVGImageForContainer::create(toSVGImage(image.get()), containerSi
ze, zoom, m_url); |
128 return image; | 129 return image; |
129 } | 130 } |
130 | 131 |
131 bool StyleFetchedImageSet::knownToBeOpaque(const LayoutObject* layoutObject) con
st | 132 bool StyleFetchedImageSet::knownToBeOpaque(const LayoutObject* layoutObject) con
st |
132 { | 133 { |
133 return m_bestFitImage->currentFrameKnownToBeOpaque(layoutObject); | 134 return m_bestFitImage->currentFrameKnownToBeOpaque(layoutObject); |
134 } | 135 } |
135 | 136 |
136 DEFINE_TRACE(StyleFetchedImageSet) | 137 DEFINE_TRACE(StyleFetchedImageSet) |
137 { | 138 { |
138 visitor->trace(m_imageSetValue); | 139 visitor->trace(m_imageSetValue); |
139 StyleImage::trace(visitor); | 140 StyleImage::trace(visitor); |
140 } | 141 } |
141 | 142 |
142 } // namespace blink | 143 } // namespace blink |
OLD | NEW |