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 2643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2654 } | 2654 } |
2655 | 2655 |
2656 if (isOutOfFlowPositioned() && parent()->childrenInline()) | 2656 if (isOutOfFlowPositioned() && parent()->childrenInline()) |
2657 parent()->dirtyLinesFromChangedChild(this); | 2657 parent()->dirtyLinesFromChangedChild(this); |
2658 | 2658 |
2659 removeFromLayoutFlowThread(); | 2659 removeFromLayoutFlowThread(); |
2660 | 2660 |
2661 // Update cached boundaries in SVG layoutObjects if a child is removed. | 2661 // Update cached boundaries in SVG layoutObjects if a child is removed. |
2662 if (parent()->isSVG()) | 2662 if (parent()->isSVG()) |
2663 parent()->setNeedsBoundariesUpdate(); | 2663 parent()->setNeedsBoundariesUpdate(); |
2664 | |
2665 clearScrollAnchorIfNeeded(); | |
2666 } | |
2667 | |
2668 void LayoutObject::clearScrollAnchorIfNeeded() const | |
2669 { | |
2670 if (!scrollAnchoringEnabled()) | |
2671 return; | |
2672 | |
2673 PaintLayer* layer = parent()->enclosingLayer(); | |
2674 | |
2675 // Walk up the layer tree to clear any scroll anchors that reference us. | |
2676 // TODO(skobes): Should this be a hash lookup or a data member instead? | |
2677 while (layer) { | |
2678 if (PaintLayerScrollableArea* scrollableArea = layer->scrollableArea()) { | |
2679 ScrollAnchor& anchor = scrollableArea->scrollAnchor(); | |
2680 if (anchor.layoutObject() == this) | |
2681 anchor.clear(); | |
2682 } | |
2683 layer = layer->parent(); | |
ojan
2016/02/02 06:51:01
I think this is O(n^2) in the depth of the layer t
skobes
2016/02/02 22:39:10
Yes my first thought was to add a back pointer to
| |
2684 } | |
2685 if (FrameView* view = frameView()) { | |
2686 ScrollAnchor& anchor = view->scrollAnchor(); | |
2687 if (anchor.layoutObject() == this) | |
2688 anchor.clear(); | |
2689 } | |
2664 } | 2690 } |
2665 | 2691 |
2666 void LayoutObject::removeFromLayoutFlowThread() | 2692 void LayoutObject::removeFromLayoutFlowThread() |
2667 { | 2693 { |
2668 if (!isInsideFlowThread()) | 2694 if (!isInsideFlowThread()) |
2669 return; | 2695 return; |
2670 | 2696 |
2671 // Sometimes we remove the element from the flow, but it's not destroyed at that time. | 2697 // Sometimes we remove the element from the flow, but it's not destroyed at that time. |
2672 // It's only until later when we actually destroy it and remove all the chil dren from it. | 2698 // It's only until later when we actually destroy it and remove all the chil dren from it. |
2673 // Currently, that happens for firstLetter elements and list markers. | 2699 // Currently, that happens for firstLetter elements and list markers. |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3520 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 3546 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
3521 objectPaintPropertiesMap().set(this, paintProperties); | 3547 objectPaintPropertiesMap().set(this, paintProperties); |
3522 } | 3548 } |
3523 | 3549 |
3524 void LayoutObject::clearObjectPaintProperties() | 3550 void LayoutObject::clearObjectPaintProperties() |
3525 { | 3551 { |
3526 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 3552 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
3527 objectPaintPropertiesMap().remove(this); | 3553 objectPaintPropertiesMap().remove(this); |
3528 } | 3554 } |
3529 | 3555 |
3556 bool LayoutObject::scrollAnchoringEnabled() const | |
3557 { | |
3558 if (Settings* settings = document().settings()) | |
3559 return settings->scrollAnchoringEnabled(); | |
3560 return false; | |
3561 } | |
3562 | |
3530 } // namespace blink | 3563 } // namespace blink |
3531 | 3564 |
3532 #ifndef NDEBUG | 3565 #ifndef NDEBUG |
3533 | 3566 |
3534 void showTree(const blink::LayoutObject* object) | 3567 void showTree(const blink::LayoutObject* object) |
3535 { | 3568 { |
3536 if (object) | 3569 if (object) |
3537 object->showTreeForThis(); | 3570 object->showTreeForThis(); |
3538 else | 3571 else |
3539 fprintf(stderr, "Cannot showTree. Root is (nil)\n"); | 3572 fprintf(stderr, "Cannot showTree. Root is (nil)\n"); |
(...skipping 18 matching lines...) Expand all Loading... | |
3558 const blink::LayoutObject* root = object1; | 3591 const blink::LayoutObject* root = object1; |
3559 while (root->parent()) | 3592 while (root->parent()) |
3560 root = root->parent(); | 3593 root = root->parent(); |
3561 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3594 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3562 } else { | 3595 } else { |
3563 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3596 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3564 } | 3597 } |
3565 } | 3598 } |
3566 | 3599 |
3567 #endif | 3600 #endif |
OLD | NEW |