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

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

Issue 2650343008: Implement Element.scrollIntoView for scroll-behavior: smooth. (Closed)
Patch Set: Rebase Created 3 years, 8 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. 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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 } 637 }
638 // TODO(crbug.com/365897): we should get rid of detached layout subtrees, at 638 // TODO(crbug.com/365897): we should get rid of detached layout subtrees, at
639 // which point this code should not be reached. 639 // which point this code should not be reached.
640 return nullptr; 640 return nullptr;
641 } 641 }
642 642
643 bool LayoutObject::scrollRectToVisible(const LayoutRect& rect, 643 bool LayoutObject::scrollRectToVisible(const LayoutRect& rect,
644 const ScrollAlignment& alignX, 644 const ScrollAlignment& alignX,
645 const ScrollAlignment& alignY, 645 const ScrollAlignment& alignY,
646 ScrollType scrollType, 646 ScrollType scrollType,
647 bool makeVisibleInVisualViewport) { 647 bool makeVisibleInVisualViewport,
648 ScrollBehavior scrollBehavior) {
648 LayoutBox* enclosingBox = this->enclosingBox(); 649 LayoutBox* enclosingBox = this->enclosingBox();
649 if (!enclosingBox) 650 if (!enclosingBox)
650 return false; 651 return false;
651 652
652 enclosingBox->scrollRectToVisible(rect, alignX, alignY, scrollType, 653 enclosingBox->scrollRectToVisible(rect, alignX, alignY, scrollType,
653 makeVisibleInVisualViewport); 654 makeVisibleInVisualViewport,
655 scrollBehavior);
654 return true; 656 return true;
655 } 657 }
656 658
657 LayoutBox* LayoutObject::enclosingBox() const { 659 LayoutBox* LayoutObject::enclosingBox() const {
658 LayoutObject* curr = const_cast<LayoutObject*>(this); 660 LayoutObject* curr = const_cast<LayoutObject*>(this);
659 while (curr) { 661 while (curr) {
660 if (curr->isBox()) 662 if (curr->isBox())
661 return toLayoutBox(curr); 663 return toLayoutBox(curr);
662 curr = curr->parent(); 664 curr = curr->parent();
663 } 665 }
(...skipping 2961 matching lines...) Expand 10 before | Expand all | Expand 10 after
3625 const blink::LayoutObject* root = object1; 3627 const blink::LayoutObject* root = object1;
3626 while (root->parent()) 3628 while (root->parent())
3627 root = root->parent(); 3629 root = root->parent();
3628 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3630 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3629 } else { 3631 } else {
3630 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3632 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3631 } 3633 }
3632 } 3634 }
3633 3635
3634 #endif 3636 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698