| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 private: | 178 private: |
| 179 LayoutSVGResourceClipper* m_resourceClipper; | 179 LayoutSVGResourceClipper* m_resourceClipper; |
| 180 Optional<ClipPathRecorder> m_clipPathRecorder; | 180 Optional<ClipPathRecorder> m_clipPathRecorder; |
| 181 SVGClipPainter::ClipperState m_clipperState; | 181 SVGClipPainter::ClipperState m_clipperState; |
| 182 const PaintLayer& m_paintLayer; | 182 const PaintLayer& m_paintLayer; |
| 183 GraphicsContext& m_context; | 183 GraphicsContext& m_context; |
| 184 }; | 184 }; |
| 185 | 185 |
| 186 static bool shouldCreateSubsequence(const PaintLayer& paintLayer, GraphicsContex
t& context, const PaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFla
gs) | 186 static bool shouldCreateSubsequence(const PaintLayer& paintLayer, GraphicsContex
t& context, const PaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFla
gs) |
| 187 { | 187 { |
| 188 if (!RuntimeEnabledFeatures::paintOptimizationsEnabled()) |
| 189 return false; |
| 190 |
| 188 // Caching is not needed during printing. | 191 // Caching is not needed during printing. |
| 189 if (context.printing()) | 192 if (context.printing()) |
| 190 return false; | 193 return false; |
| 191 | 194 |
| 192 // Don't create subsequence for a composited layer because if it can be cach
ed, | 195 // Don't create subsequence for a composited layer because if it can be cach
ed, |
| 193 // we can skip the whole painting in GraphicsLayer::paint() with CachedDispl
ayItemList. | 196 // we can skip the whole painting in GraphicsLayer::paint() with CachedDispl
ayItemList. |
| 194 // This also avoids conflict of PaintLayer::previousXXX() when paintLayer is
composited | 197 // This also avoids conflict of PaintLayer::previousXXX() when paintLayer is
composited |
| 195 // scrolling and is painted twice for GraphicsLayers of container and scroll
ing contents. | 198 // scrolling and is painted twice for GraphicsLayers of container and scroll
ing contents. |
| 196 if (paintLayer.compositingState() == PaintsIntoOwnBacking) | 199 if (paintLayer.compositingState() == PaintsIntoOwnBacking) |
| 197 return false; | 200 return false; |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun
dRect)) { | 735 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun
dRect)) { |
| 733 clipRecorder.emplace(context, *m_paintLayer.layoutObject(), DisplayItem:
:ClipLayerForeground, layerFragments[0].foregroundRect, &localPaintingInfo, laye
rFragments[0].paginationOffset, paintFlags); | 736 clipRecorder.emplace(context, *m_paintLayer.layoutObject(), DisplayItem:
:ClipLayerForeground, layerFragments[0].foregroundRect, &localPaintingInfo, laye
rFragments[0].paginationOffset, paintFlags); |
| 734 clipState = HasClipped; | 737 clipState = HasClipped; |
| 735 } | 738 } |
| 736 | 739 |
| 737 // We have to loop through every fragment multiple times, since we have to i
ssue paint invalidations in each specific phase in order for | 740 // We have to loop through every fragment multiple times, since we have to i
ssue paint invalidations in each specific phase in order for |
| 738 // interleaving of the fragments to work properly. | 741 // interleaving of the fragments to work properly. |
| 739 if (selectionOnly) { | 742 if (selectionOnly) { |
| 740 paintForegroundForFragmentsWithPhase(PaintPhaseSelection, layerFragments
, context, localPaintingInfo, paintFlags, clipState); | 743 paintForegroundForFragmentsWithPhase(PaintPhaseSelection, layerFragments
, context, localPaintingInfo, paintFlags, clipState); |
| 741 } else { | 744 } else { |
| 742 if (m_paintLayer.needsPaintPhaseDescendantBlockBackgrounds()) | 745 if (!RuntimeEnabledFeatures::paintOptimizationsEnabled() || m_paintLayer
.needsPaintPhaseDescendantBlockBackgrounds()) |
| 743 paintForegroundForFragmentsWithPhase(PaintPhaseDescendantBlockBackgr
oundsOnly, layerFragments, context, localPaintingInfo, paintFlags, clipState); | 746 paintForegroundForFragmentsWithPhase(PaintPhaseDescendantBlockBackgr
oundsOnly, layerFragments, context, localPaintingInfo, paintFlags, clipState); |
| 744 if (m_paintLayer.needsPaintPhaseFloat()) | 747 if (!RuntimeEnabledFeatures::paintOptimizationsEnabled() || m_paintLayer
.needsPaintPhaseFloat()) |
| 745 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments
, context, localPaintingInfo, paintFlags, clipState); | 748 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments
, context, localPaintingInfo, paintFlags, clipState); |
| 746 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragment
s, context, localPaintingInfo, paintFlags, clipState); | 749 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragment
s, context, localPaintingInfo, paintFlags, clipState); |
| 747 if (m_paintLayer.needsPaintPhaseDescendantOutlines()) | 750 if (!RuntimeEnabledFeatures::paintOptimizationsEnabled() || m_paintLayer
.needsPaintPhaseDescendantOutlines()) |
| 748 paintForegroundForFragmentsWithPhase(PaintPhaseDescendantOutlinesOnl
y, layerFragments, context, localPaintingInfo, paintFlags, clipState); | 751 paintForegroundForFragmentsWithPhase(PaintPhaseDescendantOutlinesOnl
y, layerFragments, context, localPaintingInfo, paintFlags, clipState); |
| 749 } | 752 } |
| 750 } | 753 } |
| 751 | 754 |
| 752 void PaintLayerPainter::paintForegroundForFragmentsWithPhase(PaintPhase phase, | 755 void PaintLayerPainter::paintForegroundForFragmentsWithPhase(PaintPhase phase, |
| 753 const PaintLayerFragments& layerFragments, GraphicsContext& context, | 756 const PaintLayerFragments& layerFragments, GraphicsContext& context, |
| 754 const PaintLayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags,
ClipState clipState) | 757 const PaintLayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags,
ClipState clipState) |
| 755 { | 758 { |
| 756 bool needsScope = layerFragments.size() > 1; | 759 bool needsScope = layerFragments.size() > 1; |
| 757 for (auto& fragment : layerFragments) { | 760 for (auto& fragment : layerFragments) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 if (!m_paintLayer.containsDirtyOverlayScrollbars()) | 810 if (!m_paintLayer.containsDirtyOverlayScrollbars()) |
| 808 return; | 811 return; |
| 809 | 812 |
| 810 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe
ct(damageRect)), paintFlags, LayoutSize()); | 813 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe
ct(damageRect)), paintFlags, LayoutSize()); |
| 811 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 814 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
| 812 | 815 |
| 813 m_paintLayer.setContainsDirtyOverlayScrollbars(false); | 816 m_paintLayer.setContainsDirtyOverlayScrollbars(false); |
| 814 } | 817 } |
| 815 | 818 |
| 816 } // namespace blink | 819 } // namespace blink |
| OLD | NEW |