Changeset 20761 in webkit
- Timestamp:
- Apr 6, 2007 2:37:48 PM (17 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r20760 r20761 1 2007-04-06 David Hyatt <hyatt@apple.com> 2 3 Fix for bug 13274. Rework mouse events so that subframe capturing works again. Make sure 4 everything just comes down through the top FrameView even when capturing is in effect. Update 5 scrollbar handling logic so that scrollbars receive events correctly while capturing is in 6 effect. Eliminate the notion of widget capture. Fix mouse moves so that they only fire 7 on the innermost hit frame. 8 9 Reviewed by olliej 10 11 * page/EventHandler.cpp: 12 (WebCore::EventHandler::handleMouseDraggedEvent): 13 (WebCore::subframeForTargetNode): 14 (WebCore::EventHandler::handleMousePressEvent): 15 (WebCore::EventHandler::handleMouseMoveEvent): 16 (WebCore::EventHandler::handleMouseReleaseEvent): 17 * page/EventHandler.h: 18 * platform/PopupMenu.h: 19 (WebCore::PopupMenu::scrollbarCapturingMouse): 20 (WebCore::PopupMenu::setScrollbarCapturingMouse): 21 * platform/ScrollBar.h: 22 (WebCore::Scrollbar::handleMouseReleaseEvent): 23 * platform/Widget.h: 24 (WebCore::Widget::geometryChanged): 25 1 26 2007-04-06 Justin Garcia <justin.garcia@apple.com> 2 27 -
trunk/WebCore/page/EventHandler.cpp
r20753 r20761 306 306 } 307 307 308 bool EventHandler::handleMouse MoveEvent(const MouseEventWithHitTestResults& event)308 bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& event) 309 309 { 310 310 if (handleDrag(event)) … … 593 593 } 594 594 595 staticFrame* subframeForTargetNode(Node* node)595 Frame* subframeForTargetNode(Node* node) 596 596 { 597 597 if (!node) … … 788 788 Frame* subframe = subframeForTargetNode(mev.targetNode()); 789 789 if (subframe && passMousePressEventToSubframe(mev, subframe)) { 790 // Start capturing future events for this frame. We only do this if we didn't clear 791 // the m_mousePressed flag, which may happen if an AppKit widget entered a modal event loop. 792 if (m_mousePressed) 793 m_capturingMouseEventsNode = mev.targetNode(); 790 794 invalidateClick(); 791 795 return true; … … 884 888 return dispatchMouseEvent(mousemoveEvent, m_frameSetBeingResized.get(), false, 0, mouseEvent, false); 885 889 890 // Send events right to a scrollbar if the mouse is pressed. 891 if (m_lastScrollbarUnderMouse && m_mousePressed) 892 return m_lastScrollbarUnderMouse->handleMouseMoveEvent(mouseEvent); 893 886 894 // Treat mouse move events while the mouse is pressed as "read-only" in prepareMouseEvent 887 895 // if we are allowed to select. … … 891 899 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); 892 900 893 if (m_lastMouseMoveEventSubframe && m_lastMouseMoveEventSubframe->tree()->isDescendantOf(m_frame))894 passMouseMoveEventToSubframe(mev, m_lastMouseMoveEventSubframe.get());895 896 bool swallowEvent = dispatchMouseEvent(mousemoveEvent, mev.targetNode(), false, 0, mouseEvent, true);897 898 901 PlatformScrollbar* scrollbar = 0; 899 902 if (m_frame->view()) … … 913 916 m_resizeLayer->resize(mouseEvent, m_offsetFromResizeCorner); 914 917 915 if (!swallowEvent)916 swallowEvent = handleMouseMoveEvent(mev);917 918 RefPtr<Frame> newSubframe = subframeForTargetNode(mev.targetNode());919 if (newSubframe) {920 if (m_lastMouseMoveEventSubframe !=newSubframe)921 922 }else {918 bool swallowEvent = false; 919 Node* targetNode = m_capturingMouseEventsNode.get() ? m_capturingMouseEventsNode.get() : mev.targetNode(); 920 RefPtr<Frame> newSubframe = subframeForTargetNode(targetNode); 921 if (m_lastMouseMoveEventSubframe && m_lastMouseMoveEventSubframe->tree()->isDescendantOf(m_frame) && m_lastMouseMoveEventSubframe != newSubframe) 922 passMouseMoveEventToSubframe(mev, m_lastMouseMoveEventSubframe.get()); 923 if (newSubframe) 924 swallowEvent |= passMouseMoveEventToSubframe(mev, newSubframe.get()); 925 else { 923 926 if (scrollbar && !m_mousePressed) 924 927 scrollbar->handleMouseMoveEvent(mouseEvent); // Handle hover effects on platforms that support visual feedback on scrollbar hovering. … … 926 929 m_frame->view()->setCursor(selectCursor(mev, m_frame, m_mousePressed, scrollbar, m_capturingMouseEventsNode)); 927 930 } 928 931 929 932 m_lastMouseMoveEventSubframe = newSubframe; 933 934 if (swallowEvent) 935 return true; 936 937 swallowEvent = dispatchMouseEvent(mousemoveEvent, mev.targetNode(), false, 0, mouseEvent, true); 938 if (!swallowEvent) 939 swallowEvent = handleMouseDraggedEvent(mev); 930 940 931 941 return swallowEvent; … … 951 961 return dispatchMouseEvent(mouseupEvent, m_frameSetBeingResized.get(), true, m_clickCount, mouseEvent, false); 952 962 963 if (m_lastScrollbarUnderMouse) { 964 invalidateClick(); 965 return m_lastScrollbarUnderMouse->handleMouseReleaseEvent(mouseEvent); 966 } 967 953 968 MouseEventWithHitTestResults mev = prepareMouseEvent(HitTestRequest(false, false, false, true), mouseEvent); 954 Frame* subframe = subframeForTargetNode(mev.targetNode()); 969 Node* targetNode = m_capturingMouseEventsNode.get() ? m_capturingMouseEventsNode.get() : mev.targetNode(); 970 setCapturingMouseEventsNode(0); 971 Frame* subframe = subframeForTargetNode(targetNode); 955 972 if (subframe && passMouseReleaseEventToSubframe(mev, subframe)) 956 973 return true; -
trunk/WebCore/page/EventHandler.h
r19879 r20761 185 185 bool handleMousePressEventDoubleClick(const MouseEventWithHitTestResults&); 186 186 bool handleMousePressEventTripleClick(const MouseEventWithHitTestResults&); 187 bool handleMouse MoveEvent(const MouseEventWithHitTestResults&);187 bool handleMouseDraggedEvent(const MouseEventWithHitTestResults&); 188 188 bool handleMouseReleaseEvent(const MouseEventWithHitTestResults&); 189 189 -
trunk/WebCore/platform/PopupMenu.h
r20475 r20761 104 104 void reduceWheelDelta(int delta); 105 105 int wheelDelta() const { return m_wheelDelta; } 106 107 bool scrollbarCapturingMouse() const { return m_scrollbarCapturingMouse; } 108 void setScrollbarCapturingMouse(bool b) { m_scrollbarCapturingMouse = b; } 106 109 #endif 107 110 … … 141 144 int m_wheelDelta; 142 145 int m_focusedIndex; 146 bool m_scrollbarCapturingMouse; 143 147 #endif 144 148 -
trunk/WebCore/platform/ScrollBar.h
r20518 r20761 93 93 virtual bool handleMouseOutEvent(const PlatformMouseEvent&) { return false; } 94 94 95 // Used by some platform scrollbars to know when they've been released from capture. 96 virtual bool handleMouseReleaseEvent(const PlatformMouseEvent&) { return false; } 97 95 98 protected: 96 99 virtual void updateThumbPosition() = 0; -
trunk/WebCore/platform/Widget.h
r19772 r20761 121 121 122 122 virtual void geometryChanged() const {}; 123 124 bool capturingMouse() const;125 void setCapturingMouse(bool);126 Widget* capturingTarget();127 Widget* capturingChild();128 void setCapturingChild(Widget*);129 123 130 124 IntRect convertToContainingWindow(const IntRect&) const;
Note: See TracChangeset
for help on using the changeset viewer.