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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
167 return (!page) ? nullptr : page->scrollingCoordinator(); | 167 return (!page) ? nullptr : page->scrollingCoordinator(); |
168 } | 168 } |
169 | 169 |
170 CompositedLayerMapping::CompositedLayerMapping(PaintLayer& layer) | 170 CompositedLayerMapping::CompositedLayerMapping(PaintLayer& layer) |
171 : m_owningLayer(layer) | 171 : m_owningLayer(layer) |
172 , m_contentOffsetInCompositingLayerDirty(false) | 172 , m_contentOffsetInCompositingLayerDirty(false) |
173 , m_pendingUpdateScope(GraphicsLayerUpdateNone) | 173 , m_pendingUpdateScope(GraphicsLayerUpdateNone) |
174 , m_isMainFrameLayoutViewLayer(false) | 174 , m_isMainFrameLayoutViewLayer(false) |
175 , m_backgroundLayerPaintsFixedRootBackground(false) | 175 , m_backgroundLayerPaintsFixedRootBackground(false) |
176 , m_scrollingContentsAreEmpty(false) | 176 , m_scrollingContentsAreEmpty(false) |
177 , m_backgroundPaintsOntoScrollingContentsLayer(false) | |
177 { | 178 { |
178 if (layer.isRootLayer() && layoutObject()->frame()->isMainFrame()) | 179 if (layer.isRootLayer() && layoutObject()->frame()->isMainFrame()) |
179 m_isMainFrameLayoutViewLayer = true; | 180 m_isMainFrameLayoutViewLayer = true; |
180 | 181 |
181 createPrimaryGraphicsLayer(); | 182 createPrimaryGraphicsLayer(); |
182 } | 183 } |
183 | 184 |
184 CompositedLayerMapping::~CompositedLayerMapping() | 185 CompositedLayerMapping::~CompositedLayerMapping() |
185 { | 186 { |
186 // Hits in compositing/squashing/squash-onto-nephew.html. | 187 // Hits in compositing/squashing/squash-onto-nephew.html. |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
287 void CompositedLayerMapping::updateIsRootForIsolatedGroup() | 288 void CompositedLayerMapping::updateIsRootForIsolatedGroup() |
288 { | 289 { |
289 bool isolate = m_owningLayer.shouldIsolateCompositedDescendants(); | 290 bool isolate = m_owningLayer.shouldIsolateCompositedDescendants(); |
290 | 291 |
291 // non stacking context layers should never isolate | 292 // non stacking context layers should never isolate |
292 ASSERT(m_owningLayer.stackingNode()->isStackingContext() || !isolate); | 293 ASSERT(m_owningLayer.stackingNode()->isStackingContext() || !isolate); |
293 | 294 |
294 m_graphicsLayer->setIsRootForIsolatedGroup(isolate); | 295 m_graphicsLayer->setIsRootForIsolatedGroup(isolate); |
295 } | 296 } |
296 | 297 |
298 void CompositedLayerMapping::updateBackgroundPaintingLayer() | |
chrishtr
2016/08/24 23:35:32
updateBackgroundPaintsOntoScrollingContentsLayer
flackr
2016/08/25 15:21:52
Done.
| |
299 { | |
300 bool backgroundLayerPaintsOntoScrollingContentsLayer = shouldPaintBackground OntoScrollingContentsLayer(); | |
301 if (backgroundLayerPaintsOntoScrollingContentsLayer != m_backgroundPaintsOnt oScrollingContentsLayer) { | |
302 m_backgroundPaintsOntoScrollingContentsLayer = backgroundLayerPaintsOnto ScrollingContentsLayer; | |
303 // If the background is no longer painted onto the scrolling contents | |
304 // layer the scrolling contents layer needs to be updated. If it is | |
305 // going to be painted onto the scrolling contents layer this update | |
306 // will be triggered by LayoutBoxModelObject::setBackingNeedsPaintInvali dationInRect | |
307 if (hasScrollingLayer() && !backgroundLayerPaintsOntoScrollingContentsLa yer) { | |
308 m_scrollingContentsLayer->setNeedsDisplay(); | |
309 m_owningLayer.setNeedsRepaint(); | |
310 } | |
311 } | |
312 } | |
313 | |
297 void CompositedLayerMapping::updateContentsOpaque() | 314 void CompositedLayerMapping::updateContentsOpaque() |
298 { | 315 { |
299 ASSERT(m_isMainFrameLayoutViewLayer || !m_backgroundLayer); | |
300 if (isAcceleratedCanvas(layoutObject())) { | 316 if (isAcceleratedCanvas(layoutObject())) { |
301 // Determine whether the rendering context's external texture layer is o paque. | 317 // Determine whether the rendering context's external texture layer is o paque. |
302 CanvasRenderingContext* context = toHTMLCanvasElement(layoutObject()->no de())->renderingContext(); | 318 CanvasRenderingContext* context = toHTMLCanvasElement(layoutObject()->no de())->renderingContext(); |
303 if (!context->hasAlpha()) | 319 if (!context->hasAlpha()) |
304 m_graphicsLayer->setContentsOpaque(true); | 320 m_graphicsLayer->setContentsOpaque(true); |
305 else if (WebLayer* layer = context->platformLayer()) | 321 else if (WebLayer* layer = context->platformLayer()) |
306 m_graphicsLayer->setContentsOpaque(!Color(layer->backgroundColor()). hasAlpha()); | 322 m_graphicsLayer->setContentsOpaque(!Color(layer->backgroundColor()). hasAlpha()); |
307 else | 323 else |
308 m_graphicsLayer->setContentsOpaque(false); | 324 m_graphicsLayer->setContentsOpaque(false); |
309 } else if (m_backgroundLayer) { | 325 } else if (m_backgroundLayer) { |
310 m_graphicsLayer->setContentsOpaque(false); | 326 m_graphicsLayer->setContentsOpaque(false); |
311 m_backgroundLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBe OpaqueInRect(compositedBounds())); | 327 m_backgroundLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBe OpaqueInRect(compositedBounds())); |
312 } else { | 328 } else { |
313 // For non-root layers, background is painted by the scrolling contents layer if all backgrounds | 329 // For non-root layers, background is painted by the scrolling contents layer if all backgrounds |
314 // are background attachment local, otherwise background is painted by t he primary graphics layer. | 330 // are background attachment local, otherwise background is painted by t he primary graphics layer. |
315 if (hasScrollingLayer() && shouldPaintBackgroundOntoScrollingContentsLay er()) { | 331 if (hasScrollingLayer() && m_backgroundPaintsOntoScrollingContentsLayer) { |
316 // Backgrounds painted onto the foreground are clipped by the paddin g box rect. | 332 // Backgrounds painted onto the foreground are clipped by the paddin g box rect. |
317 // TODO(flackr): This should actually check the entire overflow rect within the | 333 // TODO(flackr): This should actually check the entire overflow rect within the |
318 // scrolling contents layer but since we currently only trigger this for solid | 334 // scrolling contents layer but since we currently only trigger this for solid |
319 // color backgrounds the answer will be the same. | 335 // color backgrounds the answer will be the same. |
320 m_scrollingContentsLayer->setContentsOpaque(m_owningLayer.background IsKnownToBeOpaqueInRect(toLayoutBox(layoutObject())->paddingBoxRect())); | 336 m_scrollingContentsLayer->setContentsOpaque(m_owningLayer.background IsKnownToBeOpaqueInRect(toLayoutBox(layoutObject())->paddingBoxRect())); |
321 | 337 |
322 // When we paint the background onto the scrolling contents layer we are going | 338 // When we paint the background onto the scrolling contents layer we are going |
323 // to leave a hole in the m_graphicsLayer where the background is so it is | 339 // to leave a hole in the m_graphicsLayer where the background is so it is |
324 // not opaque. | 340 // not opaque. |
325 m_graphicsLayer->setContentsOpaque(false); | 341 m_graphicsLayer->setContentsOpaque(false); |
326 } else { | 342 } else { |
343 if (hasScrollingLayer()) | |
344 m_scrollingContentsLayer->setContentsOpaque(false); | |
chrishtr
2016/08/24 23:35:32
Is this technically an unrelated fix?
Is it teste
flackr
2016/08/25 15:21:52
No, this is necessary to remove contents opaque fl
| |
327 m_graphicsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownTo BeOpaqueInRect(compositedBounds())); | 345 m_graphicsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownTo BeOpaqueInRect(compositedBounds())); |
328 } | 346 } |
329 } | 347 } |
330 } | 348 } |
331 | 349 |
332 void CompositedLayerMapping::updateCompositedBounds() | 350 void CompositedLayerMapping::updateCompositedBounds() |
333 { | 351 { |
334 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle: :InCompositingUpdate); | 352 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle: :InCompositingUpdate); |
335 // FIXME: if this is really needed for performance, it would be better to st ore it on Layer. | 353 // FIXME: if this is really needed for performance, it would be better to st ore it on Layer. |
336 m_compositedBounds = m_owningLayer.boundingBoxForCompositing(); | 354 m_compositedBounds = m_owningLayer.boundingBoxForCompositing(); |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
762 | 780 |
763 if (m_owningLayer.getScrollableArea() && m_owningLayer.getScrollableArea()-> scrollsOverflow()) | 781 if (m_owningLayer.getScrollableArea() && m_owningLayer.getScrollableArea()-> scrollsOverflow()) |
764 m_owningLayer.getScrollableArea()->positionOverflowControls(); | 782 m_owningLayer.getScrollableArea()->positionOverflowControls(); |
765 | 783 |
766 updateLayerBlendMode(layoutObject()->styleRef()); | 784 updateLayerBlendMode(layoutObject()->styleRef()); |
767 updateIsRootForIsolatedGroup(); | 785 updateIsRootForIsolatedGroup(); |
768 updateContentsRect(); | 786 updateContentsRect(); |
769 updateBackgroundColor(); | 787 updateBackgroundColor(); |
770 updateDrawsContent(); | 788 updateDrawsContent(); |
771 updateElementIdAndCompositorMutableProperties(); | 789 updateElementIdAndCompositorMutableProperties(); |
790 updateBackgroundPaintingLayer(); | |
772 updateContentsOpaque(); | 791 updateContentsOpaque(); |
773 updateAfterPartResize(); | 792 updateAfterPartResize(); |
774 updateRenderingContext(); | 793 updateRenderingContext(); |
775 updateShouldFlattenTransform(); | 794 updateShouldFlattenTransform(); |
776 updateChildrenTransform(); | 795 updateChildrenTransform(); |
777 updateScrollParent(scrollParent()); | 796 updateScrollParent(scrollParent()); |
778 registerScrollingLayers(); | 797 registerScrollingLayers(); |
779 | 798 |
780 updateCompositingReasons(); | 799 updateCompositingReasons(); |
781 } | 800 } |
(...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2454 else if (compositor()->fixedRootBackgroundLayer() && m_owningLayer.isRootLay er()) | 2473 else if (compositor()->fixedRootBackgroundLayer() && m_owningLayer.isRootLay er()) |
2455 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; | 2474 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; |
2456 | 2475 |
2457 if (graphicsLayer == m_graphicsLayer.get() | 2476 if (graphicsLayer == m_graphicsLayer.get() |
2458 || graphicsLayer == m_foregroundLayer.get() | 2477 || graphicsLayer == m_foregroundLayer.get() |
2459 || graphicsLayer == m_backgroundLayer.get() | 2478 || graphicsLayer == m_backgroundLayer.get() |
2460 || graphicsLayer == m_maskLayer.get() | 2479 || graphicsLayer == m_maskLayer.get() |
2461 || graphicsLayer == m_childClippingMaskLayer.get() | 2480 || graphicsLayer == m_childClippingMaskLayer.get() |
2462 || graphicsLayer == m_scrollingContentsLayer.get()) { | 2481 || graphicsLayer == m_scrollingContentsLayer.get()) { |
2463 | 2482 |
2464 bool paintRootBackgroundOntoScrollingContentsLayer = shouldPaintBackgrou ndOntoScrollingContentsLayer(); | 2483 bool paintRootBackgroundOntoScrollingContentsLayer = m_backgroundPaintsO ntoScrollingContentsLayer; |
2465 DCHECK(!paintRootBackgroundOntoScrollingContentsLayer || (!m_backgroundL ayer && !m_foregroundLayer)); | 2484 DCHECK(!paintRootBackgroundOntoScrollingContentsLayer || (!m_backgroundL ayer && !m_foregroundLayer)); |
2466 if (paintRootBackgroundOntoScrollingContentsLayer) { | 2485 if (paintRootBackgroundOntoScrollingContentsLayer) { |
2467 if (graphicsLayer == m_scrollingContentsLayer.get()) | 2486 if (graphicsLayer == m_scrollingContentsLayer.get()) |
2468 paintLayerFlags &= ~PaintLayerPaintingSkipRootBackground; | 2487 paintLayerFlags &= ~PaintLayerPaintingSkipRootBackground; |
2469 else | 2488 else |
2470 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; | 2489 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; |
2471 } | 2490 } |
2472 GraphicsLayerPaintInfo paintInfo; | 2491 GraphicsLayerPaintInfo paintInfo; |
2473 paintInfo.paintLayer = &m_owningLayer; | 2492 paintInfo.paintLayer = &m_owningLayer; |
2474 paintInfo.compositedBounds = compositedBounds(); | 2493 paintInfo.compositedBounds = compositedBounds(); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2694 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2713 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
2695 name = "Scrolling Contents Layer"; | 2714 name = "Scrolling Contents Layer"; |
2696 } else { | 2715 } else { |
2697 ASSERT_NOT_REACHED(); | 2716 ASSERT_NOT_REACHED(); |
2698 } | 2717 } |
2699 | 2718 |
2700 return name; | 2719 return name; |
2701 } | 2720 } |
2702 | 2721 |
2703 } // namespace blink | 2722 } // namespace blink |
OLD | NEW |