| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 static inline bool isAcceleratedCanvas(const LayoutObject& layoutObject) { | 113 static inline bool isAcceleratedCanvas(const LayoutObject& layoutObject) { |
| 114 if (layoutObject.isCanvas()) { | 114 if (layoutObject.isCanvas()) { |
| 115 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject.node()); | 115 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject.node()); |
| 116 if (CanvasRenderingContext* context = canvas->renderingContext()) | 116 if (CanvasRenderingContext* context = canvas->renderingContext()) |
| 117 return context->isAccelerated(); | 117 return context->isAccelerated(); |
| 118 } | 118 } |
| 119 return false; | 119 return false; |
| 120 } | 120 } |
| 121 | 121 |
| 122 static inline bool isCanvasControlledByOffscreen( | 122 static inline bool isPlaceholderCanvas(const LayoutObject& layoutObject) { |
| 123 const LayoutObject& layoutObject) { | |
| 124 if (layoutObject.isCanvas()) { | 123 if (layoutObject.isCanvas()) { |
| 125 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject.node()); | 124 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject.node()); |
| 126 if (canvas->surfaceLayerBridge()) | 125 return canvas->surfaceLayerBridge(); |
| 127 return true; | |
| 128 } | 126 } |
| 129 return false; | 127 return false; |
| 130 } | 128 } |
| 131 | 129 |
| 132 static bool hasBoxDecorationsOrBackgroundImage(const ComputedStyle& style) { | 130 static bool hasBoxDecorationsOrBackgroundImage(const ComputedStyle& style) { |
| 133 return style.hasBoxDecorations() || style.hasBackgroundImage(); | 131 return style.hasBoxDecorations() || style.hasBackgroundImage(); |
| 134 } | 132 } |
| 135 | 133 |
| 136 static bool contentLayerSupportsDirectBackgroundComposition( | 134 static bool contentLayerSupportsDirectBackgroundComposition( |
| 137 const LayoutObject& layoutObject) { | 135 const LayoutObject& layoutObject) { |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 m_graphicsLayer->setContentsOpaque( | 418 m_graphicsLayer->setContentsOpaque( |
| 421 !Color(layer->backgroundColor()).hasAlpha()); | 419 !Color(layer->backgroundColor()).hasAlpha()); |
| 422 } | 420 } |
| 423 } else { | 421 } else { |
| 424 m_graphicsLayer->setContentsOpaque(false); | 422 m_graphicsLayer->setContentsOpaque(false); |
| 425 } | 423 } |
| 426 } else if (m_backgroundLayer) { | 424 } else if (m_backgroundLayer) { |
| 427 m_graphicsLayer->setContentsOpaque(false); | 425 m_graphicsLayer->setContentsOpaque(false); |
| 428 m_backgroundLayer->setContentsOpaque( | 426 m_backgroundLayer->setContentsOpaque( |
| 429 m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds())); | 427 m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds())); |
| 428 } else if (isPlaceholderCanvas(layoutObject())) { |
| 429 // TODO(crbug.com/705019): Contents could be opaque, but that cannot be |
| 430 // determined from the main thread. Or can it? |
| 431 m_graphicsLayer->setContentsOpaque(false); |
| 430 } else { | 432 } else { |
| 431 // For non-root layers, background is painted by the scrolling contents | 433 // For non-root layers, background is painted by the scrolling contents |
| 432 // layer if all backgrounds are background attachment local, otherwise | 434 // layer if all backgrounds are background attachment local, otherwise |
| 433 // background is painted by the primary graphics layer. | 435 // background is painted by the primary graphics layer. |
| 434 if (hasScrollingLayer() && m_backgroundPaintsOntoScrollingContentsLayer) { | 436 if (hasScrollingLayer() && m_backgroundPaintsOntoScrollingContentsLayer) { |
| 435 // Backgrounds painted onto the foreground are clipped by the padding box | 437 // Backgrounds painted onto the foreground are clipped by the padding box |
| 436 // rect. | 438 // rect. |
| 437 // TODO(flackr): This should actually check the entire overflow rect | 439 // TODO(flackr): This should actually check the entire overflow rect |
| 438 // within the scrolling contents layer but since we currently only trigger | 440 // within the scrolling contents layer but since we currently only trigger |
| 439 // this for solid color backgrounds the answer will be the same. | 441 // this for solid color backgrounds the answer will be the same. |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 layoutObject.node()->isFrameOwnerElement() && | 749 layoutObject.node()->isFrameOwnerElement() && |
| 748 toHTMLFrameOwnerElement(layoutObject.node())->contentFrame()) { | 750 toHTMLFrameOwnerElement(layoutObject.node())->contentFrame()) { |
| 749 Frame* frame = toHTMLFrameOwnerElement(layoutObject.node())->contentFrame(); | 751 Frame* frame = toHTMLFrameOwnerElement(layoutObject.node())->contentFrame(); |
| 750 if (frame->isRemoteFrame()) { | 752 if (frame->isRemoteFrame()) { |
| 751 WebLayer* layer = toRemoteFrame(frame)->webLayer(); | 753 WebLayer* layer = toRemoteFrame(frame)->webLayer(); |
| 752 m_graphicsLayer->setContentsToPlatformLayer(layer); | 754 m_graphicsLayer->setContentsToPlatformLayer(layer); |
| 753 } | 755 } |
| 754 } else if (layoutObject.isVideo()) { | 756 } else if (layoutObject.isVideo()) { |
| 755 HTMLMediaElement* mediaElement = toHTMLMediaElement(layoutObject.node()); | 757 HTMLMediaElement* mediaElement = toHTMLMediaElement(layoutObject.node()); |
| 756 m_graphicsLayer->setContentsToPlatformLayer(mediaElement->platformLayer()); | 758 m_graphicsLayer->setContentsToPlatformLayer(mediaElement->platformLayer()); |
| 757 } else if (isCanvasControlledByOffscreen(layoutObject)) { | 759 } else if (isPlaceholderCanvas(layoutObject)) { |
| 758 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject.node()); | 760 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject.node()); |
| 759 m_graphicsLayer->setContentsToPlatformLayer( | 761 m_graphicsLayer->setContentsToPlatformLayer( |
| 760 canvas->surfaceLayerBridge()->getWebLayer()); | 762 canvas->surfaceLayerBridge()->getWebLayer()); |
| 761 layerConfigChanged = true; | 763 layerConfigChanged = true; |
| 762 } else if (isAcceleratedCanvas(layoutObject)) { | 764 } else if (isAcceleratedCanvas(layoutObject)) { |
| 763 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject.node()); | 765 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject.node()); |
| 764 if (CanvasRenderingContext* context = canvas->renderingContext()) | 766 if (CanvasRenderingContext* context = canvas->renderingContext()) |
| 765 m_graphicsLayer->setContentsToPlatformLayer(context->platformLayer()); | 767 m_graphicsLayer->setContentsToPlatformLayer(context->platformLayer()); |
| 766 layerConfigChanged = true; | 768 layerConfigChanged = true; |
| 767 } | 769 } |
| (...skipping 2730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3498 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { | 3500 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { |
| 3499 name = "Decoration Layer"; | 3501 name = "Decoration Layer"; |
| 3500 } else { | 3502 } else { |
| 3501 ASSERT_NOT_REACHED(); | 3503 ASSERT_NOT_REACHED(); |
| 3502 } | 3504 } |
| 3503 | 3505 |
| 3504 return name; | 3506 return name; |
| 3505 } | 3507 } |
| 3506 | 3508 |
| 3507 } // namespace blink | 3509 } // namespace blink |
| OLD | NEW |