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 12 matching lines...) Expand all Loading... |
23 | 23 |
24 #include "config.h" | 24 #include "config.h" |
25 #include "core/fetch/ImageResource.h" | 25 #include "core/fetch/ImageResource.h" |
26 | 26 |
27 #include "core/fetch/ImageResourceClient.h" | 27 #include "core/fetch/ImageResourceClient.h" |
28 #include "core/fetch/MemoryCache.h" | 28 #include "core/fetch/MemoryCache.h" |
29 #include "core/fetch/ResourceClient.h" | 29 #include "core/fetch/ResourceClient.h" |
30 #include "core/fetch/ResourceClientWalker.h" | 30 #include "core/fetch/ResourceClientWalker.h" |
31 #include "core/fetch/ResourceFetcher.h" | 31 #include "core/fetch/ResourceFetcher.h" |
32 #include "core/fetch/ResourceLoader.h" | 32 #include "core/fetch/ResourceLoader.h" |
33 #include "core/layout/LayoutObject.h" | |
34 #include "core/svg/graphics/SVGImage.h" | 33 #include "core/svg/graphics/SVGImage.h" |
35 #include "platform/Logging.h" | 34 #include "platform/Logging.h" |
36 #include "platform/RuntimeEnabledFeatures.h" | 35 #include "platform/RuntimeEnabledFeatures.h" |
37 #include "platform/SharedBuffer.h" | 36 #include "platform/SharedBuffer.h" |
38 #include "platform/TraceEvent.h" | 37 #include "platform/TraceEvent.h" |
39 #include "platform/graphics/BitmapImage.h" | 38 #include "platform/graphics/BitmapImage.h" |
40 #include "public/platform/Platform.h" | 39 #include "public/platform/Platform.h" |
41 #include "wtf/CurrentTime.h" | 40 #include "wtf/CurrentTime.h" |
42 #include "wtf/StdLibExtras.h" | 41 #include "wtf/StdLibExtras.h" |
43 | 42 |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 } | 438 } |
440 } | 439 } |
441 | 440 |
442 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect
) | 441 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect
) |
443 { | 442 { |
444 if (!image || image != m_image) | 443 if (!image || image != m_image) |
445 return; | 444 return; |
446 notifyObservers(&rect); | 445 notifyObservers(&rect); |
447 } | 446 } |
448 | 447 |
449 bool ImageResource::currentFrameKnownToBeOpaque(const LayoutObject* layoutObject
) | |
450 { | |
451 blink::Image* image = this->image(); | |
452 if (image->isBitmapImage()) { | |
453 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage
", "data", InspectorPaintImageEvent::data(layoutObject, *this)); | |
454 // BitmapImage::currentFrameKnownToBeOpaque() conservatively returns fal
se for uncached | |
455 // frames. To increase the change of an accurate answer, we pre-cache th
e current frame | |
456 // metadata. | |
457 image->imageForCurrentFrame(); | |
458 } | |
459 return image->currentFrameKnownToBeOpaque(); | |
460 } | |
461 | |
462 bool ImageResource::isAccessAllowed(SecurityOrigin* securityOrigin) | 448 bool ImageResource::isAccessAllowed(SecurityOrigin* securityOrigin) |
463 { | 449 { |
464 if (response().wasFetchedViaServiceWorker()) | 450 if (response().wasFetchedViaServiceWorker()) |
465 return response().serviceWorkerResponseType() != WebServiceWorkerRespons
eTypeOpaque; | 451 return response().serviceWorkerResponseType() != WebServiceWorkerRespons
eTypeOpaque; |
466 if (!image()->currentFrameHasSingleSecurityOrigin()) | 452 if (!image()->currentFrameHasSingleSecurityOrigin()) |
467 return false; | 453 return false; |
468 if (passesAccessControlCheck(securityOrigin)) | 454 if (passesAccessControlCheck(securityOrigin)) |
469 return true; | 455 return true; |
470 return !securityOrigin->taintsCanvas(response().url()); | 456 return !securityOrigin->taintsCanvas(response().url()); |
471 } | 457 } |
472 | 458 |
473 bool ImageResource::loadingMultipartContent() const | 459 bool ImageResource::loadingMultipartContent() const |
474 { | 460 { |
475 return m_loader && m_loader->loadingMultipartContent(); | 461 return m_loader && m_loader->loadingMultipartContent(); |
476 } | 462 } |
477 | 463 |
478 } // namespace blink | 464 } // namespace blink |
OLD | NEW |