OLD | NEW |
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 Loading... |
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" | |
42 #include "public/platform/Platform.h" | 41 #include "public/platform/Platform.h" |
43 #include "public/platform/WebScheduler.h" | 42 #include "public/platform/WebScheduler.h" |
44 | 43 |
45 namespace blink { | 44 namespace blink { |
46 | 45 |
47 FrameHost* FrameHost::create(Page& page) | 46 FrameHost* FrameHost::create(Page& page) |
48 { | 47 { |
49 return new FrameHost(page); | 48 return new FrameHost(page); |
50 } | 49 } |
51 | 50 |
52 FrameHost::FrameHost(Page& page) | 51 FrameHost::FrameHost(Page& page) |
53 : m_page(&page) | 52 : m_page(&page) |
54 , m_rootScroller(RootScroller::create(*this)) | |
55 , m_topControls(TopControls::create(*this)) | 53 , m_topControls(TopControls::create(*this)) |
56 , m_pageScaleConstraintsSet(PageScaleConstraintsSet::create()) | 54 , m_pageScaleConstraintsSet(PageScaleConstraintsSet::create()) |
57 , m_visualViewport(VisualViewport::create(*this)) | 55 , m_visualViewport(VisualViewport::create(*this)) |
58 , m_overscrollController(OverscrollController::create( | 56 , m_overscrollController(OverscrollController::create( |
59 *m_visualViewport, | 57 *m_visualViewport, |
60 m_page->chromeClient())) | 58 m_page->chromeClient())) |
61 , m_eventHandlerRegistry(new EventHandlerRegistry(*this)) | 59 , m_eventHandlerRegistry(new EventHandlerRegistry(*this)) |
62 , m_consoleMessageStorage(ConsoleMessageStorage::create()) | 60 , m_consoleMessageStorage(ConsoleMessageStorage::create()) |
63 , m_subframeCount(0) | 61 , m_subframeCount(0) |
64 { | 62 { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 const Deprecation& FrameHost::deprecation() const | 115 const Deprecation& FrameHost::deprecation() const |
118 { | 116 { |
119 return m_page->deprecation(); | 117 return m_page->deprecation(); |
120 } | 118 } |
121 | 119 |
122 float FrameHost::deviceScaleFactor() const | 120 float FrameHost::deviceScaleFactor() const |
123 { | 121 { |
124 return m_page->deviceScaleFactor(); | 122 return m_page->deviceScaleFactor(); |
125 } | 123 } |
126 | 124 |
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 | |
147 TopControls& FrameHost::topControls() | 125 TopControls& FrameHost::topControls() |
148 { | 126 { |
149 return *m_topControls; | 127 return *m_topControls; |
150 } | 128 } |
151 | 129 |
152 const TopControls& FrameHost::topControls() const | 130 const TopControls& FrameHost::topControls() const |
153 { | 131 { |
154 return *m_topControls; | 132 return *m_topControls; |
155 } | 133 } |
156 | 134 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 } | 178 } |
201 | 179 |
202 const ConsoleMessageStorage& FrameHost::consoleMessageStorage() const | 180 const ConsoleMessageStorage& FrameHost::consoleMessageStorage() const |
203 { | 181 { |
204 return *m_consoleMessageStorage; | 182 return *m_consoleMessageStorage; |
205 } | 183 } |
206 | 184 |
207 DEFINE_TRACE(FrameHost) | 185 DEFINE_TRACE(FrameHost) |
208 { | 186 { |
209 visitor->trace(m_page); | 187 visitor->trace(m_page); |
210 visitor->trace(m_rootScroller); | |
211 visitor->trace(m_topControls); | 188 visitor->trace(m_topControls); |
212 visitor->trace(m_visualViewport); | 189 visitor->trace(m_visualViewport); |
213 visitor->trace(m_overscrollController); | 190 visitor->trace(m_overscrollController); |
214 visitor->trace(m_eventHandlerRegistry); | 191 visitor->trace(m_eventHandlerRegistry); |
215 visitor->trace(m_consoleMessageStorage); | 192 visitor->trace(m_consoleMessageStorage); |
216 } | 193 } |
217 | 194 |
218 #if ENABLE(ASSERT) | 195 #if ENABLE(ASSERT) |
219 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) | 196 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) |
220 { | 197 { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 249 |
273 FrameView* rootView = page().deprecatedLocalMainFrame()->view(); | 250 FrameView* rootView = page().deprecatedLocalMainFrame()->view(); |
274 | 251 |
275 if (!rootView) | 252 if (!rootView) |
276 return; | 253 return; |
277 | 254 |
278 rootView->setNeedsLayout(); | 255 rootView->setNeedsLayout(); |
279 } | 256 } |
280 | 257 |
281 } // namespace blink | 258 } // namespace blink |
OLD | NEW |