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

Side by Side Diff: Source/core/paint/DeprecatedPaintLayerPainter.cpp

Issue 1246173002: Throttle rendering pipeline for invisible iframes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Keep animation time consistent. Created 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/paint/DeprecatedPaintLayerPainter.h" 6 #include "core/paint/DeprecatedPaintLayerPainter.h"
7 7
8 #include "core/frame/Settings.h" 8 #include "core/frame/Settings.h"
9 #include "core/layout/ClipPathOperation.h" 9 #include "core/layout/ClipPathOperation.h"
10 #include "core/layout/LayoutBlock.h" 10 #include "core/layout/LayoutBlock.h"
11 #include "core/layout/LayoutFrame.h"
11 #include "core/layout/LayoutView.h" 12 #include "core/layout/LayoutView.h"
12 #include "core/layout/svg/LayoutSVGResourceClipper.h" 13 #include "core/layout/svg/LayoutSVGResourceClipper.h"
13 #include "core/page/Page.h" 14 #include "core/page/Page.h"
14 #include "core/paint/CompositingRecorder.h" 15 #include "core/paint/CompositingRecorder.h"
15 #include "core/paint/DeprecatedPaintLayer.h" 16 #include "core/paint/DeprecatedPaintLayer.h"
16 #include "core/paint/FilterPainter.h" 17 #include "core/paint/FilterPainter.h"
17 #include "core/paint/LayerClipRecorder.h" 18 #include "core/paint/LayerClipRecorder.h"
18 #include "core/paint/LayerFixedPositionRecorder.h" 19 #include "core/paint/LayerFixedPositionRecorder.h"
19 #include "core/paint/PaintInfo.h" 20 #include "core/paint/PaintInfo.h"
20 #include "core/paint/SVGClipPainter.h" 21 #include "core/paint/SVGClipPainter.h"
(...skipping 15 matching lines...) Expand all
36 { 37 {
37 // Avoid painting descendants of the root layer when stylesheets haven't loa ded. This eliminates FOUC. 38 // Avoid painting descendants of the root layer when stylesheets haven't loa ded. This eliminates FOUC.
38 // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document 39 // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document
39 // will do a full paintInvalidationForWholeLayoutObject(). 40 // will do a full paintInvalidationForWholeLayoutObject().
40 if (layer->layoutObject()->document().didLayoutWithPendingStylesheets() && ! layer->isRootLayer() && !layer->layoutObject()->isDocumentElement()) 41 if (layer->layoutObject()->document().didLayoutWithPendingStylesheets() && ! layer->isRootLayer() && !layer->layoutObject()->isDocumentElement())
41 return true; 42 return true;
42 43
43 return false; 44 return false;
44 } 45 }
45 46
47 static bool isThrottledFrameView(const LayoutObject* layoutObject)
48 {
49 if (!layoutObject->isFrame())
50 return false;
51 const LayoutFrame* frame = toLayoutFrame(layoutObject);
52 if (!frame->widget()->isFrameView())
53 return false;
54 const FrameView* frameView = toFrameView(frame->widget());
55 return frameView->shouldThrottleRenderingPipeline();
56 }
57
46 void DeprecatedPaintLayerPainter::paint(GraphicsContext* context, const LayoutRe ct& damageRect, const GlobalPaintFlags globalPaintFlags, LayoutObject* paintingR oot, PaintLayerFlags paintFlags) 58 void DeprecatedPaintLayerPainter::paint(GraphicsContext* context, const LayoutRe ct& damageRect, const GlobalPaintFlags globalPaintFlags, LayoutObject* paintingR oot, PaintLayerFlags paintFlags)
47 { 59 {
48 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl osingIntRect(damageRect)), globalPaintFlags, LayoutSize(), paintingRoot); 60 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl osingIntRect(damageRect)), globalPaintFlags, LayoutSize(), paintingRoot);
49 if (shouldPaintLayerInSoftwareMode(globalPaintFlags, paintFlags)) 61 if (shouldPaintLayerInSoftwareMode(globalPaintFlags, paintFlags))
50 paintLayer(context, paintingInfo, paintFlags); 62 paintLayer(context, paintingInfo, paintFlags);
51 } 63 }
52 64
53 static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paint Flags, const LayoutObject* layoutObject) 65 static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paint Flags, const LayoutObject* layoutObject)
54 { 66 {
55 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai ntLayerPaintingChildClippingMaskPhase && layoutObject->hasClipPath())) ? IgnoreO verflowClip : RespectOverflowClip; 67 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai ntLayerPaintingChildClippingMaskPhase && layoutObject->hasClipPath())) ? IgnoreO verflowClip : RespectOverflowClip;
(...skipping 17 matching lines...) Expand all
73 ASSERT(!m_paintLayer.needsRepaint()); 85 ASSERT(!m_paintLayer.needsRepaint());
74 return; 86 return;
75 } 87 }
76 88
77 bool needsRepaint = m_paintLayer.needsRepaint(); 89 bool needsRepaint = m_paintLayer.needsRepaint();
78 m_paintLayer.clearNeedsRepaint(); 90 m_paintLayer.clearNeedsRepaint();
79 91
80 if (shouldSuppressPaintingLayer(&m_paintLayer)) 92 if (shouldSuppressPaintingLayer(&m_paintLayer))
81 return; 93 return;
82 94
95 if (isThrottledFrameView(m_paintLayer.layoutObject()))
chrishtr 2015/09/04 17:32:04 Add TODO here and below about subsequence caching.
Sami 2015/09/07 17:27:17 Done.
96 return;
97
83 // If this layer is totally invisible then there is nothing to paint. 98 // If this layer is totally invisible then there is nothing to paint.
84 if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()- >hasBackdropFilter()) 99 if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()- >hasBackdropFilter())
85 return; 100 return;
86 101
87 if (!needsRepaint && SubsequenceRecorder::useCachedSubsequenceIfPossible(*co ntext, m_paintLayer)) 102 if (!needsRepaint && SubsequenceRecorder::useCachedSubsequenceIfPossible(*co ntext, m_paintLayer))
88 return; 103 return;
89 SubsequenceRecorder subsequenceRecorder(*context, m_paintLayer); 104 SubsequenceRecorder subsequenceRecorder(*context, m_paintLayer);
90 105
91 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) 106 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags()))
92 paintFlags |= PaintLayerHaveTransparency; 107 paintFlags |= PaintLayerHaveTransparency;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 // foreground phase. Since scrolled contents are moved by paint invalidation in this 211 // foreground phase. Since scrolled contents are moved by paint invalidation in this
197 // case, the outline won't get 'dragged along'. 212 // case, the outline won't get 'dragged along'.
198 bool shouldPaintOutline = isSelfPaintingLayer && !isPaintingOverlayScrollbar s 213 bool shouldPaintOutline = isSelfPaintingLayer && !isPaintingOverlayScrollbar s
199 && ((isPaintingScrollingContent && isPaintingCompositedBackground) 214 && ((isPaintingScrollingContent && isPaintingCompositedBackground)
200 || (!isPaintingScrollingContent && isPaintingCompositedForeground)); 215 || (!isPaintingScrollingContent && isPaintingCompositedForeground));
201 bool shouldPaintContent = m_paintLayer.hasVisibleContent() && isSelfPainting Layer && !isPaintingOverlayScrollbars; 216 bool shouldPaintContent = m_paintLayer.hasVisibleContent() && isSelfPainting Layer && !isPaintingOverlayScrollbars;
202 217
203 if (paintFlags & PaintLayerPaintingRootBackgroundOnly && !m_paintLayer.layou tObject()->isLayoutView() && !m_paintLayer.layoutObject()->isDocumentElement()) 218 if (paintFlags & PaintLayerPaintingRootBackgroundOnly && !m_paintLayer.layou tObject()->isLayoutView() && !m_paintLayer.layoutObject()->isDocumentElement())
204 return; 219 return;
205 220
221 if (isThrottledFrameView(m_paintLayer.layoutObject()))
222 return;
223
206 // Ensure our lists are up-to-date. 224 // Ensure our lists are up-to-date.
207 m_paintLayer.stackingNode()->updateLayerListsIfNeeded(); 225 m_paintLayer.stackingNode()->updateLayerListsIfNeeded();
208 226
209 LayoutPoint offsetFromRoot; 227 LayoutPoint offsetFromRoot;
210 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); 228 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot);
211 229
212 if (m_paintLayer.compositingState() == PaintsIntoOwnBacking) 230 if (m_paintLayer.compositingState() == PaintsIntoOwnBacking)
213 offsetFromRoot.move(m_paintLayer.subpixelAccumulation()); 231 offsetFromRoot.move(m_paintLayer.subpixelAccumulation());
214 else 232 else
215 offsetFromRoot.move(paintingInfo.subPixelAccumulation); 233 offsetFromRoot.move(paintingInfo.subPixelAccumulation);
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 if (!m_paintLayer.containsDirtyOverlayScrollbars()) 628 if (!m_paintLayer.containsDirtyOverlayScrollbars())
611 return; 629 return;
612 630
613 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot); 631 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot);
614 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); 632 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars);
615 633
616 m_paintLayer.setContainsDirtyOverlayScrollbars(false); 634 m_paintLayer.setContainsDirtyOverlayScrollbars(false);
617 } 635 }
618 636
619 } // namespace blink 637 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698