| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 #include "modules/accessibility/AXObjectCacheImpl.h" | 90 #include "modules/accessibility/AXObjectCacheImpl.h" |
| 91 #include "modules/credentialmanager/CredentialManagerClient.h" | 91 #include "modules/credentialmanager/CredentialManagerClient.h" |
| 92 #include "modules/encryptedmedia/MediaKeysController.h" | 92 #include "modules/encryptedmedia/MediaKeysController.h" |
| 93 #include "modules/storage/StorageNamespaceController.h" | 93 #include "modules/storage/StorageNamespaceController.h" |
| 94 #include "modules/webgl/WebGLRenderingContext.h" | 94 #include "modules/webgl/WebGLRenderingContext.h" |
| 95 #include "platform/ContextMenu.h" | 95 #include "platform/ContextMenu.h" |
| 96 #include "platform/ContextMenuItem.h" | 96 #include "platform/ContextMenuItem.h" |
| 97 #include "platform/Cursor.h" | 97 #include "platform/Cursor.h" |
| 98 #include "platform/Histogram.h" | 98 #include "platform/Histogram.h" |
| 99 #include "platform/KeyboardCodes.h" | 99 #include "platform/KeyboardCodes.h" |
| 100 #include "platform/PlatformMouseEvent.h" | |
| 101 #include "platform/RuntimeEnabledFeatures.h" | 100 #include "platform/RuntimeEnabledFeatures.h" |
| 102 #include "platform/UserGestureIndicator.h" | 101 #include "platform/UserGestureIndicator.h" |
| 103 #include "platform/animation/CompositorAnimationHost.h" | 102 #include "platform/animation/CompositorAnimationHost.h" |
| 104 #include "platform/exported/WebActiveGestureAnimation.h" | 103 #include "platform/exported/WebActiveGestureAnimation.h" |
| 105 #include "platform/fonts/FontCache.h" | 104 #include "platform/fonts/FontCache.h" |
| 106 #include "platform/geometry/FloatRect.h" | 105 #include "platform/geometry/FloatRect.h" |
| 107 #include "platform/graphics/Color.h" | 106 #include "platform/graphics/Color.h" |
| 108 #include "platform/graphics/CompositorMutatorClient.h" | 107 #include "platform/graphics/CompositorMutatorClient.h" |
| 109 #include "platform/graphics/FirstPaintInvalidationTracking.h" | 108 #include "platform/graphics/FirstPaintInvalidationTracking.h" |
| 110 #include "platform/graphics/GraphicsContext.h" | 109 #include "platform/graphics/GraphicsContext.h" |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 | 548 |
| 550 mainFrameImpl()->frameView()->setDisplayMode(mode); | 549 mainFrameImpl()->frameView()->setDisplayMode(mode); |
| 551 } | 550 } |
| 552 | 551 |
| 553 void WebViewImpl::mouseContextMenu(const WebMouseEvent& event) { | 552 void WebViewImpl::mouseContextMenu(const WebMouseEvent& event) { |
| 554 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 553 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
| 555 return; | 554 return; |
| 556 | 555 |
| 557 m_page->contextMenuController().clearContextMenu(); | 556 m_page->contextMenuController().clearContextMenu(); |
| 558 | 557 |
| 559 PlatformMouseEventBuilder pme(mainFrameImpl()->frameView(), event); | 558 WebMouseEvent transformedEvent = |
| 559 TransformWebMouseEvent(mainFrameImpl()->frameView(), event); |
| 560 IntPoint positionInRootFrame = |
| 561 flooredIntPoint(transformedEvent.positionInRootFrame()); |
| 560 | 562 |
| 561 // Find the right target frame. See issue 1186900. | 563 // Find the right target frame. See issue 1186900. |
| 562 HitTestResult result = hitTestResultForRootFramePos(pme.position()); | 564 HitTestResult result = hitTestResultForRootFramePos(positionInRootFrame); |
| 563 Frame* targetFrame; | 565 Frame* targetFrame; |
| 564 if (result.innerNodeOrImageMapImage()) | 566 if (result.innerNodeOrImageMapImage()) |
| 565 targetFrame = result.innerNodeOrImageMapImage()->document().frame(); | 567 targetFrame = result.innerNodeOrImageMapImage()->document().frame(); |
| 566 else | 568 else |
| 567 targetFrame = m_page->focusController().focusedOrMainFrame(); | 569 targetFrame = m_page->focusController().focusedOrMainFrame(); |
| 568 | 570 |
| 569 if (!targetFrame->isLocalFrame()) | 571 if (!targetFrame->isLocalFrame()) |
| 570 return; | 572 return; |
| 571 | 573 |
| 572 LocalFrame* targetLocalFrame = toLocalFrame(targetFrame); | 574 LocalFrame* targetLocalFrame = toLocalFrame(targetFrame); |
| 573 | 575 |
| 574 #if OS(WIN) | 576 #if OS(WIN) |
| 575 targetLocalFrame->view()->setCursor(pointerCursor()); | 577 targetLocalFrame->view()->setCursor(pointerCursor()); |
| 576 #endif | 578 #endif |
| 577 | 579 |
| 578 { | 580 { |
| 579 ContextMenuAllowedScope scope; | 581 ContextMenuAllowedScope scope; |
| 580 targetLocalFrame->eventHandler().sendContextMenuEvent(pme, nullptr); | 582 targetLocalFrame->eventHandler().sendContextMenuEvent(transformedEvent, |
| 583 nullptr); |
| 581 } | 584 } |
| 582 // Actually showing the context menu is handled by the ContextMenuClient | 585 // Actually showing the context menu is handled by the ContextMenuClient |
| 583 // implementation... | 586 // implementation... |
| 584 } | 587 } |
| 585 | 588 |
| 586 void WebViewImpl::handleMouseUp(LocalFrame& mainFrame, | 589 void WebViewImpl::handleMouseUp(LocalFrame& mainFrame, |
| 587 const WebMouseEvent& event) { | 590 const WebMouseEvent& event) { |
| 588 PageWidgetEventHandler::handleMouseUp(mainFrame, event); | 591 PageWidgetEventHandler::handleMouseUp(mainFrame, event); |
| 589 | 592 |
| 590 if (page()->settings().getShowContextMenuOnMouseUp()) { | 593 if (page()->settings().getShowContextMenuOnMouseUp()) { |
| (...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2192 break; | 2195 break; |
| 2193 case WebInputEvent::MouseUp: | 2196 case WebInputEvent::MouseUp: |
| 2194 eventType = EventTypeNames::mouseup; | 2197 eventType = EventTypeNames::mouseup; |
| 2195 gestureIndicator = WTF::wrapUnique( | 2198 gestureIndicator = WTF::wrapUnique( |
| 2196 new UserGestureIndicator(m_mouseCaptureGestureToken.release())); | 2199 new UserGestureIndicator(m_mouseCaptureGestureToken.release())); |
| 2197 break; | 2200 break; |
| 2198 default: | 2201 default: |
| 2199 NOTREACHED(); | 2202 NOTREACHED(); |
| 2200 } | 2203 } |
| 2201 | 2204 |
| 2202 node->dispatchMouseEvent( | 2205 WebMouseEvent transformedEvent = |
| 2203 PlatformMouseEventBuilder( | 2206 TransformWebMouseEvent(mainFrameImpl()->frameView(), |
| 2204 mainFrameImpl()->frameView(), | 2207 static_cast<const WebMouseEvent&>(inputEvent)); |
| 2205 static_cast<const WebMouseEvent&>(inputEvent)), | 2208 node->dispatchMouseEvent(transformedEvent, eventType, |
| 2206 eventType, static_cast<const WebMouseEvent&>(inputEvent).clickCount); | 2209 transformedEvent.clickCount); |
| 2207 return WebInputEventResult::HandledSystem; | 2210 return WebInputEventResult::HandledSystem; |
| 2208 } | 2211 } |
| 2209 | 2212 |
| 2210 // FIXME: This should take in the intended frame, not the local frame root. | 2213 // FIXME: This should take in the intended frame, not the local frame root. |
| 2211 WebInputEventResult result = PageWidgetDelegate::handleInputEvent( | 2214 WebInputEventResult result = PageWidgetDelegate::handleInputEvent( |
| 2212 *this, coalescedEvent, mainFrameImpl()->frame()); | 2215 *this, coalescedEvent, mainFrameImpl()->frame()); |
| 2213 if (result != WebInputEventResult::NotHandled) | 2216 if (result != WebInputEventResult::NotHandled) |
| 2214 return result; | 2217 return result; |
| 2215 | 2218 |
| 2216 // Unhandled pinch events should adjust the scale. | 2219 // Unhandled pinch events should adjust the scale. |
| (...skipping 1911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4128 break; | 4131 break; |
| 4129 case WebInputEvent::MouseMove: | 4132 case WebInputEvent::MouseMove: |
| 4130 eventType = EventTypeNames::mousemove; | 4133 eventType = EventTypeNames::mousemove; |
| 4131 break; | 4134 break; |
| 4132 default: | 4135 default: |
| 4133 NOTREACHED(); | 4136 NOTREACHED(); |
| 4134 } | 4137 } |
| 4135 | 4138 |
| 4136 const WebMouseEvent& mouseEvent = static_cast<const WebMouseEvent&>(event); | 4139 const WebMouseEvent& mouseEvent = static_cast<const WebMouseEvent&>(event); |
| 4137 | 4140 |
| 4138 if (page()) | 4141 if (page()) { |
| 4139 page()->pointerLockController().dispatchLockedMouseEvent( | 4142 WebMouseEvent transformedEvent = |
| 4140 PlatformMouseEventBuilder(mainFrameImpl()->frameView(), mouseEvent), | 4143 TransformWebMouseEvent(mainFrameImpl()->frameView(), mouseEvent); |
| 4141 eventType); | 4144 page()->pointerLockController().dispatchLockedMouseEvent(transformedEvent, |
| 4145 eventType); |
| 4146 } |
| 4142 } | 4147 } |
| 4143 | 4148 |
| 4144 void WebViewImpl::forceNextWebGLContextCreationToFail() { | 4149 void WebViewImpl::forceNextWebGLContextCreationToFail() { |
| 4145 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); | 4150 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); |
| 4146 } | 4151 } |
| 4147 | 4152 |
| 4148 void WebViewImpl::forceNextDrawingBufferCreationToFail() { | 4153 void WebViewImpl::forceNextDrawingBufferCreationToFail() { |
| 4149 DrawingBuffer::forceNextDrawingBufferCreationToFail(); | 4154 DrawingBuffer::forceNextDrawingBufferCreationToFail(); |
| 4150 } | 4155 } |
| 4151 | 4156 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4187 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) | 4192 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
| 4188 return nullptr; | 4193 return nullptr; |
| 4189 return focusedFrame; | 4194 return focusedFrame; |
| 4190 } | 4195 } |
| 4191 | 4196 |
| 4192 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { | 4197 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { |
| 4193 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4198 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
| 4194 } | 4199 } |
| 4195 | 4200 |
| 4196 } // namespace blink | 4201 } // namespace blink |
| OLD | NEW |