| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. |
| 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 2821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2832 if (sendMouseEvents) | 2832 if (sendMouseEvents) |
| 2833 dispatchSimulatedMouseEvent(eventNames().mouseupEvent, event.get()); | 2833 dispatchSimulatedMouseEvent(eventNames().mouseupEvent, event.get()); |
| 2834 setActive(false); | 2834 setActive(false); |
| 2835 | 2835 |
| 2836 // always send click | 2836 // always send click |
| 2837 dispatchSimulatedMouseEvent(eventNames().clickEvent, event); | 2837 dispatchSimulatedMouseEvent(eventNames().clickEvent, event); |
| 2838 | 2838 |
| 2839 gNodesDispatchingSimulatedClicks->remove(this); | 2839 gNodesDispatchingSimulatedClicks->remove(this); |
| 2840 } | 2840 } |
| 2841 | 2841 |
| 2842 // FIXME: Once https://bugs.webkit.org/show_bug.cgi?id=52963 lands, this should |
| 2843 // be greatly improved. See https://bugs.webkit.org/show_bug.cgi?id=54025. |
| 2844 static Node* pullOutOfShadow(Node* node) |
| 2845 { |
| 2846 Node* outermostShadowBoundary = node; |
| 2847 for (Node* n = node; n; n = n->parentOrHostNode()) { |
| 2848 if (n->isShadowRoot()) |
| 2849 outermostShadowBoundary = n->parentOrHostNode(); |
| 2850 } |
| 2851 return outermostShadowBoundary; |
| 2852 } |
| 2853 |
| 2842 bool Node::dispatchMouseEvent(const AtomicString& eventType, int button, int det
ail, | 2854 bool Node::dispatchMouseEvent(const AtomicString& eventType, int button, int det
ail, |
| 2843 int pageX, int pageY, int screenX, int screenY, | 2855 int pageX, int pageY, int screenX, int screenY, |
| 2844 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, | 2856 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, |
| 2845 bool isSimulated, Node* relatedTargetArg, PassRefPtr<Event> underlyingEvent) | 2857 bool isSimulated, Node* relatedTargetArg, PassRefPtr<Event> underlyingEvent) |
| 2846 { | 2858 { |
| 2847 ASSERT(!eventDispatchForbidden()); | 2859 ASSERT(!eventDispatchForbidden()); |
| 2848 if (disabled()) // Don't even send DOM events for disabled controls.. | 2860 if (disabled()) // Don't even send DOM events for disabled controls.. |
| 2849 return true; | 2861 return true; |
| 2850 | 2862 |
| 2851 if (eventType.isEmpty()) | 2863 if (eventType.isEmpty()) |
| 2852 return false; // Shouldn't happen. | 2864 return false; // Shouldn't happen. |
| 2853 | 2865 |
| 2854 // Dispatching the first event can easily result in this node being destroye
d. | 2866 // Dispatching the first event can easily result in this node being destroye
d. |
| 2855 // Since we dispatch up to three events here, we need to make sure we're ref
erenced | 2867 // Since we dispatch up to three events here, we need to make sure we're ref
erenced |
| 2856 // so the pointer will be good for the two subsequent ones. | 2868 // so the pointer will be good for the two subsequent ones. |
| 2857 RefPtr<Node> protect(this); | 2869 RefPtr<Node> protect(this); |
| 2858 | 2870 |
| 2859 bool cancelable = eventType != eventNames().mousemoveEvent; | 2871 bool cancelable = eventType != eventNames().mousemoveEvent; |
| 2860 | 2872 |
| 2861 bool swallowEvent = false; | 2873 bool swallowEvent = false; |
| 2862 | 2874 |
| 2863 // Attempting to dispatch with a non-EventTarget relatedTarget causes the re
latedTarget to be silently ignored. | 2875 // Attempting to dispatch with a non-EventTarget relatedTarget causes the re
latedTarget to be silently ignored. |
| 2864 RefPtr<Node> relatedTarget = relatedTargetArg; | 2876 RefPtr<Node> relatedTarget = pullOutOfShadow(relatedTargetArg); |
| 2865 | 2877 |
| 2866 int adjustedPageX = pageX; | 2878 int adjustedPageX = pageX; |
| 2867 int adjustedPageY = pageY; | 2879 int adjustedPageY = pageY; |
| 2868 if (Frame* frame = document()->frame()) { | 2880 if (Frame* frame = document()->frame()) { |
| 2869 float pageZoom = frame->pageZoomFactor(); | 2881 float pageZoom = frame->pageZoomFactor(); |
| 2870 if (pageZoom != 1.0f) { | 2882 if (pageZoom != 1.0f) { |
| 2871 // Adjust our pageX and pageY to account for the page zoom. | 2883 // Adjust our pageX and pageY to account for the page zoom. |
| 2872 adjustedPageX = lroundf(pageX / pageZoom); | 2884 adjustedPageX = lroundf(pageX / pageZoom); |
| 2873 adjustedPageY = lroundf(pageY / pageZoom); | 2885 adjustedPageY = lroundf(pageY / pageZoom); |
| 2874 } | 2886 } |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3039 | 3051 |
| 3040 #ifndef NDEBUG | 3052 #ifndef NDEBUG |
| 3041 | 3053 |
| 3042 void showTree(const WebCore::Node* node) | 3054 void showTree(const WebCore::Node* node) |
| 3043 { | 3055 { |
| 3044 if (node) | 3056 if (node) |
| 3045 node->showTreeForThis(); | 3057 node->showTreeForThis(); |
| 3046 } | 3058 } |
| 3047 | 3059 |
| 3048 #endif | 3060 #endif |
| OLD | NEW |