OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2011 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 |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "core/layout/compositing/CompositedLayerMapping.h" | 26 #include "core/layout/compositing/CompositedLayerMapping.h" |
27 | 27 |
28 #include "core/HTMLNames.h" | 28 #include "core/HTMLNames.h" |
29 #include "core/dom/DOMNodeIds.h" | 29 #include "core/dom/DOMNodeIds.h" |
30 #include "core/fetch/ImageResource.h" | 30 #include "core/fetch/ImageResourceContent.h" |
31 #include "core/frame/FrameHost.h" | 31 #include "core/frame/FrameHost.h" |
32 #include "core/frame/FrameView.h" | 32 #include "core/frame/FrameView.h" |
33 #include "core/frame/RemoteFrame.h" | 33 #include "core/frame/RemoteFrame.h" |
34 #include "core/frame/Settings.h" | 34 #include "core/frame/Settings.h" |
35 #include "core/frame/VisualViewport.h" | 35 #include "core/frame/VisualViewport.h" |
36 #include "core/html/HTMLCanvasElement.h" | 36 #include "core/html/HTMLCanvasElement.h" |
37 #include "core/html/HTMLIFrameElement.h" | 37 #include "core/html/HTMLIFrameElement.h" |
38 #include "core/html/HTMLMediaElement.h" | 38 #include "core/html/HTMLMediaElement.h" |
39 #include "core/html/HTMLVideoElement.h" | 39 #include "core/html/HTMLVideoElement.h" |
40 #include "core/html/canvas/CanvasRenderingContext.h" | 40 #include "core/html/canvas/CanvasRenderingContext.h" |
(...skipping 2432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2473 // compositing saves a backing store. | 2473 // compositing saves a backing store. |
2474 bool CompositedLayerMapping::isDirectlyCompositedImage() const { | 2474 bool CompositedLayerMapping::isDirectlyCompositedImage() const { |
2475 ASSERT(layoutObject()->isImage()); | 2475 ASSERT(layoutObject()->isImage()); |
2476 LayoutImage* imageLayoutObject = toLayoutImage(layoutObject()); | 2476 LayoutImage* imageLayoutObject = toLayoutImage(layoutObject()); |
2477 | 2477 |
2478 if (m_owningLayer.hasBoxDecorationsOrBackground() || | 2478 if (m_owningLayer.hasBoxDecorationsOrBackground() || |
2479 imageLayoutObject->hasClip() || imageLayoutObject->hasClipPath() || | 2479 imageLayoutObject->hasClip() || imageLayoutObject->hasClipPath() || |
2480 imageLayoutObject->hasObjectFit()) | 2480 imageLayoutObject->hasObjectFit()) |
2481 return false; | 2481 return false; |
2482 | 2482 |
2483 if (ImageResource* cachedImage = imageLayoutObject->cachedImage()) { | 2483 if (ImageResourceContent* cachedImage = imageLayoutObject->cachedImage()) { |
2484 if (!cachedImage->hasImage()) | 2484 if (!cachedImage->hasImage()) |
2485 return false; | 2485 return false; |
2486 | 2486 |
2487 Image* image = cachedImage->getImage(); | 2487 Image* image = cachedImage->getImage(); |
2488 if (!image->isBitmapImage()) | 2488 if (!image->isBitmapImage()) |
2489 return false; | 2489 return false; |
2490 | 2490 |
2491 return true; | 2491 return true; |
2492 } | 2492 } |
2493 | 2493 |
(...skipping 10 matching lines...) Expand all Loading... |
2504 if (changeType == CanvasChanged && isAcceleratedCanvas(layoutObject())) { | 2504 if (changeType == CanvasChanged && isAcceleratedCanvas(layoutObject())) { |
2505 m_graphicsLayer->setContentsNeedsDisplay(); | 2505 m_graphicsLayer->setContentsNeedsDisplay(); |
2506 return; | 2506 return; |
2507 } | 2507 } |
2508 } | 2508 } |
2509 | 2509 |
2510 void CompositedLayerMapping::updateImageContents() { | 2510 void CompositedLayerMapping::updateImageContents() { |
2511 ASSERT(layoutObject()->isImage()); | 2511 ASSERT(layoutObject()->isImage()); |
2512 LayoutImage* imageLayoutObject = toLayoutImage(layoutObject()); | 2512 LayoutImage* imageLayoutObject = toLayoutImage(layoutObject()); |
2513 | 2513 |
2514 ImageResource* cachedImage = imageLayoutObject->cachedImage(); | 2514 ImageResourceContent* cachedImage = imageLayoutObject->cachedImage(); |
2515 if (!cachedImage) | 2515 if (!cachedImage) |
2516 return; | 2516 return; |
2517 | 2517 |
2518 Image* image = cachedImage->getImage(); | 2518 Image* image = cachedImage->getImage(); |
2519 if (!image) | 2519 if (!image) |
2520 return; | 2520 return; |
2521 | 2521 |
2522 // This is a no-op if the layer doesn't have an inner layer for the image. | 2522 // This is a no-op if the layer doesn't have an inner layer for the image. |
2523 m_graphicsLayer->setContentsToImage( | 2523 m_graphicsLayer->setContentsToImage( |
2524 image, LayoutObject::shouldRespectImageOrientation(imageLayoutObject)); | 2524 image, LayoutObject::shouldRespectImageOrientation(imageLayoutObject)); |
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3374 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { | 3374 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { |
3375 name = "Decoration Layer"; | 3375 name = "Decoration Layer"; |
3376 } else { | 3376 } else { |
3377 ASSERT_NOT_REACHED(); | 3377 ASSERT_NOT_REACHED(); |
3378 } | 3378 } |
3379 | 3379 |
3380 return name; | 3380 return name; |
3381 } | 3381 } |
3382 | 3382 |
3383 } // namespace blink | 3383 } // namespace blink |
OLD | NEW |