| 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 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 return false; | 129 return false; |
| 130 | 130 |
| 131 // If there is no background, there is nothing to support. | 131 // If there is no background, there is nothing to support. |
| 132 if (!renderer->style()->hasBackground()) | 132 if (!renderer->style()->hasBackground()) |
| 133 return true; | 133 return true; |
| 134 | 134 |
| 135 // Simple background that is contained within the contents rect. | 135 // Simple background that is contained within the contents rect. |
| 136 return contentsRect(renderer).contains(backgroundRect(renderer)); | 136 return contentsRect(renderer).contains(backgroundRect(renderer)); |
| 137 } | 137 } |
| 138 | 138 |
| 139 static blink::WebLayer* platformLayerForPlugin(RenderObject* renderer) |
| 140 { |
| 141 if (!renderer->isEmbeddedObject()) |
| 142 return 0; |
| 143 Widget* widget = toRenderEmbeddedObject(renderer)->widget(); |
| 144 if (!widget || !widget->isPluginView()) |
| 145 return 0; |
| 146 return toPluginView(widget)->platformLayer(); |
| 147 |
| 148 } |
| 149 |
| 139 static inline bool isAcceleratedContents(RenderObject* renderer) | 150 static inline bool isAcceleratedContents(RenderObject* renderer) |
| 140 { | 151 { |
| 141 return isAcceleratedCanvas(renderer) | 152 return isAcceleratedCanvas(renderer) |
| 142 || (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->re
quiresAcceleratedCompositing()) | 153 || (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->re
quiresAcceleratedCompositing()) |
| 143 || renderer->isVideo(); | 154 || renderer->isVideo(); |
| 144 } | 155 } |
| 145 | 156 |
| 146 // Get the scrolling coordinator in a way that works inside CompositedLayerMappi
ng's destructor. | 157 // Get the scrolling coordinator in a way that works inside CompositedLayerMappi
ng's destructor. |
| 147 static ScrollingCoordinator* scrollingCoordinatorFromLayer(RenderLayer& layer) | 158 static ScrollingCoordinator* scrollingCoordinatorFromLayer(RenderLayer& layer) |
| 148 { | 159 { |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 } | 534 } |
| 524 } else { | 535 } else { |
| 525 m_graphicsLayer->setReplicatedByLayer(0); | 536 m_graphicsLayer->setReplicatedByLayer(0); |
| 526 } | 537 } |
| 527 | 538 |
| 528 updateBackgroundColor(); | 539 updateBackgroundColor(); |
| 529 | 540 |
| 530 if (isDirectlyCompositedImage()) | 541 if (isDirectlyCompositedImage()) |
| 531 updateImageContents(); | 542 updateImageContents(); |
| 532 | 543 |
| 533 if (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->requir
esAcceleratedCompositing()) { | 544 if (blink::WebLayer* layer = platformLayerForPlugin(renderer)) { |
| 534 PluginView* pluginView = toPluginView(toRenderWidget(renderer)->widget()
); | 545 m_graphicsLayer->setContentsToPlatformLayer(layer); |
| 535 m_graphicsLayer->setContentsToPlatformLayer(pluginView->platformLayer())
; | |
| 536 } else if (renderer->node() && renderer->node()->isFrameOwnerElement() && to
HTMLFrameOwnerElement(renderer->node())->contentFrame()) { | 546 } else if (renderer->node() && renderer->node()->isFrameOwnerElement() && to
HTMLFrameOwnerElement(renderer->node())->contentFrame()) { |
| 537 blink::WebLayer* layer = toHTMLFrameOwnerElement(renderer->node())->cont
entFrame()->remotePlatformLayer(); | 547 blink::WebLayer* layer = toHTMLFrameOwnerElement(renderer->node())->cont
entFrame()->remotePlatformLayer(); |
| 538 if (layer) | 548 if (layer) |
| 539 m_graphicsLayer->setContentsToPlatformLayer(layer); | 549 m_graphicsLayer->setContentsToPlatformLayer(layer); |
| 540 } else if (renderer->isVideo()) { | 550 } else if (renderer->isVideo()) { |
| 541 HTMLMediaElement* mediaElement = toHTMLMediaElement(renderer->node()); | 551 HTMLMediaElement* mediaElement = toHTMLMediaElement(renderer->node()); |
| 542 m_graphicsLayer->setContentsToPlatformLayer(mediaElement->platformLayer(
)); | 552 m_graphicsLayer->setContentsToPlatformLayer(mediaElement->platformLayer(
)); |
| 543 } else if (isAcceleratedCanvas(renderer)) { | 553 } else if (isAcceleratedCanvas(renderer)) { |
| 544 HTMLCanvasElement* canvas = toHTMLCanvasElement(renderer->node()); | 554 HTMLCanvasElement* canvas = toHTMLCanvasElement(renderer->node()); |
| 545 if (CanvasRenderingContext* context = canvas->renderingContext()) | 555 if (CanvasRenderingContext* context = canvas->renderingContext()) |
| (...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2153 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2163 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
| 2154 name = "Scrolling Contents Layer"; | 2164 name = "Scrolling Contents Layer"; |
| 2155 } else { | 2165 } else { |
| 2156 ASSERT_NOT_REACHED(); | 2166 ASSERT_NOT_REACHED(); |
| 2157 } | 2167 } |
| 2158 | 2168 |
| 2159 return name; | 2169 return name; |
| 2160 } | 2170 } |
| 2161 | 2171 |
| 2162 } // namespace WebCore | 2172 } // namespace WebCore |
| OLD | NEW |