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