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

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

Issue 1880763002: Merge repaintRects and paintInvalidationObjects in text-based-repaint test results (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject: :invalidatePaintUsingContainer()", 1212 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject: :invalidatePaintUsingContainer()",
1213 "object", this->debugName().ascii(), 1213 "object", this->debugName().ascii(),
1214 "info", jsonObjectForPaintInvalidationInfo(dirtyRect, paintInvalidationR easonToString(invalidationReason))); 1214 "info", jsonObjectForPaintInvalidationInfo(dirtyRect, paintInvalidationR easonToString(invalidationReason)));
1215 1215
1216 // This conditional handles situations where non-rooted (and hence non-compo sited) frames are 1216 // This conditional handles situations where non-rooted (and hence non-compo sited) frames are
1217 // painted, such as SVG images. 1217 // painted, such as SVG images.
1218 if (!paintInvalidationContainer.isPaintInvalidationContainer()) 1218 if (!paintInvalidationContainer.isPaintInvalidationContainer())
1219 invalidatePaintRectangleOnWindow(paintInvalidationContainer, enclosingIn tRect(dirtyRect)); 1219 invalidatePaintRectangleOnWindow(paintInvalidationContainer, enclosingIn tRect(dirtyRect));
1220 1220
1221 if (paintInvalidationContainer.view()->usesCompositing() && paintInvalidatio nContainer.isPaintInvalidationContainer()) 1221 if (paintInvalidationContainer.view()->usesCompositing() && paintInvalidatio nContainer.isPaintInvalidationContainer())
1222 paintInvalidationContainer.setBackingNeedsPaintInvalidationInRect(dirtyR ect, invalidationReason); 1222 paintInvalidationContainer.setBackingNeedsPaintInvalidationInRect(dirtyR ect, invalidationReason, *this);
1223 } 1223 }
1224 1224
1225 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClient& displayI temClient) const 1225 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClient& displayI temClient) const
1226 { 1226 {
1227 if (PaintLayer* enclosingLayer = this->enclosingLayer()) { 1227 if (PaintLayer* enclosingLayer = this->enclosingLayer()) {
1228 // This is valid because we want to invalidate the client in the display item list of the current backing. 1228 // This is valid because we want to invalidate the client in the display item list of the current backing.
1229 DisableCompositingQueryAsserts disabler; 1229 DisableCompositingQueryAsserts disabler;
1230 if (const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosing LayerForPaintInvalidationCrossingFrameBoundaries()) 1230 if (const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosing LayerForPaintInvalidationCrossingFrameBoundaries())
1231 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO nBacking(displayItemClient, PaintInvalidationFull); 1231 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO nBacking(displayItemClient, PaintInvalidationFull);
1232 enclosingLayer->setNeedsRepaint(); 1232 enclosingLayer->setNeedsRepaint();
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 // Composited scrolling should not be included in the bounds and positio n tracking, because the graphics layer backing the scroller 1382 // Composited scrolling should not be included in the bounds and positio n tracking, because the graphics layer backing the scroller
1383 // does not move on scroll. 1383 // does not move on scroll.
1384 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvali dationContainer != this) { 1384 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvali dationContainer != this) {
1385 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->s crolledContentOffset()); 1385 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->s crolledContentOffset());
1386 newSelectionRect.move(inverseOffset); 1386 newSelectionRect.move(inverseOffset);
1387 } 1387 }
1388 } 1388 }
1389 1389
1390 setPreviousSelectionRectForPaintInvalidation(newSelectionRect); 1390 setPreviousSelectionRectForPaintInvalidation(newSelectionRect);
1391 1391
1392 // TODO(wangxianzhu): Combine the following two conditions when removing Lay outView::doingFullPaintInvalidation().
1393 if (!fullInvalidation)
1394 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelect ion, oldSelectionRect, newSelectionRect);
1392 if (shouldInvalidateSelection()) 1395 if (shouldInvalidateSelection())
1393 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidation Container, paintInvalidationState, PaintInvalidationSelection); 1396 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidation Container, paintInvalidationState, PaintInvalidationSelection);
1394
1395 if (fullInvalidation)
1396 return;
1397
1398 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelection, oldSelectionRect, newSelectionRect);
1399 } 1397 }
1400 1398
1401 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(const PaintInvalid ationState& paintInvalidationState) 1399 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(const PaintInvalid ationState& paintInvalidationState)
1402 { 1400 {
1403 ASSERT(&paintInvalidationState.currentObject() == this); 1401 ASSERT(&paintInvalidationState.currentObject() == this);
1404 1402
1405 if (styleRef().hasOutline()) { 1403 if (styleRef().hasOutline()) {
1406 PaintLayer& layer = paintInvalidationState.enclosingSelfPaintingLayer(*t his); 1404 PaintLayer& layer = paintInvalidationState.enclosingSelfPaintingLayer(*t his);
1407 if (layer.layoutObject() != this) 1405 if (layer.layoutObject() != this)
1408 layer.setNeedsPaintPhaseDescendantOutlines(); 1406 layer.setNeedsPaintPhaseDescendantOutlines();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 // There are corner cases that the display items need to be invalidated for paint offset 1455 // There are corner cases that the display items need to be invalidated for paint offset
1458 // mutation, but incurs no pixel difference (i.e. bounds stay the same) so no rect-based 1456 // mutation, but incurs no pixel difference (i.e. bounds stay the same) so no rect-based
1459 // invalidation is issued. See crbug.com/508383 and crbug.com/515977. 1457 // invalidation is issued. See crbug.com/508383 and crbug.com/515977.
1460 // This is a workaround to force display items to update paint offset. 1458 // This is a workaround to force display items to update paint offset.
1461 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && paint InvalidationState.forcedSubtreeInvalidationWithinContainer()) 1459 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && paint InvalidationState.forcedSubtreeInvalidationWithinContainer())
1462 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalida tionContainer, paintInvalidationState, invalidationReason); 1460 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalida tionContainer, paintInvalidationState, invalidationReason);
1463 1461
1464 return invalidationReason; 1462 return invalidationReason;
1465 } 1463 }
1466 1464
1465 if (invalidationReason == PaintInvalidationIncremental)
1466 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB ounds, newLocation);
1467 else
1468 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, old Bounds, newBounds);
1469
1467 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidationCont ainer, paintInvalidationState, invalidationReason); 1470 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidationCont ainer, paintInvalidationState, invalidationReason);
1468
1469 if (invalidationReason == PaintInvalidationIncremental) {
1470 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB ounds, newLocation);
1471 return invalidationReason;
1472 }
1473
1474 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun ds, newBounds);
1475
1476 return invalidationReason; 1471 return invalidationReason;
1477 } 1472 }
1478 1473
1479 PaintInvalidationReason LayoutObject::getPaintInvalidationReason(const LayoutBox ModelObject& paintInvalidationContainer, 1474 PaintInvalidationReason LayoutObject::getPaintInvalidationReason(const LayoutBox ModelObject& paintInvalidationContainer,
1480 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalida tionBacking, 1475 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalida tionBacking,
1481 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInvalida tionBacking) const 1476 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInvalida tionBacking) const
1482 { 1477 {
1483 // First check for InvalidationLocationChange to avoid it from being hidden by other 1478 // First check for InvalidationLocationChange to avoid it from being hidden by other
1484 // invalidation reasons because we'll need to force check for paint invalida tion for 1479 // invalidation reasons because we'll need to force check for paint invalida tion for
1485 // children when location of this object changed. 1480 // children when location of this object changed.
(...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after
3562 #if ENABLE(ASSERT) 3557 #if ENABLE(ASSERT)
3563 assertEnclosingSelfPaintingLayerHasSetNeedsRepaint(*this); 3558 assertEnclosingSelfPaintingLayerHasSetNeedsRepaint(*this);
3564 #endif 3559 #endif
3565 3560
3566 // These disablers are valid because we want to use the current compositing/ invalidation status. 3561 // These disablers are valid because we want to use the current compositing/ invalidation status.
3567 DisablePaintInvalidationStateAsserts invalidationDisabler; 3562 DisablePaintInvalidationStateAsserts invalidationDisabler;
3568 DisableCompositingQueryAsserts compositingDisabler; 3563 DisableCompositingQueryAsserts compositingDisabler;
3569 3564
3570 LayoutRect invalidationRect = previousPaintInvalidationRect(); 3565 LayoutRect invalidationRect = previousPaintInvalidationRect();
3571 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida tionContainer); 3566 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida tionContainer);
3572 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, PaintInvalidationLayer); 3567 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, reason);
3573 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa yer); 3568 invalidateDisplayItemClients(paintInvalidationContainer, reason);
3574 3569
3575 // This method may be used to invalidate paint of an object changing paint i nvalidation container. 3570 // This method may be used to invalidate paint of an object changing paint i nvalidation container.
3576 // Clear previous paint invalidation rect on the original paint invalidation container to avoid 3571 // Clear previous paint invalidation rect on the original paint invalidation container to avoid
3577 // under-invalidation if the new paint invalidation rect on the new paint in validation container 3572 // under-invalidation if the new paint invalidation rect on the new paint in validation container
3578 // happens to be the same as the old one. 3573 // happens to be the same as the old one.
3579 clearPreviousPaintInvalidationRects(); 3574 clearPreviousPaintInvalidationRects();
3580 } 3575 }
3581 3576
3582 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() 3577 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants()
3583 { 3578 {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
3679 const blink::LayoutObject* root = object1; 3674 const blink::LayoutObject* root = object1;
3680 while (root->parent()) 3675 while (root->parent())
3681 root = root->parent(); 3676 root = root->parent();
3682 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3677 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3683 } else { 3678 } else {
3684 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3679 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3685 } 3680 }
3686 } 3681 }
3687 3682
3688 #endif 3683 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698