Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 1971423002: Implement bounce suppression in ScrollAnchor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address ymalik review comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2740 matching lines...) Expand 10 before | Expand all | Expand 10 after
2751 { 2751 {
2752 PaintLayer* layer = nullptr; 2752 PaintLayer* layer = nullptr;
2753 if (LayoutObject* parent = layoutObject->parent()) 2753 if (LayoutObject* parent = layoutObject->parent())
2754 layer = parent->enclosingLayer(); 2754 layer = parent->enclosingLayer();
2755 bool found = false; 2755 bool found = false;
2756 2756
2757 // Walk up the layer tree to clear any scroll anchors that reference us. 2757 // Walk up the layer tree to clear any scroll anchors that reference us.
2758 while (layer) { 2758 while (layer) {
2759 if (PaintLayerScrollableArea* scrollableArea = layer->getScrollableArea( )) { 2759 if (PaintLayerScrollableArea* scrollableArea = layer->getScrollableArea( )) {
2760 ScrollAnchor& anchor = scrollableArea->scrollAnchor(); 2760 ScrollAnchor& anchor = scrollableArea->scrollAnchor();
2761 if (anchor.anchorObject() == layoutObject) { 2761 if (anchor.refersTo(layoutObject)) {
2762 found = true; 2762 found = true;
2763 if (behavior == Clear) 2763 if (behavior == Clear)
2764 anchor.clear(); 2764 anchor.notifyRemoved(layoutObject);
2765 else 2765 else
2766 return true; 2766 return true;
2767 } 2767 }
2768 } 2768 }
2769 layer = layer->parent(); 2769 layer = layer->parent();
2770 } 2770 }
2771 if (FrameView* view = layoutObject->frameView()) { 2771 if (FrameView* view = layoutObject->frameView()) {
2772 ScrollAnchor& anchor = view->scrollAnchor(); 2772 ScrollAnchor& anchor = view->scrollAnchor();
2773 if (anchor.anchorObject() == layoutObject) { 2773 if (anchor.refersTo(layoutObject)) {
2774 found = true; 2774 found = true;
2775 if (behavior == Clear) 2775 if (behavior == Clear)
2776 anchor.clear(); 2776 anchor.notifyRemoved(layoutObject);
2777 } 2777 }
2778 } 2778 }
2779 return found; 2779 return found;
2780 } 2780 }
2781 2781
2782 void LayoutObject::willBeRemovedFromTree() 2782 void LayoutObject::willBeRemovedFromTree()
2783 { 2783 {
2784 // FIXME: We should ASSERT(isRooted()) but we have some out-of-order removal s which would need to be fixed first. 2784 // FIXME: We should ASSERT(isRooted()) but we have some out-of-order removal s which would need to be fixed first.
2785 2785
2786 // If we remove a visible child from an invisible parent, we don't know the layer visibility any more. 2786 // If we remove a visible child from an invisible parent, we don't know the layer visibility any more.
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
3690 const blink::LayoutObject* root = object1; 3690 const blink::LayoutObject* root = object1;
3691 while (root->parent()) 3691 while (root->parent())
3692 root = root->parent(); 3692 root = root->parent();
3693 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3693 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3694 } else { 3694 } else {
3695 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3695 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3696 } 3696 }
3697 } 3697 }
3698 3698
3699 #endif 3699 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698