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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 Loading... | |
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; |
dcheng
2016/06/07 05:07:55
Sigh. One day we won't need this I guess =)
| |
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 2252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4436 | 4443 |
4437 if (page()) | 4444 if (page()) |
4438 m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast< int>(visibilityState)), isInitialState); | 4445 m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast< int>(visibilityState)), isInitialState); |
4439 | 4446 |
4440 bool visible = visibilityState == WebPageVisibilityStateVisible; | 4447 bool visible = visibilityState == WebPageVisibilityStateVisible; |
4441 if (m_layerTreeView) | 4448 if (m_layerTreeView) |
4442 m_layerTreeView->setVisible(visible); | 4449 m_layerTreeView->setVisible(visible); |
4443 m_scheduler->setPageVisible(visible); | 4450 m_scheduler->setPageVisible(visible); |
4444 } | 4451 } |
4445 | 4452 |
4446 bool WebViewImpl::requestPointerLock() | |
4447 { | |
4448 return m_client && m_client->requestPointerLock(); | |
4449 } | |
4450 | |
4451 void WebViewImpl::requestPointerUnlock() | |
4452 { | |
4453 if (m_client) | |
4454 m_client->requestPointerUnlock(); | |
4455 } | |
4456 | |
4457 bool WebViewImpl::isPointerLocked() | |
4458 { | |
4459 return m_client && m_client->isPointerLocked(); | |
4460 } | |
4461 | |
4462 void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event) | 4453 void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event) |
4463 { | 4454 { |
4464 OwnPtr<UserGestureIndicator> gestureIndicator; | 4455 OwnPtr<UserGestureIndicator> gestureIndicator; |
4465 AtomicString eventType; | 4456 AtomicString eventType; |
4466 switch (event.type) { | 4457 switch (event.type) { |
4467 case WebInputEvent::MouseDown: | 4458 case WebInputEvent::MouseDown: |
4468 eventType = EventTypeNames::mousedown; | 4459 eventType = EventTypeNames::mousedown; |
4469 gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessin gNewUserGesture)); | 4460 gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessin gNewUserGesture)); |
4470 m_pointerLockGestureToken = gestureIndicator->currentToken(); | 4461 m_pointerLockGestureToken = gestureIndicator->currentToken(); |
4471 break; | 4462 break; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4553 { | 4544 { |
4554 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than | 4545 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than |
4555 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. | 4546 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. |
4556 if (!page()) | 4547 if (!page()) |
4557 return 1; | 4548 return 1; |
4558 | 4549 |
4559 return page()->deviceScaleFactor(); | 4550 return page()->deviceScaleFactor(); |
4560 } | 4551 } |
4561 | 4552 |
4562 } // namespace blink | 4553 } // namespace blink |
OLD | NEW |