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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp

Issue 1833043007: Disable subsequence caching when didLayoutWithPendingStylesheets is true. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2623
Patch Set: Created 4 years, 8 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 | « no previous file | third_party/WebKit/Source/web/tests/DocumentLoadingRenderingTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "core/paint/PaintLayerPainter.h" 5 #include "core/paint/PaintLayerPainter.h"
6 6
7 #include "core/frame/Settings.h" 7 #include "core/frame/Settings.h"
8 #include "core/layout/ClipPathOperation.h" 8 #include "core/layout/ClipPathOperation.h"
9 #include "core/layout/LayoutBlock.h" 9 #include "core/layout/LayoutBlock.h"
10 #include "core/layout/LayoutFrame.h" 10 #include "core/layout/LayoutFrame.h"
(...skipping 18 matching lines...) Expand all
29 #include "platform/graphics/paint/ClipRecorder.h" 29 #include "platform/graphics/paint/ClipRecorder.h"
30 #include "platform/graphics/paint/CompositingRecorder.h" 30 #include "platform/graphics/paint/CompositingRecorder.h"
31 #include "platform/graphics/paint/PaintChunkProperties.h" 31 #include "platform/graphics/paint/PaintChunkProperties.h"
32 #include "platform/graphics/paint/ScopedPaintChunkProperties.h" 32 #include "platform/graphics/paint/ScopedPaintChunkProperties.h"
33 #include "platform/graphics/paint/SubsequenceRecorder.h" 33 #include "platform/graphics/paint/SubsequenceRecorder.h"
34 #include "platform/graphics/paint/Transform3DDisplayItem.h" 34 #include "platform/graphics/paint/Transform3DDisplayItem.h"
35 #include "wtf/Optional.h" 35 #include "wtf/Optional.h"
36 36
37 namespace blink { 37 namespace blink {
38 38
39 static inline bool shouldSuppressPaintingLayer(PaintLayer* layer) 39 static inline bool shouldSuppressPaintingLayer(const PaintLayer& layer)
40 { 40 {
41 // Avoid painting descendants of the root layer when stylesheets haven't loa ded. This eliminates FOUC. 41 // Avoid painting descendants of the root layer when stylesheets haven't loa ded. This eliminates FOUC.
42 // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document 42 // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document
43 // will do a full paintInvalidationForWholeLayoutObject(). 43 // will do a full paintInvalidationForWholeLayoutObject().
44 if (layer->layoutObject()->document().didLayoutWithPendingStylesheets() && ! layer->isRootLayer() && !layer->layoutObject()->isDocumentElement()) 44 if (layer.layoutObject()->document().didLayoutWithPendingStylesheets() && !l ayer.isRootLayer() && !layer.layoutObject()->isDocumentElement())
45 return true; 45 return true;
46 46
47 return false; 47 return false;
48 } 48 }
49 49
50 void PaintLayerPainter::paint(GraphicsContext& context, const LayoutRect& damage Rect, const GlobalPaintFlags globalPaintFlags, LayoutObject* paintingRoot, Paint LayerFlags paintFlags) 50 void PaintLayerPainter::paint(GraphicsContext& context, const LayoutRect& damage Rect, const GlobalPaintFlags globalPaintFlags, LayoutObject* paintingRoot, Paint LayerFlags paintFlags)
51 { 51 {
52 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), globalPaintFlags, LayoutSize(), paintingRoot); 52 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), globalPaintFlags, LayoutSize(), paintingRoot);
53 if (shouldPaintLayerInSoftwareMode(globalPaintFlags, paintFlags)) 53 if (shouldPaintLayerInSoftwareMode(globalPaintFlags, paintFlags))
54 paintLayer(context, paintingInfo, paintFlags); 54 paintLayer(context, paintingInfo, paintFlags);
(...skipping 15 matching lines...) Expand all
70 // FIXME: why isn't the code here global, as opposed to being set on each paintLayer() call? 70 // FIXME: why isn't the code here global, as opposed to being set on each paintLayer() call?
71 paintFlags |= PaintLayerUncachedClipRects; 71 paintFlags |= PaintLayerUncachedClipRects;
72 } 72 }
73 } 73 }
74 74
75 // Non self-painting layers without self-painting descendants don't need to be painted as their 75 // Non self-painting layers without self-painting descendants don't need to be painted as their
76 // layoutObject() should properly paint itself. 76 // layoutObject() should properly paint itself.
77 if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLaye rDescendant()) 77 if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLaye rDescendant())
78 return FullyPainted; 78 return FullyPainted;
79 79
80 if (shouldSuppressPaintingLayer(&m_paintLayer)) 80 if (shouldSuppressPaintingLayer(m_paintLayer))
81 return FullyPainted; 81 return FullyPainted;
82 82
83 // TODO(skyostil): Unify this early-out logic with subsequence caching. 83 // TODO(skyostil): Unify this early-out logic with subsequence caching.
84 if (m_paintLayer.layoutObject()->isLayoutPart() && toLayoutPart(m_paintLayer .layoutObject())->isThrottledFrameView()) 84 if (m_paintLayer.layoutObject()->isLayoutPart() && toLayoutPart(m_paintLayer .layoutObject())->isThrottledFrameView())
85 return FullyPainted; 85 return FullyPainted;
86 86
87 // If this layer is totally invisible then there is nothing to paint. 87 // If this layer is totally invisible then there is nothing to paint.
88 if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()- >hasBackdropFilter()) 88 if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()- >hasBackdropFilter())
89 return FullyPainted; 89 return FullyPainted;
90 90
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 return false; 204 return false;
205 205
206 // Create subsequence for only stacking contexts whose painting are atomic. 206 // Create subsequence for only stacking contexts whose painting are atomic.
207 if (!paintLayer.stackingNode()->isStackingContext()) 207 if (!paintLayer.stackingNode()->isStackingContext())
208 return false; 208 return false;
209 209
210 // The layer doesn't have children. Subsequence caching is not worth because normally the actual painting will be cheap. 210 // The layer doesn't have children. Subsequence caching is not worth because normally the actual painting will be cheap.
211 if (!PaintLayerStackingNodeIterator(*paintLayer.stackingNode(), AllChildren) .next()) 211 if (!PaintLayerStackingNodeIterator(*paintLayer.stackingNode(), AllChildren) .next())
212 return false; 212 return false;
213 213
214 // When in FOUC-avoidance mode, don't cache any subsequences, to avoid havin g
215 // to invalidate all of them when leaving this mode. There is an early-out i n BlockPainter::paintContents that may result
216 // in nothing getting painted in thos mode, in addition to early-out logic i n PaintLayerPainter.
217 if (paintLayer.layoutObject()->document().didLayoutWithPendingStylesheets())
218 return false;
219
214 return true; 220 return true;
215 } 221 }
216 222
217 static bool shouldRepaintSubsequence(PaintLayer& paintLayer, const PaintLayerPai ntingInfo& paintingInfo, ShouldRespectOverflowClip respectOverflowClip, const La youtSize& subpixelAccumulation) 223 static bool shouldRepaintSubsequence(PaintLayer& paintLayer, const PaintLayerPai ntingInfo& paintingInfo, ShouldRespectOverflowClip respectOverflowClip, const La youtSize& subpixelAccumulation)
218 { 224 {
219 bool needsRepaint = false; 225 bool needsRepaint = false;
220 226
221 // Repaint subsequence if the layer is marked for needing repaint. 227 // Repaint subsequence if the layer is marked for needing repaint.
222 if (paintLayer.needsRepaint()) 228 if (paintLayer.needsRepaint())
223 needsRepaint = true; 229 needsRepaint = true;
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 if (!m_paintLayer.containsDirtyOverlayScrollbars()) 747 if (!m_paintLayer.containsDirtyOverlayScrollbars())
742 return; 748 return;
743 749
744 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), paintFlags, LayoutSize(), paintingRoot); 750 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), paintFlags, LayoutSize(), paintingRoot);
745 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); 751 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars);
746 752
747 m_paintLayer.setContainsDirtyOverlayScrollbars(false); 753 m_paintLayer.setContainsDirtyOverlayScrollbars(false);
748 } 754 }
749 755
750 } // namespace blink 756 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/DocumentLoadingRenderingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698