| 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 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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()) |
| 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 Loading... |
| 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 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2613 break; | 2610 break; |
| 2614 } | 2611 } |
| 2615 } | 2612 } |
| 2616 } | 2613 } |
| 2617 return multicolContainer; | 2614 return multicolContainer; |
| 2618 } | 2615 } |
| 2619 | 2616 |
| 2620 return o; | 2617 return o; |
| 2621 } | 2618 } |
| 2622 | 2619 |
| 2623 LayoutObject* LayoutObject::containerCrossingFrameBoundaries() const | 2620 LayoutObject* LayoutObject::parentCrossingFrameBoundaries() const |
| 2624 { | 2621 { |
| 2625 return isLayoutView() ? frame()->ownerLayoutObject() : container(); | 2622 return isLayoutView() ? frame()->ownerLayoutObject() : parent(); |
| 2626 } | 2623 } |
| 2627 | 2624 |
| 2628 bool LayoutObject::isSelectionBorder() const | 2625 bool LayoutObject::isSelectionBorder() const |
| 2629 { | 2626 { |
| 2630 SelectionState st = getSelectionState(); | 2627 SelectionState st = getSelectionState(); |
| 2631 return st == SelectionStart || st == SelectionEnd || st == SelectionBoth; | 2628 return st == SelectionStart || st == SelectionEnd || st == SelectionBoth; |
| 2632 } | 2629 } |
| 2633 | 2630 |
| 2634 inline void LayoutObject::clearLayoutRootIfNeeded() const | 2631 inline void LayoutObject::clearLayoutRootIfNeeded() const |
| 2635 { | 2632 { |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3414 case DocumentLifecycle::InPerformLayout: | 3411 case DocumentLifecycle::InPerformLayout: |
| 3415 case DocumentLifecycle::AfterPerformLayout: | 3412 case DocumentLifecycle::AfterPerformLayout: |
| 3416 return PaintInvalidationForcedByLayout; | 3413 return PaintInvalidationForcedByLayout; |
| 3417 case DocumentLifecycle::InCompositingUpdate: | 3414 case DocumentLifecycle::InCompositingUpdate: |
| 3418 return PaintInvalidationCompositingUpdate; | 3415 return PaintInvalidationCompositingUpdate; |
| 3419 default: | 3416 default: |
| 3420 return PaintInvalidationFull; | 3417 return PaintInvalidationFull; |
| 3421 } | 3418 } |
| 3422 } | 3419 } |
| 3423 | 3420 |
| 3424 inline void LayoutObject::markContainerChainForPaintInvalidation() | 3421 inline void LayoutObject::markAncestorsForPaintInvalidation() |
| 3425 { | 3422 { |
| 3426 for (LayoutObject* container = this->containerCrossingFrameBoundaries(); con
tainer && !container->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidati
onState(); container = container->containerCrossingFrameBoundaries()) | 3423 for (LayoutObject* container = this->parentCrossingFrameBoundaries(); contai
ner && !container->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationS
tate(); container = container->parentCrossingFrameBoundaries()) |
| 3427 container->m_bitfields.setChildShouldCheckForPaintInvalidation(true); | 3424 container->m_bitfields.setChildShouldCheckForPaintInvalidation(true); |
| 3428 } | 3425 } |
| 3429 | 3426 |
| 3430 void LayoutObject::setShouldInvalidateSelection() | 3427 void LayoutObject::setShouldInvalidateSelection() |
| 3431 { | 3428 { |
| 3432 if (!canUpdateSelectionOnRootLineBoxes()) | 3429 if (!canUpdateSelectionOnRootLineBoxes()) |
| 3433 return; | 3430 return; |
| 3434 m_bitfields.setShouldInvalidateSelection(true); | 3431 m_bitfields.setShouldInvalidateSelection(true); |
| 3435 markContainerChainForPaintInvalidation(); | 3432 markAncestorsForPaintInvalidation(); |
| 3436 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); | 3433 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); |
| 3437 } | 3434 } |
| 3438 | 3435 |
| 3439 void LayoutObject::setShouldDoFullPaintInvalidation(PaintInvalidationReason reas
on) | 3436 void LayoutObject::setShouldDoFullPaintInvalidation(PaintInvalidationReason reas
on) |
| 3440 { | 3437 { |
| 3441 // Only full invalidation reasons are allowed. | 3438 // Only full invalidation reasons are allowed. |
| 3442 ASSERT(isFullPaintInvalidationReason(reason)); | 3439 ASSERT(isFullPaintInvalidationReason(reason)); |
| 3443 | 3440 |
| 3444 bool isUpgradingDelayedFullToFull = m_bitfields.fullPaintInvalidationReason(
) == PaintInvalidationDelayedFull && reason != PaintInvalidationDelayedFull; | 3441 bool isUpgradingDelayedFullToFull = m_bitfields.fullPaintInvalidationReason(
) == PaintInvalidationDelayedFull && reason != PaintInvalidationDelayedFull; |
| 3445 | 3442 |
| 3446 if (m_bitfields.fullPaintInvalidationReason() == PaintInvalidationNone || is
UpgradingDelayedFullToFull) { | 3443 if (m_bitfields.fullPaintInvalidationReason() == PaintInvalidationNone || is
UpgradingDelayedFullToFull) { |
| 3447 if (reason == PaintInvalidationFull) | 3444 if (reason == PaintInvalidationFull) |
| 3448 reason = documentLifecycleBasedPaintInvalidationReason(document().li
fecycle()); | 3445 reason = documentLifecycleBasedPaintInvalidationReason(document().li
fecycle()); |
| 3449 m_bitfields.setFullPaintInvalidationReason(reason); | 3446 m_bitfields.setFullPaintInvalidationReason(reason); |
| 3450 if (!isUpgradingDelayedFullToFull) | 3447 if (!isUpgradingDelayedFullToFull) |
| 3451 markContainerChainForPaintInvalidation(); | 3448 markAncestorsForPaintInvalidation(); |
| 3452 } | 3449 } |
| 3453 | 3450 |
| 3454 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); | 3451 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); |
| 3455 } | 3452 } |
| 3456 | 3453 |
| 3457 void LayoutObject::setMayNeedPaintInvalidation() | 3454 void LayoutObject::setMayNeedPaintInvalidation() |
| 3458 { | 3455 { |
| 3459 if (mayNeedPaintInvalidation()) | 3456 if (mayNeedPaintInvalidation()) |
| 3460 return; | 3457 return; |
| 3461 m_bitfields.setMayNeedPaintInvalidation(true); | 3458 m_bitfields.setMayNeedPaintInvalidation(true); |
| 3462 markContainerChainForPaintInvalidation(); | 3459 markAncestorsForPaintInvalidation(); |
| 3463 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); | 3460 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); |
| 3464 } | 3461 } |
| 3465 | 3462 |
| 3466 void LayoutObject::clearPaintInvalidationFlags(const PaintInvalidationState& pai
ntInvalidationState) | 3463 void LayoutObject::clearPaintInvalidationFlags(const PaintInvalidationState& pai
ntInvalidationState) |
| 3467 { | 3464 { |
| 3468 // paintInvalidationStateIsDirty should be kept in sync with the | 3465 // paintInvalidationStateIsDirty should be kept in sync with the |
| 3469 // booleans that are cleared below. | 3466 // booleans that are cleared below. |
| 3470 ASSERT(paintInvalidationState.forcedSubtreeInvalidationWithinContainer() ||
paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinContainer() || p
aintInvalidationStateIsDirty()); | 3467 ASSERT(paintInvalidationState.forcedSubtreeInvalidationWithinContainer() ||
paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinContainer() || p
aintInvalidationStateIsDirty()); |
| 3471 clearShouldDoFullPaintInvalidation(); | 3468 clearShouldDoFullPaintInvalidation(); |
| 3472 m_bitfields.setChildShouldCheckForPaintInvalidation(false); | 3469 m_bitfields.setChildShouldCheckForPaintInvalidation(false); |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3706 const blink::LayoutObject* root = object1; | 3703 const blink::LayoutObject* root = object1; |
| 3707 while (root->parent()) | 3704 while (root->parent()) |
| 3708 root = root->parent(); | 3705 root = root->parent(); |
| 3709 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3706 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
| 3710 } else { | 3707 } else { |
| 3711 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3708 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
| 3712 } | 3709 } |
| 3713 } | 3710 } |
| 3714 | 3711 |
| 3715 #endif | 3712 #endif |
| OLD | NEW |