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