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/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 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) |
| 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->shouldThrottleRenderingPipeline(); |
| 57 } |
| 58 |
47 void DeprecatedPaintLayerPainter::paint(GraphicsContext* context, const LayoutRe
ct& damageRect, const GlobalPaintFlags globalPaintFlags, LayoutObject* paintingR
oot, PaintLayerFlags paintFlags) | 59 void DeprecatedPaintLayerPainter::paint(GraphicsContext* context, const LayoutRe
ct& damageRect, const GlobalPaintFlags globalPaintFlags, LayoutObject* paintingR
oot, PaintLayerFlags paintFlags) |
48 { | 60 { |
49 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl
osingIntRect(damageRect)), globalPaintFlags, LayoutSize(), paintingRoot); | 61 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl
osingIntRect(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 21 matching lines...) Expand all Loading... |
78 | 90 |
79 // Non self-painting leaf layers don't need to be painted as their layoutObj
ect() should properly paint itself. | 91 // Non self-painting leaf layers don't need to be painted as their layoutObj
ect() should properly paint itself. |
80 if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLaye
rDescendant()) { | 92 if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLaye
rDescendant()) { |
81 ASSERT(!m_paintLayer.needsRepaint()); | 93 ASSERT(!m_paintLayer.needsRepaint()); |
82 return FullyPainted; | 94 return FullyPainted; |
83 } | 95 } |
84 | 96 |
85 if (shouldSuppressPaintingLayer(&m_paintLayer)) | 97 if (shouldSuppressPaintingLayer(&m_paintLayer)) |
86 return FullyPainted; | 98 return FullyPainted; |
87 | 99 |
| 100 // TODO(skyostil): Unify this early-out logic with subsequence caching. |
| 101 if (isThrottledFrameView(m_paintLayer.layoutObject())) |
| 102 return FullyPainted; |
| 103 |
88 // If this layer is totally invisible then there is nothing to paint. | 104 // If this layer is totally invisible then there is nothing to paint. |
89 if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()-
>hasBackdropFilter()) | 105 if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()-
>hasBackdropFilter()) |
90 return FullyPainted; | 106 return FullyPainted; |
91 | 107 |
92 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) | 108 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) |
93 paintFlags |= PaintLayerHaveTransparency; | 109 paintFlags |= PaintLayerHaveTransparency; |
94 | 110 |
95 LayerFixedPositionRecorder fixedPositionRecorder(*context, *m_paintLayer.lay
outObject()); | 111 LayerFixedPositionRecorder fixedPositionRecorder(*context, *m_paintLayer.lay
outObject()); |
96 | 112 |
97 // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying th
e transform twice. | 113 // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying th
e transform twice. |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 Optional<SubsequenceRecorder> subsequenceRecorder; | 234 Optional<SubsequenceRecorder> subsequenceRecorder; |
219 if (isPaintingOverlayScrollbars) { | 235 if (isPaintingOverlayScrollbars) { |
220 // We should have cleared the repaint flag in the first pass. | 236 // We should have cleared the repaint flag in the first pass. |
221 ASSERT(!needsRepaint); | 237 ASSERT(!needsRepaint); |
222 } else { | 238 } else { |
223 if (!needsRepaint && SubsequenceRecorder::useCachedSubsequenceIfPossible
(*context, m_paintLayer)) | 239 if (!needsRepaint && SubsequenceRecorder::useCachedSubsequenceIfPossible
(*context, m_paintLayer)) |
224 return result; | 240 return result; |
225 subsequenceRecorder.emplace(*context, m_paintLayer); | 241 subsequenceRecorder.emplace(*context, m_paintLayer); |
226 } | 242 } |
227 | 243 |
| 244 // TODO(skyostil): Unify this early-out logic with subsequence caching. |
| 245 if (isThrottledFrameView(m_paintLayer.layoutObject())) |
| 246 return FullyPainted; |
| 247 |
228 DeprecatedPaintLayerPaintingInfo paintingInfo = paintingInfoArg; | 248 DeprecatedPaintLayerPaintingInfo paintingInfo = paintingInfoArg; |
229 | 249 |
230 // Ensure our lists are up-to-date. | 250 // Ensure our lists are up-to-date. |
231 m_paintLayer.stackingNode()->updateLayerListsIfNeeded(); | 251 m_paintLayer.stackingNode()->updateLayerListsIfNeeded(); |
232 | 252 |
233 LayoutPoint offsetFromRoot; | 253 LayoutPoint offsetFromRoot; |
234 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); | 254 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); |
235 | 255 |
236 if (m_paintLayer.compositingState() == PaintsIntoOwnBacking) | 256 if (m_paintLayer.compositingState() == PaintsIntoOwnBacking) |
237 offsetFromRoot.move(m_paintLayer.subpixelAccumulation()); | 257 offsetFromRoot.move(m_paintLayer.subpixelAccumulation()); |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 if (!m_paintLayer.containsDirtyOverlayScrollbars()) | 688 if (!m_paintLayer.containsDirtyOverlayScrollbars()) |
669 return; | 689 return; |
670 | 690 |
671 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl
osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot); | 691 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl
osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot); |
672 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 692 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
673 | 693 |
674 m_paintLayer.setContainsDirtyOverlayScrollbars(false); | 694 m_paintLayer.setContainsDirtyOverlayScrollbars(false); |
675 } | 695 } |
676 | 696 |
677 } // namespace blink | 697 } // namespace blink |
OLD | NEW |