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

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

Issue 2650343008: Implement Element.scrollIntoView for scroll-behavior: smooth. (Closed)
Patch Set: Fixed nits. Created 3 years, 6 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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 } 624 }
625 // TODO(crbug.com/365897): we should get rid of detached layout subtrees, at 625 // TODO(crbug.com/365897): we should get rid of detached layout subtrees, at
626 // which point this code should not be reached. 626 // which point this code should not be reached.
627 return nullptr; 627 return nullptr;
628 } 628 }
629 629
630 bool LayoutObject::ScrollRectToVisible(const LayoutRect& rect, 630 bool LayoutObject::ScrollRectToVisible(const LayoutRect& rect,
631 const ScrollAlignment& align_x, 631 const ScrollAlignment& align_x,
632 const ScrollAlignment& align_y, 632 const ScrollAlignment& align_y,
633 ScrollType scroll_type, 633 ScrollType scroll_type,
634 bool make_visible_in_visual_viewport) { 634 bool make_visible_in_visual_viewport,
635 ScrollBehavior scroll_behavior) {
635 LayoutBox* enclosing_box = this->EnclosingBox(); 636 LayoutBox* enclosing_box = this->EnclosingBox();
636 if (!enclosing_box) 637 if (!enclosing_box)
637 return false; 638 return false;
638 639
639 enclosing_box->ScrollRectToVisible(rect, align_x, align_y, scroll_type, 640 enclosing_box->ScrollRectToVisible(rect, align_x, align_y, scroll_type,
640 make_visible_in_visual_viewport); 641 make_visible_in_visual_viewport,
642 scroll_behavior);
641 return true; 643 return true;
642 } 644 }
643 645
644 LayoutBox* LayoutObject::EnclosingBox() const { 646 LayoutBox* LayoutObject::EnclosingBox() const {
645 LayoutObject* curr = const_cast<LayoutObject*>(this); 647 LayoutObject* curr = const_cast<LayoutObject*>(this);
646 while (curr) { 648 while (curr) {
647 if (curr->IsBox()) 649 if (curr->IsBox())
648 return ToLayoutBox(curr); 650 return ToLayoutBox(curr);
649 curr = curr->Parent(); 651 curr = curr->Parent();
650 } 652 }
(...skipping 2993 matching lines...) Expand 10 before | Expand all | Expand 10 after
3644 const blink::LayoutObject* root = object1; 3646 const blink::LayoutObject* root = object1;
3645 while (root->Parent()) 3647 while (root->Parent())
3646 root = root->Parent(); 3648 root = root->Parent();
3647 root->ShowLayoutTreeAndMark(object1, "*", object2, "-", 0); 3649 root->ShowLayoutTreeAndMark(object1, "*", object2, "-", 0);
3648 } else { 3650 } else {
3649 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3651 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3650 } 3652 }
3651 } 3653 }
3652 3654
3653 #endif 3655 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698