| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 #include "wtf/CurrentTime.h" | 101 #include "wtf/CurrentTime.h" |
| 102 #include "wtf/PtrUtil.h" | 102 #include "wtf/PtrUtil.h" |
| 103 #include "wtf/StdLibExtras.h" | 103 #include "wtf/StdLibExtras.h" |
| 104 | 104 |
| 105 namespace blink { | 105 namespace blink { |
| 106 | 106 |
| 107 namespace { | 107 namespace { |
| 108 | 108 |
| 109 // Refetch the event target node if it is removed or currently is the shadow | 109 // Refetch the event target node if it is removed or currently is the shadow |
| 110 // node inside an <input> element. If a mouse event handler changes the input | 110 // node inside an <input> element. If a mouse event handler changes the input |
| 111 // element type to one that has a widget associated, we'd like to | 111 // element type to one that has a FrameViewBase associated, we'd like to |
| 112 // EventHandler::handleMousePressEvent to pass the event to the widget and thus | 112 // EventHandler::handleMousePressEvent to pass the event to the FrameViewBase |
| 113 // the event target node can't still be the shadow node. | 113 // and thus the event target node can't still be the shadow node. |
| 114 bool shouldRefetchEventTarget(const MouseEventWithHitTestResults& mev) { | 114 bool shouldRefetchEventTarget(const MouseEventWithHitTestResults& mev) { |
| 115 Node* targetNode = mev.innerNode(); | 115 Node* targetNode = mev.innerNode(); |
| 116 if (!targetNode || !targetNode->parentNode()) | 116 if (!targetNode || !targetNode->parentNode()) |
| 117 return true; | 117 return true; |
| 118 return targetNode->isShadowRoot() && | 118 return targetNode->isShadowRoot() && |
| 119 isHTMLInputElement(toShadowRoot(targetNode)->host()); | 119 isHTMLInputElement(toShadowRoot(targetNode)->host()); |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace | 122 } // namespace |
| 123 | 123 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 } | 312 } |
| 313 | 313 |
| 314 static LocalFrame* subframeForTargetNode(Node* node) { | 314 static LocalFrame* subframeForTargetNode(Node* node) { |
| 315 if (!node) | 315 if (!node) |
| 316 return nullptr; | 316 return nullptr; |
| 317 | 317 |
| 318 LayoutObject* layoutObject = node->layoutObject(); | 318 LayoutObject* layoutObject = node->layoutObject(); |
| 319 if (!layoutObject || !layoutObject->isLayoutPart()) | 319 if (!layoutObject || !layoutObject->isLayoutPart()) |
| 320 return nullptr; | 320 return nullptr; |
| 321 | 321 |
| 322 Widget* widget = toLayoutPart(layoutObject)->widget(); | 322 FrameViewBase* frameViewBase = toLayoutPart(layoutObject)->widget(); |
| 323 if (!widget || !widget->isFrameView()) | 323 if (!frameViewBase || !frameViewBase->isFrameView()) |
| 324 return nullptr; | 324 return nullptr; |
| 325 | 325 |
| 326 return &toFrameView(widget)->frame(); | 326 return &toFrameView(frameViewBase)->frame(); |
| 327 } | 327 } |
| 328 | 328 |
| 329 static LocalFrame* subframeForHitTestResult( | 329 static LocalFrame* subframeForHitTestResult( |
| 330 const MouseEventWithHitTestResults& hitTestResult) { | 330 const MouseEventWithHitTestResults& hitTestResult) { |
| 331 if (!hitTestResult.isOverWidget()) | 331 if (!hitTestResult.isOverWidget()) |
| 332 return nullptr; | 332 return nullptr; |
| 333 return subframeForTargetNode(hitTestResult.innerNode()); | 333 return subframeForTargetNode(hitTestResult.innerNode()); |
| 334 } | 334 } |
| 335 | 335 |
| 336 static bool isSubmitImage(Node* node) { | 336 static bool isSubmitImage(Node* node) { |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 | 602 |
| 603 m_mouseEventManager->setMousePressNode(mev.innerNode()); | 603 m_mouseEventManager->setMousePressNode(mev.innerNode()); |
| 604 m_frame->document()->setSequentialFocusNavigationStartingPoint( | 604 m_frame->document()->setSequentialFocusNavigationStartingPoint( |
| 605 mev.innerNode()); | 605 mev.innerNode()); |
| 606 | 606 |
| 607 LocalFrame* subframe = subframeForHitTestResult(mev); | 607 LocalFrame* subframe = subframeForHitTestResult(mev); |
| 608 if (subframe) { | 608 if (subframe) { |
| 609 WebInputEventResult result = passMousePressEventToSubframe(mev, subframe); | 609 WebInputEventResult result = passMousePressEventToSubframe(mev, subframe); |
| 610 // Start capturing future events for this frame. We only do this if we | 610 // Start capturing future events for this frame. We only do this if we |
| 611 // didn't clear the m_mousePressed flag, which may happen if an AppKit | 611 // didn't clear the m_mousePressed flag, which may happen if an AppKit |
| 612 // widget entered a modal event loop. The capturing should be done only | 612 // FrameViewBase entered a modal event loop. The capturing should be done |
| 613 // when the result indicates it has been handled. See crbug.com/269917 | 613 // only when the result indicates it has been handled. See crbug.com/269917 |
| 614 m_mouseEventManager->setCapturesDragging( | 614 m_mouseEventManager->setCapturesDragging( |
| 615 subframe->eventHandler().m_mouseEventManager->capturesDragging()); | 615 subframe->eventHandler().m_mouseEventManager->capturesDragging()); |
| 616 if (m_mouseEventManager->mousePressed() && | 616 if (m_mouseEventManager->mousePressed() && |
| 617 m_mouseEventManager->capturesDragging()) { | 617 m_mouseEventManager->capturesDragging()) { |
| 618 m_capturingMouseEventsNode = mev.innerNode(); | 618 m_capturingMouseEventsNode = mev.innerNode(); |
| 619 m_eventHandlerWillResetCapturingMouseEventsNode = true; | 619 m_eventHandlerWillResetCapturingMouseEventsNode = true; |
| 620 } | 620 } |
| 621 m_mouseEventManager->invalidateClick(); | 621 m_mouseEventManager->invalidateClick(); |
| 622 return result; | 622 return result; |
| 623 } | 623 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 ->firesTouchEvents(mouseEvent.fromTouch()); | 686 ->firesTouchEvents(mouseEvent.fromTouch()); |
| 687 | 687 |
| 688 if (eventResult == WebInputEventResult::NotHandled) { | 688 if (eventResult == WebInputEventResult::NotHandled) { |
| 689 eventResult = m_mouseEventManager->handleMouseFocus(hitTestResult, | 689 eventResult = m_mouseEventManager->handleMouseFocus(hitTestResult, |
| 690 sourceCapabilities); | 690 sourceCapabilities); |
| 691 } | 691 } |
| 692 m_mouseEventManager->setCapturesDragging( | 692 m_mouseEventManager->setCapturesDragging( |
| 693 eventResult == WebInputEventResult::NotHandled || mev.scrollbar()); | 693 eventResult == WebInputEventResult::NotHandled || mev.scrollbar()); |
| 694 | 694 |
| 695 // If the hit testing originally determined the event was in a scrollbar, | 695 // If the hit testing originally determined the event was in a scrollbar, |
| 696 // refetch the MouseEventWithHitTestResults in case the scrollbar widget was | 696 // refetch the MouseEventWithHitTestResults in case the scrollbar |
| 697 // destroyed when the mouse event was handled. | 697 // FrameViewBase was destroyed when the mouse event was handled. |
| 698 if (mev.scrollbar()) { | 698 if (mev.scrollbar()) { |
| 699 const bool wasLastScrollBar = | 699 const bool wasLastScrollBar = |
| 700 mev.scrollbar() == m_lastScrollbarUnderMouse.get(); | 700 mev.scrollbar() == m_lastScrollbarUnderMouse.get(); |
| 701 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active); | 701 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active); |
| 702 mev = m_frame->document()->performMouseEventHitTest(request, documentPoint, | 702 mev = m_frame->document()->performMouseEventHitTest(request, documentPoint, |
| 703 mouseEvent); | 703 mouseEvent); |
| 704 if (wasLastScrollBar && mev.scrollbar() != m_lastScrollbarUnderMouse.get()) | 704 if (wasLastScrollBar && mev.scrollbar() != m_lastScrollbarUnderMouse.get()) |
| 705 m_lastScrollbarUnderMouse = nullptr; | 705 m_lastScrollbarUnderMouse = nullptr; |
| 706 } | 706 } |
| 707 | 707 |
| (...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2142 } | 2142 } |
| 2143 | 2143 |
| 2144 FrameHost* EventHandler::frameHost() const { | 2144 FrameHost* EventHandler::frameHost() const { |
| 2145 if (!m_frame->page()) | 2145 if (!m_frame->page()) |
| 2146 return nullptr; | 2146 return nullptr; |
| 2147 | 2147 |
| 2148 return &m_frame->page()->frameHost(); | 2148 return &m_frame->page()->frameHost(); |
| 2149 } | 2149 } |
| 2150 | 2150 |
| 2151 } // namespace blink | 2151 } // namespace blink |
| OLD | NEW |