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