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

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

Issue 1775213002: Fix premature termination of scroll animations while selecting text. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/RootFrameViewport.h" 5 #include "core/frame/RootFrameViewport.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/layout/ScrollAlignment.h" 8 #include "core/layout/ScrollAlignment.h"
9 #include "platform/geometry/DoubleRect.h" 9 #include "platform/geometry/DoubleRect.h"
10 #include "platform/geometry/FloatRect.h" 10 #include "platform/geometry/FloatRect.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 layoutViewport().scrollAnimator().currentPosition(), 102 layoutViewport().scrollAnimator().currentPosition(),
103 layoutViewport().visibleContentRect().size()); 103 layoutViewport().visibleContentRect().size());
104 LayoutRect visualRectInContent = LayoutRect( 104 LayoutRect visualRectInContent = LayoutRect(
105 scrollOffsetFromScrollAnimators(), 105 scrollOffsetFromScrollAnimators(),
106 visualViewport().visibleContentRect().size()); 106 visualViewport().visibleContentRect().size());
107 107
108 // Intersect layout and visual rects to exclude the scrollbar from the view rect. 108 // Intersect layout and visual rects to exclude the scrollbar from the view rect.
109 LayoutRect viewRectInContent = intersection(visualRectInContent, frameRectIn Content); 109 LayoutRect viewRectInContent = intersection(visualRectInContent, frameRectIn Content);
110 LayoutRect targetViewport = 110 LayoutRect targetViewport =
111 ScrollAlignment::getRectToExpose(viewRectInContent, rectInContent, align X, alignY); 111 ScrollAlignment::getRectToExpose(viewRectInContent, rectInContent, align X, alignY);
112 DoublePoint targetOffset(targetViewport.x(), targetViewport.y()); 112 if (targetViewport != viewRectInContent)
113 113 setScrollPosition(DoublePoint(targetViewport.x(), targetViewport.y()), s crollType);
114 setScrollPosition(targetOffset, scrollType, ScrollBehaviorInstant);
115 114
116 // RootFrameViewport only changes the viewport relative to the document so w e can't change the input 115 // RootFrameViewport only changes the viewport relative to the document so w e can't change the input
117 // rect's location relative to the document origin. 116 // rect's location relative to the document origin.
118 return rectInContent; 117 return rectInContent;
119 } 118 }
120 119
121 void RootFrameViewport::setScrollOffset(const DoublePoint& offset, ScrollType sc rollType) 120 void RootFrameViewport::setScrollOffset(const DoublePoint& offset, ScrollType sc rollType)
122 { 121 {
123 distributeScrollBetweenViewports(DoublePoint(offset), scrollType, ScrollBeha viorInstant); 122 distributeScrollBetweenViewports(DoublePoint(offset), scrollType, ScrollBeha viorInstant);
124 } 123 }
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 } 335 }
337 336
338 DEFINE_TRACE(RootFrameViewport) 337 DEFINE_TRACE(RootFrameViewport)
339 { 338 {
340 visitor->trace(m_visualViewport); 339 visitor->trace(m_visualViewport);
341 visitor->trace(m_layoutViewport); 340 visitor->trace(m_layoutViewport);
342 ScrollableArea::trace(visitor); 341 ScrollableArea::trace(visitor);
343 } 342 }
344 343
345 } // namespace blink 344 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698