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

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

Issue 665673004: Move selection invalidation to the invalidation phase (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Tentative fix, up for slammin' reviews Created 6 years, 1 month 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
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 void* pointers[5]; 123 void* pointers[5];
124 #if ENABLE(ASSERT) 124 #if ENABLE(ASSERT)
125 unsigned m_debugBitfields : 2; 125 unsigned m_debugBitfields : 2;
126 #if ENABLE(OILPAN) 126 #if ENABLE(OILPAN)
127 unsigned m_oilpanBitfields : 1; 127 unsigned m_oilpanBitfields : 1;
128 #endif 128 #endif
129 #endif 129 #endif
130 unsigned m_bitfields; 130 unsigned m_bitfields;
131 unsigned m_bitfields2; 131 unsigned m_bitfields2;
132 LayoutRect rect; // Stores the previous paint invalidation rect. 132 LayoutRect rect; // Stores the previous paint invalidation rect.
133 LayoutRect rect2; // Stores the previous selection paint invalidation rect.
dsinclair 2014/10/31 14:03:15 Would something like the following be better? Lay
133 LayoutPoint position; // Stores the previous position from the paint invalid ation container. 134 LayoutPoint position; // Stores the previous position from the paint invalid ation container.
134 }; 135 };
135 136
136 COMPILE_ASSERT(sizeof(RenderObject) == sizeof(SameSizeAsRenderObject), RenderObj ect_should_stay_small); 137 COMPILE_ASSERT(sizeof(RenderObject) == sizeof(SameSizeAsRenderObject), RenderObj ect_should_stay_small);
137 138
138 bool RenderObject::s_affectsParentBlock = false; 139 bool RenderObject::s_affectsParentBlock = false;
139 140
140 #if !ENABLE(OILPAN) 141 #if !ENABLE(OILPAN)
141 void* RenderObject::operator new(size_t sz) 142 void* RenderObject::operator new(size_t sz)
142 { 143 {
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 addJsonObjectForRect(value.get(), "newRect", newRect); 1240 addJsonObjectForRect(value.get(), "newRect", newRect);
1240 addJsonObjectForPoint(value.get(), "newLocation", newLocation); 1241 addJsonObjectForPoint(value.get(), "newLocation", newLocation);
1241 return value; 1242 return value;
1242 } 1243 }
1243 1244
1244 void RenderObject::invalidateSelectionIfNeeded(const RenderLayerModelObject& pai ntInvalidationContainer) 1245 void RenderObject::invalidateSelectionIfNeeded(const RenderLayerModelObject& pai ntInvalidationContainer)
1245 { 1246 {
1246 if (!shouldInvalidateSelection()) 1247 if (!shouldInvalidateSelection())
1247 return; 1248 return;
1248 1249
1249 LayoutRect selection = selectionRectForPaintInvalidation(&paintInvalidationC ontainer); 1250 LayoutRect oldSelectionRect = m_previousSelectionRectForPaintInvalidation;
1250 // FIXME: groupedMapping() leaks the squashing abstraction. See RenderBlockS electionInfo for more details. 1251 m_previousSelectionRectForPaintInvalidation = selectionRectForPaintInvalidat ion(&paintInvalidationContainer);
1252 // FIXME: groupedMapping() leaks the squashing abstraction.
1251 if (paintInvalidationContainer.layer()->groupedMapping()) 1253 if (paintInvalidationContainer.layer()->groupedMapping())
1252 RenderLayer::mapRectToPaintBackingCoordinates(&paintInvalidationContaine r, selection); 1254 RenderLayer::mapRectToPaintBackingCoordinates(&paintInvalidationContaine r, m_previousSelectionRectForPaintInvalidation);
1253 invalidatePaintUsingContainer(&paintInvalidationContainer, selection, PaintI nvalidationSelection); 1255
1256 if (view()->doingFullPaintInvalidation())
1257 return;
1258
1259 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelection, oldSelectionRect, m_previousSelectionRectForPaintInvalidation);
1254 } 1260 }
1255 1261
1256 PaintInvalidationReason RenderObject::invalidatePaintIfNeeded(const PaintInvalid ationState& paintInvalidationState, const RenderLayerModelObject& paintInvalidat ionContainer) 1262 PaintInvalidationReason RenderObject::invalidatePaintIfNeeded(const PaintInvalid ationState& paintInvalidationState, const RenderLayerModelObject& paintInvalidat ionContainer)
1257 { 1263 {
1258 RenderView* v = view(); 1264 RenderView* v = view();
1259 if (v->document().printing()) 1265 if (v->document().printing())
1260 return PaintInvalidationNone; // Don't invalidate paints if we're printi ng. 1266 return PaintInvalidationNone; // Don't invalidate paints if we're printi ng.
1261 1267
1262 const LayoutRect oldBounds = previousPaintInvalidationRect(); 1268 const LayoutRect oldBounds = previousPaintInvalidationRect();
1263 const LayoutPoint oldLocation = previousPositionFromPaintInvalidationBacking (); 1269 const LayoutPoint oldLocation = previousPositionFromPaintInvalidationBacking ();
1264 const LayoutRect newBounds = boundsRectForPaintInvalidation(&paintInvalidati onContainer, &paintInvalidationState); 1270 const LayoutRect newBounds = boundsRectForPaintInvalidation(&paintInvalidati onContainer, &paintInvalidationState);
1265 const LayoutPoint newLocation = RenderLayer::positionFromPaintInvalidationBa cking(this, &paintInvalidationContainer, &paintInvalidationState); 1271 const LayoutPoint newLocation = RenderLayer::positionFromPaintInvalidationBa cking(this, &paintInvalidationContainer, &paintInvalidationState);
1266 setPreviousPaintInvalidationRect(newBounds); 1272 setPreviousPaintInvalidationRect(newBounds);
1267 setPreviousPositionFromPaintInvalidationBacking(newLocation); 1273 setPreviousPositionFromPaintInvalidationBacking(newLocation);
1268 1274
1275 // We need to invalidate the selection before checking for whether we are do ing a full invalidation.
1276 // This is because we need to update the old rect regardless.
1277 invalidateSelectionIfNeeded(paintInvalidationContainer);
dsinclair 2014/10/31 14:03:16 We need to update the rect regardless, but we don'
Julien - ping for review 2014/10/31 22:31:03 It was easy to do, added it.
1278
1269 PaintInvalidationReason invalidationReason = paintInvalidationReason(paintIn validationContainer, oldBounds, oldLocation, newBounds, newLocation); 1279 PaintInvalidationReason invalidationReason = paintInvalidationReason(paintIn validationContainer, oldBounds, oldLocation, newBounds, newLocation);
1270 1280
1271 // If we are set to do a full paint invalidation that means the RenderView w ill issue 1281 // If we are set to do a full paint invalidation that means the RenderView w ill issue
1272 // paint invalidations. We can then skip issuing of paint invalidations for the child 1282 // paint invalidations. We can then skip issuing of paint invalidations for the child
1273 // renderers as they'll be covered by the RenderView. 1283 // renderers as they'll be covered by the RenderView.
1274 if (view()->doingFullPaintInvalidation()) 1284 if (view()->doingFullPaintInvalidation())
1275 return invalidationReason; 1285 return invalidationReason;
1276 1286
1277 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject: :invalidatePaintIfNeeded()", 1287 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject: :invalidatePaintIfNeeded()",
1278 "object", this->debugName().ascii(), 1288 "object", this->debugName().ascii(),
1279 "info", jsonObjectForOldAndNewRects(oldBounds, oldLocation, newBounds, n ewLocation)); 1289 "info", jsonObjectForOldAndNewRects(oldBounds, oldLocation, newBounds, n ewLocation));
1280 1290
1281 invalidateSelectionIfNeeded(paintInvalidationContainer);
1282
1283 if (invalidationReason == PaintInvalidationNone) 1291 if (invalidationReason == PaintInvalidationNone)
1284 return invalidationReason; 1292 return invalidationReason;
1285 1293
1286 if (invalidationReason == PaintInvalidationIncremental) { 1294 if (invalidationReason == PaintInvalidationIncremental) {
1287 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB ounds, newLocation); 1295 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB ounds, newLocation);
1288 return invalidationReason; 1296 return invalidationReason;
1289 } 1297 }
1290 1298
1291 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun ds, newBounds); 1299 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun ds, newBounds);
1292 return invalidationReason; 1300 return invalidationReason;
(...skipping 1852 matching lines...) Expand 10 before | Expand all | Expand 10 after
3145 { 3153 {
3146 if (object1) { 3154 if (object1) {
3147 const blink::RenderObject* root = object1; 3155 const blink::RenderObject* root = object1;
3148 while (root->parent()) 3156 while (root->parent())
3149 root = root->parent(); 3157 root = root->parent();
3150 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3158 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3151 } 3159 }
3152 } 3160 }
3153 3161
3154 #endif 3162 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698