Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Side by Side Diff: third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp

Issue 2696523003: Unify the code paths for handling mouse events when pointer is locked on (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 // Report the event to be NOT processed by WebKit, so that the browser can 330 // Report the event to be NOT processed by WebKit, so that the browser can
331 // handle it appropriately. 331 // handle it appropriately.
332 if (ignoreInputEvents()) 332 if (ignoreInputEvents())
333 return WebInputEventResult::NotHandled; 333 return WebInputEventResult::NotHandled;
334 334
335 // FIXME: pass event to m_localRoot's WebDevToolsAgentImpl once available. 335 // FIXME: pass event to m_localRoot's WebDevToolsAgentImpl once available.
336 336
337 AutoReset<const WebInputEvent*> currentEventChange(&m_currentInputEvent, 337 AutoReset<const WebInputEvent*> currentEventChange(&m_currentInputEvent,
338 &inputEvent); 338 &inputEvent);
339 339
340 if (m_client && m_client->isPointerLocked() &&
dcheng 2017/02/13 23:21:28 Why would the client be null here?
lfg 2017/02/14 15:42:49 It shouldn't be. I just copied the code from WebVi
341 WebInputEvent::isMouseEventType(inputEvent.type())) {
342 pointerLockMouseEvent(inputEvent);
343 return WebInputEventResult::HandledSystem;
344 }
345
340 if (m_mouseCaptureNode && 346 if (m_mouseCaptureNode &&
341 WebInputEvent::isMouseEventType(inputEvent.type())) { 347 WebInputEvent::isMouseEventType(inputEvent.type())) {
342 TRACE_EVENT1("input", "captured mouse event", "type", inputEvent.type()); 348 TRACE_EVENT1("input", "captured mouse event", "type", inputEvent.type());
343 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. 349 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it.
344 Node* node = m_mouseCaptureNode; 350 Node* node = m_mouseCaptureNode;
345 351
346 // Not all platforms call mouseCaptureLost() directly. 352 // Not all platforms call mouseCaptureLost() directly.
347 if (inputEvent.type() == WebInputEvent::MouseUp) 353 if (inputEvent.type() == WebInputEvent::MouseUp)
348 mouseCaptureLost(); 354 mouseCaptureLost();
349 355
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 m_localRoot->frame()->view()); 666 m_localRoot->frame()->view());
661 } 667 }
662 668
663 setIsAcceleratedCompositingActive(false); 669 setIsAcceleratedCompositingActive(false);
664 m_mutator = nullptr; 670 m_mutator = nullptr;
665 m_layerTreeView = nullptr; 671 m_layerTreeView = nullptr;
666 m_animationHost = nullptr; 672 m_animationHost = nullptr;
667 m_layerTreeViewClosed = true; 673 m_layerTreeViewClosed = true;
668 } 674 }
669 675
670 void WebFrameWidgetImpl::didAcquirePointerLock() {
671 page()->pointerLockController().didAcquirePointerLock();
672 }
673
674 void WebFrameWidgetImpl::didNotAcquirePointerLock() {
675 page()->pointerLockController().didNotAcquirePointerLock();
676 }
677
678 void WebFrameWidgetImpl::didLosePointerLock() {
679 page()->pointerLockController().didLosePointerLock();
680 }
681
682 // TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This 676 // TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This
683 // code needs to be refactored (http://crbug.com/629721). 677 // code needs to be refactored (http://crbug.com/629721).
684 bool WebFrameWidgetImpl::getCompositionCharacterBounds( 678 bool WebFrameWidgetImpl::getCompositionCharacterBounds(
685 WebVector<WebRect>& bounds) { 679 WebVector<WebRect>& bounds) {
686 WebRange range = compositionRange(); 680 WebRange range = compositionRange();
687 if (range.isEmpty()) 681 if (range.isEmpty())
688 return false; 682 return false;
689 683
690 LocalFrame* frame = focusedLocalFrameInWidget(); 684 LocalFrame* frame = focusedLocalFrameInWidget();
691 if (!frame) 685 if (!frame)
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 return nullptr; 1128 return nullptr;
1135 } 1129 }
1136 1130
1137 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const { 1131 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const {
1138 if (!m_imeAcceptEvents) 1132 if (!m_imeAcceptEvents)
1139 return nullptr; 1133 return nullptr;
1140 return focusedLocalFrameInWidget(); 1134 return focusedLocalFrameInWidget();
1141 } 1135 }
1142 1136
1143 } // namespace blink 1137 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698