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

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

Issue 2353623004: Only paint the background onto the scrolling contents layer if we have a scrolling contents layer. (Closed)
Patch Set: Use local background on test. Created 4 years, 2 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
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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 bool isolate = m_owningLayer.shouldIsolateCompositedDescendants(); 290 bool isolate = m_owningLayer.shouldIsolateCompositedDescendants();
291 291
292 // non stacking context layers should never isolate 292 // non stacking context layers should never isolate
293 ASSERT(m_owningLayer.stackingNode()->isStackingContext() || !isolate); 293 ASSERT(m_owningLayer.stackingNode()->isStackingContext() || !isolate);
294 294
295 m_graphicsLayer->setIsRootForIsolatedGroup(isolate); 295 m_graphicsLayer->setIsRootForIsolatedGroup(isolate);
296 } 296 }
297 297
298 void CompositedLayerMapping::updateBackgroundPaintsOntoScrollingContentsLayer() 298 void CompositedLayerMapping::updateBackgroundPaintsOntoScrollingContentsLayer()
299 { 299 {
300 bool shouldPaintOntoScrollingContentsLayer = shouldPaintBackgroundOntoScroll ingContentsLayer(); 300 // We can only paint the background onto the scrolling contents layer if
301 // it would be visually correct and we are using composited scrolling meanin g we
302 // have a scrolling contents layer to paint it into.
303 bool shouldPaintOntoScrollingContentsLayer =
304 canPaintBackgroundOntoScrollingContentsLayer()
305 && m_owningLayer.getScrollableArea()->usesCompositedScrolling();
301 if (shouldPaintOntoScrollingContentsLayer != backgroundPaintsOntoScrollingCo ntentsLayer()) { 306 if (shouldPaintOntoScrollingContentsLayer != backgroundPaintsOntoScrollingCo ntentsLayer()) {
302 m_backgroundPaintsOntoScrollingContentsLayer = shouldPaintOntoScrollingC ontentsLayer; 307 m_backgroundPaintsOntoScrollingContentsLayer = shouldPaintOntoScrollingC ontentsLayer;
303 // If the background is no longer painted onto the scrolling contents 308 // If the background is no longer painted onto the scrolling contents
304 // layer the scrolling contents layer needs to be updated. If it is 309 // layer the scrolling contents layer needs to be updated. If it is
305 // going to be painted onto the scrolling contents layer this update 310 // going to be painted onto the scrolling contents layer this update
306 // will be triggered by LayoutBoxModelObject::setBackingNeedsPaintInvali dationInRect 311 // will be triggered by LayoutBoxModelObject::setBackingNeedsPaintInvali dationInRect
307 if (hasScrollingLayer() && !shouldPaintOntoScrollingContentsLayer) 312 if (hasScrollingLayer() && !shouldPaintOntoScrollingContentsLayer)
308 m_scrollingContentsLayer->setNeedsDisplay(); 313 m_scrollingContentsLayer->setNeedsDisplay();
309 } 314 }
310 } 315 }
(...skipping 2269 matching lines...) Expand 10 before | Expand all | Expand 10 after
2580 if (m_squashedLayers[previousIndex].paintLayer == layerToRemove) 2585 if (m_squashedLayers[previousIndex].paintLayer == layerToRemove)
2581 break; 2586 break;
2582 } 2587 }
2583 if (previousIndex == indexToClear && layerToRemove->groupedMapping() == this ) { 2588 if (previousIndex == indexToClear && layerToRemove->groupedMapping() == this ) {
2584 compositor()->paintInvalidationOnCompositingChange(layerToRemove); 2589 compositor()->paintInvalidationOnCompositingChange(layerToRemove);
2585 return true; 2590 return true;
2586 } 2591 }
2587 return false; 2592 return false;
2588 } 2593 }
2589 2594
2590 bool CompositedLayerMapping::shouldPaintBackgroundOntoScrollingContentsLayer() c onst 2595 bool CompositedLayerMapping::canPaintBackgroundOntoScrollingContentsLayer() cons t
2591 { 2596 {
2592 // TODO(flackr): Add support for painting locally attached background images . https://crbug.com/625882 2597 // TODO(flackr): Add support for painting locally attached background images . https://crbug.com/625882
2593 const FillLayer& backgroundLayer = m_owningLayer.layoutObject()->style()->ba ckgroundLayers(); 2598 const FillLayer& backgroundLayer = m_owningLayer.layoutObject()->style()->ba ckgroundLayers();
2594 return !m_owningLayer.isRootLayer() 2599 return !m_owningLayer.isRootLayer()
2595 && m_owningLayer.scrollsOverflow() 2600 && m_owningLayer.scrollsOverflow()
2596 && !backgroundLayer.image() 2601 && !backgroundLayer.image()
2597 && !backgroundLayer.next() 2602 && !backgroundLayer.next()
2598 && (backgroundLayer.attachment() == LocalBackgroundAttachment 2603 && (backgroundLayer.attachment() == LocalBackgroundAttachment
2599 || backgroundLayer.clip() == PaddingFillBox) 2604 || backgroundLayer.clip() == PaddingFillBox)
2600 && !m_owningLayer.stackingNode()->hasNegativeZOrderList(); 2605 && !m_owningLayer.stackingNode()->hasNegativeZOrderList();
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2713 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2718 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2714 name = "Scrolling Contents Layer"; 2719 name = "Scrolling Contents Layer";
2715 } else { 2720 } else {
2716 ASSERT_NOT_REACHED(); 2721 ASSERT_NOT_REACHED();
2717 } 2722 }
2718 2723
2719 return name; 2724 return name;
2720 } 2725 }
2721 2726
2722 } // namespace blink 2727 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698