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 isPlaceholderCanvas(const LayoutObject& layoutObject) { | |
xlai (Olivia)
2017/03/24 20:24:59
You don't need to add this function. There is "isC
| |
123 if (layoutObject.isCanvas()) { | |
124 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject.node()); | |
125 return canvas->surfaceLayerBridge(); | |
126 } | |
127 return false; | |
128 } | |
129 | |
122 static inline bool isCanvasControlledByOffscreen( | 130 static inline bool isCanvasControlledByOffscreen( |
123 const LayoutObject& layoutObject) { | 131 const LayoutObject& layoutObject) { |
124 if (layoutObject.isCanvas()) { | 132 if (layoutObject.isCanvas()) { |
125 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject.node()); | 133 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject.node()); |
126 if (canvas->surfaceLayerBridge()) | 134 if (canvas->surfaceLayerBridge()) |
127 return true; | 135 return true; |
128 } | 136 } |
129 return false; | 137 return false; |
130 } | 138 } |
131 | 139 |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
420 m_graphicsLayer->setContentsOpaque( | 428 m_graphicsLayer->setContentsOpaque( |
421 !Color(layer->backgroundColor()).hasAlpha()); | 429 !Color(layer->backgroundColor()).hasAlpha()); |
422 } | 430 } |
423 } else { | 431 } else { |
424 m_graphicsLayer->setContentsOpaque(false); | 432 m_graphicsLayer->setContentsOpaque(false); |
425 } | 433 } |
426 } else if (m_backgroundLayer) { | 434 } else if (m_backgroundLayer) { |
427 m_graphicsLayer->setContentsOpaque(false); | 435 m_graphicsLayer->setContentsOpaque(false); |
428 m_backgroundLayer->setContentsOpaque( | 436 m_backgroundLayer->setContentsOpaque( |
429 m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds())); | 437 m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds())); |
438 } else if (isPlaceholderCanvas(layoutObject())) { | |
439 // TODO(crbug.com/705019): Contents could be opaque, but that cannot be | |
440 // determined from the main thread. Or can it? | |
441 m_graphicsLayer->setContentsOpaque(false); | |
430 } else { | 442 } else { |
431 // For non-root layers, background is painted by the scrolling contents | 443 // For non-root layers, background is painted by the scrolling contents |
432 // layer if all backgrounds are background attachment local, otherwise | 444 // layer if all backgrounds are background attachment local, otherwise |
433 // background is painted by the primary graphics layer. | 445 // background is painted by the primary graphics layer. |
434 if (hasScrollingLayer() && m_backgroundPaintsOntoScrollingContentsLayer) { | 446 if (hasScrollingLayer() && m_backgroundPaintsOntoScrollingContentsLayer) { |
435 // Backgrounds painted onto the foreground are clipped by the padding box | 447 // Backgrounds painted onto the foreground are clipped by the padding box |
436 // rect. | 448 // rect. |
437 // TODO(flackr): This should actually check the entire overflow rect | 449 // TODO(flackr): This should actually check the entire overflow rect |
438 // within the scrolling contents layer but since we currently only trigger | 450 // within the scrolling contents layer but since we currently only trigger |
439 // this for solid color backgrounds the answer will be the same. | 451 // this for solid color backgrounds the answer will be the same. |
(...skipping 3058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3498 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { | 3510 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { |
3499 name = "Decoration Layer"; | 3511 name = "Decoration Layer"; |
3500 } else { | 3512 } else { |
3501 ASSERT_NOT_REACHED(); | 3513 ASSERT_NOT_REACHED(); |
3502 } | 3514 } |
3503 | 3515 |
3504 return name; | 3516 return name; |
3505 } | 3517 } |
3506 | 3518 |
3507 } // namespace blink | 3519 } // namespace blink |
OLD | NEW |