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

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

Issue 1804963005: Avoid paintInvalidationContainer parameter of invalidatePaintIfNeeded() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaintRect angleInternal(rect); 1323 const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaintRect angleInternal(rect);
1324 if (paintInvalidationContainer) 1324 if (paintInvalidationContainer)
1325 invalidateDisplayItemClients(*paintInvalidationContainer, PaintInvalidat ionRectangle); 1325 invalidateDisplayItemClients(*paintInvalidationContainer, PaintInvalidat ionRectangle);
1326 } 1326 }
1327 1327
1328 void LayoutObject::invalidatePaintRectangleNotInvalidatingDisplayItemClients(con st LayoutRect& r) const 1328 void LayoutObject::invalidatePaintRectangleNotInvalidatingDisplayItemClients(con st LayoutRect& r) const
1329 { 1329 {
1330 invalidatePaintRectangleInternal(r); 1330 invalidatePaintRectangleInternal(r);
1331 } 1331 }
1332 1332
1333 void LayoutObject::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidat ionState) 1333 void LayoutObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv alidationState)
1334 { 1334 {
1335 ASSERT(!needsLayout()); 1335 ASSERT(!needsLayout());
1336 1336
1337 // If we didn't need paint invalidation then our children don't need as well . 1337 // If we didn't need paint invalidation then our children don't need as well .
1338 // Skip walking down the tree as everything should be fine below us. 1338 // Skip walking down the tree as everything should be fine below us.
1339 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) 1339 if (!shouldCheckForPaintInvalidation(paintInvalidationState))
1340 return; 1340 return;
1341 1341
1342 PaintInvalidationReason reason = invalidatePaintIfNeeded(paintInvalidationSt ate, paintInvalidationState.paintInvalidationContainer()); 1342 PaintInvalidationReason reason = invalidatePaintIfNeeded(paintInvalidationSt ate);
1343 clearPaintInvalidationState(paintInvalidationState); 1343 clearPaintInvalidationFlags(paintInvalidationState);
1344 1344
1345 if (reason == PaintInvalidationDelayedFull) 1345 if (reason == PaintInvalidationDelayedFull)
1346 paintInvalidationState.pushDelayedPaintInvalidationTarget(*this); 1346 paintInvalidationState.pushDelayedPaintInvalidationTarget(*this);
1347 1347
1348 invalidatePaintOfSubtreesIfNeeded(paintInvalidationState); 1348 invalidatePaintOfSubtreesIfNeeded(paintInvalidationState);
1349 } 1349 }
1350 1350
1351 void LayoutObject::invalidatePaintOfSubtreesIfNeeded(PaintInvalidationState& chi ldPaintInvalidationState) 1351 void LayoutObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat e& childPaintInvalidationState)
1352 { 1352 {
1353 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli ng()) { 1353 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli ng()) {
1354 if (!child->isOutOfFlowPositioned()) 1354 if (!child->isOutOfFlowPositioned())
1355 child->invalidateTreeIfNeeded(childPaintInvalidationState); 1355 child->invalidateTreeIfNeeded(childPaintInvalidationState);
1356 } 1356 }
1357 } 1357 }
1358 1358
1359 static PassOwnPtr<TracedValue> jsonObjectForOldAndNewRects(const LayoutRect& old Rect, const LayoutPoint& oldLocation, const LayoutRect& newRect, const LayoutPoi nt& newLocation) 1359 static PassOwnPtr<TracedValue> jsonObjectForOldAndNewRects(const LayoutRect& old Rect, const LayoutPoint& oldLocation, const LayoutRect& newRect, const LayoutPoi nt& newLocation)
1360 { 1360 {
1361 OwnPtr<TracedValue> value = TracedValue::create(); 1361 OwnPtr<TracedValue> value = TracedValue::create();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 1416
1417 if (shouldInvalidateSelection()) 1417 if (shouldInvalidateSelection())
1418 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidation Container, paintInvalidationState, PaintInvalidationSelection); 1418 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidation Container, paintInvalidationState, PaintInvalidationSelection);
1419 1419
1420 if (fullInvalidation) 1420 if (fullInvalidation)
1421 return; 1421 return;
1422 1422
1423 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelection, oldSelectionRect, newSelectionRect); 1423 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelection, oldSelectionRect, newSelectionRect);
1424 } 1424 }
1425 1425
1426 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(PaintInvalidationS tate& paintInvalidationState, const LayoutBoxModelObject& paintInvalidationConta iner) 1426 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(const PaintInvalid ationState& paintInvalidationState)
1427 { 1427 {
1428 if (styleRef().hasOutline()) { 1428 if (styleRef().hasOutline()) {
1429 PaintLayer& layer = paintInvalidationState.enclosingSelfPaintingLayer(*t his); 1429 PaintLayer& layer = paintInvalidationState.enclosingSelfPaintingLayer(*t his);
1430 if (layer.layoutObject() != this) 1430 if (layer.layoutObject() != this)
1431 layer.setNeedsPaintPhaseDescendantOutlines(); 1431 layer.setNeedsPaintPhaseDescendantOutlines();
1432 } 1432 }
1433 1433
1434 LayoutView* v = view(); 1434 LayoutView* v = view();
1435 if (v->document().printing()) 1435 if (v->document().printing())
1436 return PaintInvalidationNone; // Don't invalidate paints if we're printi ng. 1436 return PaintInvalidationNone; // Don't invalidate paints if we're printi ng.
1437 1437
1438 const LayoutBoxModelObject& paintInvalidationContainer = paintInvalidationSt ate.paintInvalidationContainer();
1439 // TODO(wangxianzhu): Enable this assert after we fix all paintInvalidationC ontainer mismatch issues. crbug.com/360286
1440 // ASSERT(paintInvalidationContainer == containerForPaintInvalidation());
1441
1438 const LayoutRect oldBounds = previousPaintInvalidationRect(); 1442 const LayoutRect oldBounds = previousPaintInvalidationRect();
1439 const LayoutPoint oldLocation = RuntimeEnabledFeatures::slimmingPaintInvalid ationEnabled() ? LayoutPoint() : previousPositionFromPaintInvalidationBacking(); 1443 const LayoutPoint oldLocation = RuntimeEnabledFeatures::slimmingPaintInvalid ationEnabled() ? LayoutPoint() : previousPositionFromPaintInvalidationBacking();
1440 LayoutRect newBounds = boundsRectForPaintInvalidation(paintInvalidationConta iner, &paintInvalidationState); 1444 LayoutRect newBounds = boundsRectForPaintInvalidation(paintInvalidationConta iner, &paintInvalidationState);
1441 LayoutPoint newLocation = RuntimeEnabledFeatures::slimmingPaintInvalidationE nabled() ? LayoutPoint() : PaintLayer::positionFromPaintInvalidationBacking(this , &paintInvalidationContainer, &paintInvalidationState); 1445 LayoutPoint newLocation = RuntimeEnabledFeatures::slimmingPaintInvalidationE nabled() ? LayoutPoint() : PaintLayer::positionFromPaintInvalidationBacking(this , &paintInvalidationContainer, &paintInvalidationState);
1442 1446
1443 // Composited scrolling should not be included in the bounds and position tr acking, because the graphics layer backing the scroller 1447 // Composited scrolling should not be included in the bounds and position tr acking, because the graphics layer backing the scroller
1444 // does not move on scroll. 1448 // does not move on scroll.
1445 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati onContainer != this) { 1449 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati onContainer != this) {
1446 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol ledContentOffset()); 1450 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol ledContentOffset());
1447 newLocation.move(inverseOffset); 1451 newLocation.move(inverseOffset);
(...skipping 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after
3476 3480
3477 void LayoutObject::setMayNeedPaintInvalidation() 3481 void LayoutObject::setMayNeedPaintInvalidation()
3478 { 3482 {
3479 if (mayNeedPaintInvalidation()) 3483 if (mayNeedPaintInvalidation())
3480 return; 3484 return;
3481 m_bitfields.setMayNeedPaintInvalidation(true); 3485 m_bitfields.setMayNeedPaintInvalidation(true);
3482 markContainerChainForPaintInvalidation(); 3486 markContainerChainForPaintInvalidation();
3483 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); 3487 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded();
3484 } 3488 }
3485 3489
3486 void LayoutObject::clearPaintInvalidationState(const PaintInvalidationState& pai ntInvalidationState) 3490 void LayoutObject::clearPaintInvalidationFlags(const PaintInvalidationState& pai ntInvalidationState)
3487 { 3491 {
3488 // paintInvalidationStateIsDirty should be kept in sync with the 3492 // paintInvalidationStateIsDirty should be kept in sync with the
3489 // booleans that are cleared below. 3493 // booleans that are cleared below.
3490 ASSERT(paintInvalidationState.forcedSubtreeInvalidationWithinContainer() || paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinContainer() || p aintInvalidationStateIsDirty()); 3494 ASSERT(paintInvalidationState.forcedSubtreeInvalidationWithinContainer() || paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinContainer() || p aintInvalidationStateIsDirty());
3491 clearShouldDoFullPaintInvalidation(); 3495 clearShouldDoFullPaintInvalidation();
3492 m_bitfields.setChildShouldCheckForPaintInvalidation(false); 3496 m_bitfields.setChildShouldCheckForPaintInvalidation(false);
3493 m_bitfields.setNeededLayoutBecauseOfChildren(false); 3497 m_bitfields.setNeededLayoutBecauseOfChildren(false);
3494 m_bitfields.setShouldInvalidateOverflowForPaint(false); 3498 m_bitfields.setShouldInvalidateOverflowForPaint(false);
3495 m_bitfields.setMayNeedPaintInvalidation(false); 3499 m_bitfields.setMayNeedPaintInvalidation(false);
3496 m_bitfields.setShouldInvalidateSelection(false); 3500 m_bitfields.setShouldInvalidateSelection(false);
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
3726 const blink::LayoutObject* root = object1; 3730 const blink::LayoutObject* root = object1;
3727 while (root->parent()) 3731 while (root->parent())
3728 root = root->parent(); 3732 root = root->parent();
3729 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3733 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3730 } else { 3734 } else {
3731 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3735 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3732 } 3736 }
3733 } 3737 }
3734 3738
3735 #endif 3739 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698