Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(562)

Unified Diff: third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPainter.cpp

Issue 1375393002: Output subsequence for children layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix blink_platform_unittests and address pdr's comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPainter.cpp b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPainter.cpp
index 1d3ec1dd161fab0c2ee0e6d031e9614376a5a082..e036df4ee69393769a533f0e71692e1001bd157c 100644
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPainter.cpp
@@ -220,28 +220,8 @@ DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintLayer
if (paintFlags & PaintLayerPaintingRootBackgroundOnly && !m_paintLayer.layoutObject()->isLayoutView() && !m_paintLayer.layoutObject()->isDocumentElement())
return result;
- Optional<SubsequenceRecorder> subsequenceRecorder;
-
- bool scrollOffsetAccumulationChanged = paintingInfoArg.scrollOffsetAccumulation != m_paintLayer.previousScrollOffsetAccumulationForPainting();
- if (scrollOffsetAccumulationChanged)
- m_paintLayer.setPreviousScrollOffsetAccumulationForPainting(paintingInfoArg.scrollOffsetAccumulation);
-
- if (!isPaintingOverlayScrollbars
- && !paintingInfoArg.disableSubsequenceCache
- && !(paintingInfoArg.globalPaintFlags() & GlobalPaintFlattenCompositingLayers)
- && !(paintFlags & PaintLayerPaintingReflection)
- && !(paintFlags & PaintLayerPaintingRootBackgroundOnly)) {
- if (!scrollOffsetAccumulationChanged && !m_paintLayer.needsRepaint() && SubsequenceRecorder::useCachedSubsequenceIfPossible(*context, m_paintLayer))
- return result;
- subsequenceRecorder.emplace(*context, m_paintLayer);
- }
-
DeprecatedPaintLayerPaintingInfo paintingInfo = paintingInfoArg;
- if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()
- && (m_paintLayer.layoutObject()->hasOverflowClip() || m_paintLayer.layoutObject()->hasClip()))
- paintingInfo.disableSubsequenceCache = true;
-
// Ensure our lists are up-to-date.
m_paintLayer.stackingNode()->updateLayerListsIfNeeded();
@@ -356,10 +336,7 @@ DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintLayer
paintChildClippingMaskForFragments(layerFragments, context, localPaintingInfo, paintingRootForLayoutObject, paintFlags);
}
- // Set subsequence not cacheable if the bounding box of this layer and descendants is not fully contained
- // by paintRect, because later paintRect changes may expose new contents which will need repainting.
- if (result == MaybeNotFullyPainted && subsequenceRecorder)
- subsequenceRecorder->setUncacheable();
+ m_paintLayer.setPreviousScrollOffsetAccumulationForPainting(paintingInfoArg.scrollOffsetAccumulation);
return result;
}
@@ -492,12 +469,39 @@ DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintChild
LayerListMutationDetector mutationChecker(m_paintLayer.stackingNode());
#endif
- IntSize scrollOffsetAccumulation = paintingInfo.scrollOffsetAccumulation;
+ DeprecatedPaintLayerStackingNodeIterator iterator(*m_paintLayer.stackingNode(), childrenToVisit);
+ DeprecatedPaintLayerStackingNode* child = iterator.next();
+ if (!child)
+ return result;
+
+ DisplayItem::Type subsequenceType;
+ if (childrenToVisit == NegativeZOrderChildren) {
+ subsequenceType = DisplayItem::SubsequenceNegativeZOrder;
+ } else {
+ ASSERT(childrenToVisit == (NormalFlowChildren | PositiveZOrderChildren));
+ subsequenceType = DisplayItem::SubsequenceNormalFlowAndPositiveZOrder;
+ }
+
+ Optional<SubsequenceRecorder> subsequenceRecorder;
+ if (!paintingInfo.disableSubsequenceCache
+ && !(paintingInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLayers)
+ && !(paintFlags & PaintLayerPaintingReflection)
+ && !(paintFlags & PaintLayerPaintingRootBackgroundOnly)) {
+ if (!m_paintLayer.needsRepaint()
+ && paintingInfo.scrollOffsetAccumulation == m_paintLayer.previousScrollOffsetAccumulationForPainting()
+ && SubsequenceRecorder::useCachedSubsequenceIfPossible(*context, m_paintLayer, subsequenceType))
+ return result;
+ subsequenceRecorder.emplace(*context, m_paintLayer, subsequenceType);
+ }
+
+ IntSize scrollOffsetAccumulationForChildren = paintingInfo.scrollOffsetAccumulation;
if (m_paintLayer.layoutObject()->hasOverflowClip())
- scrollOffsetAccumulation += m_paintLayer.layoutBox()->scrolledContentOffset();
+ scrollOffsetAccumulationForChildren += m_paintLayer.layoutBox()->scrolledContentOffset();
- DeprecatedPaintLayerStackingNodeIterator iterator(*m_paintLayer.stackingNode(), childrenToVisit);
- while (DeprecatedPaintLayerStackingNode* child = iterator.next()) {
+ bool disableChildSubsequenceCache = !RuntimeEnabledFeatures::slimmingPaintV2Enabled()
pdr. 2015/09/30 23:36:54 Nit: Should this be !RuntimeEnabledFeatures::slimm
Xianzhu 2015/09/30 23:48:48 No. This is to workaround the effect of ancestor c
+ && (m_paintLayer.layoutObject()->hasOverflowClip() || m_paintLayer.layoutObject()->hasClip());
+
+ for (; child; child = iterator.next()) {
DeprecatedPaintLayerPainter childPainter(*child->layer());
// If this Layer should paint into its own backing or a grouped backing, that will be done via CompositedDeprecatedPaintLayerMapping::paintContents()
// and CompositedDeprecatedPaintLayerMapping::doPaintTask().
@@ -505,7 +509,8 @@ DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintChild
continue;
DeprecatedPaintLayerPaintingInfo childPaintingInfo = paintingInfo;
- childPaintingInfo.scrollOffsetAccumulation = scrollOffsetAccumulation;
+ childPaintingInfo.disableSubsequenceCache = disableChildSubsequenceCache;
+ childPaintingInfo.scrollOffsetAccumulation = scrollOffsetAccumulationForChildren;
// Rare case: accumulate scroll offset of non-stacking-context ancestors up to m_paintLayer.
for (DeprecatedPaintLayer* parentLayer = child->layer()->parent(); parentLayer != &m_paintLayer; parentLayer = parentLayer->parent()) {
if (parentLayer->layoutObject()->hasOverflowClip())
@@ -515,6 +520,12 @@ DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintChild
if (childPainter.paintLayer(context, childPaintingInfo, paintFlags) == MaybeNotFullyPainted)
result = MaybeNotFullyPainted;
}
+
+ // Set subsequence not cacheable if the bounding box of this layer and descendants is not fully contained
+ // by paintRect, because later paintRect changes may expose new contents which will need repainting.
+ if (result == MaybeNotFullyPainted && subsequenceRecorder)
+ subsequenceRecorder->setUncacheable();
+
return result;
}

Powered by Google App Engine
This is Rietveld 408576698