Chromium Code Reviews| 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 // For non-root layers, background is painted by the scrolling contents layer if all backgrounds |
| 313 m_graphicsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOp aqueInRect(compositedBounds())); | 313 // are background attachment local, otherwise background is painted by t he primary graphics layer. |
| 314 if (hasScrollingLayer() && m_owningLayer.shouldPaintBackgroundOntoScroll ingContentsLayer()) { | |
| 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 | |
| 317 // scrolling contents layer but since we currently only trigger this for solid | |
| 318 // color backgrounds the answer will be the same. | |
| 319 m_scrollingContentsLayer->setContentsOpaque(m_owningLayer.background IsKnownToBeOpaqueInRect(toLayoutBox(layoutObject())->paddingBoxRect())); | |
| 320 | |
| 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 | |
| 323 // not opaque. | |
| 324 m_graphicsLayer->setContentsOpaque(false); | |
| 325 } else { | |
| 326 m_graphicsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownTo BeOpaqueInRect(compositedBounds())); | |
| 327 } | |
| 314 } | 328 } |
| 315 } | 329 } |
| 316 | 330 |
| 317 void CompositedLayerMapping::updateCompositedBounds() | 331 void CompositedLayerMapping::updateCompositedBounds() |
| 318 { | 332 { |
| 319 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle: :InCompositingUpdate); | 333 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. | 334 // FIXME: if this is really needed for performance, it would be better to st ore it on Layer. |
| 321 m_compositedBounds = m_owningLayer.boundingBoxForCompositing(); | 335 m_compositedBounds = m_owningLayer.boundingBoxForCompositing(); |
| 322 m_contentOffsetInCompositingLayerDirty = true; | 336 m_contentOffsetInCompositingLayerDirty = true; |
| 323 } | 337 } |
| (...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2419 paintLayerFlags |= PaintLayerPaintingCompositingMaskPhase; | 2433 paintLayerFlags |= PaintLayerPaintingCompositingMaskPhase; |
| 2420 if (graphicsLayerPaintingPhase & GraphicsLayerPaintChildClippingMask) | 2434 if (graphicsLayerPaintingPhase & GraphicsLayerPaintChildClippingMask) |
| 2421 paintLayerFlags |= PaintLayerPaintingChildClippingMaskPhase; | 2435 paintLayerFlags |= PaintLayerPaintingChildClippingMaskPhase; |
| 2422 if (graphicsLayerPaintingPhase & GraphicsLayerPaintOverflowContents) | 2436 if (graphicsLayerPaintingPhase & GraphicsLayerPaintOverflowContents) |
| 2423 paintLayerFlags |= PaintLayerPaintingOverflowContents; | 2437 paintLayerFlags |= PaintLayerPaintingOverflowContents; |
| 2424 if (graphicsLayerPaintingPhase & GraphicsLayerPaintCompositedScroll) | 2438 if (graphicsLayerPaintingPhase & GraphicsLayerPaintCompositedScroll) |
| 2425 paintLayerFlags |= PaintLayerPaintingCompositingScrollingPhase; | 2439 paintLayerFlags |= PaintLayerPaintingCompositingScrollingPhase; |
| 2426 | 2440 |
| 2427 if (graphicsLayer == m_backgroundLayer.get()) | 2441 if (graphicsLayer == m_backgroundLayer.get()) |
| 2428 paintLayerFlags |= (PaintLayerPaintingRootBackgroundOnly | PaintLayerPai ntingCompositingForegroundPhase); // Need PaintLayerPaintingCompositingForegroun dPhase to walk child layers. | 2442 paintLayerFlags |= (PaintLayerPaintingRootBackgroundOnly | PaintLayerPai ntingCompositingForegroundPhase); // Need PaintLayerPaintingCompositingForegroun dPhase to walk child layers. |
| 2429 else if (compositor()->fixedRootBackgroundLayer()) | 2443 else if (compositor()->fixedRootBackgroundLayer() && m_owningLayer.isRootLay er()) |
| 2430 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; | 2444 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; |
| 2431 | 2445 |
| 2432 if (graphicsLayer == m_graphicsLayer.get() | 2446 if (graphicsLayer == m_graphicsLayer.get() |
| 2433 || graphicsLayer == m_foregroundLayer.get() | 2447 || graphicsLayer == m_foregroundLayer.get() |
| 2434 || graphicsLayer == m_backgroundLayer.get() | 2448 || graphicsLayer == m_backgroundLayer.get() |
| 2435 || graphicsLayer == m_maskLayer.get() | 2449 || graphicsLayer == m_maskLayer.get() |
| 2436 || graphicsLayer == m_childClippingMaskLayer.get() | 2450 || graphicsLayer == m_childClippingMaskLayer.get() |
| 2437 || graphicsLayer == m_scrollingContentsLayer.get()) { | 2451 || graphicsLayer == m_scrollingContentsLayer.get()) { |
| 2438 | 2452 |
| 2453 bool paintRootBackgroundIntoScrollingContentsLayer = m_owningLayer.shoul dPaintBackgroundOntoScrollingContentsLayer(); | |
|
chrishtr
2016/08/05 00:40:08
Add:
DCHECK(!paintRootBackgroundIntoScrollingCont
flackr
2016/08/08 18:01:30
Done.
| |
| 2454 bool shouldSkipRootBackground = paintRootBackgroundIntoScrollingContents Layer | |
| 2455 ? graphicsLayer != m_scrollingContentsLayer.get() | |
| 2456 : !(graphicsLayerPaintingPhase & GraphicsLayerPaintBackground); | |
| 2457 if (shouldSkipRootBackground) | |
| 2458 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; | |
| 2439 GraphicsLayerPaintInfo paintInfo; | 2459 GraphicsLayerPaintInfo paintInfo; |
| 2440 paintInfo.paintLayer = &m_owningLayer; | 2460 paintInfo.paintLayer = &m_owningLayer; |
| 2441 paintInfo.compositedBounds = compositedBounds(); | 2461 paintInfo.compositedBounds = compositedBounds(); |
| 2442 paintInfo.offsetFromLayoutObject = graphicsLayer->offsetFromLayoutObject (); | 2462 paintInfo.offsetFromLayoutObject = graphicsLayer->offsetFromLayoutObject (); |
| 2443 adjustForCompositedScrolling(graphicsLayer, paintInfo.offsetFromLayoutOb ject); | 2463 adjustForCompositedScrolling(graphicsLayer, paintInfo.offsetFromLayoutOb ject); |
| 2444 | 2464 |
| 2445 // We have to use the same root as for hit testing, because both methods can compute and cache clipRects. | 2465 // We have to use the same root as for hit testing, because both methods can compute and cache clipRects. |
| 2446 doPaintTask(paintInfo, *graphicsLayer, paintLayerFlags, context, interes tRect); | 2466 doPaintTask(paintInfo, *graphicsLayer, paintLayerFlags, context, interes tRect); |
| 2447 } else if (graphicsLayer == m_squashingLayer.get()) { | 2467 } else if (graphicsLayer == m_squashingLayer.get()) { |
| 2448 for (size_t i = 0; i < m_squashedLayers.size(); ++i) | 2468 for (size_t i = 0; i < m_squashedLayers.size(); ++i) |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2660 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2680 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
| 2661 name = "Scrolling Contents Layer"; | 2681 name = "Scrolling Contents Layer"; |
| 2662 } else { | 2682 } else { |
| 2663 ASSERT_NOT_REACHED(); | 2683 ASSERT_NOT_REACHED(); |
| 2664 } | 2684 } |
| 2665 | 2685 |
| 2666 return name; | 2686 return name; |
| 2667 } | 2687 } |
| 2668 | 2688 |
| 2669 } // namespace blink | 2689 } // namespace blink |
| OLD | NEW |