OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1425 HitTestRequest request(hitType); | 1425 HitTestRequest request(hitType); |
1426 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); | 1426 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); |
1427 if (hoveredNode) | 1427 if (hoveredNode) |
1428 *hoveredNode = mev.hitTestResult(); | 1428 *hoveredNode = mev.hitTestResult(); |
1429 | 1429 |
1430 Scrollbar* scrollbar = 0; | 1430 Scrollbar* scrollbar = 0; |
1431 | 1431 |
1432 if (m_resizeScrollableArea && m_resizeScrollableArea->inResizeMode()) | 1432 if (m_resizeScrollableArea && m_resizeScrollableArea->inResizeMode()) |
1433 m_resizeScrollableArea->resize(mouseEvent, m_offsetFromResizeCorner); | 1433 m_resizeScrollableArea->resize(mouseEvent, m_offsetFromResizeCorner); |
1434 else { | 1434 else { |
1435 if (FrameView* view = m_frame->view()) | |
1436 scrollbar = view->scrollbarAtPoint(mouseEvent.position()); | |
1437 | |
1438 if (!scrollbar) | 1435 if (!scrollbar) |
1439 scrollbar = mev.scrollbar(); | 1436 scrollbar = mev.scrollbar(); |
1440 | 1437 |
1441 updateLastScrollbarUnderMouse(scrollbar, !m_mousePressed); | 1438 updateLastScrollbarUnderMouse(scrollbar, !m_mousePressed); |
1442 if (onlyUpdateScrollbars) | 1439 if (onlyUpdateScrollbars) |
1443 return true; | 1440 return true; |
1444 } | 1441 } |
1445 | 1442 |
1446 bool swallowEvent = false; | 1443 bool swallowEvent = false; |
1447 RefPtr<LocalFrame> newSubframe = m_capturingMouseEventsNode.get() ? subframe
ForTargetNode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev); | 1444 RefPtr<LocalFrame> newSubframe = m_capturingMouseEventsNode.get() ? subframe
ForTargetNode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev); |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1869 { | 1866 { |
1870 updateMouseEventTargetNode(targetNode, mouseEvent, setUnder); | 1867 updateMouseEventTargetNode(targetNode, mouseEvent, setUnder); |
1871 return !m_nodeUnderMouse || m_nodeUnderMouse->dispatchMouseEvent(mouseEvent,
eventType, clickCount); | 1868 return !m_nodeUnderMouse || m_nodeUnderMouse->dispatchMouseEvent(mouseEvent,
eventType, clickCount); |
1872 } | 1869 } |
1873 | 1870 |
1874 // The return value means 'swallow event' (was handled), as for other handle* fu
nctions. | 1871 // The return value means 'swallow event' (was handled), as for other handle* fu
nctions. |
1875 bool EventHandler::handleMouseFocus(const PlatformMouseEvent& mouseEvent) | 1872 bool EventHandler::handleMouseFocus(const PlatformMouseEvent& mouseEvent) |
1876 { | 1873 { |
1877 // If clicking on a frame scrollbar, do not mess up with content focus. | 1874 // If clicking on a frame scrollbar, do not mess up with content focus. |
1878 if (FrameView* view = m_frame->view()) { | 1875 if (FrameView* view = m_frame->view()) { |
1879 if (view->scrollbarAtPoint(mouseEvent.position())) | 1876 if (view->scrollbarAtWindowPoint(mouseEvent.position())) |
1880 return false; | 1877 return false; |
1881 } | 1878 } |
1882 | 1879 |
1883 // The layout needs to be up to date to determine if an element is focusable
. | 1880 // The layout needs to be up to date to determine if an element is focusable
. |
1884 m_frame->document()->updateLayoutIgnorePendingStylesheets(); | 1881 m_frame->document()->updateLayoutIgnorePendingStylesheets(); |
1885 | 1882 |
1886 Element* element = 0; | 1883 Element* element = 0; |
1887 if (m_nodeUnderMouse) | 1884 if (m_nodeUnderMouse) |
1888 element = m_nodeUnderMouse->isElementNode() ? toElement(m_nodeUnderMouse
) : m_nodeUnderMouse->parentOrShadowHostElement(); | 1885 element = m_nodeUnderMouse->isElementNode() ? toElement(m_nodeUnderMouse
) : m_nodeUnderMouse->parentOrShadowHostElement(); |
1889 for (; element; element = element->parentOrShadowHostElement()) { | 1886 for (; element; element = element->parentOrShadowHostElement()) { |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2151 HitTestResult result(viewPoint); | 2148 HitTestResult result(viewPoint); |
2152 document->renderView()->hitTest(request, result); | 2149 document->renderView()->hitTest(request, result); |
2153 | 2150 |
2154 eventTarget = result.innerNode(); | 2151 eventTarget = result.innerNode(); |
2155 | 2152 |
2156 m_lastGestureScrollOverWidget = result.isOverWidget(); | 2153 m_lastGestureScrollOverWidget = result.isOverWidget(); |
2157 m_scrollGestureHandlingNode = eventTarget; | 2154 m_scrollGestureHandlingNode = eventTarget; |
2158 m_previousGestureScrolledNode = nullptr; | 2155 m_previousGestureScrolledNode = nullptr; |
2159 | 2156 |
2160 if (!scrollbar) | 2157 if (!scrollbar) |
2161 scrollbar = view->scrollbarAtPoint(gestureEvent.position()); | |
2162 if (!scrollbar) | |
2163 scrollbar = result.scrollbar(); | 2158 scrollbar = result.scrollbar(); |
2164 } | 2159 } |
2165 | 2160 |
2166 if (scrollbar) { | 2161 if (scrollbar) { |
2167 bool eventSwallowed = scrollbar->gestureEvent(gestureEvent); | 2162 bool eventSwallowed = scrollbar->gestureEvent(gestureEvent); |
2168 if (gestureEvent.type() == PlatformEvent::GestureScrollEnd | 2163 if (gestureEvent.type() == PlatformEvent::GestureScrollEnd |
2169 || gestureEvent.type() == PlatformEvent::GestureFlingStart | 2164 || gestureEvent.type() == PlatformEvent::GestureFlingStart |
2170 || !eventSwallowed) { | 2165 || !eventSwallowed) { |
2171 m_scrollbarHandlingScrollGesture = nullptr; | 2166 m_scrollbarHandlingScrollGesture = nullptr; |
2172 } | 2167 } |
(...skipping 25 matching lines...) Expand all Loading... |
2198 default: | 2193 default: |
2199 ASSERT_NOT_REACHED(); | 2194 ASSERT_NOT_REACHED(); |
2200 return false; | 2195 return false; |
2201 } | 2196 } |
2202 } | 2197 } |
2203 | 2198 |
2204 bool EventHandler::handleGestureTap(const GestureEventWithHitTestResults& target
edEvent) | 2199 bool EventHandler::handleGestureTap(const GestureEventWithHitTestResults& target
edEvent) |
2205 { | 2200 { |
2206 RefPtr<FrameView> protector(m_frame->view()); | 2201 RefPtr<FrameView> protector(m_frame->view()); |
2207 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); | 2202 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); |
| 2203 HitTestRequest::HitTestRequestType hitType = getHitTypeForGestureType(gestur
eEvent.type()); |
2208 | 2204 |
2209 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); | 2205 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); |
2210 | 2206 |
2211 unsigned modifierFlags = 0; | 2207 unsigned modifierFlags = 0; |
2212 if (gestureEvent.altKey()) | 2208 if (gestureEvent.altKey()) |
2213 modifierFlags |= PlatformEvent::AltKey; | 2209 modifierFlags |= PlatformEvent::AltKey; |
2214 if (gestureEvent.ctrlKey()) | 2210 if (gestureEvent.ctrlKey()) |
2215 modifierFlags |= PlatformEvent::CtrlKey; | 2211 modifierFlags |= PlatformEvent::CtrlKey; |
2216 if (gestureEvent.metaKey()) | 2212 if (gestureEvent.metaKey()) |
2217 modifierFlags |= PlatformEvent::MetaKey; | 2213 modifierFlags |= PlatformEvent::MetaKey; |
(...skipping 11 matching lines...) Expand all Loading... |
2229 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0, | 2225 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0, |
2230 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); | 2226 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); |
2231 dispatchMouseEvent(EventTypeNames::mousemove, currentHitTest.innerNode(), 0,
fakeMouseMove, true); | 2227 dispatchMouseEvent(EventTypeNames::mousemove, currentHitTest.innerNode(), 0,
fakeMouseMove, true); |
2232 | 2228 |
2233 // Do a new hit-test in case the mousemove event changed the DOM. | 2229 // Do a new hit-test in case the mousemove event changed the DOM. |
2234 // Note that if the original hit test wasn't over an element (eg. was over a
scrollbar) we | 2230 // Note that if the original hit test wasn't over an element (eg. was over a
scrollbar) we |
2235 // don't want to re-hit-test because it may be in the wrong frame (and there
's no way the page | 2231 // don't want to re-hit-test because it may be in the wrong frame (and there
's no way the page |
2236 // could have seen the event anyway). | 2232 // could have seen the event anyway). |
2237 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.
com/398920 | 2233 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.
com/398920 |
2238 if (currentHitTest.innerNode()) | 2234 if (currentHitTest.innerNode()) |
2239 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, HitTestReq
uest::ReadOnly); | 2235 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType); |
2240 m_clickNode = currentHitTest.innerNode(); | 2236 m_clickNode = currentHitTest.innerNode(); |
2241 if (m_clickNode && m_clickNode->isTextNode()) | 2237 if (m_clickNode && m_clickNode->isTextNode()) |
2242 m_clickNode = NodeRenderingTraversal::parent(m_clickNode.get()); | 2238 m_clickNode = NodeRenderingTraversal::parent(m_clickNode.get()); |
2243 | 2239 |
2244 PlatformMouseEvent fakeMouseDown(adjustedPoint, gestureEvent.globalPosition(
), | 2240 PlatformMouseEvent fakeMouseDown(adjustedPoint, gestureEvent.globalPosition(
), |
2245 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(), | 2241 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(), |
2246 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); | 2242 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); |
2247 bool swallowMouseDownEvent = !dispatchMouseEvent(EventTypeNames::mousedown,
currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown, true); | 2243 bool swallowMouseDownEvent = !dispatchMouseEvent(EventTypeNames::mousedown,
currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown, true); |
2248 if (!swallowMouseDownEvent) | 2244 if (!swallowMouseDownEvent) |
2249 swallowMouseDownEvent = handleMouseFocus(fakeMouseDown); | 2245 swallowMouseDownEvent = handleMouseFocus(fakeMouseDown); |
2250 if (!swallowMouseDownEvent) | 2246 if (!swallowMouseDownEvent) |
2251 swallowMouseDownEvent = handleMousePressEvent(MouseEventWithHitTestResul
ts(fakeMouseDown, currentHitTest)); | 2247 swallowMouseDownEvent = handleMousePressEvent(MouseEventWithHitTestResul
ts(fakeMouseDown, currentHitTest)); |
2252 | 2248 |
2253 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.
com/398920 | 2249 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.
com/398920 |
2254 if (currentHitTest.innerNode()) | 2250 if (currentHitTest.innerNode()) |
2255 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, HitTestReq
uest::ReadOnly); | 2251 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType); |
2256 PlatformMouseEvent fakeMouseUp(adjustedPoint, gestureEvent.globalPosition(), | 2252 PlatformMouseEvent fakeMouseUp(adjustedPoint, gestureEvent.globalPosition(), |
2257 LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(), | 2253 LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(), |
2258 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); | 2254 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); |
2259 bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, curr
entHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseUp, false); | 2255 bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, curr
entHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseUp, false); |
2260 | 2256 |
2261 bool swallowClickEvent = false; | 2257 bool swallowClickEvent = false; |
2262 if (m_clickNode) { | 2258 if (m_clickNode) { |
2263 if (currentHitTest.innerNode()) { | 2259 if (currentHitTest.innerNode()) { |
2264 Node* clickTargetNode = currentHitTest.innerNode()->commonAncestor(*
m_clickNode, parentForClickEvent); | 2260 Node* clickTargetNode = currentHitTest.innerNode()->commonAncestor(*
m_clickNode, parentForClickEvent); |
2265 swallowClickEvent = !dispatchMouseEvent(EventTypeNames::click, click
TargetNode, gestureEvent.tapCount(), fakeMouseUp, true); | 2261 swallowClickEvent = !dispatchMouseEvent(EventTypeNames::click, click
TargetNode, gestureEvent.tapCount(), fakeMouseUp, true); |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2577 // we don't yet apply hover/active state here because we need to resolve tou
ch adjustment | 2573 // we don't yet apply hover/active state here because we need to resolve tou
ch adjustment |
2578 // first so that we apply hover/active it to the final adjusted node. | 2574 // first so that we apply hover/active it to the final adjusted node. |
2579 IntPoint hitTestPoint = m_frame->view()->windowToContents(gestureEvent.posit
ion()); | 2575 IntPoint hitTestPoint = m_frame->view()->windowToContents(gestureEvent.posit
ion()); |
2580 LayoutSize padding; | 2576 LayoutSize padding; |
2581 if (shouldApplyTouchAdjustment(gestureEvent)) { | 2577 if (shouldApplyTouchAdjustment(gestureEvent)) { |
2582 padding = gestureEvent.area(); | 2578 padding = gestureEvent.area(); |
2583 padding.scale(1.f / 2); | 2579 padding.scale(1.f / 2); |
2584 } | 2580 } |
2585 HitTestResult hitTestResult = hitTestResultAtPoint(hitTestPoint, hitType | H
itTestRequest::ReadOnly, padding); | 2581 HitTestResult hitTestResult = hitTestResultAtPoint(hitTestPoint, hitType | H
itTestRequest::ReadOnly, padding); |
2586 | 2582 |
2587 // Hit-test the main frame scrollbars (in addition to the child-frame and Re
nderLayer | |
2588 // scroll bars checked by the hit-test code. | |
2589 if (!hitTestResult.scrollbar()) { | |
2590 if (FrameView* view = m_frame->view()) { | |
2591 hitTestResult.setScrollbar(view->scrollbarAtPoint(gestureEvent.posit
ion())); | |
2592 } | |
2593 } | |
2594 | |
2595 // Adjust the location of the gesture to the most likely nearby node, as app
ropriate for the | 2583 // Adjust the location of the gesture to the most likely nearby node, as app
ropriate for the |
2596 // type of event. | 2584 // type of event. |
2597 PlatformGestureEvent adjustedEvent = gestureEvent; | 2585 PlatformGestureEvent adjustedEvent = gestureEvent; |
2598 applyTouchAdjustment(&adjustedEvent, &hitTestResult); | 2586 applyTouchAdjustment(&adjustedEvent, &hitTestResult); |
2599 | 2587 |
2600 // Do a new hit-test at the (adjusted) gesture co-ordinates. This is necessa
ry because | 2588 // Do a new hit-test at the (adjusted) gesture co-ordinates. This is necessa
ry because |
2601 // rect-based hit testing and touch adjustment sometimes return a different
node than | 2589 // rect-based hit testing and touch adjustment sometimes return a different
node than |
2602 // what a point-based hit test would return for the same point. | 2590 // what a point-based hit test would return for the same point. |
2603 // FIXME: Fix touch adjustment to avoid the need for a redundant hit test. h
ttp://crbug.com/398914 | 2591 // FIXME: Fix touch adjustment to avoid the need for a redundant hit test. h
ttp://crbug.com/398914 |
2604 if (shouldApplyTouchAdjustment(gestureEvent)) { | 2592 if (shouldApplyTouchAdjustment(gestureEvent)) { |
2605 LocalFrame* hitFrame = hitTestResult.innerNodeFrame(); | 2593 LocalFrame* hitFrame = hitTestResult.innerNodeFrame(); |
2606 if (!hitFrame) | 2594 if (!hitFrame) |
2607 hitFrame = m_frame; | 2595 hitFrame = m_frame; |
2608 hitTestResult = hitTestResultInFrame(hitFrame, hitFrame->view()->windowT
oContents(adjustedEvent.position()), hitType | HitTestRequest::ReadOnly); | 2596 hitTestResult = hitTestResultInFrame(hitFrame, hitFrame->view()->windowT
oContents(adjustedEvent.position()), hitType | HitTestRequest::ReadOnly); |
2609 // FIXME: HitTest entry points should really check for main frame scroll
bars themselves. | |
2610 if (!hitTestResult.scrollbar()) { | |
2611 if (FrameView* view = m_frame->view()) { | |
2612 hitTestResult.setScrollbar(view->scrollbarAtPoint(gestureEvent.p
osition())); | |
2613 } | |
2614 } | |
2615 } | 2597 } |
2616 | 2598 |
2617 // If we did a rect-based hit test it must be resolved to the best single no
de by now to | 2599 // If we did a rect-based hit test it must be resolved to the best single no
de by now to |
2618 // ensure consumers don't accidentally use one of the other candidates. | 2600 // ensure consumers don't accidentally use one of the other candidates. |
2619 ASSERT(!hitTestResult.isRectBasedTest()); | 2601 ASSERT(!hitTestResult.isRectBasedTest()); |
2620 | 2602 |
2621 // Now apply hover/active state to the final target. | 2603 // Now apply hover/active state to the final target. |
2622 // FIXME: This is supposed to send mouseenter/mouseleave events, but doesn't
because we | 2604 // FIXME: This is supposed to send mouseenter/mouseleave events, but doesn't
because we |
2623 // aren't passing a PlatformMouseEvent. | 2605 // aren't passing a PlatformMouseEvent. |
2624 HitTestRequest request(hitType | HitTestRequest::AllowChildFrameContent); | 2606 HitTestRequest request(hitType | HitTestRequest::AllowChildFrameContent); |
2625 if (!request.readOnly()) | 2607 if (!request.readOnly()) |
2626 m_frame->document()->updateHoverActiveState(request, hitTestResult.inner
Element()); | 2608 m_frame->document()->updateHoverActiveState(request, hitTestResult.inner
Element()); |
2627 | 2609 |
2628 if (shouldKeepActiveForMinInterval) { | 2610 if (shouldKeepActiveForMinInterval) { |
2629 m_lastDeferredTapElement = hitTestResult.innerElement(); | 2611 m_lastDeferredTapElement = hitTestResult.innerElement(); |
2630 m_activeIntervalTimer.startOneShot(minimumActiveInterval - activeInterva
l, FROM_HERE); | 2612 m_activeIntervalTimer.startOneShot(minimumActiveInterval - activeInterva
l, FROM_HERE); |
2631 } | 2613 } |
2632 | 2614 |
2633 return GestureEventWithHitTestResults(adjustedEvent, hitTestResult); | 2615 return GestureEventWithHitTestResults(adjustedEvent, hitTestResult); |
2634 } | 2616 } |
2635 | 2617 |
2636 HitTestRequest::HitTestRequestType EventHandler::getHitTypeForGestureType(Platfo
rmEvent::Type type) | 2618 HitTestRequest::HitTestRequestType EventHandler::getHitTypeForGestureType(Platfo
rmEvent::Type type) |
2637 { | 2619 { |
2638 HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent | Hi
tTestRequest::AllowFrameScrollbars; | 2620 HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent; |
2639 switch (type) { | 2621 switch (type) { |
2640 case PlatformEvent::GestureShowPress: | 2622 case PlatformEvent::GestureShowPress: |
2641 case PlatformEvent::GestureTapUnconfirmed: | 2623 case PlatformEvent::GestureTapUnconfirmed: |
2642 return hitType | HitTestRequest::Active; | 2624 return hitType | HitTestRequest::Active; |
2643 case PlatformEvent::GestureTapDownCancel: | 2625 case PlatformEvent::GestureTapDownCancel: |
2644 // A TapDownCancel received when no element is active shouldn't really b
e changing hover state. | 2626 // A TapDownCancel received when no element is active shouldn't really b
e changing hover state. |
2645 if (!m_frame->document()->activeHoverElement()) | 2627 if (!m_frame->document()->activeHoverElement()) |
2646 hitType |= HitTestRequest::ReadOnly; | 2628 hitType |= HitTestRequest::ReadOnly; |
2647 return hitType | HitTestRequest::Release; | 2629 return hitType | HitTestRequest::Release; |
2648 case PlatformEvent::GestureTap: | 2630 case PlatformEvent::GestureTap: |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3452 } | 3434 } |
3453 | 3435 |
3454 void EventHandler::setFrameWasScrolledByUser() | 3436 void EventHandler::setFrameWasScrolledByUser() |
3455 { | 3437 { |
3456 if (FrameView* view = m_frame->view()) | 3438 if (FrameView* view = m_frame->view()) |
3457 view->setWasScrolledByUser(true); | 3439 view->setWasScrolledByUser(true); |
3458 } | 3440 } |
3459 | 3441 |
3460 bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults&
mev) | 3442 bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults&
mev) |
3461 { | 3443 { |
3462 // First try to use the frame scrollbar. | 3444 Scrollbar* scrollbar = mev.scrollbar(); |
3463 FrameView* view = m_frame->view(); | |
3464 Scrollbar* scrollbar = view ? view->scrollbarAtPoint(mev.event().position())
: 0; | |
3465 | |
3466 // Then try the scrollbar in the hit test. | |
3467 if (!scrollbar) | |
3468 scrollbar = mev.scrollbar(); | |
3469 | |
3470 updateLastScrollbarUnderMouse(scrollbar, true); | 3445 updateLastScrollbarUnderMouse(scrollbar, true); |
3471 | 3446 |
3472 if (!scrollbar || !scrollbar->enabled()) | 3447 if (!scrollbar || !scrollbar->enabled()) |
3473 return false; | 3448 return false; |
3474 setFrameWasScrolledByUser(); | 3449 setFrameWasScrolledByUser(); |
3475 scrollbar->mouseDown(mev.event()); | 3450 scrollbar->mouseDown(mev.event()); |
3476 return true; | 3451 return true; |
3477 } | 3452 } |
3478 | 3453 |
3479 // If scrollbar (under mouse) is different from last, send a mouse exited. Set | 3454 // If scrollbar (under mouse) is different from last, send a mouse exited. Set |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3512 } | 3487 } |
3513 } | 3488 } |
3514 | 3489 |
3515 HitTestResult EventHandler::hitTestResultInFrame(LocalFrame* frame, const Layout
Point& point, HitTestRequest::HitTestRequestType hitType) | 3490 HitTestResult EventHandler::hitTestResultInFrame(LocalFrame* frame, const Layout
Point& point, HitTestRequest::HitTestRequestType hitType) |
3516 { | 3491 { |
3517 HitTestResult result(point); | 3492 HitTestResult result(point); |
3518 | 3493 |
3519 if (!frame || !frame->contentRenderer()) | 3494 if (!frame || !frame->contentRenderer()) |
3520 return result; | 3495 return result; |
3521 if (frame->view()) { | 3496 if (frame->view()) { |
3522 IntRect rect = frame->view()->visibleContentRect(); | 3497 IntRect rect = frame->view()->visibleContentRect(IncludeScrollbars); |
3523 if (!rect.contains(roundedIntPoint(point))) | 3498 if (!rect.contains(roundedIntPoint(point))) |
3524 return result; | 3499 return result; |
3525 } | 3500 } |
3526 frame->contentRenderer()->hitTest(HitTestRequest(hitType), result); | 3501 frame->contentRenderer()->hitTest(HitTestRequest(hitType), result); |
3527 return result; | 3502 return result; |
3528 } | 3503 } |
3529 | 3504 |
3530 bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) | 3505 bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) |
3531 { | 3506 { |
3532 TRACE_EVENT0("blink", "EventHandler::handleTouchEvent"); | 3507 TRACE_EVENT0("blink", "EventHandler::handleTouchEvent"); |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3885 unsigned EventHandler::accessKeyModifiers() | 3860 unsigned EventHandler::accessKeyModifiers() |
3886 { | 3861 { |
3887 #if OS(MACOSX) | 3862 #if OS(MACOSX) |
3888 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3863 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
3889 #else | 3864 #else |
3890 return PlatformEvent::AltKey; | 3865 return PlatformEvent::AltKey; |
3891 #endif | 3866 #endif |
3892 } | 3867 } |
3893 | 3868 |
3894 } // namespace blink | 3869 } // namespace blink |
OLD | NEW |