| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 return (!page) ? nullptr : page->scrollingCoordinator(); | 170 return (!page) ? nullptr : page->scrollingCoordinator(); |
| 171 } | 171 } |
| 172 | 172 |
| 173 CompositedLayerMapping::CompositedLayerMapping(PaintLayer& layer) | 173 CompositedLayerMapping::CompositedLayerMapping(PaintLayer& layer) |
| 174 : m_owningLayer(layer), | 174 : m_owningLayer(layer), |
| 175 m_contentOffsetInCompositingLayerDirty(false), | 175 m_contentOffsetInCompositingLayerDirty(false), |
| 176 m_pendingUpdateScope(GraphicsLayerUpdateNone), | 176 m_pendingUpdateScope(GraphicsLayerUpdateNone), |
| 177 m_isMainFrameLayoutViewLayer(false), | 177 m_isMainFrameLayoutViewLayer(false), |
| 178 m_backgroundLayerPaintsFixedRootBackground(false), | 178 m_backgroundLayerPaintsFixedRootBackground(false), |
| 179 m_scrollingContentsAreEmpty(false), | 179 m_scrollingContentsAreEmpty(false), |
| 180 m_backgroundPaintsOntoScrollingContentsLayer(false) { | 180 m_backgroundPaintsOntoScrollingContentsLayer(false), |
| 181 m_backgroundPaintsOntoGraphicsLayer(false) { |
| 181 if (layer.isRootLayer() && layoutObject()->frame()->isMainFrame()) | 182 if (layer.isRootLayer() && layoutObject()->frame()->isMainFrame()) |
| 182 m_isMainFrameLayoutViewLayer = true; | 183 m_isMainFrameLayoutViewLayer = true; |
| 183 | 184 |
| 184 createPrimaryGraphicsLayer(); | 185 createPrimaryGraphicsLayer(); |
| 185 } | 186 } |
| 186 | 187 |
| 187 CompositedLayerMapping::~CompositedLayerMapping() { | 188 CompositedLayerMapping::~CompositedLayerMapping() { |
| 188 // Hits in compositing/squashing/squash-onto-nephew.html. | 189 // Hits in compositing/squashing/squash-onto-nephew.html. |
| 189 DisableCompositingQueryAsserts disabler; | 190 DisableCompositingQueryAsserts disabler; |
| 190 | 191 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 ASSERT(m_owningLayer.stackingNode()->isStackingContext() || !isolate); | 356 ASSERT(m_owningLayer.stackingNode()->isStackingContext() || !isolate); |
| 356 | 357 |
| 357 m_graphicsLayer->setIsRootForIsolatedGroup(isolate); | 358 m_graphicsLayer->setIsRootForIsolatedGroup(isolate); |
| 358 } | 359 } |
| 359 | 360 |
| 360 void CompositedLayerMapping:: | 361 void CompositedLayerMapping:: |
| 361 updateBackgroundPaintsOntoScrollingContentsLayer() { | 362 updateBackgroundPaintsOntoScrollingContentsLayer() { |
| 362 // We can only paint the background onto the scrolling contents layer if | 363 // We can only paint the background onto the scrolling contents layer if |
| 363 // it would be visually correct and we are using composited scrolling meaning | 364 // it would be visually correct and we are using composited scrolling meaning |
| 364 // we have a scrolling contents layer to paint it into. | 365 // we have a scrolling contents layer to paint it into. |
| 366 BackgroundPaintLocation paintLocation = |
| 367 m_owningLayer.backgroundPaintLocation(); |
| 365 bool shouldPaintOntoScrollingContentsLayer = | 368 bool shouldPaintOntoScrollingContentsLayer = |
| 366 m_owningLayer.canPaintBackgroundOntoScrollingContentsLayer() && | 369 paintLocation & BackgroundPaintInScrollingContents && |
| 367 m_owningLayer.getScrollableArea()->usesCompositedScrolling(); | 370 m_owningLayer.getScrollableArea()->usesCompositedScrolling(); |
| 368 if (shouldPaintOntoScrollingContentsLayer != | 371 if (shouldPaintOntoScrollingContentsLayer != |
| 369 backgroundPaintsOntoScrollingContentsLayer()) { | 372 backgroundPaintsOntoScrollingContentsLayer()) { |
| 370 m_backgroundPaintsOntoScrollingContentsLayer = | 373 m_backgroundPaintsOntoScrollingContentsLayer = |
| 371 shouldPaintOntoScrollingContentsLayer; | 374 shouldPaintOntoScrollingContentsLayer; |
| 372 // If the background is no longer painted onto the scrolling contents layer | 375 // If the background is no longer painted onto the scrolling contents layer |
| 373 // the scrolling contents layer needs to be updated. If it is going to be | 376 // the scrolling contents layer needs to be updated. If it is going to be |
| 374 // painted onto the scrolling contents layer this update will be triggered | 377 // painted onto the scrolling contents layer this update will be triggered |
| 375 // by LayoutBoxModelObject::setBackingNeedsPaintInvalidationInRect | 378 // by LayoutBoxModelObject::setBackingNeedsPaintInvalidationInRect |
| 376 if (hasScrollingLayer() && !shouldPaintOntoScrollingContentsLayer) | 379 if (hasScrollingLayer() && !shouldPaintOntoScrollingContentsLayer) |
| 377 m_scrollingContentsLayer->setNeedsDisplay(); | 380 m_scrollingContentsLayer->setNeedsDisplay(); |
| 378 } | 381 } |
| 382 m_backgroundPaintsOntoGraphicsLayer = |
| 383 !m_backgroundPaintsOntoScrollingContentsLayer || |
| 384 paintLocation & BackgroundPaintInGraphicsLayer; |
| 379 } | 385 } |
| 380 | 386 |
| 381 void CompositedLayerMapping::updateContentsOpaque() { | 387 void CompositedLayerMapping::updateContentsOpaque() { |
| 382 if (isAcceleratedCanvas(layoutObject())) { | 388 if (isAcceleratedCanvas(layoutObject())) { |
| 383 // Determine whether the rendering context's external texture layer is | 389 // Determine whether the rendering context's external texture layer is |
| 384 // opaque. | 390 // opaque. |
| 385 CanvasRenderingContext* context = | 391 CanvasRenderingContext* context = |
| 386 toHTMLCanvasElement(layoutObject()->node())->renderingContext(); | 392 toHTMLCanvasElement(layoutObject()->node())->renderingContext(); |
| 387 if (!context->creationAttributes().alpha()) | 393 if (!context->creationAttributes().alpha()) |
| 388 m_graphicsLayer->setContentsOpaque(true); | 394 m_graphicsLayer->setContentsOpaque(true); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 402 if (hasScrollingLayer() && m_backgroundPaintsOntoScrollingContentsLayer) { | 408 if (hasScrollingLayer() && m_backgroundPaintsOntoScrollingContentsLayer) { |
| 403 // Backgrounds painted onto the foreground are clipped by the padding box | 409 // Backgrounds painted onto the foreground are clipped by the padding box |
| 404 // rect. | 410 // rect. |
| 405 // TODO(flackr): This should actually check the entire overflow rect | 411 // TODO(flackr): This should actually check the entire overflow rect |
| 406 // within the scrolling contents layer but since we currently only trigger | 412 // within the scrolling contents layer but since we currently only trigger |
| 407 // this for solid color backgrounds the answer will be the same. | 413 // this for solid color backgrounds the answer will be the same. |
| 408 m_scrollingContentsLayer->setContentsOpaque( | 414 m_scrollingContentsLayer->setContentsOpaque( |
| 409 m_owningLayer.backgroundIsKnownToBeOpaqueInRect( | 415 m_owningLayer.backgroundIsKnownToBeOpaqueInRect( |
| 410 toLayoutBox(layoutObject())->paddingBoxRect())); | 416 toLayoutBox(layoutObject())->paddingBoxRect())); |
| 411 | 417 |
| 412 // When we paint the background onto the scrolling contents layer we are | 418 if (m_owningLayer.backgroundPaintLocation() & |
| 413 // going to leave a hole in the m_graphicsLayer where the background is so | 419 BackgroundPaintInGraphicsLayer) { |
| 414 // it is not opaque. | 420 m_graphicsLayer->setContentsOpaque( |
| 415 m_graphicsLayer->setContentsOpaque(false); | 421 m_owningLayer.backgroundIsKnownToBeOpaqueInRect( |
| 422 compositedBounds())); |
| 423 } else { |
| 424 // If we only paint the background onto the scrolling contents layer we |
| 425 // are going to leave a hole in the m_graphicsLayer where the background |
| 426 // is so it is not opaque. |
| 427 m_graphicsLayer->setContentsOpaque(false); |
| 428 } |
| 416 } else { | 429 } else { |
| 417 if (hasScrollingLayer()) | 430 if (hasScrollingLayer()) |
| 418 m_scrollingContentsLayer->setContentsOpaque(false); | 431 m_scrollingContentsLayer->setContentsOpaque(false); |
| 419 m_graphicsLayer->setContentsOpaque( | 432 m_graphicsLayer->setContentsOpaque( |
| 420 m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds())); | 433 m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds())); |
| 421 } | 434 } |
| 422 } | 435 } |
| 423 } | 436 } |
| 424 | 437 |
| 425 void CompositedLayerMapping::updateCompositedBounds() { | 438 void CompositedLayerMapping::updateCompositedBounds() { |
| (...skipping 2636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3062 graphicsLayer == m_childClippingMaskLayer.get() || | 3075 graphicsLayer == m_childClippingMaskLayer.get() || |
| 3063 graphicsLayer == m_scrollingContentsLayer.get() || | 3076 graphicsLayer == m_scrollingContentsLayer.get() || |
| 3064 graphicsLayer == m_decorationOutlineLayer.get()) { | 3077 graphicsLayer == m_decorationOutlineLayer.get()) { |
| 3065 bool paintRootBackgroundOntoScrollingContentsLayer = | 3078 bool paintRootBackgroundOntoScrollingContentsLayer = |
| 3066 m_backgroundPaintsOntoScrollingContentsLayer; | 3079 m_backgroundPaintsOntoScrollingContentsLayer; |
| 3067 DCHECK(!paintRootBackgroundOntoScrollingContentsLayer || | 3080 DCHECK(!paintRootBackgroundOntoScrollingContentsLayer || |
| 3068 (!m_backgroundLayer && !m_foregroundLayer)); | 3081 (!m_backgroundLayer && !m_foregroundLayer)); |
| 3069 if (paintRootBackgroundOntoScrollingContentsLayer) { | 3082 if (paintRootBackgroundOntoScrollingContentsLayer) { |
| 3070 if (graphicsLayer == m_scrollingContentsLayer.get()) | 3083 if (graphicsLayer == m_scrollingContentsLayer.get()) |
| 3071 paintLayerFlags &= ~PaintLayerPaintingSkipRootBackground; | 3084 paintLayerFlags &= ~PaintLayerPaintingSkipRootBackground; |
| 3072 else | 3085 else if (!m_backgroundPaintsOntoGraphicsLayer) |
| 3073 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; | 3086 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; |
| 3074 } | 3087 } |
| 3075 GraphicsLayerPaintInfo paintInfo; | 3088 GraphicsLayerPaintInfo paintInfo; |
| 3076 paintInfo.paintLayer = &m_owningLayer; | 3089 paintInfo.paintLayer = &m_owningLayer; |
| 3077 paintInfo.compositedBounds = compositedBounds(); | 3090 paintInfo.compositedBounds = compositedBounds(); |
| 3078 paintInfo.offsetFromLayoutObject = graphicsLayer->offsetFromLayoutObject(); | 3091 paintInfo.offsetFromLayoutObject = graphicsLayer->offsetFromLayoutObject(); |
| 3079 adjustForCompositedScrolling(graphicsLayer, | 3092 adjustForCompositedScrolling(graphicsLayer, |
| 3080 paintInfo.offsetFromLayoutObject); | 3093 paintInfo.offsetFromLayoutObject); |
| 3081 | 3094 |
| 3082 // We have to use the same root as for hit testing, because both methods can | 3095 // We have to use the same root as for hit testing, because both methods can |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3345 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { | 3358 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { |
| 3346 name = "Decoration Layer"; | 3359 name = "Decoration Layer"; |
| 3347 } else { | 3360 } else { |
| 3348 ASSERT_NOT_REACHED(); | 3361 ASSERT_NOT_REACHED(); |
| 3349 } | 3362 } |
| 3350 | 3363 |
| 3351 return name; | 3364 return name; |
| 3352 } | 3365 } |
| 3353 | 3366 |
| 3354 } // namespace blink | 3367 } // namespace blink |
| OLD | NEW |