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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 2203123004: Don't adjust for scrolling of the ancestor, rather than un-adjusting for it later. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: none Created 4 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 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 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 if (dirtyRect.isEmpty()) 1239 if (dirtyRect.isEmpty())
1240 return; 1240 return;
1241 1241
1242 if (view()->document().printing()) 1242 if (view()->document().printing())
1243 return; // Don't invalidate paints if we're printing. 1243 return; // Don't invalidate paints if we're printing.
1244 1244
1245 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validation(); 1245 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validation();
1246 LayoutRect dirtyRectOnBacking = dirtyRect; 1246 LayoutRect dirtyRectOnBacking = dirtyRect;
1247 PaintLayer::mapRectToPaintInvalidationBacking(*this, paintInvalidationContai ner, dirtyRectOnBacking); 1247 PaintLayer::mapRectToPaintInvalidationBacking(*this, paintInvalidationContai ner, dirtyRectOnBacking);
1248 1248
1249 // Composited scrolling should not be included in the bounds of composited-s crolled items.
1250 if (compositedScrollsWithRespectTo(paintInvalidationContainer)) {
1251 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol ledContentOffset());
1252 dirtyRectOnBacking.move(inverseOffset);
1253 }
1254
1255 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking , PaintInvalidationRectangle); 1249 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking , PaintInvalidationRectangle);
1256 1250
1257 slowSetPaintingLayerNeedsRepaint(); 1251 slowSetPaintingLayerNeedsRepaint();
1258 invalidateDisplayItemClients(PaintInvalidationRectangle); 1252 invalidateDisplayItemClients(PaintInvalidationRectangle);
1259 } 1253 }
1260 1254
1261 void LayoutObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv alidationState) 1255 void LayoutObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv alidationState)
1262 { 1256 {
1263 ASSERT(!needsLayout()); 1257 ASSERT(!needsLayout());
1264 1258
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 inline void LayoutObject::invalidateSelectionIfNeeded(const LayoutBoxModelObject & paintInvalidationContainer, const PaintInvalidationState& paintInvalidationSta te, PaintInvalidationReason invalidationReason) 1328 inline void LayoutObject::invalidateSelectionIfNeeded(const LayoutBoxModelObject & paintInvalidationContainer, const PaintInvalidationState& paintInvalidationSta te, PaintInvalidationReason invalidationReason)
1335 { 1329 {
1336 // Update selection rect when we are doing full invalidation (in case that t he object is moved, composite status changed, etc.) 1330 // Update selection rect when we are doing full invalidation (in case that t he object is moved, composite status changed, etc.)
1337 // or shouldInvalidationSelection is set (in case that the selection itself changed). 1331 // or shouldInvalidationSelection is set (in case that the selection itself changed).
1338 bool fullInvalidation = isFullPaintInvalidationReason(invalidationReason); 1332 bool fullInvalidation = isFullPaintInvalidationReason(invalidationReason);
1339 if (!fullInvalidation && !shouldInvalidateSelection()) 1333 if (!fullInvalidation && !shouldInvalidateSelection())
1340 return; 1334 return;
1341 1335
1342 LayoutRect oldSelectionRect = previousSelectionRectForPaintInvalidation(); 1336 LayoutRect oldSelectionRect = previousSelectionRectForPaintInvalidation();
1343 LayoutRect newSelectionRect = localSelectionRect(); 1337 LayoutRect newSelectionRect = localSelectionRect();
1344 if (!newSelectionRect.isEmpty()) { 1338 if (!newSelectionRect.isEmpty())
1345 paintInvalidationState.mapLocalRectToPaintInvalidationBacking(newSelecti onRect); 1339 paintInvalidationState.mapLocalRectToPaintInvalidationBacking(newSelecti onRect);
1346 1340
1347 // Composited scrolling should not be included in the bounds and positio n tracking, because the graphics layer backing the scroller
1348 // does not move on scroll.
1349 if (compositedScrollsWithRespectTo(paintInvalidationContainer)) {
1350 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->s crolledContentOffset());
1351 newSelectionRect.move(inverseOffset);
1352 }
1353 }
1354
1355 setPreviousSelectionRectForPaintInvalidation(newSelectionRect); 1341 setPreviousSelectionRectForPaintInvalidation(newSelectionRect);
1356 1342
1357 // TODO(wangxianzhu): Combine the following two conditions when removing Lay outView::doingFullPaintInvalidation(). 1343 // TODO(wangxianzhu): Combine the following two conditions when removing Lay outView::doingFullPaintInvalidation().
1358 if (!fullInvalidation) 1344 if (!fullInvalidation)
1359 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelect ion, oldSelectionRect, newSelectionRect); 1345 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelect ion, oldSelectionRect, newSelectionRect);
1360 if (shouldInvalidateSelection()) 1346 if (shouldInvalidateSelection())
1361 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidation State, PaintInvalidationSelection); 1347 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidation State, PaintInvalidationSelection);
1362 } 1348 }
1363 1349
1364 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(const PaintInvalid ationState& paintInvalidationState) 1350 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(const PaintInvalid ationState& paintInvalidationState)
(...skipping 11 matching lines...) Expand all
1376 return PaintInvalidationNone; // Don't invalidate paints if we're printi ng. 1362 return PaintInvalidationNone; // Don't invalidate paints if we're printi ng.
1377 1363
1378 const LayoutBoxModelObject& paintInvalidationContainer = paintInvalidationSt ate.paintInvalidationContainer(); 1364 const LayoutBoxModelObject& paintInvalidationContainer = paintInvalidationSt ate.paintInvalidationContainer();
1379 ASSERT(paintInvalidationContainer == containerForPaintInvalidation()); 1365 ASSERT(paintInvalidationContainer == containerForPaintInvalidation());
1380 1366
1381 const LayoutRect oldBounds = previousPaintInvalidationRect(); 1367 const LayoutRect oldBounds = previousPaintInvalidationRect();
1382 const LayoutPoint oldLocation = RuntimeEnabledFeatures::slimmingPaintInvalid ationEnabled() ? LayoutPoint() : previousPositionFromPaintInvalidationBacking(); 1368 const LayoutPoint oldLocation = RuntimeEnabledFeatures::slimmingPaintInvalid ationEnabled() ? LayoutPoint() : previousPositionFromPaintInvalidationBacking();
1383 LayoutRect newBounds = paintInvalidationState.computePaintInvalidationRectIn Backing(); 1369 LayoutRect newBounds = paintInvalidationState.computePaintInvalidationRectIn Backing();
1384 LayoutPoint newLocation = RuntimeEnabledFeatures::slimmingPaintInvalidationE nabled() ? LayoutPoint() : paintInvalidationState.computePositionFromPaintInvali dationBacking(); 1370 LayoutPoint newLocation = RuntimeEnabledFeatures::slimmingPaintInvalidationE nabled() ? LayoutPoint() : paintInvalidationState.computePositionFromPaintInvali dationBacking();
1385 1371
1386 // Composited scrolling should not be included in the bounds and position tr acking, because the graphics layer backing the scroller
1387 // does not move on scroll.
1388 // TODO(chrishtr): can we just avoid adding in the scroll in the first place in LayoutBox::mapScrollingContentsRectToBoxSpace?
1389 if (compositedScrollsWithRespectTo(paintInvalidationContainer)) {
1390 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol ledContentOffset());
1391 newLocation.move(inverseOffset);
1392 newBounds.move(inverseOffset);
1393 }
1394
1395 setPreviousPaintInvalidationRect(newBounds); 1372 setPreviousPaintInvalidationRect(newBounds);
1396 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) 1373 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
1397 setPreviousPositionFromPaintInvalidationBacking(newLocation); 1374 setPreviousPositionFromPaintInvalidationBacking(newLocation);
1398 1375
1399 if (!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() && paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinContainerOnly()) { 1376 if (!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() && paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinContainerOnly()) {
1400 // We are done updating the paint invalidation rect. No other paint inva lidation work to do for this object. 1377 // We are done updating the paint invalidation rect. No other paint inva lidation work to do for this object.
1401 return PaintInvalidationNone; 1378 return PaintInvalidationNone;
1402 } 1379 }
1403 1380
1404 PaintInvalidationReason invalidationReason = getPaintInvalidationReason(pain tInvalidationState, oldBounds, oldLocation, newBounds, newLocation); 1381 PaintInvalidationReason invalidationReason = getPaintInvalidationReason(pain tInvalidationState, oldBounds, oldLocation, newBounds, newLocation);
(...skipping 2269 matching lines...) Expand 10 before | Expand all | Expand 10 after
3674 const blink::LayoutObject* root = object1; 3651 const blink::LayoutObject* root = object1;
3675 while (root->parent()) 3652 while (root->parent())
3676 root = root->parent(); 3653 root = root->parent();
3677 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3654 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3678 } else { 3655 } else {
3679 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3656 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3680 } 3657 }
3681 } 3658 }
3682 3659
3683 #endif 3660 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698