| 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/LocalFrame.h" | 7 #include "core/frame/LocalFrame.h" |
| 8 #include "core/layout/LayoutInline.h" | 8 #include "core/layout/LayoutInline.h" |
| 9 #include "core/layout/LayoutView.h" | 9 #include "core/layout/LayoutView.h" |
| 10 #include "core/paint/ClipPathClipper.h" | 10 #include "core/paint/ClipPathClipper.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 localPaintFlags |= PaintLayerPaintingCompositingAllPhases; | 110 localPaintFlags |= PaintLayerPaintingCompositingAllPhases; |
| 111 if (paintLayerContents(context, paintingInfo, localPaintFlags, fragmentPolic
y) == MayBeClippedByPaintDirtyRect) | 111 if (paintLayerContents(context, paintingInfo, localPaintFlags, fragmentPolic
y) == MayBeClippedByPaintDirtyRect) |
| 112 result = MayBeClippedByPaintDirtyRect; | 112 result = MayBeClippedByPaintDirtyRect; |
| 113 | 113 |
| 114 return result; | 114 return result; |
| 115 } | 115 } |
| 116 | 116 |
| 117 static bool shouldCreateSubsequence(const PaintLayer& paintLayer, GraphicsContex
t& context, const PaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFla
gs) | 117 static bool shouldCreateSubsequence(const PaintLayer& paintLayer, GraphicsContex
t& context, const PaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFla
gs) |
| 118 { | 118 { |
| 119 if (!RuntimeEnabledFeatures::paintOptimizationsEnabled()) | |
| 120 return false; | |
| 121 | |
| 122 // Caching is not needed during printing. | 119 // Caching is not needed during printing. |
| 123 if (context.printing()) | 120 if (context.printing()) |
| 124 return false; | 121 return false; |
| 125 | 122 |
| 126 // Don't create subsequence for a composited layer because if it can be cach
ed, | 123 // Don't create subsequence for a composited layer because if it can be cach
ed, |
| 127 // we can skip the whole painting in GraphicsLayer::paint() with CachedDispl
ayItemList. | 124 // we can skip the whole painting in GraphicsLayer::paint() with CachedDispl
ayItemList. |
| 128 // This also avoids conflict of PaintLayer::previousXXX() when paintLayer is
composited | 125 // This also avoids conflict of PaintLayer::previousXXX() when paintLayer is
composited |
| 129 // scrolling and is painted twice for GraphicsLayers of container and scroll
ing contents. | 126 // scrolling and is painted twice for GraphicsLayers of container and scroll
ing contents. |
| 130 if (paintLayer.compositingState() == PaintsIntoOwnBacking) | 127 if (paintLayer.compositingState() == PaintsIntoOwnBacking) |
| 131 return false; | 128 return false; |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun
dRect)) { | 684 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun
dRect)) { |
| 688 clipRecorder.emplace(context, *m_paintLayer.layoutObject(), DisplayItem:
:ClipLayerForeground, layerFragments[0].foregroundRect, &localPaintingInfo, laye
rFragments[0].paginationOffset, paintFlags); | 685 clipRecorder.emplace(context, *m_paintLayer.layoutObject(), DisplayItem:
:ClipLayerForeground, layerFragments[0].foregroundRect, &localPaintingInfo, laye
rFragments[0].paginationOffset, paintFlags); |
| 689 clipState = HasClipped; | 686 clipState = HasClipped; |
| 690 } | 687 } |
| 691 | 688 |
| 692 // We have to loop through every fragment multiple times, since we have to i
ssue paint invalidations in each specific phase in order for | 689 // We have to loop through every fragment multiple times, since we have to i
ssue paint invalidations in each specific phase in order for |
| 693 // interleaving of the fragments to work properly. | 690 // interleaving of the fragments to work properly. |
| 694 if (selectionOnly) { | 691 if (selectionOnly) { |
| 695 paintForegroundForFragmentsWithPhase(PaintPhaseSelection, layerFragments
, context, localPaintingInfo, paintFlags, clipState); | 692 paintForegroundForFragmentsWithPhase(PaintPhaseSelection, layerFragments
, context, localPaintingInfo, paintFlags, clipState); |
| 696 } else { | 693 } else { |
| 697 if (!RuntimeEnabledFeatures::paintOptimizationsEnabled() || m_paintLayer
.needsPaintPhaseDescendantBlockBackgrounds()) | 694 if (m_paintLayer.needsPaintPhaseDescendantBlockBackgrounds()) |
| 698 paintForegroundForFragmentsWithPhase(PaintPhaseDescendantBlockBackgr
oundsOnly, layerFragments, context, localPaintingInfo, paintFlags, clipState); | 695 paintForegroundForFragmentsWithPhase(PaintPhaseDescendantBlockBackgr
oundsOnly, layerFragments, context, localPaintingInfo, paintFlags, clipState); |
| 699 if (!RuntimeEnabledFeatures::paintOptimizationsEnabled() || m_paintLayer
.needsPaintPhaseFloat()) | 696 if (m_paintLayer.needsPaintPhaseFloat()) |
| 700 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments
, context, localPaintingInfo, paintFlags, clipState); | 697 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments
, context, localPaintingInfo, paintFlags, clipState); |
| 701 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragment
s, context, localPaintingInfo, paintFlags, clipState); | 698 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragment
s, context, localPaintingInfo, paintFlags, clipState); |
| 702 if (!RuntimeEnabledFeatures::paintOptimizationsEnabled() || m_paintLayer
.needsPaintPhaseDescendantOutlines()) | 699 if (m_paintLayer.needsPaintPhaseDescendantOutlines()) |
| 703 paintForegroundForFragmentsWithPhase(PaintPhaseDescendantOutlinesOnl
y, layerFragments, context, localPaintingInfo, paintFlags, clipState); | 700 paintForegroundForFragmentsWithPhase(PaintPhaseDescendantOutlinesOnl
y, layerFragments, context, localPaintingInfo, paintFlags, clipState); |
| 704 } | 701 } |
| 705 } | 702 } |
| 706 | 703 |
| 707 void PaintLayerPainter::paintForegroundForFragmentsWithPhase(PaintPhase phase, | 704 void PaintLayerPainter::paintForegroundForFragmentsWithPhase(PaintPhase phase, |
| 708 const PaintLayerFragments& layerFragments, GraphicsContext& context, | 705 const PaintLayerFragments& layerFragments, GraphicsContext& context, |
| 709 const PaintLayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags,
ClipState clipState) | 706 const PaintLayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags,
ClipState clipState) |
| 710 { | 707 { |
| 711 Optional<DisplayItemCacheSkipper> cacheSkipper; | 708 Optional<DisplayItemCacheSkipper> cacheSkipper; |
| 712 if (layerFragments.size() > 1) | 709 if (layerFragments.size() > 1) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 if (!m_paintLayer.containsDirtyOverlayScrollbars()) | 755 if (!m_paintLayer.containsDirtyOverlayScrollbars()) |
| 759 return; | 756 return; |
| 760 | 757 |
| 761 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe
ct(damageRect)), paintFlags, LayoutSize()); | 758 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe
ct(damageRect)), paintFlags, LayoutSize()); |
| 762 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 759 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
| 763 | 760 |
| 764 m_paintLayer.setContainsDirtyOverlayScrollbars(false); | 761 m_paintLayer.setContainsDirtyOverlayScrollbars(false); |
| 765 } | 762 } |
| 766 | 763 |
| 767 } // namespace blink | 764 } // namespace blink |
| OLD | NEW |