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

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

Issue 2096633002: Adds scroll position/scale emulation to DevTools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Emulator using GC, moved to FrameHost, addressed other comments. Created 4 years, 5 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 17 matching lines...) Expand all
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "core/frame/FrameHost.h" 31 #include "core/frame/FrameHost.h"
32 32
33 #include "core/dom/custom/CustomElementReactionStack.h" 33 #include "core/dom/custom/CustomElementReactionStack.h"
34 #include "core/frame/EventHandlerRegistry.h" 34 #include "core/frame/EventHandlerRegistry.h"
35 #include "core/frame/FrameView.h" 35 #include "core/frame/FrameView.h"
36 #include "core/frame/PageScaleConstraints.h" 36 #include "core/frame/PageScaleConstraints.h"
37 #include "core/frame/PageScaleConstraintsSet.h" 37 #include "core/frame/PageScaleConstraintsSet.h"
38 #include "core/frame/ScrollAndScaleEmulator.h"
38 #include "core/frame/TopControls.h" 39 #include "core/frame/TopControls.h"
39 #include "core/frame/VisualViewport.h" 40 #include "core/frame/VisualViewport.h"
40 #include "core/page/Page.h" 41 #include "core/page/Page.h"
41 #include "core/page/scrolling/OverscrollController.h" 42 #include "core/page/scrolling/OverscrollController.h"
42 #include "public/platform/Platform.h" 43 #include "public/platform/Platform.h"
43 #include "public/platform/WebScheduler.h" 44 #include "public/platform/WebScheduler.h"
44 45
45 namespace blink { 46 namespace blink {
46 47
47 FrameHost* FrameHost::create(Page& page) 48 FrameHost* FrameHost::create(Page& page)
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 185 }
185 186
186 DEFINE_TRACE(FrameHost) 187 DEFINE_TRACE(FrameHost)
187 { 188 {
188 visitor->trace(m_page); 189 visitor->trace(m_page);
189 visitor->trace(m_topControls); 190 visitor->trace(m_topControls);
190 visitor->trace(m_visualViewport); 191 visitor->trace(m_visualViewport);
191 visitor->trace(m_overscrollController); 192 visitor->trace(m_overscrollController);
192 visitor->trace(m_eventHandlerRegistry); 193 visitor->trace(m_eventHandlerRegistry);
193 visitor->trace(m_customElementReactionStack); 194 visitor->trace(m_customElementReactionStack);
195 visitor->trace(m_scrollAndScaleEmulator);
194 } 196 }
195 197
196 #if ENABLE(ASSERT) 198 #if ENABLE(ASSERT)
197 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) 199 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame)
198 { 200 {
199 ASSERT(expectedFrameCount >= 0); 201 ASSERT(expectedFrameCount >= 0);
200 202
201 int actualFrameCount = 0; 203 int actualFrameCount = 0;
202 for (; frame; frame = frame->tree().traverseNext()) 204 for (; frame; frame = frame->tree().traverseNext())
203 ++actualFrameCount; 205 ++actualFrameCount;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 return; 251 return;
250 252
251 FrameView* rootView = page().deprecatedLocalMainFrame()->view(); 253 FrameView* rootView = page().deprecatedLocalMainFrame()->view();
252 254
253 if (!rootView) 255 if (!rootView)
254 return; 256 return;
255 257
256 rootView->setNeedsLayout(); 258 rootView->setNeedsLayout();
257 } 259 }
258 260
261 void FrameHost::setScrollAndScaleOverride(const IntPoint& framePosition, const D oublePoint& visualViewportPosition, float pageScale)
262 {
263 if (!page().mainFrame() || !page().mainFrame()->isLocalFrame())
264 return;
265
266 if (!m_scrollAndScaleEmulator) {
bokan 2016/07/06 14:26:31 Nit: no braces
Eric Seckler 2016/07/11 10:38:44 Done.
267 m_scrollAndScaleEmulator = ScrollAndScaleEmulator::create(this);
268 }
269
270 m_scrollAndScaleEmulator->update(
271 framePosition, visualViewportPosition, pageScale);
272 }
273
274 void FrameHost::clearScrollAndScaleOverride()
275 {
276 if (!m_scrollAndScaleEmulator)
277 return;
278
279 m_scrollAndScaleEmulator->clear();
280 m_scrollAndScaleEmulator = nullptr;
281 }
282
259 } // namespace blink 283 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698