Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 2172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2183 UIEventWithKeyState::ClearNewTabModifierSetFromIsolatedWorld(); | 2183 UIEventWithKeyState::ClearNewTabModifierSetFromIsolatedWorld(); |
| 2184 | 2184 |
| 2185 bool is_pointer_locked = false; | 2185 bool is_pointer_locked = false; |
| 2186 if (WebFrameWidgetBase* widget = MainFrameImpl()->FrameWidget()) { | 2186 if (WebFrameWidgetBase* widget = MainFrameImpl()->FrameWidget()) { |
| 2187 if (WebWidgetClient* client = widget->Client()) | 2187 if (WebWidgetClient* client = widget->Client()) |
| 2188 is_pointer_locked = client->IsPointerLocked(); | 2188 is_pointer_locked = client->IsPointerLocked(); |
| 2189 } | 2189 } |
| 2190 | 2190 |
| 2191 if (is_pointer_locked && | 2191 if (is_pointer_locked && |
| 2192 WebInputEvent::IsMouseEventType(input_event.GetType())) { | 2192 WebInputEvent::IsMouseEventType(input_event.GetType())) { |
| 2193 LocalFrame* focusedFrame = FocusedLocalFrameInWidget(); | |
| 2194 if (focusedFrame) { | |
| 2195 WebMouseEvent transformed_event = TransformWebMouseEvent( | |
| 2196 MainFrameImpl()->GetFrameView(), | |
| 2197 static_cast<const WebMouseEvent&>(input_event)); | |
| 2198 Vector<WebMouseEvent> transformed_coalesced_events = | |
| 2199 TransformWebMouseEventVector( | |
| 2200 MainFrameImpl()->GetFrameView(), | |
| 2201 coalesced_event.GetCoalescedEventsPointers()); | |
| 2202 focusedFrame->GetEventHandler().ProcessPendingPointerCapture( | |
| 2203 transformed_event, transformed_coalesced_events); | |
| 2204 } | |
| 2205 | |
| 2193 MainFrameImpl()->FrameWidget()->PointerLockMouseEvent(input_event); | 2206 MainFrameImpl()->FrameWidget()->PointerLockMouseEvent(input_event); |
|
mustaq
2017/05/19 20:05:33
I believe we need a similar fix before another dir
lanwei
2017/05/23 23:11:42
You are right, I moved the code to the WebFrameWid
| |
| 2194 return WebInputEventResult::kHandledSystem; | 2207 return WebInputEventResult::kHandledSystem; |
| 2195 } | 2208 } |
| 2196 | 2209 |
| 2197 if (mouse_capture_node_ && | 2210 if (mouse_capture_node_ && |
| 2198 WebInputEvent::IsMouseEventType(input_event.GetType())) { | 2211 WebInputEvent::IsMouseEventType(input_event.GetType())) { |
| 2199 TRACE_EVENT1("input", "captured mouse event", "type", | 2212 TRACE_EVENT1("input", "captured mouse event", "type", |
| 2200 input_event.GetType()); | 2213 input_event.GetType()); |
| 2201 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. | 2214 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. |
| 2202 Node* node = mouse_capture_node_; | 2215 Node* node = mouse_capture_node_; |
| 2203 | 2216 |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2552 SetRootLayer(nullptr); | 2565 SetRootLayer(nullptr); |
| 2553 animation_host_ = nullptr; | 2566 animation_host_ = nullptr; |
| 2554 | 2567 |
| 2555 mutator_ = nullptr; | 2568 mutator_ = nullptr; |
| 2556 layer_tree_view_ = nullptr; | 2569 layer_tree_view_ = nullptr; |
| 2557 } | 2570 } |
| 2558 | 2571 |
| 2559 void WebViewImpl::DidAcquirePointerLock() { | 2572 void WebViewImpl::DidAcquirePointerLock() { |
| 2560 if (MainFrameImpl()) | 2573 if (MainFrameImpl()) |
| 2561 MainFrameImpl()->FrameWidget()->DidAcquirePointerLock(); | 2574 MainFrameImpl()->FrameWidget()->DidAcquirePointerLock(); |
| 2575 | |
| 2576 LocalFrame* focusedFrame = FocusedLocalFrameInWidget(); | |
| 2577 if (focusedFrame) | |
| 2578 focusedFrame->GetEventHandler().ReleaseMousePointerCapture(); | |
| 2562 } | 2579 } |
| 2563 | 2580 |
| 2564 void WebViewImpl::DidNotAcquirePointerLock() { | 2581 void WebViewImpl::DidNotAcquirePointerLock() { |
| 2565 if (MainFrameImpl()) | 2582 if (MainFrameImpl()) |
| 2566 MainFrameImpl()->FrameWidget()->DidNotAcquirePointerLock(); | 2583 MainFrameImpl()->FrameWidget()->DidNotAcquirePointerLock(); |
| 2567 } | 2584 } |
| 2568 | 2585 |
| 2569 void WebViewImpl::DidLosePointerLock() { | 2586 void WebViewImpl::DidLosePointerLock() { |
| 2570 // Make sure that the main frame wasn't swapped-out when the pointer lock is | 2587 // Make sure that the main frame wasn't swapped-out when the pointer lock is |
| 2571 // lost. There's a race that can happen when a pointer lock is requested, but | 2588 // lost. There's a race that can happen when a pointer lock is requested, but |
| (...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4169 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) | 4186 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) |
| 4170 return nullptr; | 4187 return nullptr; |
| 4171 return focused_frame; | 4188 return focused_frame; |
| 4172 } | 4189 } |
| 4173 | 4190 |
| 4174 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { | 4191 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { |
| 4175 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; | 4192 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; |
| 4176 } | 4193 } |
| 4177 | 4194 |
| 4178 } // namespace blink | 4195 } // namespace blink |
| OLD | NEW |