OLD | NEW |
---|---|
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/PaintLayerPainter.h" | 6 #include "core/paint/PaintLayerPainter.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/FilterPainter.h" | 16 #include "core/paint/FilterPainter.h" |
16 #include "core/paint/LayerClipRecorder.h" | 17 #include "core/paint/LayerClipRecorder.h" |
17 #include "core/paint/LayerFixedPositionRecorder.h" | 18 #include "core/paint/LayerFixedPositionRecorder.h" |
18 #include "core/paint/PaintInfo.h" | 19 #include "core/paint/PaintInfo.h" |
19 #include "core/paint/PaintLayer.h" | 20 #include "core/paint/PaintLayer.h" |
20 #include "core/paint/SVGClipPainter.h" | 21 #include "core/paint/SVGClipPainter.h" |
(...skipping 16 matching lines...) Expand all Loading... | |
37 { | 38 { |
38 // Avoid painting descendants of the root layer when stylesheets haven't loa ded. This eliminates FOUC. | 39 // Avoid painting descendants of the root layer when stylesheets haven't loa ded. This eliminates FOUC. |
39 // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document | 40 // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document |
40 // will do a full paintInvalidationForWholeLayoutObject(). | 41 // will do a full paintInvalidationForWholeLayoutObject(). |
41 if (layer->layoutObject()->document().didLayoutWithPendingStylesheets() && ! layer->isRootLayer() && !layer->layoutObject()->isDocumentElement()) | 42 if (layer->layoutObject()->document().didLayoutWithPendingStylesheets() && ! layer->isRootLayer() && !layer->layoutObject()->isDocumentElement()) |
42 return true; | 43 return true; |
43 | 44 |
44 return false; | 45 return false; |
45 } | 46 } |
46 | 47 |
48 static bool isThrottledFrameView(const LayoutObject* layoutObject) | |
esprehn
2015/10/14 22:09:46
I'd put this on LayoutPart, and do
->isLayoutPar
Sami
2015/10/16 16:48:09
Thanks, much better.
| |
49 { | |
50 if (!layoutObject->isLayoutPart()) | |
51 return false; | |
52 const LayoutPart* part = toLayoutPart(layoutObject); | |
53 if (!part->widget() || !part->widget()->isFrameView()) | |
54 return false; | |
55 const FrameView* frameView = toFrameView(part->widget()); | |
56 return frameView->shouldThrottleRendering(); | |
57 } | |
58 | |
47 void PaintLayerPainter::paint(GraphicsContext* context, const LayoutRect& damage Rect, const GlobalPaintFlags globalPaintFlags, LayoutObject* paintingRoot, Paint LayerFlags paintFlags) | 59 void PaintLayerPainter::paint(GraphicsContext* context, const LayoutRect& damage Rect, const GlobalPaintFlags globalPaintFlags, LayoutObject* paintingRoot, Paint LayerFlags paintFlags) |
48 { | 60 { |
49 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), globalPaintFlags, LayoutSize(), paintingRoot); | 61 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), globalPaintFlags, LayoutSize(), paintingRoot); |
50 if (shouldPaintLayerInSoftwareMode(globalPaintFlags, paintFlags)) | 62 if (shouldPaintLayerInSoftwareMode(globalPaintFlags, paintFlags)) |
51 paintLayer(context, paintingInfo, paintFlags); | 63 paintLayer(context, paintingInfo, paintFlags); |
52 } | 64 } |
53 | 65 |
54 static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paint Flags, const LayoutObject* layoutObject) | 66 static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paint Flags, const LayoutObject* layoutObject) |
55 { | 67 { |
56 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai ntLayerPaintingChildClippingMaskPhase && layoutObject->hasClipPath())) ? IgnoreO verflowClip : RespectOverflowClip; | 68 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai ntLayerPaintingChildClippingMaskPhase && layoutObject->hasClipPath())) ? IgnoreO verflowClip : RespectOverflowClip; |
(...skipping 22 matching lines...) Expand all Loading... | |
79 // Non self-painting layers without self-painting descendants don't need to be painted as their | 91 // Non self-painting layers without self-painting descendants don't need to be painted as their |
80 // layoutObject() should properly paint itself. | 92 // layoutObject() should properly paint itself. |
81 if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLaye rDescendant()) { | 93 if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLaye rDescendant()) { |
82 ASSERT(!m_paintLayer.needsRepaint() || !RuntimeEnabledFeatures::slimming PaintV2Enabled()); | 94 ASSERT(!m_paintLayer.needsRepaint() || !RuntimeEnabledFeatures::slimming PaintV2Enabled()); |
83 return FullyPainted; | 95 return FullyPainted; |
84 } | 96 } |
85 | 97 |
86 if (shouldSuppressPaintingLayer(&m_paintLayer)) | 98 if (shouldSuppressPaintingLayer(&m_paintLayer)) |
87 return FullyPainted; | 99 return FullyPainted; |
88 | 100 |
101 // TODO(skyostil): Unify this early-out logic with subsequence caching. | |
102 if (isThrottledFrameView(m_paintLayer.layoutObject())) | |
103 return FullyPainted; | |
104 | |
89 // If this layer is totally invisible then there is nothing to paint. | 105 // If this layer is totally invisible then there is nothing to paint. |
90 if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()- >hasBackdropFilter()) | 106 if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()- >hasBackdropFilter()) |
91 return FullyPainted; | 107 return FullyPainted; |
92 | 108 |
93 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) | 109 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) |
94 paintFlags |= PaintLayerHaveTransparency; | 110 paintFlags |= PaintLayerHaveTransparency; |
95 | 111 |
96 LayerFixedPositionRecorder fixedPositionRecorder(*context, *m_paintLayer.lay outObject()); | 112 LayerFixedPositionRecorder fixedPositionRecorder(*context, *m_paintLayer.lay outObject()); |
97 | 113 |
98 // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying th e transform twice. | 114 // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying th e transform twice. |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 bool shouldPaintOutline = isSelfPaintingLayer && !isPaintingOverlayScrollbar s | 229 bool shouldPaintOutline = isSelfPaintingLayer && !isPaintingOverlayScrollbar s |
214 && ((isPaintingScrollingContent && isPaintingCompositedBackground) | 230 && ((isPaintingScrollingContent && isPaintingCompositedBackground) |
215 || (!isPaintingScrollingContent && isPaintingCompositedForeground)); | 231 || (!isPaintingScrollingContent && isPaintingCompositedForeground)); |
216 bool shouldPaintContent = m_paintLayer.hasVisibleContent() && isSelfPainting Layer && !isPaintingOverlayScrollbars; | 232 bool shouldPaintContent = m_paintLayer.hasVisibleContent() && isSelfPainting Layer && !isPaintingOverlayScrollbars; |
217 | 233 |
218 PaintResult result = FullyPainted; | 234 PaintResult result = FullyPainted; |
219 | 235 |
220 if (paintFlags & PaintLayerPaintingRootBackgroundOnly && !m_paintLayer.layou tObject()->isLayoutView() && !m_paintLayer.layoutObject()->isDocumentElement()) | 236 if (paintFlags & PaintLayerPaintingRootBackgroundOnly && !m_paintLayer.layou tObject()->isLayoutView() && !m_paintLayer.layoutObject()->isDocumentElement()) |
221 return result; | 237 return result; |
222 | 238 |
239 // TODO(skyostil): Unify this early-out logic with subsequence caching. | |
240 if (isThrottledFrameView(m_paintLayer.layoutObject())) | |
241 return FullyPainted; | |
242 | |
223 PaintLayerPaintingInfo paintingInfo = paintingInfoArg; | 243 PaintLayerPaintingInfo paintingInfo = paintingInfoArg; |
224 | 244 |
225 // Ensure our lists are up-to-date. | 245 // Ensure our lists are up-to-date. |
226 m_paintLayer.stackingNode()->updateLayerListsIfNeeded(); | 246 m_paintLayer.stackingNode()->updateLayerListsIfNeeded(); |
227 | 247 |
228 LayoutPoint offsetFromRoot; | 248 LayoutPoint offsetFromRoot; |
229 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); | 249 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); |
230 | 250 |
231 if (m_paintLayer.compositingState() == PaintsIntoOwnBacking) | 251 if (m_paintLayer.compositingState() == PaintsIntoOwnBacking) |
232 offsetFromRoot.move(m_paintLayer.subpixelAccumulation()); | 252 offsetFromRoot.move(m_paintLayer.subpixelAccumulation()); |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
694 if (!m_paintLayer.containsDirtyOverlayScrollbars()) | 714 if (!m_paintLayer.containsDirtyOverlayScrollbars()) |
695 return; | 715 return; |
696 | 716 |
697 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), paintFlags, LayoutSize(), paintingRoot); | 717 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), paintFlags, LayoutSize(), paintingRoot); |
698 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 718 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
699 | 719 |
700 m_paintLayer.setContainsDirtyOverlayScrollbars(false); | 720 m_paintLayer.setContainsDirtyOverlayScrollbars(false); |
701 } | 721 } |
702 | 722 |
703 } // namespace blink | 723 } // namespace blink |
OLD | NEW |