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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 if (!context->hasAlpha()) | 302 if (!context->hasAlpha()) |
303 m_graphicsLayer->setContentsOpaque(true); | 303 m_graphicsLayer->setContentsOpaque(true); |
304 else if (WebLayer* layer = context->platformLayer()) | 304 else if (WebLayer* layer = context->platformLayer()) |
305 m_graphicsLayer->setContentsOpaque(!Color(layer->backgroundColor()).
hasAlpha()); | 305 m_graphicsLayer->setContentsOpaque(!Color(layer->backgroundColor()).
hasAlpha()); |
306 else | 306 else |
307 m_graphicsLayer->setContentsOpaque(false); | 307 m_graphicsLayer->setContentsOpaque(false); |
308 } else if (m_backgroundLayer) { | 308 } else if (m_backgroundLayer) { |
309 m_graphicsLayer->setContentsOpaque(false); | 309 m_graphicsLayer->setContentsOpaque(false); |
310 m_backgroundLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBe
OpaqueInRect(compositedBounds())); | 310 m_backgroundLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBe
OpaqueInRect(compositedBounds())); |
311 } else { | 311 } else { |
312 // For non-root layers, background is always painted by the primary grap
hics layer. | 312 const bool backgroundOpaque = m_owningLayer.backgroundIsKnownToBeOpaqueI
nRect(compositedBounds()); |
313 m_graphicsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOp
aqueInRect(compositedBounds())); | 313 // Whether or not the background is painted into the primary graphics la
yer, it will be |
| 314 // entirely occluded by an opaque background. |
| 315 m_graphicsLayer->setContentsOpaque(backgroundOpaque); |
| 316 |
| 317 // For non-root layers, background is painted by the scrolling contents
layer if all backgrounds |
| 318 // are solid color or background attachment local, otherwise background
is painted by |
| 319 // the primary graphics layer. |
| 320 if (hasScrollingLayer() && m_owningLayer.shouldPaintBackgroundOntoForegr
ound()) |
| 321 m_scrollingContentsLayer->setContentsOpaque(backgroundOpaque); |
314 } | 322 } |
315 } | 323 } |
316 | 324 |
317 void CompositedLayerMapping::updateCompositedBounds() | 325 void CompositedLayerMapping::updateCompositedBounds() |
318 { | 326 { |
319 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle:
:InCompositingUpdate); | 327 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle:
:InCompositingUpdate); |
320 // FIXME: if this is really needed for performance, it would be better to st
ore it on Layer. | 328 // FIXME: if this is really needed for performance, it would be better to st
ore it on Layer. |
321 m_compositedBounds = m_owningLayer.boundingBoxForCompositing(); | 329 m_compositedBounds = m_owningLayer.boundingBoxForCompositing(); |
322 m_contentOffsetInCompositingLayerDirty = true; | 330 m_contentOffsetInCompositingLayerDirty = true; |
323 } | 331 } |
(...skipping 2336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2660 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2668 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
2661 name = "Scrolling Contents Layer"; | 2669 name = "Scrolling Contents Layer"; |
2662 } else { | 2670 } else { |
2663 ASSERT_NOT_REACHED(); | 2671 ASSERT_NOT_REACHED(); |
2664 } | 2672 } |
2665 | 2673 |
2666 return name; | 2674 return name; |
2667 } | 2675 } |
2668 | 2676 |
2669 } // namespace blink | 2677 } // namespace blink |
OLD | NEW |