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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 m_client->setMouseOverURL(WebURL()); | 526 m_client->setMouseOverURL(WebURL()); |
527 PageWidgetEventHandler::handleMouseLeave(mainFrame, event); | 527 PageWidgetEventHandler::handleMouseLeave(mainFrame, event); |
528 } | 528 } |
529 | 529 |
530 void WebViewImpl::handleMouseDown(LocalFrame& mainFrame, const WebMouseEvent& ev
ent) | 530 void WebViewImpl::handleMouseDown(LocalFrame& mainFrame, const WebMouseEvent& ev
ent) |
531 { | 531 { |
532 // If there is a popup open, close it as the user is clicking on the page | 532 // If there is a popup open, close it as the user is clicking on the page |
533 // (outside of the popup). We also save it so we can prevent a click on an | 533 // (outside of the popup). We also save it so we can prevent a click on an |
534 // element from immediately reopening the same popup. | 534 // element from immediately reopening the same popup. |
535 RefPtr<WebPagePopupImpl> pagePopup; | 535 RefPtr<WebPagePopupImpl> pagePopup; |
536 if (event.button == WebMouseEvent::ButtonLeft) { | 536 if (event.button == WebMouseEvent::Button::Left) { |
537 pagePopup = m_pagePopup; | 537 pagePopup = m_pagePopup; |
538 hidePopups(); | 538 hidePopups(); |
539 DCHECK(!m_pagePopup); | 539 DCHECK(!m_pagePopup); |
540 } | 540 } |
541 | 541 |
542 // Take capture on a mouse down on a plugin so we can send it mouse events. | 542 // Take capture on a mouse down on a plugin so we can send it mouse events. |
543 // If the hit node is a plugin but a scrollbar is over it don't start mouse | 543 // If the hit node is a plugin but a scrollbar is over it don't start mouse |
544 // capture because it will interfere with the scrollbar receiving events. | 544 // capture because it will interfere with the scrollbar receiving events. |
545 IntPoint point(event.x, event.y); | 545 IntPoint point(event.x, event.y); |
546 if (event.button == WebMouseEvent::ButtonLeft && m_page->mainFrame()->isLoca
lFrame()) { | 546 if (event.button == WebMouseEvent::Button::Left && m_page->mainFrame()->isLo
calFrame()) { |
547 point = m_page->deprecatedLocalMainFrame()->view()->rootFrameToContents(
point); | 547 point = m_page->deprecatedLocalMainFrame()->view()->rootFrameToContents(
point); |
548 HitTestResult result(m_page->deprecatedLocalMainFrame()->eventHandler().
hitTestResultAtPoint(point)); | 548 HitTestResult result(m_page->deprecatedLocalMainFrame()->eventHandler().
hitTestResultAtPoint(point)); |
549 result.setToShadowHostIfInUserAgentShadowRoot(); | 549 result.setToShadowHostIfInUserAgentShadowRoot(); |
550 Node* hitNode = result.innerNodeOrImageMapImage(); | 550 Node* hitNode = result.innerNodeOrImageMapImage(); |
551 | 551 |
552 if (!result.scrollbar() && hitNode && hitNode->layoutObject() && hitNode
->layoutObject()->isEmbeddedObject()) { | 552 if (!result.scrollbar() && hitNode && hitNode->layoutObject() && hitNode
->layoutObject()->isEmbeddedObject()) { |
553 m_mouseCaptureNode = hitNode; | 553 m_mouseCaptureNode = hitNode; |
554 TRACE_EVENT_ASYNC_BEGIN0("input", "capturing mouse", this); | 554 TRACE_EVENT_ASYNC_BEGIN0("input", "capturing mouse", this); |
555 } | 555 } |
556 } | 556 } |
557 | 557 |
558 PageWidgetEventHandler::handleMouseDown(mainFrame, event); | 558 PageWidgetEventHandler::handleMouseDown(mainFrame, event); |
559 | 559 |
560 if (event.button == WebMouseEvent::ButtonLeft && m_mouseCaptureNode) | 560 if (event.button == WebMouseEvent::Button::Left && m_mouseCaptureNode) |
561 m_mouseCaptureGestureToken = mainFrame.eventHandler().takeLastMouseDownG
estureToken(); | 561 m_mouseCaptureGestureToken = mainFrame.eventHandler().takeLastMouseDownG
estureToken(); |
562 | 562 |
563 if (m_pagePopup && pagePopup && m_pagePopup->hasSamePopupClient(pagePopup.ge
t())) { | 563 if (m_pagePopup && pagePopup && m_pagePopup->hasSamePopupClient(pagePopup.ge
t())) { |
564 // That click triggered a page popup that is the same as the one we just
closed. | 564 // That click triggered a page popup that is the same as the one we just
closed. |
565 // It needs to be closed. | 565 // It needs to be closed. |
566 cancelPagePopup(); | 566 cancelPagePopup(); |
567 } | 567 } |
568 | 568 |
569 // Dispatch the contextmenu event regardless of if the click was swallowed. | 569 // Dispatch the contextmenu event regardless of if the click was swallowed. |
570 if (!page()->settings().showContextMenuOnMouseUp()) { | 570 if (!page()->settings().showContextMenuOnMouseUp()) { |
571 #if OS(MACOSX) | 571 #if OS(MACOSX) |
572 if (event.button == WebMouseEvent::ButtonRight | 572 if (event.button == WebMouseEvent::Button::Right |
573 || (event.button == WebMouseEvent::ButtonLeft | 573 || (event.button == WebMouseEvent::Button::Left |
574 && event.modifiers & WebMouseEvent::ControlKey)) | 574 && event.modifiers & WebMouseEvent::ControlKey)) |
575 mouseContextMenu(event); | 575 mouseContextMenu(event); |
576 #else | 576 #else |
577 if (event.button == WebMouseEvent::ButtonRight) | 577 if (event.button == WebMouseEvent::Button::Right) |
578 mouseContextMenu(event); | 578 mouseContextMenu(event); |
579 #endif | 579 #endif |
580 } | 580 } |
581 } | 581 } |
582 | 582 |
583 void WebViewImpl::setDisplayMode(WebDisplayMode mode) | 583 void WebViewImpl::setDisplayMode(WebDisplayMode mode) |
584 { | 584 { |
585 m_displayMode = mode; | 585 m_displayMode = mode; |
586 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 586 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
587 return; | 587 return; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 // implementation... | 623 // implementation... |
624 } | 624 } |
625 | 625 |
626 void WebViewImpl::handleMouseUp(LocalFrame& mainFrame, const WebMouseEvent& even
t) | 626 void WebViewImpl::handleMouseUp(LocalFrame& mainFrame, const WebMouseEvent& even
t) |
627 { | 627 { |
628 PageWidgetEventHandler::handleMouseUp(mainFrame, event); | 628 PageWidgetEventHandler::handleMouseUp(mainFrame, event); |
629 | 629 |
630 if (page()->settings().showContextMenuOnMouseUp()) { | 630 if (page()->settings().showContextMenuOnMouseUp()) { |
631 // Dispatch the contextmenu event regardless of if the click was swallow
ed. | 631 // Dispatch the contextmenu event regardless of if the click was swallow
ed. |
632 // On Mac/Linux, we handle it on mouse down, not up. | 632 // On Mac/Linux, we handle it on mouse down, not up. |
633 if (event.button == WebMouseEvent::ButtonRight) | 633 if (event.button == WebMouseEvent::Button::Right) |
634 mouseContextMenu(event); | 634 mouseContextMenu(event); |
635 } | 635 } |
636 } | 636 } |
637 | 637 |
638 WebInputEventResult WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const W
ebMouseWheelEvent& event) | 638 WebInputEventResult WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const W
ebMouseWheelEvent& event) |
639 { | 639 { |
640 // Halt an in-progress fling on a wheel tick. | 640 // Halt an in-progress fling on a wheel tick. |
641 if (!event.hasPreciseScrollingDeltas) | 641 if (!event.hasPreciseScrollingDeltas) |
642 endActiveFlingAnimation(); | 642 endActiveFlingAnimation(); |
643 | 643 |
(...skipping 3009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3653 FrameView* view = mainFrameImpl()->frameView(); | 3653 FrameView* view = mainFrameImpl()->frameView(); |
3654 IntPoint pointInRootFrame = view->contentsToFrame(view->viewportToContents(p
ointInViewport)); | 3654 IntPoint pointInRootFrame = view->contentsToFrame(view->viewportToContents(p
ointInViewport)); |
3655 return hitTestResultForRootFramePos(pointInRootFrame); | 3655 return hitTestResultForRootFramePos(pointInRootFrame); |
3656 } | 3656 } |
3657 | 3657 |
3658 void WebViewImpl::dragSourceEndedAt( | 3658 void WebViewImpl::dragSourceEndedAt( |
3659 const WebPoint& clientPoint, | 3659 const WebPoint& clientPoint, |
3660 const WebPoint& screenPoint, | 3660 const WebPoint& screenPoint, |
3661 WebDragOperation operation) | 3661 WebDragOperation operation) |
3662 { | 3662 { |
3663 PlatformMouseEvent pme(clientPoint, screenPoint, LeftButton, PlatformEvent::
MouseMoved, | 3663 PlatformMouseEvent pme(clientPoint, screenPoint, WebPointerProperties::Butto
n::Left, PlatformEvent::MouseMoved, |
3664 0, PlatformEvent::NoModifiers, PlatformMouseEvent::RealOrIndistinguishab
le, WTF::monotonicallyIncreasingTime()); | 3664 0, PlatformEvent::NoModifiers, PlatformMouseEvent::RealOrIndistinguishab
le, WTF::monotonicallyIncreasingTime()); |
3665 m_page->deprecatedLocalMainFrame()->eventHandler().dragSourceEndedAt(pme, | 3665 m_page->deprecatedLocalMainFrame()->eventHandler().dragSourceEndedAt(pme, |
3666 static_cast<DragOperation>(operation)); | 3666 static_cast<DragOperation>(operation)); |
3667 } | 3667 } |
3668 | 3668 |
3669 void WebViewImpl::dragSourceSystemDragEnded() | 3669 void WebViewImpl::dragSourceSystemDragEnded() |
3670 { | 3670 { |
3671 // It's possible for us to get this callback while not doing a drag if | 3671 // It's possible for us to get this callback while not doing a drag if |
3672 // it's from a previous page that got unloaded. | 3672 // it's from a previous page that got unloaded. |
3673 if (m_doingDragAndDrop) { | 3673 if (m_doingDragAndDrop) { |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4611 return nullptr; | 4611 return nullptr; |
4612 return focusedFrame; | 4612 return focusedFrame; |
4613 } | 4613 } |
4614 | 4614 |
4615 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const | 4615 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const |
4616 { | 4616 { |
4617 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4617 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
4618 } | 4618 } |
4619 | 4619 |
4620 } // namespace blink | 4620 } // namespace blink |
OLD | NEW |