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

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 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after
3483 3487
3484 void LayoutObject::setMayNeedPaintInvalidation() 3488 void LayoutObject::setMayNeedPaintInvalidation()
3485 { 3489 {
3486 if (mayNeedPaintInvalidation()) 3490 if (mayNeedPaintInvalidation())
3487 return; 3491 return;
3488 m_bitfields.setMayNeedPaintInvalidation(true); 3492 m_bitfields.setMayNeedPaintInvalidation(true);
3489 markContainerChainForPaintInvalidation(); 3493 markContainerChainForPaintInvalidation();
3490 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); 3494 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded();
3491 } 3495 }
3492 3496
3493 void LayoutObject::clearPaintInvalidationState(const PaintInvalidationState& pai ntInvalidationState) 3497 void LayoutObject::clearPaintInvalidationFlags(const PaintInvalidationState& pai ntInvalidationState)
3494 { 3498 {
3495 // paintInvalidationStateIsDirty should be kept in sync with the 3499 // paintInvalidationStateIsDirty should be kept in sync with the
3496 // booleans that are cleared below. 3500 // booleans that are cleared below.
3497 ASSERT(paintInvalidationState.forcedSubtreeInvalidationWithinContainer() || paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinContainer() || p aintInvalidationStateIsDirty()); 3501 ASSERT(paintInvalidationState.forcedSubtreeInvalidationWithinContainer() || paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinContainer() || p aintInvalidationStateIsDirty());
3498 clearShouldDoFullPaintInvalidation(); 3502 clearShouldDoFullPaintInvalidation();
3499 m_bitfields.setChildShouldCheckForPaintInvalidation(false); 3503 m_bitfields.setChildShouldCheckForPaintInvalidation(false);
3500 m_bitfields.setNeededLayoutBecauseOfChildren(false); 3504 m_bitfields.setNeededLayoutBecauseOfChildren(false);
3501 m_bitfields.setShouldInvalidateOverflowForPaint(false); 3505 m_bitfields.setShouldInvalidateOverflowForPaint(false);
3502 m_bitfields.setMayNeedPaintInvalidation(false); 3506 m_bitfields.setMayNeedPaintInvalidation(false);
3503 m_bitfields.setShouldInvalidateSelection(false); 3507 m_bitfields.setShouldInvalidateSelection(false);
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
3733 const blink::LayoutObject* root = object1; 3737 const blink::LayoutObject* root = object1;
3734 while (root->parent()) 3738 while (root->parent())
3735 root = root->parent(); 3739 root = root->parent();
3736 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3740 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3737 } else { 3741 } else {
3738 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3742 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3739 } 3743 }
3740 } 3744 }
3741 3745
3742 #endif 3746 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutPart.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698