Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: Source/core/dom/Node.cpp

Issue 894913002: Prevent default actions for JS-generated mouse events other than click (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: TIL, gclient sync may rebase changes back in time Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/events/EventDispatcher.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights 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 2084 matching lines...) Expand 10 before | Expand all | Expand 10 after
2095 dispatchScopedEventDispatchMediator(EventDispatchMediator::create(event)); 2095 dispatchScopedEventDispatchMediator(EventDispatchMediator::create(event));
2096 } 2096 }
2097 2097
2098 void Node::dispatchScopedEventDispatchMediator(PassRefPtrWillBeRawPtr<EventDispa tchMediator> eventDispatchMediator) 2098 void Node::dispatchScopedEventDispatchMediator(PassRefPtrWillBeRawPtr<EventDispa tchMediator> eventDispatchMediator)
2099 { 2099 {
2100 EventDispatcher::dispatchScopedEvent(*this, eventDispatchMediator); 2100 EventDispatcher::dispatchScopedEvent(*this, eventDispatchMediator);
2101 } 2101 }
2102 2102
2103 bool Node::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event) 2103 bool Node::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event)
2104 { 2104 {
2105 if (event->isMouseEvent()) 2105 if (event->isMouseEvent()) {
2106 return EventDispatcher::dispatchEvent(*this, MouseEventDispatchMediator: :create(static_pointer_cast<MouseEvent>(event), MouseEventDispatchMediator::Synt heticMouseEvent)); 2106 toMouseEvent(*event).setFromScript();
2107 return dispatchMouseEvent(static_pointer_cast<MouseEvent>(event));
2108 }
2107 if (event->isTouchEvent()) 2109 if (event->isTouchEvent())
2108 return dispatchTouchEvent(static_pointer_cast<TouchEvent>(event)); 2110 return dispatchTouchEvent(static_pointer_cast<TouchEvent>(event));
2109 return EventDispatcher::dispatchEvent(*this, EventDispatchMediator::create(e vent)); 2111 return EventDispatcher::dispatchEvent(*this, EventDispatchMediator::create(e vent));
2110 } 2112 }
2111 2113
2112 void Node::dispatchSubtreeModifiedEvent() 2114 void Node::dispatchSubtreeModifiedEvent()
2113 { 2115 {
2114 if (isInShadowTree()) 2116 if (isInShadowTree())
2115 return; 2117 return;
2116 2118
(...skipping 18 matching lines...) Expand all
2135 { 2137 {
2136 return EventDispatcher::dispatchEvent(*this, KeyboardEventDispatchMediator:: create(KeyboardEvent::create(event, document().domWindow()))); 2138 return EventDispatcher::dispatchEvent(*this, KeyboardEventDispatchMediator:: create(KeyboardEvent::create(event, document().domWindow())));
2137 } 2139 }
2138 2140
2139 bool Node::dispatchMouseEvent(const PlatformMouseEvent& event, const AtomicStrin g& eventType, 2141 bool Node::dispatchMouseEvent(const PlatformMouseEvent& event, const AtomicStrin g& eventType,
2140 int detail, Node* relatedTarget) 2142 int detail, Node* relatedTarget)
2141 { 2143 {
2142 return EventDispatcher::dispatchEvent(*this, MouseEventDispatchMediator::cre ate(MouseEvent::create(eventType, document().domWindow(), event, detail, related Target))); 2144 return EventDispatcher::dispatchEvent(*this, MouseEventDispatchMediator::cre ate(MouseEvent::create(eventType, document().domWindow(), event, detail, related Target)));
2143 } 2145 }
2144 2146
2147 bool Node::dispatchMouseEvent(PassRefPtrWillBeRawPtr<MouseEvent> event)
2148 {
2149 return EventDispatcher::dispatchEvent(*this, MouseEventDispatchMediator::cre ate(event));
2150 }
2151
2145 bool Node::dispatchGestureEvent(const PlatformGestureEvent& event) 2152 bool Node::dispatchGestureEvent(const PlatformGestureEvent& event)
2146 { 2153 {
2147 RefPtrWillBeRawPtr<GestureEvent> gestureEvent = GestureEvent::create(documen t().domWindow(), event); 2154 RefPtrWillBeRawPtr<GestureEvent> gestureEvent = GestureEvent::create(documen t().domWindow(), event);
2148 if (!gestureEvent.get()) 2155 if (!gestureEvent.get())
2149 return false; 2156 return false;
2150 return EventDispatcher::dispatchEvent(*this, GestureEventDispatchMediator::c reate(gestureEvent)); 2157 return EventDispatcher::dispatchEvent(*this, GestureEventDispatchMediator::c reate(gestureEvent));
2151 } 2158 }
2152 2159
2153 bool Node::dispatchTouchEvent(PassRefPtrWillBeRawPtr<TouchEvent> event) 2160 bool Node::dispatchTouchEvent(PassRefPtrWillBeRawPtr<TouchEvent> event)
2154 { 2161 {
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
2496 2503
2497 void showNodePath(const blink::Node* node) 2504 void showNodePath(const blink::Node* node)
2498 { 2505 {
2499 if (node) 2506 if (node)
2500 node->showNodePathForThis(); 2507 node->showNodePathForThis();
2501 else 2508 else
2502 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2509 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2503 } 2510 }
2504 2511
2505 #endif 2512 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/events/EventDispatcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698