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

Side by Side Diff: Source/core/rendering/RenderObject.cpp

Issue 620553009: Move selection invalidations to the invalidation phase (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added missing expectation Created 6 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForOldAndNewRe cts(const LayoutRect& oldRect, const LayoutPoint& oldLocation, const LayoutRect& newRect, const LayoutPoint& newLocation) 1271 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForOldAndNewRe cts(const LayoutRect& oldRect, const LayoutPoint& oldLocation, const LayoutRect& newRect, const LayoutPoint& newLocation)
1272 { 1272 {
1273 RefPtr<TracedValue> value = TracedValue::create(); 1273 RefPtr<TracedValue> value = TracedValue::create();
1274 addJsonObjectForRect(value.get(), "oldRect", oldRect); 1274 addJsonObjectForRect(value.get(), "oldRect", oldRect);
1275 addJsonObjectForPoint(value.get(), "oldLocation", oldLocation); 1275 addJsonObjectForPoint(value.get(), "oldLocation", oldLocation);
1276 addJsonObjectForRect(value.get(), "newRect", newRect); 1276 addJsonObjectForRect(value.get(), "newRect", newRect);
1277 addJsonObjectForPoint(value.get(), "newLocation", newLocation); 1277 addJsonObjectForPoint(value.get(), "newLocation", newLocation);
1278 return value; 1278 return value;
1279 } 1279 }
1280 1280
1281 void RenderObject::invalidateSelectionIfNeeded(const RenderLayerModelObject& pai ntInvalidationContainer) const
dsinclair 2014/10/01 17:13:32 Should this be non-const? Its issuing invalidation
Julien - ping for review 2014/10/01 18:18:22 Done.
1282 {
1283 if (!shouldInvalidateSelection())
1284 return;
1285
1286 LayoutRect selection = selectionRectForPaintInvalidation(&paintInvalidationC ontainer);
1287 // FIXME: groupedMapping() leaks the squashing abstraction. See RenderBlockS electionInfo for more details.
1288 if (paintInvalidationContainer.layer()->groupedMapping())
1289 RenderLayer::mapRectToPaintBackingCoordinates(&paintInvalidationContaine r, selection);
1290 invalidatePaintUsingContainer(&paintInvalidationContainer, selection, Invali dationSelection);
1291 }
1292
1281 InvalidationReason RenderObject::invalidatePaintIfNeeded(const PaintInvalidation State& paintInvalidationState, const RenderLayerModelObject& paintInvalidationCo ntainer) 1293 InvalidationReason RenderObject::invalidatePaintIfNeeded(const PaintInvalidation State& paintInvalidationState, const RenderLayerModelObject& paintInvalidationCo ntainer)
1282 { 1294 {
1283 RenderView* v = view(); 1295 RenderView* v = view();
1284 if (v->document().printing()) 1296 if (v->document().printing())
1285 return InvalidationNone; // Don't invalidate paints if we're printing. 1297 return InvalidationNone; // Don't invalidate paints if we're printing.
1286 1298
1287 const LayoutRect oldBounds = previousPaintInvalidationRect(); 1299 const LayoutRect oldBounds = previousPaintInvalidationRect();
1288 const LayoutPoint oldLocation = previousPositionFromPaintInvalidationBacking (); 1300 const LayoutPoint oldLocation = previousPositionFromPaintInvalidationBacking ();
1289 const LayoutRect newBounds = boundsRectForPaintInvalidation(&paintInvalidati onContainer, &paintInvalidationState); 1301 const LayoutRect newBounds = boundsRectForPaintInvalidation(&paintInvalidati onContainer, &paintInvalidationState);
1290 const LayoutPoint newLocation = RenderLayer::positionFromPaintInvalidationBa cking(this, &paintInvalidationContainer, &paintInvalidationState); 1302 const LayoutPoint newLocation = RenderLayer::positionFromPaintInvalidationBa cking(this, &paintInvalidationContainer, &paintInvalidationState);
1291 setPreviousPaintInvalidationRect(newBounds); 1303 setPreviousPaintInvalidationRect(newBounds);
1292 setPreviousPositionFromPaintInvalidationBacking(newLocation); 1304 setPreviousPositionFromPaintInvalidationBacking(newLocation);
1293 1305
1294 // If we are set to do a full paint invalidation that means the RenderView w ill issue 1306 // If we are set to do a full paint invalidation that means the RenderView w ill issue
1295 // paint invalidations. We can then skip issuing of paint invalidations for the child 1307 // paint invalidations. We can then skip issuing of paint invalidations for the child
1296 // renderers as they'll be covered by the RenderView. 1308 // renderers as they'll be covered by the RenderView.
1297 if (view()->doingFullPaintInvalidation()) 1309 if (view()->doingFullPaintInvalidation())
1298 return InvalidationNone; 1310 return InvalidationNone;
1299 1311
1300 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject: :invalidatePaintIfNeeded()", 1312 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject: :invalidatePaintIfNeeded()",
1301 "object", this->debugName().ascii(), 1313 "object", this->debugName().ascii(),
1302 "info", jsonObjectForOldAndNewRects(oldBounds, oldLocation, newBounds, n ewLocation)); 1314 "info", jsonObjectForOldAndNewRects(oldBounds, oldLocation, newBounds, n ewLocation));
1303 1315
1304 InvalidationReason invalidationReason = getPaintInvalidationReason(paintInva lidationContainer, oldBounds, oldLocation, newBounds, newLocation); 1316 InvalidationReason invalidationReason = getPaintInvalidationReason(paintInva lidationContainer, oldBounds, oldLocation, newBounds, newLocation);
1305 1317
1318 invalidateSelectionIfNeeded(paintInvalidationContainer);
1319
1306 if (invalidationReason == InvalidationNone) 1320 if (invalidationReason == InvalidationNone)
1307 return invalidationReason; 1321 return invalidationReason;
1308 1322
1309 if (invalidationReason == InvalidationIncremental) { 1323 if (invalidationReason == InvalidationIncremental) {
1310 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB ounds, newLocation); 1324 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB ounds, newLocation);
1311 return invalidationReason; 1325 return invalidationReason;
1312 } 1326 }
1313 1327
1314 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun ds, newBounds); 1328 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun ds, newBounds);
1315 return invalidationReason; 1329 return invalidationReason;
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after
3106 // paintInvalidationStateIsDirty should be kept in sync with the 3120 // paintInvalidationStateIsDirty should be kept in sync with the
3107 // booleans that are cleared below. 3121 // booleans that are cleared below.
3108 ASSERT(paintInvalidationState.forceCheckForPaintInvalidation() || paintInval idationStateIsDirty()); 3122 ASSERT(paintInvalidationState.forceCheckForPaintInvalidation() || paintInval idationStateIsDirty());
3109 setShouldDoFullPaintInvalidation(false); 3123 setShouldDoFullPaintInvalidation(false);
3110 setShouldDoFullPaintInvalidationIfSelfPaintingLayer(false); 3124 setShouldDoFullPaintInvalidationIfSelfPaintingLayer(false);
3111 setOnlyNeededPositionedMovementLayout(false); 3125 setOnlyNeededPositionedMovementLayout(false);
3112 setNeededLayoutBecauseOfChildren(false); 3126 setNeededLayoutBecauseOfChildren(false);
3113 setShouldInvalidateOverflowForPaint(false); 3127 setShouldInvalidateOverflowForPaint(false);
3114 setLayoutDidGetCalled(false); 3128 setLayoutDidGetCalled(false);
3115 setMayNeedPaintInvalidation(false); 3129 setMayNeedPaintInvalidation(false);
3130 clearShouldInvalidateSelection();
3116 } 3131 }
3117 3132
3118 bool RenderObject::isAllowedToModifyRenderTreeStructure(Document& document) 3133 bool RenderObject::isAllowedToModifyRenderTreeStructure(Document& document)
3119 { 3134 {
3120 return DeprecatedDisableModifyRenderTreeStructureAsserts::canModifyRenderTre eStateInAnyState() 3135 return DeprecatedDisableModifyRenderTreeStructureAsserts::canModifyRenderTre eStateInAnyState()
3121 || document.lifecycle().stateAllowsRenderTreeMutations(); 3136 || document.lifecycle().stateAllowsRenderTreeMutations();
3122 } 3137 }
3123 3138
3124 DeprecatedDisableModifyRenderTreeStructureAsserts::DeprecatedDisableModifyRender TreeStructureAsserts() 3139 DeprecatedDisableModifyRenderTreeStructureAsserts::DeprecatedDisableModifyRender TreeStructureAsserts()
3125 : m_disabler(gModifyRenderTreeStructureAnyState, true) 3140 : m_disabler(gModifyRenderTreeStructureAnyState, true)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
3173 { 3188 {
3174 if (object1) { 3189 if (object1) {
3175 const blink::RenderObject* root = object1; 3190 const blink::RenderObject* root = object1;
3176 while (root->parent()) 3191 while (root->parent())
3177 root = root->parent(); 3192 root = root->parent();
3178 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3193 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3179 } 3194 }
3180 } 3195 }
3181 3196
3182 #endif 3197 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698