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

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

Issue 2068723002: Paint local attachment backgrounds into composited scrolling contents layer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add/update tests and simplify added code. Created 4 years, 4 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 return pixelSnappedIntRect(toLayoutBox(layoutObject)->contentBoxRect()); 91 return pixelSnappedIntRect(toLayoutBox(layoutObject)->contentBoxRect());
92 } 92 }
93 93
94 static IntRect backgroundRect(const LayoutObject* layoutObject) 94 static IntRect backgroundRect(const LayoutObject* layoutObject)
95 { 95 {
96 if (!layoutObject->isBox()) 96 if (!layoutObject->isBox())
97 return IntRect(); 97 return IntRect();
98 98
99 LayoutRect rect; 99 LayoutRect rect;
100 const LayoutBox* box = toLayoutBox(layoutObject); 100 const LayoutBox* box = toLayoutBox(layoutObject);
101 return pixelSnappedIntRect(box->backgroundClipRect()); 101 return pixelSnappedIntRect(box->backgroundRect(TranslucentBackgroundRect));
102 } 102 }
103 103
104 static inline bool isAcceleratedCanvas(const LayoutObject* layoutObject) 104 static inline bool isAcceleratedCanvas(const LayoutObject* layoutObject)
105 { 105 {
106 if (layoutObject->isCanvas()) { 106 if (layoutObject->isCanvas()) {
107 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject->node()); 107 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject->node());
108 if (CanvasRenderingContext* context = canvas->renderingContext()) 108 if (CanvasRenderingContext* context = canvas->renderingContext())
109 return context->isAccelerated(); 109 return context->isAccelerated();
110 } 110 }
111 return false; 111 return false;
(...skipping 2466 matching lines...) Expand 10 before | Expand all | Expand 10 after
2578 } 2578 }
2579 if (previousIndex == indexToClear && layerToRemove->groupedMapping() == this ) { 2579 if (previousIndex == indexToClear && layerToRemove->groupedMapping() == this ) {
2580 compositor()->paintInvalidationOnCompositingChange(layerToRemove); 2580 compositor()->paintInvalidationOnCompositingChange(layerToRemove);
2581 return true; 2581 return true;
2582 } 2582 }
2583 return false; 2583 return false;
2584 } 2584 }
2585 2585
2586 bool CompositedLayerMapping::shouldPaintBackgroundOntoScrollingContentsLayer() c onst 2586 bool CompositedLayerMapping::shouldPaintBackgroundOntoScrollingContentsLayer() c onst
2587 { 2587 {
2588 // TODO(flackr): Add support for painting locally attached background images . https://crbug.com/625882
2589 const FillLayer& backgroundLayer = m_owningLayer.layoutObject()->style()->ba ckgroundLayers();
2590 return !m_owningLayer.isRootLayer() 2588 return !m_owningLayer.isRootLayer()
2591 && m_owningLayer.scrollsOverflow() 2589 && m_owningLayer.scrollsOverflow()
2592 && !backgroundLayer.image() 2590 && m_owningLayer.layoutObject()->style()->hasEntirelyLocalBackground()
2593 && !backgroundLayer.next()
2594 && (backgroundLayer.attachment() == LocalBackgroundAttachment
2595 || backgroundLayer.clip() == PaddingFillBox)
2596 && !m_owningLayer.stackingNode()->hasNegativeZOrderList(); 2591 && !m_owningLayer.stackingNode()->hasNegativeZOrderList();
2597 } 2592 }
2598 2593
2599 bool CompositedLayerMapping::updateSquashingLayerAssignment(PaintLayer* squashed Layer, size_t nextSquashedLayerIndex) 2594 bool CompositedLayerMapping::updateSquashingLayerAssignment(PaintLayer* squashed Layer, size_t nextSquashedLayerIndex)
2600 { 2595 {
2601 GraphicsLayerPaintInfo paintInfo; 2596 GraphicsLayerPaintInfo paintInfo;
2602 paintInfo.paintLayer = squashedLayer; 2597 paintInfo.paintLayer = squashedLayer;
2603 // NOTE: composited bounds are updated elsewhere 2598 // NOTE: composited bounds are updated elsewhere
2604 // NOTE: offsetFromLayoutObject is updated elsewhere 2599 // NOTE: offsetFromLayoutObject is updated elsewhere
2605 2600
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
2709 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2704 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2710 name = "Scrolling Contents Layer"; 2705 name = "Scrolling Contents Layer";
2711 } else { 2706 } else {
2712 ASSERT_NOT_REACHED(); 2707 ASSERT_NOT_REACHED();
2713 } 2708 }
2714 2709
2715 return name; 2710 return name;
2716 } 2711 }
2717 2712
2718 } // namespace blink 2713 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698