OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
7 | 7 |
8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 187 } |
188 | 188 |
189 ImageResourceObserverWalker walker(m_observers); | 189 ImageResourceObserverWalker walker(m_observers); |
190 while (const auto* observer = walker.next()) { | 190 while (const auto* observer = walker.next()) { |
191 priorityFromObserver(observer, priority); | 191 priorityFromObserver(observer, priority); |
192 } | 192 } |
193 | 193 |
194 return priority; | 194 return priority; |
195 } | 195 } |
196 | 196 |
197 bool ImageResource::isSafeToUnlock() const | |
198 { | |
199 // Note that |m_image| holds a reference to |data()| in addition to the one
held by the Resource parent class. | |
200 return !m_image || (m_image->hasOneRef() && data()->refCount() == 2); | |
201 } | |
202 | |
203 void ImageResource::destroyDecodedDataForFailedRevalidation() | 197 void ImageResource::destroyDecodedDataForFailedRevalidation() |
204 { | 198 { |
205 clearImage(); | 199 clearImage(); |
206 setDecodedSize(0); | 200 setDecodedSize(0); |
207 } | 201 } |
208 | 202 |
209 void ImageResource::destroyDecodedDataIfPossible() | 203 void ImageResource::destroyDecodedDataIfPossible() |
210 { | 204 { |
211 if (!m_image) | 205 if (!m_image) |
212 return; | 206 return; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 return std::make_pair(brokenImageLoRes, 1); | 262 return std::make_pair(brokenImageLoRes, 1); |
269 } | 263 } |
270 | 264 |
271 bool ImageResource::willPaintBrokenImage() const | 265 bool ImageResource::willPaintBrokenImage() const |
272 { | 266 { |
273 return errorOccurred(); | 267 return errorOccurred(); |
274 } | 268 } |
275 | 269 |
276 blink::Image* ImageResource::getImage() | 270 blink::Image* ImageResource::getImage() |
277 { | 271 { |
278 ASSERT(!isPurgeable()); | |
279 | |
280 if (errorOccurred()) { | 272 if (errorOccurred()) { |
281 // Returning the 1x broken image is non-ideal, but we cannot reliably ac
cess the appropriate | 273 // Returning the 1x broken image is non-ideal, but we cannot reliably ac
cess the appropriate |
282 // deviceScaleFactor from here. It is critical that callers use ImageRes
ource::brokenImage() | 274 // deviceScaleFactor from here. It is critical that callers use ImageRes
ource::brokenImage() |
283 // when they need the real, deviceScaleFactor-appropriate broken image i
con. | 275 // when they need the real, deviceScaleFactor-appropriate broken image i
con. |
284 return brokenImage(1).first; | 276 return brokenImage(1).first; |
285 } | 277 } |
286 | 278 |
287 if (m_image) | 279 if (m_image) |
288 return m_image.get(); | 280 return m_image.get(); |
289 | 281 |
(...skipping 11 matching lines...) Expand all Loading... |
301 bool ImageResource::imageHasRelativeSize() const | 293 bool ImageResource::imageHasRelativeSize() const |
302 { | 294 { |
303 if (m_image) | 295 if (m_image) |
304 return m_image->hasRelativeSize(); | 296 return m_image->hasRelativeSize(); |
305 | 297 |
306 return false; | 298 return false; |
307 } | 299 } |
308 | 300 |
309 LayoutSize ImageResource::imageSize(RespectImageOrientationEnum shouldRespectIma
geOrientation, float multiplier, SizeType sizeType) | 301 LayoutSize ImageResource::imageSize(RespectImageOrientationEnum shouldRespectIma
geOrientation, float multiplier, SizeType sizeType) |
310 { | 302 { |
311 ASSERT(!isPurgeable()); | |
312 | |
313 if (!m_image) | 303 if (!m_image) |
314 return LayoutSize(); | 304 return LayoutSize(); |
315 | 305 |
316 LayoutSize size; | 306 LayoutSize size; |
317 | 307 |
318 if (m_image->isBitmapImage() && shouldRespectImageOrientation == RespectImag
eOrientation) | 308 if (m_image->isBitmapImage() && shouldRespectImageOrientation == RespectImag
eOrientation) |
319 size = LayoutSize(toBitmapImage(m_image.get())->sizeRespectingOrientatio
n()); | 309 size = LayoutSize(toBitmapImage(m_image.get())->sizeRespectingOrientatio
n()); |
320 else | 310 else |
321 size = LayoutSize(m_image->size()); | 311 size = LayoutSize(m_image->size()); |
322 | 312 |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 if (response().wasFetchedViaServiceWorker()) | 588 if (response().wasFetchedViaServiceWorker()) |
599 return response().serviceWorkerResponseType() != WebServiceWorkerRespons
eTypeOpaque; | 589 return response().serviceWorkerResponseType() != WebServiceWorkerRespons
eTypeOpaque; |
600 if (!getImage()->currentFrameHasSingleSecurityOrigin()) | 590 if (!getImage()->currentFrameHasSingleSecurityOrigin()) |
601 return false; | 591 return false; |
602 if (passesAccessControlCheck(securityOrigin)) | 592 if (passesAccessControlCheck(securityOrigin)) |
603 return true; | 593 return true; |
604 return !securityOrigin->taintsCanvas(response().url()); | 594 return !securityOrigin->taintsCanvas(response().url()); |
605 } | 595 } |
606 | 596 |
607 } // namespace blink | 597 } // namespace blink |
OLD | NEW |