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 19 matching lines...) Expand all Loading... |
30 | 30 |
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 "public/platform/Platform.h" | 41 #include "public/platform/Platform.h" |
41 #include "public/platform/WebScheduler.h" | 42 #include "public/platform/WebScheduler.h" |
42 | 43 |
43 namespace blink { | 44 namespace blink { |
44 | 45 |
45 FrameHost* FrameHost::create(Page& page) | 46 FrameHost* FrameHost::create(Page& page) |
46 { | 47 { |
47 return new FrameHost(page); | 48 return new FrameHost(page); |
48 } | 49 } |
49 | 50 |
50 FrameHost::FrameHost(Page& page) | 51 FrameHost::FrameHost(Page& page) |
51 : m_page(&page) | 52 : m_page(&page) |
52 , m_topControls(TopControls::create(*this)) | 53 , m_topControls(TopControls::create(*this)) |
53 , m_pageScaleConstraintsSet(PageScaleConstraintsSet::create()) | 54 , m_pageScaleConstraintsSet(PageScaleConstraintsSet::create()) |
54 , m_visualViewport(VisualViewport::create(*this)) | 55 , m_visualViewport(VisualViewport::create(*this)) |
| 56 , m_overscrollController(OverscrollController::create( |
| 57 *m_visualViewport, |
| 58 m_page->chromeClient())) |
55 , m_eventHandlerRegistry(new EventHandlerRegistry(*this)) | 59 , m_eventHandlerRegistry(new EventHandlerRegistry(*this)) |
56 , m_consoleMessageStorage(ConsoleMessageStorage::create()) | 60 , m_consoleMessageStorage(ConsoleMessageStorage::create()) |
57 , m_subframeCount(0) | 61 , m_subframeCount(0) |
58 { | 62 { |
59 } | 63 } |
60 | 64 |
61 // Explicitly in the .cpp to avoid default constructor in .h | 65 // Explicitly in the .cpp to avoid default constructor in .h |
62 FrameHost::~FrameHost() | 66 FrameHost::~FrameHost() |
63 { | 67 { |
64 } | 68 } |
65 | 69 |
66 Settings& FrameHost::settings() const | 70 Page& FrameHost::page() |
| 71 { |
| 72 return *m_page; |
| 73 } |
| 74 |
| 75 const Page& FrameHost::page() const |
| 76 { |
| 77 return *m_page; |
| 78 } |
| 79 |
| 80 Settings& FrameHost::settings() |
67 { | 81 { |
68 return m_page->settings(); | 82 return m_page->settings(); |
69 } | 83 } |
70 | 84 |
71 ChromeClient& FrameHost::chromeClient() const | 85 const Settings& FrameHost::settings() const |
| 86 { |
| 87 return m_page->settings(); |
| 88 } |
| 89 |
| 90 ChromeClient& FrameHost::chromeClient() |
72 { | 91 { |
73 return m_page->chromeClient(); | 92 return m_page->chromeClient(); |
74 } | 93 } |
75 | 94 |
76 UseCounter& FrameHost::useCounter() const | 95 const ChromeClient& FrameHost::chromeClient() const |
| 96 { |
| 97 return m_page->chromeClient(); |
| 98 } |
| 99 |
| 100 UseCounter& FrameHost::useCounter() |
77 { | 101 { |
78 return m_page->useCounter(); | 102 return m_page->useCounter(); |
79 } | 103 } |
80 | 104 |
81 Deprecation& FrameHost::deprecation() const | 105 const UseCounter& FrameHost::useCounter() const |
| 106 { |
| 107 return m_page->useCounter(); |
| 108 } |
| 109 |
| 110 Deprecation& FrameHost::deprecation() |
82 { | 111 { |
83 return m_page->deprecation(); | 112 return m_page->deprecation(); |
84 } | 113 } |
| 114 |
| 115 const Deprecation& FrameHost::deprecation() const |
| 116 { |
| 117 return m_page->deprecation(); |
| 118 } |
85 | 119 |
86 float FrameHost::deviceScaleFactor() const | 120 float FrameHost::deviceScaleFactor() const |
87 { | 121 { |
88 return m_page->deviceScaleFactor(); | 122 return m_page->deviceScaleFactor(); |
89 } | 123 } |
90 | 124 |
91 TopControls& FrameHost::topControls() const | 125 TopControls& FrameHost::topControls() |
92 { | 126 { |
93 return *m_topControls; | 127 return *m_topControls; |
94 } | 128 } |
95 | 129 |
96 VisualViewport& FrameHost::visualViewport() const | 130 const TopControls& FrameHost::topControls() const |
| 131 { |
| 132 return *m_topControls; |
| 133 } |
| 134 |
| 135 OverscrollController& FrameHost::overscrollController() |
| 136 { |
| 137 return *m_overscrollController; |
| 138 } |
| 139 |
| 140 const OverscrollController& FrameHost::overscrollController() const |
| 141 { |
| 142 return *m_overscrollController; |
| 143 } |
| 144 |
| 145 VisualViewport& FrameHost::visualViewport() |
97 { | 146 { |
98 return *m_visualViewport; | 147 return *m_visualViewport; |
99 } | 148 } |
100 | 149 |
101 PageScaleConstraintsSet& FrameHost::pageScaleConstraintsSet() const | 150 const VisualViewport& FrameHost::visualViewport() const |
| 151 { |
| 152 return *m_visualViewport; |
| 153 } |
| 154 |
| 155 PageScaleConstraintsSet& FrameHost::pageScaleConstraintsSet() |
102 { | 156 { |
103 return *m_pageScaleConstraintsSet; | 157 return *m_pageScaleConstraintsSet; |
104 } | 158 } |
105 | 159 |
106 EventHandlerRegistry& FrameHost::eventHandlerRegistry() const | 160 const PageScaleConstraintsSet& FrameHost::pageScaleConstraintsSet() const |
| 161 { |
| 162 return *m_pageScaleConstraintsSet; |
| 163 } |
| 164 |
| 165 EventHandlerRegistry& FrameHost::eventHandlerRegistry() |
107 { | 166 { |
108 return *m_eventHandlerRegistry; | 167 return *m_eventHandlerRegistry; |
109 } | 168 } |
110 | 169 |
111 ConsoleMessageStorage& FrameHost::consoleMessageStorage() const | 170 const EventHandlerRegistry& FrameHost::eventHandlerRegistry() const |
| 171 { |
| 172 return *m_eventHandlerRegistry; |
| 173 } |
| 174 |
| 175 ConsoleMessageStorage& FrameHost::consoleMessageStorage() |
112 { | 176 { |
113 return *m_consoleMessageStorage; | 177 return *m_consoleMessageStorage; |
114 } | 178 } |
| 179 |
| 180 const ConsoleMessageStorage& FrameHost::consoleMessageStorage() const |
| 181 { |
| 182 return *m_consoleMessageStorage; |
| 183 } |
115 | 184 |
116 DEFINE_TRACE(FrameHost) | 185 DEFINE_TRACE(FrameHost) |
117 { | 186 { |
118 visitor->trace(m_page); | 187 visitor->trace(m_page); |
119 visitor->trace(m_topControls); | 188 visitor->trace(m_topControls); |
120 visitor->trace(m_visualViewport); | 189 visitor->trace(m_visualViewport); |
| 190 visitor->trace(m_overscrollController); |
121 visitor->trace(m_eventHandlerRegistry); | 191 visitor->trace(m_eventHandlerRegistry); |
122 visitor->trace(m_consoleMessageStorage); | 192 visitor->trace(m_consoleMessageStorage); |
123 } | 193 } |
124 | 194 |
125 #if ENABLE(ASSERT) | 195 #if ENABLE(ASSERT) |
126 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) | 196 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) |
127 { | 197 { |
128 ASSERT(expectedFrameCount >= 0); | 198 ASSERT(expectedFrameCount >= 0); |
129 | 199 |
130 int actualFrameCount = 0; | 200 int actualFrameCount = 0; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 249 |
180 FrameView* rootView = page().deprecatedLocalMainFrame()->view(); | 250 FrameView* rootView = page().deprecatedLocalMainFrame()->view(); |
181 | 251 |
182 if (!rootView) | 252 if (!rootView) |
183 return; | 253 return; |
184 | 254 |
185 rootView->setNeedsLayout(); | 255 rootView->setNeedsLayout(); |
186 } | 256 } |
187 | 257 |
188 } // namespace blink | 258 } // namespace blink |
OLD | NEW |