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/LayoutBlock.h" | 9 #include "core/layout/LayoutBlock.h" |
10 #include "core/layout/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "platform/graphics/paint/CompositingRecorder.h" | 28 #include "platform/graphics/paint/CompositingRecorder.h" |
29 #include "platform/graphics/paint/DisplayItemCacheSkipper.h" | 29 #include "platform/graphics/paint/DisplayItemCacheSkipper.h" |
30 #include "platform/graphics/paint/PaintChunkProperties.h" | 30 #include "platform/graphics/paint/PaintChunkProperties.h" |
31 #include "platform/graphics/paint/ScopedPaintChunkProperties.h" | 31 #include "platform/graphics/paint/ScopedPaintChunkProperties.h" |
32 #include "platform/graphics/paint/SubsequenceRecorder.h" | 32 #include "platform/graphics/paint/SubsequenceRecorder.h" |
33 #include "platform/graphics/paint/Transform3DDisplayItem.h" | 33 #include "platform/graphics/paint/Transform3DDisplayItem.h" |
34 #include "wtf/Optional.h" | 34 #include "wtf/Optional.h" |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
| 38 namespace { |
| 39 |
38 static inline bool shouldSuppressPaintingLayer(const PaintLayer& layer) | 40 static inline bool shouldSuppressPaintingLayer(const PaintLayer& layer) |
39 { | 41 { |
40 // Avoid painting descendants of the root layer when stylesheets haven't loa
ded. This avoids some FOUC. | 42 // Avoid painting descendants of the root layer when stylesheets haven't loa
ded. This avoids some FOUC. |
41 // It's ok not to draw, because later on, when all the stylesheets do load,
Document::styleResolverMayHaveChanged() | 43 // It's ok not to draw, because later on, when all the stylesheets do load,
Document::styleResolverMayHaveChanged() |
42 // will invalidate all painted output via a call to LayoutView::invalidatePa
intForViewAndCompositedLayers(). | 44 // will invalidate all painted output via a call to LayoutView::invalidatePa
intForViewAndCompositedLayers(). |
43 // We also avoid caching subsequences in this mode; see shouldCreateSubseque
nce(). | 45 // We also avoid caching subsequences in this mode; see shouldCreateSubseque
nce(). |
44 if (layer.layoutObject()->document().didLayoutWithPendingStylesheets() && !l
ayer.isRootLayer() && !layer.layoutObject()->isDocumentElement()) | 46 if (layer.layoutObject()->document().didLayoutWithPendingStylesheets() && !l
ayer.isRootLayer() && !layer.layoutObject()->isDocumentElement()) |
45 return true; | 47 return true; |
46 | 48 |
47 return false; | 49 return false; |
48 } | 50 } |
49 | 51 |
| 52 } // namespace |
| 53 |
50 void PaintLayerPainter::paint(GraphicsContext& context, const LayoutRect& damage
Rect, const GlobalPaintFlags globalPaintFlags, PaintLayerFlags paintFlags) | 54 void PaintLayerPainter::paint(GraphicsContext& context, const LayoutRect& damage
Rect, const GlobalPaintFlags globalPaintFlags, PaintLayerFlags paintFlags) |
51 { | 55 { |
52 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe
ct(damageRect)), globalPaintFlags, LayoutSize()); | 56 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe
ct(damageRect)), globalPaintFlags, LayoutSize()); |
53 if (shouldPaintLayerInSoftwareMode(globalPaintFlags, paintFlags)) | 57 if (shouldPaintLayerInSoftwareMode(globalPaintFlags, paintFlags)) |
54 paintLayer(context, paintingInfo, paintFlags); | 58 paintLayer(context, paintingInfo, paintFlags); |
55 } | 59 } |
56 | 60 |
57 static ShouldRespectOverflowClipType shouldRespectOverflowClip(PaintLayerFlags p
aintFlags, const LayoutObject* layoutObject) | 61 static ShouldRespectOverflowClipType shouldRespectOverflowClip(PaintLayerFlags p
aintFlags, const LayoutObject* layoutObject) |
58 { | 62 { |
59 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai
ntLayerPaintingChildClippingMaskPhase && layoutObject->hasClipPath())) ? IgnoreO
verflowClip : RespectOverflowClip; | 63 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai
ntLayerPaintingChildClippingMaskPhase && layoutObject->hasClipPath())) ? IgnoreO
verflowClip : RespectOverflowClip; |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 ASSERT(objectPaintProperties && objectPaintProperties->localBorderBo
xProperties()); | 378 ASSERT(objectPaintProperties && objectPaintProperties->localBorderBo
xProperties()); |
375 PaintChunkProperties properties(context.getPaintController().current
PaintChunkProperties()); | 379 PaintChunkProperties properties(context.getPaintController().current
PaintChunkProperties()); |
376 auto& localBorderBoxProperties = *objectPaintProperties->localBorder
BoxProperties(); | 380 auto& localBorderBoxProperties = *objectPaintProperties->localBorder
BoxProperties(); |
377 properties.transform = localBorderBoxProperties.propertyTreeState.tr
ansform; | 381 properties.transform = localBorderBoxProperties.propertyTreeState.tr
ansform; |
378 properties.clip = localBorderBoxProperties.propertyTreeState.clip; | 382 properties.clip = localBorderBoxProperties.propertyTreeState.clip; |
379 properties.effect = localBorderBoxProperties.propertyTreeState.effec
t; | 383 properties.effect = localBorderBoxProperties.propertyTreeState.effec
t; |
380 properties.backfaceHidden = m_paintLayer.layoutObject()->hasHiddenBa
ckface(); | 384 properties.backfaceHidden = m_paintLayer.layoutObject()->hasHiddenBa
ckface(); |
381 scopedPaintChunkProperties.emplace(context.getPaintController(), m_p
aintLayer, properties); | 385 scopedPaintChunkProperties.emplace(context.getPaintController(), m_p
aintLayer, properties); |
382 } | 386 } |
383 | 387 |
384 bool shouldPaintBackground = isPaintingCompositedBackground && shouldPai
ntContent && !selectionOnly; | 388 bool paintBackgroundOnForeground = isPaintingScrollingContent && m_paint
Layer.shouldPaintBackgroundOntoForeground(); |
| 389 bool shouldPaintBackground = shouldPaintContent && !selectionOnly |
| 390 && ((paintBackgroundOnForeground && isPaintingCompositedForeground) |
| 391 || isPaintingCompositedBackground); |
385 bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintin
gOverflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackgr
ound); | 392 bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintin
gOverflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackgr
ound); |
386 bool shouldPaintOwnContents = isPaintingCompositedForeground && shouldPa
intContent; | 393 bool shouldPaintOwnContents = isPaintingCompositedForeground && shouldPa
intContent; |
387 bool shouldPaintNormalFlowAndPosZOrderLists = isPaintingCompositedForegr
ound; | 394 bool shouldPaintNormalFlowAndPosZOrderLists = isPaintingCompositedForegr
ound; |
388 bool shouldPaintOverlayScrollbars = isPaintingOverlayScrollbars; | 395 bool shouldPaintOverlayScrollbars = isPaintingOverlayScrollbars; |
389 | 396 |
390 if (shouldPaintBackground) { | 397 if (shouldPaintBackground) { |
391 paintBackgroundForFragments(layerFragments, context, paintingInfo.pa
intDirtyRect, | 398 paintBackgroundForFragments(layerFragments, context, paintingInfo.pa
intDirtyRect, |
392 localPaintingInfo, paintFlags); | 399 localPaintingInfo, paintFlags); |
393 } | 400 } |
394 | 401 |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 if (!m_paintLayer.containsDirtyOverlayScrollbars()) | 816 if (!m_paintLayer.containsDirtyOverlayScrollbars()) |
810 return; | 817 return; |
811 | 818 |
812 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe
ct(damageRect)), paintFlags, LayoutSize()); | 819 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe
ct(damageRect)), paintFlags, LayoutSize()); |
813 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 820 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
814 | 821 |
815 m_paintLayer.setContainsDirtyOverlayScrollbars(false); | 822 m_paintLayer.setContainsDirtyOverlayScrollbars(false); |
816 } | 823 } |
817 | 824 |
818 } // namespace blink | 825 } // namespace blink |
OLD | NEW |