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/LayoutView.h" | 11 #include "core/layout/LayoutView.h" |
12 #include "core/layout/svg/LayoutSVGResourceClipper.h" | 12 #include "core/layout/svg/LayoutSVGResourceClipper.h" |
13 #include "core/page/Page.h" | 13 #include "core/page/Page.h" |
14 #include "core/paint/CompositingRecorder.h" | 14 #include "core/paint/CompositingRecorder.h" |
15 #include "core/paint/DeprecatedPaintLayer.h" | 15 #include "core/paint/DeprecatedPaintLayer.h" |
16 #include "core/paint/FilterPainter.h" | 16 #include "core/paint/FilterPainter.h" |
17 #include "core/paint/LayerClipRecorder.h" | 17 #include "core/paint/LayerClipRecorder.h" |
18 #include "core/paint/LayerFixedPositionRecorder.h" | 18 #include "core/paint/LayerFixedPositionRecorder.h" |
19 #include "core/paint/PaintInfo.h" | 19 #include "core/paint/PaintInfo.h" |
20 #include "core/paint/SVGClipPainter.h" | 20 #include "core/paint/SVGClipPainter.h" |
21 #include "core/paint/ScopeRecorder.h" | 21 #include "core/paint/ScopeRecorder.h" |
22 #include "core/paint/ScrollRecorder.h" | 22 #include "core/paint/ScrollRecorder.h" |
23 #include "core/paint/ScrollableAreaPainter.h" | 23 #include "core/paint/ScrollableAreaPainter.h" |
24 #include "core/paint/Transform3DRecorder.h" | 24 #include "core/paint/Transform3DRecorder.h" |
25 #include "platform/graphics/GraphicsLayer.h" | 25 #include "platform/graphics/GraphicsLayer.h" |
26 #include "platform/graphics/paint/ClipPathRecorder.h" | 26 #include "platform/graphics/paint/ClipPathRecorder.h" |
27 #include "platform/graphics/paint/ClipRecorder.h" | 27 #include "platform/graphics/paint/ClipRecorder.h" |
28 #include "platform/graphics/paint/CompositingDisplayItem.h" | 28 #include "platform/graphics/paint/CompositingDisplayItem.h" |
| 29 #include "platform/graphics/paint/SubsequenceRecorder.h" |
29 #include "platform/graphics/paint/Transform3DDisplayItem.h" | 30 #include "platform/graphics/paint/Transform3DDisplayItem.h" |
30 #include "wtf/Optional.h" | 31 #include "wtf/Optional.h" |
31 | 32 |
32 namespace blink { | 33 namespace blink { |
33 | 34 |
34 static inline bool shouldSuppressPaintingLayer(DeprecatedPaintLayer* layer) | 35 static inline bool shouldSuppressPaintingLayer(DeprecatedPaintLayer* layer) |
35 { | 36 { |
36 // Avoid painting descendants of the root layer when stylesheets haven't loa
ded. This eliminates FOUC. | 37 // Avoid painting descendants of the root layer when stylesheets haven't loa
ded. This eliminates FOUC. |
37 // It's ok not to draw, because later on, when all the stylesheets do load,
updateStyleSelector on the Document | 38 // It's ok not to draw, because later on, when all the stylesheets do load,
updateStyleSelector on the Document |
38 // will do a full paintInvalidationForWholeLayoutObject(). | 39 // will do a full paintInvalidationForWholeLayoutObject(). |
(...skipping 22 matching lines...) Expand all Loading... |
61 | 62 |
62 if (m_paintLayer.compositingState() != NotComposited) { | 63 if (m_paintLayer.compositingState() != NotComposited) { |
63 if (paintingInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLayer
s) { | 64 if (paintingInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLayer
s) { |
64 // FIXME: ok, but what about GlobalPaintFlattenCompositingLayers? Th
at's for printing and drag-image. | 65 // FIXME: ok, but what about GlobalPaintFlattenCompositingLayers? Th
at's for printing and drag-image. |
65 // FIXME: why isn't the code here global, as opposed to being set on
each paintLayer() call? | 66 // FIXME: why isn't the code here global, as opposed to being set on
each paintLayer() call? |
66 paintFlags |= PaintLayerUncachedClipRects; | 67 paintFlags |= PaintLayerUncachedClipRects; |
67 } | 68 } |
68 } | 69 } |
69 | 70 |
70 // Non self-painting leaf layers don't need to be painted as their layoutObj
ect() should properly paint itself. | 71 // Non self-painting leaf layers don't need to be painted as their layoutObj
ect() should properly paint itself. |
71 if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLaye
rDescendant()) | 72 if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLaye
rDescendant()) { |
| 73 ASSERT(!m_paintLayer.needsRepaint()); |
72 return; | 74 return; |
| 75 } |
| 76 |
| 77 bool needsRepaint = m_paintLayer.needsRepaint(); |
| 78 m_paintLayer.clearNeedsRepaint(); |
73 | 79 |
74 if (shouldSuppressPaintingLayer(&m_paintLayer)) | 80 if (shouldSuppressPaintingLayer(&m_paintLayer)) |
75 return; | 81 return; |
76 | 82 |
77 // If this layer is totally invisible then there is nothing to paint. | 83 // If this layer is totally invisible then there is nothing to paint. |
78 if (!m_paintLayer.layoutObject()->opacity()) | 84 if (!m_paintLayer.layoutObject()->opacity()) |
79 return; | 85 return; |
80 | 86 |
| 87 if (!needsRepaint && SubsequenceRecorder::useCachedSubsequenceIfPossible(*co
ntext, *m_paintLayer.layoutObject())) |
| 88 return; |
| 89 SubsequenceRecorder subsequenceRecorder(*context, *m_paintLayer.layoutObject
()); |
| 90 |
81 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) | 91 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) |
82 paintFlags |= PaintLayerHaveTransparency; | 92 paintFlags |= PaintLayerHaveTransparency; |
83 | 93 |
84 LayerFixedPositionRecorder fixedPositionRecorder(*context, *m_paintLayer.lay
outObject()); | 94 LayerFixedPositionRecorder fixedPositionRecorder(*context, *m_paintLayer.lay
outObject()); |
85 | 95 |
86 // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying th
e transform twice. | 96 // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying th
e transform twice. |
87 if (m_paintLayer.paintsWithTransform(paintingInfo.globalPaintFlags()) && !(p
aintFlags & PaintLayerAppliedTransform)) { | 97 if (m_paintLayer.paintsWithTransform(paintingInfo.globalPaintFlags()) && !(p
aintFlags & PaintLayerAppliedTransform)) { |
88 paintLayerWithTransform(context, paintingInfo, paintFlags); | 98 paintLayerWithTransform(context, paintingInfo, paintFlags); |
89 return; | 99 return; |
90 } | 100 } |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 if (!m_paintLayer.containsDirtyOverlayScrollbars()) | 610 if (!m_paintLayer.containsDirtyOverlayScrollbars()) |
601 return; | 611 return; |
602 | 612 |
603 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl
osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot); | 613 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl
osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot); |
604 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 614 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
605 | 615 |
606 m_paintLayer.setContainsDirtyOverlayScrollbars(false); | 616 m_paintLayer.setContainsDirtyOverlayScrollbars(false); |
607 } | 617 } |
608 | 618 |
609 } // namespace blink | 619 } // namespace blink |
OLD | NEW |