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 "core/paint/PaintLayerPainter.h" | 5 #include "core/paint/PaintLayerPainter.h" |
6 | 6 |
7 #include "core/frame/FrameView.h" | |
7 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
8 #include "core/layout/ClipPathOperation.h" | 9 #include "core/layout/ClipPathOperation.h" |
9 #include "core/layout/LayoutBlock.h" | 10 #include "core/layout/LayoutBlock.h" |
10 #include "core/layout/LayoutFrame.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/FilterPainter.h" | 15 #include "core/paint/FilterPainter.h" |
15 #include "core/paint/LayerClipRecorder.h" | 16 #include "core/paint/LayerClipRecorder.h" |
16 #include "core/paint/LayerFixedPositionRecorder.h" | 17 #include "core/paint/LayerFixedPositionRecorder.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 } | 74 } |
74 | 75 |
75 // Non self-painting layers without self-painting descendants don't need to be painted as their | 76 // Non self-painting layers without self-painting descendants don't need to be painted as their |
76 // layoutObject() should properly paint itself. | 77 // layoutObject() should properly paint itself. |
77 if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLaye rDescendant()) | 78 if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLaye rDescendant()) |
78 return FullyPainted; | 79 return FullyPainted; |
79 | 80 |
80 if (shouldSuppressPaintingLayer(&m_paintLayer)) | 81 if (shouldSuppressPaintingLayer(&m_paintLayer)) |
81 return FullyPainted; | 82 return FullyPainted; |
82 | 83 |
83 // TODO(skyostil): Unify this early-out logic with subsequence caching. | |
84 if (m_paintLayer.layoutObject()->isLayoutPart() && toLayoutPart(m_paintLayer .layoutObject())->isThrottledFrameView()) | |
85 return FullyPainted; | |
86 | |
87 // If this layer is totally invisible then there is nothing to paint. | 84 // If this layer is totally invisible then there is nothing to paint. |
88 if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()- >hasBackdropFilter()) | 85 if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()- >hasBackdropFilter()) |
89 return FullyPainted; | 86 return FullyPainted; |
90 | 87 |
91 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) | 88 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) |
92 paintFlags |= PaintLayerHaveTransparency; | 89 paintFlags |= PaintLayerHaveTransparency; |
93 | 90 |
94 LayerFixedPositionRecorder fixedPositionRecorder(context, *m_paintLayer.layo utObject()); | 91 LayerFixedPositionRecorder fixedPositionRecorder(context, *m_paintLayer.layo utObject()); |
95 | 92 |
96 // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying th e transform twice. | 93 // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying th e transform twice. |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
262 bool shouldPaintOutline = isSelfPaintingLayer && !isPaintingOverlayScrollbar s | 259 bool shouldPaintOutline = isSelfPaintingLayer && !isPaintingOverlayScrollbar s |
263 && ((isPaintingScrollingContent && isPaintingCompositedBackground) | 260 && ((isPaintingScrollingContent && isPaintingCompositedBackground) |
264 || (!isPaintingScrollingContent && isPaintingCompositedForeground)); | 261 || (!isPaintingScrollingContent && isPaintingCompositedForeground)); |
265 bool shouldPaintContent = m_paintLayer.hasVisibleContent() && isSelfPainting Layer && !isPaintingOverlayScrollbars; | 262 bool shouldPaintContent = m_paintLayer.hasVisibleContent() && isSelfPainting Layer && !isPaintingOverlayScrollbars; |
266 | 263 |
267 PaintResult result = FullyPainted; | 264 PaintResult result = FullyPainted; |
268 | 265 |
269 if (paintFlags & PaintLayerPaintingRootBackgroundOnly && !m_paintLayer.layou tObject()->isLayoutView() && !m_paintLayer.layoutObject()->isDocumentElement()) | 266 if (paintFlags & PaintLayerPaintingRootBackgroundOnly && !m_paintLayer.layou tObject()->isLayoutView() && !m_paintLayer.layoutObject()->isDocumentElement()) |
270 return result; | 267 return result; |
271 | 268 |
272 // TODO(skyostil): Unify this early-out logic with subsequence caching. | 269 if (m_paintLayer.layoutObject()->isLayoutView() && toLayoutView(m_paintLayer .layoutObject())->frameView()->shouldThrottleRendering()) { |
273 if (m_paintLayer.layoutObject()->isLayoutPart() && toLayoutPart(m_paintLayer .layoutObject())->isThrottledFrameView()) | 270 // Make sure we re-record any cached subsequence when this layer becomes |
274 return FullyPainted; | 271 // unthrottled again. |
272 result = MayBeClippedByPaintDirtyRect; | |
273 m_paintLayer.setPreviousPaintResult(result); | |
274 return result; | |
chrishtr
2016/01/20 17:08:11
I think you need to call m_paintLayer.setPreviousP
Sami
2016/01/20 18:06:42
Hmm, isn't that what I'm doing on line 273 or did
Sami
2016/01/20 18:10:09
And to be clear the other part of the bugfix is th
Xianzhu
2016/01/20 18:31:12
I think we need to clear m_paintLayer's other prev
Sami
2016/01/20 18:49:31
Good point. Looks like it should be sufficient to
Xianzhu
2016/01/20 18:51:03
needsRepaint should be suffice.
| |
275 } | |
275 | 276 |
276 // Ensure our lists are up-to-date. | 277 // Ensure our lists are up-to-date. |
277 m_paintLayer.stackingNode()->updateLayerListsIfNeeded(); | 278 m_paintLayer.stackingNode()->updateLayerListsIfNeeded(); |
278 | 279 |
279 LayoutSize subpixelAccumulation = m_paintLayer.compositingState() == PaintsI ntoOwnBacking ? m_paintLayer.subpixelAccumulation() : paintingInfoArg.subPixelAc cumulation; | 280 LayoutSize subpixelAccumulation = m_paintLayer.compositingState() == PaintsI ntoOwnBacking ? m_paintLayer.subpixelAccumulation() : paintingInfoArg.subPixelAc cumulation; |
280 ShouldRespectOverflowClip respectOverflowClip = shouldRespectOverflowClip(pa intFlags, m_paintLayer.layoutObject()); | 281 ShouldRespectOverflowClip respectOverflowClip = shouldRespectOverflowClip(pa intFlags, m_paintLayer.layoutObject()); |
281 | 282 |
282 Optional<SubsequenceRecorder> subsequenceRecorder; | 283 Optional<SubsequenceRecorder> subsequenceRecorder; |
283 if (shouldCreateSubsequence(m_paintLayer, context, paintingInfoArg, paintFla gs)) { | 284 if (shouldCreateSubsequence(m_paintLayer, context, paintingInfoArg, paintFla gs)) { |
284 if (!shouldRepaintSubsequence(m_paintLayer, paintingInfoArg, respectOver flowClip, subpixelAccumulation) | 285 if (!shouldRepaintSubsequence(m_paintLayer, paintingInfoArg, respectOver flowClip, subpixelAccumulation) |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
741 if (!m_paintLayer.containsDirtyOverlayScrollbars()) | 742 if (!m_paintLayer.containsDirtyOverlayScrollbars()) |
742 return; | 743 return; |
743 | 744 |
744 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), paintFlags, LayoutSize(), paintingRoot); | 745 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), paintFlags, LayoutSize(), paintingRoot); |
745 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 746 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
746 | 747 |
747 m_paintLayer.setContainsDirtyOverlayScrollbars(false); | 748 m_paintLayer.setContainsDirtyOverlayScrollbars(false); |
748 } | 749 } |
749 | 750 |
750 } // namespace blink | 751 } // namespace blink |
OLD | NEW |