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

Unified Diff: Source/core/layout/LayoutObject.cpp

Issue 1315213002: (WIP) Paint invalidation for slimming paint v2 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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/layout/LayoutObject.h ('k') | Source/core/layout/LayoutTable.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutObject.cpp
diff --git a/Source/core/layout/LayoutObject.cpp b/Source/core/layout/LayoutObject.cpp
index 330908c1373a39287787cecc3288ad5f4e1e4e70..b77a062f89d9d694bd70ee39b113cef197595cf0 100644
--- a/Source/core/layout/LayoutObject.cpp
+++ b/Source/core/layout/LayoutObject.cpp
@@ -673,6 +673,9 @@ LayoutFlowThread* LayoutObject::locateFlowThreadContainingBlock() const
return LayoutFlowThread::locateFlowThreadContainingBlockOf(*this);
}
+// TODO: May remove this for slimming paint v2 because if the object paints
+// nothing, then repainting is fast and invalidation of it won't generate any
+// rastarization invalidation.
bool LayoutObject::skipInvalidationWhenLaidOutChildren() const
{
if (!m_bitfields.neededLayoutBecauseOfChildren())
@@ -1044,6 +1047,11 @@ const LayoutBoxModelObject& LayoutObject::containerForPaintInvalidationOnRootedT
const LayoutBoxModelObject* LayoutObject::enclosingCompositedContainer() const
{
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
+ // Get the LayoutView of the top level frame. This is temporary before we remove blink compositing.
+ return adjustCompositedContainerForSpecialAncestors(nullptr);
+ }
+
LayoutBoxModelObject* container = nullptr;
// FIXME: CompositingState is not necessarily up to date for many callers of this function.
DisableCompositingQueryAsserts disabler;
@@ -1204,7 +1212,7 @@ void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain
void LayoutObject::setNeedsRepaint()
{
ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
- ASSERT(document().lifecycle().state() <= DocumentLifecycle::InPaintInvalidation);
+ ASSERT(document().lifecycle().state() <= DocumentLifecycle::InPaintForSlimmingPaintV2);
if (!selfNeedsRepaint()) {
m_bitfields.setSelfNeedsRepaint(true);
@@ -1215,7 +1223,7 @@ void LayoutObject::setNeedsRepaint()
void LayoutObject::setChildNeedsRepaint()
{
ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
- ASSERT(document().lifecycle().state() <= DocumentLifecycle::InPaintInvalidation);
+ ASSERT(document().lifecycle().state() <= DocumentLifecycle::InPaintForSlimmingPaintV2);
if (!childNeedsRepaint()) {
m_bitfields.setChildNeedsRepaint(true);
@@ -1443,6 +1451,37 @@ PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(PaintInvalidationS
return invalidationReason;
}
+PaintInvalidationReason LayoutObject::invalidatePaintIfNeededForSlimmingPaintV2(const LayoutPoint& newPaintOffset)
+{
+ ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
+ if (!selfShouldCheckForPaintInvalidation())
+ return PaintInvalidationNone;
+
+ LayoutPoint oldPaintOffset = m_previousPaintOffset;
+ m_previousPaintOffset = newPaintOffset;
+
+ const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintInvalidationOnRootedTree(); // This is fast for slimming paint v2.
+ PaintInvalidationReason invalidationReason = paintInvalidationReason(paintInvalidationContainer, LayoutRect(), oldPaintOffset, LayoutRect(), newPaintOffset);
+
+ bool boxDecorationBackgroundObscured = boxDecorationBackgroundIsKnownToBeObscured();
+ if (!isFullPaintInvalidationReason(invalidationReason) && boxDecorationBackgroundObscured != m_bitfields.lastBoxDecorationBackgroundObscured())
+ invalidationReason = PaintInvalidationBackgroundObscurationChange;
+ m_bitfields.setLastBoxDecorationBackgroundObscured(boxDecorationBackgroundObscured);
+
+ TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject::invalidatePaintIfNeededForSlimmingPaintV2()",
+ "object", this->debugName().ascii(),
+ // TODO: Update the function to reflect new meanings.
+ "", jsonObjectForOldAndNewRects(LayoutRect(), oldPaintOffset, LayoutRect(), newPaintOffset));
+
+ if (invalidationReason == PaintInvalidationNone)
+ return invalidationReason;
+
+ invalidateDisplayItemClients(paintInvalidationContainer);
+
+ clearSelfPaintInvalidationFlags();
+ return invalidationReason;
+}
+
PaintInvalidationReason LayoutObject::paintInvalidationReason(const LayoutBoxModelObject& paintInvalidationContainer,
const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalidationBacking,
const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInvalidationBacking) const
@@ -3232,6 +3271,11 @@ inline void LayoutObject::markContainerChainForPaintInvalidation()
void LayoutObject::setShouldInvalidateSelection()
{
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
+ setShouldDoFullPaintInvalidation(PaintInvalidationSelection);
+ return;
+ }
+
if (!canUpdateSelectionOnRootLineBoxes())
return;
@@ -3273,8 +3317,13 @@ void LayoutObject::clearPaintInvalidationState(const PaintInvalidationState& pai
// paintInvalidationStateIsDirty should be kept in sync with the
// booleans that are cleared below.
ASSERT(paintInvalidationState.ancestorHadPaintInvalidationForLocationChange() || paintInvalidationStateIsDirty());
- clearShouldDoFullPaintInvalidation();
m_bitfields.setChildShouldCheckForPaintInvalidation(false);
+ clearSelfPaintInvalidationFlags();
+}
+
+void LayoutObject::clearSelfPaintInvalidationFlags()
+{
+ clearShouldDoFullPaintInvalidation();
m_bitfields.setNeededLayoutBecauseOfChildren(false);
m_bitfields.setShouldInvalidateOverflowForPaint(false);
m_bitfields.setMayNeedPaintInvalidation(false);
« no previous file with comments | « Source/core/layout/LayoutObject.h ('k') | Source/core/layout/LayoutTable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698