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

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

Issue 2650343008: Implement Element.scrollIntoView for scroll-behavior: smooth. (Closed)
Patch Set: Revised according to the comments. We are still missing tests. Created 3 years, 10 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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 } 630 }
631 // TODO(crbug.com/365897): we should get rid of detached layout subtrees, at 631 // TODO(crbug.com/365897): we should get rid of detached layout subtrees, at
632 // which point this code should not be reached. 632 // which point this code should not be reached.
633 return nullptr; 633 return nullptr;
634 } 634 }
635 635
636 bool LayoutObject::scrollRectToVisible(const LayoutRect& rect, 636 bool LayoutObject::scrollRectToVisible(const LayoutRect& rect,
637 const ScrollAlignment& alignX, 637 const ScrollAlignment& alignX,
638 const ScrollAlignment& alignY, 638 const ScrollAlignment& alignY,
639 ScrollType scrollType, 639 ScrollType scrollType,
640 bool makeVisibleInVisualViewport) { 640 bool makeVisibleInVisualViewport,
641 ScrollBehavior scrollBehavior) {
641 LayoutBox* enclosingBox = this->enclosingBox(); 642 LayoutBox* enclosingBox = this->enclosingBox();
642 if (!enclosingBox) 643 if (!enclosingBox)
643 return false; 644 return false;
644 645
645 enclosingBox->scrollRectToVisible(rect, alignX, alignY, scrollType, 646 enclosingBox->scrollRectToVisible(rect, alignX, alignY, scrollType,
646 makeVisibleInVisualViewport); 647 makeVisibleInVisualViewport,
648 scrollBehavior);
647 return true; 649 return true;
648 } 650 }
649 651
650 LayoutBox* LayoutObject::enclosingBox() const { 652 LayoutBox* LayoutObject::enclosingBox() const {
651 LayoutObject* curr = const_cast<LayoutObject*>(this); 653 LayoutObject* curr = const_cast<LayoutObject*>(this);
652 while (curr) { 654 while (curr) {
653 if (curr->isBox()) 655 if (curr->isBox())
654 return toLayoutBox(curr); 656 return toLayoutBox(curr);
655 curr = curr->parent(); 657 curr = curr->parent();
656 } 658 }
(...skipping 2835 matching lines...) Expand 10 before | Expand all | Expand 10 after
3492 const blink::LayoutObject* root = object1; 3494 const blink::LayoutObject* root = object1;
3493 while (root->parent()) 3495 while (root->parent())
3494 root = root->parent(); 3496 root = root->parent();
3495 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3497 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3496 } else { 3498 } else {
3497 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3499 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3498 } 3500 }
3499 } 3501 }
3500 3502
3501 #endif 3503 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698