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

Side by Side Diff: third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.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) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 m_lastMainThreadScrollingReasons(0) {} 98 m_lastMainThreadScrollingReasons(0) {}
99 99
100 ScrollingCoordinator::~ScrollingCoordinator() { 100 ScrollingCoordinator::~ScrollingCoordinator() {
101 DCHECK(!m_page); 101 DCHECK(!m_page);
102 } 102 }
103 103
104 DEFINE_TRACE(ScrollingCoordinator) { 104 DEFINE_TRACE(ScrollingCoordinator) {
105 visitor->trace(m_page); 105 visitor->trace(m_page);
106 visitor->trace(m_horizontalScrollbars); 106 visitor->trace(m_horizontalScrollbars);
107 visitor->trace(m_verticalScrollbars); 107 visitor->trace(m_verticalScrollbars);
108 visitor->trace(m_programmaticScrollCoordinator);
108 } 109 }
109 110
110 void ScrollingCoordinator::setShouldHandleScrollGestureOnMainThreadRegion( 111 void ScrollingCoordinator::setShouldHandleScrollGestureOnMainThreadRegion(
111 const Region& region) { 112 const Region& region) {
112 if (!m_page->mainFrame()->isLocalFrame() || 113 if (!m_page->mainFrame()->isLocalFrame() ||
113 !m_page->deprecatedLocalMainFrame()->view()) 114 !m_page->deprecatedLocalMainFrame()->view())
114 return; 115 return;
115 if (WebLayer* scrollLayer = toWebLayer( 116 if (WebLayer* scrollLayer = toWebLayer(
116 m_page->deprecatedLocalMainFrame()->view()->layerForScrolling())) { 117 m_page->deprecatedLocalMainFrame()->view()->layerForScrolling())) {
117 Vector<IntRect> rects = region.rects(); 118 Vector<IntRect> rects = region.rects();
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 bool frameIsScrollable = frameView && frameView->isScrollable(); 1158 bool frameIsScrollable = frameView && frameView->isScrollable();
1158 if (frameIsScrollable != m_wasFrameScrollable) 1159 if (frameIsScrollable != m_wasFrameScrollable)
1159 return true; 1160 return true;
1160 1161
1161 if (WebLayer* scrollLayer = 1162 if (WebLayer* scrollLayer =
1162 frameView ? toWebLayer(frameView->layerForScrolling()) : nullptr) 1163 frameView ? toWebLayer(frameView->layerForScrolling()) : nullptr)
1163 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); 1164 return WebSize(frameView->contentsSize()) != scrollLayer->bounds();
1164 return false; 1165 return false;
1165 } 1166 }
1166 1167
1168 ProgrammaticScrollCoordinator*
1169 ScrollingCoordinator::programmaticScrollCoordinator() {
1170 if (!m_programmaticScrollCoordinator) {
1171 m_programmaticScrollCoordinator = ProgrammaticScrollCoordinator::create();
1172 }
1173
1174 return m_programmaticScrollCoordinator.get();
1175 }
1176
1167 } // namespace blink 1177 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698