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

Unified Diff: Source/core/paint/DeprecatedPaintLayer.cpp

Issue 1294233004: Subtree caching implementation in blink-core (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Don't mark non-self-painting layers for needsRepaint Created 5 years, 4 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 | « Source/core/paint/DeprecatedPaintLayer.h ('k') | Source/core/paint/DeprecatedPaintLayerPainter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/DeprecatedPaintLayer.cpp
diff --git a/Source/core/paint/DeprecatedPaintLayer.cpp b/Source/core/paint/DeprecatedPaintLayer.cpp
index 3d6d6c233c58510dd84cf70a54fe79ad11432959..29c0f4bca89cbee090098a58324a430b07e04553 100644
--- a/Source/core/paint/DeprecatedPaintLayer.cpp
+++ b/Source/core/paint/DeprecatedPaintLayer.cpp
@@ -123,6 +123,7 @@ DeprecatedPaintLayer::DeprecatedPaintLayer(LayoutBoxModelObject* layoutObject, D
, m_hasNonCompositedChild(false)
, m_shouldIsolateCompositedDescendants(false)
, m_lostGroupedMapping(false)
+ , m_needsRepaint(false)
, m_layoutObject(layoutObject)
, m_parent(0)
, m_previous(0)
@@ -858,13 +859,13 @@ LayoutPoint DeprecatedPaintLayer::computeOffsetFromTransformedAncestor() const
return LayoutPoint(transformState.lastPlanarPoint());
}
-const DeprecatedPaintLayer* DeprecatedPaintLayer::compositingContainer() const
+DeprecatedPaintLayer* DeprecatedPaintLayer::compositingContainer() const
{
if (!stackingNode()->isTreatedAsStackingContextForPainting())
return parent();
if (DeprecatedPaintLayerStackingNode* ancestorStackingNode = stackingNode()->ancestorStackingContextNode())
return ancestorStackingNode->layer();
- return 0;
+ return nullptr;
}
bool DeprecatedPaintLayer::isPaintInvalidationContainer() const
@@ -881,12 +882,12 @@ DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingLayerWithCompositedDeprecat
if ((includeSelf == IncludeSelf) && compositingState() != NotComposited && compositingState() != PaintsIntoGroupedBacking)
return const_cast<DeprecatedPaintLayer*>(this);
- for (const DeprecatedPaintLayer* curr = compositingContainer(); curr; curr = curr->compositingContainer()) {
+ for (DeprecatedPaintLayer* curr = compositingContainer(); curr; curr = curr->compositingContainer()) {
if (curr->compositingState() != NotComposited && curr->compositingState() != PaintsIntoGroupedBacking)
- return const_cast<DeprecatedPaintLayer*>(curr);
+ return curr;
}
- return 0;
+ return nullptr;
}
// Return the enclosingCompositedLayerForPaintInvalidation for the given Layer
@@ -914,12 +915,12 @@ DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingLayerForPaintInvalidation()
if (isPaintInvalidationContainer())
return const_cast<DeprecatedPaintLayer*>(this);
- for (const DeprecatedPaintLayer* curr = compositingContainer(); curr; curr = curr->compositingContainer()) {
+ for (DeprecatedPaintLayer* curr = compositingContainer(); curr; curr = curr->compositingContainer()) {
if (curr->isPaintInvalidationContainer())
- return const_cast<DeprecatedPaintLayer*>(curr);
+ return curr;
}
- return 0;
+ return nullptr;
}
void DeprecatedPaintLayer::setNeedsCompositingInputsUpdate()
@@ -2686,6 +2687,41 @@ void DeprecatedPaintLayer::computeSelfHitTestRects(LayerHitTestRects& rects) con
}
}
+void DeprecatedPaintLayer::setNeedsRepaint()
+{
+ ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
+
+ DeprecatedPaintLayer* layer = this;
+ while (!layer->isSelfPaintingLayer() && !layer->hasSelfPaintingLayerDescendant()) {
+ layer = layer->parent();
+ ASSERT(layer); // At least the root layer is self painting.
+ }
+
+ if (layer->m_needsRepaint)
+ return;
+ layer->m_needsRepaint = true;
+ layer->markCompositingContainerChainForNeedsRepaint();
+}
+
+void DeprecatedPaintLayer::markCompositingContainerChainForNeedsRepaint()
+{
+ DeprecatedPaintLayer* layer = this;
+ while (true) {
+ DeprecatedPaintLayer* container = layer->compositingContainer();
+ if (!container) {
+ LayoutObject* owner = layer->layoutObject()->frame()->ownerLayoutObject();
+ if (!owner)
+ break;
+ container = owner->enclosingLayer();
+ }
+ if (container->m_needsRepaint)
+ break;
+ if (container->isSelfPaintingLayer() || container->hasSelfPaintingLayerDescendant())
+ container->m_needsRepaint = true;
+ layer = container;
+ }
+}
+
DisableCompositingQueryAsserts::DisableCompositingQueryAsserts()
: m_disabler(gCompositingQueryMode, CompositingQueriesAreAllowed) { }
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayer.h ('k') | Source/core/paint/DeprecatedPaintLayerPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698