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

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: Rebase 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPainterTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..663a4032a672cb52cf9d59c64ea9f0c199313be0 100644
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPainter.cpp
@@ -220,22 +220,6 @@ 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()
@@ -356,10 +340,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,20 +473,45 @@ 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()) {
+ 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().
- if (!childPainter.shouldPaintLayerInSoftwareMode(paintingInfo.globalPaintFlags(), paintFlags))
+ if (!childPainter.shouldPaintLayerInSoftwareMode(paintingInfo.globalPaintFlags(), paintFlags)) {
pdr. 2015/09/30 23:11:56 Nit: extra curly braces.
Xianzhu 2015/09/30 23:29:47 Done.
continue;
+ }
DeprecatedPaintLayerPaintingInfo childPaintingInfo = paintingInfo;
- childPaintingInfo.scrollOffsetAccumulation = scrollOffsetAccumulation;
+ 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 +521,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;
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPainterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698