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

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

Issue 2650343008: Implement Element.scrollIntoView for scroll-behavior: smooth. (Closed)
Patch Set: Change the default setting. 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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 } 623 }
624 // TODO(crbug.com/365897): we should get rid of detached layout subtrees, at 624 // TODO(crbug.com/365897): we should get rid of detached layout subtrees, at
625 // which point this code should not be reached. 625 // which point this code should not be reached.
626 return nullptr; 626 return nullptr;
627 } 627 }
628 628
629 bool LayoutObject::ScrollRectToVisible(const LayoutRect& rect, 629 bool LayoutObject::ScrollRectToVisible(const LayoutRect& rect,
630 const ScrollAlignment& align_x, 630 const ScrollAlignment& align_x,
631 const ScrollAlignment& align_y, 631 const ScrollAlignment& align_y,
632 ScrollType scroll_type, 632 ScrollType scroll_type,
633 bool make_visible_in_visual_viewport) { 633 bool make_visible_in_visual_viewport,
634 ScrollBehavior scroll_behavior) {
634 LayoutBox* enclosing_box = this->EnclosingBox(); 635 LayoutBox* enclosing_box = this->EnclosingBox();
635 if (!enclosing_box) 636 if (!enclosing_box)
636 return false; 637 return false;
637 638
638 enclosing_box->ScrollRectToVisible(rect, align_x, align_y, scroll_type, 639 enclosing_box->ScrollRectToVisible(rect, align_x, align_y, scroll_type,
639 make_visible_in_visual_viewport); 640 make_visible_in_visual_viewport,
641 scroll_behavior);
640 return true; 642 return true;
641 } 643 }
642 644
643 LayoutBox* LayoutObject::EnclosingBox() const { 645 LayoutBox* LayoutObject::EnclosingBox() const {
644 LayoutObject* curr = const_cast<LayoutObject*>(this); 646 LayoutObject* curr = const_cast<LayoutObject*>(this);
645 while (curr) { 647 while (curr) {
646 if (curr->IsBox()) 648 if (curr->IsBox())
647 return ToLayoutBox(curr); 649 return ToLayoutBox(curr);
648 curr = curr->Parent(); 650 curr = curr->Parent();
649 } 651 }
(...skipping 2998 matching lines...) Expand 10 before | Expand all | Expand 10 after
3648 const blink::LayoutObject* root = object1; 3650 const blink::LayoutObject* root = object1;
3649 while (root->Parent()) 3651 while (root->Parent())
3650 root = root->Parent(); 3652 root = root->Parent();
3651 root->ShowLayoutTreeAndMark(object1, "*", object2, "-", 0); 3653 root->ShowLayoutTreeAndMark(object1, "*", object2, "-", 0);
3652 } else { 3654 } else {
3653 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3655 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3654 } 3656 }
3655 } 3657 }
3656 3658
3657 #endif 3659 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/ScrollAlignment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698