Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1330 | 1330 |
| 1331 if (reason == PaintInvalidationDelayedFull) | 1331 if (reason == PaintInvalidationDelayedFull) |
| 1332 newPaintInvalidationState.pushDelayedPaintInvalidationTarget(*this); | 1332 newPaintInvalidationState.pushDelayedPaintInvalidationTarget(*this); |
| 1333 | 1333 |
| 1334 newPaintInvalidationState.updateForChildren(); | 1334 newPaintInvalidationState.updateForChildren(); |
| 1335 invalidatePaintOfSubtreesIfNeeded(newPaintInvalidationState); | 1335 invalidatePaintOfSubtreesIfNeeded(newPaintInvalidationState); |
| 1336 } | 1336 } |
| 1337 | 1337 |
| 1338 void LayoutObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat e& childPaintInvalidationState) | 1338 void LayoutObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat e& childPaintInvalidationState) |
| 1339 { | 1339 { |
| 1340 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli ng()) { | 1340 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli ng()) |
| 1341 if (!child->isOutOfFlowPositioned()) | 1341 child->invalidateTreeIfNeeded(childPaintInvalidationState); |
| 1342 child->invalidateTreeIfNeeded(childPaintInvalidationState); | |
| 1343 } | |
| 1344 } | 1342 } |
| 1345 | 1343 |
| 1346 static PassOwnPtr<TracedValue> jsonObjectForOldAndNewRects(const LayoutRect& old Rect, const LayoutPoint& oldLocation, const LayoutRect& newRect, const LayoutPoi nt& newLocation) | 1344 static PassOwnPtr<TracedValue> jsonObjectForOldAndNewRects(const LayoutRect& old Rect, const LayoutPoint& oldLocation, const LayoutRect& newRect, const LayoutPoi nt& newLocation) |
| 1347 { | 1345 { |
| 1348 OwnPtr<TracedValue> value = TracedValue::create(); | 1346 OwnPtr<TracedValue> value = TracedValue::create(); |
| 1349 addJsonObjectForRect(value.get(), "oldRect", oldRect); | 1347 addJsonObjectForRect(value.get(), "oldRect", oldRect); |
| 1350 addJsonObjectForPoint(value.get(), "oldLocation", oldLocation); | 1348 addJsonObjectForPoint(value.get(), "oldLocation", oldLocation); |
| 1351 addJsonObjectForRect(value.get(), "newRect", newRect); | 1349 addJsonObjectForRect(value.get(), "newRect", newRect); |
| 1352 addJsonObjectForPoint(value.get(), "newLocation", newLocation); | 1350 addJsonObjectForPoint(value.get(), "newLocation", newLocation); |
| 1353 return value.release(); | 1351 return value.release(); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1424 PaintLayer& layer = paintInvalidationState.enclosingSelfPaintingLayer(*t his); | 1422 PaintLayer& layer = paintInvalidationState.enclosingSelfPaintingLayer(*t his); |
| 1425 if (layer.layoutObject() != this) | 1423 if (layer.layoutObject() != this) |
| 1426 layer.setNeedsPaintPhaseDescendantOutlines(); | 1424 layer.setNeedsPaintPhaseDescendantOutlines(); |
| 1427 } | 1425 } |
| 1428 | 1426 |
| 1429 LayoutView* v = view(); | 1427 LayoutView* v = view(); |
| 1430 if (v->document().printing()) | 1428 if (v->document().printing()) |
| 1431 return PaintInvalidationNone; // Don't invalidate paints if we're printi ng. | 1429 return PaintInvalidationNone; // Don't invalidate paints if we're printi ng. |
| 1432 | 1430 |
| 1433 const LayoutBoxModelObject& paintInvalidationContainer = paintInvalidationSt ate.paintInvalidationContainer(); | 1431 const LayoutBoxModelObject& paintInvalidationContainer = paintInvalidationSt ate.paintInvalidationContainer(); |
| 1434 // TODO(wangxianzhu): Enable this assert after we fix all paintInvalidationC ontainer mismatch issues. crbug.com/360286 | 1432 ASSERT(paintInvalidationContainer == containerForPaintInvalidation()); |
| 1435 // ASSERT(paintInvalidationContainer == containerForPaintInvalidation()); | |
| 1436 | 1433 |
| 1437 const LayoutRect oldBounds = previousPaintInvalidationRect(); | 1434 const LayoutRect oldBounds = previousPaintInvalidationRect(); |
| 1438 const LayoutPoint oldLocation = RuntimeEnabledFeatures::slimmingPaintInvalid ationEnabled() ? LayoutPoint() : previousPositionFromPaintInvalidationBacking(); | 1435 const LayoutPoint oldLocation = RuntimeEnabledFeatures::slimmingPaintInvalid ationEnabled() ? LayoutPoint() : previousPositionFromPaintInvalidationBacking(); |
| 1439 LayoutRect newBounds = paintInvalidationState.computePaintInvalidationRectIn Backing(); | 1436 LayoutRect newBounds = paintInvalidationState.computePaintInvalidationRectIn Backing(); |
| 1440 LayoutPoint newLocation = RuntimeEnabledFeatures::slimmingPaintInvalidationE nabled() ? LayoutPoint() : paintInvalidationState.computePositionFromPaintInvali dationBacking(); | 1437 LayoutPoint newLocation = RuntimeEnabledFeatures::slimmingPaintInvalidationE nabled() ? LayoutPoint() : paintInvalidationState.computePositionFromPaintInvali dationBacking(); |
| 1441 | 1438 |
| 1442 // Composited scrolling should not be included in the bounds and position tr acking, because the graphics layer backing the scroller | 1439 // Composited scrolling should not be included in the bounds and position tr acking, because the graphics layer backing the scroller |
| 1443 // does not move on scroll. | 1440 // does not move on scroll. |
| 1444 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati onContainer != this) { | 1441 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati onContainer != this) { |
| 1445 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol ledContentOffset()); | 1442 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol ledContentOffset()); |
| (...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2609 break; | 2606 break; |
| 2610 } | 2607 } |
| 2611 } | 2608 } |
| 2612 } | 2609 } |
| 2613 return multicolContainer; | 2610 return multicolContainer; |
| 2614 } | 2611 } |
| 2615 | 2612 |
| 2616 return o; | 2613 return o; |
| 2617 } | 2614 } |
| 2618 | 2615 |
| 2619 LayoutObject* LayoutObject::containerCrossingFrameBoundaries() const | 2616 LayoutObject* LayoutObject::parentCrossingFrameBoundaries() const |
| 2620 { | 2617 { |
| 2621 return isLayoutView() ? frame()->ownerLayoutObject() : container(); | 2618 return isLayoutView() ? frame()->ownerLayoutObject() : parent(); |
| 2622 } | 2619 } |
| 2623 | 2620 |
| 2624 bool LayoutObject::isSelectionBorder() const | 2621 bool LayoutObject::isSelectionBorder() const |
| 2625 { | 2622 { |
| 2626 SelectionState st = getSelectionState(); | 2623 SelectionState st = getSelectionState(); |
| 2627 return st == SelectionStart || st == SelectionEnd || st == SelectionBoth; | 2624 return st == SelectionStart || st == SelectionEnd || st == SelectionBoth; |
| 2628 } | 2625 } |
| 2629 | 2626 |
| 2630 inline void LayoutObject::clearLayoutRootIfNeeded() const | 2627 inline void LayoutObject::clearLayoutRootIfNeeded() const |
| 2631 { | 2628 { |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3410 case DocumentLifecycle::InPerformLayout: | 3407 case DocumentLifecycle::InPerformLayout: |
| 3411 case DocumentLifecycle::AfterPerformLayout: | 3408 case DocumentLifecycle::AfterPerformLayout: |
| 3412 return PaintInvalidationForcedByLayout; | 3409 return PaintInvalidationForcedByLayout; |
| 3413 case DocumentLifecycle::InCompositingUpdate: | 3410 case DocumentLifecycle::InCompositingUpdate: |
| 3414 return PaintInvalidationCompositingUpdate; | 3411 return PaintInvalidationCompositingUpdate; |
| 3415 default: | 3412 default: |
| 3416 return PaintInvalidationFull; | 3413 return PaintInvalidationFull; |
| 3417 } | 3414 } |
| 3418 } | 3415 } |
| 3419 | 3416 |
| 3420 inline void LayoutObject::markContainerChainForPaintInvalidation() | 3417 inline void LayoutObject::markAncestorsForPaintInvalidation() |
| 3421 { | 3418 { |
| 3422 for (LayoutObject* container = this->containerCrossingFrameBoundaries(); con tainer && !container->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidati onState(); container = container->containerCrossingFrameBoundaries()) | 3419 for (LayoutObject* container = this->parentCrossingFrameBoundaries(); contai ner && !container->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationS tate(); container = container->parentCrossingFrameBoundaries()) |
|
leviw_travelin_and_unemployed
2016/04/04 23:56:12
Nit: s/container/parent/
Xianzhu
2016/04/05 00:01:39
Will upload a follow-up CL for this.
| |
| 3423 container->m_bitfields.setChildShouldCheckForPaintInvalidation(true); | 3420 container->m_bitfields.setChildShouldCheckForPaintInvalidation(true); |
| 3424 } | 3421 } |
| 3425 | 3422 |
| 3426 void LayoutObject::setShouldInvalidateSelection() | 3423 void LayoutObject::setShouldInvalidateSelection() |
| 3427 { | 3424 { |
| 3428 if (!canUpdateSelectionOnRootLineBoxes()) | 3425 if (!canUpdateSelectionOnRootLineBoxes()) |
| 3429 return; | 3426 return; |
| 3430 m_bitfields.setShouldInvalidateSelection(true); | 3427 m_bitfields.setShouldInvalidateSelection(true); |
| 3431 markContainerChainForPaintInvalidation(); | 3428 markAncestorsForPaintInvalidation(); |
| 3432 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); | 3429 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); |
| 3433 } | 3430 } |
| 3434 | 3431 |
| 3435 void LayoutObject::setShouldDoFullPaintInvalidation(PaintInvalidationReason reas on) | 3432 void LayoutObject::setShouldDoFullPaintInvalidation(PaintInvalidationReason reas on) |
| 3436 { | 3433 { |
| 3437 // Only full invalidation reasons are allowed. | 3434 // Only full invalidation reasons are allowed. |
| 3438 ASSERT(isFullPaintInvalidationReason(reason)); | 3435 ASSERT(isFullPaintInvalidationReason(reason)); |
| 3439 | 3436 |
| 3440 bool isUpgradingDelayedFullToFull = m_bitfields.fullPaintInvalidationReason( ) == PaintInvalidationDelayedFull && reason != PaintInvalidationDelayedFull; | 3437 bool isUpgradingDelayedFullToFull = m_bitfields.fullPaintInvalidationReason( ) == PaintInvalidationDelayedFull && reason != PaintInvalidationDelayedFull; |
| 3441 | 3438 |
| 3442 if (m_bitfields.fullPaintInvalidationReason() == PaintInvalidationNone || is UpgradingDelayedFullToFull) { | 3439 if (m_bitfields.fullPaintInvalidationReason() == PaintInvalidationNone || is UpgradingDelayedFullToFull) { |
| 3443 if (reason == PaintInvalidationFull) | 3440 if (reason == PaintInvalidationFull) |
| 3444 reason = documentLifecycleBasedPaintInvalidationReason(document().li fecycle()); | 3441 reason = documentLifecycleBasedPaintInvalidationReason(document().li fecycle()); |
| 3445 m_bitfields.setFullPaintInvalidationReason(reason); | 3442 m_bitfields.setFullPaintInvalidationReason(reason); |
| 3446 if (!isUpgradingDelayedFullToFull) | 3443 if (!isUpgradingDelayedFullToFull) |
| 3447 markContainerChainForPaintInvalidation(); | 3444 markAncestorsForPaintInvalidation(); |
| 3448 } | 3445 } |
| 3449 | 3446 |
| 3450 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); | 3447 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); |
| 3451 } | 3448 } |
| 3452 | 3449 |
| 3453 void LayoutObject::setMayNeedPaintInvalidation() | 3450 void LayoutObject::setMayNeedPaintInvalidation() |
| 3454 { | 3451 { |
| 3455 if (mayNeedPaintInvalidation()) | 3452 if (mayNeedPaintInvalidation()) |
| 3456 return; | 3453 return; |
| 3457 m_bitfields.setMayNeedPaintInvalidation(true); | 3454 m_bitfields.setMayNeedPaintInvalidation(true); |
| 3458 markContainerChainForPaintInvalidation(); | 3455 markAncestorsForPaintInvalidation(); |
| 3459 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); | 3456 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); |
| 3460 } | 3457 } |
| 3461 | 3458 |
| 3462 void LayoutObject::clearPaintInvalidationFlags(const PaintInvalidationState& pai ntInvalidationState) | 3459 void LayoutObject::clearPaintInvalidationFlags(const PaintInvalidationState& pai ntInvalidationState) |
| 3463 { | 3460 { |
| 3464 // paintInvalidationStateIsDirty should be kept in sync with the | 3461 // paintInvalidationStateIsDirty should be kept in sync with the |
| 3465 // booleans that are cleared below. | 3462 // booleans that are cleared below. |
| 3466 ASSERT(paintInvalidationState.forcedSubtreeInvalidationWithinContainer() || paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinContainer() || p aintInvalidationStateIsDirty()); | 3463 ASSERT(paintInvalidationState.forcedSubtreeInvalidationWithinContainer() || paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinContainer() || p aintInvalidationStateIsDirty()); |
| 3467 clearShouldDoFullPaintInvalidation(); | 3464 clearShouldDoFullPaintInvalidation(); |
| 3468 m_bitfields.setChildShouldCheckForPaintInvalidation(false); | 3465 m_bitfields.setChildShouldCheckForPaintInvalidation(false); |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3702 const blink::LayoutObject* root = object1; | 3699 const blink::LayoutObject* root = object1; |
| 3703 while (root->parent()) | 3700 while (root->parent()) |
| 3704 root = root->parent(); | 3701 root = root->parent(); |
| 3705 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3702 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
| 3706 } else { | 3703 } else { |
| 3707 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3704 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
| 3708 } | 3705 } |
| 3709 } | 3706 } |
| 3710 | 3707 |
| 3711 #endif | 3708 #endif |
| OLD | NEW |