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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 painted by the scrolling contents
layer if all backgrounds | 312 // For non-root layers, background is painted by the scrolling contents
layer if all backgrounds |
313 // are background attachment local, otherwise background is painted by t
he primary graphics layer. | 313 // are background attachment local, otherwise background is painted by t
he primary graphics layer. |
314 if (hasScrollingLayer() && shouldPaintBackgroundOntoScrollingContentsLay
er()) { | 314 if (hasScrollingLayer() && m_owningLayer.shouldPaintBackgroundOntoScroll
ingContentsLayer()) { |
315 // Backgrounds painted onto the foreground are clipped by the paddin
g box rect. | 315 // Backgrounds painted onto the foreground are clipped by the paddin
g box rect. |
316 // TODO(flackr): This should actually check the entire overflow rect
within the | 316 // TODO(flackr): This should actually check the entire overflow rect
within the |
317 // scrolling contents layer but since we currently only trigger this
for solid | 317 // scrolling contents layer but since we currently only trigger this
for solid |
318 // color backgrounds the answer will be the same. | 318 // color backgrounds the answer will be the same. |
319 m_scrollingContentsLayer->setContentsOpaque(m_owningLayer.background
IsKnownToBeOpaqueInRect(toLayoutBox(layoutObject())->paddingBoxRect())); | 319 m_scrollingContentsLayer->setContentsOpaque(m_owningLayer.background
IsKnownToBeOpaqueInRect(toLayoutBox(layoutObject())->paddingBoxRect())); |
320 | 320 |
321 // When we paint the background onto the scrolling contents layer we
are going | 321 // When we paint the background onto the scrolling contents layer we
are going |
322 // to leave a hole in the m_graphicsLayer where the background is so
it is | 322 // to leave a hole in the m_graphicsLayer where the background is so
it is |
323 // not opaque. | 323 // not opaque. |
324 m_graphicsLayer->setContentsOpaque(false); | 324 m_graphicsLayer->setContentsOpaque(false); |
(...skipping 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2451 else if (compositor()->fixedRootBackgroundLayer() && m_owningLayer.isRootLay
er()) | 2451 else if (compositor()->fixedRootBackgroundLayer() && m_owningLayer.isRootLay
er()) |
2452 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; | 2452 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; |
2453 | 2453 |
2454 if (graphicsLayer == m_graphicsLayer.get() | 2454 if (graphicsLayer == m_graphicsLayer.get() |
2455 || graphicsLayer == m_foregroundLayer.get() | 2455 || graphicsLayer == m_foregroundLayer.get() |
2456 || graphicsLayer == m_backgroundLayer.get() | 2456 || graphicsLayer == m_backgroundLayer.get() |
2457 || graphicsLayer == m_maskLayer.get() | 2457 || graphicsLayer == m_maskLayer.get() |
2458 || graphicsLayer == m_childClippingMaskLayer.get() | 2458 || graphicsLayer == m_childClippingMaskLayer.get() |
2459 || graphicsLayer == m_scrollingContentsLayer.get()) { | 2459 || graphicsLayer == m_scrollingContentsLayer.get()) { |
2460 | 2460 |
2461 bool paintRootBackgroundOntoScrollingContentsLayer = shouldPaintBackgrou
ndOntoScrollingContentsLayer(); | 2461 bool paintRootBackgroundOntoScrollingContentsLayer = m_owningLayer.shoul
dPaintBackgroundOntoScrollingContentsLayer(); |
2462 DCHECK(!paintRootBackgroundOntoScrollingContentsLayer || (!m_backgroundL
ayer && !m_foregroundLayer)); | 2462 DCHECK(!paintRootBackgroundOntoScrollingContentsLayer || (!m_backgroundL
ayer && !m_foregroundLayer)); |
2463 if (paintRootBackgroundOntoScrollingContentsLayer) { | 2463 if (paintRootBackgroundOntoScrollingContentsLayer) { |
2464 if (graphicsLayer == m_scrollingContentsLayer.get()) | 2464 if (graphicsLayer == m_scrollingContentsLayer.get()) |
2465 paintLayerFlags &= ~PaintLayerPaintingSkipRootBackground; | 2465 paintLayerFlags &= ~PaintLayerPaintingSkipRootBackground; |
2466 else | 2466 else |
2467 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; | 2467 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; |
2468 } | 2468 } |
2469 GraphicsLayerPaintInfo paintInfo; | 2469 GraphicsLayerPaintInfo paintInfo; |
2470 paintInfo.paintLayer = &m_owningLayer; | 2470 paintInfo.paintLayer = &m_owningLayer; |
2471 paintInfo.compositedBounds = compositedBounds(); | 2471 paintInfo.compositedBounds = compositedBounds(); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2558 if (m_squashedLayers[previousIndex].paintLayer == layerToRemove) | 2558 if (m_squashedLayers[previousIndex].paintLayer == layerToRemove) |
2559 break; | 2559 break; |
2560 } | 2560 } |
2561 if (previousIndex == indexToClear && layerToRemove->groupedMapping() == this
) { | 2561 if (previousIndex == indexToClear && layerToRemove->groupedMapping() == this
) { |
2562 compositor()->paintInvalidationOnCompositingChange(layerToRemove); | 2562 compositor()->paintInvalidationOnCompositingChange(layerToRemove); |
2563 return true; | 2563 return true; |
2564 } | 2564 } |
2565 return false; | 2565 return false; |
2566 } | 2566 } |
2567 | 2567 |
2568 bool CompositedLayerMapping::shouldPaintBackgroundOntoScrollingContentsLayer() c
onst | |
2569 { | |
2570 // TODO(flackr): Add support for painting locally attached background images
. https://crbug.com/625882 | |
2571 const FillLayer& backgroundLayer = m_owningLayer.layoutObject()->style()->ba
ckgroundLayers(); | |
2572 return !m_owningLayer.isRootLayer() | |
2573 && m_owningLayer.scrollsOverflow() | |
2574 && !backgroundLayer.image() | |
2575 && !backgroundLayer.next() | |
2576 && (backgroundLayer.attachment() == LocalBackgroundAttachment | |
2577 || backgroundLayer.clip() == PaddingFillBox) | |
2578 && !m_owningLayer.stackingNode()->hasNegativeZOrderList(); | |
2579 } | |
2580 | |
2581 bool CompositedLayerMapping::updateSquashingLayerAssignment(PaintLayer* squashed
Layer, size_t nextSquashedLayerIndex) | 2568 bool CompositedLayerMapping::updateSquashingLayerAssignment(PaintLayer* squashed
Layer, size_t nextSquashedLayerIndex) |
2582 { | 2569 { |
2583 GraphicsLayerPaintInfo paintInfo; | 2570 GraphicsLayerPaintInfo paintInfo; |
2584 paintInfo.paintLayer = squashedLayer; | 2571 paintInfo.paintLayer = squashedLayer; |
2585 // NOTE: composited bounds are updated elsewhere | 2572 // NOTE: composited bounds are updated elsewhere |
2586 // NOTE: offsetFromLayoutObject is updated elsewhere | 2573 // NOTE: offsetFromLayoutObject is updated elsewhere |
2587 | 2574 |
2588 // Change tracking on squashing layers: at the first sign of something chang
ed, just invalidate the layer. | 2575 // Change tracking on squashing layers: at the first sign of something chang
ed, just invalidate the layer. |
2589 // FIXME: Perhaps we can find a tighter more clever mechanism later. | 2576 // FIXME: Perhaps we can find a tighter more clever mechanism later. |
2590 if (nextSquashedLayerIndex < m_squashedLayers.size()) { | 2577 if (nextSquashedLayerIndex < m_squashedLayers.size()) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2691 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2678 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
2692 name = "Scrolling Contents Layer"; | 2679 name = "Scrolling Contents Layer"; |
2693 } else { | 2680 } else { |
2694 ASSERT_NOT_REACHED(); | 2681 ASSERT_NOT_REACHED(); |
2695 } | 2682 } |
2696 | 2683 |
2697 return name; | 2684 return name; |
2698 } | 2685 } |
2699 | 2686 |
2700 } // namespace blink | 2687 } // namespace blink |
OLD | NEW |