OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 toWebLocalFrameImpl(*mainFrame)); | 92 toWebLocalFrameImpl(*mainFrame)); |
93 } | 93 } |
94 | 94 |
95 WebFrameWidgetImpl* WebFrameWidgetImpl::create(WebWidgetClient* client, | 95 WebFrameWidgetImpl* WebFrameWidgetImpl::create(WebWidgetClient* client, |
96 WebLocalFrame* localRoot) { | 96 WebLocalFrame* localRoot) { |
97 // Pass the WebFrameWidgetImpl's self-reference to the caller. | 97 // Pass the WebFrameWidgetImpl's self-reference to the caller. |
98 return new WebFrameWidgetImpl( | 98 return new WebFrameWidgetImpl( |
99 client, localRoot); // SelfKeepAlive is set in constructor. | 99 client, localRoot); // SelfKeepAlive is set in constructor. |
100 } | 100 } |
101 | 101 |
102 // static | |
103 WebFrameWidgetsSet& WebFrameWidgetImpl::allInstances() { | |
104 DEFINE_STATIC_LOCAL(WebFrameWidgetsSet, allInstances, ()); | |
105 return allInstances; | |
106 } | |
107 | |
108 WebFrameWidgetImpl::WebFrameWidgetImpl(WebWidgetClient* client, | 102 WebFrameWidgetImpl::WebFrameWidgetImpl(WebWidgetClient* client, |
109 WebLocalFrame* localRoot) | 103 WebLocalFrame* localRoot) |
110 : m_client(client), | 104 : m_client(client), |
111 m_localRoot(toWebLocalFrameImpl(localRoot)), | 105 m_localRoot(toWebLocalFrameImpl(localRoot)), |
112 m_mutator(nullptr), | 106 m_mutator(nullptr), |
113 m_layerTreeView(nullptr), | 107 m_layerTreeView(nullptr), |
114 m_rootLayer(nullptr), | 108 m_rootLayer(nullptr), |
115 m_rootGraphicsLayer(nullptr), | 109 m_rootGraphicsLayer(nullptr), |
116 m_isAcceleratedCompositingActive(false), | 110 m_isAcceleratedCompositingActive(false), |
117 m_layerTreeViewClosed(false), | 111 m_layerTreeViewClosed(false), |
118 m_suppressNextKeypressEvent(false), | 112 m_suppressNextKeypressEvent(false), |
119 m_ignoreInputEvents(false), | |
120 m_isTransparent(false), | 113 m_isTransparent(false), |
121 m_imeAcceptEvents(true), | 114 m_imeAcceptEvents(true), |
122 m_selfKeepAlive(this) { | 115 m_selfKeepAlive(this) { |
123 DCHECK(m_localRoot->frame()->isLocalRoot()); | 116 DCHECK(m_localRoot->frame()->isLocalRoot()); |
124 initializeLayerTreeView(); | 117 initializeLayerTreeView(); |
125 m_localRoot->setFrameWidget(this); | 118 m_localRoot->setFrameWidget(this); |
126 allInstances().add(this); | |
127 | 119 |
128 if (localRoot->parent()) | 120 if (localRoot->parent()) |
129 setIsTransparent(true); | 121 setIsTransparent(true); |
130 } | 122 } |
131 | 123 |
132 WebFrameWidgetImpl::~WebFrameWidgetImpl() {} | 124 WebFrameWidgetImpl::~WebFrameWidgetImpl() {} |
133 | 125 |
134 DEFINE_TRACE(WebFrameWidgetImpl) { | 126 DEFINE_TRACE(WebFrameWidgetImpl) { |
135 visitor->trace(m_localRoot); | 127 visitor->trace(m_localRoot); |
136 visitor->trace(m_mouseCaptureNode); | 128 visitor->trace(m_mouseCaptureNode); |
137 } | 129 } |
138 | 130 |
139 // WebWidget ------------------------------------------------------------------ | 131 // WebWidget ------------------------------------------------------------------ |
140 | 132 |
141 void WebFrameWidgetImpl::close() { | 133 void WebFrameWidgetImpl::close() { |
142 WebDevToolsAgentImpl::webFrameWidgetImplClosed(this); | |
143 DCHECK(allInstances().contains(this)); | |
144 allInstances().remove(this); | |
145 | |
146 m_localRoot->setFrameWidget(nullptr); | 134 m_localRoot->setFrameWidget(nullptr); |
147 m_localRoot = nullptr; | 135 m_localRoot = nullptr; |
148 // Reset the delegate to prevent notifications being sent as we're being | 136 // Reset the delegate to prevent notifications being sent as we're being |
149 // deleted. | 137 // deleted. |
150 m_client = nullptr; | 138 m_client = nullptr; |
151 | 139 |
152 m_mutator = nullptr; | 140 m_mutator = nullptr; |
153 m_layerTreeView = nullptr; | 141 m_layerTreeView = nullptr; |
154 m_rootLayer = nullptr; | 142 m_rootLayer = nullptr; |
155 m_rootGraphicsLayer = nullptr; | 143 m_rootGraphicsLayer = nullptr; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 | 209 |
222 FrameView* view = m_localRoot->frameView(); | 210 FrameView* view = m_localRoot->frameView(); |
223 if (!view) | 211 if (!view) |
224 return; | 212 return; |
225 | 213 |
226 WebSize layoutSize = m_size; | 214 WebSize layoutSize = m_size; |
227 | 215 |
228 view->setLayoutSize(layoutSize); | 216 view->setLayoutSize(layoutSize); |
229 } | 217 } |
230 | 218 |
231 void WebFrameWidgetImpl::setIgnoreInputEvents(bool newValue) { | |
232 DCHECK_NE(m_ignoreInputEvents, newValue); | |
233 m_ignoreInputEvents = newValue; | |
234 } | |
235 | 219 |
236 void WebFrameWidgetImpl::didEnterFullscreen() { | 220 void WebFrameWidgetImpl::didEnterFullscreen() { |
237 view()->didEnterFullscreen(); | 221 view()->didEnterFullscreen(); |
238 } | 222 } |
239 | 223 |
240 void WebFrameWidgetImpl::didExitFullscreen() { | 224 void WebFrameWidgetImpl::didExitFullscreen() { |
241 view()->didExitFullscreen(); | 225 view()->didExitFullscreen(); |
242 } | 226 } |
243 | 227 |
244 void WebFrameWidgetImpl::beginFrame(double lastFrameTimeMonotonic) { | 228 void WebFrameWidgetImpl::beginFrame(double lastFrameTimeMonotonic) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 if (!page()) | 320 if (!page()) |
337 return WebInputEventResult::NotHandled; | 321 return WebInputEventResult::NotHandled; |
338 | 322 |
339 if (InspectorOverlay* overlay = inspectorOverlay()) { | 323 if (InspectorOverlay* overlay = inspectorOverlay()) { |
340 if (overlay->handleInputEvent(inputEvent)) | 324 if (overlay->handleInputEvent(inputEvent)) |
341 return WebInputEventResult::HandledSuppressed; | 325 return WebInputEventResult::HandledSuppressed; |
342 } | 326 } |
343 | 327 |
344 // Report the event to be NOT processed by WebKit, so that the browser can | 328 // Report the event to be NOT processed by WebKit, so that the browser can |
345 // handle it appropriately. | 329 // handle it appropriately. |
346 if (m_ignoreInputEvents) | 330 if (ignoreInputEvents()) |
347 return WebInputEventResult::NotHandled; | 331 return WebInputEventResult::NotHandled; |
348 | 332 |
349 // FIXME: pass event to m_localRoot's WebDevToolsAgentImpl once available. | 333 // FIXME: pass event to m_localRoot's WebDevToolsAgentImpl once available. |
350 | 334 |
351 AutoReset<const WebInputEvent*> currentEventChange(&m_currentInputEvent, | 335 AutoReset<const WebInputEvent*> currentEventChange(&m_currentInputEvent, |
352 &inputEvent); | 336 &inputEvent); |
353 | 337 |
354 if (m_mouseCaptureNode && WebInputEvent::isMouseEventType(inputEvent.type)) { | 338 if (m_mouseCaptureNode && WebInputEvent::isMouseEventType(inputEvent.type)) { |
355 TRACE_EVENT1("input", "captured mouse event", "type", inputEvent.type); | 339 TRACE_EVENT1("input", "captured mouse event", "type", inputEvent.type); |
356 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. | 340 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 return nullptr; | 1139 return nullptr; |
1156 } | 1140 } |
1157 | 1141 |
1158 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const { | 1142 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const { |
1159 if (!m_imeAcceptEvents) | 1143 if (!m_imeAcceptEvents) |
1160 return nullptr; | 1144 return nullptr; |
1161 return focusedLocalFrameInWidget(); | 1145 return focusedLocalFrameInWidget(); |
1162 } | 1146 } |
1163 | 1147 |
1164 } // namespace blink | 1148 } // namespace blink |
OLD | NEW |