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. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. |
7 * All rights reserved. | 7 * All rights reserved. |
8 * Copyright (C) 2009 Google Inc. All rights reserved. | 8 * Copyright (C) 2009 Google Inc. All rights reserved. |
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
10 * (http://www.torchmobile.com/) | 10 * (http://www.torchmobile.com/) |
(...skipping 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 ? object->parent() | 1617 ? object->parent() |
1618 : object->containingBlock(); | 1618 : object->containingBlock(); |
1619 if (object) | 1619 if (object) |
1620 object->setChildNeedsOverflowRecalcAfterStyleChange(); | 1620 object->setChildNeedsOverflowRecalcAfterStyleChange(); |
1621 } while (object); | 1621 } while (object); |
1622 } | 1622 } |
1623 | 1623 |
1624 void LayoutObject::setNeedsOverflowRecalcAfterStyleChange() { | 1624 void LayoutObject::setNeedsOverflowRecalcAfterStyleChange() { |
1625 bool neededRecalc = needsOverflowRecalcAfterStyleChange(); | 1625 bool neededRecalc = needsOverflowRecalcAfterStyleChange(); |
1626 setSelfNeedsOverflowRecalcAfterStyleChange(); | 1626 setSelfNeedsOverflowRecalcAfterStyleChange(); |
1627 setMayNeedPaintInvalidation(); | |
1628 if (!neededRecalc) | 1627 if (!neededRecalc) |
1629 markAncestorsForOverflowRecalcIfNeeded(); | 1628 markAncestorsForOverflowRecalcIfNeeded(); |
1630 } | 1629 } |
1631 | 1630 |
1632 DISABLE_CFI_PERF | 1631 DISABLE_CFI_PERF |
1633 void LayoutObject::setStyle(PassRefPtr<ComputedStyle> style) { | 1632 void LayoutObject::setStyle(PassRefPtr<ComputedStyle> style) { |
1634 ASSERT(style); | 1633 ASSERT(style); |
1635 | 1634 |
1636 if (m_style == style) { | 1635 if (m_style == style) { |
1637 // We need to run through adjustStyleDifference() for iframes, plugins, and | 1636 // We need to run through adjustStyleDifference() for iframes, plugins, and |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1717 | 1716 |
1718 if (diff.needsRecomputeOverflow() && !needsLayout()) { | 1717 if (diff.needsRecomputeOverflow() && !needsLayout()) { |
1719 // TODO(rhogan): Make inlines capable of recomputing overflow too. | 1718 // TODO(rhogan): Make inlines capable of recomputing overflow too. |
1720 if (isLayoutBlock()) | 1719 if (isLayoutBlock()) |
1721 setNeedsOverflowRecalcAfterStyleChange(); | 1720 setNeedsOverflowRecalcAfterStyleChange(); |
1722 else | 1721 else |
1723 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange); | 1722 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange); |
1724 } | 1723 } |
1725 | 1724 |
1726 if (diff.needsPaintInvalidationSubtree() || | 1725 if (diff.needsPaintInvalidationSubtree() || |
1727 updatedDiff.needsPaintInvalidationSubtree()) { | 1726 updatedDiff.needsPaintInvalidationSubtree()) |
1728 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); | 1727 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); |
1729 } else if (diff.needsPaintInvalidationObject() || | 1728 else if (diff.needsPaintInvalidationObject() || |
1730 updatedDiff.needsPaintInvalidationObject()) { | 1729 updatedDiff.needsPaintInvalidationObject()) |
1731 // TODO(wangxianzhu): For now LayoutSVGRoot::localVisualRect() depends on | 1730 setShouldDoFullPaintInvalidation(); |
1732 // several styles. Refactor to avoid this special case. | |
1733 if (isSVGRoot()) | |
1734 setShouldDoFullPaintInvalidation(); | |
1735 else | |
1736 setShouldDoFullPaintInvalidationWithoutGeometryChange(); | |
1737 } | |
1738 | 1731 |
1739 // Text nodes share style with their parents but the paint properties don't | 1732 // Text nodes share style with their parents but the paint properties don't |
1740 // apply to them, hence the !isText() check. | 1733 // apply to them, hence the !isText() check. |
1741 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && !isText() && | 1734 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && !isText() && |
1742 (diff.transformChanged() || diff.opacityChanged() || | 1735 (diff.transformChanged() || diff.opacityChanged() || |
1743 diff.zIndexChanged() || diff.filterChanged() || | 1736 diff.zIndexChanged() || diff.filterChanged() || |
1744 diff.backdropFilterChanged() || diff.cssClipChanged())) { | 1737 diff.backdropFilterChanged() || diff.cssClipChanged())) { |
1745 setNeedsPaintPropertyUpdate(); | 1738 setNeedsPaintPropertyUpdate(); |
1746 | 1739 |
1747 // We don't need to invalidate paint of objects on SPv2 when only paint | 1740 // We don't need to invalidate paint of objects on SPv2 when only paint |
(...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3409 return PaintInvalidationCompositingUpdate; | 3402 return PaintInvalidationCompositingUpdate; |
3410 default: | 3403 default: |
3411 return PaintInvalidationFull; | 3404 return PaintInvalidationFull; |
3412 } | 3405 } |
3413 } | 3406 } |
3414 | 3407 |
3415 inline void LayoutObject::markAncestorsForPaintInvalidation() { | 3408 inline void LayoutObject::markAncestorsForPaintInvalidation() { |
3416 for (LayoutObject* parent = this->paintInvalidationParent(); | 3409 for (LayoutObject* parent = this->paintInvalidationParent(); |
3417 parent && !parent->shouldCheckForPaintInvalidation(); | 3410 parent && !parent->shouldCheckForPaintInvalidation(); |
3418 parent = parent->paintInvalidationParent()) | 3411 parent = parent->paintInvalidationParent()) |
3419 parent->m_bitfields.setMayNeedPaintInvalidation(true); | 3412 parent->m_bitfields.setChildShouldCheckForPaintInvalidation(true); |
3420 } | |
3421 | |
3422 inline void LayoutObject::setNeedsPaintOffsetAndVisualRectUpdate() { | |
3423 if (needsPaintOffsetAndVisualRectUpdate()) | |
3424 return; | |
3425 m_bitfields.setNeedsPaintOffsetAndVisualRectUpdate(true); | |
3426 for (LayoutObject* parent = paintInvalidationParent(); | |
3427 parent && !parent->needsPaintOffsetAndVisualRectUpdate(); | |
3428 parent = parent->paintInvalidationParent()) | |
3429 parent->m_bitfields.setNeedsPaintOffsetAndVisualRectUpdate(true); | |
3430 } | 3413 } |
3431 | 3414 |
3432 void LayoutObject::setShouldInvalidateSelection() { | 3415 void LayoutObject::setShouldInvalidateSelection() { |
3433 if (!canUpdateSelectionOnRootLineBoxes()) | 3416 if (!canUpdateSelectionOnRootLineBoxes()) |
3434 return; | 3417 return; |
3435 m_bitfields.setShouldInvalidateSelection(true); | 3418 m_bitfields.setShouldInvalidateSelection(true); |
3436 setMayNeedPaintInvalidation(); | 3419 markAncestorsForPaintInvalidation(); |
3437 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); | 3420 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); |
3438 } | 3421 } |
3439 | 3422 |
3440 bool LayoutObject::shouldCheckForPaintInvalidationWithPaintInvalidationState( | 3423 bool LayoutObject::shouldCheckForPaintInvalidationWithPaintInvalidationState( |
3441 const PaintInvalidationState& paintInvalidationState) const { | 3424 const PaintInvalidationState& paintInvalidationState) const { |
3442 return paintInvalidationState.hasForcedSubtreeInvalidationFlags() || | 3425 return paintInvalidationState.hasForcedSubtreeInvalidationFlags() || |
3443 shouldCheckForPaintInvalidation(); | 3426 shouldCheckForPaintInvalidation(); |
3444 } | 3427 } |
3445 | 3428 |
3446 void LayoutObject::setShouldDoFullPaintInvalidation( | 3429 void LayoutObject::setShouldDoFullPaintInvalidation( |
3447 PaintInvalidationReason reason) { | 3430 PaintInvalidationReason reason) { |
3448 setNeedsPaintOffsetAndVisualRectUpdate(); | |
3449 setShouldDoFullPaintInvalidationWithoutGeometryChange(reason); | |
3450 } | |
3451 | |
3452 void LayoutObject::setShouldDoFullPaintInvalidationWithoutGeometryChange( | |
3453 PaintInvalidationReason reason) { | |
3454 // Only full invalidation reasons are allowed. | 3431 // Only full invalidation reasons are allowed. |
3455 DCHECK(isFullPaintInvalidationReason(reason)); | 3432 ASSERT(isFullPaintInvalidationReason(reason)); |
3456 | 3433 |
3457 bool isUpgradingDelayedFullToFull = | 3434 bool isUpgradingDelayedFullToFull = |
3458 m_bitfields.fullPaintInvalidationReason() == | 3435 m_bitfields.fullPaintInvalidationReason() == |
3459 PaintInvalidationDelayedFull && | 3436 PaintInvalidationDelayedFull && |
3460 reason != PaintInvalidationDelayedFull; | 3437 reason != PaintInvalidationDelayedFull; |
3461 | 3438 |
3462 if (m_bitfields.fullPaintInvalidationReason() == PaintInvalidationNone || | 3439 if (m_bitfields.fullPaintInvalidationReason() == PaintInvalidationNone || |
3463 isUpgradingDelayedFullToFull) { | 3440 isUpgradingDelayedFullToFull) { |
3464 if (reason == PaintInvalidationFull) | 3441 if (reason == PaintInvalidationFull) |
3465 reason = | 3442 reason = |
3466 documentLifecycleBasedPaintInvalidationReason(document().lifecycle()); | 3443 documentLifecycleBasedPaintInvalidationReason(document().lifecycle()); |
3467 m_bitfields.setFullPaintInvalidationReason(reason); | 3444 m_bitfields.setFullPaintInvalidationReason(reason); |
3468 if (!isUpgradingDelayedFullToFull) | 3445 if (!isUpgradingDelayedFullToFull) |
3469 markAncestorsForPaintInvalidation(); | 3446 markAncestorsForPaintInvalidation(); |
3470 } | 3447 } |
3471 | 3448 |
3472 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); | 3449 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); |
3473 } | 3450 } |
3474 | 3451 |
3475 void LayoutObject::setMayNeedPaintInvalidation() { | 3452 void LayoutObject::setMayNeedPaintInvalidation() { |
3476 setNeedsPaintOffsetAndVisualRectUpdate(); | |
3477 setMayNeedPaintInvalidationWithoutGeometryChange(); | |
3478 } | |
3479 | |
3480 void LayoutObject::setMayNeedPaintInvalidationWithoutGeometryChange() { | |
3481 if (mayNeedPaintInvalidation()) | 3453 if (mayNeedPaintInvalidation()) |
3482 return; | 3454 return; |
3483 m_bitfields.setMayNeedPaintInvalidation(true); | 3455 m_bitfields.setMayNeedPaintInvalidation(true); |
3484 markAncestorsForPaintInvalidation(); | 3456 markAncestorsForPaintInvalidation(); |
3485 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); | 3457 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); |
3486 } | 3458 } |
3487 | 3459 |
3488 void LayoutObject::setMayNeedPaintInvalidationSubtree() { | 3460 void LayoutObject::setMayNeedPaintInvalidationSubtree() { |
3489 if (mayNeedPaintInvalidationSubtree()) | 3461 if (mayNeedPaintInvalidationSubtree()) |
3490 return; | 3462 return; |
3491 m_bitfields.setMayNeedPaintInvalidationSubtree(true); | 3463 m_bitfields.setMayNeedPaintInvalidationSubtree(true); |
3492 setMayNeedPaintInvalidation(); | 3464 setMayNeedPaintInvalidation(); |
3493 } | 3465 } |
3494 | 3466 |
3495 void LayoutObject::setMayNeedPaintInvalidationAnimatedBackgroundImage() { | 3467 void LayoutObject::setMayNeedPaintInvalidationAnimatedBackgroundImage() { |
3496 if (mayNeedPaintInvalidationAnimatedBackgroundImage()) | 3468 if (mayNeedPaintInvalidationAnimatedBackgroundImage()) |
3497 return; | 3469 return; |
3498 m_bitfields.setMayNeedPaintInvalidationAnimatedBackgroundImage(true); | 3470 m_bitfields.setMayNeedPaintInvalidationAnimatedBackgroundImage(true); |
3499 setMayNeedPaintInvalidationWithoutGeometryChange(); | 3471 setMayNeedPaintInvalidation(); |
3500 } | 3472 } |
3501 | 3473 |
3502 void LayoutObject::clearPaintInvalidationFlags() { | 3474 void LayoutObject::clearPaintInvalidationFlags() { |
3503 // paintInvalidationStateIsDirty should be kept in sync with the | 3475 // paintInvalidationStateIsDirty should be kept in sync with the |
3504 // booleans that are cleared below. | 3476 // booleans that are cleared below. |
3505 #if DCHECK_IS_ON() | 3477 #if DCHECK_IS_ON() |
3506 DCHECK(!shouldCheckForPaintInvalidation() || paintInvalidationStateIsDirty()); | 3478 DCHECK(!shouldCheckForPaintInvalidation() || paintInvalidationStateIsDirty()); |
3507 #endif | 3479 #endif |
3508 clearShouldDoFullPaintInvalidation(); | 3480 clearShouldDoFullPaintInvalidation(); |
| 3481 m_bitfields.setChildShouldCheckForPaintInvalidation(false); |
3509 m_bitfields.setMayNeedPaintInvalidation(false); | 3482 m_bitfields.setMayNeedPaintInvalidation(false); |
3510 m_bitfields.setMayNeedPaintInvalidationSubtree(false); | 3483 m_bitfields.setMayNeedPaintInvalidationSubtree(false); |
3511 m_bitfields.setMayNeedPaintInvalidationAnimatedBackgroundImage(false); | 3484 m_bitfields.setMayNeedPaintInvalidationAnimatedBackgroundImage(false); |
3512 m_bitfields.setNeedsPaintOffsetAndVisualRectUpdate(false); | |
3513 m_bitfields.setShouldInvalidateSelection(false); | 3485 m_bitfields.setShouldInvalidateSelection(false); |
3514 m_bitfields.setBackgroundChangedSinceLastPaintInvalidation(false); | 3486 m_bitfields.setBackgroundChangedSinceLastPaintInvalidation(false); |
3515 } | 3487 } |
3516 | 3488 |
3517 bool LayoutObject::isAllowedToModifyLayoutTreeStructure(Document& document) { | 3489 bool LayoutObject::isAllowedToModifyLayoutTreeStructure(Document& document) { |
3518 return DeprecatedDisableModifyLayoutTreeStructureAsserts:: | 3490 return DeprecatedDisableModifyLayoutTreeStructureAsserts:: |
3519 canModifyLayoutTreeStateInAnyState() || | 3491 canModifyLayoutTreeStateInAnyState() || |
3520 document.lifecycle().stateAllowsLayoutTreeMutations(); | 3492 document.lifecycle().stateAllowsLayoutTreeMutations(); |
3521 } | 3493 } |
3522 | 3494 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3625 const blink::LayoutObject* root = object1; | 3597 const blink::LayoutObject* root = object1; |
3626 while (root->parent()) | 3598 while (root->parent()) |
3627 root = root->parent(); | 3599 root = root->parent(); |
3628 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3600 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3629 } else { | 3601 } else { |
3630 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); | 3602 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); |
3631 } | 3603 } |
3632 } | 3604 } |
3633 | 3605 |
3634 #endif | 3606 #endif |
OLD | NEW |