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 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2031 return EventTypeNames::touchend; | 2031 return EventTypeNames::touchend; |
2032 case WebInputEvent::TouchCancel: | 2032 case WebInputEvent::TouchCancel: |
2033 return EventTypeNames::touchcancel; | 2033 return EventTypeNames::touchcancel; |
2034 default: | 2034 default: |
2035 return String("unknown"); | 2035 return String("unknown"); |
2036 } | 2036 } |
2037 } | 2037 } |
2038 | 2038 |
2039 bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) | 2039 bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) |
2040 { | 2040 { |
2041 UserGestureNotifier notifier(m_autofillClient, &m_userGestureObserved); | 2041 WebAutofillClient* autofillClient = m_autofillClient ? m_autofillClient : |
| 2042 mainFrameImpl() ? mainFrameImpl()->autofillClient() : 0; |
| 2043 UserGestureNotifier notifier(autofillClient, &m_userGestureObserved); |
2042 // On the first input event since page load, |notifier| instructs the | 2044 // On the first input event since page load, |notifier| instructs the |
2043 // autofill client to unblock values of password input fields of any forms | 2045 // autofill client to unblock values of password input fields of any forms |
2044 // on the page. There is a single input event, GestureTap, which can both | 2046 // on the page. There is a single input event, GestureTap, which can both |
2045 // be the first event after page load, and cause a form submission. In that | 2047 // be the first event after page load, and cause a form submission. In that |
2046 // case, the form submission happens before the autofill client is told | 2048 // case, the form submission happens before the autofill client is told |
2047 // to unblock the password values, and so the password values are not | 2049 // to unblock the password values, and so the password values are not |
2048 // submitted. To avoid that, GestureTap is handled explicitly: | 2050 // submitted. To avoid that, GestureTap is handled explicitly: |
2049 if (inputEvent.type == WebInputEvent::GestureTap && m_autofillClient) { | 2051 if (inputEvent.type == WebInputEvent::GestureTap && autofillClient) { |
2050 m_userGestureObserved = true; | 2052 m_userGestureObserved = true; |
2051 m_autofillClient->firstUserGestureObserved(); | 2053 autofillClient->firstUserGestureObserved(); |
2052 } | 2054 } |
2053 | 2055 |
2054 TRACE_EVENT1("input", "WebViewImpl::handleInputEvent", "type", inputTypeToNa
me(inputEvent.type).ascii()); | 2056 TRACE_EVENT1("input", "WebViewImpl::handleInputEvent", "type", inputTypeToNa
me(inputEvent.type).ascii()); |
2055 // If we've started a drag and drop operation, ignore input events until | 2057 // If we've started a drag and drop operation, ignore input events until |
2056 // we're done. | 2058 // we're done. |
2057 if (m_doingDragAndDrop) | 2059 if (m_doingDragAndDrop) |
2058 return true; | 2060 return true; |
2059 | 2061 |
2060 if (m_devToolsAgent && m_devToolsAgent->handleInputEvent(m_page.get(), input
Event)) | 2062 if (m_devToolsAgent && m_devToolsAgent->handleInputEvent(m_page.get(), input
Event)) |
2061 return true; | 2063 return true; |
2062 | 2064 |
2063 // Report the event to be NOT processed by WebKit, so that the browser can h
andle it appropriately. | 2065 // Report the event to be NOT processed by WebKit, so that the browser can h
andle it appropriately. |
2064 if (m_ignoreInputEvents) | 2066 if (m_ignoreInputEvents) |
2065 return false; | 2067 return false; |
2066 | 2068 |
2067 TemporaryChange<const WebInputEvent*> currentEventChange(m_currentInputEvent
, &inputEvent); | 2069 TemporaryChange<const WebInputEvent*> currentEventChange(m_currentInputEvent
, &inputEvent); |
2068 | 2070 |
2069 if (isPointerLocked() && WebInputEvent::isMouseEventType(inputEvent.type)) { | 2071 if (isPointerLocked() && WebInputEvent::isMouseEventType(inputEvent.type)) { |
2070 pointerLockMouseEvent(inputEvent); | 2072 pointerLockMouseEvent(inputEvent); |
2071 return true; | 2073 return true; |
2072 } | 2074 } |
2073 | 2075 |
2074 if (m_mouseCaptureNode && WebInputEvent::isMouseEventType(inputEvent.type))
{ | 2076 if (m_mouseCaptureNode && WebInputEvent::isMouseEventType(inputEvent.type))
{ |
2075 TRACE_EVENT1("input", "captured mouse event", "type", inputEvent.type); | 2077 TRACE_EVENT1("input", "captured mouse event", "type", inputEvent.type); |
2076 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. | 2078 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. |
2077 RefPtrWillBeRawPtr<Node> node = m_mouseCaptureNode; | 2079 RefPtrWillBeRawPtr<Node> node = m_mouseCaptureNode; |
2078 | 2080 |
2079 // Not all platforms call mouseCaptureLost() directly. | 2081 // Not all platforms call mouseCaptureLost() directly. |
2080 if (inputEvent.type == WebInputEvent::MouseUp) | 2082 if (inputEvent.type == WebInputEvent::MouseUp) |
2081 mouseCaptureLost(); | 2083 mouseCaptureLost(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2160 | 2162 |
2161 LocalFrame* frame = m_page->mainFrame() && m_page->mainFrame()->isLocalF
rame() | 2163 LocalFrame* frame = m_page->mainFrame() && m_page->mainFrame()->isLocalF
rame() |
2162 ? m_page->deprecatedLocalMainFrame() : 0; | 2164 ? m_page->deprecatedLocalMainFrame() : 0; |
2163 if (!frame) | 2165 if (!frame) |
2164 return; | 2166 return; |
2165 | 2167 |
2166 RefPtrWillBeRawPtr<Frame> focusedFrame = m_page->focusController().focus
edFrame(); | 2168 RefPtrWillBeRawPtr<Frame> focusedFrame = m_page->focusController().focus
edFrame(); |
2167 if (focusedFrame && focusedFrame->isLocalFrame()) { | 2169 if (focusedFrame && focusedFrame->isLocalFrame()) { |
2168 // Finish an ongoing composition to delete the composition node. | 2170 // Finish an ongoing composition to delete the composition node. |
2169 if (toLocalFrame(focusedFrame.get())->inputMethodController().hasCom
position()) { | 2171 if (toLocalFrame(focusedFrame.get())->inputMethodController().hasCom
position()) { |
2170 if (m_autofillClient) | 2172 WebAutofillClient* autofillClient = m_autofillClient ? m_autofil
lClient : |
2171 m_autofillClient->setIgnoreTextChanges(true); | 2173 WebLocalFrameImpl::fromFrame(toLocalFrame(focusedFrame.get()
))->autofillClient(); |
| 2174 |
| 2175 if (autofillClient) |
| 2176 autofillClient->setIgnoreTextChanges(true); |
2172 | 2177 |
2173 toLocalFrame(focusedFrame.get())->inputMethodController().confir
mComposition(); | 2178 toLocalFrame(focusedFrame.get())->inputMethodController().confir
mComposition(); |
2174 | 2179 |
2175 if (m_autofillClient) | 2180 if (autofillClient) |
2176 m_autofillClient->setIgnoreTextChanges(false); | 2181 autofillClient->setIgnoreTextChanges(false); |
2177 } | 2182 } |
2178 m_imeAcceptEvents = false; | 2183 m_imeAcceptEvents = false; |
2179 } | 2184 } |
2180 } | 2185 } |
2181 } | 2186 } |
2182 | 2187 |
2183 bool WebViewImpl::setComposition( | 2188 bool WebViewImpl::setComposition( |
2184 const WebString& text, | 2189 const WebString& text, |
2185 const WebVector<WebCompositionUnderline>& underlines, | 2190 const WebVector<WebCompositionUnderline>& underlines, |
2186 int selectionStart, | 2191 int selectionStart, |
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3563 m_dragOperation = WebDragOperationNone; | 3568 m_dragOperation = WebDragOperationNone; |
3564 m_currentDragData = nullptr; | 3569 m_currentDragData = nullptr; |
3565 } | 3570 } |
3566 | 3571 |
3567 void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint, | 3572 void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint, |
3568 const WebPoint& screenPoint, | 3573 const WebPoint& screenPoint, |
3569 int keyModifiers) | 3574 int keyModifiers) |
3570 { | 3575 { |
3571 ASSERT(m_currentDragData); | 3576 ASSERT(m_currentDragData); |
3572 | 3577 |
3573 UserGestureNotifier notifier(m_autofillClient, &m_userGestureObserved); | 3578 WebAutofillClient* autofillClient = m_autofillClient ? m_autofillClient : |
| 3579 mainFrameImpl() ? mainFrameImpl()->autofillClient() : 0; |
| 3580 UserGestureNotifier notifier(autofillClient, &m_userGestureObserved); |
3574 | 3581 |
3575 // If this webview transitions from the "drop accepting" state to the "not | 3582 // If this webview transitions from the "drop accepting" state to the "not |
3576 // accepting" state, then our IPC message reply indicating that may be in- | 3583 // accepting" state, then our IPC message reply indicating that may be in- |
3577 // flight, or else delayed by javascript processing in this webview. If a | 3584 // flight, or else delayed by javascript processing in this webview. If a |
3578 // drop happens before our IPC reply has reached the browser process, then | 3585 // drop happens before our IPC reply has reached the browser process, then |
3579 // the browser forwards the drop to this webview. So only allow a drop to | 3586 // the browser forwards the drop to this webview. So only allow a drop to |
3580 // proceed if our webview m_dragOperation state is not DragOperationNone. | 3587 // proceed if our webview m_dragOperation state is not DragOperationNone. |
3581 | 3588 |
3582 if (m_dragOperation == WebDragOperationNone) { // IPC RACE CONDITION: do not
allow this drop. | 3589 if (m_dragOperation == WebDragOperationNone) { // IPC RACE CONDITION: do not
allow this drop. |
3583 dragTargetDragLeave(); | 3590 dragTargetDragLeave(); |
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4515 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4522 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4516 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4523 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4517 } | 4524 } |
4518 | 4525 |
4519 void WebViewImpl::forceNextWebGLContextCreationToFail() | 4526 void WebViewImpl::forceNextWebGLContextCreationToFail() |
4520 { | 4527 { |
4521 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); | 4528 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); |
4522 } | 4529 } |
4523 | 4530 |
4524 } // namespace blink | 4531 } // namespace blink |
OLD | NEW |