| 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 1990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3310 } | 3298 } |
| 3311 } | 3299 } |
| 3312 } | 3300 } |
| 3313 | 3301 |
| 3314 void EventHandler::setFrameWasScrolledByUser() | 3302 void EventHandler::setFrameWasScrolledByUser() |
| 3315 { | 3303 { |
| 3316 if (FrameView* view = m_frame->view()) | 3304 if (FrameView* view = m_frame->view()) |
| 3317 view->setWasScrolledByUser(true); | 3305 view->setWasScrolledByUser(true); |
| 3318 } | 3306 } |
| 3319 | 3307 |
| 3320 bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults&
mev, Scrollbar* scrollbar) | 3308 bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults&
mev) |
| 3321 { | 3309 { |
| 3310 // First try to use the frame scrollbar. |
| 3311 FrameView* view = m_frame->view(); |
| 3312 Scrollbar* scrollbar = view ? view->scrollbarAtPoint(mev.event().position())
: 0; |
| 3313 |
| 3314 // Then try the scrollbar in the hit test. |
| 3315 if (!scrollbar) |
| 3316 scrollbar = mev.scrollbar(); |
| 3317 |
| 3318 updateLastScrollbarUnderMouse(scrollbar, true); |
| 3319 |
| 3322 if (!scrollbar || !scrollbar->enabled()) | 3320 if (!scrollbar || !scrollbar->enabled()) |
| 3323 return false; | 3321 return false; |
| 3324 setFrameWasScrolledByUser(); | 3322 setFrameWasScrolledByUser(); |
| 3325 scrollbar->mouseDown(mev.event()); | 3323 scrollbar->mouseDown(mev.event()); |
| 3326 return true; | 3324 return true; |
| 3327 } | 3325 } |
| 3328 | 3326 |
| 3329 // If scrollbar (under mouse) is different from last, send a mouse exited. Set | 3327 // If scrollbar (under mouse) is different from last, send a mouse exited. Set |
| 3330 // last to scrollbar if setLast is true; else set last to 0. | 3328 // last to scrollbar if setLast is true; else set last to 0. |
| 3331 void EventHandler::updateLastScrollbarUnderMouse(Scrollbar* scrollbar, bool setL
ast) | 3329 void EventHandler::updateLastScrollbarUnderMouse(Scrollbar* scrollbar, bool setL
ast) |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3731 unsigned EventHandler::accessKeyModifiers() | 3729 unsigned EventHandler::accessKeyModifiers() |
| 3732 { | 3730 { |
| 3733 #if OS(MACOSX) | 3731 #if OS(MACOSX) |
| 3734 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3732 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 3735 #else | 3733 #else |
| 3736 return PlatformEvent::AltKey; | 3734 return PlatformEvent::AltKey; |
| 3737 #endif | 3735 #endif |
| 3738 } | 3736 } |
| 3739 | 3737 |
| 3740 } // namespace WebCore | 3738 } // namespace WebCore |
| OLD | NEW |