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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 #include "platform/wtf/AutoReset.h" | 61 #include "platform/wtf/AutoReset.h" |
62 #include "platform/wtf/PtrUtil.h" | 62 #include "platform/wtf/PtrUtil.h" |
63 #include "public/web/WebAutofillClient.h" | 63 #include "public/web/WebAutofillClient.h" |
64 #include "public/web/WebPlugin.h" | 64 #include "public/web/WebPlugin.h" |
65 #include "public/web/WebRange.h" | 65 #include "public/web/WebRange.h" |
66 #include "public/web/WebWidgetClient.h" | 66 #include "public/web/WebWidgetClient.h" |
67 #include "web/AnimationWorkletProxyClientImpl.h" | 67 #include "web/AnimationWorkletProxyClientImpl.h" |
68 #include "web/CompositorMutatorImpl.h" | 68 #include "web/CompositorMutatorImpl.h" |
69 #include "web/CompositorWorkerProxyClientImpl.h" | 69 #include "web/CompositorWorkerProxyClientImpl.h" |
70 #include "web/ContextMenuAllowedScope.h" | 70 #include "web/ContextMenuAllowedScope.h" |
71 #include "web/InspectorOverlayAgent.h" | |
72 #include "web/PageOverlay.h" | |
73 #include "web/WebDevToolsAgentImpl.h" | 71 #include "web/WebDevToolsAgentImpl.h" |
74 #include "web/WebInputEventConversion.h" | 72 #include "web/WebInputEventConversion.h" |
75 #include "web/WebInputMethodControllerImpl.h" | 73 #include "web/WebInputMethodControllerImpl.h" |
76 #include "web/WebLocalFrameImpl.h" | 74 #include "web/WebLocalFrameImpl.h" |
77 #include "web/WebPagePopupImpl.h" | 75 #include "web/WebPagePopupImpl.h" |
78 #include "web/WebPluginContainerImpl.h" | 76 #include "web/WebPluginContainerImpl.h" |
79 #include "web/WebRemoteFrameImpl.h" | 77 #include "web/WebRemoteFrameImpl.h" |
80 #include "web/WebViewFrameWidget.h" | 78 #include "web/WebViewFrameWidget.h" |
81 | 79 |
82 namespace blink { | 80 namespace blink { |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 last_frame_time_monotonic); | 243 last_frame_time_monotonic); |
246 DCHECK(last_frame_time_monotonic); | 244 DCHECK(last_frame_time_monotonic); |
247 PageWidgetDelegate::Animate(*GetPage(), last_frame_time_monotonic); | 245 PageWidgetDelegate::Animate(*GetPage(), last_frame_time_monotonic); |
248 } | 246 } |
249 | 247 |
250 void WebFrameWidgetImpl::UpdateAllLifecyclePhases() { | 248 void WebFrameWidgetImpl::UpdateAllLifecyclePhases() { |
251 TRACE_EVENT0("blink", "WebFrameWidgetImpl::updateAllLifecyclePhases"); | 249 TRACE_EVENT0("blink", "WebFrameWidgetImpl::updateAllLifecyclePhases"); |
252 if (!local_root_) | 250 if (!local_root_) |
253 return; | 251 return; |
254 | 252 |
255 if (InspectorOverlayAgent* overlay = GetInspectorOverlay()) { | 253 if (WebDevToolsAgentImpl* devtools = local_root_->DevToolsAgentImpl()) |
256 overlay->UpdateAllLifecyclePhases(); | 254 devtools->PaintOverlay(); |
257 // TODO(chrishtr): integrate paint into the overlay's lifecycle. | |
258 if (overlay->GetPageOverlay() && | |
259 overlay->GetPageOverlay()->GetGraphicsLayer()) | |
260 overlay->GetPageOverlay()->GetGraphicsLayer()->Paint(nullptr); | |
261 } | |
262 PageWidgetDelegate::UpdateAllLifecyclePhases(*GetPage(), | 255 PageWidgetDelegate::UpdateAllLifecyclePhases(*GetPage(), |
263 *local_root_->GetFrame()); | 256 *local_root_->GetFrame()); |
264 UpdateLayerTreeBackgroundColor(); | 257 UpdateLayerTreeBackgroundColor(); |
265 } | 258 } |
266 | 259 |
267 void WebFrameWidgetImpl::Paint(WebCanvas* canvas, const WebRect& rect) { | 260 void WebFrameWidgetImpl::Paint(WebCanvas* canvas, const WebRect& rect) { |
268 // Out-of-process iframes require compositing. | 261 // Out-of-process iframes require compositing. |
269 NOTREACHED(); | 262 NOTREACHED(); |
270 } | 263 } |
271 | 264 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 WebInputEvent::GetName(input_event.GetType())); | 350 WebInputEvent::GetName(input_event.GetType())); |
358 | 351 |
359 // If a drag-and-drop operation is in progress, ignore input events. | 352 // If a drag-and-drop operation is in progress, ignore input events. |
360 if (doing_drag_and_drop_) | 353 if (doing_drag_and_drop_) |
361 return WebInputEventResult::kHandledSuppressed; | 354 return WebInputEventResult::kHandledSuppressed; |
362 | 355 |
363 // Don't handle events once we've started shutting down. | 356 // Don't handle events once we've started shutting down. |
364 if (!GetPage()) | 357 if (!GetPage()) |
365 return WebInputEventResult::kNotHandled; | 358 return WebInputEventResult::kNotHandled; |
366 | 359 |
367 if (InspectorOverlayAgent* overlay = GetInspectorOverlay()) { | 360 if (local_root_) { |
368 if (overlay->HandleInputEvent(input_event)) | 361 if (WebDevToolsAgentImpl* devtools = local_root_->DevToolsAgentImpl()) { |
369 return WebInputEventResult::kHandledSuppressed; | 362 if (devtools->HandleInputEvent(input_event)) |
| 363 return WebInputEventResult::kHandledSuppressed; |
| 364 } |
370 } | 365 } |
371 | 366 |
372 // Report the event to be NOT processed by WebKit, so that the browser can | 367 // Report the event to be NOT processed by WebKit, so that the browser can |
373 // handle it appropriately. | 368 // handle it appropriately. |
374 if (IgnoreInputEvents()) | 369 if (IgnoreInputEvents()) |
375 return WebInputEventResult::kNotHandled; | 370 return WebInputEventResult::kNotHandled; |
376 | 371 |
377 // FIXME: pass event to m_localRoot's WebDevToolsAgentImpl once available. | 372 // FIXME: pass event to m_localRoot's WebDevToolsAgentImpl once available. |
378 | 373 |
379 AutoReset<const WebInputEvent*> current_event_change(¤t_input_event_, | 374 AutoReset<const WebInputEvent*> current_event_change(¤t_input_event_, |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 const IntPoint& pos_in_root_frame) { | 1183 const IntPoint& pos_in_root_frame) { |
1189 IntPoint doc_point( | 1184 IntPoint doc_point( |
1190 local_root_->GetFrame()->View()->RootFrameToContents(pos_in_root_frame)); | 1185 local_root_->GetFrame()->View()->RootFrameToContents(pos_in_root_frame)); |
1191 HitTestResult result = | 1186 HitTestResult result = |
1192 local_root_->GetFrame()->GetEventHandler().HitTestResultAtPoint( | 1187 local_root_->GetFrame()->GetEventHandler().HitTestResultAtPoint( |
1193 doc_point, HitTestRequest::kReadOnly | HitTestRequest::kActive); | 1188 doc_point, HitTestRequest::kReadOnly | HitTestRequest::kActive); |
1194 result.SetToShadowHostIfInRestrictedShadowRoot(); | 1189 result.SetToShadowHostIfInRestrictedShadowRoot(); |
1195 return result; | 1190 return result; |
1196 } | 1191 } |
1197 | 1192 |
1198 InspectorOverlayAgent* WebFrameWidgetImpl::GetInspectorOverlay() { | |
1199 if (!local_root_) | |
1200 return nullptr; | |
1201 if (WebDevToolsAgentImpl* devtools = local_root_->DevToolsAgentImpl()) | |
1202 return devtools->OverlayAgent(); | |
1203 return nullptr; | |
1204 } | |
1205 | |
1206 LocalFrame* WebFrameWidgetImpl::FocusedLocalFrameInWidget() const { | 1193 LocalFrame* WebFrameWidgetImpl::FocusedLocalFrameInWidget() const { |
1207 LocalFrame* frame = GetPage()->GetFocusController().FocusedFrame(); | 1194 LocalFrame* frame = GetPage()->GetFocusController().FocusedFrame(); |
1208 return (frame && frame->LocalFrameRoot() == local_root_->GetFrame()) | 1195 return (frame && frame->LocalFrameRoot() == local_root_->GetFrame()) |
1209 ? frame | 1196 ? frame |
1210 : nullptr; | 1197 : nullptr; |
1211 } | 1198 } |
1212 | 1199 |
1213 WebPlugin* WebFrameWidgetImpl::FocusedPluginIfInputMethodSupported( | 1200 WebPlugin* WebFrameWidgetImpl::FocusedPluginIfInputMethodSupported( |
1214 LocalFrame* frame) const { | 1201 LocalFrame* frame) const { |
1215 WebPluginContainerImpl* container = | 1202 WebPluginContainerImpl* container = |
1216 WebLocalFrameImpl::CurrentPluginContainer(frame); | 1203 WebLocalFrameImpl::CurrentPluginContainer(frame); |
1217 if (container && container->SupportsInputMethod()) | 1204 if (container && container->SupportsInputMethod()) |
1218 return container->Plugin(); | 1205 return container->Plugin(); |
1219 return nullptr; | 1206 return nullptr; |
1220 } | 1207 } |
1221 | 1208 |
1222 LocalFrame* WebFrameWidgetImpl::FocusedLocalFrameAvailableForIme() const { | 1209 LocalFrame* WebFrameWidgetImpl::FocusedLocalFrameAvailableForIme() const { |
1223 if (!ime_accept_events_) | 1210 if (!ime_accept_events_) |
1224 return nullptr; | 1211 return nullptr; |
1225 return FocusedLocalFrameInWidget(); | 1212 return FocusedLocalFrameInWidget(); |
1226 } | 1213 } |
1227 | 1214 |
1228 } // namespace blink | 1215 } // namespace blink |
OLD | NEW |