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

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: Sync, patch in 2169483002 (+ regression test), add DevTools tests. 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/inspector/ConsoleMessageStorage.h" 41 #include "core/inspector/ConsoleMessageStorage.h"
41 #include "core/page/Page.h" 42 #include "core/page/Page.h"
42 #include "core/page/scrolling/OverscrollController.h" 43 #include "core/page/scrolling/OverscrollController.h"
43 #include "public/platform/Platform.h" 44 #include "public/platform/Platform.h"
44 #include "public/platform/WebScheduler.h" 45 #include "public/platform/WebScheduler.h"
45 46
46 namespace blink { 47 namespace blink {
47 48
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 198
198 DEFINE_TRACE(FrameHost) 199 DEFINE_TRACE(FrameHost)
199 { 200 {
200 visitor->trace(m_page); 201 visitor->trace(m_page);
201 visitor->trace(m_topControls); 202 visitor->trace(m_topControls);
202 visitor->trace(m_visualViewport); 203 visitor->trace(m_visualViewport);
203 visitor->trace(m_overscrollController); 204 visitor->trace(m_overscrollController);
204 visitor->trace(m_eventHandlerRegistry); 205 visitor->trace(m_eventHandlerRegistry);
205 visitor->trace(m_consoleMessageStorage); 206 visitor->trace(m_consoleMessageStorage);
206 visitor->trace(m_customElementReactionStack); 207 visitor->trace(m_customElementReactionStack);
208 visitor->trace(m_scrollAndScaleEmulator);
207 } 209 }
208 210
209 #if ENABLE(ASSERT) 211 #if ENABLE(ASSERT)
210 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) 212 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame)
211 { 213 {
212 ASSERT(expectedFrameCount >= 0); 214 ASSERT(expectedFrameCount >= 0);
213 215
214 int actualFrameCount = 0; 216 int actualFrameCount = 0;
215 for (; frame; frame = frame->tree().traverseNext()) 217 for (; frame; frame = frame->tree().traverseNext())
216 ++actualFrameCount; 218 ++actualFrameCount;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 return; 264 return;
263 265
264 FrameView* rootView = page().deprecatedLocalMainFrame()->view(); 266 FrameView* rootView = page().deprecatedLocalMainFrame()->view();
265 267
266 if (!rootView) 268 if (!rootView)
267 return; 269 return;
268 270
269 rootView->setNeedsLayout(); 271 rootView->setNeedsLayout();
270 } 272 }
271 273
274 void FrameHost::setScrollAndScaleOverride(const IntPoint& framePosition, const D oublePoint& visualViewportPosition, float pageScale)
275 {
276 if (!page().mainFrame() || !page().mainFrame()->isLocalFrame())
277 return;
278
279 if (!m_scrollAndScaleEmulator)
280 m_scrollAndScaleEmulator = ScrollAndScaleEmulator::create(this);
281
282 m_scrollAndScaleEmulator->update(
283 framePosition, visualViewportPosition, pageScale);
284 }
285
286 void FrameHost::clearScrollAndScaleOverride()
287 {
288 if (!m_scrollAndScaleEmulator)
289 return;
290
291 m_scrollAndScaleEmulator->clear();
292 m_scrollAndScaleEmulator = nullptr;
293 }
294
272 } // namespace blink 295 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698