| 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/FrameView.h" |
| 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" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 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, PaintLayerFlags paintFlags) | 50 void PaintLayerPainter::paint(GraphicsContext& context, const LayoutRect& damage
Rect, const GlobalPaintFlags globalPaintFlags, PaintLayerFlags paintFlags) |
| 51 { | 51 { |
| 52 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe
ct(damageRect)), globalPaintFlags, LayoutSize()); | 52 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe
ct(damageRect)), globalPaintFlags, LayoutSize()); |
| 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 Loading... |
| 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 if (m_paintLayer.layoutObject()->isLayoutView() && toLayoutView(m_paintLayer
.layoutObject())->frameView()->shouldThrottleRendering()) | 83 if (m_paintLayer.layoutObject()->isLayoutView() && toLayoutView(m_paintLayer
.layoutObject())->frameView()->shouldThrottleRendering()) |
| 84 return FullyPainted; | 84 return FullyPainted; |
| 85 | 85 |
| 86 // If this layer is totally invisible then there is nothing to paint. | 86 // If this layer is totally invisible then there is nothing to paint. |
| 87 if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()-
>hasBackdropFilter()) | 87 if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()-
>hasBackdropFilter()) |
| 88 return FullyPainted; | 88 return FullyPainted; |
| 89 | 89 |
| 90 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) | 90 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 return false; | 202 return false; |
| 203 | 203 |
| 204 // Create subsequence for only stacking contexts whose painting are atomic. | 204 // Create subsequence for only stacking contexts whose painting are atomic. |
| 205 if (!paintLayer.stackingNode()->isStackingContext()) | 205 if (!paintLayer.stackingNode()->isStackingContext()) |
| 206 return false; | 206 return false; |
| 207 | 207 |
| 208 // The layer doesn't have children. Subsequence caching is not worth because
normally the actual painting will be cheap. | 208 // The layer doesn't have children. Subsequence caching is not worth because
normally the actual painting will be cheap. |
| 209 if (!PaintLayerStackingNodeIterator(*paintLayer.stackingNode(), AllChildren)
.next()) | 209 if (!PaintLayerStackingNodeIterator(*paintLayer.stackingNode(), AllChildren)
.next()) |
| 210 return false; | 210 return false; |
| 211 | 211 |
| 212 // When in FOUC-avoidance mode, don't cache any subsequences, to avoid havin
g |
| 213 // to invalidate all of them when leaving this mode. There is an early-out i
n BlockPainter::paintContents that may result |
| 214 // in nothing getting painted in thos mode, in addition to early-out logic i
n PaintLayerPainter. |
| 215 if (paintLayer.layoutObject()->document().didLayoutWithPendingStylesheets()) |
| 216 return false; |
| 217 |
| 212 return true; | 218 return true; |
| 213 } | 219 } |
| 214 | 220 |
| 215 static bool shouldRepaintSubsequence(PaintLayer& paintLayer, const PaintLayerPai
ntingInfo& paintingInfo, ShouldRespectOverflowClip respectOverflowClip, const La
youtSize& subpixelAccumulation) | 221 static bool shouldRepaintSubsequence(PaintLayer& paintLayer, const PaintLayerPai
ntingInfo& paintingInfo, ShouldRespectOverflowClip respectOverflowClip, const La
youtSize& subpixelAccumulation) |
| 216 { | 222 { |
| 217 bool needsRepaint = false; | 223 bool needsRepaint = false; |
| 218 | 224 |
| 219 // Repaint subsequence if the layer is marked for needing repaint. | 225 // Repaint subsequence if the layer is marked for needing repaint. |
| 220 if (paintLayer.needsRepaint()) | 226 if (paintLayer.needsRepaint()) |
| 221 needsRepaint = true; | 227 needsRepaint = true; |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 if (!m_paintLayer.containsDirtyOverlayScrollbars()) | 773 if (!m_paintLayer.containsDirtyOverlayScrollbars()) |
| 768 return; | 774 return; |
| 769 | 775 |
| 770 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe
ct(damageRect)), paintFlags, LayoutSize()); | 776 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe
ct(damageRect)), paintFlags, LayoutSize()); |
| 771 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 777 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
| 772 | 778 |
| 773 m_paintLayer.setContainsDirtyOverlayScrollbars(false); | 779 m_paintLayer.setContainsDirtyOverlayScrollbars(false); |
| 774 } | 780 } |
| 775 | 781 |
| 776 } // namespace blink | 782 } // namespace blink |
| OLD | NEW |