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

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

Issue 1980133002: Implement pointer lock API for out-of-process iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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) 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 #include "public/platform/WebScheduler.h" 133 #include "public/platform/WebScheduler.h"
134 #include "public/platform/WebURLRequest.h" 134 #include "public/platform/WebURLRequest.h"
135 #include "public/platform/WebVector.h" 135 #include "public/platform/WebVector.h"
136 #include "public/platform/WebViewScheduler.h" 136 #include "public/platform/WebViewScheduler.h"
137 #include "public/web/WebAXObject.h" 137 #include "public/web/WebAXObject.h"
138 #include "public/web/WebActiveWheelFlingParameters.h" 138 #include "public/web/WebActiveWheelFlingParameters.h"
139 #include "public/web/WebAutofillClient.h" 139 #include "public/web/WebAutofillClient.h"
140 #include "public/web/WebElement.h" 140 #include "public/web/WebElement.h"
141 #include "public/web/WebFrame.h" 141 #include "public/web/WebFrame.h"
142 #include "public/web/WebFrameClient.h" 142 #include "public/web/WebFrameClient.h"
143 #include "public/web/WebFrameWidget.h"
143 #include "public/web/WebHitTestResult.h" 144 #include "public/web/WebHitTestResult.h"
144 #include "public/web/WebInputElement.h" 145 #include "public/web/WebInputElement.h"
145 #include "public/web/WebMeaningfulLayout.h" 146 #include "public/web/WebMeaningfulLayout.h"
146 #include "public/web/WebMediaPlayerAction.h" 147 #include "public/web/WebMediaPlayerAction.h"
147 #include "public/web/WebNode.h" 148 #include "public/web/WebNode.h"
148 #include "public/web/WebPlugin.h" 149 #include "public/web/WebPlugin.h"
149 #include "public/web/WebPluginAction.h" 150 #include "public/web/WebPluginAction.h"
150 #include "public/web/WebRange.h" 151 #include "public/web/WebRange.h"
151 #include "public/web/WebScopedUserGesture.h" 152 #include "public/web/WebScopedUserGesture.h"
152 #include "public/web/WebSelection.h" 153 #include "public/web/WebSelection.h"
(...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after
2163 return WebInputEventResult::HandledSuppressed; 2164 return WebInputEventResult::HandledSuppressed;
2164 } 2165 }
2165 2166
2166 // Report the event to be NOT processed by WebKit, so that the browser can h andle it appropriately. 2167 // Report the event to be NOT processed by WebKit, so that the browser can h andle it appropriately.
2167 if (m_ignoreInputEvents) 2168 if (m_ignoreInputEvents)
2168 return WebInputEventResult::NotHandled; 2169 return WebInputEventResult::NotHandled;
2169 2170
2170 TemporaryChange<const WebInputEvent*> currentEventChange(m_currentInputEvent , &inputEvent); 2171 TemporaryChange<const WebInputEvent*> currentEventChange(m_currentInputEvent , &inputEvent);
2171 UIEventWithKeyState::clearNewTabModifierSetFromIsolatedWorld(); 2172 UIEventWithKeyState::clearNewTabModifierSetFromIsolatedWorld();
2172 2173
2173 if (isPointerLocked() && WebInputEvent::isMouseEventType(inputEvent.type)) { 2174 bool isPointerLocked = false;
2175 if (WebFrameWidget* widget = mainFrameImpl()->frameWidget()) {
2176 if (WebWidgetClient* client = widget->client())
2177 isPointerLocked = client->isPointerLocked();
2178 }
2179
2180 if (isPointerLocked && WebInputEvent::isMouseEventType(inputEvent.type)) {
2174 pointerLockMouseEvent(inputEvent); 2181 pointerLockMouseEvent(inputEvent);
2175 return WebInputEventResult::HandledSystem; 2182 return WebInputEventResult::HandledSystem;
2176 } 2183 }
2177 2184
2178 if (m_mouseCaptureNode && WebInputEvent::isMouseEventType(inputEvent.type)) { 2185 if (m_mouseCaptureNode && WebInputEvent::isMouseEventType(inputEvent.type)) {
2179 TRACE_EVENT1("input", "captured mouse event", "type", inputEvent.type); 2186 TRACE_EVENT1("input", "captured mouse event", "type", inputEvent.type);
2180 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. 2187 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it.
2181 Node* node = m_mouseCaptureNode; 2188 Node* node = m_mouseCaptureNode;
2182 2189
2183 // Not all platforms call mouseCaptureLost() directly. 2190 // Not all platforms call mouseCaptureLost() directly.
(...skipping 2274 matching lines...) Expand 10 before | Expand all | Expand 10 after
4458 4465
4459 if (page()) 4466 if (page())
4460 m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast< int>(visibilityState)), isInitialState); 4467 m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast< int>(visibilityState)), isInitialState);
4461 4468
4462 bool visible = visibilityState == WebPageVisibilityStateVisible; 4469 bool visible = visibilityState == WebPageVisibilityStateVisible;
4463 if (m_layerTreeView) 4470 if (m_layerTreeView)
4464 m_layerTreeView->setVisible(visible); 4471 m_layerTreeView->setVisible(visible);
4465 m_scheduler->setPageVisible(visible); 4472 m_scheduler->setPageVisible(visible);
4466 } 4473 }
4467 4474
4468 bool WebViewImpl::requestPointerLock()
4469 {
4470 return m_client && m_client->requestPointerLock();
4471 }
4472
4473 void WebViewImpl::requestPointerUnlock()
4474 {
4475 if (m_client)
4476 m_client->requestPointerUnlock();
4477 }
4478
4479 bool WebViewImpl::isPointerLocked()
4480 {
4481 return m_client && m_client->isPointerLocked();
4482 }
4483
4484 void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event) 4475 void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event)
4485 { 4476 {
4486 OwnPtr<UserGestureIndicator> gestureIndicator; 4477 OwnPtr<UserGestureIndicator> gestureIndicator;
4487 AtomicString eventType; 4478 AtomicString eventType;
4488 switch (event.type) { 4479 switch (event.type) {
4489 case WebInputEvent::MouseDown: 4480 case WebInputEvent::MouseDown:
4490 eventType = EventTypeNames::mousedown; 4481 eventType = EventTypeNames::mousedown;
4491 gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessin gNewUserGesture)); 4482 gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessin gNewUserGesture));
4492 m_pointerLockGestureToken = gestureIndicator->currentToken(); 4483 m_pointerLockGestureToken = gestureIndicator->currentToken();
4493 break; 4484 break;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
4575 { 4566 {
4576 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than 4567 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than
4577 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. 4568 // page's scale factor, which can be 1 in use-zoom-for-dsf mode.
4578 if (!page()) 4569 if (!page())
4579 return 1; 4570 return 1;
4580 4571
4581 return page()->deviceScaleFactor(); 4572 return page()->deviceScaleFactor();
4582 } 4573 }
4583 4574
4584 } // namespace blink 4575 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | third_party/WebKit/public/web/WebViewClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698