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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 257 |
258 // Refetch the event target node if it is removed or currently is the shadow nod
e inside an <input> element. | 258 // Refetch the event target node if it is removed or currently is the shadow nod
e inside an <input> element. |
259 // If a mouse event handler changes the input element type to one that has a wid
get associated, | 259 // If a mouse event handler changes the input element type to one that has a wid
get associated, |
260 // we'd like to EventHandler::handleMousePressEvent to pass the event to the wid
get and thus the | 260 // we'd like to EventHandler::handleMousePressEvent to pass the event to the wid
get and thus the |
261 // event target node can't still be the shadow node. | 261 // event target node can't still be the shadow node. |
262 static inline bool shouldRefetchEventTarget(const MouseEventWithHitTestResults&
mev) | 262 static inline bool shouldRefetchEventTarget(const MouseEventWithHitTestResults&
mev) |
263 { | 263 { |
264 Node* targetNode = mev.targetNode(); | 264 Node* targetNode = mev.targetNode(); |
265 if (!targetNode || !targetNode->parentNode()) | 265 if (!targetNode || !targetNode->parentNode()) |
266 return true; | 266 return true; |
267 return targetNode->isShadowRoot() && toShadowRoot(targetNode)->host()->hasTa
gName(inputTag); | 267 return targetNode->isShadowRoot() && isHTMLInputElement(*toShadowRoot(target
Node)->host()); |
268 } | 268 } |
269 | 269 |
270 EventHandler::EventHandler(LocalFrame* frame) | 270 EventHandler::EventHandler(LocalFrame* frame) |
271 : m_frame(frame) | 271 : m_frame(frame) |
272 , m_mousePressed(false) | 272 , m_mousePressed(false) |
273 , m_capturesDragging(false) | 273 , m_capturesDragging(false) |
274 , m_mouseDownMayStartSelect(false) | 274 , m_mouseDownMayStartSelect(false) |
275 , m_mouseDownMayStartDrag(false) | 275 , m_mouseDownMayStartDrag(false) |
276 , m_mouseDownWasSingleClickInSelection(false) | 276 , m_mouseDownWasSingleClickInSelection(false) |
277 , m_selectionInitiationState(HaveNotStartedSelection) | 277 , m_selectionInitiationState(HaveNotStartedSelection) |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 | 1012 |
1013 static LocalFrame* subframeForHitTestResult(const MouseEventWithHitTestResults&
hitTestResult) | 1013 static LocalFrame* subframeForHitTestResult(const MouseEventWithHitTestResults&
hitTestResult) |
1014 { | 1014 { |
1015 if (!hitTestResult.isOverWidget()) | 1015 if (!hitTestResult.isOverWidget()) |
1016 return 0; | 1016 return 0; |
1017 return subframeForTargetNode(hitTestResult.targetNode()); | 1017 return subframeForTargetNode(hitTestResult.targetNode()); |
1018 } | 1018 } |
1019 | 1019 |
1020 static bool isSubmitImage(Node* node) | 1020 static bool isSubmitImage(Node* node) |
1021 { | 1021 { |
1022 return node && node->hasTagName(inputTag) && toHTMLInputElement(node)->isIma
geButton(); | 1022 return isHTMLInputElement(node) && toHTMLInputElement(node)->isImageButton()
; |
1023 } | 1023 } |
1024 | 1024 |
1025 // Returns true if the node's editable block is not current focused for editing | 1025 // Returns true if the node's editable block is not current focused for editing |
1026 static bool nodeIsNotBeingEdited(Node* node, LocalFrame* frame) | 1026 static bool nodeIsNotBeingEdited(Node* node, LocalFrame* frame) |
1027 { | 1027 { |
1028 return frame->selection().rootEditableElement() != node->rootEditableElement
(); | 1028 return frame->selection().rootEditableElement() != node->rootEditableElement
(); |
1029 } | 1029 } |
1030 | 1030 |
1031 bool EventHandler::useHandCursor(Node* node, bool isOverLink, bool shiftKey) | 1031 bool EventHandler::useHandCursor(Node* node, bool isOverLink, bool shiftKey) |
1032 { | 1032 { |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1740 | 1740 |
1741 dragTarget->dispatchEvent(me.get(), IGNORE_EXCEPTION); | 1741 dragTarget->dispatchEvent(me.get(), IGNORE_EXCEPTION); |
1742 return me->defaultPrevented(); | 1742 return me->defaultPrevented(); |
1743 } | 1743 } |
1744 | 1744 |
1745 static bool targetIsFrame(Node* target, LocalFrame*& frame) | 1745 static bool targetIsFrame(Node* target, LocalFrame*& frame) |
1746 { | 1746 { |
1747 if (!target) | 1747 if (!target) |
1748 return false; | 1748 return false; |
1749 | 1749 |
1750 if (!target->hasTagName(frameTag) && !target->hasTagName(iframeTag)) | 1750 if (!isHTMLFrameElement(*target) && !isHTMLIFrameElement(*target)) |
1751 return false; | 1751 return false; |
1752 | 1752 |
1753 frame = toHTMLFrameElementBase(target)->contentFrame(); | 1753 frame = toHTMLFrameElementBase(target)->contentFrame(); |
1754 return true; | 1754 return true; |
1755 } | 1755 } |
1756 | 1756 |
1757 static bool findDropZone(Node* target, Clipboard* clipboard) | 1757 static bool findDropZone(Node* target, Clipboard* clipboard) |
1758 { | 1758 { |
1759 Element* element = target->isElementNode() ? toElement(target) : target->par
entElement(); | 1759 Element* element = target->isElementNode() ? toElement(target) : target->par
entElement(); |
1760 for (; element; element = element->parentElement()) { | 1760 for (; element; element = element->parentElement()) { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1914 static inline SVGElementInstance* instanceAssociatedWithShadowTreeElement(Node*
referenceNode) | 1914 static inline SVGElementInstance* instanceAssociatedWithShadowTreeElement(Node*
referenceNode) |
1915 { | 1915 { |
1916 if (!referenceNode || !referenceNode->isSVGElement()) | 1916 if (!referenceNode || !referenceNode->isSVGElement()) |
1917 return 0; | 1917 return 0; |
1918 | 1918 |
1919 ShadowRoot* shadowRoot = referenceNode->containingShadowRoot(); | 1919 ShadowRoot* shadowRoot = referenceNode->containingShadowRoot(); |
1920 if (!shadowRoot) | 1920 if (!shadowRoot) |
1921 return 0; | 1921 return 0; |
1922 | 1922 |
1923 Element* shadowTreeParentElement = shadowRoot->host(); | 1923 Element* shadowTreeParentElement = shadowRoot->host(); |
1924 if (!shadowTreeParentElement || !shadowTreeParentElement->hasTagName(useTag)
) | 1924 if (!isSVGUseElement(shadowTreeParentElement)) |
1925 return 0; | 1925 return 0; |
1926 | 1926 |
1927 return toSVGUseElement(shadowTreeParentElement)->instanceForShadowTreeElemen
t(referenceNode); | 1927 return toSVGUseElement(shadowTreeParentElement)->instanceForShadowTreeElemen
t(referenceNode); |
1928 } | 1928 } |
1929 | 1929 |
1930 void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo
useEvent& mouseEvent, bool fireMouseOverOut) | 1930 void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo
useEvent& mouseEvent, bool fireMouseOverOut) |
1931 { | 1931 { |
1932 Node* result = targetNode; | 1932 Node* result = targetNode; |
1933 | 1933 |
1934 // If we're capturing, we always go right to that node. | 1934 // If we're capturing, we always go right to that node. |
(...skipping 2091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4026 unsigned EventHandler::accessKeyModifiers() | 4026 unsigned EventHandler::accessKeyModifiers() |
4027 { | 4027 { |
4028 #if OS(MACOSX) | 4028 #if OS(MACOSX) |
4029 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 4029 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
4030 #else | 4030 #else |
4031 return PlatformEvent::AltKey; | 4031 return PlatformEvent::AltKey; |
4032 #endif | 4032 #endif |
4033 } | 4033 } |
4034 | 4034 |
4035 } // namespace WebCore | 4035 } // namespace WebCore |
OLD | NEW |