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

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalFrameView.cpp

Issue 2911103002: Revert of Implement Element.scrollIntoView for scroll-behavior: smooth. (Closed)
Patch Set: 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) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2120 } 2120 }
2121 } 2121 }
2122 2122
2123 PlatformChromeClient* LocalFrameView::GetChromeClient() const { 2123 PlatformChromeClient* LocalFrameView::GetChromeClient() const {
2124 Page* page = GetFrame().GetPage(); 2124 Page* page = GetFrame().GetPage();
2125 if (!page) 2125 if (!page)
2126 return nullptr; 2126 return nullptr;
2127 return &page->GetChromeClient(); 2127 return &page->GetChromeClient();
2128 } 2128 }
2129 2129
2130 SmoothScrollSequencer* LocalFrameView::GetSmoothScrollSequencer() const {
2131 Page* page = GetFrame().GetPage();
2132 if (!page)
2133 return nullptr;
2134 return page->GetSmoothScrollSequencer();
2135 }
2136
2137 void LocalFrameView::ContentsResized() { 2130 void LocalFrameView::ContentsResized() {
2138 if (frame_->IsMainFrame() && frame_->GetDocument()) { 2131 if (frame_->IsMainFrame() && frame_->GetDocument()) {
2139 if (TextAutosizer* text_autosizer = 2132 if (TextAutosizer* text_autosizer =
2140 frame_->GetDocument()->GetTextAutosizer()) 2133 frame_->GetDocument()->GetTextAutosizer())
2141 text_autosizer->UpdatePageInfoInAllFrames(); 2134 text_autosizer->UpdatePageInfoInAllFrames();
2142 } 2135 }
2143 2136
2144 ScrollableArea::ContentsResized(); 2137 ScrollableArea::ContentsResized();
2145 SetNeedsLayout(); 2138 SetNeedsLayout();
2146 } 2139 }
(...skipping 2463 matching lines...) Expand 10 before | Expand all | Expand 10 after
4610 return mode == kScrollbarAuto || mode == kScrollbarAlwaysOn; 4603 return mode == kScrollbarAuto || mode == kScrollbarAlwaysOn;
4611 } 4604 }
4612 4605
4613 bool LocalFrameView::ShouldPlaceVerticalScrollbarOnLeft() const { 4606 bool LocalFrameView::ShouldPlaceVerticalScrollbarOnLeft() const {
4614 return false; 4607 return false;
4615 } 4608 }
4616 4609
4617 LayoutRect LocalFrameView::ScrollIntoView(const LayoutRect& rect_in_content, 4610 LayoutRect LocalFrameView::ScrollIntoView(const LayoutRect& rect_in_content,
4618 const ScrollAlignment& align_x, 4611 const ScrollAlignment& align_x,
4619 const ScrollAlignment& align_y, 4612 const ScrollAlignment& align_y,
4620 bool is_smooth,
4621 ScrollType scroll_type) { 4613 ScrollType scroll_type) {
4622 LayoutRect view_rect(VisibleContentRect()); 4614 LayoutRect view_rect(VisibleContentRect());
4623 LayoutRect expose_rect = ScrollAlignment::GetRectToExpose( 4615 LayoutRect expose_rect = ScrollAlignment::GetRectToExpose(
4624 view_rect, rect_in_content, align_x, align_y); 4616 view_rect, rect_in_content, align_x, align_y);
4625 if (expose_rect != view_rect) { 4617 if (expose_rect != view_rect) {
4626 ScrollOffset target_offset(expose_rect.X().ToFloat(), 4618 SetScrollOffset(
4627 expose_rect.Y().ToFloat()); 4619 ScrollOffset(expose_rect.X().ToFloat(), expose_rect.Y().ToFloat()),
4628 if (is_smooth) { 4620 scroll_type);
4629 DCHECK(scroll_type == kProgrammaticScroll);
4630 GetSmoothScrollSequencer()->QueueAnimation(this, target_offset);
4631 } else {
4632 SetScrollOffset(target_offset, scroll_type);
4633 }
4634 } 4621 }
4635 4622
4636 // Scrolling the LocalFrameView cannot change the input rect's location 4623 // Scrolling the LocalFrameView cannot change the input rect's location
4637 // relative to the document. 4624 // relative to the document.
4638 return rect_in_content; 4625 return rect_in_content;
4639 } 4626 }
4640 4627
4641 IntRect LocalFrameView::ScrollCornerRect() const { 4628 IntRect LocalFrameView::ScrollCornerRect() const {
4642 IntRect corner_rect; 4629 IntRect corner_rect;
4643 4630
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
5399 void LocalFrameView::SetAnimationHost( 5386 void LocalFrameView::SetAnimationHost(
5400 std::unique_ptr<CompositorAnimationHost> host) { 5387 std::unique_ptr<CompositorAnimationHost> host) {
5401 animation_host_ = std::move(host); 5388 animation_host_ = std::move(host);
5402 } 5389 }
5403 5390
5404 LayoutUnit LocalFrameView::CaretWidth() const { 5391 LayoutUnit LocalFrameView::CaretWidth() const {
5405 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1)); 5392 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1));
5406 } 5393 }
5407 5394
5408 } // namespace blink 5395 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrameView.h ('k') | third_party/WebKit/Source/core/frame/RootFrameViewport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698