Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 2266103002: Repaint when background switches painting from/to scrolling contents layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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)
Stephen Chennney 2016/08/22 19:16:04 You never set m_backgroundPaintsOntoScrollingConte
flackr 2016/08/22 19:33:25 Oops, thank you for catching this. I suspect the o
301 m_owningLayer.setNeedsRepaint();
302 }
303
296 void CompositedLayerMapping::updateContentsOpaque() 304 void CompositedLayerMapping::updateContentsOpaque()
297 { 305 {
298 ASSERT(m_isMainFrameLayoutViewLayer || !m_backgroundLayer);
299 if (isAcceleratedCanvas(layoutObject())) { 306 if (isAcceleratedCanvas(layoutObject())) {
300 // Determine whether the rendering context's external texture layer is o paque. 307 // Determine whether the rendering context's external texture layer is o paque.
301 CanvasRenderingContext* context = toHTMLCanvasElement(layoutObject()->no de())->renderingContext(); 308 CanvasRenderingContext* context = toHTMLCanvasElement(layoutObject()->no de())->renderingContext();
302 if (!context->hasAlpha()) 309 if (!context->hasAlpha())
303 m_graphicsLayer->setContentsOpaque(true); 310 m_graphicsLayer->setContentsOpaque(true);
304 else if (WebLayer* layer = context->platformLayer()) 311 else if (WebLayer* layer = context->platformLayer())
305 m_graphicsLayer->setContentsOpaque(!Color(layer->backgroundColor()). hasAlpha()); 312 m_graphicsLayer->setContentsOpaque(!Color(layer->backgroundColor()). hasAlpha());
306 else 313 else
307 m_graphicsLayer->setContentsOpaque(false); 314 m_graphicsLayer->setContentsOpaque(false);
308 } else if (m_backgroundLayer) { 315 } else if (m_backgroundLayer) {
309 m_graphicsLayer->setContentsOpaque(false); 316 m_graphicsLayer->setContentsOpaque(false);
310 m_backgroundLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBe OpaqueInRect(compositedBounds())); 317 m_backgroundLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBe OpaqueInRect(compositedBounds()));
311 } else { 318 } else {
312 // For non-root layers, background is painted by the scrolling contents layer if all backgrounds 319 // 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. 320 // are background attachment local, otherwise background is painted by t he primary graphics layer.
314 if (hasScrollingLayer() && shouldPaintBackgroundOntoScrollingContentsLay er()) { 321 if (hasScrollingLayer() && m_backgroundPaintsOntoScrollingContentsLayer) {
315 // Backgrounds painted onto the foreground are clipped by the paddin g box rect. 322 // 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 323 // 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 324 // scrolling contents layer but since we currently only trigger this for solid
318 // color backgrounds the answer will be the same. 325 // color backgrounds the answer will be the same.
319 m_scrollingContentsLayer->setContentsOpaque(m_owningLayer.background IsKnownToBeOpaqueInRect(toLayoutBox(layoutObject())->paddingBoxRect())); 326 m_scrollingContentsLayer->setContentsOpaque(m_owningLayer.background IsKnownToBeOpaqueInRect(toLayoutBox(layoutObject())->paddingBoxRect()));
320 327
321 // When we paint the background onto the scrolling contents layer we are going 328 // 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 329 // to leave a hole in the m_graphicsLayer where the background is so it is
323 // not opaque. 330 // not opaque.
324 m_graphicsLayer->setContentsOpaque(false); 331 m_graphicsLayer->setContentsOpaque(false);
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 768
762 if (m_owningLayer.getScrollableArea() && m_owningLayer.getScrollableArea()-> scrollsOverflow()) 769 if (m_owningLayer.getScrollableArea() && m_owningLayer.getScrollableArea()-> scrollsOverflow())
763 m_owningLayer.getScrollableArea()->positionOverflowControls(); 770 m_owningLayer.getScrollableArea()->positionOverflowControls();
764 771
765 updateLayerBlendMode(layoutObject()->styleRef()); 772 updateLayerBlendMode(layoutObject()->styleRef());
766 updateIsRootForIsolatedGroup(); 773 updateIsRootForIsolatedGroup();
767 updateContentsRect(); 774 updateContentsRect();
768 updateBackgroundColor(); 775 updateBackgroundColor();
769 updateDrawsContent(); 776 updateDrawsContent();
770 updateElementIdAndCompositorMutableProperties(); 777 updateElementIdAndCompositorMutableProperties();
778 updateBackgroundPaintingLayer();
771 updateContentsOpaque(); 779 updateContentsOpaque();
772 updateAfterPartResize(); 780 updateAfterPartResize();
773 updateRenderingContext(); 781 updateRenderingContext();
774 updateShouldFlattenTransform(); 782 updateShouldFlattenTransform();
775 updateChildrenTransform(); 783 updateChildrenTransform();
776 updateScrollParent(scrollParent()); 784 updateScrollParent(scrollParent());
777 registerScrollingLayers(); 785 registerScrollingLayers();
778 786
779 updateCompositingReasons(); 787 updateCompositingReasons();
780 } 788 }
(...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after
2453 else if (compositor()->fixedRootBackgroundLayer() && m_owningLayer.isRootLay er()) 2461 else if (compositor()->fixedRootBackgroundLayer() && m_owningLayer.isRootLay er())
2454 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; 2462 paintLayerFlags |= PaintLayerPaintingSkipRootBackground;
2455 2463
2456 if (graphicsLayer == m_graphicsLayer.get() 2464 if (graphicsLayer == m_graphicsLayer.get()
2457 || graphicsLayer == m_foregroundLayer.get() 2465 || graphicsLayer == m_foregroundLayer.get()
2458 || graphicsLayer == m_backgroundLayer.get() 2466 || graphicsLayer == m_backgroundLayer.get()
2459 || graphicsLayer == m_maskLayer.get() 2467 || graphicsLayer == m_maskLayer.get()
2460 || graphicsLayer == m_childClippingMaskLayer.get() 2468 || graphicsLayer == m_childClippingMaskLayer.get()
2461 || graphicsLayer == m_scrollingContentsLayer.get()) { 2469 || graphicsLayer == m_scrollingContentsLayer.get()) {
2462 2470
2463 bool paintRootBackgroundOntoScrollingContentsLayer = shouldPaintBackgrou ndOntoScrollingContentsLayer(); 2471 bool paintRootBackgroundOntoScrollingContentsLayer = m_backgroundPaintsO ntoScrollingContentsLayer;
2464 DCHECK(!paintRootBackgroundOntoScrollingContentsLayer || (!m_backgroundL ayer && !m_foregroundLayer)); 2472 DCHECK(!paintRootBackgroundOntoScrollingContentsLayer || (!m_backgroundL ayer && !m_foregroundLayer));
2465 if (paintRootBackgroundOntoScrollingContentsLayer) { 2473 if (paintRootBackgroundOntoScrollingContentsLayer) {
2466 if (graphicsLayer == m_scrollingContentsLayer.get()) 2474 if (graphicsLayer == m_scrollingContentsLayer.get())
2467 paintLayerFlags &= ~PaintLayerPaintingSkipRootBackground; 2475 paintLayerFlags &= ~PaintLayerPaintingSkipRootBackground;
2468 else 2476 else
2469 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; 2477 paintLayerFlags |= PaintLayerPaintingSkipRootBackground;
2470 } 2478 }
2471 GraphicsLayerPaintInfo paintInfo; 2479 GraphicsLayerPaintInfo paintInfo;
2472 paintInfo.paintLayer = &m_owningLayer; 2480 paintInfo.paintLayer = &m_owningLayer;
2473 paintInfo.compositedBounds = compositedBounds(); 2481 paintInfo.compositedBounds = compositedBounds();
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2693 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2701 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2694 name = "Scrolling Contents Layer"; 2702 name = "Scrolling Contents Layer";
2695 } else { 2703 } else {
2696 ASSERT_NOT_REACHED(); 2704 ASSERT_NOT_REACHED();
2697 } 2705 }
2698 2706
2699 return name; 2707 return name;
2700 } 2708 }
2701 2709
2702 } // namespace blink 2710 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698