Diff
Modified: trunk/Source/WebCore/ChangeLog (135689 => 135690)
--- trunk/Source/WebCore/ChangeLog 2012-11-26 09:07:19 UTC (rev 135689)
+++ trunk/Source/WebCore/ChangeLog 2012-11-26 09:11:52 UTC (rev 135690)
@@ -1,3 +1,51 @@
+2012-11-26 Jon Lee <jon...@apple.com>
+
+ Extend EventDispatcher::dispatchSimulatedClick to allow sending a mouseover event
+ https://bugs.webkit.org/show_bug.cgi?id=102610
+ <rdar://problem/12725663>
+
+ Reviewed by Darin Adler.
+
+ Update the dispatchSimulatedClick() to take option enums for dispatching events.
+
+ * dom/SimulatedClickOptions.h: Added. Define two options enums. One tracks which mouse
+ events to send. The other determines whether to force the element to repaint.
+
+ * dom/EventDispatcher.cpp:
+ (WebCore::EventDispatcher::dispatchSimulatedClick): Refactor to use the option enums.
+ * dom/EventDispatcher.h:
+ (EventDispatcher): Update function signature.
+
+ * dom/Node.cpp: Refactor parameters to use the options enums rather than booleans.
+ (WebCore::Node::dispatchSimulatedClick):
+ * dom/Node.h:
+
+ Refactor. Remove redundant comments.
+ * html/BaseCheckableInputType.cpp:
+ (WebCore::BaseCheckableInputType::accessKeyAction):
+ * html/BaseClickableWithKeyInputType.cpp:
+ (WebCore::BaseClickableWithKeyInputType::accessKeyAction):
+ * html/HTMLAnchorElement.cpp:
+ (WebCore::HTMLAnchorElement::accessKeyAction):
+ * html/HTMLButtonElement.cpp:
+ (WebCore::HTMLButtonElement::accessKeyAction):
+ * html/HTMLElement.cpp:
+ (WebCore::HTMLElement::click):
+ (WebCore::HTMLElement::accessKeyAction):
+ * html/HTMLSelectElement.cpp:
+ (WebCore::HTMLSelectElement::accessKeyAction):
+ * html/RadioInputType.cpp:
+ (WebCore::RadioInputType::handleKeydownEvent):
+ * html/RangeInputType.cpp:
+ (WebCore::RangeInputType::accessKeyAction):
+
+ Add SimulatedClickOptions.h.
+ * GNUmakefile.list.am:
+ * Target.pri:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+
2012-11-26 Shinya Kawanaka <shin...@chromium.org>
[Shadow] Attaching children of a shadow host takes O(N^2) where N is the number of host children
Modified: trunk/Source/WebCore/GNUmakefile.list.am (135689 => 135690)
--- trunk/Source/WebCore/GNUmakefile.list.am 2012-11-26 09:07:19 UTC (rev 135689)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2012-11-26 09:11:52 UTC (rev 135690)
@@ -2924,6 +2924,7 @@
Source/WebCore/dom/SelectorQuery.h \
Source/WebCore/dom/ShadowRoot.cpp \
Source/WebCore/dom/ShadowRoot.h \
+ Source/WebCore/dom/SimulatedClickOptions.h \
Source/WebCore/dom/SpaceSplitString.cpp \
Source/WebCore/dom/SpaceSplitString.h \
Source/WebCore/dom/StaticHashSetNodeList.cpp \
Modified: trunk/Source/WebCore/Target.pri (135689 => 135690)
--- trunk/Source/WebCore/Target.pri 2012-11-26 09:07:19 UTC (rev 135689)
+++ trunk/Source/WebCore/Target.pri 2012-11-26 09:11:52 UTC (rev 135690)
@@ -1621,6 +1621,7 @@
dom/ScriptExecutionContext.h \
dom/SelectorQuery.h \
dom/ShadowRoot.h \
+ dom/SimulatedClickOptions.h \
dom/SpaceSplitString.h \
dom/StaticNodeList.h \
dom/StyledElement.h \
Modified: trunk/Source/WebCore/WebCore.gypi (135689 => 135690)
--- trunk/Source/WebCore/WebCore.gypi 2012-11-26 09:07:19 UTC (rev 135689)
+++ trunk/Source/WebCore/WebCore.gypi 2012-11-26 09:11:52 UTC (rev 135690)
@@ -690,6 +690,7 @@
'dom/ScriptExecutionContext.h',
'dom/ScriptRunner.h',
'dom/ShadowRoot.h',
+ 'dom/SimulatedClickOptions.h',
'dom/SpaceSplitString.h',
'dom/StyledElement.h',
'dom/Text.h',
@@ -3925,6 +3926,7 @@
'dom/SelectorQuery.h',
'dom/ShadowRoot.cpp',
'dom/ShadowRoot.h',
+ 'dom/SimulatedClickOptions.h',
'dom/SpaceSplitString.cpp',
'dom/StaticHashSetNodeList.cpp',
'dom/StaticHashSetNodeList.h',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (135689 => 135690)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-11-26 09:07:19 UTC (rev 135689)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-11-26 09:11:52 UTC (rev 135690)
@@ -54350,6 +54350,10 @@
>
</File>
<File
+ RelativePath="..\dom\SimulatedClickOptions.h"
+ >
+ </File>
+ <File
RelativePath="..\dom\SpaceSplitString.cpp"
>
<FileConfiguration
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (135689 => 135690)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-11-26 09:07:19 UTC (rev 135689)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-11-26 09:11:52 UTC (rev 135690)
@@ -911,6 +911,7 @@
316FE1180E6E1DA700BF6088 /* ImplicitAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 316FE10E0E6E1DA700BF6088 /* ImplicitAnimation.h */; };
316FE1190E6E1DA700BF6088 /* KeyframeAnimation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 316FE10F0E6E1DA700BF6088 /* KeyframeAnimation.cpp */; };
316FE11A0E6E1DA700BF6088 /* KeyframeAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 316FE1100E6E1DA700BF6088 /* KeyframeAnimation.h */; };
+ 31741AAD16636609008A5B7E /* SimulatedClickOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 31741AAB16635E45008A5B7E /* SimulatedClickOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
3194616213020B20004BB3F8 /* JSWebKitAnimation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3194616013020B20004BB3F8 /* JSWebKitAnimation.cpp */; };
3194616313020B20004BB3F8 /* JSWebKitAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 3194616113020B20004BB3F8 /* JSWebKitAnimation.h */; };
3194616A13020B66004BB3F8 /* DOMWebKitAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 3194616813020B66004BB3F8 /* DOMWebKitAnimation.h */; };
@@ -8082,6 +8083,7 @@
316FE10E0E6E1DA700BF6088 /* ImplicitAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ImplicitAnimation.h; path = animation/ImplicitAnimation.h; sourceTree = "<group>"; };
316FE10F0E6E1DA700BF6088 /* KeyframeAnimation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KeyframeAnimation.cpp; path = animation/KeyframeAnimation.cpp; sourceTree = "<group>"; };
316FE1100E6E1DA700BF6088 /* KeyframeAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KeyframeAnimation.h; path = animation/KeyframeAnimation.h; sourceTree = "<group>"; };
+ 31741AAB16635E45008A5B7E /* SimulatedClickOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SimulatedClickOptions.h; sourceTree = "<group>"; };
3194616013020B20004BB3F8 /* JSWebKitAnimation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitAnimation.cpp; sourceTree = "<group>"; };
3194616113020B20004BB3F8 /* JSWebKitAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitAnimation.h; sourceTree = "<group>"; };
3194616813020B66004BB3F8 /* DOMWebKitAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWebKitAnimation.h; sourceTree = "<group>"; };
@@ -22094,6 +22096,7 @@
A6D169611346B49B000EB770 /* ShadowRoot.cpp */,
A6D169631346B4C1000EB770 /* ShadowRoot.h */,
A7DB418114CE1F0A00A2E316 /* ShadowRoot.idl */,
+ 31741AAB16635E45008A5B7E /* SimulatedClickOptions.h */,
D01A27AB10C9BFD800026A42 /* SpaceSplitString.cpp */,
D01A27AC10C9BFD800026A42 /* SpaceSplitString.h */,
CEA3949A11D45CDA003094CF /* StaticHashSetNodeList.cpp */,
@@ -25808,6 +25811,7 @@
53EF766B16530A61004CBE49 /* SettingsMacros.h in Headers */,
447958041643B49A001E0A7F /* ParsedContentType.h in Headers */,
FB2C15C3165D649D0039C9F8 /* CachedSVGDocumentReference.h in Headers */,
+ 31741AAD16636609008A5B7E /* SimulatedClickOptions.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: trunk/Source/WebCore/dom/EventDispatcher.cpp (135689 => 135690)
--- trunk/Source/WebCore/dom/EventDispatcher.cpp 2012-11-26 09:07:19 UTC (rev 135689)
+++ trunk/Source/WebCore/dom/EventDispatcher.cpp 2012-11-26 09:11:52 UTC (rev 135690)
@@ -208,7 +208,7 @@
ScopedEventQueue::instance()->enqueueEventDispatchMediator(mediator);
}
-void EventDispatcher::dispatchSimulatedClick(Node* node, Event* underlyingEvent, bool sendMouseEvents, bool showPressedLook)
+void EventDispatcher::dispatchSimulatedClick(Node* node, Event* underlyingEvent, SimulatedClickMouseEventOptions mouseEventOptions, SimulatedClickVisualOptions visualOptions)
{
if (node->disabled())
return;
@@ -220,11 +220,13 @@
gNodesDispatchingSimulatedClicks->add(node);
- // send mousedown and mouseup before the click, if requested
- if (sendMouseEvents)
+ if (mouseEventOptions == SendMouseOverUpDownEvents)
+ EventDispatcher(node).dispatchEvent(SimulatedMouseEvent::create(eventNames().mouseoverEvent, node->document()->defaultView(), underlyingEvent));
+
+ if (mouseEventOptions != SendNoEvents)
EventDispatcher(node).dispatchEvent(SimulatedMouseEvent::create(eventNames().mousedownEvent, node->document()->defaultView(), underlyingEvent));
- node->setActive(true, showPressedLook);
- if (sendMouseEvents)
+ node->setActive(true, visualOptions == ShowPressedLook);
+ if (mouseEventOptions != SendNoEvents)
EventDispatcher(node).dispatchEvent(SimulatedMouseEvent::create(eventNames().mouseupEvent, node->document()->defaultView(), underlyingEvent));
node->setActive(false);
Modified: trunk/Source/WebCore/dom/EventDispatcher.h (135689 => 135690)
--- trunk/Source/WebCore/dom/EventDispatcher.h 2012-11-26 09:07:19 UTC (rev 135689)
+++ trunk/Source/WebCore/dom/EventDispatcher.h 2012-11-26 09:11:52 UTC (rev 135690)
@@ -26,6 +26,7 @@
#ifndef EventDispatcher_h
#define EventDispatcher_h
+#include "SimulatedClickOptions.h"
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
#include <wtf/Vector.h>
@@ -72,7 +73,7 @@
static bool dispatchEvent(Node*, PassRefPtr<EventDispatchMediator>);
static void dispatchScopedEvent(Node*, PassRefPtr<EventDispatchMediator>);
- static void dispatchSimulatedClick(Node*, Event* underlyingEvent, bool sendMouseEvents, bool showPressedLook);
+ static void dispatchSimulatedClick(Node*, Event* underlyingEvent, SimulatedClickMouseEventOptions, SimulatedClickVisualOptions);
bool dispatchEvent(PassRefPtr<Event>);
void adjustRelatedTarget(Event*, PassRefPtr<EventTarget> prpRelatedTarget);
Modified: trunk/Source/WebCore/dom/Node.cpp (135689 => 135690)
--- trunk/Source/WebCore/dom/Node.cpp 2012-11-26 09:07:19 UTC (rev 135689)
+++ trunk/Source/WebCore/dom/Node.cpp 2012-11-26 09:11:52 UTC (rev 135690)
@@ -2604,9 +2604,9 @@
}
#endif
-void Node::dispatchSimulatedClick(Event* underlyingEvent, bool sendMouseEvents, bool showPressedLook)
+void Node::dispatchSimulatedClick(Event* underlyingEvent, SimulatedClickMouseEventOptions eventOptions, SimulatedClickVisualOptions visualOptions)
{
- EventDispatcher::dispatchSimulatedClick(this, underlyingEvent, sendMouseEvents, showPressedLook);
+ EventDispatcher::dispatchSimulatedClick(this, underlyingEvent, eventOptions, visualOptions);
}
bool Node::dispatchBeforeLoadEvent(const String& sourceURL)
Modified: trunk/Source/WebCore/dom/Node.h (135689 => 135690)
--- trunk/Source/WebCore/dom/Node.h 2012-11-26 09:07:19 UTC (rev 135689)
+++ trunk/Source/WebCore/dom/Node.h 2012-11-26 09:11:52 UTC (rev 135690)
@@ -32,6 +32,7 @@
#include "MutationObserver.h"
#include "RenderStyleConstants.h"
#include "ScriptWrappable.h"
+#include "SimulatedClickOptions.h"
#include "TreeShared.h"
#include <wtf/Forward.h>
#include <wtf/ListHashSet.h>
@@ -637,7 +638,7 @@
#if ENABLE(GESTURE_EVENTS)
bool dispatchGestureEvent(const PlatformGestureEvent&);
#endif
- void dispatchSimulatedClick(Event* underlyingEvent, bool sendMouseEvents = false, bool showPressedLook = true);
+ void dispatchSimulatedClick(Event* underlyingEvent, SimulatedClickMouseEventOptions = SendNoEvents, SimulatedClickVisualOptions = ShowPressedLook);
bool dispatchBeforeLoadEvent(const String& sourceURL);
virtual void dispatchFocusEvent(PassRefPtr<Node> oldFocusedNode);
Added: trunk/Source/WebCore/dom/SimulatedClickOptions.h (0 => 135690)
--- trunk/Source/WebCore/dom/SimulatedClickOptions.h (rev 0)
+++ trunk/Source/WebCore/dom/SimulatedClickOptions.h 2012-11-26 09:11:52 UTC (rev 135690)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef SimulatedClickOptions_h
+#define SimulatedClickOptions_h
+
+namespace WebCore {
+
+enum SimulatedClickMouseEventOptions {
+ SendNoEvents,
+ SendMouseUpDownEvents,
+ SendMouseOverUpDownEvents
+};
+
+enum SimulatedClickVisualOptions {
+ DoNotShowPressedLook,
+ ShowPressedLook
+};
+
+} // namespace WebCore
+
+#endif // SimulatedClickOptions_h
Modified: trunk/Source/WebCore/html/BaseCheckableInputType.cpp (135689 => 135690)
--- trunk/Source/WebCore/html/BaseCheckableInputType.cpp 2012-11-26 09:07:19 UTC (rev 135689)
+++ trunk/Source/WebCore/html/BaseCheckableInputType.cpp 2012-11-26 09:11:52 UTC (rev 135690)
@@ -89,9 +89,7 @@
{
InputType::accessKeyAction(sendMouseEvents);
- // Send mouse button events if the caller specified sendMouseEvents.
- // FIXME: The comment above is no good. It says what we do, but not why.
- element()->dispatchSimulatedClick(0, sendMouseEvents);
+ element()->dispatchSimulatedClick(0, sendMouseEvents ? SendMouseUpDownEvents : SendNoEvents);
}
String BaseCheckableInputType::fallbackValue() const
Modified: trunk/Source/WebCore/html/BaseClickableWithKeyInputType.cpp (135689 => 135690)
--- trunk/Source/WebCore/html/BaseClickableWithKeyInputType.cpp 2012-11-26 09:07:19 UTC (rev 135689)
+++ trunk/Source/WebCore/html/BaseClickableWithKeyInputType.cpp 2012-11-26 09:11:52 UTC (rev 135690)
@@ -75,9 +75,7 @@
// FIXME: Could share this with BaseCheckableInputType and RangeInputType if we had a common base class.
void BaseClickableWithKeyInputType::accessKeyAction(HTMLInputElement* element, bool sendMouseEvents)
{
- // Send mouse button events if the caller specified sendMouseEvents.
- // FIXME: The comment above is no good. It says what we do, but not why.
- element->dispatchSimulatedClick(0, sendMouseEvents);
+ element->dispatchSimulatedClick(0, sendMouseEvents ? SendMouseUpDownEvents : SendNoEvents);
}
void BaseClickableWithKeyInputType::handleKeydownEvent(KeyboardEvent* event)
Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (135689 => 135690)
--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp 2012-11-26 09:07:19 UTC (rev 135689)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp 2012-11-26 09:11:52 UTC (rev 135690)
@@ -241,8 +241,7 @@
void HTMLAnchorElement::accessKeyAction(bool sendMouseEvents)
{
- // send the mouse button events if the caller specified sendMouseEvents
- dispatchSimulatedClick(0, sendMouseEvents);
+ dispatchSimulatedClick(0, sendMouseEvents ? SendMouseUpDownEvents : SendNoEvents);
}
bool HTMLAnchorElement::isURLAttribute(const Attribute& attribute) const
Modified: trunk/Source/WebCore/html/HTMLButtonElement.cpp (135689 => 135690)
--- trunk/Source/WebCore/html/HTMLButtonElement.cpp 2012-11-26 09:07:19 UTC (rev 135689)
+++ trunk/Source/WebCore/html/HTMLButtonElement.cpp 2012-11-26 09:11:52 UTC (rev 135690)
@@ -192,8 +192,8 @@
void HTMLButtonElement::accessKeyAction(bool sendMouseEvents)
{
focus();
- // Send the mouse button events if the caller specified sendMouseEvents
- dispatchSimulatedClick(0, sendMouseEvents);
+
+ dispatchSimulatedClick(0, sendMouseEvents ? SendMouseUpDownEvents : SendNoEvents);
}
bool HTMLButtonElement::isURLAttribute(const Attribute& attribute) const
Modified: trunk/Source/WebCore/html/HTMLElement.cpp (135689 => 135690)
--- trunk/Source/WebCore/html/HTMLElement.cpp 2012-11-26 09:07:19 UTC (rev 135689)
+++ trunk/Source/WebCore/html/HTMLElement.cpp 2012-11-26 09:11:52 UTC (rev 135690)
@@ -690,12 +690,12 @@
void HTMLElement::click()
{
- dispatchSimulatedClick(0, false, false);
+ dispatchSimulatedClick(0, SendNoEvents, DoNotShowPressedLook);
}
void HTMLElement::accessKeyAction(bool sendMouseEvents)
{
- dispatchSimulatedClick(0, sendMouseEvents);
+ dispatchSimulatedClick(0, sendMouseEvents ? SendMouseUpDownEvents : SendNoEvents);
}
String HTMLElement::title() const
Modified: trunk/Source/WebCore/html/HTMLSelectElement.cpp (135689 => 135690)
--- trunk/Source/WebCore/html/HTMLSelectElement.cpp 2012-11-26 09:07:19 UTC (rev 135689)
+++ trunk/Source/WebCore/html/HTMLSelectElement.cpp 2012-11-26 09:11:52 UTC (rev 135690)
@@ -393,7 +393,7 @@
void HTMLSelectElement::accessKeyAction(bool sendMouseEvents)
{
focus();
- dispatchSimulatedClick(0, sendMouseEvents);
+ dispatchSimulatedClick(0, sendMouseEvents ? SendMouseUpDownEvents : SendNoEvents);
}
void HTMLSelectElement::setMultiple(bool multiple)
Modified: trunk/Source/WebCore/html/RadioInputType.cpp (135689 => 135690)
--- trunk/Source/WebCore/html/RadioInputType.cpp 2012-11-26 09:07:19 UTC (rev 135689)
+++ trunk/Source/WebCore/html/RadioInputType.cpp 2012-11-26 09:11:52 UTC (rev 135690)
@@ -96,7 +96,7 @@
break;
if (inputElement->isRadioButton() && inputElement->name() == element()->name() && inputElement->isFocusable()) {
document->setFocusedNode(inputElement);
- inputElement->dispatchSimulatedClick(event, false, false);
+ inputElement->dispatchSimulatedClick(event, SendNoEvents, DoNotShowPressedLook);
event->setDefaultHandled();
return;
}
Modified: trunk/Source/WebCore/html/RangeInputType.cpp (135689 => 135690)
--- trunk/Source/WebCore/html/RangeInputType.cpp 2012-11-26 09:07:19 UTC (rev 135689)
+++ trunk/Source/WebCore/html/RangeInputType.cpp 2012-11-26 09:11:52 UTC (rev 135690)
@@ -286,9 +286,7 @@
{
InputType::accessKeyAction(sendMouseEvents);
- // Send mouse button events if the caller specified sendMouseEvents.
- // FIXME: The comment above is no good. It says what we do, but not why.
- element()->dispatchSimulatedClick(0, sendMouseEvents);
+ element()->dispatchSimulatedClick(0, sendMouseEvents ? SendMouseUpDownEvents : SendNoEvents);
}
void RangeInputType::minOrMaxAttributeChanged()