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

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

Issue 2070563002: Seperate DOMVisualViewport from Blink's VisualViewport class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 30 matching lines...) Expand all
41 #include "core/dom/SandboxFlags.h" 41 #include "core/dom/SandboxFlags.h"
42 #include "core/dom/custom/CustomElementsRegistry.h" 42 #include "core/dom/custom/CustomElementsRegistry.h"
43 #include "core/editing/Editor.h" 43 #include "core/editing/Editor.h"
44 #include "core/events/DOMWindowEventQueue.h" 44 #include "core/events/DOMWindowEventQueue.h"
45 #include "core/events/HashChangeEvent.h" 45 #include "core/events/HashChangeEvent.h"
46 #include "core/events/MessageEvent.h" 46 #include "core/events/MessageEvent.h"
47 #include "core/events/PageTransitionEvent.h" 47 #include "core/events/PageTransitionEvent.h"
48 #include "core/events/PopStateEvent.h" 48 #include "core/events/PopStateEvent.h"
49 #include "core/events/ScopedEventQueue.h" 49 #include "core/events/ScopedEventQueue.h"
50 #include "core/frame/BarProp.h" 50 #include "core/frame/BarProp.h"
51 #include "core/frame/DOMVisualViewport.h"
51 #include "core/frame/EventHandlerRegistry.h" 52 #include "core/frame/EventHandlerRegistry.h"
52 #include "core/frame/FrameConsole.h" 53 #include "core/frame/FrameConsole.h"
53 #include "core/frame/FrameView.h" 54 #include "core/frame/FrameView.h"
54 #include "core/frame/History.h" 55 #include "core/frame/History.h"
55 #include "core/frame/LocalFrame.h" 56 #include "core/frame/LocalFrame.h"
56 #include "core/frame/Navigator.h" 57 #include "core/frame/Navigator.h"
57 #include "core/frame/Screen.h" 58 #include "core/frame/Screen.h"
58 #include "core/frame/ScrollToOptions.h" 59 #include "core/frame/ScrollToOptions.h"
59 #include "core/frame/Settings.h" 60 #include "core/frame/Settings.h"
60 #include "core/frame/SuspendableTimer.h" 61 #include "core/frame/SuspendableTimer.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 return settings && settings->javaScriptCanOpenWindowsAutomatically(); 296 return settings && settings->javaScriptCanOpenWindowsAutomatically();
296 } 297 }
297 298
298 bool LocalDOMWindow::allowPopUp() 299 bool LocalDOMWindow::allowPopUp()
299 { 300 {
300 return frame() && allowPopUp(*frame()); 301 return frame() && allowPopUp(*frame());
301 } 302 }
302 303
303 LocalDOMWindow::LocalDOMWindow(LocalFrame& frame) 304 LocalDOMWindow::LocalDOMWindow(LocalFrame& frame)
304 : m_frameObserver(WindowFrameObserver::create(this, frame)) 305 : m_frameObserver(WindowFrameObserver::create(this, frame))
306 , m_visualViewport(DOMVisualViewport::create(this))
305 , m_shouldPrintWhenFinishedLoading(false) 307 , m_shouldPrintWhenFinishedLoading(false)
306 { 308 {
307 ThreadState::current()->registerPreFinalizer(this); 309 ThreadState::current()->registerPreFinalizer(this);
308 } 310 }
309 311
310 void LocalDOMWindow::clearDocument() 312 void LocalDOMWindow::clearDocument()
311 { 313 {
312 if (!m_document) 314 if (!m_document)
313 return; 315 return;
314 316
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 if (!host) 1026 if (!host)
1025 return 0; 1027 return 0;
1026 1028
1027 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); 1029 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
1028 1030
1029 ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->la youtViewportScrollableArea() : view->getScrollableArea(); 1031 ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->la youtViewportScrollableArea() : view->getScrollableArea();
1030 double viewportY = viewport->scrollPositionDouble().y(); 1032 double viewportY = viewport->scrollPositionDouble().y();
1031 return adjustScrollForAbsoluteZoom(viewportY, frame()->pageZoomFactor()); 1033 return adjustScrollForAbsoluteZoom(viewportY, frame()->pageZoomFactor());
1032 } 1034 }
1033 1035
1034 VisualViewport* LocalDOMWindow::visualViewport() 1036 DOMVisualViewport* LocalDOMWindow::visualViewport()
1035 { 1037 {
1036 if (!frame()) 1038 if (!frame())
1037 return nullptr; 1039 return nullptr;
1038 1040
1039 FrameHost* host = frame()->host(); 1041 return m_visualViewport;
1040 if (!host)
1041 return nullptr;
1042
1043 return &host->visualViewport();
1044 } 1042 }
1045 1043
1046 const AtomicString& LocalDOMWindow::name() const 1044 const AtomicString& LocalDOMWindow::name() const
1047 { 1045 {
1048 if (!isCurrentlyDisplayedInFrame()) 1046 if (!isCurrentlyDisplayedInFrame())
1049 return nullAtom; 1047 return nullAtom;
1050 1048
1051 return frame()->tree().name(); 1049 return frame()->tree().name();
1052 } 1050 }
1053 1051
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1534 visitor->trace(m_personalbar); 1532 visitor->trace(m_personalbar);
1535 visitor->trace(m_scrollbars); 1533 visitor->trace(m_scrollbars);
1536 visitor->trace(m_statusbar); 1534 visitor->trace(m_statusbar);
1537 visitor->trace(m_toolbar); 1535 visitor->trace(m_toolbar);
1538 visitor->trace(m_navigator); 1536 visitor->trace(m_navigator);
1539 visitor->trace(m_media); 1537 visitor->trace(m_media);
1540 visitor->trace(m_customElements); 1538 visitor->trace(m_customElements);
1541 visitor->trace(m_applicationCache); 1539 visitor->trace(m_applicationCache);
1542 visitor->trace(m_eventQueue); 1540 visitor->trace(m_eventQueue);
1543 visitor->trace(m_postMessageTimers); 1541 visitor->trace(m_postMessageTimers);
1542 visitor->trace(m_visualViewport);
1544 DOMWindow::trace(visitor); 1543 DOMWindow::trace(visitor);
1545 Supplementable<LocalDOMWindow>::trace(visitor); 1544 Supplementable<LocalDOMWindow>::trace(visitor);
1546 DOMWindowLifecycleNotifier::trace(visitor); 1545 DOMWindowLifecycleNotifier::trace(visitor);
1547 } 1546 }
1548 1547
1549 LocalFrame* LocalDOMWindow::frame() const 1548 LocalFrame* LocalDOMWindow::frame() const
1550 { 1549 {
1551 // If the LocalDOMWindow still has a frame reference, that frame must point 1550 // If the LocalDOMWindow still has a frame reference, that frame must point
1552 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation 1551 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation
1553 // where script execution leaks between different LocalDOMWindows. 1552 // where script execution leaks between different LocalDOMWindows.
1554 if (m_frameObserver->frame()) 1553 if (m_frameObserver->frame())
1555 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this); 1554 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this);
1556 return m_frameObserver->frame(); 1555 return m_frameObserver->frame();
1557 } 1556 }
1558 1557
1559 } // namespace blink 1558 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698