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

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

Issue 2650343008: Implement Element.scrollIntoView for scroll-behavior: smooth. (Closed)
Patch Set: Added SimTest. Created 3 years, 9 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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 } 626 }
627 // TODO(crbug.com/365897): we should get rid of detached layout subtrees, at 627 // TODO(crbug.com/365897): we should get rid of detached layout subtrees, at
628 // which point this code should not be reached. 628 // which point this code should not be reached.
629 return nullptr; 629 return nullptr;
630 } 630 }
631 631
632 bool LayoutObject::scrollRectToVisible(const LayoutRect& rect, 632 bool LayoutObject::scrollRectToVisible(const LayoutRect& rect,
633 const ScrollAlignment& alignX, 633 const ScrollAlignment& alignX,
634 const ScrollAlignment& alignY, 634 const ScrollAlignment& alignY,
635 ScrollType scrollType, 635 ScrollType scrollType,
636 bool makeVisibleInVisualViewport) { 636 bool makeVisibleInVisualViewport,
637 ScrollBehavior scrollBehavior) {
637 LayoutBox* enclosingBox = this->enclosingBox(); 638 LayoutBox* enclosingBox = this->enclosingBox();
638 if (!enclosingBox) 639 if (!enclosingBox)
639 return false; 640 return false;
640 641
641 enclosingBox->scrollRectToVisible(rect, alignX, alignY, scrollType, 642 enclosingBox->scrollRectToVisible(rect, alignX, alignY, scrollType,
642 makeVisibleInVisualViewport); 643 makeVisibleInVisualViewport,
644 scrollBehavior);
643 return true; 645 return true;
644 } 646 }
645 647
646 LayoutBox* LayoutObject::enclosingBox() const { 648 LayoutBox* LayoutObject::enclosingBox() const {
647 LayoutObject* curr = const_cast<LayoutObject*>(this); 649 LayoutObject* curr = const_cast<LayoutObject*>(this);
648 while (curr) { 650 while (curr) {
649 if (curr->isBox()) 651 if (curr->isBox())
650 return toLayoutBox(curr); 652 return toLayoutBox(curr);
651 curr = curr->parent(); 653 curr = curr->parent();
652 } 654 }
(...skipping 2869 matching lines...) Expand 10 before | Expand all | Expand 10 after
3522 const blink::LayoutObject* root = object1; 3524 const blink::LayoutObject* root = object1;
3523 while (root->parent()) 3525 while (root->parent())
3524 root = root->parent(); 3526 root = root->parent();
3525 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3527 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3526 } else { 3528 } else {
3527 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3529 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3528 } 3530 }
3529 } 3531 }
3530 3532
3531 #endif 3533 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698