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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 } | 115 } |
116 | 116 |
117 void ImageResource::switchClientsToRevalidatedResource() | 117 void ImageResource::switchClientsToRevalidatedResource() |
118 { | 118 { |
119 ASSERT(resourceToRevalidate()); | 119 ASSERT(resourceToRevalidate()); |
120 ASSERT(resourceToRevalidate()->isImage()); | 120 ASSERT(resourceToRevalidate()->isImage()); |
121 // Pending container size requests need to be transferred to the revalidated resource. | 121 // Pending container size requests need to be transferred to the revalidated resource. |
122 if (!m_pendingContainerSizeRequests.isEmpty()) { | 122 if (!m_pendingContainerSizeRequests.isEmpty()) { |
123 // A copy of pending size requests is needed as they are deleted during Resource::switchClientsToRevalidateResouce(). | 123 // A copy of pending size requests is needed as they are deleted during Resource::switchClientsToRevalidateResouce(). |
124 ContainerSizeRequests switchContainerSizeRequests; | 124 ContainerSizeRequests switchContainerSizeRequests; |
125 for (ContainerSizeRequests::iterator it = m_pendingContainerSizeRequests .begin(); it != m_pendingContainerSizeRequests.end(); ++it) | 125 for (const auto& containerSizeRequest : m_pendingContainerSizeRequests) |
126 switchContainerSizeRequests.set(it->key, it->value); | 126 switchContainerSizeRequests.set(containerSizeRequest.key, containerS izeRequest.value); |
127 Resource::switchClientsToRevalidatedResource(); | 127 Resource::switchClientsToRevalidatedResource(); |
128 ImageResource* revalidatedImageResource = toImageResource(resourceToReva lidate()); | 128 ImageResource* revalidatedImageResource = toImageResource(resourceToReva lidate()); |
129 for (ContainerSizeRequests::iterator it = switchContainerSizeRequests.be gin(); it != switchContainerSizeRequests.end(); ++it) | 129 for (const auto& containerSizeRequest : switchContainerSizeRequests) |
130 revalidatedImageResource->setContainerSizeForRenderer(it->key, it->v alue.first, it->value.second); | 130 revalidatedImageResource->setContainerSizeForRenderer(containerSizeR equest.key, containerSizeRequest.value.first, containerSizeRequest.value.second) ; |
131 return; | 131 return; |
132 } | 132 } |
133 | 133 |
134 Resource::switchClientsToRevalidatedResource(); | 134 Resource::switchClientsToRevalidatedResource(); |
135 } | 135 } |
136 | 136 |
137 bool ImageResource::isSafeToUnlock() const | 137 bool ImageResource::isSafeToUnlock() const |
138 { | 138 { |
139 // Note that |m_image| holds a reference to |m_data| in addition to the one held by the Resource parent class. | 139 // Note that |m_image| holds a reference to |m_data| in addition to the one held by the Resource parent class. |
140 return !m_image || (m_image->hasOneRef() && m_data->refCount() == 2); | 140 return !m_image || (m_image->hasOneRef() && m_data->refCount() == 2); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
322 RefPtr<SVGImage> svgImage = SVGImage::create(this); | 322 RefPtr<SVGImage> svgImage = SVGImage::create(this); |
323 m_svgImageCache = SVGImageCache::create(svgImage.get()); | 323 m_svgImageCache = SVGImageCache::create(svgImage.get()); |
324 m_image = svgImage.release(); | 324 m_image = svgImage.release(); |
325 } else { | 325 } else { |
326 m_image = BitmapImage::create(this); | 326 m_image = BitmapImage::create(this); |
327 } | 327 } |
328 | 328 |
329 if (m_image) { | 329 if (m_image) { |
330 // Send queued container size requests. | 330 // Send queued container size requests. |
331 if (m_image->usesContainerSize()) { | 331 if (m_image->usesContainerSize()) { |
332 for (ContainerSizeRequests::iterator it = m_pendingContainerSizeRequ ests.begin(); it != m_pendingContainerSizeRequests.end(); ++it) | 332 for (const auto& containerSizeRequest : m_pendingContainerSizeReques ts) |
333 setContainerSizeForRenderer(it->key, it->value.first, it->value. second); | 333 setContainerSizeForRenderer(containerSizeRequest.key, containerS izeRequest.value.first, containerSizeRequest.value.second); |
334 } | 334 } |
335 m_pendingContainerSizeRequests.clear(); | 335 m_pendingContainerSizeRequests.clear(); |
336 } | 336 } |
337 } | 337 } |
338 | 338 |
339 inline void ImageResource::clearImage() | 339 inline void ImageResource::clearImage() |
340 { | 340 { |
341 // If our Image has an observer, it's always us so we need to clear the back pointer | 341 // If our Image has an observer, it's always us so we need to clear the back pointer |
342 // before dropping our reference. | 342 // before dropping our reference. |
343 if (m_image) | 343 if (m_image) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 } | 380 } |
381 | 381 |
382 // It would be nice to only redraw the decoded band of the image, but wi th the current design | 382 // It would be nice to only redraw the decoded band of the image, but wi th the current design |
383 // (decoding delayed until painting) that seems hard. | 383 // (decoding delayed until painting) that seems hard. |
384 notifyObservers(); | 384 notifyObservers(); |
385 } | 385 } |
386 } | 386 } |
387 | 387 |
388 void ImageResource::updateBitmapImages(HashSet<ImageResource*>& images, bool red ecodeImages) | 388 void ImageResource::updateBitmapImages(HashSet<ImageResource*>& images, bool red ecodeImages) |
389 { | 389 { |
390 for (HashSet<ImageResource*>::iterator it = images.begin(); it != images.end (); ++it) { | 390 for (const auto& imageResource : images) { |
kenneth.r.christiansen
2014/10/18 09:55:04
I am not sure if calling this like imageResource i
| |
391 ImageResource* imageResource = *it; | |
392 if (!imageResource->hasImage() || imageResource->image()->isNull()) | 391 if (!imageResource->hasImage() || imageResource->image()->isNull()) |
393 continue; | 392 continue; |
394 BitmapImage* image = toBitmapImage(imageResource->image()); | 393 BitmapImage* image = toBitmapImage(imageResource->image()); |
395 if (redecodeImages) | 394 if (redecodeImages) |
396 image->resetDecoder(); | 395 image->resetDecoder(); |
397 imageResource->updateImage(image->isAllDataReceived()); | 396 imageResource->updateImage(image->isAllDataReceived()); |
398 } | 397 } |
399 } | 398 } |
400 | 399 |
401 void ImageResource::finishOnePart() | 400 void ImageResource::finishOnePart() |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
489 bool ImageResource::isAccessAllowed(SecurityOrigin* securityOrigin) | 488 bool ImageResource::isAccessAllowed(SecurityOrigin* securityOrigin) |
490 { | 489 { |
491 if (!image()->currentFrameHasSingleSecurityOrigin()) | 490 if (!image()->currentFrameHasSingleSecurityOrigin()) |
492 return false; | 491 return false; |
493 if (passesAccessControlCheck(securityOrigin)) | 492 if (passesAccessControlCheck(securityOrigin)) |
494 return true; | 493 return true; |
495 return !securityOrigin->taintsCanvas(response().url()); | 494 return !securityOrigin->taintsCanvas(response().url()); |
496 } | 495 } |
497 | 496 |
498 } // namespace blink | 497 } // namespace blink |
OLD | NEW |