OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 stopAutoscrollTimer(); | 618 stopAutoscrollTimer(); |
619 return; | 619 return; |
620 } | 620 } |
621 #if ENABLE(PAN_SCROLLING) | 621 #if ENABLE(PAN_SCROLLING) |
622 setPanScrollCursor(); | 622 setPanScrollCursor(); |
623 toRenderBox(r)->panScroll(m_panScrollStartPos); | 623 toRenderBox(r)->panScroll(m_panScrollStartPos); |
624 #endif | 624 #endif |
625 } | 625 } |
626 } | 626 } |
627 | 627 |
| 628 #if ENABLE(PAN_SCROLLING) |
628 void EventHandler::setPanScrollCursor() | 629 void EventHandler::setPanScrollCursor() |
629 { | 630 { |
630 // At the original click location we draw a 4 arrowed icon. Over this icon t
here won't be any scroll | 631 // At the original click location we draw a 4 arrowed icon. Over this icon t
here won't be any scroll |
631 // So we don't want to change the cursor over this area | 632 // So we don't want to change the cursor over this area |
632 const int noScrollRadius = 9; | 633 const int noScrollRadius = 9; |
633 bool east = m_panScrollStartPos.x() < (m_currentMousePosition.x() - noScroll
Radius); | 634 bool east = m_panScrollStartPos.x() < (m_currentMousePosition.x() - noScroll
Radius); |
634 bool west = m_panScrollStartPos.x() > (m_currentMousePosition.x() + noScroll
Radius); | 635 bool west = m_panScrollStartPos.x() > (m_currentMousePosition.x() + noScroll
Radius); |
635 bool north = m_panScrollStartPos.y() > (m_currentMousePosition.y() + noScrol
lRadius); | 636 bool north = m_panScrollStartPos.y() > (m_currentMousePosition.y() + noScrol
lRadius); |
636 bool south = m_panScrollStartPos.y() < (m_currentMousePosition.y() - noScrol
lRadius); | 637 bool south = m_panScrollStartPos.y() < (m_currentMousePosition.y() - noScrol
lRadius); |
637 | 638 |
(...skipping 11 matching lines...) Expand all Loading... |
649 m_frame->view()->setCursor(southWestPanningCursor()); | 650 m_frame->view()->setCursor(southWestPanningCursor()); |
650 else | 651 else |
651 m_frame->view()->setCursor(southPanningCursor()); | 652 m_frame->view()->setCursor(southPanningCursor()); |
652 } else if (east) | 653 } else if (east) |
653 m_frame->view()->setCursor(eastPanningCursor()); | 654 m_frame->view()->setCursor(eastPanningCursor()); |
654 else if (west) | 655 else if (west) |
655 m_frame->view()->setCursor(westPanningCursor()); | 656 m_frame->view()->setCursor(westPanningCursor()); |
656 else | 657 else |
657 m_frame->view()->setCursor(middlePanningCursor()); | 658 m_frame->view()->setCursor(middlePanningCursor()); |
658 } | 659 } |
| 660 #endif // ENABLE(PAN_SCROLLING) |
659 | 661 |
660 RenderObject* EventHandler::autoscrollRenderer() const | 662 RenderObject* EventHandler::autoscrollRenderer() const |
661 { | 663 { |
662 return m_autoscrollRenderer; | 664 return m_autoscrollRenderer; |
663 } | 665 } |
664 | 666 |
665 void EventHandler::updateAutoscrollRenderer() | 667 void EventHandler::updateAutoscrollRenderer() |
666 { | 668 { |
667 if (!m_autoscrollRenderer) | 669 if (!m_autoscrollRenderer) |
668 return; | 670 return; |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1565 while (renderer) { | 1567 while (renderer) { |
1566 node = renderer->element(); | 1568 node = renderer->element(); |
1567 if (node && node->isFocusable()) { | 1569 if (node && node->isFocusable()) { |
1568 // To fix <rdar://problem/4895428> Can't drag selected ToDo, we
don't focus a | 1570 // To fix <rdar://problem/4895428> Can't drag selected ToDo, we
don't focus a |
1569 // node on mouse down if it's selected and inside a focused node
. It will be | 1571 // node on mouse down if it's selected and inside a focused node
. It will be |
1570 // focused if the user does a mouseup over it, however, because
the mouseup | 1572 // focused if the user does a mouseup over it, however, because
the mouseup |
1571 // will set a selection inside it, which will call setFocuseNode
IfNeeded. | 1573 // will set a selection inside it, which will call setFocuseNode
IfNeeded. |
1572 ExceptionCode ec = 0; | 1574 ExceptionCode ec = 0; |
1573 Node* n = node->isShadowNode() ? node->shadowParentNode() : node
; | 1575 Node* n = node->isShadowNode() ? node->shadowParentNode() : node
; |
1574 if (m_frame->selection()->isRange() && | 1576 if (m_frame->selection()->isRange() && |
1575 m_frame->selection()->toRange()->compareNode(n, ec) == Range
::NODE_INSIDE && | 1577 m_frame->selection()->toNormalizedRange()->compareNode(n, ec
) == Range::NODE_INSIDE && |
1576 n->isDescendantOf(m_frame->document()->focusedNode())) | 1578 n->isDescendantOf(m_frame->document()->focusedNode())) |
1577 return false; | 1579 return false; |
1578 | 1580 |
1579 break; | 1581 break; |
1580 } | 1582 } |
1581 | 1583 |
1582 renderer = renderer->parent(); | 1584 renderer = renderer->parent(); |
1583 } | 1585 } |
1584 // If focus shift is blocked, we eat the event. Note we should never cl
ear swallowEvent | 1586 // If focus shift is blocked, we eat the event. Note we should never cl
ear swallowEvent |
1585 // if the page already set it (e.g., by canceling default behavior). | 1587 // if the page already set it (e.g., by canceling default behavior). |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2314 } | 2316 } |
2315 | 2317 |
2316 bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults&
mev, Scrollbar* scrollbar) | 2318 bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults&
mev, Scrollbar* scrollbar) |
2317 { | 2319 { |
2318 if (!scrollbar || !scrollbar->enabled()) | 2320 if (!scrollbar || !scrollbar->enabled()) |
2319 return false; | 2321 return false; |
2320 return scrollbar->mouseDown(mev.event()); | 2322 return scrollbar->mouseDown(mev.event()); |
2321 } | 2323 } |
2322 | 2324 |
2323 } | 2325 } |
OLD | NEW |