OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com) |
6 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 6 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
8 * Copyright (C) 2010 Google Inc. All rights reserved. | 8 * Copyright (C) 2010 Google Inc. All rights reserved. |
9 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. | 9 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. |
10 * | 10 * |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 RespectImageOrientationEnum oldOrientation = oldStyle ? oldStyle->respectIma
geOrientation() : ComputedStyle::initialRespectImageOrientation(); | 83 RespectImageOrientationEnum oldOrientation = oldStyle ? oldStyle->respectIma
geOrientation() : ComputedStyle::initialRespectImageOrientation(); |
84 if (style() && style()->respectImageOrientation() != oldOrientation) | 84 if (style() && style()->respectImageOrientation() != oldOrientation) |
85 intrinsicSizeChanged(); | 85 intrinsicSizeChanged(); |
86 } | 86 } |
87 | 87 |
88 void LayoutImage::setImageResource(PassOwnPtrWillBeRawPtr<LayoutImageResource> i
mageResource) | 88 void LayoutImage::setImageResource(PassOwnPtrWillBeRawPtr<LayoutImageResource> i
mageResource) |
89 { | 89 { |
90 ASSERT(!m_imageResource); | 90 ASSERT(!m_imageResource); |
91 m_imageResource = imageResource; | 91 m_imageResource = imageResource; |
92 m_imageResource->initialize(this, this); | 92 m_imageResource->initialize(this); |
93 } | 93 } |
94 | 94 |
95 void LayoutImage::imageChanged(WrappedImagePtr newImage, const IntRect* rect) | 95 void LayoutImage::imageChanged(bool isNotifyingFinish, WrappedImagePtr newImage,
const IntRect* rect) |
96 { | 96 { |
97 ASSERT(view()); | 97 ASSERT(view()); |
98 ASSERT(view()->frameView()); | 98 ASSERT(view()->frameView()); |
99 if (documentBeingDestroyed()) | 99 if (documentBeingDestroyed()) |
100 return; | 100 return; |
101 | 101 |
102 if (hasBoxDecorationBackground() || hasMask() || hasShapeOutside()) | 102 if (hasBoxDecorationBackground() || hasMask() || hasShapeOutside()) |
103 LayoutReplaced::imageChanged(newImage, rect); | 103 LayoutReplaced::imageChanged(isNotifyingFinish, newImage, rect); |
104 | 104 |
105 if (!m_imageResource) | 105 if (!m_imageResource) |
106 return; | 106 return; |
107 | 107 |
| 108 if (isNotifyingFinish) { |
| 109 invalidateBackgroundObscurationStatus(); |
| 110 if (newImage == m_imageResource->cachedImage()) { |
| 111 // tell any potential compositing layers |
| 112 // that the image is done and they can reference it directly. |
| 113 contentChanged(ImageChanged); |
| 114 } |
| 115 } |
| 116 |
108 if (newImage != m_imageResource->imagePtr()) | 117 if (newImage != m_imageResource->imagePtr()) |
109 return; | 118 return; |
110 | 119 |
111 if (isGeneratedContent() && isHTMLImageElement(node()) && m_imageResource->e
rrorOccurred()) { | 120 if (isGeneratedContent() && isHTMLImageElement(node()) && m_imageResource->e
rrorOccurred()) { |
112 toHTMLImageElement(node())->ensureFallbackForGeneratedContent(); | 121 toHTMLImageElement(node())->ensureFallbackForGeneratedContent(); |
113 return; | 122 return; |
114 } | 123 } |
115 | 124 |
116 // Per the spec, we let the server-sent header override srcset/other sources
of dpr. | 125 // Per the spec, we let the server-sent header override srcset/other sources
of dpr. |
117 // https://github.com/igrigorik/http-client-hints/blob/master/draft-grigorik
-http-client-hints-01.txt#L255 | 126 // https://github.com/igrigorik/http-client-hints/blob/master/draft-grigorik
-http-client-hints-01.txt#L255 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 177 |
169 if (imageResource() && imageResource()->maybeAnimated()) | 178 if (imageResource() && imageResource()->maybeAnimated()) |
170 setShouldDoFullPaintInvalidation(PaintInvalidationDelayedFull); | 179 setShouldDoFullPaintInvalidation(PaintInvalidationDelayedFull); |
171 else | 180 else |
172 setShouldDoFullPaintInvalidation(PaintInvalidationFull); | 181 setShouldDoFullPaintInvalidation(PaintInvalidationFull); |
173 | 182 |
174 // Tell any potential compositing layers that the image needs updating. | 183 // Tell any potential compositing layers that the image needs updating. |
175 contentChanged(ImageChanged); | 184 contentChanged(ImageChanged); |
176 } | 185 } |
177 | 186 |
178 void LayoutImage::notifyFinished(Resource* newImage) | |
179 { | |
180 if (!m_imageResource) | |
181 return; | |
182 | |
183 if (documentBeingDestroyed()) | |
184 return; | |
185 | |
186 invalidateBackgroundObscurationStatus(); | |
187 | |
188 if (newImage == m_imageResource->cachedImage()) { | |
189 // tell any potential compositing layers | |
190 // that the image is done and they can reference it directly. | |
191 contentChanged(ImageChanged); | |
192 } | |
193 } | |
194 | |
195 void LayoutImage::paintReplaced(const PaintInfo& paintInfo, const LayoutPoint& p
aintOffset) const | 187 void LayoutImage::paintReplaced(const PaintInfo& paintInfo, const LayoutPoint& p
aintOffset) const |
196 { | 188 { |
197 ImagePainter(*this).paintReplaced(paintInfo, paintOffset); | 189 ImagePainter(*this).paintReplaced(paintInfo, paintOffset); |
198 } | 190 } |
199 | 191 |
200 void LayoutImage::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) const | 192 void LayoutImage::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) const |
201 { | 193 { |
202 ImagePainter(*this).paint(paintInfo, paintOffset); | 194 ImagePainter(*this).paint(paintInfo, paintOffset); |
203 } | 195 } |
204 | 196 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 return nullptr; | 310 return nullptr; |
319 | 311 |
320 ImageResource* cachedImage = m_imageResource->cachedImage(); | 312 ImageResource* cachedImage = m_imageResource->cachedImage(); |
321 if (cachedImage && cachedImage->getImage() && cachedImage->getImage()->isSVG
Image()) | 313 if (cachedImage && cachedImage->getImage() && cachedImage->getImage()->isSVG
Image()) |
322 return toSVGImage(cachedImage->getImage())->embeddedContentBox(); | 314 return toSVGImage(cachedImage->getImage())->embeddedContentBox(); |
323 | 315 |
324 return nullptr; | 316 return nullptr; |
325 } | 317 } |
326 | 318 |
327 } // namespace blink | 319 } // namespace blink |
OLD | NEW |