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 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 if (mev.scrollbar()) { | 1280 if (mev.scrollbar()) { |
1281 const bool wasLastScrollBar = mev.scrollbar() == m_lastScrollbarUnderMou
se.get(); | 1281 const bool wasLastScrollBar = mev.scrollbar() == m_lastScrollbarUnderMou
se.get(); |
1282 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active
| HitTestRequest::ConfusingAndOftenMisusedDisallowShadowContent); | 1282 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active
| HitTestRequest::ConfusingAndOftenMisusedDisallowShadowContent); |
1283 mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mou
seEvent); | 1283 mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mou
seEvent); |
1284 if (wasLastScrollBar && mev.scrollbar() != m_lastScrollbarUnderMouse.get
()) | 1284 if (wasLastScrollBar && mev.scrollbar() != m_lastScrollbarUnderMouse.get
()) |
1285 m_lastScrollbarUnderMouse = nullptr; | 1285 m_lastScrollbarUnderMouse = nullptr; |
1286 } | 1286 } |
1287 | 1287 |
1288 if (swallowEvent) { | 1288 if (swallowEvent) { |
1289 // scrollbars should get events anyway, even disabled controls might be
scrollable | 1289 // scrollbars should get events anyway, even disabled controls might be
scrollable |
1290 Scrollbar* scrollbar = mev.scrollbar(); | 1290 passMousePressEventToScrollbar(mev); |
1291 | |
1292 updateLastScrollbarUnderMouse(scrollbar, true); | |
1293 | |
1294 if (scrollbar) | |
1295 passMousePressEventToScrollbar(mev, scrollbar); | |
1296 } else { | 1291 } else { |
1297 if (shouldRefetchEventTarget(mev)) { | 1292 if (shouldRefetchEventTarget(mev)) { |
1298 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Ac
tive | HitTestRequest::ConfusingAndOftenMisusedDisallowShadowContent); | 1293 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Ac
tive | HitTestRequest::ConfusingAndOftenMisusedDisallowShadowContent); |
1299 mev = m_frame->document()->prepareMouseEvent(request, documentPoint,
mouseEvent); | 1294 mev = m_frame->document()->prepareMouseEvent(request, documentPoint,
mouseEvent); |
1300 } | 1295 } |
1301 | 1296 |
1302 FrameView* view = m_frame->view(); | 1297 if (passMousePressEventToScrollbar(mev)) |
1303 Scrollbar* scrollbar = view ? view->scrollbarAtPoint(mouseEvent.position
()) : 0; | |
1304 if (!scrollbar) | |
1305 scrollbar = mev.scrollbar(); | |
1306 | |
1307 updateLastScrollbarUnderMouse(scrollbar, true); | |
1308 | |
1309 if (scrollbar && passMousePressEventToScrollbar(mev, scrollbar)) | |
1310 swallowEvent = true; | 1298 swallowEvent = true; |
1311 else | 1299 else |
1312 swallowEvent = handleMousePressEvent(mev); | 1300 swallowEvent = handleMousePressEvent(mev); |
1313 } | 1301 } |
1314 | 1302 |
1315 return swallowEvent; | 1303 return swallowEvent; |
1316 } | 1304 } |
1317 | 1305 |
1318 static RenderLayer* layerForNode(Node* node) | 1306 static RenderLayer* layerForNode(Node* node) |
1319 { | 1307 { |
(...skipping 1992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3312 } | 3300 } |
3313 } | 3301 } |
3314 } | 3302 } |
3315 | 3303 |
3316 void EventHandler::setFrameWasScrolledByUser() | 3304 void EventHandler::setFrameWasScrolledByUser() |
3317 { | 3305 { |
3318 if (FrameView* view = m_frame->view()) | 3306 if (FrameView* view = m_frame->view()) |
3319 view->setWasScrolledByUser(true); | 3307 view->setWasScrolledByUser(true); |
3320 } | 3308 } |
3321 | 3309 |
3322 bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults&
mev, Scrollbar* scrollbar) | 3310 bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults&
mev) |
3323 { | 3311 { |
| 3312 // First try to use the frame scrollbar. |
| 3313 FrameView* view = m_frame->view(); |
| 3314 Scrollbar* scrollbar = view ? view->scrollbarAtPoint(mev.event().position())
: 0; |
| 3315 |
| 3316 // Then try the scrollbar in the hit test. |
| 3317 if (!scrollbar) |
| 3318 scrollbar = mev.scrollbar(); |
| 3319 |
| 3320 updateLastScrollbarUnderMouse(scrollbar, true); |
| 3321 |
3324 if (!scrollbar || !scrollbar->enabled()) | 3322 if (!scrollbar || !scrollbar->enabled()) |
3325 return false; | 3323 return false; |
3326 setFrameWasScrolledByUser(); | 3324 setFrameWasScrolledByUser(); |
3327 scrollbar->mouseDown(mev.event()); | 3325 scrollbar->mouseDown(mev.event()); |
3328 return true; | 3326 return true; |
3329 } | 3327 } |
3330 | 3328 |
3331 // If scrollbar (under mouse) is different from last, send a mouse exited. Set | 3329 // If scrollbar (under mouse) is different from last, send a mouse exited. Set |
3332 // last to scrollbar if setLast is true; else set last to 0. | 3330 // last to scrollbar if setLast is true; else set last to 0. |
3333 void EventHandler::updateLastScrollbarUnderMouse(Scrollbar* scrollbar, bool setL
ast) | 3331 void EventHandler::updateLastScrollbarUnderMouse(Scrollbar* scrollbar, bool setL
ast) |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3733 unsigned EventHandler::accessKeyModifiers() | 3731 unsigned EventHandler::accessKeyModifiers() |
3734 { | 3732 { |
3735 #if OS(MACOSX) | 3733 #if OS(MACOSX) |
3736 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3734 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
3737 #else | 3735 #else |
3738 return PlatformEvent::AltKey; | 3736 return PlatformEvent::AltKey; |
3739 #endif | 3737 #endif |
3740 } | 3738 } |
3741 | 3739 |
3742 } // namespace WebCore | 3740 } // namespace WebCore |
OLD | NEW |