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 1833493003: Remove ForceHorriblySlowRectMapping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pi
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 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 1334
1335 if (reason == PaintInvalidationDelayedFull) 1335 if (reason == PaintInvalidationDelayedFull)
1336 newPaintInvalidationState.pushDelayedPaintInvalidationTarget(*this); 1336 newPaintInvalidationState.pushDelayedPaintInvalidationTarget(*this);
1337 1337
1338 newPaintInvalidationState.updateForChildren(); 1338 newPaintInvalidationState.updateForChildren();
1339 invalidatePaintOfSubtreesIfNeeded(newPaintInvalidationState); 1339 invalidatePaintOfSubtreesIfNeeded(newPaintInvalidationState);
1340 } 1340 }
1341 1341
1342 void LayoutObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat e& childPaintInvalidationState) 1342 void LayoutObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat e& childPaintInvalidationState)
1343 { 1343 {
1344 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli ng()) { 1344 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli ng())
chrishtr 2016/03/31 00:15:02 Document the new traversal order and any other per
Xianzhu 2016/03/31 01:41:28 Done.
1345 if (!child->isOutOfFlowPositioned()) 1345 child->invalidateTreeIfNeeded(childPaintInvalidationState);
1346 child->invalidateTreeIfNeeded(childPaintInvalidationState);
1347 }
1348 } 1346 }
1349 1347
1350 static PassOwnPtr<TracedValue> jsonObjectForOldAndNewRects(const LayoutRect& old Rect, const LayoutPoint& oldLocation, const LayoutRect& newRect, const LayoutPoi nt& newLocation) 1348 static PassOwnPtr<TracedValue> jsonObjectForOldAndNewRects(const LayoutRect& old Rect, const LayoutPoint& oldLocation, const LayoutRect& newRect, const LayoutPoi nt& newLocation)
1351 { 1349 {
1352 OwnPtr<TracedValue> value = TracedValue::create(); 1350 OwnPtr<TracedValue> value = TracedValue::create();
1353 addJsonObjectForRect(value.get(), "oldRect", oldRect); 1351 addJsonObjectForRect(value.get(), "oldRect", oldRect);
1354 addJsonObjectForPoint(value.get(), "oldLocation", oldLocation); 1352 addJsonObjectForPoint(value.get(), "oldLocation", oldLocation);
1355 addJsonObjectForRect(value.get(), "newRect", newRect); 1353 addJsonObjectForRect(value.get(), "newRect", newRect);
1356 addJsonObjectForPoint(value.get(), "newLocation", newLocation); 1354 addJsonObjectForPoint(value.get(), "newLocation", newLocation);
1357 return value.release(); 1355 return value.release();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 PaintLayer& layer = paintInvalidationState.enclosingSelfPaintingLayer(*t his); 1426 PaintLayer& layer = paintInvalidationState.enclosingSelfPaintingLayer(*t his);
1429 if (layer.layoutObject() != this) 1427 if (layer.layoutObject() != this)
1430 layer.setNeedsPaintPhaseDescendantOutlines(); 1428 layer.setNeedsPaintPhaseDescendantOutlines();
1431 } 1429 }
1432 1430
1433 LayoutView* v = view(); 1431 LayoutView* v = view();
1434 if (v->document().printing()) 1432 if (v->document().printing())
1435 return PaintInvalidationNone; // Don't invalidate paints if we're printi ng. 1433 return PaintInvalidationNone; // Don't invalidate paints if we're printi ng.
1436 1434
1437 const LayoutBoxModelObject& paintInvalidationContainer = paintInvalidationSt ate.paintInvalidationContainer(); 1435 const LayoutBoxModelObject& paintInvalidationContainer = paintInvalidationSt ate.paintInvalidationContainer();
1438 // TODO(wangxianzhu): Enable this assert after we fix all paintInvalidationC ontainer mismatch issues. crbug.com/360286 1436 ASSERT(paintInvalidationContainer == containerForPaintInvalidation());
1439 // ASSERT(paintInvalidationContainer == containerForPaintInvalidation());
1440 1437
1441 const LayoutRect oldBounds = previousPaintInvalidationRect(); 1438 const LayoutRect oldBounds = previousPaintInvalidationRect();
1442 const LayoutPoint oldLocation = RuntimeEnabledFeatures::slimmingPaintInvalid ationEnabled() ? LayoutPoint() : previousPositionFromPaintInvalidationBacking(); 1439 const LayoutPoint oldLocation = RuntimeEnabledFeatures::slimmingPaintInvalid ationEnabled() ? LayoutPoint() : previousPositionFromPaintInvalidationBacking();
1443 LayoutRect newBounds = paintInvalidationState.computePaintInvalidationRectIn Backing(); 1440 LayoutRect newBounds = paintInvalidationState.computePaintInvalidationRectIn Backing();
1444 LayoutPoint newLocation = RuntimeEnabledFeatures::slimmingPaintInvalidationE nabled() ? LayoutPoint() : paintInvalidationState.computePositionFromPaintInvali dationBacking(); 1441 LayoutPoint newLocation = RuntimeEnabledFeatures::slimmingPaintInvalidationE nabled() ? LayoutPoint() : paintInvalidationState.computePositionFromPaintInvali dationBacking();
1445 1442
1446 // Composited scrolling should not be included in the bounds and position tr acking, because the graphics layer backing the scroller 1443 // Composited scrolling should not be included in the bounds and position tr acking, because the graphics layer backing the scroller
1447 // does not move on scroll. 1444 // does not move on scroll.
1448 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati onContainer != this) { 1445 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati onContainer != this) {
1449 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol ledContentOffset()); 1446 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol ledContentOffset());
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
2618 } 2615 }
2619 } 2616 }
2620 return multicolContainer; 2617 return multicolContainer;
2621 } 2618 }
2622 2619
2623 return o; 2620 return o;
2624 } 2621 }
2625 2622
2626 LayoutObject* LayoutObject::containerCrossingFrameBoundaries() const 2623 LayoutObject* LayoutObject::containerCrossingFrameBoundaries() const
2627 { 2624 {
2628 return isLayoutView() ? frame()->ownerLayoutObject() : container(); 2625 return isLayoutView() ? frame()->ownerLayoutObject() : container();
chrishtr 2016/03/31 00:15:02 Delete this method?
Xianzhu 2016/03/31 01:41:28 Done.
2629 } 2626 }
2630 2627
2628 LayoutObject* LayoutObject::parentCrossingFrameBoundaries() const
2629 {
2630 return isLayoutView() ? frame()->ownerLayoutObject() : parent();
2631 }
2632
2631 bool LayoutObject::isSelectionBorder() const 2633 bool LayoutObject::isSelectionBorder() const
2632 { 2634 {
2633 SelectionState st = getSelectionState(); 2635 SelectionState st = getSelectionState();
2634 return st == SelectionStart || st == SelectionEnd || st == SelectionBoth; 2636 return st == SelectionStart || st == SelectionEnd || st == SelectionBoth;
2635 } 2637 }
2636 2638
2637 inline void LayoutObject::clearLayoutRootIfNeeded() const 2639 inline void LayoutObject::clearLayoutRootIfNeeded() const
2638 { 2640 {
2639 if (FrameView* view = frameView()) { 2641 if (FrameView* view = frameView()) {
2640 if (!documentBeingDestroyed()) 2642 if (!documentBeingDestroyed())
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
3422 case DocumentLifecycle::InPerformLayout: 3424 case DocumentLifecycle::InPerformLayout:
3423 case DocumentLifecycle::AfterPerformLayout: 3425 case DocumentLifecycle::AfterPerformLayout:
3424 return PaintInvalidationForcedByLayout; 3426 return PaintInvalidationForcedByLayout;
3425 case DocumentLifecycle::InCompositingUpdate: 3427 case DocumentLifecycle::InCompositingUpdate:
3426 return PaintInvalidationCompositingUpdate; 3428 return PaintInvalidationCompositingUpdate;
3427 default: 3429 default:
3428 return PaintInvalidationFull; 3430 return PaintInvalidationFull;
3429 } 3431 }
3430 } 3432 }
3431 3433
3432 inline void LayoutObject::markContainerChainForPaintInvalidation() 3434 inline void LayoutObject::markAncestorsForPaintInvalidation()
3433 { 3435 {
3434 for (LayoutObject* container = this->containerCrossingFrameBoundaries(); con tainer && !container->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidati onState(); container = container->containerCrossingFrameBoundaries()) 3436 for (LayoutObject* container = this->parentCrossingFrameBoundaries(); contai ner && !container->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationS tate(); container = container->parentCrossingFrameBoundaries())
3435 container->m_bitfields.setChildShouldCheckForPaintInvalidation(true); 3437 container->m_bitfields.setChildShouldCheckForPaintInvalidation(true);
3436 } 3438 }
3437 3439
3438 void LayoutObject::setShouldInvalidateSelection() 3440 void LayoutObject::setShouldInvalidateSelection()
3439 { 3441 {
3440 if (!canUpdateSelectionOnRootLineBoxes()) 3442 if (!canUpdateSelectionOnRootLineBoxes())
3441 return; 3443 return;
3442 m_bitfields.setShouldInvalidateSelection(true); 3444 m_bitfields.setShouldInvalidateSelection(true);
3443 markContainerChainForPaintInvalidation(); 3445 markAncestorsForPaintInvalidation();
3444 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); 3446 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded();
3445 } 3447 }
3446 3448
3447 void LayoutObject::setShouldDoFullPaintInvalidation(PaintInvalidationReason reas on) 3449 void LayoutObject::setShouldDoFullPaintInvalidation(PaintInvalidationReason reas on)
3448 { 3450 {
3449 // Only full invalidation reasons are allowed. 3451 // Only full invalidation reasons are allowed.
3450 ASSERT(isFullPaintInvalidationReason(reason)); 3452 ASSERT(isFullPaintInvalidationReason(reason));
3451 3453
3452 bool isUpgradingDelayedFullToFull = m_bitfields.fullPaintInvalidationReason( ) == PaintInvalidationDelayedFull && reason != PaintInvalidationDelayedFull; 3454 bool isUpgradingDelayedFullToFull = m_bitfields.fullPaintInvalidationReason( ) == PaintInvalidationDelayedFull && reason != PaintInvalidationDelayedFull;
3453 3455
3454 if (m_bitfields.fullPaintInvalidationReason() == PaintInvalidationNone || is UpgradingDelayedFullToFull) { 3456 if (m_bitfields.fullPaintInvalidationReason() == PaintInvalidationNone || is UpgradingDelayedFullToFull) {
3455 if (reason == PaintInvalidationFull) 3457 if (reason == PaintInvalidationFull)
3456 reason = documentLifecycleBasedPaintInvalidationReason(document().li fecycle()); 3458 reason = documentLifecycleBasedPaintInvalidationReason(document().li fecycle());
3457 m_bitfields.setFullPaintInvalidationReason(reason); 3459 m_bitfields.setFullPaintInvalidationReason(reason);
3458 if (!isUpgradingDelayedFullToFull) 3460 if (!isUpgradingDelayedFullToFull)
3459 markContainerChainForPaintInvalidation(); 3461 markAncestorsForPaintInvalidation();
3460 } 3462 }
3461 3463
3462 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); 3464 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded();
3463 } 3465 }
3464 3466
3465 void LayoutObject::setMayNeedPaintInvalidation() 3467 void LayoutObject::setMayNeedPaintInvalidation()
3466 { 3468 {
3467 if (mayNeedPaintInvalidation()) 3469 if (mayNeedPaintInvalidation())
3468 return; 3470 return;
3469 m_bitfields.setMayNeedPaintInvalidation(true); 3471 m_bitfields.setMayNeedPaintInvalidation(true);
3470 markContainerChainForPaintInvalidation(); 3472 markAncestorsForPaintInvalidation();
3471 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); 3473 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded();
3472 } 3474 }
3473 3475
3474 void LayoutObject::clearPaintInvalidationFlags(const PaintInvalidationState& pai ntInvalidationState) 3476 void LayoutObject::clearPaintInvalidationFlags(const PaintInvalidationState& pai ntInvalidationState)
3475 { 3477 {
3476 // paintInvalidationStateIsDirty should be kept in sync with the 3478 // paintInvalidationStateIsDirty should be kept in sync with the
3477 // booleans that are cleared below. 3479 // booleans that are cleared below.
3478 ASSERT(paintInvalidationState.forcedSubtreeInvalidationWithinContainer() || paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinContainer() || p aintInvalidationStateIsDirty()); 3480 ASSERT(paintInvalidationState.forcedSubtreeInvalidationWithinContainer() || paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinContainer() || p aintInvalidationStateIsDirty());
3479 clearShouldDoFullPaintInvalidation(); 3481 clearShouldDoFullPaintInvalidation();
3480 m_bitfields.setChildShouldCheckForPaintInvalidation(false); 3482 m_bitfields.setChildShouldCheckForPaintInvalidation(false);
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
3714 const blink::LayoutObject* root = object1; 3716 const blink::LayoutObject* root = object1;
3715 while (root->parent()) 3717 while (root->parent())
3716 root = root->parent(); 3718 root = root->parent();
3717 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3719 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3718 } else { 3720 } else {
3719 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3721 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3720 } 3722 }
3721 } 3723 }
3722 3724
3723 #endif 3725 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698