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

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

Issue 1913843004: Implementing document.setRootScroller API for main thread scrolling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@overscrollController
Patch Set: Rebase and remove whitespace in Document.idl Created 4 years, 7 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 20 matching lines...) Expand all
31 #include "core/frame/FrameHost.h" 31 #include "core/frame/FrameHost.h"
32 32
33 #include "core/frame/EventHandlerRegistry.h" 33 #include "core/frame/EventHandlerRegistry.h"
34 #include "core/frame/FrameView.h" 34 #include "core/frame/FrameView.h"
35 #include "core/frame/PageScaleConstraints.h" 35 #include "core/frame/PageScaleConstraints.h"
36 #include "core/frame/PageScaleConstraintsSet.h" 36 #include "core/frame/PageScaleConstraintsSet.h"
37 #include "core/frame/TopControls.h" 37 #include "core/frame/TopControls.h"
38 #include "core/inspector/ConsoleMessageStorage.h" 38 #include "core/inspector/ConsoleMessageStorage.h"
39 #include "core/page/Page.h" 39 #include "core/page/Page.h"
40 #include "core/page/scrolling/OverscrollController.h" 40 #include "core/page/scrolling/OverscrollController.h"
41 #include "core/page/scrolling/RootScroller.h"
41 #include "public/platform/Platform.h" 42 #include "public/platform/Platform.h"
42 #include "public/platform/WebScheduler.h" 43 #include "public/platform/WebScheduler.h"
43 44
44 namespace blink { 45 namespace blink {
45 46
46 FrameHost* FrameHost::create(Page& page) 47 FrameHost* FrameHost::create(Page& page)
47 { 48 {
48 return new FrameHost(page); 49 return new FrameHost(page);
49 } 50 }
50 51
51 FrameHost::FrameHost(Page& page) 52 FrameHost::FrameHost(Page& page)
52 : m_page(&page) 53 : m_page(&page)
54 , m_rootScroller(RootScroller::create(*this))
53 , m_topControls(TopControls::create(*this)) 55 , m_topControls(TopControls::create(*this))
54 , m_pageScaleConstraintsSet(PageScaleConstraintsSet::create()) 56 , m_pageScaleConstraintsSet(PageScaleConstraintsSet::create())
55 , m_visualViewport(VisualViewport::create(*this)) 57 , m_visualViewport(VisualViewport::create(*this))
56 , m_overscrollController(OverscrollController::create( 58 , m_overscrollController(OverscrollController::create(
57 *m_visualViewport, 59 *m_visualViewport,
58 m_page->chromeClient())) 60 m_page->chromeClient()))
59 , m_eventHandlerRegistry(new EventHandlerRegistry(*this)) 61 , m_eventHandlerRegistry(new EventHandlerRegistry(*this))
60 , m_consoleMessageStorage(ConsoleMessageStorage::create()) 62 , m_consoleMessageStorage(ConsoleMessageStorage::create())
61 , m_subframeCount(0) 63 , m_subframeCount(0)
62 { 64 {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 const Deprecation& FrameHost::deprecation() const 117 const Deprecation& FrameHost::deprecation() const
116 { 118 {
117 return m_page->deprecation(); 119 return m_page->deprecation();
118 } 120 }
119 121
120 float FrameHost::deviceScaleFactor() const 122 float FrameHost::deviceScaleFactor() const
121 { 123 {
122 return m_page->deviceScaleFactor(); 124 return m_page->deviceScaleFactor();
123 } 125 }
124 126
127 RootScroller* FrameHost::rootScroller()
128 {
129 // RootScroller only makes sense if we're in the process where the main
130 // frame is local.
131 if (!m_page->mainFrame() || !m_page->mainFrame()->isLocalFrame())
132 return nullptr;
133
134 return m_rootScroller;
135 }
136
137 const RootScroller* FrameHost::rootScroller() const
138 {
139 // RootScroller only makes sense if we're in the process where the main
140 // frame is local.
141 if (!m_page->mainFrame() || !m_page->mainFrame()->isLocalFrame())
142 return nullptr;
143
144 return m_rootScroller;
145 }
146
125 TopControls& FrameHost::topControls() 147 TopControls& FrameHost::topControls()
126 { 148 {
127 return *m_topControls; 149 return *m_topControls;
128 } 150 }
129 151
130 const TopControls& FrameHost::topControls() const 152 const TopControls& FrameHost::topControls() const
131 { 153 {
132 return *m_topControls; 154 return *m_topControls;
133 } 155 }
134 156
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 200 }
179 201
180 const ConsoleMessageStorage& FrameHost::consoleMessageStorage() const 202 const ConsoleMessageStorage& FrameHost::consoleMessageStorage() const
181 { 203 {
182 return *m_consoleMessageStorage; 204 return *m_consoleMessageStorage;
183 } 205 }
184 206
185 DEFINE_TRACE(FrameHost) 207 DEFINE_TRACE(FrameHost)
186 { 208 {
187 visitor->trace(m_page); 209 visitor->trace(m_page);
210 visitor->trace(m_rootScroller);
188 visitor->trace(m_topControls); 211 visitor->trace(m_topControls);
189 visitor->trace(m_visualViewport); 212 visitor->trace(m_visualViewport);
190 visitor->trace(m_overscrollController); 213 visitor->trace(m_overscrollController);
191 visitor->trace(m_eventHandlerRegistry); 214 visitor->trace(m_eventHandlerRegistry);
192 visitor->trace(m_consoleMessageStorage); 215 visitor->trace(m_consoleMessageStorage);
193 } 216 }
194 217
195 #if ENABLE(ASSERT) 218 #if ENABLE(ASSERT)
196 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) 219 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame)
197 { 220 {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 272
250 FrameView* rootView = page().deprecatedLocalMainFrame()->view(); 273 FrameView* rootView = page().deprecatedLocalMainFrame()->view();
251 274
252 if (!rootView) 275 if (!rootView)
253 return; 276 return;
254 277
255 rootView->setNeedsLayout(); 278 rootView->setNeedsLayout();
256 } 279 }
257 280
258 } // namespace blink 281 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698