| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 return false; | 122 return false; |
| 123 | 123 |
| 124 // If there is no background, there is nothing to support. | 124 // If there is no background, there is nothing to support. |
| 125 if (!renderer->style()->hasBackground()) | 125 if (!renderer->style()->hasBackground()) |
| 126 return true; | 126 return true; |
| 127 | 127 |
| 128 // Simple background that is contained within the contents rect. | 128 // Simple background that is contained within the contents rect. |
| 129 return contentsRect(renderer).contains(backgroundRect(renderer)); | 129 return contentsRect(renderer).contains(backgroundRect(renderer)); |
| 130 } | 130 } |
| 131 | 131 |
| 132 static blink::WebLayer* platformLayerForPlugin(RenderObject* renderer) | 132 static WebLayer* platformLayerForPlugin(RenderObject* renderer) |
| 133 { | 133 { |
| 134 if (!renderer->isEmbeddedObject()) | 134 if (!renderer->isEmbeddedObject()) |
| 135 return 0; | 135 return 0; |
| 136 Widget* widget = toRenderEmbeddedObject(renderer)->widget(); | 136 Widget* widget = toRenderEmbeddedObject(renderer)->widget(); |
| 137 if (!widget || !widget->isPluginView()) | 137 if (!widget || !widget->isPluginView()) |
| 138 return 0; | 138 return 0; |
| 139 return toPluginView(widget)->platformLayer(); | 139 return toPluginView(widget)->platformLayer(); |
| 140 | 140 |
| 141 } | 141 } |
| 142 | 142 |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 } | 453 } |
| 454 } else { | 454 } else { |
| 455 m_graphicsLayer->setReplicatedByLayer(0); | 455 m_graphicsLayer->setReplicatedByLayer(0); |
| 456 } | 456 } |
| 457 | 457 |
| 458 updateBackgroundColor(); | 458 updateBackgroundColor(); |
| 459 | 459 |
| 460 if (isDirectlyCompositedImage()) | 460 if (isDirectlyCompositedImage()) |
| 461 updateImageContents(); | 461 updateImageContents(); |
| 462 | 462 |
| 463 if (blink::WebLayer* layer = platformLayerForPlugin(renderer)) { | 463 if (WebLayer* layer = platformLayerForPlugin(renderer)) { |
| 464 m_graphicsLayer->setContentsToPlatformLayer(layer); | 464 m_graphicsLayer->setContentsToPlatformLayer(layer); |
| 465 } else if (renderer->node() && renderer->node()->isFrameOwnerElement() && to
HTMLFrameOwnerElement(renderer->node())->contentFrame()) { | 465 } else if (renderer->node() && renderer->node()->isFrameOwnerElement() && to
HTMLFrameOwnerElement(renderer->node())->contentFrame()) { |
| 466 blink::WebLayer* layer = toHTMLFrameOwnerElement(renderer->node())->cont
entFrame()->remotePlatformLayer(); | 466 WebLayer* layer = toHTMLFrameOwnerElement(renderer->node())->contentFram
e()->remotePlatformLayer(); |
| 467 if (layer) | 467 if (layer) |
| 468 m_graphicsLayer->setContentsToPlatformLayer(layer); | 468 m_graphicsLayer->setContentsToPlatformLayer(layer); |
| 469 } else if (renderer->isVideo()) { | 469 } else if (renderer->isVideo()) { |
| 470 HTMLMediaElement* mediaElement = toHTMLMediaElement(renderer->node()); | 470 HTMLMediaElement* mediaElement = toHTMLMediaElement(renderer->node()); |
| 471 m_graphicsLayer->setContentsToPlatformLayer(mediaElement->platformLayer(
)); | 471 m_graphicsLayer->setContentsToPlatformLayer(mediaElement->platformLayer(
)); |
| 472 } else if (isAcceleratedCanvas(renderer)) { | 472 } else if (isAcceleratedCanvas(renderer)) { |
| 473 HTMLCanvasElement* canvas = toHTMLCanvasElement(renderer->node()); | 473 HTMLCanvasElement* canvas = toHTMLCanvasElement(renderer->node()); |
| 474 if (CanvasRenderingContext* context = canvas->renderingContext()) | 474 if (CanvasRenderingContext* context = canvas->renderingContext()) |
| 475 m_graphicsLayer->setContentsToPlatformLayer(context->platformLayer()
); | 475 m_graphicsLayer->setContentsToPlatformLayer(context->platformLayer()
); |
| 476 layerConfigChanged = true; | 476 layerConfigChanged = true; |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 m_scrollingContentsLayer->setDrawsContent(!m_scrollingContentsAreEmpty); | 1097 m_scrollingContentsLayer->setDrawsContent(!m_scrollingContentsAreEmpty); |
| 1098 | 1098 |
| 1099 updateScrollingBlockSelection(); | 1099 updateScrollingBlockSelection(); |
| 1100 return; | 1100 return; |
| 1101 } | 1101 } |
| 1102 | 1102 |
| 1103 bool hasPaintedContent = containsPaintedContent(); | 1103 bool hasPaintedContent = containsPaintedContent(); |
| 1104 if (hasPaintedContent && isAcceleratedCanvas(renderer())) { | 1104 if (hasPaintedContent && isAcceleratedCanvas(renderer())) { |
| 1105 CanvasRenderingContext* context = toHTMLCanvasElement(renderer()->node()
)->renderingContext(); | 1105 CanvasRenderingContext* context = toHTMLCanvasElement(renderer()->node()
)->renderingContext(); |
| 1106 // Content layer may be null if context is lost. | 1106 // Content layer may be null if context is lost. |
| 1107 if (blink::WebLayer* contentLayer = context->platformLayer()) { | 1107 if (WebLayer* contentLayer = context->platformLayer()) { |
| 1108 Color bgColor(Color::transparent); | 1108 Color bgColor(Color::transparent); |
| 1109 if (contentLayerSupportsDirectBackgroundComposition(renderer())) { | 1109 if (contentLayerSupportsDirectBackgroundComposition(renderer())) { |
| 1110 bgColor = rendererBackgroundColor(); | 1110 bgColor = rendererBackgroundColor(); |
| 1111 } | 1111 } |
| 1112 contentLayer->setBackgroundColor(bgColor.rgb()); | 1112 contentLayer->setBackgroundColor(bgColor.rgb()); |
| 1113 } | 1113 } |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 // FIXME: we could refine this to only allocate backings for one of these la
yers if possible. | 1116 // FIXME: we could refine this to only allocate backings for one of these la
yers if possible. |
| 1117 m_graphicsLayer->setDrawsContent(hasPaintedContent); | 1117 m_graphicsLayer->setDrawsContent(hasPaintedContent); |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 || renderer->hasReflection() | 1913 || renderer->hasReflection() |
| 1914 || renderer->hasFilter(); | 1914 || renderer->hasFilter(); |
| 1915 | 1915 |
| 1916 if (paintsIntoCompositedAncestor() != previousPaintsIntoCompositedAncestor) | 1916 if (paintsIntoCompositedAncestor() != previousPaintsIntoCompositedAncestor) |
| 1917 compositor()->repaintOnCompositingChange(&m_owningLayer); | 1917 compositor()->repaintOnCompositingChange(&m_owningLayer); |
| 1918 | 1918 |
| 1919 | 1919 |
| 1920 return m_requiresOwnBackingStoreForIntrinsicReasons != previousRequiresOwnBa
ckingStoreForIntrinsicReasons; | 1920 return m_requiresOwnBackingStoreForIntrinsicReasons != previousRequiresOwnBa
ckingStoreForIntrinsicReasons; |
| 1921 } | 1921 } |
| 1922 | 1922 |
| 1923 void CompositedLayerMapping::setBlendMode(blink::WebBlendMode blendMode) | 1923 void CompositedLayerMapping::setBlendMode(WebBlendMode blendMode) |
| 1924 { | 1924 { |
| 1925 if (m_ancestorClippingLayer) { | 1925 if (m_ancestorClippingLayer) { |
| 1926 m_ancestorClippingLayer->setBlendMode(blendMode); | 1926 m_ancestorClippingLayer->setBlendMode(blendMode); |
| 1927 m_graphicsLayer->setBlendMode(blink::WebBlendModeNormal); | 1927 m_graphicsLayer->setBlendMode(WebBlendModeNormal); |
| 1928 } else { | 1928 } else { |
| 1929 m_graphicsLayer->setBlendMode(blendMode); | 1929 m_graphicsLayer->setBlendMode(blendMode); |
| 1930 } | 1930 } |
| 1931 } | 1931 } |
| 1932 | 1932 |
| 1933 GraphicsLayerUpdater::UpdateType CompositedLayerMapping::updateTypeForChildren(G
raphicsLayerUpdater::UpdateType updateType) const | 1933 GraphicsLayerUpdater::UpdateType CompositedLayerMapping::updateTypeForChildren(G
raphicsLayerUpdater::UpdateType updateType) const |
| 1934 { | 1934 { |
| 1935 if (m_pendingUpdateScope >= GraphicsLayerUpdateSubtree) | 1935 if (m_pendingUpdateScope >= GraphicsLayerUpdateSubtree) |
| 1936 return GraphicsLayerUpdater::ForceUpdate; | 1936 return GraphicsLayerUpdater::ForceUpdate; |
| 1937 return updateType; | 1937 return updateType; |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2287 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2287 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
| 2288 name = "Scrolling Block Selection Layer"; | 2288 name = "Scrolling Block Selection Layer"; |
| 2289 } else { | 2289 } else { |
| 2290 ASSERT_NOT_REACHED(); | 2290 ASSERT_NOT_REACHED(); |
| 2291 } | 2291 } |
| 2292 | 2292 |
| 2293 return name; | 2293 return name; |
| 2294 } | 2294 } |
| 2295 | 2295 |
| 2296 } // namespace blink | 2296 } // namespace blink |
| OLD | NEW |