summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/WebKit/Source/core/events
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-08-08 14:30:41 +0200
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-08-12 13:49:54 +0200
commitab0a50979b9eb4dfa3320eff7e187e41efedf7a9 (patch)
tree498dfb8a97ff3361a9f7486863a52bb4e26bb898 /chromium/third_party/WebKit/Source/core/events
parent4ce69f7403811819800e7c5ae1318b2647e778d1 (diff)
Update Chromium to beta version 37.0.2062.68
Change-Id: I188e3b5aff1bec75566014291b654eb19f5bc8ca Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/events')
-rw-r--r--chromium/third_party/WebKit/Source/core/events/AnimationPlayerEvent.cpp63
-rw-r--r--chromium/third_party/WebKit/Source/core/events/AnimationPlayerEvent.h54
-rw-r--r--chromium/third_party/WebKit/Source/core/events/AnimationPlayerEvent.idl12
-rw-r--r--chromium/third_party/WebKit/Source/core/events/ApplicationCacheErrorEvent.cpp82
-rw-r--r--chromium/third_party/WebKit/Source/core/events/ApplicationCacheErrorEvent.h66
-rw-r--r--chromium/third_party/WebKit/Source/core/events/ApplicationCacheErrorEvent.idl12
-rw-r--r--chromium/third_party/WebKit/Source/core/events/AutocompleteErrorEvent.h21
-rw-r--r--chromium/third_party/WebKit/Source/core/events/BeforeLoadEvent.h89
-rw-r--r--chromium/third_party/WebKit/Source/core/events/BeforeTextInsertedEvent.cpp7
-rw-r--r--chromium/third_party/WebKit/Source/core/events/BeforeTextInsertedEvent.h12
-rw-r--r--chromium/third_party/WebKit/Source/core/events/BeforeUnloadEvent.cpp5
-rw-r--r--chromium/third_party/WebKit/Source/core/events/BeforeUnloadEvent.h9
-rw-r--r--chromium/third_party/WebKit/Source/core/events/ClipboardEvent.cpp11
-rw-r--r--chromium/third_party/WebKit/Source/core/events/ClipboardEvent.h16
-rw-r--r--chromium/third_party/WebKit/Source/core/events/CompositionEvent.cpp43
-rw-r--r--chromium/third_party/WebKit/Source/core/events/CompositionEvent.h30
-rw-r--r--chromium/third_party/WebKit/Source/core/events/CompositionEvent.idl5
-rw-r--r--chromium/third_party/WebKit/Source/core/events/CustomEvent.cpp6
-rw-r--r--chromium/third_party/WebKit/Source/core/events/CustomEvent.h14
-rw-r--r--chromium/third_party/WebKit/Source/core/events/DOMWindowEventQueue.cpp55
-rw-r--r--chromium/third_party/WebKit/Source/core/events/DOMWindowEventQueue.h20
-rw-r--r--chromium/third_party/WebKit/Source/core/events/ErrorEvent.cpp12
-rw-r--r--chromium/third_party/WebKit/Source/core/events/ErrorEvent.h26
-rw-r--r--chromium/third_party/WebKit/Source/core/events/Event.cpp74
-rw-r--r--chromium/third_party/WebKit/Source/core/events/Event.h63
-rw-r--r--chromium/third_party/WebKit/Source/core/events/Event.idl13
-rw-r--r--chromium/third_party/WebKit/Source/core/events/EventAliases.in2
-rw-r--r--chromium/third_party/WebKit/Source/core/events/EventContext.h117
-rw-r--r--chromium/third_party/WebKit/Source/core/events/EventDispatchMediator.cpp11
-rw-r--r--chromium/third_party/WebKit/Source/core/events/EventDispatchMediator.h12
-rw-r--r--chromium/third_party/WebKit/Source/core/events/EventDispatcher.cpp37
-rw-r--r--chromium/third_party/WebKit/Source/core/events/EventDispatcher.h23
-rw-r--r--chromium/third_party/WebKit/Source/core/events/EventFactory.h19
-rw-r--r--chromium/third_party/WebKit/Source/core/events/EventListener.h2
-rw-r--r--chromium/third_party/WebKit/Source/core/events/EventListenerMap.h1
-rw-r--r--chromium/third_party/WebKit/Source/core/events/EventPath.cpp305
-rw-r--r--chromium/third_party/WebKit/Source/core/events/EventPath.h58
-rw-r--r--chromium/third_party/WebKit/Source/core/events/EventQueue.h6
-rw-r--r--chromium/third_party/WebKit/Source/core/events/EventRetargeter.cpp187
-rw-r--r--chromium/third_party/WebKit/Source/core/events/EventRetargeter.h64
-rw-r--r--chromium/third_party/WebKit/Source/core/events/EventSender.h12
-rw-r--r--chromium/third_party/WebKit/Source/core/events/EventTarget.cpp98
-rw-r--r--chromium/third_party/WebKit/Source/core/events/EventTarget.h130
-rw-r--r--chromium/third_party/WebKit/Source/core/events/EventTarget.idl11
-rw-r--r--chromium/third_party/WebKit/Source/core/events/EventTargetFactory.in34
-rw-r--r--chromium/third_party/WebKit/Source/core/events/EventTypeNames.in19
-rw-r--r--chromium/third_party/WebKit/Source/core/events/FocusEvent.cpp44
-rw-r--r--chromium/third_party/WebKit/Source/core/events/FocusEvent.h50
-rw-r--r--chromium/third_party/WebKit/Source/core/events/GenericEventQueue.cpp38
-rw-r--r--chromium/third_party/WebKit/Source/core/events/GenericEventQueue.h15
-rw-r--r--chromium/third_party/WebKit/Source/core/events/GestureEvent.cpp38
-rw-r--r--chromium/third_party/WebKit/Source/core/events/GestureEvent.h21
-rw-r--r--chromium/third_party/WebKit/Source/core/events/HashChangeEvent.h19
-rw-r--r--chromium/third_party/WebKit/Source/core/events/KeyboardEvent.cpp15
-rw-r--r--chromium/third_party/WebKit/Source/core/events/KeyboardEvent.h36
-rw-r--r--chromium/third_party/WebKit/Source/core/events/MessageEvent.cpp28
-rw-r--r--chromium/third_party/WebKit/Source/core/events/MessageEvent.h60
-rw-r--r--chromium/third_party/WebKit/Source/core/events/MessageEvent.idl17
-rw-r--r--chromium/third_party/WebKit/Source/core/events/MouseEvent.cpp86
-rw-r--r--chromium/third_party/WebKit/Source/core/events/MouseEvent.h60
-rw-r--r--chromium/third_party/WebKit/Source/core/events/MouseEvent.idl8
-rw-r--r--chromium/third_party/WebKit/Source/core/events/MouseRelatedEvent.cpp34
-rw-r--r--chromium/third_party/WebKit/Source/core/events/MouseRelatedEvent.h19
-rw-r--r--chromium/third_party/WebKit/Source/core/events/MutationEvent.cpp12
-rw-r--r--chromium/third_party/WebKit/Source/core/events/MutationEvent.h21
-rw-r--r--chromium/third_party/WebKit/Source/core/events/NavigatorEvents.cpp6
-rw-r--r--chromium/third_party/WebKit/Source/core/events/NavigatorEvents.h2
-rw-r--r--chromium/third_party/WebKit/Source/core/events/NavigatorEvents.idl5
-rw-r--r--chromium/third_party/WebKit/Source/core/events/NodeEventContext.cpp72
-rw-r--r--chromium/third_party/WebKit/Source/core/events/NodeEventContext.h70
-rw-r--r--chromium/third_party/WebKit/Source/core/events/OverflowEvent.cpp11
-rw-r--r--chromium/third_party/WebKit/Source/core/events/OverflowEvent.h20
-rw-r--r--chromium/third_party/WebKit/Source/core/events/PageTransitionEvent.cpp7
-rw-r--r--chromium/third_party/WebKit/Source/core/events/PageTransitionEvent.h18
-rw-r--r--chromium/third_party/WebKit/Source/core/events/PopStateEvent.cpp27
-rw-r--r--chromium/third_party/WebKit/Source/core/events/PopStateEvent.h17
-rw-r--r--chromium/third_party/WebKit/Source/core/events/ProgressEvent.cpp7
-rw-r--r--chromium/third_party/WebKit/Source/core/events/ProgressEvent.h16
-rw-r--r--chromium/third_party/WebKit/Source/core/events/ResourceProgressEvent.cpp5
-rw-r--r--chromium/third_party/WebKit/Source/core/events/ResourceProgressEvent.h14
-rw-r--r--chromium/third_party/WebKit/Source/core/events/ScopedEventQueue.cpp6
-rw-r--r--chromium/third_party/WebKit/Source/core/events/ScopedEventQueue.h7
-rw-r--r--chromium/third_party/WebKit/Source/core/events/SecurityPolicyViolationEvent.h15
-rw-r--r--chromium/third_party/WebKit/Source/core/events/TextEvent.cpp34
-rw-r--r--chromium/third_party/WebKit/Source/core/events/TextEvent.h26
-rw-r--r--chromium/third_party/WebKit/Source/core/events/ThreadLocalEventNames.h10
-rw-r--r--chromium/third_party/WebKit/Source/core/events/TouchEvent.cpp51
-rw-r--r--chromium/third_party/WebKit/Source/core/events/TouchEvent.h57
-rw-r--r--chromium/third_party/WebKit/Source/core/events/TouchEvent.idl8
-rw-r--r--chromium/third_party/WebKit/Source/core/events/TouchEventContext.cpp (renamed from chromium/third_party/WebKit/Source/core/events/EventContext.cpp)60
-rw-r--r--chromium/third_party/WebKit/Source/core/events/TouchEventContext.h (renamed from chromium/third_party/WebKit/Source/core/events/BeforeLoadEvent.idl)41
-rw-r--r--chromium/third_party/WebKit/Source/core/events/TransitionEvent.cpp7
-rw-r--r--chromium/third_party/WebKit/Source/core/events/TransitionEvent.h18
-rw-r--r--chromium/third_party/WebKit/Source/core/events/TreeScopeEventContext.cpp97
-rw-r--r--chromium/third_party/WebKit/Source/core/events/TreeScopeEventContext.h120
-rw-r--r--chromium/third_party/WebKit/Source/core/events/UIEvent.cpp12
-rw-r--r--chromium/third_party/WebKit/Source/core/events/UIEvent.h30
-rw-r--r--chromium/third_party/WebKit/Source/core/events/UIEventWithKeyState.h2
-rw-r--r--chromium/third_party/WebKit/Source/core/events/WebKitAnimationEvent.cpp7
-rw-r--r--chromium/third_party/WebKit/Source/core/events/WebKitAnimationEvent.h18
-rw-r--r--chromium/third_party/WebKit/Source/core/events/WheelEvent.cpp22
-rw-r--r--chromium/third_party/WebKit/Source/core/events/WheelEvent.h32
-rw-r--r--chromium/third_party/WebKit/Source/core/events/WheelEvent.idl2
-rw-r--r--chromium/third_party/WebKit/Source/core/events/WindowEventContext.cpp12
-rw-r--r--chromium/third_party/WebKit/Source/core/events/WindowEventContext.h16
105 files changed, 2072 insertions, 1524 deletions
diff --git a/chromium/third_party/WebKit/Source/core/events/AnimationPlayerEvent.cpp b/chromium/third_party/WebKit/Source/core/events/AnimationPlayerEvent.cpp
new file mode 100644
index 00000000000..206e2c16b65
--- /dev/null
+++ b/chromium/third_party/WebKit/Source/core/events/AnimationPlayerEvent.cpp
@@ -0,0 +1,63 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/events/AnimationPlayerEvent.h"
+
+namespace WebCore {
+
+AnimationPlayerEventInit::AnimationPlayerEventInit()
+ : currentTime(0.0)
+ , timelineTime(0.0)
+{
+}
+
+AnimationPlayerEvent::AnimationPlayerEvent()
+ : m_currentTime(0.0)
+ , m_timelineTime(0.0)
+{
+ ScriptWrappable::init(this);
+}
+
+AnimationPlayerEvent::AnimationPlayerEvent(const AtomicString& type, double currentTime, double timelineTime)
+ : Event(type, false, false)
+ , m_currentTime(currentTime)
+ , m_timelineTime(timelineTime)
+{
+ ScriptWrappable::init(this);
+}
+
+AnimationPlayerEvent::AnimationPlayerEvent(const AtomicString& type, const AnimationPlayerEventInit& initializer)
+ : Event(type, initializer)
+ , m_currentTime(initializer.currentTime)
+ , m_timelineTime(initializer.timelineTime)
+{
+ ScriptWrappable::init(this);
+}
+
+AnimationPlayerEvent::~AnimationPlayerEvent()
+{
+}
+
+double AnimationPlayerEvent::currentTime() const
+{
+ return m_currentTime;
+}
+
+double AnimationPlayerEvent::timelineTime() const
+{
+ return m_timelineTime;
+}
+
+const AtomicString& AnimationPlayerEvent::interfaceName() const
+{
+ return EventNames::AnimationPlayerEvent;
+}
+
+void AnimationPlayerEvent::trace(Visitor* visitor)
+{
+ Event::trace(visitor);
+}
+
+} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/AnimationPlayerEvent.h b/chromium/third_party/WebKit/Source/core/events/AnimationPlayerEvent.h
new file mode 100644
index 00000000000..e19a85306c2
--- /dev/null
+++ b/chromium/third_party/WebKit/Source/core/events/AnimationPlayerEvent.h
@@ -0,0 +1,54 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef AnimationPlayerEvent_h
+#define AnimationPlayerEvent_h
+
+#include "core/events/Event.h"
+
+namespace WebCore {
+
+struct AnimationPlayerEventInit : public EventInit {
+ AnimationPlayerEventInit();
+
+ double currentTime;
+ double timelineTime;
+};
+
+class AnimationPlayerEvent FINAL : public Event {
+public:
+ static PassRefPtrWillBeRawPtr<AnimationPlayerEvent> create()
+ {
+ return adoptRefWillBeNoop(new AnimationPlayerEvent);
+ }
+ static PassRefPtrWillBeRawPtr<AnimationPlayerEvent> create(const AtomicString& type, double currentTime, double timelineTime)
+ {
+ return adoptRefWillBeNoop(new AnimationPlayerEvent(type, currentTime, timelineTime));
+ }
+ static PassRefPtrWillBeRawPtr<AnimationPlayerEvent> create(const AtomicString& type, const AnimationPlayerEventInit& initializer)
+ {
+ return adoptRefWillBeNoop(new AnimationPlayerEvent(type, initializer));
+ }
+
+ virtual ~AnimationPlayerEvent();
+
+ double currentTime() const;
+ double timelineTime() const;
+
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+
+ virtual void trace(Visitor*) OVERRIDE;
+
+private:
+ AnimationPlayerEvent();
+ AnimationPlayerEvent(const AtomicString& type, double currentTime, double timelineTime);
+ AnimationPlayerEvent(const AtomicString&, const AnimationPlayerEventInit&);
+
+ double m_currentTime;
+ double m_timelineTime;
+};
+
+} // namespace WebCore
+
+#endif // AnimationPlayerEvent_h
diff --git a/chromium/third_party/WebKit/Source/core/events/AnimationPlayerEvent.idl b/chromium/third_party/WebKit/Source/core/events/AnimationPlayerEvent.idl
new file mode 100644
index 00000000000..a719ec75f0c
--- /dev/null
+++ b/chromium/third_party/WebKit/Source/core/events/AnimationPlayerEvent.idl
@@ -0,0 +1,12 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+[
+ EventConstructor,
+ RuntimeEnabled=WebAnimationsAPI,
+] interface AnimationPlayerEvent : Event {
+ [InitializedByEventConstructor] readonly attribute double currentTime;
+ [InitializedByEventConstructor] readonly attribute double timelineTime;
+};
+
diff --git a/chromium/third_party/WebKit/Source/core/events/ApplicationCacheErrorEvent.cpp b/chromium/third_party/WebKit/Source/core/events/ApplicationCacheErrorEvent.cpp
new file mode 100644
index 00000000000..2125f5afa14
--- /dev/null
+++ b/chromium/third_party/WebKit/Source/core/events/ApplicationCacheErrorEvent.cpp
@@ -0,0 +1,82 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/events/ApplicationCacheErrorEvent.h"
+
+namespace WebCore {
+
+static const String& errorReasonToString(blink::WebApplicationCacheHost::ErrorReason reason)
+{
+ DEFINE_STATIC_LOCAL(String, errorManifest, ("manifest"));
+ DEFINE_STATIC_LOCAL(String, errorSignature, ("signature"));
+ DEFINE_STATIC_LOCAL(String, errorResource, ("resource"));
+ DEFINE_STATIC_LOCAL(String, errorChanged, ("changed"));
+ DEFINE_STATIC_LOCAL(String, errorAbort, ("abort"));
+ DEFINE_STATIC_LOCAL(String, errorQuota, ("quota"));
+ DEFINE_STATIC_LOCAL(String, errorPolicy, ("policy"));
+ DEFINE_STATIC_LOCAL(String, errorUnknown, ("unknown"));
+
+ switch (reason) {
+ case blink::WebApplicationCacheHost::ManifestError:
+ return errorManifest;
+ case blink::WebApplicationCacheHost::SignatureError:
+ return errorSignature;
+ case blink::WebApplicationCacheHost::ResourceError:
+ return errorResource;
+ case blink::WebApplicationCacheHost::ChangedError:
+ return errorChanged;
+ case blink::WebApplicationCacheHost::AbortError:
+ return errorAbort;
+ case blink::WebApplicationCacheHost::QuotaError:
+ return errorQuota;
+ case blink::WebApplicationCacheHost::PolicyError:
+ return errorPolicy;
+ case blink::WebApplicationCacheHost::UnknownError:
+ return errorUnknown;
+ }
+ ASSERT_NOT_REACHED();
+ return emptyString();
+}
+
+ApplicationCacheErrorEventInit::ApplicationCacheErrorEventInit()
+ : status(0)
+{
+}
+
+ApplicationCacheErrorEvent::ApplicationCacheErrorEvent()
+{
+ ScriptWrappable::init(this);
+}
+
+ApplicationCacheErrorEvent::ApplicationCacheErrorEvent(blink::WebApplicationCacheHost::ErrorReason reason, const String& url, int status, const String& message)
+ : Event(EventTypeNames::error, false, false)
+ , m_reason(errorReasonToString(reason))
+ , m_url(url)
+ , m_status(status)
+ , m_message(message)
+{
+ ScriptWrappable::init(this);
+}
+
+ApplicationCacheErrorEvent::ApplicationCacheErrorEvent(const AtomicString& eventType, const ApplicationCacheErrorEventInit& initializer)
+ : Event(eventType, initializer)
+ , m_reason(initializer.reason)
+ , m_url(initializer.url)
+ , m_status(initializer.status)
+ , m_message(initializer.message)
+{
+ ScriptWrappable::init(this);
+}
+
+ApplicationCacheErrorEvent::~ApplicationCacheErrorEvent()
+{
+}
+
+void ApplicationCacheErrorEvent::trace(Visitor* visitor)
+{
+ Event::trace(visitor);
+}
+
+} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/ApplicationCacheErrorEvent.h b/chromium/third_party/WebKit/Source/core/events/ApplicationCacheErrorEvent.h
new file mode 100644
index 00000000000..9ccad7eee31
--- /dev/null
+++ b/chromium/third_party/WebKit/Source/core/events/ApplicationCacheErrorEvent.h
@@ -0,0 +1,66 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ApplicationCacheErrorEvent_h
+#define ApplicationCacheErrorEvent_h
+
+#include "core/events/Event.h"
+#include "core/loader/appcache/ApplicationCacheHost.h"
+#include "public/platform/WebApplicationCacheHostClient.h"
+
+namespace WebCore {
+
+class ApplicationCacheErrorEvent;
+
+struct ApplicationCacheErrorEventInit : public EventInit {
+ ApplicationCacheErrorEventInit();
+
+ String reason;
+ String url;
+ int status;
+ String message;
+};
+
+class ApplicationCacheErrorEvent FINAL : public Event {
+public:
+ virtual ~ApplicationCacheErrorEvent();
+
+ static PassRefPtrWillBeRawPtr<ApplicationCacheErrorEvent> create()
+ {
+ return adoptRefWillBeNoop(new ApplicationCacheErrorEvent);
+ }
+
+ static PassRefPtrWillBeRawPtr<ApplicationCacheErrorEvent> create(blink::WebApplicationCacheHost::ErrorReason reason, const String& url, int status, const String& message)
+ {
+ return adoptRefWillBeNoop(new ApplicationCacheErrorEvent(reason, url, status, message));
+ }
+
+ static PassRefPtrWillBeRawPtr<ApplicationCacheErrorEvent> create(const AtomicString& eventType, const ApplicationCacheErrorEventInit& initializer)
+ {
+ return adoptRefWillBeNoop(new ApplicationCacheErrorEvent(eventType, initializer));
+ }
+
+ const String& reason() const { return m_reason; }
+ const String& url() const { return m_url; }
+ int status() const { return m_status; }
+ const String& message() const { return m_message; }
+
+ virtual const AtomicString& interfaceName() const OVERRIDE { return EventNames::ApplicationCacheErrorEvent; }
+
+ virtual void trace(Visitor*) OVERRIDE;
+
+private:
+ ApplicationCacheErrorEvent();
+ ApplicationCacheErrorEvent(blink::WebApplicationCacheHost::ErrorReason, const String& url, int status, const String& message);
+ ApplicationCacheErrorEvent(const AtomicString& eventType, const ApplicationCacheErrorEventInit& initializer);
+
+ String m_reason;
+ String m_url;
+ int m_status;
+ String m_message;
+};
+
+} // namespace WebCore
+
+#endif // ApplicationCacheErrorEvent_h
diff --git a/chromium/third_party/WebKit/Source/core/events/ApplicationCacheErrorEvent.idl b/chromium/third_party/WebKit/Source/core/events/ApplicationCacheErrorEvent.idl
new file mode 100644
index 00000000000..c69c3f7fe97
--- /dev/null
+++ b/chromium/third_party/WebKit/Source/core/events/ApplicationCacheErrorEvent.idl
@@ -0,0 +1,12 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+[
+ EventConstructor,
+] interface ApplicationCacheErrorEvent : Event {
+ [InitializedByEventConstructor] readonly attribute DOMString reason;
+ [InitializedByEventConstructor] readonly attribute DOMString url;
+ [InitializedByEventConstructor] readonly attribute unsigned short status;
+ [InitializedByEventConstructor] readonly attribute DOMString message;
+};
diff --git a/chromium/third_party/WebKit/Source/core/events/AutocompleteErrorEvent.h b/chromium/third_party/WebKit/Source/core/events/AutocompleteErrorEvent.h
index 1eed01deb6f..ba4cefe9ae5 100644
--- a/chromium/third_party/WebKit/Source/core/events/AutocompleteErrorEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/AutocompleteErrorEvent.h
@@ -26,7 +26,6 @@
#define AutocompleteErrorEvent_h
#include "core/events/Event.h"
-#include "core/events/ThreadLocalEventNames.h"
namespace WebCore {
@@ -34,26 +33,28 @@ struct AutocompleteErrorEventInit : public EventInit {
String reason;
};
-class AutocompleteErrorEvent : public Event {
+class AutocompleteErrorEvent FINAL : public Event {
public:
- static PassRefPtr<AutocompleteErrorEvent> create()
+ static PassRefPtrWillBeRawPtr<AutocompleteErrorEvent> create()
{
- return adoptRef(new AutocompleteErrorEvent);
+ return adoptRefWillBeNoop(new AutocompleteErrorEvent);
}
- static PassRefPtr<AutocompleteErrorEvent> create(const String& reason)
+ static PassRefPtrWillBeRawPtr<AutocompleteErrorEvent> create(const String& reason)
{
- return adoptRef(new AutocompleteErrorEvent(reason));
+ return adoptRefWillBeNoop(new AutocompleteErrorEvent(reason));
}
- static PassRefPtr<AutocompleteErrorEvent> create(const AtomicString& eventType, const AutocompleteErrorEventInit& initializer)
+ static PassRefPtrWillBeRawPtr<AutocompleteErrorEvent> create(const AtomicString& eventType, const AutocompleteErrorEventInit& initializer)
{
- return adoptRef(new AutocompleteErrorEvent(eventType, initializer));
+ return adoptRefWillBeNoop(new AutocompleteErrorEvent(eventType, initializer));
}
const String& reason() const { return m_reason; }
- virtual const AtomicString& interfaceName() const { return EventNames::AutocompleteErrorEvent; }
+ virtual const AtomicString& interfaceName() const OVERRIDE { return EventNames::AutocompleteErrorEvent; }
+
+ virtual void trace(Visitor* visitor) OVERRIDE { Event::trace(visitor); }
private:
AutocompleteErrorEvent()
@@ -62,7 +63,7 @@ private:
}
AutocompleteErrorEvent(const String& reason)
- : Event(EventTypeNames::autocompleteerror, false, false)
+ : Event(EventTypeNames::autocompleteerror, true, false)
, m_reason(reason)
{
ScriptWrappable::init(this);
diff --git a/chromium/third_party/WebKit/Source/core/events/BeforeLoadEvent.h b/chromium/third_party/WebKit/Source/core/events/BeforeLoadEvent.h
deleted file mode 100644
index f52c5377f2a..00000000000
--- a/chromium/third_party/WebKit/Source/core/events/BeforeLoadEvent.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2009 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef BeforeLoadEvent_h
-#define BeforeLoadEvent_h
-
-#include "core/events/Event.h"
-#include "core/events/ThreadLocalEventNames.h"
-
-namespace WebCore {
-
-struct BeforeLoadEventInit : public EventInit {
- BeforeLoadEventInit()
- {
- };
-
- String url;
-};
-
-class BeforeLoadEvent : public Event {
-public:
- static PassRefPtr<BeforeLoadEvent> create()
- {
- return adoptRef(new BeforeLoadEvent);
- }
-
- static PassRefPtr<BeforeLoadEvent> create(const String& url)
- {
- return adoptRef(new BeforeLoadEvent(url));
- }
-
- static PassRefPtr<BeforeLoadEvent> create(const AtomicString& type, const BeforeLoadEventInit& initializer)
- {
- return adoptRef(new BeforeLoadEvent(type, initializer));
- }
-
- const String& url() const { return m_url; }
-
- virtual const AtomicString& interfaceName() const { return EventNames::BeforeLoadEvent; }
-
-private:
- BeforeLoadEvent()
- {
- ScriptWrappable::init(this);
- }
-
- explicit BeforeLoadEvent(const String& url)
- : Event(EventTypeNames::beforeload, false, true)
- , m_url(url)
- {
- ScriptWrappable::init(this);
- }
-
- BeforeLoadEvent(const AtomicString& type, const BeforeLoadEventInit& initializer)
- : Event(type, initializer)
- , m_url(initializer.url)
- {
- ScriptWrappable::init(this);
- }
-
- String m_url;
-};
-
-} // namespace WebCore
-
-#endif // BeforeLoadEvent_h
diff --git a/chromium/third_party/WebKit/Source/core/events/BeforeTextInsertedEvent.cpp b/chromium/third_party/WebKit/Source/core/events/BeforeTextInsertedEvent.cpp
index fc0ed37f5d1..c092ac1d222 100644
--- a/chromium/third_party/WebKit/Source/core/events/BeforeTextInsertedEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/BeforeTextInsertedEvent.cpp
@@ -26,8 +26,6 @@
#include "config.h"
#include "core/events/BeforeTextInsertedEvent.h"
-#include "core/events/ThreadLocalEventNames.h"
-
namespace WebCore {
BeforeTextInsertedEvent::BeforeTextInsertedEvent(const String& text)
@@ -45,4 +43,9 @@ const AtomicString& BeforeTextInsertedEvent::interfaceName() const
return EventNames::Event;
}
+void BeforeTextInsertedEvent::trace(Visitor* visitor)
+{
+ Event::trace(visitor);
+}
+
}
diff --git a/chromium/third_party/WebKit/Source/core/events/BeforeTextInsertedEvent.h b/chromium/third_party/WebKit/Source/core/events/BeforeTextInsertedEvent.h
index 546c4fb7364..d92dbb9232e 100644
--- a/chromium/third_party/WebKit/Source/core/events/BeforeTextInsertedEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/BeforeTextInsertedEvent.h
@@ -30,21 +30,23 @@
namespace WebCore {
-class BeforeTextInsertedEvent : public Event {
+class BeforeTextInsertedEvent FINAL : public Event {
public:
virtual ~BeforeTextInsertedEvent();
- static PassRefPtr<BeforeTextInsertedEvent> create(const String& text)
+ static PassRefPtrWillBeRawPtr<BeforeTextInsertedEvent> create(const String& text)
{
- return adoptRef(new BeforeTextInsertedEvent(text));
+ return adoptRefWillBeNoop(new BeforeTextInsertedEvent(text));
}
- virtual const AtomicString& interfaceName() const;
- virtual bool isBeforeTextInsertedEvent() const { return true; }
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+ virtual bool isBeforeTextInsertedEvent() const OVERRIDE { return true; }
const String& text() const { return m_text; }
void setText(const String& s) { m_text = s; }
+ virtual void trace(Visitor*) OVERRIDE;
+
private:
explicit BeforeTextInsertedEvent(const String&);
diff --git a/chromium/third_party/WebKit/Source/core/events/BeforeUnloadEvent.cpp b/chromium/third_party/WebKit/Source/core/events/BeforeUnloadEvent.cpp
index 15dd1ad9520..06993cd557d 100644
--- a/chromium/third_party/WebKit/Source/core/events/BeforeUnloadEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/BeforeUnloadEvent.cpp
@@ -42,4 +42,9 @@ bool BeforeUnloadEvent::isBeforeUnloadEvent() const
return true;
}
+void BeforeUnloadEvent::trace(Visitor* visitor)
+{
+ Event::trace(visitor);
+}
+
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/BeforeUnloadEvent.h b/chromium/third_party/WebKit/Source/core/events/BeforeUnloadEvent.h
index 57136f92ae8..5c5b4f90edb 100644
--- a/chromium/third_party/WebKit/Source/core/events/BeforeUnloadEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/BeforeUnloadEvent.h
@@ -26,17 +26,16 @@
#define BeforeUnloadEvent_h
#include "core/events/Event.h"
-#include "core/events/ThreadLocalEventNames.h"
namespace WebCore {
-class BeforeUnloadEvent : public Event {
+class BeforeUnloadEvent FINAL : public Event {
public:
virtual ~BeforeUnloadEvent();
- static PassRefPtr<BeforeUnloadEvent> create()
+ static PassRefPtrWillBeRawPtr<BeforeUnloadEvent> create()
{
- return adoptRef(new BeforeUnloadEvent);
+ return adoptRefWillBeNoop(new BeforeUnloadEvent);
}
virtual bool isBeforeUnloadEvent() const OVERRIDE;
@@ -46,6 +45,8 @@ public:
virtual const AtomicString& interfaceName() const OVERRIDE { return EventNames::BeforeUnloadEvent; }
+ virtual void trace(Visitor*) OVERRIDE;
+
private:
BeforeUnloadEvent();
diff --git a/chromium/third_party/WebKit/Source/core/events/ClipboardEvent.cpp b/chromium/third_party/WebKit/Source/core/events/ClipboardEvent.cpp
index a8fa4f96699..72d5b1867b3 100644
--- a/chromium/third_party/WebKit/Source/core/events/ClipboardEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/ClipboardEvent.cpp
@@ -23,8 +23,7 @@
#include "config.h"
#include "core/events/ClipboardEvent.h"
-#include "core/dom/Clipboard.h"
-#include "core/events/ThreadLocalEventNames.h"
+#include "core/clipboard/Clipboard.h"
namespace WebCore {
@@ -32,7 +31,7 @@ ClipboardEvent::ClipboardEvent()
{
}
-ClipboardEvent::ClipboardEvent(const AtomicString& eventType, bool canBubble, bool cancelable, PassRefPtr<Clipboard> clipboard)
+ClipboardEvent::ClipboardEvent(const AtomicString& eventType, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<Clipboard> clipboard)
: Event(eventType, canBubble, cancelable), m_clipboard(clipboard)
{
}
@@ -52,4 +51,10 @@ bool ClipboardEvent::isClipboardEvent() const
return true;
}
+void ClipboardEvent::trace(Visitor* visitor)
+{
+ visitor->trace(m_clipboard);
+ Event::trace(visitor);
+}
+
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/ClipboardEvent.h b/chromium/third_party/WebKit/Source/core/events/ClipboardEvent.h
index 671315b39f5..15eb8f4b56c 100644
--- a/chromium/third_party/WebKit/Source/core/events/ClipboardEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/ClipboardEvent.h
@@ -30,29 +30,27 @@ namespace WebCore {
class Clipboard;
- class ClipboardEvent : public Event {
+ class ClipboardEvent FINAL : public Event {
public:
virtual ~ClipboardEvent();
- static PassRefPtr<ClipboardEvent> create()
+ static PassRefPtrWillBeRawPtr<ClipboardEvent> create(const AtomicString& type, bool canBubbleArg, bool cancelableArg, PassRefPtrWillBeRawPtr<Clipboard> clipboardArg)
{
- return adoptRef(new ClipboardEvent);
- }
- static PassRefPtr<ClipboardEvent> create(const AtomicString& type, bool canBubbleArg, bool cancelableArg, PassRefPtr<Clipboard> clipboardArg)
- {
- return adoptRef(new ClipboardEvent(type, canBubbleArg, cancelableArg, clipboardArg));
+ return adoptRefWillBeNoop(new ClipboardEvent(type, canBubbleArg, cancelableArg, clipboardArg));
}
Clipboard* clipboard() const { return m_clipboard.get(); }
+ virtual void trace(Visitor*) OVERRIDE;
+
private:
ClipboardEvent();
- ClipboardEvent(const AtomicString& type, bool canBubbleArg, bool cancelableArg, PassRefPtr<Clipboard>);
+ ClipboardEvent(const AtomicString& type, bool canBubbleArg, bool cancelableArg, PassRefPtrWillBeRawPtr<Clipboard>);
virtual const AtomicString& interfaceName() const OVERRIDE;
virtual bool isClipboardEvent() const OVERRIDE;
- RefPtr<Clipboard> m_clipboard;
+ RefPtrWillBeMember<Clipboard> m_clipboard;
};
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/CompositionEvent.cpp b/chromium/third_party/WebKit/Source/core/events/CompositionEvent.cpp
index f4ecff6596f..ce1b9f7e983 100644
--- a/chromium/third_party/WebKit/Source/core/events/CompositionEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/CompositionEvent.cpp
@@ -27,8 +27,6 @@
#include "config.h"
#include "core/events/CompositionEvent.h"
-#include "core/events/ThreadLocalEventNames.h"
-
namespace WebCore {
CompositionEventInit::CompositionEventInit()
@@ -36,29 +34,38 @@ CompositionEventInit::CompositionEventInit()
}
CompositionEvent::CompositionEvent()
+ : m_activeSegmentStart(0)
+ , m_activeSegmentEnd(0)
{
ScriptWrappable::init(this);
+ initializeSegments();
}
-CompositionEvent::CompositionEvent(const AtomicString& type, PassRefPtr<AbstractView> view, const String& data)
+CompositionEvent::CompositionEvent(const AtomicString& type, PassRefPtrWillBeRawPtr<AbstractView> view, const String& data, const Vector<CompositionUnderline>& underlines)
: UIEvent(type, true, true, view, 0)
, m_data(data)
+ , m_activeSegmentStart(0)
+ , m_activeSegmentEnd(0)
{
ScriptWrappable::init(this);
+ initializeSegments(&underlines);
}
CompositionEvent::CompositionEvent(const AtomicString& type, const CompositionEventInit& initializer)
: UIEvent(type, initializer)
, m_data(initializer.data)
+ , m_activeSegmentStart(0)
+ , m_activeSegmentEnd(0)
{
ScriptWrappable::init(this);
+ initializeSegments();
}
CompositionEvent::~CompositionEvent()
{
}
-void CompositionEvent::initCompositionEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view, const String& data)
+void CompositionEvent::initCompositionEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view, const String& data)
{
if (dispatched())
return;
@@ -66,6 +73,29 @@ void CompositionEvent::initCompositionEvent(const AtomicString& type, bool canBu
initUIEvent(type, canBubble, cancelable, view, 0);
m_data = data;
+ initializeSegments();
+}
+
+void CompositionEvent::initializeSegments(const Vector<CompositionUnderline>* underlines)
+{
+ m_activeSegmentStart = 0;
+ m_activeSegmentEnd = m_data.length();
+
+ if (!underlines || !underlines->size()) {
+ m_segments.append(0);
+ return;
+ }
+
+ for (size_t i = 0; i < underlines->size(); ++i) {
+ if (underlines->at(i).thick) {
+ m_activeSegmentStart = underlines->at(i).startOffset;
+ m_activeSegmentEnd = underlines->at(i).endOffset;
+ break;
+ }
+ }
+
+ for (size_t i = 0; i < underlines->size(); ++i)
+ m_segments.append(underlines->at(i).startOffset);
}
const AtomicString& CompositionEvent::interfaceName() const
@@ -73,4 +103,9 @@ const AtomicString& CompositionEvent::interfaceName() const
return EventNames::CompositionEvent;
}
+void CompositionEvent::trace(Visitor* visitor)
+{
+ UIEvent::trace(visitor);
+}
+
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/CompositionEvent.h b/chromium/third_party/WebKit/Source/core/events/CompositionEvent.h
index c06da88c196..662f0596a3d 100644
--- a/chromium/third_party/WebKit/Source/core/events/CompositionEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/CompositionEvent.h
@@ -27,6 +27,7 @@
#ifndef CompositionEvent_h
#define CompositionEvent_h
+#include "core/editing/CompositionUnderline.h"
#include "core/events/UIEvent.h"
namespace WebCore {
@@ -37,37 +38,46 @@ struct CompositionEventInit : UIEventInit {
String data;
};
-class CompositionEvent : public UIEvent {
+class CompositionEvent FINAL : public UIEvent {
public:
- static PassRefPtr<CompositionEvent> create()
+ static PassRefPtrWillBeRawPtr<CompositionEvent> create()
{
- return adoptRef(new CompositionEvent);
+ return adoptRefWillBeNoop(new CompositionEvent);
}
- static PassRefPtr<CompositionEvent> create(const AtomicString& type, PassRefPtr<AbstractView> view, const String& data)
+ static PassRefPtrWillBeRawPtr<CompositionEvent> create(const AtomicString& type, PassRefPtrWillBeRawPtr<AbstractView> view, const String& data, const Vector<CompositionUnderline>& underlines)
{
- return adoptRef(new CompositionEvent(type, view, data));
+ return adoptRefWillBeNoop(new CompositionEvent(type, view, data, underlines));
}
- static PassRefPtr<CompositionEvent> create(const AtomicString& type, const CompositionEventInit& initializer)
+ static PassRefPtrWillBeRawPtr<CompositionEvent> create(const AtomicString& type, const CompositionEventInit& initializer)
{
- return adoptRef(new CompositionEvent(type, initializer));
+ return adoptRefWillBeNoop(new CompositionEvent(type, initializer));
}
virtual ~CompositionEvent();
- void initCompositionEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, const String& data);
+ void initCompositionEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>, const String& data);
String data() const { return m_data; }
+ int activeSegmentStart() const { return m_activeSegmentStart; }
+ int activeSegmentEnd() const { return m_activeSegmentEnd; }
+ const Vector<unsigned>& getSegments() const { return m_segments; }
- virtual const AtomicString& interfaceName() const;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+
+ virtual void trace(Visitor*) OVERRIDE;
private:
CompositionEvent();
- CompositionEvent(const AtomicString& type, PassRefPtr<AbstractView>, const String&);
+ CompositionEvent(const AtomicString& type, PassRefPtrWillBeRawPtr<AbstractView>, const String&, const Vector<CompositionUnderline>& underlines);
CompositionEvent(const AtomicString& type, const CompositionEventInit&);
+ void initializeSegments(const Vector<CompositionUnderline>* = 0);
String m_data;
+ int m_activeSegmentStart;
+ int m_activeSegmentEnd;
+ Vector<unsigned> m_segments;
};
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/CompositionEvent.idl b/chromium/third_party/WebKit/Source/core/events/CompositionEvent.idl
index 4e14a952281..8b1d740fd68 100644
--- a/chromium/third_party/WebKit/Source/core/events/CompositionEvent.idl
+++ b/chromium/third_party/WebKit/Source/core/events/CompositionEvent.idl
@@ -29,6 +29,10 @@
[InitializedByEventConstructor] readonly attribute DOMString data;
+ [RuntimeEnabled=IMEAPI] readonly attribute long activeSegmentStart;
+ [RuntimeEnabled=IMEAPI] readonly attribute long activeSegmentEnd;
+ [RuntimeEnabled=IMEAPI] sequence<unsigned long> getSegments();
+
void initCompositionEvent([Default=Undefined] optional DOMString typeArg,
[Default=Undefined] optional boolean canBubbleArg,
[Default=Undefined] optional boolean cancelableArg,
@@ -36,4 +40,3 @@
[Default=Undefined] optional DOMString dataArg);
};
-
diff --git a/chromium/third_party/WebKit/Source/core/events/CustomEvent.cpp b/chromium/third_party/WebKit/Source/core/events/CustomEvent.cpp
index ea3ac91b9e3..deb3aba5c2e 100644
--- a/chromium/third_party/WebKit/Source/core/events/CustomEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/CustomEvent.cpp
@@ -27,7 +27,6 @@
#include "core/events/CustomEvent.h"
#include "bindings/v8/SerializedScriptValue.h"
-#include "core/events/ThreadLocalEventNames.h"
namespace WebCore {
@@ -61,4 +60,9 @@ const AtomicString& CustomEvent::interfaceName() const
return EventNames::CustomEvent;
}
+void CustomEvent::trace(Visitor* visitor)
+{
+ Event::trace(visitor);
+}
+
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/CustomEvent.h b/chromium/third_party/WebKit/Source/core/events/CustomEvent.h
index 9be0e119aa7..5340f75431b 100644
--- a/chromium/third_party/WebKit/Source/core/events/CustomEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/CustomEvent.h
@@ -34,23 +34,23 @@ class SerializedScriptValue;
typedef EventInit CustomEventInit;
-class CustomEvent : public Event {
+class CustomEvent FINAL : public Event {
public:
virtual ~CustomEvent();
- static PassRefPtr<CustomEvent> create()
+ static PassRefPtrWillBeRawPtr<CustomEvent> create()
{
- return adoptRef(new CustomEvent);
+ return adoptRefWillBeNoop(new CustomEvent);
}
- static PassRefPtr<CustomEvent> create(const AtomicString& type, const CustomEventInit& initializer)
+ static PassRefPtrWillBeRawPtr<CustomEvent> create(const AtomicString& type, const CustomEventInit& initializer)
{
- return adoptRef(new CustomEvent(type, initializer));
+ return adoptRefWillBeNoop(new CustomEvent(type, initializer));
}
void initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue>);
- virtual const AtomicString& interfaceName() const;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
SerializedScriptValue* serializedDetail() { return m_serializedDetail.get(); }
@@ -60,6 +60,8 @@ public:
m_serializedDetail = detail;
}
+ virtual void trace(Visitor*) OVERRIDE;
+
private:
CustomEvent();
CustomEvent(const AtomicString& type, const CustomEventInit& initializer);
diff --git a/chromium/third_party/WebKit/Source/core/events/DOMWindowEventQueue.cpp b/chromium/third_party/WebKit/Source/core/events/DOMWindowEventQueue.cpp
index e18530c72a0..bd0be9936c9 100644
--- a/chromium/third_party/WebKit/Source/core/events/DOMWindowEventQueue.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/DOMWindowEventQueue.cpp
@@ -29,31 +29,33 @@
#include "core/dom/Document.h"
#include "core/events/Event.h"
-#include "core/events/ThreadLocalEventNames.h"
-#include "core/frame/DOMWindow.h"
+#include "core/frame/LocalDOMWindow.h"
#include "core/frame/SuspendableTimer.h"
+#include "core/inspector/InspectorInstrumentation.h"
namespace WebCore {
-class DOMWindowEventQueueTimer : public SuspendableTimer {
+class DOMWindowEventQueueTimer : public NoBaseWillBeGarbageCollectedFinalized<DOMWindowEventQueueTimer>, public SuspendableTimer {
WTF_MAKE_NONCOPYABLE(DOMWindowEventQueueTimer);
public:
DOMWindowEventQueueTimer(DOMWindowEventQueue* eventQueue, ExecutionContext* context)
: SuspendableTimer(context)
, m_eventQueue(eventQueue) { }
+ void trace(Visitor* visitor) { visitor->trace(m_eventQueue); }
private:
virtual void fired() { m_eventQueue->pendingEventTimerFired(); }
- DOMWindowEventQueue* m_eventQueue;
+
+ RawPtrWillBeMember<DOMWindowEventQueue> m_eventQueue;
};
-PassRefPtr<DOMWindowEventQueue> DOMWindowEventQueue::create(ExecutionContext* context)
+PassRefPtrWillBeRawPtr<DOMWindowEventQueue> DOMWindowEventQueue::create(ExecutionContext* context)
{
- return adoptRef(new DOMWindowEventQueue(context));
+ return adoptRefWillBeNoop(new DOMWindowEventQueue(context));
}
DOMWindowEventQueue::DOMWindowEventQueue(ExecutionContext* context)
- : m_pendingEventTimer(adoptPtr(new DOMWindowEventQueueTimer(this, context)))
+ : m_pendingEventTimer(adoptPtrWillBeNoop(new DOMWindowEventQueueTimer(this, context)))
, m_isClosed(false)
{
m_pendingEventTimer->suspendIfNeeded();
@@ -63,27 +65,38 @@ DOMWindowEventQueue::~DOMWindowEventQueue()
{
}
-bool DOMWindowEventQueue::enqueueEvent(PassRefPtr<Event> event)
+void DOMWindowEventQueue::trace(Visitor* visitor)
+{
+ visitor->trace(m_pendingEventTimer);
+ visitor->trace(m_queuedEvents);
+ EventQueue::trace(visitor);
+}
+
+bool DOMWindowEventQueue::enqueueEvent(PassRefPtrWillBeRawPtr<Event> event)
{
if (m_isClosed)
return false;
ASSERT(event->target());
+ InspectorInstrumentation::didEnqueueEvent(event->target(), event.get());
+
bool wasAdded = m_queuedEvents.add(event).isNewEntry;
ASSERT_UNUSED(wasAdded, wasAdded); // It should not have already been in the list.
if (!m_pendingEventTimer->isActive())
- m_pendingEventTimer->startOneShot(0);
+ m_pendingEventTimer->startOneShot(0, FROM_HERE);
return true;
}
bool DOMWindowEventQueue::cancelEvent(Event* event)
{
- ListHashSet<RefPtr<Event>, 16>::iterator it = m_queuedEvents.find(event);
+ WillBeHeapListHashSet<RefPtrWillBeMember<Event>, 16>::iterator it = m_queuedEvents.find(event);
bool found = it != m_queuedEvents.end();
- if (found)
+ if (found) {
+ InspectorInstrumentation::didRemoveEvent(event->target(), event);
m_queuedEvents.remove(it);
+ }
if (m_queuedEvents.isEmpty())
m_pendingEventTimer->stop();
return found;
@@ -93,6 +106,11 @@ void DOMWindowEventQueue::close()
{
m_isClosed = true;
m_pendingEventTimer->stop();
+ if (InspectorInstrumentation::hasFrontends()) {
+ WillBeHeapListHashSet<RefPtrWillBeMember<Event>, 16>::iterator it = m_queuedEvents.begin();
+ for (; it != m_queuedEvents.end(); ++it)
+ InspectorInstrumentation::didRemoveEvent((*it)->target(), it->get());
+ }
m_queuedEvents.clear();
}
@@ -102,27 +120,28 @@ void DOMWindowEventQueue::pendingEventTimerFired()
ASSERT(!m_queuedEvents.isEmpty());
// Insert a marker for where we should stop.
- ASSERT(!m_queuedEvents.contains(0));
- bool wasAdded = m_queuedEvents.add(0).isNewEntry;
+ ASSERT(!m_queuedEvents.contains(nullptr));
+ bool wasAdded = m_queuedEvents.add(nullptr).isNewEntry;
ASSERT_UNUSED(wasAdded, wasAdded); // It should not have already been in the list.
- RefPtr<DOMWindowEventQueue> protector(this);
+ RefPtrWillBeRawPtr<DOMWindowEventQueue> protector(this);
while (!m_queuedEvents.isEmpty()) {
- ListHashSet<RefPtr<Event>, 16>::iterator iter = m_queuedEvents.begin();
- RefPtr<Event> event = *iter;
+ WillBeHeapListHashSet<RefPtrWillBeMember<Event>, 16>::iterator iter = m_queuedEvents.begin();
+ RefPtrWillBeRawPtr<Event> event = *iter;
m_queuedEvents.remove(iter);
if (!event)
break;
dispatchEvent(event.get());
+ InspectorInstrumentation::didRemoveEvent(event->target(), event.get());
}
}
-void DOMWindowEventQueue::dispatchEvent(PassRefPtr<Event> event)
+void DOMWindowEventQueue::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event)
{
EventTarget* eventTarget = event->target();
if (eventTarget->toDOMWindow())
- eventTarget->toDOMWindow()->dispatchEvent(event, 0);
+ eventTarget->toDOMWindow()->dispatchEvent(event, nullptr);
else
eventTarget->dispatchEvent(event);
}
diff --git a/chromium/third_party/WebKit/Source/core/events/DOMWindowEventQueue.h b/chromium/third_party/WebKit/Source/core/events/DOMWindowEventQueue.h
index f19e22b5d51..443f2876bc6 100644
--- a/chromium/third_party/WebKit/Source/core/events/DOMWindowEventQueue.h
+++ b/chromium/third_party/WebKit/Source/core/events/DOMWindowEventQueue.h
@@ -28,7 +28,6 @@
#define DOMWindowEventQueue_h
#include "core/events/EventQueue.h"
-#include "wtf/Forward.h"
#include "wtf/HashSet.h"
#include "wtf/ListHashSet.h"
#include "wtf/OwnPtr.h"
@@ -41,13 +40,20 @@ class DOMWindowEventQueueTimer;
class Node;
class ExecutionContext;
-class DOMWindowEventQueue : public RefCounted<DOMWindowEventQueue>, public EventQueue {
+#if ENABLE(OILPAN)
+#define DOMWINDOWEVENTQUEUE_BASE_CLASSES public EventQueue
+#else
+#define DOMWINDOWEVENTQUEUE_BASE_CLASSES public RefCounted<DOMWindowEventQueue>, public EventQueue
+#endif
+
+class DOMWindowEventQueue FINAL : DOMWINDOWEVENTQUEUE_BASE_CLASSES {
public:
- static PassRefPtr<DOMWindowEventQueue> create(ExecutionContext*);
+ static PassRefPtrWillBeRawPtr<DOMWindowEventQueue> create(ExecutionContext*);
virtual ~DOMWindowEventQueue();
// EventQueue
- virtual bool enqueueEvent(PassRefPtr<Event>) OVERRIDE;
+ virtual void trace(Visitor*) OVERRIDE;
+ virtual bool enqueueEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE;
virtual bool cancelEvent(Event*) OVERRIDE;
virtual void close() OVERRIDE;
@@ -55,10 +61,10 @@ private:
explicit DOMWindowEventQueue(ExecutionContext*);
void pendingEventTimerFired();
- void dispatchEvent(PassRefPtr<Event>);
+ void dispatchEvent(PassRefPtrWillBeRawPtr<Event>);
- OwnPtr<DOMWindowEventQueueTimer> m_pendingEventTimer;
- ListHashSet<RefPtr<Event>, 16> m_queuedEvents;
+ OwnPtrWillBeMember<DOMWindowEventQueueTimer> m_pendingEventTimer;
+ WillBeHeapListHashSet<RefPtrWillBeMember<Event>, 16> m_queuedEvents;
bool m_isClosed;
friend class DOMWindowEventQueueTimer;
diff --git a/chromium/third_party/WebKit/Source/core/events/ErrorEvent.cpp b/chromium/third_party/WebKit/Source/core/events/ErrorEvent.cpp
index 0bd32f4e9e2..ed95ff13afd 100644
--- a/chromium/third_party/WebKit/Source/core/events/ErrorEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/ErrorEvent.cpp
@@ -31,7 +31,8 @@
#include "config.h"
#include "core/events/ErrorEvent.h"
-#include "core/events/ThreadLocalEventNames.h"
+#include "bindings/v8/V8Binding.h"
+#include <v8.h>
namespace WebCore {
@@ -54,12 +55,12 @@ ErrorEvent::ErrorEvent(const AtomicString& type, const ErrorEventInit& initializ
, m_fileName(initializer.filename)
, m_lineNumber(initializer.lineno)
, m_columnNumber(initializer.colno)
- , m_world(DOMWrapperWorld::current())
+ , m_world(DOMWrapperWorld::current(v8::Isolate::GetCurrent()))
{
ScriptWrappable::init(this);
}
-ErrorEvent::ErrorEvent(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, PassRefPtr<DOMWrapperWorld> world)
+ErrorEvent::ErrorEvent(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, DOMWrapperWorld* world)
: Event(EventTypeNames::error, false, true)
, m_sanitizedMessage(message)
, m_fileName(fileName)
@@ -85,4 +86,9 @@ const AtomicString& ErrorEvent::interfaceName() const
return EventNames::ErrorEvent;
}
+void ErrorEvent::trace(Visitor* visitor)
+{
+ Event::trace(visitor);
+}
+
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/ErrorEvent.h b/chromium/third_party/WebKit/Source/core/events/ErrorEvent.h
index e0643e4895f..e0dbf837ee0 100644
--- a/chromium/third_party/WebKit/Source/core/events/ErrorEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/ErrorEvent.h
@@ -47,23 +47,23 @@ struct ErrorEventInit : public EventInit {
unsigned colno;
};
-class ErrorEvent : public Event {
+class ErrorEvent FINAL : public Event {
public:
- static PassRefPtr<ErrorEvent> create()
+ static PassRefPtrWillBeRawPtr<ErrorEvent> create()
{
- return adoptRef(new ErrorEvent);
+ return adoptRefWillBeNoop(new ErrorEvent);
}
- static PassRefPtr<ErrorEvent> create(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, PassRefPtr<DOMWrapperWorld> world)
+ static PassRefPtrWillBeRawPtr<ErrorEvent> create(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, DOMWrapperWorld* world)
{
- return adoptRef(new ErrorEvent(message, fileName, lineNumber, columnNumber, world));
+ return adoptRefWillBeNoop(new ErrorEvent(message, fileName, lineNumber, columnNumber, world));
}
- static PassRefPtr<ErrorEvent> create(const AtomicString& type, const ErrorEventInit& initializer)
+ static PassRefPtrWillBeRawPtr<ErrorEvent> create(const AtomicString& type, const ErrorEventInit& initializer)
{
- return adoptRef(new ErrorEvent(type, initializer));
+ return adoptRefWillBeNoop(new ErrorEvent(type, initializer));
}
- static PassRefPtr<ErrorEvent> createSanitizedError(PassRefPtr<DOMWrapperWorld> world)
+ static PassRefPtrWillBeRawPtr<ErrorEvent> createSanitizedError(DOMWrapperWorld* world)
{
- return adoptRef(new ErrorEvent("Script error.", String(), 0, 0, world));
+ return adoptRefWillBeNoop(new ErrorEvent("Script error.", String(), 0, 0, world));
}
virtual ~ErrorEvent();
@@ -76,15 +76,17 @@ public:
// 'messageForConsole' is not exposed to JavaScript, and prefers 'm_unsanitizedMessage'.
const String& messageForConsole() const { return !m_unsanitizedMessage.isEmpty() ? m_unsanitizedMessage : m_sanitizedMessage; }
- virtual const AtomicString& interfaceName() const;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
- PassRefPtr<DOMWrapperWorld> world() const { return m_world; }
+ DOMWrapperWorld* world() const { return m_world.get(); }
void setUnsanitizedMessage(const String&);
+ virtual void trace(Visitor*) OVERRIDE;
+
private:
ErrorEvent();
- ErrorEvent(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, PassRefPtr<DOMWrapperWorld>);
+ ErrorEvent(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, DOMWrapperWorld*);
ErrorEvent(const AtomicString&, const ErrorEventInit&);
String m_unsanitizedMessage;
diff --git a/chromium/third_party/WebKit/Source/core/events/Event.cpp b/chromium/third_party/WebKit/Source/core/events/Event.cpp
index 4ec60126722..6530b42c10c 100644
--- a/chromium/third_party/WebKit/Source/core/events/Event.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/Event.cpp
@@ -25,7 +25,8 @@
#include "core/dom/StaticNodeList.h"
#include "core/events/EventTarget.h"
-#include "core/events/ThreadLocalEventNames.h"
+#include "core/frame/UseCounter.h"
+#include "core/svg/SVGElement.h"
#include "wtf/CurrentTime.h"
namespace WebCore {
@@ -46,9 +47,8 @@ Event::Event()
, m_defaultHandled(false)
, m_cancelBubble(false)
, m_eventPhase(0)
- , m_currentTarget(0)
+ , m_currentTarget(nullptr)
, m_createTime(convertSecondsToDOMTimeStamp(currentTime()))
- , m_eventPath(this)
{
ScriptWrappable::init(this);
}
@@ -63,9 +63,8 @@ Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr
, m_defaultHandled(false)
, m_cancelBubble(false)
, m_eventPhase(0)
- , m_currentTarget(0)
+ , m_currentTarget(nullptr)
, m_createTime(convertSecondsToDOMTimeStamp(currentTime()))
- , m_eventPath(this)
{
ScriptWrappable::init(this);
}
@@ -80,9 +79,8 @@ Event::Event(const AtomicString& eventType, const EventInit& initializer)
, m_defaultHandled(false)
, m_cancelBubble(false)
, m_eventPhase(0)
- , m_currentTarget(0)
+ , m_currentTarget(nullptr)
, m_createTime(convertSecondsToDOMTimeStamp(currentTime()))
- , m_eventPath(this)
{
ScriptWrappable::init(this);
}
@@ -105,6 +103,25 @@ void Event::initEvent(const AtomicString& eventTypeArg, bool canBubbleArg, bool
m_cancelable = cancelableArg;
}
+bool Event::legacyReturnValue(ExecutionContext* executionContext) const
+{
+ bool returnValue = !defaultPrevented();
+ if (returnValue)
+ UseCounter::count(executionContext, UseCounter::EventGetReturnValueTrue);
+ else
+ UseCounter::count(executionContext, UseCounter::EventGetReturnValueFalse);
+ return returnValue;
+}
+
+void Event::setLegacyReturnValue(ExecutionContext* executionContext, bool returnValue)
+{
+ if (returnValue)
+ UseCounter::count(executionContext, UseCounter::EventSetReturnValueTrue);
+ else
+ UseCounter::count(executionContext, UseCounter::EventSetReturnValueFalse);
+ setDefaultPrevented(!returnValue);
+}
+
const AtomicString& Event::interfaceName() const
{
return EventNames::Event;
@@ -170,7 +187,7 @@ bool Event::isBeforeUnloadEvent() const
return false;
}
-void Event::setTarget(PassRefPtr<EventTarget> target)
+void Event::setTarget(PassRefPtrWillBeRawPtr<EventTarget> target)
{
if (m_target == target)
return;
@@ -184,7 +201,7 @@ void Event::receivedTarget()
{
}
-void Event::setUnderlyingEvent(PassRefPtr<Event> ue)
+void Event::setUnderlyingEvent(PassRefPtrWillBeRawPtr<Event> ue)
{
// Prohibit creation of a cycle -- just do nothing in that case.
for (Event* e = ue.get(); e; e = e->underlyingEvent())
@@ -193,19 +210,48 @@ void Event::setUnderlyingEvent(PassRefPtr<Event> ue)
m_underlyingEvent = ue;
}
-PassRefPtr<NodeList> Event::path() const
+EventPath& Event::ensureEventPath()
+{
+ if (!m_eventPath)
+ m_eventPath = adoptPtrWillBeNoop(new EventPath(this));
+ return *m_eventPath;
+}
+
+PassRefPtrWillBeRawPtr<StaticNodeList> Event::path() const
{
if (!m_currentTarget || !m_currentTarget->toNode())
return StaticNodeList::createEmpty();
Node* node = m_currentTarget->toNode();
- size_t eventPathSize = m_eventPath.size();
+ // FIXME: Support SVG Elements.
+ if (node->isSVGElement())
+ return StaticNodeList::createEmpty();
+ size_t eventPathSize = m_eventPath->size();
for (size_t i = 0; i < eventPathSize; ++i) {
- if (node == m_eventPath[i].node()) {
- ASSERT(m_eventPath[i].eventPath());
- return m_eventPath[i].eventPath();
+ if (node == (*m_eventPath)[i].node()) {
+ return (*m_eventPath)[i].treeScopeEventContext().ensureEventPath(*m_eventPath);
}
}
return StaticNodeList::createEmpty();
}
+EventTarget* Event::currentTarget() const
+{
+ if (!m_currentTarget)
+ return 0;
+ Node* node = m_currentTarget->toNode();
+ if (node && node->isSVGElement()) {
+ if (SVGElement* svgElement = toSVGElement(node)->correspondingElement())
+ return svgElement;
+ }
+ return m_currentTarget;
+}
+
+void Event::trace(Visitor* visitor)
+{
+ visitor->trace(m_currentTarget);
+ visitor->trace(m_target);
+ visitor->trace(m_underlyingEvent);
+ visitor->trace(m_eventPath);
+}
+
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/Event.h b/chromium/third_party/WebKit/Source/core/events/Event.h
index b28f7f113d1..ef9d3657149 100644
--- a/chromium/third_party/WebKit/Source/core/events/Event.h
+++ b/chromium/third_party/WebKit/Source/core/events/Event.h
@@ -26,26 +26,27 @@
#include "bindings/v8/ScriptWrappable.h"
#include "core/dom/DOMTimeStamp.h"
-#include "core/events/EventContext.h"
#include "core/events/EventPath.h"
+#include "platform/heap/Handle.h"
#include "wtf/RefCounted.h"
#include "wtf/text/AtomicString.h"
namespace WebCore {
-class Clipboard;
class EventTarget;
class EventDispatcher;
-class HTMLIFrameElement;
+class ExecutionContext;
struct EventInit {
+ STACK_ALLOCATED();
+public:
EventInit();
bool bubbles;
bool cancelable;
};
-class Event : public ScriptWrappable, public RefCounted<Event> {
+class Event : public RefCountedWillBeGarbageCollectedFinalized<Event>, public ScriptWrappable {
public:
enum PhaseType {
NONE = 0,
@@ -73,34 +74,34 @@ public:
CHANGE = 32768
};
- static PassRefPtr<Event> create()
+ static PassRefPtrWillBeRawPtr<Event> create()
{
- return adoptRef(new Event);
+ return adoptRefWillBeNoop(new Event);
}
// A factory for a simple event. The event doesn't bubble, and isn't
// cancelable.
// http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#fire-a-simple-event
- static PassRefPtr<Event> create(const AtomicString& type)
+ static PassRefPtrWillBeRawPtr<Event> create(const AtomicString& type)
{
- return adoptRef(new Event(type, false, false));
+ return adoptRefWillBeNoop(new Event(type, false, false));
}
- static PassRefPtr<Event> createCancelable(const AtomicString& type)
+ static PassRefPtrWillBeRawPtr<Event> createCancelable(const AtomicString& type)
{
- return adoptRef(new Event(type, false, true));
+ return adoptRefWillBeNoop(new Event(type, false, true));
}
- static PassRefPtr<Event> createBubble(const AtomicString& type)
+ static PassRefPtrWillBeRawPtr<Event> createBubble(const AtomicString& type)
{
- return adoptRef(new Event(type, true, false));
+ return adoptRefWillBeNoop(new Event(type, true, false));
}
- static PassRefPtr<Event> createCancelableBubble(const AtomicString& type)
+ static PassRefPtrWillBeRawPtr<Event> createCancelableBubble(const AtomicString& type)
{
- return adoptRef(new Event(type, true, true));
+ return adoptRefWillBeNoop(new Event(type, true, true));
}
- static PassRefPtr<Event> create(const AtomicString& type, const EventInit& initializer)
+ static PassRefPtrWillBeRawPtr<Event> create(const AtomicString& type, const EventInit& initializer)
{
- return adoptRef(new Event(type, initializer));
+ return adoptRefWillBeNoop(new Event(type, initializer));
}
virtual ~Event();
@@ -111,9 +112,9 @@ public:
void setType(const AtomicString& type) { m_type = type; }
EventTarget* target() const { return m_target.get(); }
- void setTarget(PassRefPtr<EventTarget>);
+ void setTarget(PassRefPtrWillBeRawPtr<EventTarget>);
- EventTarget* currentTarget() const { return m_currentTarget; }
+ EventTarget* currentTarget() const;
void setCurrentTarget(EventTarget* currentTarget) { m_currentTarget = currentTarget; }
unsigned short eventPhase() const { return m_eventPhase; }
@@ -129,10 +130,8 @@ public:
// IE Extensions
EventTarget* srcElement() const { return target(); } // MSIE extension - "the object that fired the event"
- bool legacyReturnValue() const { return !defaultPrevented(); }
- void setLegacyReturnValue(bool returnValue) { setDefaultPrevented(!returnValue); }
-
- Clipboard* clipboardData() const { return isClipboardEvent() ? clipboard() : 0; }
+ bool legacyReturnValue(ExecutionContext*) const;
+ void setLegacyReturnValue(ExecutionContext*, bool returnValue);
virtual const AtomicString& interfaceName() const;
bool hasInterface(const AtomicString&) const;
@@ -159,7 +158,7 @@ public:
bool immediatePropagationStopped() const { return m_immediatePropagationStopped; }
bool defaultPrevented() const { return m_defaultPrevented; }
- void preventDefault()
+ virtual void preventDefault()
{
if (m_cancelable)
m_defaultPrevented = true;
@@ -173,15 +172,17 @@ public:
void setCancelBubble(bool cancel) { m_cancelBubble = cancel; }
Event* underlyingEvent() const { return m_underlyingEvent.get(); }
- void setUnderlyingEvent(PassRefPtr<Event>);
+ void setUnderlyingEvent(PassRefPtrWillBeRawPtr<Event>);
- EventPath& eventPath() { return m_eventPath; }
- PassRefPtr<NodeList> path() const;
+ EventPath& eventPath() { ASSERT(m_eventPath); return *m_eventPath; }
+ EventPath& ensureEventPath();
- virtual Clipboard* clipboard() const { return 0; }
+ PassRefPtrWillBeRawPtr<StaticNodeList> path() const;
bool isBeingDispatched() const { return eventPhase(); }
+ virtual void trace(Visitor*);
+
protected:
Event();
Event(const AtomicString& type, bool canBubble, bool cancelable);
@@ -202,11 +203,11 @@ private:
bool m_cancelBubble;
unsigned short m_eventPhase;
- EventTarget* m_currentTarget;
- RefPtr<EventTarget> m_target;
+ RawPtrWillBeMember<EventTarget> m_currentTarget;
+ RefPtrWillBeMember<EventTarget> m_target;
DOMTimeStamp m_createTime;
- RefPtr<Event> m_underlyingEvent;
- EventPath m_eventPath;
+ RefPtrWillBeMember<Event> m_underlyingEvent;
+ OwnPtrWillBeMember<EventPath> m_eventPath;
};
#define DEFINE_EVENT_TYPE_CASTS(typeName) \
diff --git a/chromium/third_party/WebKit/Source/core/events/Event.idl b/chromium/third_party/WebKit/Source/core/events/Event.idl
index 3f8e80b0523..58a832a3a62 100644
--- a/chromium/third_party/WebKit/Source/core/events/Event.idl
+++ b/chromium/third_party/WebKit/Source/core/events/Event.idl
@@ -20,6 +20,7 @@
// Introduced in DOM Level 2:
[
+ WillBeGarbageCollected,
Custom=Wrap,
EventConstructor,
] interface Event {
@@ -67,11 +68,9 @@
void stopImmediatePropagation();
// IE Extensions
- readonly attribute EventTarget srcElement;
- [ImplementedAs=legacyReturnValue, DeprecateAs=EventReturnValue] attribute boolean returnValue;
- attribute boolean cancelBubble;
-
- [RuntimeEnabled=ShadowDOM] readonly attribute NodeList path;
-
- [Custom=Getter] readonly attribute Clipboard clipboardData;
+ [MeasureAs=EventSrcElement] readonly attribute EventTarget srcElement;
+ [CallWith=ExecutionContext, ImplementedAs=legacyReturnValue, MeasureAs=EventReturnValue] attribute boolean returnValue;
+ [MeasureAs=EventCancelBubble] attribute boolean cancelBubble;
+ [MeasureAs=EventPath] readonly attribute NodeList path;
+ [Custom=Getter, MeasureAs=EventClipboardData] readonly attribute DataTransfer clipboardData;
};
diff --git a/chromium/third_party/WebKit/Source/core/events/EventAliases.in b/chromium/third_party/WebKit/Source/core/events/EventAliases.in
index 82b3a744fc9..f5d90635e0f 100644
--- a/chromium/third_party/WebKit/Source/core/events/EventAliases.in
+++ b/chromium/third_party/WebKit/Source/core/events/EventAliases.in
@@ -5,7 +5,7 @@ HTMLEvents ImplementedAs=Event
KeyboardEvents ImplementedAs=KeyboardEvent
MouseEvents ImplementedAs=MouseEvent
MutationEvents ImplementedAs=MutationEvent
-OrientationEvent ImplementedAs=Event, Conditional=ORIENTATION_EVENTS
+OrientationEvent ImplementedAs=Event, RuntimeEnabled=OrientationEventEnabled
SVGEvents ImplementedAs=Event
SVGZoomEvents ImplementedAs=SVGZoomEvent
UIEvents ImplementedAs=UIEvent
diff --git a/chromium/third_party/WebKit/Source/core/events/EventContext.h b/chromium/third_party/WebKit/Source/core/events/EventContext.h
deleted file mode 100644
index c51c90d4aaf..00000000000
--- a/chromium/third_party/WebKit/Source/core/events/EventContext.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef EventContext_h
-#define EventContext_h
-
-#include "core/events/EventTarget.h"
-#include "core/dom/Node.h"
-#include "core/dom/StaticNodeList.h"
-#include "core/dom/TreeScope.h"
-#include "wtf/RefPtr.h"
-
-namespace WebCore {
-
-class Event;
-class TouchList;
-
-class TouchEventContext : public RefCounted<TouchEventContext> {
-public:
- static PassRefPtr<TouchEventContext> create();
- ~TouchEventContext();
- void handleLocalEvents(Event*) const;
- TouchList* touches() { return m_touches.get(); }
- TouchList* targetTouches() { return m_targetTouches.get(); }
- TouchList* changedTouches() { return m_changedTouches.get(); }
-
-private:
- TouchEventContext();
-
- RefPtr<TouchList> m_touches;
- RefPtr<TouchList> m_targetTouches;
- RefPtr<TouchList> m_changedTouches;
-};
-
-class EventContext {
-public:
- // FIXME: Use ContainerNode instead of Node.
- EventContext(PassRefPtr<Node>, PassRefPtr<EventTarget> currentTarget);
- ~EventContext();
-
- Node* node() const { return m_node.get(); }
- EventTarget* currentTarget() const { return m_currentTarget.get(); }
-
- EventTarget* target() const { return m_target.get(); }
- void setTarget(PassRefPtr<EventTarget>);
-
- EventTarget* relatedTarget() const { return m_relatedTarget.get(); }
- void setRelatedTarget(PassRefPtr<EventTarget>);
-
- TouchEventContext* touchEventContext() const { return m_touchEventContext.get(); }
- TouchEventContext* ensureTouchEventContext();
-
- PassRefPtr<NodeList> eventPath() const { return m_eventPath; }
- void adoptEventPath(Vector<RefPtr<Node> >&);
- void setEventPath(PassRefPtr<NodeList> nodeList) { m_eventPath = nodeList; }
-
- bool currentTargetSameAsTarget() const { return m_currentTarget.get() == m_target.get(); }
- void handleLocalEvents(Event*) const;
-
-protected:
-#ifndef NDEBUG
- bool isUnreachableNode(EventTarget*);
-#endif
- RefPtr<Node> m_node;
- RefPtr<EventTarget> m_currentTarget;
- RefPtr<EventTarget> m_target;
- RefPtr<EventTarget> m_relatedTarget;
- RefPtr<NodeList> m_eventPath;
- RefPtr<TouchEventContext> m_touchEventContext;
-};
-
-#ifndef NDEBUG
-inline bool EventContext::isUnreachableNode(EventTarget* target)
-{
- // FIXME: Checks also for SVG elements.
- return target && target->toNode() && !target->toNode()->isSVGElement() && !target->toNode()->treeScope().isInclusiveAncestorOf(m_node->treeScope());
-}
-#endif
-
-inline void EventContext::setTarget(PassRefPtr<EventTarget> target)
-{
- ASSERT(!isUnreachableNode(target.get()));
- m_target = target;
-}
-
-inline void EventContext::setRelatedTarget(PassRefPtr<EventTarget> relatedTarget)
-{
- ASSERT(!isUnreachableNode(relatedTarget.get()));
- m_relatedTarget = relatedTarget;
-}
-
-}
-
-#endif // EventContext_h
diff --git a/chromium/third_party/WebKit/Source/core/events/EventDispatchMediator.cpp b/chromium/third_party/WebKit/Source/core/events/EventDispatchMediator.cpp
index 032d0b8f9ad..f2b261a6c50 100644
--- a/chromium/third_party/WebKit/Source/core/events/EventDispatchMediator.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/EventDispatchMediator.cpp
@@ -36,16 +36,21 @@
namespace WebCore {
-PassRefPtr<EventDispatchMediator> EventDispatchMediator::create(PassRefPtr<Event> event)
+PassRefPtrWillBeRawPtr<EventDispatchMediator> EventDispatchMediator::create(PassRefPtrWillBeRawPtr<Event> event)
{
- return adoptRef(new EventDispatchMediator(event));
+ return adoptRefWillBeNoop(new EventDispatchMediator(event));
}
-EventDispatchMediator::EventDispatchMediator(PassRefPtr<Event> event)
+EventDispatchMediator::EventDispatchMediator(PassRefPtrWillBeRawPtr<Event> event)
: m_event(event)
{
}
+void EventDispatchMediator::trace(Visitor* visitor)
+{
+ visitor->trace(m_event);
+}
+
bool EventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
{
ASSERT(m_event.get() == dispatcher->event());
diff --git a/chromium/third_party/WebKit/Source/core/events/EventDispatchMediator.h b/chromium/third_party/WebKit/Source/core/events/EventDispatchMediator.h
index 00ab327689a..233c442273c 100644
--- a/chromium/third_party/WebKit/Source/core/events/EventDispatchMediator.h
+++ b/chromium/third_party/WebKit/Source/core/events/EventDispatchMediator.h
@@ -31,6 +31,7 @@
#ifndef EventDispatchMediator_h
#define EventDispatchMediator_h
+#include "platform/heap/Handle.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
#include "wtf/RefPtr.h"
@@ -41,20 +42,21 @@ class Event;
class EventDispatcher;
class Node;
-class EventDispatchMediator : public RefCounted<EventDispatchMediator> {
+class EventDispatchMediator : public RefCountedWillBeGarbageCollectedFinalized<EventDispatchMediator> {
public:
- static PassRefPtr<EventDispatchMediator> create(PassRefPtr<Event>);
+ static PassRefPtrWillBeRawPtr<EventDispatchMediator> create(PassRefPtrWillBeRawPtr<Event>);
virtual ~EventDispatchMediator() { };
+ virtual void trace(Visitor*);
virtual bool dispatchEvent(EventDispatcher*) const;
Event* event() const { return m_event.get(); };
protected:
- explicit EventDispatchMediator(PassRefPtr<Event>);
+ explicit EventDispatchMediator(PassRefPtrWillBeRawPtr<Event>);
EventDispatchMediator() { };
- void setEvent(PassRefPtr<Event> event) { m_event = event; };
+ void setEvent(PassRefPtrWillBeRawPtr<Event> event) { m_event = event; };
private:
- RefPtr<Event> m_event;
+ RefPtrWillBeMember<Event> m_event;
};
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/EventDispatcher.cpp b/chromium/third_party/WebKit/Source/core/events/EventDispatcher.cpp
index fa5698ebce9..0a61afe7a2d 100644
--- a/chromium/third_party/WebKit/Source/core/events/EventDispatcher.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/EventDispatcher.cpp
@@ -27,21 +27,24 @@
#include "core/events/EventDispatcher.h"
#include "core/dom/ContainerNode.h"
+#include "core/dom/NoEventDispatchAssertion.h"
#include "core/events/EventDispatchMediator.h"
-#include "core/events/EventRetargeter.h"
#include "core/events/MouseEvent.h"
#include "core/events/ScopedEventQueue.h"
#include "core/events/WindowEventContext.h"
-#include "core/inspector/InspectorInstrumentation.h"
#include "core/frame/FrameView.h"
+#include "core/inspector/InspectorInstrumentation.h"
+#include "core/inspector/InspectorTraceEvents.h"
+#include "platform/TraceEvent.h"
#include "wtf/RefPtr.h"
namespace WebCore {
static HashSet<Node*>* gNodesDispatchingSimulatedClicks = 0;
-bool EventDispatcher::dispatchEvent(Node* node, PassRefPtr<EventDispatchMediator> mediator)
+bool EventDispatcher::dispatchEvent(Node* node, PassRefPtrWillBeRawPtr<EventDispatchMediator> mediator)
{
+ TRACE_EVENT0("webkit", "EventDispatcher::dispatchEvent");
ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
if (!mediator->event())
return true;
@@ -49,7 +52,7 @@ bool EventDispatcher::dispatchEvent(Node* node, PassRefPtr<EventDispatchMediator
return mediator->dispatchEvent(&dispatcher);
}
-EventDispatcher::EventDispatcher(Node* node, PassRefPtr<Event> event)
+EventDispatcher::EventDispatcher(Node* node, PassRefPtrWillBeRawPtr<Event> event)
: m_node(node)
, m_event(event)
#ifndef NDEBUG
@@ -60,10 +63,10 @@ EventDispatcher::EventDispatcher(Node* node, PassRefPtr<Event> event)
ASSERT(m_event.get());
ASSERT(!m_event->type().isNull()); // JavaScript code can create an event with an empty name, but not null.
m_view = node->document().view();
- m_event->eventPath().resetWith(m_node.get());
+ m_event->ensureEventPath().resetWith(m_node.get());
}
-void EventDispatcher::dispatchScopedEvent(Node* node, PassRefPtr<EventDispatchMediator> mediator)
+void EventDispatcher::dispatchScopedEvent(Node* node, PassRefPtrWillBeRawPtr<EventDispatchMediator> mediator)
{
// We need to set the target here because it can go away by the time we actually fire the event.
mediator->event()->setTarget(EventPath::eventTargetRespectingTargetRules(node));
@@ -85,11 +88,13 @@ void EventDispatcher::dispatchSimulatedClick(Node* node, Event* underlyingEvent,
if (mouseEventOptions == SendMouseOverUpDownEvents)
EventDispatcher(node, SimulatedMouseEvent::create(EventTypeNames::mouseover, node->document().domWindow(), underlyingEvent)).dispatch();
- if (mouseEventOptions != SendNoEvents)
+ if (mouseEventOptions != SendNoEvents) {
EventDispatcher(node, SimulatedMouseEvent::create(EventTypeNames::mousedown, node->document().domWindow(), underlyingEvent)).dispatch();
- node->setActive(true);
- if (mouseEventOptions != SendNoEvents)
+ node->setActive(true);
EventDispatcher(node, SimulatedMouseEvent::create(EventTypeNames::mouseup, node->document().domWindow(), underlyingEvent)).dispatch();
+ }
+ // Some elements (e.g. the color picker) may set active state to true before
+ // calling this method and expect the state to be reset during the call.
node->setActive(false);
// always send click
@@ -100,16 +105,19 @@ void EventDispatcher::dispatchSimulatedClick(Node* node, Event* underlyingEvent,
bool EventDispatcher::dispatch()
{
+ TRACE_EVENT0("webkit", "EventDispatcher::dispatch");
+
#ifndef NDEBUG
ASSERT(!m_eventDispatched);
m_eventDispatched = true;
#endif
- ChildNodesLazySnapshot::takeChildNodesLazySnapshot();
m_event->setTarget(EventPath::eventTargetRespectingTargetRules(m_node.get()));
ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
ASSERT(m_event->target());
- WindowEventContext windowEventContext(m_event.get(), m_node.get(), topEventContext());
+ WindowEventContext windowEventContext(m_event.get(), m_node.get(), topNodeEventContext());
+ TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "EventDispatch", "type", m_event->type().ascii());
+ // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeline migrates to tracing.
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchEvent(&m_node->document(), *m_event, windowEventContext.window(), m_node.get(), m_event->eventPath());
void* preDispatchEventHandlerResult;
@@ -124,6 +132,7 @@ bool EventDispatcher::dispatch()
m_event->setTarget(windowEventContext.target());
m_event->setCurrentTarget(0);
InspectorInstrumentation::didDispatchEvent(cookie);
+ TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", "data", InspectorUpdateCountersEvent::data());
return !m_event->defaultPrevented();
}
@@ -144,7 +153,7 @@ inline EventDispatchContinuation EventDispatcher::dispatchEventAtCapturing(Windo
return DoneDispatching;
for (size_t i = m_event->eventPath().size() - 1; i > 0; --i) {
- const EventContext& eventContext = m_event->eventPath()[i];
+ const NodeEventContext& eventContext = m_event->eventPath()[i];
if (eventContext.currentTargetSameAsTarget())
continue;
eventContext.handleLocalEvents(m_event.get());
@@ -167,7 +176,7 @@ inline void EventDispatcher::dispatchEventAtBubbling(WindowEventContext& windowC
// Trigger bubbling event handlers, starting at the bottom and working our way up.
size_t size = m_event->eventPath().size();
for (size_t i = 1; i < size; ++i) {
- const EventContext& eventContext = m_event->eventPath()[i];
+ const NodeEventContext& eventContext = m_event->eventPath()[i];
if (eventContext.currentTargetSameAsTarget())
m_event->setEventPhase(Event::AT_TARGET);
else if (m_event->bubbles() && !m_event->cancelBubble())
@@ -218,7 +227,7 @@ inline void EventDispatcher::dispatchEventPostProcess(void* preDispatchEventHand
}
}
-const EventContext* EventDispatcher::topEventContext()
+const NodeEventContext* EventDispatcher::topNodeEventContext()
{
return m_event->eventPath().isEmpty() ? 0 : &m_event->eventPath().last();
}
diff --git a/chromium/third_party/WebKit/Source/core/events/EventDispatcher.h b/chromium/third_party/WebKit/Source/core/events/EventDispatcher.h
index aae65a2d7f2..891a9b9646e 100644
--- a/chromium/third_party/WebKit/Source/core/events/EventDispatcher.h
+++ b/chromium/third_party/WebKit/Source/core/events/EventDispatcher.h
@@ -26,22 +26,18 @@
#ifndef EventDispatcher_h
#define EventDispatcher_h
-#include "core/events/EventContext.h"
#include "core/dom/SimulatedClickOptions.h"
-#include "wtf/Forward.h"
+#include "platform/heap/Handle.h"
#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
namespace WebCore {
class Event;
class EventDispatchMediator;
-class EventTarget;
class FrameView;
class Node;
-class PlatformKeyboardEvent;
-class PlatformMouseEvent;
-class ShadowRoot;
-class TreeScope;
+class NodeEventContext;
class WindowEventContext;
enum EventDispatchContinuation {
@@ -50,9 +46,10 @@ enum EventDispatchContinuation {
};
class EventDispatcher {
+ STACK_ALLOCATED();
public:
- static bool dispatchEvent(Node*, PassRefPtr<EventDispatchMediator>);
- static void dispatchScopedEvent(Node*, PassRefPtr<EventDispatchMediator>);
+ static bool dispatchEvent(Node*, PassRefPtrWillBeRawPtr<EventDispatchMediator>);
+ static void dispatchScopedEvent(Node*, PassRefPtrWillBeRawPtr<EventDispatchMediator>);
static void dispatchSimulatedClick(Node*, Event* underlyingEvent, SimulatedClickMouseEventOptions);
@@ -61,8 +58,8 @@ public:
Event* event() const { return m_event.get(); }
private:
- EventDispatcher(Node*, PassRefPtr<Event>);
- const EventContext* topEventContext();
+ EventDispatcher(Node*, PassRefPtrWillBeRawPtr<Event>);
+ const NodeEventContext* topNodeEventContext();
EventDispatchContinuation dispatchEventPreProcess(void*& preDispatchEventHandlerResult);
EventDispatchContinuation dispatchEventAtCapturing(WindowEventContext&);
@@ -70,8 +67,8 @@ private:
void dispatchEventAtBubbling(WindowEventContext&);
void dispatchEventPostProcess(void* preDispatchEventHandlerResult);
- RefPtr<Node> m_node;
- RefPtr<Event> m_event;
+ RefPtrWillBeMember<Node> m_node;
+ RefPtrWillBeMember<Event> m_event;
RefPtr<FrameView> m_view;
#ifndef NDEBUG
bool m_eventDispatched;
diff --git a/chromium/third_party/WebKit/Source/core/events/EventFactory.h b/chromium/third_party/WebKit/Source/core/events/EventFactory.h
index 2436e3f0000..df9cde337a7 100644
--- a/chromium/third_party/WebKit/Source/core/events/EventFactory.h
+++ b/chromium/third_party/WebKit/Source/core/events/EventFactory.h
@@ -26,6 +26,7 @@
#ifndef EventFactory_h
#define EventFactory_h
+#include "platform/heap/Handle.h"
#include "wtf/PassRefPtr.h"
#include "wtf/text/AtomicString.h"
@@ -33,9 +34,23 @@ namespace WebCore {
class Event;
-class EventFactory {
+class EventFactoryBase {
public:
- static PassRefPtr<Event> create(const String& eventType);
+ virtual PassRefPtrWillBeRawPtr<Event> create(const String& eventType) = 0;
+ virtual ~EventFactoryBase() { }
+
+protected:
+ EventFactoryBase() { }
+};
+
+class EventFactory FINAL : public EventFactoryBase {
+public:
+ static PassOwnPtr<EventFactory> create()
+ {
+ return adoptPtr(new EventFactory());
+ }
+
+ virtual PassRefPtrWillBeRawPtr<Event> create(const String& eventType) OVERRIDE;
};
}
diff --git a/chromium/third_party/WebKit/Source/core/events/EventListener.h b/chromium/third_party/WebKit/Source/core/events/EventListener.h
index 78291043e83..a6270cc2a7a 100644
--- a/chromium/third_party/WebKit/Source/core/events/EventListener.h
+++ b/chromium/third_party/WebKit/Source/core/events/EventListener.h
@@ -43,7 +43,7 @@ namespace WebCore {
virtual bool operator==(const EventListener&) = 0;
virtual void handleEvent(ExecutionContext*, Event*) = 0;
virtual bool wasCreatedFromMarkup() const { return false; }
- virtual DOMWrapperWorld* world() const { return 0; }
+ virtual bool belongsToTheCurrentWorld() const { return false; }
bool isAttribute() const { return virtualisAttribute(); }
Type type() const { return m_type; }
diff --git a/chromium/third_party/WebKit/Source/core/events/EventListenerMap.h b/chromium/third_party/WebKit/Source/core/events/EventListenerMap.h
index fa39f2b23c1..37d72dd3260 100644
--- a/chromium/third_party/WebKit/Source/core/events/EventListenerMap.h
+++ b/chromium/third_party/WebKit/Source/core/events/EventListenerMap.h
@@ -34,7 +34,6 @@
#define EventListenerMap_h
#include "core/events/RegisteredEventListener.h"
-#include "wtf/Forward.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/text/AtomicStringHash.h"
diff --git a/chromium/third_party/WebKit/Source/core/events/EventPath.cpp b/chromium/third_party/WebKit/Source/core/events/EventPath.cpp
index ca9a57dcdfa..c69d7744ace 100644
--- a/chromium/third_party/WebKit/Source/core/events/EventPath.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/EventPath.cpp
@@ -27,25 +27,22 @@
#include "config.h"
#include "core/events/EventPath.h"
-#include "EventNames.h"
-#include "RuntimeEnabledFeatures.h"
-#include "SVGNames.h"
+#include "core/EventNames.h"
+#include "core/SVGNames.h"
#include "core/dom/FullscreenElementStack.h"
-#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/Touch.h"
+#include "core/dom/TouchList.h"
#include "core/dom/shadow/InsertionPoint.h"
#include "core/dom/shadow/ShadowRoot.h"
-#include "core/html/shadow/HTMLShadowElement.h"
-#include "core/svg/SVGElementInstance.h"
+#include "core/events/FocusEvent.h"
+#include "core/events/MouseEvent.h"
+#include "core/events/TouchEvent.h"
+#include "core/events/TouchEventContext.h"
#include "core/svg/SVGUseElement.h"
+#include "platform/RuntimeEnabledFeatures.h"
namespace WebCore {
-Node* EventPath::parent(Node* node)
-{
- EventPath eventPath(node);
- return eventPath.size() > 1 ? eventPath[1].node() : 0;
-}
-
EventTarget* EventPath::eventTargetRespectingTargetRules(Node* referenceNode)
{
ASSERT(referenceNode);
@@ -53,20 +50,6 @@ EventTarget* EventPath::eventTargetRespectingTargetRules(Node* referenceNode)
if (referenceNode->isPseudoElement())
return referenceNode->parentNode();
- if (!referenceNode->isSVGElement() || !referenceNode->isInShadowTree())
- return referenceNode;
-
- // Spec: The event handling for the non-exposed tree works as if the referenced element had been textually included
- // as a deeply cloned child of the 'use' element, except that events are dispatched to the SVGElementInstance objects.
- Node* rootNode = referenceNode->treeScope().rootNode();
- Element* shadowHostElement = rootNode->isShadowRoot() ? toShadowRoot(rootNode)->host() : 0;
- // At this time, SVG nodes are not supported in non-<use> shadow trees.
- if (!shadowHostElement || !shadowHostElement->hasTagName(SVGNames::useTag))
- return referenceNode;
- SVGUseElement* useElement = toSVGUseElement(shadowHostElement);
- if (SVGElementInstance* instance = useElement->instanceForShadowTreeElement(referenceNode))
- return instance;
-
return referenceNode;
}
@@ -77,15 +60,6 @@ static inline bool inTheSameScope(ShadowRoot* shadowRoot, EventTarget* target)
static inline EventDispatchBehavior determineDispatchBehavior(Event* event, ShadowRoot* shadowRoot, EventTarget* target)
{
- // Video-only full screen is a mode where we use the shadow DOM as an implementation
- // detail that should not be detectable by the web content.
- if (Element* element = FullscreenElementStack::currentFullScreenElementFrom(&target->toNode()->document())) {
- // FIXME: We assume that if the full screen element is a media element that it's
- // the video-only full screen. Both here and elsewhere. But that is probably wrong.
- if (element->isMediaElement() && shadowRoot && shadowRoot->host() == element)
- return StayInsideShadowDOM;
- }
-
// WebKit never allowed selectstart event to cross the the shadow DOM boundary.
// Changing this breaks existing sites.
// See https://bugs.webkit.org/show_bug.cgi?id=52195 for details.
@@ -106,14 +80,14 @@ static inline EventDispatchBehavior determineDispatchBehavior(Event* event, Shad
}
EventPath::EventPath(Event* event)
- : m_node(0)
+ : m_node(nullptr)
, m_event(event)
{
}
EventPath::EventPath(Node* node)
: m_node(node)
- , m_event(0)
+ , m_event(nullptr)
{
resetWith(node);
}
@@ -122,31 +96,32 @@ void EventPath::resetWith(Node* node)
{
ASSERT(node);
m_node = node;
- m_eventContexts.clear();
+ m_nodeEventContexts.clear();
+ m_treeScopeEventContexts.clear();
calculatePath();
calculateAdjustedTargets();
- calculateAdjustedEventPathForEachNode();
+ calculateTreeScopePrePostOrderNumbers();
}
-void EventPath::addEventContext(Node* node)
+void EventPath::addNodeEventContext(Node* node)
{
- m_eventContexts.append(EventContext(node, eventTargetRespectingTargetRules(node)));
+ m_nodeEventContexts.append(NodeEventContext(node, eventTargetRespectingTargetRules(node)));
}
void EventPath::calculatePath()
{
ASSERT(m_node);
- ASSERT(m_eventContexts.isEmpty());
- m_node->document().updateDistributionForNodeIfNeeded(const_cast<Node*>(m_node));
+ ASSERT(m_nodeEventContexts.isEmpty());
+ m_node->document().updateDistributionForNodeIfNeeded(const_cast<Node*>(m_node.get()));
Node* current = m_node;
- addEventContext(current);
+ addNodeEventContext(current);
if (!m_node->inDocument())
return;
while (current) {
if (current->isShadowRoot() && m_event && determineDispatchBehavior(m_event, toShadowRoot(current), m_node) == StayInsideShadowDOM)
break;
- Vector<InsertionPoint*, 8> insertionPoints;
+ WillBeHeapVector<RawPtrWillBeMember<InsertionPoint>, 8> insertionPoints;
collectDestinationInsertionPoints(*current, insertionPoints);
if (!insertionPoints.isEmpty()) {
for (size_t i = 0; i < insertionPoints.size(); ++i) {
@@ -155,103 +130,227 @@ void EventPath::calculatePath()
ShadowRoot* containingShadowRoot = insertionPoint->containingShadowRoot();
ASSERT(containingShadowRoot);
if (!containingShadowRoot->isOldest())
- addEventContext(containingShadowRoot->olderShadowRoot());
+ addNodeEventContext(containingShadowRoot->olderShadowRoot());
}
- addEventContext(insertionPoint);
+ addNodeEventContext(insertionPoint);
}
current = insertionPoints.last();
continue;
}
if (current->isShadowRoot()) {
current = current->shadowHost();
- addEventContext(current);
+ addNodeEventContext(current);
} else {
current = current->parentNode();
if (current)
- addEventContext(current);
+ addNodeEventContext(current);
}
}
}
-void EventPath::calculateAdjustedEventPathForEachNode()
+void EventPath::calculateTreeScopePrePostOrderNumbers()
{
- if (!RuntimeEnabledFeatures::shadowDOMEnabled())
- return;
- TreeScope* lastScope = 0;
- for (size_t i = 0; i < size(); ++i) {
- TreeScope* currentScope = &at(i).node()->treeScope();
- if (currentScope == lastScope) {
- // Fast path.
- at(i).setEventPath(at(i - 1).eventPath());
+ // Precondition:
+ // - TreeScopes in m_treeScopeEventContexts must be *connected* in the same tree of trees.
+ // - The root tree must be included.
+ WillBeHeapHashMap<RawPtrWillBeMember<const TreeScope>, RawPtrWillBeMember<TreeScopeEventContext> > treeScopeEventContextMap;
+ for (size_t i = 0; i < m_treeScopeEventContexts.size(); ++i)
+ treeScopeEventContextMap.add(&m_treeScopeEventContexts[i]->treeScope(), m_treeScopeEventContexts[i].get());
+ TreeScopeEventContext* rootTree = 0;
+ for (size_t i = 0; i < m_treeScopeEventContexts.size(); ++i) {
+ TreeScopeEventContext* treeScopeEventContext = m_treeScopeEventContexts[i].get();
+ // Use olderShadowRootOrParentTreeScope here for parent-child relationships.
+ // See the definition of trees of trees in the Shado DOM spec: http://w3c.github.io/webcomponents/spec/shadow/
+ TreeScope* parent = treeScopeEventContext->treeScope().olderShadowRootOrParentTreeScope();
+ if (!parent) {
+ ASSERT(!rootTree);
+ rootTree = treeScopeEventContext;
continue;
}
- lastScope = currentScope;
- Vector<RefPtr<Node> > nodes;
- nodes.reserveInitialCapacity(size());
- for (size_t j = 0; j < size(); ++j) {
- if (at(j).node()->treeScope().isInclusiveAncestorOf(*currentScope))
- nodes.append(at(j).node());
+ ASSERT(treeScopeEventContextMap.find(parent) != treeScopeEventContextMap.end());
+ treeScopeEventContextMap.find(parent)->value->addChild(*treeScopeEventContext);
+ }
+ ASSERT(rootTree);
+ rootTree->calculatePrePostOrderNumber(0);
+}
+
+TreeScopeEventContext* EventPath::ensureTreeScopeEventContext(Node* currentTarget, TreeScope* treeScope, TreeScopeEventContextMap& treeScopeEventContextMap)
+{
+ if (!treeScope)
+ return 0;
+ TreeScopeEventContext* treeScopeEventContext;
+ bool isNewEntry;
+ {
+ TreeScopeEventContextMap::AddResult addResult = treeScopeEventContextMap.add(treeScope, nullptr);
+ if ((isNewEntry = addResult.isNewEntry))
+ addResult.storedValue->value = TreeScopeEventContext::create(*treeScope);
+ treeScopeEventContext = addResult.storedValue->value.get();
+ }
+ if (isNewEntry) {
+ TreeScopeEventContext* parentTreeScopeEventContext = ensureTreeScopeEventContext(0, treeScope->olderShadowRootOrParentTreeScope(), treeScopeEventContextMap);
+ if (parentTreeScopeEventContext && parentTreeScopeEventContext->target()) {
+ treeScopeEventContext->setTarget(parentTreeScopeEventContext->target());
+ } else if (currentTarget) {
+ treeScopeEventContext->setTarget(eventTargetRespectingTargetRules(currentTarget));
}
- at(i).adoptEventPath(nodes);
+ } else if (!treeScopeEventContext->target() && currentTarget) {
+ treeScopeEventContext->setTarget(eventTargetRespectingTargetRules(currentTarget));
}
+ return treeScopeEventContext;
}
-#ifndef NDEBUG
-static inline bool movedFromOlderToYounger(const TreeScope& lastTreeScope, const TreeScope& currentTreeScope)
+void EventPath::calculateAdjustedTargets()
{
- Node* rootNode = lastTreeScope.rootNode();
- return rootNode->isShadowRoot() && toShadowRoot(rootNode)->youngerShadowRoot() == currentTreeScope.rootNode();
+ const TreeScope* lastTreeScope = 0;
+
+ TreeScopeEventContextMap treeScopeEventContextMap;
+ TreeScopeEventContext* lastTreeScopeEventContext = 0;
+
+ for (size_t i = 0; i < size(); ++i) {
+ Node* currentNode = at(i).node();
+ TreeScope& currentTreeScope = currentNode->treeScope();
+ if (lastTreeScope != &currentTreeScope) {
+ lastTreeScopeEventContext = ensureTreeScopeEventContext(currentNode, &currentTreeScope, treeScopeEventContextMap);
+ }
+ ASSERT(lastTreeScopeEventContext);
+ at(i).setTreeScopeEventContext(lastTreeScopeEventContext);
+ lastTreeScope = &currentTreeScope;
+ }
+ m_treeScopeEventContexts.appendRange(treeScopeEventContextMap.values().begin(), treeScopeEventContextMap.values().end());
}
-static inline bool movedFromYoungerToOlder(const TreeScope& lastTreeScope, const TreeScope& currentTreeScope)
+void EventPath::buildRelatedNodeMap(const Node* relatedNode, RelatedTargetMap& relatedTargetMap)
{
- Node* rootNode = lastTreeScope.rootNode();
- return rootNode->isShadowRoot() && toShadowRoot(rootNode)->olderShadowRoot() == currentTreeScope.rootNode();
+ EventPath relatedTargetEventPath(const_cast<Node*>(relatedNode));
+ for (size_t i = 0; i < relatedTargetEventPath.m_treeScopeEventContexts.size(); ++i) {
+ TreeScopeEventContext* treeScopeEventContext = relatedTargetEventPath.m_treeScopeEventContexts[i].get();
+ relatedTargetMap.add(&treeScopeEventContext->treeScope(), treeScopeEventContext->target());
+ }
}
-#endif
-static inline bool movedFromChildToParent(const TreeScope& lastTreeScope, const TreeScope& currentTreeScope)
+EventTarget* EventPath::findRelatedNode(TreeScope* scope, RelatedTargetMap& relatedTargetMap)
{
- return lastTreeScope.parentTreeScope() == &currentTreeScope;
+ WillBeHeapVector<RawPtrWillBeMember<TreeScope>, 32> parentTreeScopes;
+ EventTarget* relatedNode = 0;
+ while (scope) {
+ parentTreeScopes.append(scope);
+ RelatedTargetMap::const_iterator iter = relatedTargetMap.find(scope);
+ if (iter != relatedTargetMap.end() && iter->value) {
+ relatedNode = iter->value;
+ break;
+ }
+ scope = scope->olderShadowRootOrParentTreeScope();
+ }
+ ASSERT(relatedNode);
+ for (WillBeHeapVector<RawPtrWillBeMember<TreeScope>, 32>::iterator iter = parentTreeScopes.begin(); iter < parentTreeScopes.end(); ++iter)
+ relatedTargetMap.add(*iter, relatedNode);
+ return relatedNode;
}
-static inline bool movedFromParentToChild(const TreeScope& lastTreeScope, const TreeScope& currentTreeScope)
+void EventPath::adjustForRelatedTarget(Node* target, EventTarget* relatedTarget)
{
- return currentTreeScope.parentTreeScope() == &lastTreeScope;
+ if (!target)
+ return;
+ if (!relatedTarget)
+ return;
+ Node* relatedNode = relatedTarget->toNode();
+ if (!relatedNode)
+ return;
+ if (target->document() != relatedNode->document())
+ return;
+ if (!target->inDocument() || !relatedNode->inDocument())
+ return;
+
+ RelatedTargetMap relatedNodeMap;
+ buildRelatedNodeMap(relatedNode, relatedNodeMap);
+
+ for (size_t i = 0; i < m_treeScopeEventContexts.size(); ++i) {
+ TreeScopeEventContext* treeScopeEventContext = m_treeScopeEventContexts[i].get();
+ EventTarget* adjustedRelatedTarget = findRelatedNode(&treeScopeEventContext->treeScope(), relatedNodeMap);
+ ASSERT(adjustedRelatedTarget);
+ treeScopeEventContext->setRelatedTarget(adjustedRelatedTarget);
+ }
+
+ shrinkIfNeeded(target, relatedTarget);
}
-void EventPath::calculateAdjustedTargets()
+void EventPath::shrinkIfNeeded(const Node* target, const EventTarget* relatedTarget)
{
- Vector<Node*, 32> targetStack;
- const TreeScope* lastTreeScope = 0;
- bool isSVGElement = at(0).node()->isSVGElement();
+ // Synthetic mouse events can have a relatedTarget which is identical to the target.
+ bool targetIsIdenticalToToRelatedTarget = (target == relatedTarget);
for (size_t i = 0; i < size(); ++i) {
- Node* current = at(i).node();
- const TreeScope& currentTreeScope = current->treeScope();
- if (targetStack.isEmpty()) {
- targetStack.append(current);
- } else if (*lastTreeScope != currentTreeScope && !isSVGElement) {
- if (movedFromParentToChild(*lastTreeScope, currentTreeScope)) {
- targetStack.append(targetStack.last());
- } else if (movedFromChildToParent(*lastTreeScope, currentTreeScope)) {
- ASSERT(!targetStack.isEmpty());
- targetStack.removeLast();
- if (targetStack.isEmpty())
- targetStack.append(current);
- } else {
- ASSERT(movedFromYoungerToOlder(*lastTreeScope, currentTreeScope) || movedFromOlderToYounger(*lastTreeScope, currentTreeScope));
- ASSERT(!targetStack.isEmpty());
- targetStack.removeLast();
- if (targetStack.isEmpty())
- targetStack.append(current);
- else
- targetStack.append(targetStack.last());
+ if (targetIsIdenticalToToRelatedTarget) {
+ if (target->treeScope().rootNode() == at(i).node()) {
+ shrink(i + 1);
+ break;
}
+ } else if (at(i).target() == at(i).relatedTarget()) {
+ // Event dispatching should be stopped here.
+ shrink(i);
+ break;
+ }
+ }
+}
+
+void EventPath::adjustForTouchEvent(Node* node, TouchEvent& touchEvent)
+{
+ WillBeHeapVector<RawPtrWillBeMember<TouchList> > adjustedTouches;
+ WillBeHeapVector<RawPtrWillBeMember<TouchList> > adjustedTargetTouches;
+ WillBeHeapVector<RawPtrWillBeMember<TouchList> > adjustedChangedTouches;
+ WillBeHeapVector<RawPtrWillBeMember<TreeScope> > treeScopes;
+
+ for (size_t i = 0; i < m_treeScopeEventContexts.size(); ++i) {
+ TouchEventContext* touchEventContext = m_treeScopeEventContexts[i]->ensureTouchEventContext();
+ adjustedTouches.append(&touchEventContext->touches());
+ adjustedTargetTouches.append(&touchEventContext->targetTouches());
+ adjustedChangedTouches.append(&touchEventContext->changedTouches());
+ treeScopes.append(&m_treeScopeEventContexts[i]->treeScope());
+ }
+
+ adjustTouchList(node, touchEvent.touches(), adjustedTouches, treeScopes);
+ adjustTouchList(node, touchEvent.targetTouches(), adjustedTargetTouches, treeScopes);
+ adjustTouchList(node, touchEvent.changedTouches(), adjustedChangedTouches, treeScopes);
+
+#ifndef NDEBUG
+ for (size_t i = 0; i < m_treeScopeEventContexts.size(); ++i) {
+ TreeScope& treeScope = m_treeScopeEventContexts[i]->treeScope();
+ TouchEventContext* touchEventContext = m_treeScopeEventContexts[i]->touchEventContext();
+ checkReachability(treeScope, touchEventContext->touches());
+ checkReachability(treeScope, touchEventContext->targetTouches());
+ checkReachability(treeScope, touchEventContext->changedTouches());
+ }
+#endif
+}
+
+void EventPath::adjustTouchList(const Node* node, const TouchList* touchList, WillBeHeapVector<RawPtrWillBeMember<TouchList> > adjustedTouchList, const WillBeHeapVector<RawPtrWillBeMember<TreeScope> >& treeScopes)
+{
+ if (!touchList)
+ return;
+ for (size_t i = 0; i < touchList->length(); ++i) {
+ const Touch& touch = *touchList->item(i);
+ RelatedTargetMap relatedNodeMap;
+ buildRelatedNodeMap(touch.target()->toNode(), relatedNodeMap);
+ for (size_t j = 0; j < treeScopes.size(); ++j) {
+ adjustedTouchList[j]->append(touch.cloneWithNewTarget(findRelatedNode(treeScopes[j], relatedNodeMap)));
}
- at(i).setTarget(eventTargetRespectingTargetRules(targetStack.last()));
- lastTreeScope = &currentTreeScope;
}
}
+#ifndef NDEBUG
+void EventPath::checkReachability(TreeScope& treeScope, TouchList& touchList)
+{
+ for (size_t i = 0; i < touchList.length(); ++i)
+ ASSERT(touchList.item(i)->target()->toNode()->treeScope().isInclusiveOlderSiblingShadowRootOrAncestorTreeScopeOf(treeScope));
+}
+#endif
+
+void EventPath::trace(Visitor* visitor)
+{
+ visitor->trace(m_nodeEventContexts);
+ visitor->trace(m_node);
+ visitor->trace(m_event);
+ visitor->trace(m_treeScopeEventContexts);
+}
+
} // namespace
diff --git a/chromium/third_party/WebKit/Source/core/events/EventPath.h b/chromium/third_party/WebKit/Source/core/events/EventPath.h
index e5db6c4caf1..85232b1cd49 100644
--- a/chromium/third_party/WebKit/Source/core/events/EventPath.h
+++ b/chromium/third_party/WebKit/Source/core/events/EventPath.h
@@ -27,9 +27,10 @@
#ifndef EventPath_h
#define EventPath_h
-#include "core/events/EventContext.h"
-
-#include "wtf/OwnPtr.h"
+#include "core/events/NodeEventContext.h"
+#include "core/events/TreeScopeEventContext.h"
+#include "platform/heap/Handle.h"
+#include "wtf/HashMap.h"
#include "wtf/Vector.h"
namespace WebCore {
@@ -37,44 +38,67 @@ namespace WebCore {
class Event;
class EventTarget;
class Node;
+class TouchEvent;
+class TouchList;
+class TreeScope;
enum EventDispatchBehavior {
RetargetEvent,
StayInsideShadowDOM
};
-class EventPath {
+class EventPath : public NoBaseWillBeGarbageCollectedFinalized<EventPath> {
public:
explicit EventPath(Event*);
explicit EventPath(Node*);
void resetWith(Node*);
- EventContext& operator[](size_t index) { return m_eventContexts[index]; }
- const EventContext& operator[](size_t index) const { return m_eventContexts[index]; }
- const EventContext& last() const { return m_eventContexts[size() - 1]; }
+ NodeEventContext& operator[](size_t index) { return m_nodeEventContexts[index]; }
+ const NodeEventContext& operator[](size_t index) const { return m_nodeEventContexts[index]; }
+ const NodeEventContext& last() const { return m_nodeEventContexts[size() - 1]; }
- bool isEmpty() const { return m_eventContexts.isEmpty(); }
- size_t size() const { return m_eventContexts.size(); }
+ bool isEmpty() const { return m_nodeEventContexts.isEmpty(); }
+ size_t size() const { return m_nodeEventContexts.size(); }
- void shrink(size_t newSize) { m_eventContexts.shrink(newSize); }
+ void adjustForRelatedTarget(Node*, EventTarget* relatedTarget);
+ void adjustForTouchEvent(Node*, TouchEvent&);
- static Node* parent(Node*);
static EventTarget* eventTargetRespectingTargetRules(Node*);
+ void trace(Visitor*);
+
private:
EventPath();
- EventContext& at(size_t index) { return m_eventContexts[index]; }
+ NodeEventContext& at(size_t index) { return m_nodeEventContexts[index]; }
- void addEventContext(Node*);
+ void addNodeEventContext(Node*);
void calculatePath();
void calculateAdjustedTargets();
- void calculateAdjustedEventPathForEachNode();
+ void calculateTreeScopePrePostOrderNumbers();
+
+ void shrink(size_t newSize) { m_nodeEventContexts.shrink(newSize); }
+ void shrinkIfNeeded(const Node* target, const EventTarget* relatedTarget);
+
+ void adjustTouchList(const Node*, const TouchList*, WillBeHeapVector<RawPtrWillBeMember<TouchList> > adjustedTouchList, const WillBeHeapVector<RawPtrWillBeMember<TreeScope> >& treeScopes);
+
+ typedef WillBeHeapHashMap<RawPtrWillBeMember<TreeScope>, RefPtrWillBeMember<TreeScopeEventContext> > TreeScopeEventContextMap;
+ TreeScopeEventContext* ensureTreeScopeEventContext(Node* currentTarget, TreeScope*, TreeScopeEventContextMap&);
+
+ typedef WillBeHeapHashMap<RawPtrWillBeMember<TreeScope>, RawPtrWillBeMember<EventTarget> > RelatedTargetMap;
+
+ static void buildRelatedNodeMap(const Node*, RelatedTargetMap&);
+ static EventTarget* findRelatedNode(TreeScope*, RelatedTargetMap&);
+
+#ifndef NDEBUG
+ static void checkReachability(TreeScope&, TouchList&);
+#endif
- Vector<EventContext, 64> m_eventContexts;
- Node* m_node;
- Event* m_event;
+ WillBeHeapVector<NodeEventContext, 64> m_nodeEventContexts;
+ RawPtrWillBeMember<Node> m_node;
+ RawPtrWillBeMember<Event> m_event;
+ WillBeHeapVector<RefPtrWillBeMember<TreeScopeEventContext> > m_treeScopeEventContexts;
};
} // namespace
diff --git a/chromium/third_party/WebKit/Source/core/events/EventQueue.h b/chromium/third_party/WebKit/Source/core/events/EventQueue.h
index 770ae797d21..9f59b70cbd0 100644
--- a/chromium/third_party/WebKit/Source/core/events/EventQueue.h
+++ b/chromium/third_party/WebKit/Source/core/events/EventQueue.h
@@ -27,6 +27,7 @@
#ifndef EventQueue_h
#define EventQueue_h
+#include "platform/heap/Handle.h"
#include "wtf/HashMap.h"
#include "wtf/HashSet.h"
#include "wtf/PassOwnPtr.h"
@@ -35,10 +36,11 @@ namespace WebCore {
class Event;
-class EventQueue {
+class EventQueue : public NoBaseWillBeGarbageCollectedFinalized<EventQueue> {
public:
virtual ~EventQueue() { }
- virtual bool enqueueEvent(PassRefPtr<Event>) = 0;
+ virtual void trace(Visitor*) { }
+ virtual bool enqueueEvent(PassRefPtrWillBeRawPtr<Event>) = 0;
virtual bool cancelEvent(Event*) = 0;
// The accumulated and all the future events will be discarded, no events will be dispatched anymore.
virtual void close() = 0;
diff --git a/chromium/third_party/WebKit/Source/core/events/EventRetargeter.cpp b/chromium/third_party/WebKit/Source/core/events/EventRetargeter.cpp
deleted file mode 100644
index d225dbc94b9..00000000000
--- a/chromium/third_party/WebKit/Source/core/events/EventRetargeter.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (C) 2013 Google 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.
- */
-
-#include "config.h"
-#include "core/events/EventRetargeter.h"
-
-#include "RuntimeEnabledFeatures.h"
-#include "core/dom/ContainerNode.h"
-#include "core/dom/FullscreenElementStack.h"
-#include "core/dom/Touch.h"
-#include "core/dom/TouchList.h"
-#include "core/dom/TreeScope.h"
-#include "core/dom/shadow/InsertionPoint.h"
-#include "core/dom/shadow/ShadowRoot.h"
-#include "core/events/EventContext.h"
-#include "core/events/EventPath.h"
-#include "core/events/FocusEvent.h"
-#include "core/events/MouseEvent.h"
-#include "core/events/TouchEvent.h"
-#include "wtf/PassRefPtr.h"
-
-namespace WebCore {
-
-void EventRetargeter::adjustForMouseEvent(Node* node, MouseEvent& mouseEvent)
-{
- adjustForRelatedTarget(node, mouseEvent.relatedTarget(), mouseEvent.eventPath());
-}
-
-void EventRetargeter::adjustForFocusEvent(Node* node, FocusEvent& focusEvent)
-{
- adjustForRelatedTarget(node, focusEvent.relatedTarget(), focusEvent.eventPath());
-}
-
-void EventRetargeter::adjustForTouchEvent(Node* node, TouchEvent& touchEvent)
-{
- EventPath& eventPath = touchEvent.eventPath();
- size_t eventPathSize = eventPath.size();
-
- EventPathTouchLists eventPathTouches(eventPathSize);
- EventPathTouchLists eventPathTargetTouches(eventPathSize);
- EventPathTouchLists eventPathChangedTouches(eventPathSize);
-
- for (size_t i = 0; i < eventPathSize; ++i) {
- TouchEventContext* touchEventContext = eventPath[i].ensureTouchEventContext();
- eventPathTouches[i] = touchEventContext->touches();
- eventPathTargetTouches[i] = touchEventContext->targetTouches();
- eventPathChangedTouches[i] = touchEventContext->changedTouches();
- }
-
- adjustTouchList(node, touchEvent.touches(), eventPath, eventPathTouches);
- adjustTouchList(node, touchEvent.targetTouches(), eventPath, eventPathTargetTouches);
- adjustTouchList(node, touchEvent.changedTouches(), eventPath, eventPathChangedTouches);
-
-#ifndef NDEBUG
- for (size_t i = 0; i < eventPathSize; ++i) {
- checkReachability(node, eventPath[i].touchEventContext()->touches());
- checkReachability(node, eventPath[i].touchEventContext()->targetTouches());
- checkReachability(node, eventPath[i].touchEventContext()->changedTouches());
- }
-#endif
-}
-
-#ifndef NDEBUG
-void EventRetargeter::checkReachability(Node* node, TouchList* touchList)
-{
- for (size_t i = 0; i < touchList->length(); ++i)
- ASSERT(touchList->item(i)->target()->toNode()->treeScope().isInclusiveAncestorOf(node->treeScope()));
-}
-#endif
-
-void EventRetargeter::adjustTouchList(const Node* node, const TouchList* touchList, const EventPath& eventPath, EventPathTouchLists& eventPathTouchLists)
-{
- if (!touchList)
- return;
- size_t eventPathSize = eventPath.size();
- ASSERT(eventPathTouchLists.size() == eventPathSize);
- for (size_t i = 0; i < touchList->length(); ++i) {
- const Touch& touch = *touchList->item(i);
- AdjustedTargets adjustedNodes;
- calculateAdjustedNodes(node, touch.target()->toNode(), DoesNotStopAtBoundary, const_cast<EventPath&>(eventPath), adjustedNodes);
- ASSERT(adjustedNodes.size() == eventPathSize);
- for (size_t j = 0; j < eventPathSize; ++j)
- eventPathTouchLists[j]->append(touch.cloneWithNewTarget(adjustedNodes[j].get()));
- }
-}
-
-void EventRetargeter::adjustForRelatedTarget(const Node* node, EventTarget* relatedTarget, EventPath& eventPath)
-{
- if (!node)
- return;
- if (!relatedTarget)
- return;
- Node* relatedNode = relatedTarget->toNode();
- if (!relatedNode)
- return;
- AdjustedTargets adjustedNodes;
- calculateAdjustedNodes(node, relatedNode, StopAtBoundaryIfNeeded, eventPath, adjustedNodes);
- ASSERT(adjustedNodes.size() <= eventPath.size());
- for (size_t i = 0; i < adjustedNodes.size(); ++i) {
- eventPath[i].setRelatedTarget(adjustedNodes[i]);
- }
-}
-
-void EventRetargeter::calculateAdjustedNodes(const Node* node, const Node* relatedNode, EventWithRelatedTargetDispatchBehavior eventWithRelatedTargetDispatchBehavior, EventPath& eventPath, AdjustedTargets& adjustedTargets)
-{
- RelatedTargetMap relatedNodeMap;
- buildRelatedNodeMap(relatedNode, relatedNodeMap);
-
- // Synthetic mouse events can have a relatedTarget which is identical to the target.
- bool targetIsIdenticalToToRelatedTarget = (node == relatedNode);
-
- TreeScope* lastTreeScope = 0;
- EventTarget* adjustedTarget = 0;
-
- for (size_t i = 0; i < eventPath.size(); ++i) {
- TreeScope* scope = &eventPath[i].node()->treeScope();
- if (scope == lastTreeScope) {
- // Re-use the previous adjustedRelatedTarget if treeScope does not change. Just for the performance optimization.
- adjustedTargets.append(adjustedTarget);
- } else {
- adjustedTarget = findRelatedNode(scope, relatedNodeMap);
- adjustedTargets.append(adjustedTarget);
- }
- lastTreeScope = scope;
- if (eventWithRelatedTargetDispatchBehavior == DoesNotStopAtBoundary)
- continue;
- if (targetIsIdenticalToToRelatedTarget) {
- if (node->treeScope().rootNode() == eventPath[i].node()) {
- eventPath.shrink(i + 1);
- break;
- }
- } else if (eventPath[i].target() == adjustedTarget) {
- // Event dispatching should be stopped here.
- eventPath.shrink(i);
- adjustedTargets.shrink(adjustedTargets.size() - 1);
- break;
- }
- }
-}
-
-void EventRetargeter::buildRelatedNodeMap(const Node* relatedNode, RelatedTargetMap& relatedTargetMap)
-{
- TreeScope* lastTreeScope = 0;
- EventPath eventPath(const_cast<Node*>(relatedNode));
- for (size_t i = 0; i < eventPath.size(); ++i) {
- TreeScope* treeScope = &eventPath[i].node()->treeScope();
- if (treeScope != lastTreeScope)
- relatedTargetMap.add(treeScope, eventPath[i].target());
- lastTreeScope = treeScope;
- }
-}
-
-EventTarget* EventRetargeter::findRelatedNode(TreeScope* scope, RelatedTargetMap& relatedTargetMap)
-{
- Vector<TreeScope*, 32> parentTreeScopes;
- EventTarget* relatedNode = 0;
- while (scope) {
- parentTreeScopes.append(scope);
- RelatedTargetMap::const_iterator found = relatedTargetMap.find(scope);
- if (found != relatedTargetMap.end()) {
- relatedNode = found->value;
- break;
- }
- scope = scope->parentTreeScope();
- }
- for (Vector<TreeScope*, 32>::iterator iter = parentTreeScopes.begin(); iter < parentTreeScopes.end(); ++iter)
- relatedTargetMap.add(*iter, relatedNode);
- return relatedNode;
-}
-
-}
diff --git a/chromium/third_party/WebKit/Source/core/events/EventRetargeter.h b/chromium/third_party/WebKit/Source/core/events/EventRetargeter.h
deleted file mode 100644
index 38d391c348b..00000000000
--- a/chromium/third_party/WebKit/Source/core/events/EventRetargeter.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2013 Google 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 EventRetargeter_h
-#define EventRetargeter_h
-
-#include "wtf/HashMap.h"
-#include "wtf/RefPtr.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class EventPath;
-class EventTarget;
-class FocusEvent;
-class MouseEvent;
-class Node;
-class TouchEvent;
-class TouchList;
-class TreeScope;
-
-class EventRetargeter {
-public:
- static void adjustForMouseEvent(Node*, MouseEvent&);
- static void adjustForFocusEvent(Node*, FocusEvent&);
- typedef Vector<RefPtr<TouchList> > EventPathTouchLists;
- static void adjustForTouchEvent(Node*, TouchEvent&);
-
-private:
- typedef Vector<RefPtr<EventTarget> > AdjustedTargets;
- typedef HashMap<TreeScope*, EventTarget*> RelatedTargetMap;
- enum EventWithRelatedTargetDispatchBehavior {
- StopAtBoundaryIfNeeded,
- DoesNotStopAtBoundary
- };
- static void adjustForRelatedTarget(const Node*, EventTarget* relatedTarget, EventPath&);
- static void calculateAdjustedNodes(const Node*, const Node* relatedNode, EventWithRelatedTargetDispatchBehavior, EventPath&, AdjustedTargets&);
- static void buildRelatedNodeMap(const Node*, RelatedTargetMap&);
- static EventTarget* findRelatedNode(TreeScope*, RelatedTargetMap&);
- static void adjustTouchList(const Node*, const TouchList*, const EventPath&, EventPathTouchLists&);
-#ifndef NDEBUG
- static void checkReachability(Node*, TouchList*);
-#endif
-};
-
-}
-
-#endif // EventRetargeter_h
diff --git a/chromium/third_party/WebKit/Source/core/events/EventSender.h b/chromium/third_party/WebKit/Source/core/events/EventSender.h
index f07678f23c4..b5da763e59b 100644
--- a/chromium/third_party/WebKit/Source/core/events/EventSender.h
+++ b/chromium/third_party/WebKit/Source/core/events/EventSender.h
@@ -54,8 +54,8 @@ private:
AtomicString m_eventType;
Timer<EventSender<T> > m_timer;
- Vector<T*> m_dispatchSoonList;
- Vector<T*> m_dispatchingList;
+ WillBePersistentHeapVector<RawPtrWillBeMember<T> > m_dispatchSoonList;
+ WillBePersistentHeapVector<RawPtrWillBeMember<T> > m_dispatchingList;
};
template<typename T> EventSender<T>::EventSender(const AtomicString& eventType)
@@ -68,7 +68,7 @@ template<typename T> void EventSender<T>::dispatchEventSoon(T* sender)
{
m_dispatchSoonList.append(sender);
if (!m_timer.isActive())
- m_timer.startOneShot(0);
+ m_timer.startOneShot(0, FROM_HERE);
}
template<typename T> void EventSender<T>::cancelEvent(T* sender)
@@ -78,12 +78,12 @@ template<typename T> void EventSender<T>::cancelEvent(T* sender)
size_t size = m_dispatchSoonList.size();
for (size_t i = 0; i < size; ++i) {
if (m_dispatchSoonList[i] == sender)
- m_dispatchSoonList[i] = 0;
+ m_dispatchSoonList[i] = nullptr;
}
size = m_dispatchingList.size();
for (size_t i = 0; i < size; ++i) {
if (m_dispatchingList[i] == sender)
- m_dispatchingList[i] = 0;
+ m_dispatchingList[i] = nullptr;
}
}
@@ -101,7 +101,7 @@ template<typename T> void EventSender<T>::dispatchPendingEvents()
size_t size = m_dispatchingList.size();
for (size_t i = 0; i < size; ++i) {
if (T* sender = m_dispatchingList[i]) {
- m_dispatchingList[i] = 0;
+ m_dispatchingList[i] = nullptr;
sender->dispatchPendingEvent(this);
}
}
diff --git a/chromium/third_party/WebKit/Source/core/events/EventTarget.cpp b/chromium/third_party/WebKit/Source/core/events/EventTarget.cpp
index 6e96b47c6cd..04dea3543ff 100644
--- a/chromium/third_party/WebKit/Source/core/events/EventTarget.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/EventTarget.cpp
@@ -32,14 +32,14 @@
#include "config.h"
#include "core/events/EventTarget.h"
-#include "RuntimeEnabledFeatures.h"
-#include "bindings/v8/DOMWrapperWorld.h"
#include "bindings/v8/ExceptionState.h"
-#include "core/events/Event.h"
#include "core/dom/ExceptionCode.h"
+#include "core/dom/NoEventDispatchAssertion.h"
+#include "core/editing/Editor.h"
+#include "core/events/Event.h"
#include "core/inspector/InspectorInstrumentation.h"
-#include "core/frame/DOMWindow.h"
-#include "platform/UserGestureIndicator.h"
+#include "core/frame/LocalDOMWindow.h"
+#include "platform/RuntimeEnabledFeatures.h"
#include "wtf/StdLibExtras.h"
#include "wtf/Vector.h"
@@ -64,7 +64,7 @@ Node* EventTarget::toNode()
return 0;
}
-DOMWindow* EventTarget::toDOMWindow()
+LocalDOMWindow* EventTarget::toDOMWindow()
{
return 0;
}
@@ -74,7 +74,7 @@ MessagePort* EventTarget::toMessagePort()
return 0;
}
-inline DOMWindow* EventTarget::executingWindow()
+inline LocalDOMWindow* EventTarget::executingWindow()
{
if (ExecutionContext* context = executionContext())
return context->executingWindow();
@@ -83,6 +83,10 @@ inline DOMWindow* EventTarget::executingWindow()
bool EventTarget::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture)
{
+ // FIXME: listener null check should throw TypeError (and be done in
+ // generated bindings), but breaks legacy content. http://crbug.com/249598
+ if (!listener)
+ return false;
return ensureEventTargetData().eventListenerMap.add(eventType, listener, useCapture);
}
@@ -117,44 +121,34 @@ bool EventTarget::removeEventListener(const AtomicString& eventType, EventListen
return true;
}
-bool EventTarget::setAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld)
+bool EventTarget::setAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener)
{
- clearAttributeEventListener(eventType, isolatedWorld);
+ clearAttributeEventListener(eventType);
if (!listener)
return false;
return addEventListener(eventType, listener, false);
}
-EventListener* EventTarget::getAttributeEventListener(const AtomicString& eventType, DOMWrapperWorld* isolatedWorld)
+EventListener* EventTarget::getAttributeEventListener(const AtomicString& eventType)
{
const EventListenerVector& entry = getEventListeners(eventType);
for (size_t i = 0; i < entry.size(); ++i) {
EventListener* listener = entry[i].listener.get();
- if (listener->isAttribute()) {
- DOMWrapperWorld* listenerWorld = listener->world();
- // Worker listener
- if (!listenerWorld) {
- ASSERT(!isolatedWorld);
- return listener;
- }
- if (listenerWorld->isMainWorld() && !isolatedWorld)
- return listener;
- if (listenerWorld == isolatedWorld)
- return listener;
- }
+ if (listener->isAttribute() && listener->belongsToTheCurrentWorld())
+ return listener;
}
return 0;
}
-bool EventTarget::clearAttributeEventListener(const AtomicString& eventType, DOMWrapperWorld* isolatedWorld)
+bool EventTarget::clearAttributeEventListener(const AtomicString& eventType)
{
- EventListener* listener = getAttributeEventListener(eventType, isolatedWorld);
+ EventListener* listener = getAttributeEventListener(eventType);
if (!listener)
return false;
return removeEventListener(eventType, listener, false);
}
-bool EventTarget::dispatchEvent(PassRefPtr<Event> event, ExceptionState& exceptionState)
+bool EventTarget::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event, ExceptionState& exceptionState)
{
if (!event) {
exceptionState.throwDOMException(InvalidStateError, "The event provided is null.");
@@ -175,7 +169,7 @@ bool EventTarget::dispatchEvent(PassRefPtr<Event> event, ExceptionState& excepti
return dispatchEvent(event);
}
-bool EventTarget::dispatchEvent(PassRefPtr<Event> event)
+bool EventTarget::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event)
{
event->setTarget(this);
event->setCurrentTarget(this);
@@ -189,7 +183,7 @@ void EventTarget::uncaughtExceptionInEventHandler()
{
}
-static AtomicString legacyType(const Event* event)
+static const AtomicString& legacyType(const Event* event)
{
if (event->type() == EventTypeNames::transitionend)
return EventTypeNames::webkitTransitionEnd;
@@ -206,7 +200,7 @@ static AtomicString legacyType(const Event* event)
if (event->type() == EventTypeNames::wheel)
return EventTypeNames::mousewheel;
- return emptyString();
+ return emptyAtom;
}
void EventTarget::countLegacyEvents(const AtomicString& legacyTypeName, EventListenerVector* listenersVector, EventListenerVector* legacyListenersVector)
@@ -239,14 +233,14 @@ void EventTarget::countLegacyEvents(const AtomicString& legacyTypeName, EventLis
}
if (shouldCount) {
- if (DOMWindow* executingWindow = this->executingWindow()) {
+ if (LocalDOMWindow* executingWindow = this->executingWindow()) {
if (legacyListenersVector) {
if (listenersVector)
- UseCounter::count(executingWindow, prefixedAndUnprefixedFeature);
+ UseCounter::count(executingWindow->document(), prefixedAndUnprefixedFeature);
else
- UseCounter::count(executingWindow, prefixedFeature);
+ UseCounter::count(executingWindow->document(), prefixedFeature);
} else if (listenersVector) {
- UseCounter::count(executingWindow, unprefixedFeature);
+ UseCounter::count(executingWindow->document(), unprefixedFeature);
}
}
}
@@ -268,7 +262,11 @@ bool EventTarget::fireEventListeners(Event* event)
EventListenerVector* listenersVector = d->eventListenerMap.find(event->type());
if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && (event->type() == EventTypeNames::animationiteration || event->type() == EventTypeNames::animationend
- || event->type() == EventTypeNames::animationstart))
+ || event->type() == EventTypeNames::animationstart)
+ // Some code out-there uses custom events to dispatch unprefixed animation events manually,
+ // we can safely remove all this block when cssAnimationUnprefixedEnabled is always on, this
+ // is really a special case. DO NOT ADD MORE EVENTS HERE.
+ && event->interfaceName() != EventNames::CustomEvent)
listenersVector = 0;
if (listenersVector) {
@@ -280,13 +278,14 @@ bool EventTarget::fireEventListeners(Event* event)
event->setType(unprefixedTypeName);
}
+ Editor::countEvent(executionContext(), event);
countLegacyEvents(legacyTypeName, listenersVector, legacyListenersVector);
return !event->defaultPrevented();
}
void EventTarget::fireEventListeners(Event* event, EventTargetData* d, EventListenerVector& entry)
{
- RefPtr<EventTarget> protect = this;
+ RefPtrWillBeRawPtr<EventTarget> protect(this);
// Fire all listeners registered for this event. Don't fire listeners removed
// during event dispatch. Also, don't fire event listeners added during event
@@ -295,17 +294,22 @@ void EventTarget::fireEventListeners(Event* event, EventTargetData* d, EventList
// new event listeners.
if (event->type() == EventTypeNames::beforeunload) {
- if (DOMWindow* executingWindow = this->executingWindow()) {
+ if (LocalDOMWindow* executingWindow = this->executingWindow()) {
if (executingWindow->top())
- UseCounter::count(executingWindow, UseCounter::SubFrameBeforeUnloadFired);
- UseCounter::count(executingWindow, UseCounter::DocumentBeforeUnloadFired);
+ UseCounter::count(executingWindow->document(), UseCounter::SubFrameBeforeUnloadFired);
+ UseCounter::count(executingWindow->document(), UseCounter::DocumentBeforeUnloadFired);
}
} else if (event->type() == EventTypeNames::unload) {
- if (DOMWindow* executingWindow = this->executingWindow())
- UseCounter::count(executingWindow, UseCounter::DocumentUnloadFired);
+ if (LocalDOMWindow* executingWindow = this->executingWindow())
+ UseCounter::count(executingWindow->document(), UseCounter::DocumentUnloadFired);
+ } else if (event->type() == EventTypeNames::DOMFocusIn || event->type() == EventTypeNames::DOMFocusOut) {
+ if (LocalDOMWindow* executingWindow = this->executingWindow())
+ UseCounter::count(executingWindow->document(), UseCounter::DOMFocusInOutEvent);
+ } else if (event->type() == EventTypeNames::focusin || event->type() == EventTypeNames::focusout) {
+ if (LocalDOMWindow* executingWindow = this->executingWindow())
+ UseCounter::count(executingWindow->document(), UseCounter::FocusInOutEvent);
}
- bool userEventWasHandled = false;
size_t i = 0;
size_t size = entry.size();
if (!d->firingEventIterators)
@@ -327,19 +331,13 @@ void EventTarget::fireEventListeners(Event* event, EventTargetData* d, EventList
if (!context)
break;
- InspectorInstrumentationCookie cookie = InspectorInstrumentation::willHandleEvent(context, event);
+ InspectorInstrumentationCookie cookie = InspectorInstrumentation::willHandleEvent(this, event, registeredListener.listener.get(), registeredListener.useCapture);
// To match Mozilla, the AT_TARGET phase fires both capturing and bubbling
// event listeners, even though that violates some versions of the DOM spec.
registeredListener.listener->handleEvent(context, event);
- if (!userEventWasHandled && UserGestureIndicator::processingUserGesture())
- userEventWasHandled = true;
InspectorInstrumentation::didHandleEvent(cookie);
}
d->firingEventIterators->removeLast();
- if (userEventWasHandled) {
- if (ExecutionContext* context = executionContext())
- context->userEventWasHandled();
- }
}
const EventListenerVector& EventTarget::getEventListeners(const AtomicString& eventType)
@@ -357,6 +355,12 @@ const EventListenerVector& EventTarget::getEventListeners(const AtomicString& ev
return *listenerVector;
}
+Vector<AtomicString> EventTarget::eventTypes()
+{
+ EventTargetData* d = eventTargetData();
+ return d ? d->eventListenerMap.eventTypes() : Vector<AtomicString>();
+}
+
void EventTarget::removeAllEventListeners()
{
EventTargetData* d = eventTargetData();
diff --git a/chromium/third_party/WebKit/Source/core/events/EventTarget.h b/chromium/third_party/WebKit/Source/core/events/EventTarget.h
index fa2192538a2..2e86b3c77db 100644
--- a/chromium/third_party/WebKit/Source/core/events/EventTarget.h
+++ b/chromium/third_party/WebKit/Source/core/events/EventTarget.h
@@ -34,41 +34,17 @@
#include "core/events/EventListenerMap.h"
#include "core/events/ThreadLocalEventNames.h"
-#include "wtf/Forward.h"
+#include "platform/heap/Handle.h"
namespace WebCore {
-class ApplicationCache;
-class AudioContext;
-class DOMWindow;
-class DedicatedWorkerGlobalScope;
+class LocalDOMWindow;
class Event;
-class EventListener;
-class EventSource;
class ExceptionState;
-class FileReader;
-class FileWriter;
-class IDBDatabase;
-class IDBRequest;
-class IDBTransaction;
-class MIDIAccess;
-class MIDIInput;
-class MIDIPort;
-class MediaController;
-class MediaStream;
class MessagePort;
-class NamedFlow;
class Node;
-class Notification;
-class SVGElementInstance;
-class ExecutionContext;
-class ScriptProcessorNode;
-class SharedWorker;
-class SharedWorkerGlobalScope;
class TextTrack;
class TextTrackCue;
-class WebSocket;
-class Worker;
class XMLHttpRequest;
class XMLHttpRequestUpload;
@@ -96,36 +72,47 @@ public:
OwnPtr<FiringEventIteratorVector> firingEventIterators;
};
-class EventTarget {
+class EventTarget : public WillBeGarbageCollectedMixin {
public:
+#if !ENABLE(OILPAN)
void ref() { refEventTarget(); }
void deref() { derefEventTarget(); }
+#endif
virtual const AtomicString& interfaceName() const = 0;
virtual ExecutionContext* executionContext() const = 0;
virtual Node* toNode();
- virtual DOMWindow* toDOMWindow();
+ virtual LocalDOMWindow* toDOMWindow();
virtual MessagePort* toMessagePort();
- virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
- virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
+ // FIXME: first 2 args to addEventListener and removeEventListener should
+ // be required (per spec), but throwing TypeError breaks legacy content.
+ // http://crbug.com/353484
+ bool addEventListener() { return false; }
+ bool addEventListener(const AtomicString& eventType) { return false; }
+ virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture = false);
+ bool removeEventListener() { return false; }
+ bool removeEventListener(const AtomicString& eventType) { return false; }
+ virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture = false);
virtual void removeAllEventListeners();
- virtual bool dispatchEvent(PassRefPtr<Event>);
- bool dispatchEvent(PassRefPtr<Event>, ExceptionState&); // DOM API
+ virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>);
+ bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>, ExceptionState&); // DOM API
virtual void uncaughtExceptionInEventHandler();
// Used for legacy "onEvent" attribute APIs.
- bool setAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, DOMWrapperWorld* isolatedWorld = 0);
- EventListener* getAttributeEventListener(const AtomicString& eventType, DOMWrapperWorld* isolatedWorld = 0);
+ bool setAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener>);
+ EventListener* getAttributeEventListener(const AtomicString& eventType);
bool hasEventListeners() const;
bool hasEventListeners(const AtomicString& eventType) const;
bool hasCapturingEventListeners(const AtomicString& eventType);
const EventListenerVector& getEventListeners(const AtomicString& eventType);
+ Vector<AtomicString> eventTypes();
bool fireEventListeners(Event*);
- bool isFiringEventListeners();
+
+ virtual void trace(Visitor*) { }
protected:
virtual ~EventTarget();
@@ -135,15 +122,17 @@ protected:
virtual EventTargetData& ensureEventTargetData() = 0;
private:
+#if !ENABLE(OILPAN)
// Subclasses should likely not override these themselves; instead, they should use the REFCOUNTED_EVENT_TARGET() macro.
virtual void refEventTarget() = 0;
virtual void derefEventTarget() = 0;
+#endif
- DOMWindow* executingWindow();
+ LocalDOMWindow* executingWindow();
void fireEventListeners(Event*, EventTargetData*, EventListenerVector&);
void countLegacyEvents(const AtomicString& legacyTypeName, EventListenerVector*, EventListenerVector*);
- bool clearAttributeEventListener(const AtomicString& eventType, DOMWrapperWorld* isolatedWorld);
+ bool clearAttributeEventListener(const AtomicString& eventType);
friend class EventListenerIterator;
};
@@ -159,57 +148,49 @@ private:
// FIXME: These macros should be split into separate DEFINE and DECLARE
// macros to avoid causing so many header includes.
#define DEFINE_ATTRIBUTE_EVENT_LISTENER(attribute) \
- EventListener* on##attribute(DOMWrapperWorld* isolatedWorld) { return getAttributeEventListener(EventTypeNames::attribute, isolatedWorld); } \
- void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld = 0) { setAttributeEventListener(EventTypeNames::attribute, listener, isolatedWorld); } \
+ EventListener* on##attribute() { return getAttributeEventListener(EventTypeNames::attribute); } \
+ void setOn##attribute(PassRefPtr<EventListener> listener) { setAttributeEventListener(EventTypeNames::attribute, listener); } \
#define DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(attribute) \
- static EventListener* on##attribute(EventTarget* eventTarget, DOMWrapperWorld* isolatedWorld) { return eventTarget->getAttributeEventListener(EventTypeNames::attribute, isolatedWorld); } \
- static void setOn##attribute(EventTarget* eventTarget, PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld = 0) { eventTarget->setAttributeEventListener(EventTypeNames::attribute, listener, isolatedWorld); } \
+ static EventListener* on##attribute(EventTarget& eventTarget) { return eventTarget.getAttributeEventListener(EventTypeNames::attribute); } \
+ static void setOn##attribute(EventTarget& eventTarget, PassRefPtr<EventListener> listener) { eventTarget.setAttributeEventListener(EventTypeNames::attribute, listener); } \
#define DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(attribute) \
- EventListener* on##attribute(DOMWrapperWorld* isolatedWorld) { return document().getWindowAttributeEventListener(EventTypeNames::attribute, isolatedWorld); } \
- void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld) { document().setWindowAttributeEventListener(EventTypeNames::attribute, listener, isolatedWorld); } \
+ EventListener* on##attribute() { return document().getWindowAttributeEventListener(EventTypeNames::attribute); } \
+ void setOn##attribute(PassRefPtr<EventListener> listener) { document().setWindowAttributeEventListener(EventTypeNames::attribute, listener); } \
#define DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(attribute) \
- static EventListener* on##attribute(EventTarget* eventTarget, DOMWrapperWorld* isolatedWorld) { \
- if (Node* node = eventTarget->toNode()) \
- return node->document().getWindowAttributeEventListener(EventTypeNames::attribute, isolatedWorld); \
- ASSERT(eventTarget->toDOMWindow()); \
- return eventTarget->getAttributeEventListener(EventTypeNames::attribute, isolatedWorld); \
+ static EventListener* on##attribute(EventTarget& eventTarget) { \
+ if (Node* node = eventTarget.toNode()) \
+ return node->document().getWindowAttributeEventListener(EventTypeNames::attribute); \
+ ASSERT(eventTarget.toDOMWindow()); \
+ return eventTarget.getAttributeEventListener(EventTypeNames::attribute); \
} \
- static void setOn##attribute(EventTarget* eventTarget, PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld) { \
- if (Node* node = eventTarget->toNode()) \
- node->document().setWindowAttributeEventListener(EventTypeNames::attribute, listener, isolatedWorld); \
+ static void setOn##attribute(EventTarget& eventTarget, PassRefPtr<EventListener> listener) { \
+ if (Node* node = eventTarget.toNode()) \
+ node->document().setWindowAttributeEventListener(EventTypeNames::attribute, listener); \
else { \
- ASSERT(eventTarget->toDOMWindow()); \
- eventTarget->setAttributeEventListener(EventTypeNames::attribute, listener, isolatedWorld); \
+ ASSERT(eventTarget.toDOMWindow()); \
+ eventTarget.setAttributeEventListener(EventTypeNames::attribute, listener); \
} \
}
#define DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(attribute, eventName) \
- EventListener* on##attribute(DOMWrapperWorld* isolatedWorld) { return getAttributeEventListener(EventTypeNames::eventName, isolatedWorld); } \
- void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld) { setAttributeEventListener(EventTypeNames::eventName, listener, isolatedWorld); } \
+ EventListener* on##attribute() { return getAttributeEventListener(EventTypeNames::eventName); } \
+ void setOn##attribute(PassRefPtr<EventListener> listener) { setAttributeEventListener(EventTypeNames::eventName, listener); } \
#define DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(recipient, attribute) \
- EventListener* on##attribute(DOMWrapperWorld* isolatedWorld); \
- void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld);
+ EventListener* on##attribute(); \
+ void setOn##attribute(PassRefPtr<EventListener> listener);
#define DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(type, recipient, attribute) \
- EventListener* type::on##attribute(DOMWrapperWorld* isolatedWorld) { return recipient ? recipient->getAttributeEventListener(EventTypeNames::attribute, isolatedWorld) : 0; } \
- void type::setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld) \
+ EventListener* type::on##attribute() { return recipient ? recipient->getAttributeEventListener(EventTypeNames::attribute) : 0; } \
+ void type::setOn##attribute(PassRefPtr<EventListener> listener) \
{ \
if (recipient) \
- recipient->setAttributeEventListener(EventTypeNames::attribute, listener, isolatedWorld); \
+ recipient->setAttributeEventListener(EventTypeNames::attribute, listener); \
}
-inline bool EventTarget::isFiringEventListeners()
-{
- EventTargetData* d = eventTargetData();
- if (!d)
- return false;
- return d->firingEventIterators && !d->firingEventIterators->isEmpty();
-}
-
inline bool EventTarget::hasEventListeners() const
{
// FIXME: We should have a const version of eventTargetData.
@@ -236,6 +217,15 @@ inline bool EventTarget::hasCapturingEventListeners(const AtomicString& eventTyp
} // namespace WebCore
+#if ENABLE(OILPAN)
+#define DEFINE_EVENT_TARGET_REFCOUNTING(baseClass) \
+public: \
+ using baseClass::ref; \
+ using baseClass::deref; \
+private: \
+ typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro
+#define DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(baseClass)
+#else
#define DEFINE_EVENT_TARGET_REFCOUNTING(baseClass) \
public: \
using baseClass::ref; \
@@ -244,10 +234,12 @@ private: \
virtual void refEventTarget() OVERRIDE FINAL { ref(); } \
virtual void derefEventTarget() OVERRIDE FINAL { deref(); } \
typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro
+#define DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(baseClass) DEFINE_EVENT_TARGET_REFCOUNTING(baseClass)
+#endif
// Use this macro if your EventTarget subclass is also a subclass of WTF::RefCounted.
// A ref-counted class that uses a different method of refcounting should use DEFINE_EVENT_TARGET_REFCOUNTING directly.
// Both of these macros are meant to be placed just before the "public:" section of the class declaration.
-#define REFCOUNTED_EVENT_TARGET(className) DEFINE_EVENT_TARGET_REFCOUNTING(RefCounted<className>)
+#define REFCOUNTED_EVENT_TARGET(className) DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<className>)
#endif // EventTarget_h
diff --git a/chromium/third_party/WebKit/Source/core/events/EventTarget.idl b/chromium/third_party/WebKit/Source/core/events/EventTarget.idl
index 0cd1b1718f0..69a4bc18d7b 100644
--- a/chromium/third_party/WebKit/Source/core/events/EventTarget.idl
+++ b/chromium/third_party/WebKit/Source/core/events/EventTarget.idl
@@ -20,12 +20,15 @@
[
Custom=ToV8,
+ WillBeGarbageCollected,
] interface EventTarget {
- void addEventListener(DOMString type,
- EventListener listener,
+ // FIXME: first 2 args should be required, but throwing TypeError breaks
+ // legacy content. http://crbug.com/353484
+ void addEventListener([TreatNullAs=NullString] optional DOMString type,
+ optional EventListener listener,
optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
+ void removeEventListener([TreatNullAs=NullString] optional DOMString type,
+ optional EventListener listener,
optional boolean useCapture);
[RaisesException] boolean dispatchEvent(Event event);
};
diff --git a/chromium/third_party/WebKit/Source/core/events/EventTargetFactory.in b/chromium/third_party/WebKit/Source/core/events/EventTargetFactory.in
index fcb0aff0a75..2a528dddc5c 100644
--- a/chromium/third_party/WebKit/Source/core/events/EventTargetFactory.in
+++ b/chromium/third_party/WebKit/Source/core/events/EventTargetFactory.in
@@ -1,50 +1,24 @@
namespace="EventTarget"
+core/animation/AnimationPlayer
core/css/FontFaceSet
core/dom/MessagePort
core/dom/Node
-core/dom/WebKitNamedFlow ImplementedAs=NamedFlow
core/fileapi/FileReader
core/html/MediaController
core/html/ime/InputMethodContext
+core/html/track/AudioTrackList
core/html/track/TextTrack
core/html/track/TextTrackCue
core/html/track/TextTrackList
+core/html/track/VideoTrackList
core/loader/appcache/ApplicationCache
core/page/EventSource
core/timing/Performance
-core/frame/Window ImplementedAs=DOMWindow
-core/svg/SVGElementInstance
+core/frame/Window ImplementedAs=LocalDOMWindow
core/workers/DedicatedWorkerGlobalScope
core/workers/SharedWorker
core/workers/SharedWorkerGlobalScope
core/workers/Worker
core/xml/XMLHttpRequest
core/xml/XMLHttpRequestUpload
-modules/encryptedmedia/MediaKeySession
-modules/filesystem/FileWriter
-modules/indexeddb/IDBDatabase
-modules/indexeddb/IDBOpenDBRequest
-modules/indexeddb/IDBRequest
-modules/indexeddb/IDBTransaction
-modules/mediasource/MediaSource
-modules/mediasource/SourceBuffer
-modules/mediasource/SourceBufferList
-modules/mediasource/WebKitMediaSource
-modules/mediasource/WebKitSourceBufferList
-modules/mediastream/MediaStream
-modules/mediastream/MediaStreamTrack
-modules/mediastream/RTCDTMFSender
-modules/mediastream/RTCDataChannel
-modules/mediastream/RTCPeerConnection
-modules/notifications/Notification
-modules/notifications/WebKitNotification Conditional=LEGACY_NOTIFICATIONS
-modules/serviceworkers/ServiceWorkerGlobalScope
-modules/speech/SpeechRecognition
-modules/speech/SpeechSynthesisUtterance
-modules/webaudio/AudioContext Conditional=WEB_AUDIO
-modules/webaudio/AudioNode Conditional=WEB_AUDIO
-modules/webmidi/MIDIAccess
-modules/webmidi/MIDIInput
-modules/webmidi/MIDIPort
-modules/websockets/WebSocket
diff --git a/chromium/third_party/WebKit/Source/core/events/EventTypeNames.in b/chromium/third_party/WebKit/Source/core/events/EventTypeNames.in
index b8148018635..762fbef8594 100644
--- a/chromium/third_party/WebKit/Source/core/events/EventTypeNames.in
+++ b/chromium/third_party/WebKit/Source/core/events/EventTypeNames.in
@@ -25,7 +25,6 @@ autocomplete
autocompleteerror
beforecopy
beforecut
-beforeload
beforepaste
beforeunload
beginEvent
@@ -51,12 +50,15 @@ compositionstart
compositionupdate
connect
connecting
+contextlost
contextmenu
+contextrestored
copy
cuechange
cut
datachannel
dblclick
+devicelight
devicemotion
deviceorientation
dischargingtimechange
@@ -79,9 +81,12 @@ enter
error
exit
fetch
+finish
focus
focusin
focusout
+gamepadconnected
+gamepaddisconnected
gesturescrollend
gesturescrollstart
gesturescrollupdate
@@ -98,6 +103,7 @@ invalid
keydown
keypress
keyup
+languagechange
levelchange
load
loadeddata
@@ -119,6 +125,7 @@ mouseover
mouseup
mousewheel
mute
+needkey
negotiationneeded
nomatch
noupdate
@@ -134,9 +141,13 @@ paste
pause
play
playing
+pointerlockchange
+pointerlockerror
popstate
progress
+push
ratechange
+ready
readystatechange
removesourcebuffer
removestream
@@ -165,19 +176,23 @@ speechend
speechstart
stalled
start
+statechange
storage
submit
success
suspend
+sync
textInput
timeout
timeupdate
+toggle
tonechange
touchcancel
touchend
touchmove
touchstart
transitionend
+typechange
unload
unmute
update
@@ -214,8 +229,6 @@ webkitprerenderdomcontentloaded
webkitprerenderload
webkitprerenderstart
webkitprerenderstop
-webkitregionlayoutupdate
-webkitregionoversetchange
webkitremovesourcebuffer
webkitresourcetimingbufferfull
webkitsourceclose
diff --git a/chromium/third_party/WebKit/Source/core/events/FocusEvent.cpp b/chromium/third_party/WebKit/Source/core/events/FocusEvent.cpp
index e201de0c419..a541b3bb60e 100644
--- a/chromium/third_party/WebKit/Source/core/events/FocusEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/FocusEvent.cpp
@@ -28,13 +28,11 @@
#include "core/events/Event.h"
#include "core/events/EventDispatcher.h"
-#include "core/events/EventRetargeter.h"
-#include "core/events/ThreadLocalEventNames.h"
namespace WebCore {
FocusEventInit::FocusEventInit()
- : relatedTarget(0)
+ : relatedTarget(nullptr)
{
}
@@ -53,7 +51,7 @@ FocusEvent::FocusEvent()
ScriptWrappable::init(this);
}
-FocusEvent::FocusEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view, int detail, EventTarget* relatedTarget)
+FocusEvent::FocusEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view, int detail, EventTarget* relatedTarget)
: UIEvent(type, canBubble, cancelable, view, detail)
, m_relatedTarget(relatedTarget)
{
@@ -67,67 +65,73 @@ FocusEvent::FocusEvent(const AtomicString& type, const FocusEventInit& initializ
ScriptWrappable::init(this);
}
-PassRefPtr<FocusEventDispatchMediator> FocusEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent)
+void FocusEvent::trace(Visitor* visitor)
{
- return adoptRef(new FocusEventDispatchMediator(focusEvent));
+ visitor->trace(m_relatedTarget);
+ UIEvent::trace(visitor);
}
-FocusEventDispatchMediator::FocusEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent)
+PassRefPtrWillBeRawPtr<FocusEventDispatchMediator> FocusEventDispatchMediator::create(PassRefPtrWillBeRawPtr<FocusEvent> focusEvent)
+{
+ return adoptRefWillBeNoop(new FocusEventDispatchMediator(focusEvent));
+}
+
+FocusEventDispatchMediator::FocusEventDispatchMediator(PassRefPtrWillBeRawPtr<FocusEvent> focusEvent)
: EventDispatchMediator(focusEvent)
{
}
bool FocusEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
{
- EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event());
+ event()->eventPath().adjustForRelatedTarget(dispatcher->node(), event()->relatedTarget());
return EventDispatchMediator::dispatchEvent(dispatcher);
}
-PassRefPtr<BlurEventDispatchMediator> BlurEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent)
+PassRefPtrWillBeRawPtr<BlurEventDispatchMediator> BlurEventDispatchMediator::create(PassRefPtrWillBeRawPtr<FocusEvent> focusEvent)
{
- return adoptRef(new BlurEventDispatchMediator(focusEvent));
+ return adoptRefWillBeNoop(new BlurEventDispatchMediator(focusEvent));
}
-BlurEventDispatchMediator::BlurEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent)
+BlurEventDispatchMediator::BlurEventDispatchMediator(PassRefPtrWillBeRawPtr<FocusEvent> focusEvent)
: EventDispatchMediator(focusEvent)
{
}
bool BlurEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
{
- EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event());
+ event()->eventPath().adjustForRelatedTarget(dispatcher->node(), event()->relatedTarget());
return EventDispatchMediator::dispatchEvent(dispatcher);
}
-PassRefPtr<FocusInEventDispatchMediator> FocusInEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent)
+PassRefPtrWillBeRawPtr<FocusInEventDispatchMediator> FocusInEventDispatchMediator::create(PassRefPtrWillBeRawPtr<FocusEvent> focusEvent)
{
- return adoptRef(new FocusInEventDispatchMediator(focusEvent));
+ return adoptRefWillBeNoop(new FocusInEventDispatchMediator(focusEvent));
}
-FocusInEventDispatchMediator::FocusInEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent)
+FocusInEventDispatchMediator::FocusInEventDispatchMediator(PassRefPtrWillBeRawPtr<FocusEvent> focusEvent)
: EventDispatchMediator(focusEvent)
{
}
bool FocusInEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
{
- EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event());
+ event()->eventPath().adjustForRelatedTarget(dispatcher->node(), event()->relatedTarget());
return EventDispatchMediator::dispatchEvent(dispatcher);
}
-PassRefPtr<FocusOutEventDispatchMediator> FocusOutEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent)
+PassRefPtrWillBeRawPtr<FocusOutEventDispatchMediator> FocusOutEventDispatchMediator::create(PassRefPtrWillBeRawPtr<FocusEvent> focusEvent)
{
- return adoptRef(new FocusOutEventDispatchMediator(focusEvent));
+ return adoptRefWillBeNoop(new FocusOutEventDispatchMediator(focusEvent));
}
-FocusOutEventDispatchMediator::FocusOutEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent)
+FocusOutEventDispatchMediator::FocusOutEventDispatchMediator(PassRefPtrWillBeRawPtr<FocusEvent> focusEvent)
: EventDispatchMediator(focusEvent)
{
}
bool FocusOutEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
{
- EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event());
+ event()->eventPath().adjustForRelatedTarget(dispatcher->node(), event()->relatedTarget());
return EventDispatchMediator::dispatchEvent(dispatcher);
}
diff --git a/chromium/third_party/WebKit/Source/core/events/FocusEvent.h b/chromium/third_party/WebKit/Source/core/events/FocusEvent.h
index 20a9a28c0fe..5af4eb62f4e 100644
--- a/chromium/third_party/WebKit/Source/core/events/FocusEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/FocusEvent.h
@@ -36,75 +36,77 @@ class Node;
struct FocusEventInit : public UIEventInit {
FocusEventInit();
- RefPtr<EventTarget> relatedTarget;
+ RefPtrWillBeMember<EventTarget> relatedTarget;
};
-class FocusEvent : public UIEvent {
+class FocusEvent FINAL : public UIEvent {
public:
- static PassRefPtr<FocusEvent> create()
+ static PassRefPtrWillBeRawPtr<FocusEvent> create()
{
- return adoptRef(new FocusEvent);
+ return adoptRefWillBeNoop(new FocusEvent);
}
- static PassRefPtr<FocusEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view, int detail, EventTarget* relatedTarget)
+ static PassRefPtrWillBeRawPtr<FocusEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view, int detail, EventTarget* relatedTarget)
{
- return adoptRef(new FocusEvent(type, canBubble, cancelable, view, detail, relatedTarget));
+ return adoptRefWillBeNoop(new FocusEvent(type, canBubble, cancelable, view, detail, relatedTarget));
}
- static PassRefPtr<FocusEvent> create(const AtomicString& type, const FocusEventInit& initializer)
+ static PassRefPtrWillBeRawPtr<FocusEvent> create(const AtomicString& type, const FocusEventInit& initializer)
{
- return adoptRef(new FocusEvent(type, initializer));
+ return adoptRefWillBeNoop(new FocusEvent(type, initializer));
}
EventTarget* relatedTarget() const { return m_relatedTarget.get(); }
EventTarget* relatedTarget(bool& isNull) const { isNull = !m_relatedTarget; return m_relatedTarget.get(); }
void setRelatedTarget(EventTarget* relatedTarget) { m_relatedTarget = relatedTarget; }
- virtual const AtomicString& interfaceName() const;
- virtual bool isFocusEvent() const;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+ virtual bool isFocusEvent() const OVERRIDE;
+
+ virtual void trace(Visitor*) OVERRIDE;
private:
FocusEvent();
- FocusEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, int, EventTarget*);
+ FocusEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>, int, EventTarget*);
FocusEvent(const AtomicString& type, const FocusEventInit&);
- RefPtr<EventTarget> m_relatedTarget;
+ RefPtrWillBeMember<EventTarget> m_relatedTarget;
};
DEFINE_EVENT_TYPE_CASTS(FocusEvent);
-class FocusEventDispatchMediator : public EventDispatchMediator {
+class FocusEventDispatchMediator FINAL : public EventDispatchMediator {
public:
- static PassRefPtr<FocusEventDispatchMediator> create(PassRefPtr<FocusEvent>);
+ static PassRefPtrWillBeRawPtr<FocusEventDispatchMediator> create(PassRefPtrWillBeRawPtr<FocusEvent>);
private:
- explicit FocusEventDispatchMediator(PassRefPtr<FocusEvent>);
+ explicit FocusEventDispatchMediator(PassRefPtrWillBeRawPtr<FocusEvent>);
FocusEvent* event() const { return static_cast<FocusEvent*>(EventDispatchMediator::event()); }
virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
};
-class BlurEventDispatchMediator : public EventDispatchMediator {
+class BlurEventDispatchMediator FINAL : public EventDispatchMediator {
public:
- static PassRefPtr<BlurEventDispatchMediator> create(PassRefPtr<FocusEvent>);
+ static PassRefPtrWillBeRawPtr<BlurEventDispatchMediator> create(PassRefPtrWillBeRawPtr<FocusEvent>);
private:
- explicit BlurEventDispatchMediator(PassRefPtr<FocusEvent>);
+ explicit BlurEventDispatchMediator(PassRefPtrWillBeRawPtr<FocusEvent>);
FocusEvent* event() const { return static_cast<FocusEvent*>(EventDispatchMediator::event()); }
virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
};
-class FocusInEventDispatchMediator : public EventDispatchMediator {
+class FocusInEventDispatchMediator FINAL : public EventDispatchMediator {
public:
- static PassRefPtr<FocusInEventDispatchMediator> create(PassRefPtr<FocusEvent>);
+ static PassRefPtrWillBeRawPtr<FocusInEventDispatchMediator> create(PassRefPtrWillBeRawPtr<FocusEvent>);
private:
- explicit FocusInEventDispatchMediator(PassRefPtr<FocusEvent>);
+ explicit FocusInEventDispatchMediator(PassRefPtrWillBeRawPtr<FocusEvent>);
FocusEvent* event() const { return static_cast<FocusEvent*>(EventDispatchMediator::event()); }
virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
};
-class FocusOutEventDispatchMediator : public EventDispatchMediator {
+class FocusOutEventDispatchMediator FINAL : public EventDispatchMediator {
public:
- static PassRefPtr<FocusOutEventDispatchMediator> create(PassRefPtr<FocusEvent>);
+ static PassRefPtrWillBeRawPtr<FocusOutEventDispatchMediator> create(PassRefPtrWillBeRawPtr<FocusEvent>);
private:
- explicit FocusOutEventDispatchMediator(PassRefPtr<FocusEvent>);
+ explicit FocusOutEventDispatchMediator(PassRefPtrWillBeRawPtr<FocusEvent>);
FocusEvent* event() const { return static_cast<FocusEvent*>(EventDispatchMediator::event()); }
virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
};
diff --git a/chromium/third_party/WebKit/Source/core/events/GenericEventQueue.cpp b/chromium/third_party/WebKit/Source/core/events/GenericEventQueue.cpp
index b35f85c09f9..bc53048ddf4 100644
--- a/chromium/third_party/WebKit/Source/core/events/GenericEventQueue.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/GenericEventQueue.cpp
@@ -28,13 +28,14 @@
#include "core/events/GenericEventQueue.h"
#include "core/events/Event.h"
+#include "core/inspector/InspectorInstrumentation.h"
#include "platform/TraceEvent.h"
namespace WebCore {
-PassOwnPtr<GenericEventQueue> GenericEventQueue::create(EventTarget* owner)
+PassOwnPtrWillBeRawPtr<GenericEventQueue> GenericEventQueue::create(EventTarget* owner)
{
- return adoptPtr(new GenericEventQueue(owner));
+ return adoptPtrWillBeNoop(new GenericEventQueue(owner));
}
GenericEventQueue::GenericEventQueue(EventTarget* owner)
@@ -48,19 +49,27 @@ GenericEventQueue::~GenericEventQueue()
{
}
-bool GenericEventQueue::enqueueEvent(PassRefPtr<Event> event)
+void GenericEventQueue::trace(Visitor* visitor)
+{
+ visitor->trace(m_owner);
+ visitor->trace(m_pendingEvents);
+ EventQueue::trace(visitor);
+}
+
+bool GenericEventQueue::enqueueEvent(PassRefPtrWillBeRawPtr<Event> event)
{
if (m_isClosed)
return false;
if (event->target() == m_owner)
- event->setTarget(0);
+ event->setTarget(nullptr);
- TRACE_EVENT_ASYNC_BEGIN1("event", "GenericEventQueue:enqueueEvent", event.get(), "type", event->type().string().ascii());
+ TRACE_EVENT_ASYNC_BEGIN1("event", "GenericEventQueue:enqueueEvent", event.get(), "type", event->type().ascii());
+ InspectorInstrumentation::didEnqueueEvent(event->target() ? event->target() : m_owner.get(), event.get());
m_pendingEvents.append(event);
if (!m_timer.isActive())
- m_timer.startOneShot(0);
+ m_timer.startOneShot(0, FROM_HERE);
return true;
}
@@ -70,8 +79,9 @@ bool GenericEventQueue::cancelEvent(Event* event)
bool found = m_pendingEvents.contains(event);
if (found) {
+ InspectorInstrumentation::didRemoveEvent(event->target() ? event->target() : m_owner.get(), event);
m_pendingEvents.remove(m_pendingEvents.find(event));
- TRACE_EVENT_ASYNC_END2("event", "GenericEventQueue:enqueueEvent", event, "type", event->type().string().ascii(), "status", "cancelled");
+ TRACE_EVENT_ASYNC_END2("event", "GenericEventQueue:enqueueEvent", event, "type", event->type().ascii(), "status", "cancelled");
}
if (m_pendingEvents.isEmpty())
@@ -85,17 +95,18 @@ void GenericEventQueue::timerFired(Timer<GenericEventQueue>*)
ASSERT(!m_timer.isActive());
ASSERT(!m_pendingEvents.isEmpty());
- Vector<RefPtr<Event> > pendingEvents;
+ WillBeHeapVector<RefPtrWillBeMember<Event> > pendingEvents;
m_pendingEvents.swap(pendingEvents);
- RefPtr<EventTarget> protect(m_owner);
+ RefPtrWillBeRawPtr<EventTarget> protect(m_owner.get());
for (size_t i = 0; i < pendingEvents.size(); ++i) {
Event* event = pendingEvents[i].get();
- EventTarget* target = event->target() ? event->target() : m_owner;
- CString type(event->type().string().ascii());
+ EventTarget* target = event->target() ? event->target() : m_owner.get();
+ CString type(event->type().ascii());
TRACE_EVENT_ASYNC_STEP_INTO1("event", "GenericEventQueue:enqueueEvent", event, "dispatch", "type", type);
- target->dispatchEvent(pendingEvents[i].release());
+ target->dispatchEvent(pendingEvents[i]);
TRACE_EVENT_ASYNC_END1("event", "GenericEventQueue:enqueueEvent", event, "type", type);
+ InspectorInstrumentation::didRemoveEvent(target, event);
}
}
@@ -111,7 +122,8 @@ void GenericEventQueue::cancelAllEvents()
for (size_t i = 0; i < m_pendingEvents.size(); ++i) {
Event* event = m_pendingEvents[i].get();
- TRACE_EVENT_ASYNC_END2("event", "GenericEventQueue:enqueueEvent", event, "type", event->type().string().ascii(), "status", "cancelled");
+ TRACE_EVENT_ASYNC_END2("event", "GenericEventQueue:enqueueEvent", event, "type", event->type().ascii(), "status", "cancelled");
+ InspectorInstrumentation::didRemoveEvent(event->target() ? event->target() : m_owner.get(), event);
}
m_pendingEvents.clear();
}
diff --git a/chromium/third_party/WebKit/Source/core/events/GenericEventQueue.h b/chromium/third_party/WebKit/Source/core/events/GenericEventQueue.h
index ab80f89a8ff..45ca524b315 100644
--- a/chromium/third_party/WebKit/Source/core/events/GenericEventQueue.h
+++ b/chromium/third_party/WebKit/Source/core/events/GenericEventQueue.h
@@ -35,15 +35,15 @@
namespace WebCore {
-class GenericEventQueue : public EventQueue {
- WTF_MAKE_FAST_ALLOCATED;
+class GenericEventQueue FINAL : public EventQueue {
+ WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
public:
- explicit GenericEventQueue(EventTarget*);
- static PassOwnPtr<GenericEventQueue> create(EventTarget*);
+ static PassOwnPtrWillBeRawPtr<GenericEventQueue> create(EventTarget*);
virtual ~GenericEventQueue();
// EventQueue
- virtual bool enqueueEvent(PassRefPtr<Event>) OVERRIDE;
+ virtual void trace(Visitor*) OVERRIDE;
+ virtual bool enqueueEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE;
virtual bool cancelEvent(Event*) OVERRIDE;
virtual void close() OVERRIDE;
@@ -51,10 +51,11 @@ public:
bool hasPendingEvents() const;
private:
+ explicit GenericEventQueue(EventTarget*);
void timerFired(Timer<GenericEventQueue>*);
- EventTarget* m_owner;
- Vector<RefPtr<Event> > m_pendingEvents;
+ RawPtrWillBeMember<EventTarget> m_owner;
+ WillBeHeapVector<RefPtrWillBeMember<Event> > m_pendingEvents;
Timer<GenericEventQueue> m_timer;
bool m_isClosed;
diff --git a/chromium/third_party/WebKit/Source/core/events/GestureEvent.cpp b/chromium/third_party/WebKit/Source/core/events/GestureEvent.cpp
index 13d5f6f2a01..1fb72214e80 100644
--- a/chromium/third_party/WebKit/Source/core/events/GestureEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/GestureEvent.cpp
@@ -30,12 +30,7 @@
namespace WebCore {
-PassRefPtr<GestureEvent> GestureEvent::create()
-{
- return adoptRef(new GestureEvent);
-}
-
-PassRefPtr<GestureEvent> GestureEvent::create(PassRefPtr<AbstractView> view, const PlatformGestureEvent& event)
+PassRefPtrWillBeRawPtr<GestureEvent> GestureEvent::create(PassRefPtrWillBeRawPtr<AbstractView> view, const PlatformGestureEvent& event)
{
AtomicString eventType;
float deltaX = 0;
@@ -68,27 +63,9 @@ PassRefPtr<GestureEvent> GestureEvent::create(PassRefPtr<AbstractView> view, con
case PlatformEvent::GesturePinchUpdate:
case PlatformEvent::GestureTapDownCancel:
default:
- return 0;
+ return nullptr;
}
- return adoptRef(new GestureEvent(eventType, view, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(), event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), deltaX, deltaY));
-}
-
-void GestureEvent::initGestureEvent(const AtomicString& type, PassRefPtr<AbstractView> view, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, float deltaX, float deltaY)
-{
- if (dispatched())
- return;
-
- initUIEvent(type, true, true, view, 0);
- m_screenLocation = IntPoint(screenX, screenY);
- m_ctrlKey = ctrlKey;
- m_altKey = altKey;
- m_shiftKey = shiftKey;
- m_metaKey = metaKey;
-
- m_deltaX = deltaX;
- m_deltaY = deltaY;
-
- initCoordinates(IntPoint(clientX, clientY));
+ return adoptRefWillBeNoop(new GestureEvent(eventType, view, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(), event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), deltaX, deltaY));
}
const AtomicString& GestureEvent::interfaceName() const
@@ -110,14 +87,19 @@ GestureEvent::GestureEvent()
{
}
-GestureEvent::GestureEvent(const AtomicString& type, PassRefPtr<AbstractView> view, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, float deltaX, float deltaY)
+GestureEvent::GestureEvent(const AtomicString& type, PassRefPtrWillBeRawPtr<AbstractView> view, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, float deltaX, float deltaY)
: MouseRelatedEvent(type, true, true, view, 0, IntPoint(screenX, screenY), IntPoint(clientX, clientY), IntPoint(0, 0), ctrlKey, altKey, shiftKey, metaKey)
, m_deltaX(deltaX)
, m_deltaY(deltaY)
{
}
-GestureEventDispatchMediator::GestureEventDispatchMediator(PassRefPtr<GestureEvent> gestureEvent)
+void GestureEvent::trace(Visitor* visitor)
+{
+ MouseRelatedEvent::trace(visitor);
+}
+
+GestureEventDispatchMediator::GestureEventDispatchMediator(PassRefPtrWillBeRawPtr<GestureEvent> gestureEvent)
: EventDispatchMediator(gestureEvent)
{
}
diff --git a/chromium/third_party/WebKit/Source/core/events/GestureEvent.h b/chromium/third_party/WebKit/Source/core/events/GestureEvent.h
index fe982006c92..f92a87578c8 100644
--- a/chromium/third_party/WebKit/Source/core/events/GestureEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/GestureEvent.h
@@ -32,39 +32,38 @@
namespace WebCore {
-class GestureEvent : public MouseRelatedEvent {
+class GestureEvent FINAL : public MouseRelatedEvent {
public:
virtual ~GestureEvent() { }
- static PassRefPtr<GestureEvent> create();
- static PassRefPtr<GestureEvent> create(PassRefPtr<AbstractView>, const PlatformGestureEvent&);
-
- void initGestureEvent(const AtomicString& type, PassRefPtr<AbstractView>, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, float deltaX, float deltaY);
+ static PassRefPtrWillBeRawPtr<GestureEvent> create(PassRefPtrWillBeRawPtr<AbstractView>, const PlatformGestureEvent&);
virtual bool isGestureEvent() const OVERRIDE;
- virtual const AtomicString& interfaceName() const;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
float deltaX() const { return m_deltaX; }
float deltaY() const { return m_deltaY; }
+ virtual void trace(Visitor*) OVERRIDE;
+
private:
GestureEvent();
- GestureEvent(const AtomicString& type, PassRefPtr<AbstractView>, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, float deltaX, float deltaY);
+ GestureEvent(const AtomicString& type, PassRefPtrWillBeRawPtr<AbstractView>, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, float deltaX, float deltaY);
float m_deltaX;
float m_deltaY;
};
-class GestureEventDispatchMediator : public EventDispatchMediator {
+class GestureEventDispatchMediator FINAL : public EventDispatchMediator {
public:
- static PassRefPtr<GestureEventDispatchMediator> create(PassRefPtr<GestureEvent> gestureEvent)
+ static PassRefPtrWillBeRawPtr<GestureEventDispatchMediator> create(PassRefPtrWillBeRawPtr<GestureEvent> gestureEvent)
{
- return adoptRef(new GestureEventDispatchMediator(gestureEvent));
+ return adoptRefWillBeNoop(new GestureEventDispatchMediator(gestureEvent));
}
private:
- explicit GestureEventDispatchMediator(PassRefPtr<GestureEvent>);
+ explicit GestureEventDispatchMediator(PassRefPtrWillBeRawPtr<GestureEvent>);
GestureEvent* event() const;
diff --git a/chromium/third_party/WebKit/Source/core/events/HashChangeEvent.h b/chromium/third_party/WebKit/Source/core/events/HashChangeEvent.h
index e652df8dca6..334a443fe57 100644
--- a/chromium/third_party/WebKit/Source/core/events/HashChangeEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/HashChangeEvent.h
@@ -22,7 +22,6 @@
#define HashChangeEvent_h
#include "core/events/Event.h"
-#include "core/events/ThreadLocalEventNames.h"
namespace WebCore {
@@ -35,21 +34,21 @@ struct HashChangeEventInit : public EventInit {
String newURL;
};
-class HashChangeEvent : public Event {
+class HashChangeEvent FINAL : public Event {
public:
- static PassRefPtr<HashChangeEvent> create()
+ static PassRefPtrWillBeRawPtr<HashChangeEvent> create()
{
- return adoptRef(new HashChangeEvent);
+ return adoptRefWillBeNoop(new HashChangeEvent);
}
- static PassRefPtr<HashChangeEvent> create(const String& oldURL, const String& newURL)
+ static PassRefPtrWillBeRawPtr<HashChangeEvent> create(const String& oldURL, const String& newURL)
{
- return adoptRef(new HashChangeEvent(oldURL, newURL));
+ return adoptRefWillBeNoop(new HashChangeEvent(oldURL, newURL));
}
- static PassRefPtr<HashChangeEvent> create(const AtomicString& type, const HashChangeEventInit& initializer)
+ static PassRefPtrWillBeRawPtr<HashChangeEvent> create(const AtomicString& type, const HashChangeEventInit& initializer)
{
- return adoptRef(new HashChangeEvent(type, initializer));
+ return adoptRefWillBeNoop(new HashChangeEvent(type, initializer));
}
void initHashChangeEvent(const AtomicString& eventType, bool canBubble, bool cancelable, const String& oldURL, const String& newURL)
@@ -66,7 +65,9 @@ public:
const String& oldURL() const { return m_oldURL; }
const String& newURL() const { return m_newURL; }
- virtual const AtomicString& interfaceName() const { return EventNames::HashChangeEvent; }
+ virtual const AtomicString& interfaceName() const OVERRIDE { return EventNames::HashChangeEvent; }
+
+ virtual void trace(Visitor* visitor) OVERRIDE { Event::trace(visitor); }
private:
HashChangeEvent()
diff --git a/chromium/third_party/WebKit/Source/core/events/KeyboardEvent.cpp b/chromium/third_party/WebKit/Source/core/events/KeyboardEvent.cpp
index c03712edadd..a529f490977 100644
--- a/chromium/third_party/WebKit/Source/core/events/KeyboardEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/KeyboardEvent.cpp
@@ -23,7 +23,6 @@
#include "config.h"
#include "core/events/KeyboardEvent.h"
-#include "core/events/ThreadLocalEventNames.h"
#include "platform/PlatformKeyboardEvent.h"
#include "platform/WindowsKeyboardCodes.h"
@@ -217,21 +216,17 @@ int KeyboardEvent::which() const
return keyCode();
}
-KeyboardEvent* findKeyboardEvent(Event* event)
+void KeyboardEvent::trace(Visitor* visitor)
{
- for (Event* e = event; e; e = e->underlyingEvent()) {
- if (e->isKeyboardEvent())
- return toKeyboardEvent(e);
- }
- return 0;
+ UIEventWithKeyState::trace(visitor);
}
-PassRefPtr<KeyboardEventDispatchMediator> KeyboardEventDispatchMediator::create(PassRefPtr<KeyboardEvent> event)
+PassRefPtrWillBeRawPtr<KeyboardEventDispatchMediator> KeyboardEventDispatchMediator::create(PassRefPtrWillBeRawPtr<KeyboardEvent> event)
{
- return adoptRef(new KeyboardEventDispatchMediator(event));
+ return adoptRefWillBeNoop(new KeyboardEventDispatchMediator(event));
}
-KeyboardEventDispatchMediator::KeyboardEventDispatchMediator(PassRefPtr<KeyboardEvent> event)
+KeyboardEventDispatchMediator::KeyboardEventDispatchMediator(PassRefPtrWillBeRawPtr<KeyboardEvent> event)
: EventDispatchMediator(event)
{
}
diff --git a/chromium/third_party/WebKit/Source/core/events/KeyboardEvent.h b/chromium/third_party/WebKit/Source/core/events/KeyboardEvent.h
index e4d1e9e6462..efd32a5bd7c 100644
--- a/chromium/third_party/WebKit/Source/core/events/KeyboardEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/KeyboardEvent.h
@@ -45,7 +45,7 @@ struct KeyboardEventInit : public UIEventInit {
bool repeat;
};
-class KeyboardEvent : public UIEventWithKeyState {
+class KeyboardEvent FINAL : public UIEventWithKeyState {
public:
enum KeyLocationCode {
DOM_KEY_LOCATION_STANDARD = 0x00,
@@ -54,26 +54,26 @@ public:
DOM_KEY_LOCATION_NUMPAD = 0x03
};
- static PassRefPtr<KeyboardEvent> create()
+ static PassRefPtrWillBeRawPtr<KeyboardEvent> create()
{
- return adoptRef(new KeyboardEvent);
+ return adoptRefWillBeNoop(new KeyboardEvent);
}
- static PassRefPtr<KeyboardEvent> create(const PlatformKeyboardEvent& platformEvent, AbstractView* view)
+ static PassRefPtrWillBeRawPtr<KeyboardEvent> create(const PlatformKeyboardEvent& platformEvent, AbstractView* view)
{
- return adoptRef(new KeyboardEvent(platformEvent, view));
+ return adoptRefWillBeNoop(new KeyboardEvent(platformEvent, view));
}
- static PassRefPtr<KeyboardEvent> create(const AtomicString& type, const KeyboardEventInit& initializer)
+ static PassRefPtrWillBeRawPtr<KeyboardEvent> create(const AtomicString& type, const KeyboardEventInit& initializer)
{
- return adoptRef(new KeyboardEvent(type, initializer));
+ return adoptRefWillBeNoop(new KeyboardEvent(type, initializer));
}
- static PassRefPtr<KeyboardEvent> create(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view,
+ static PassRefPtrWillBeRawPtr<KeyboardEvent> create(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view,
const String& keyIdentifier, unsigned location,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey)
{
- return adoptRef(new KeyboardEvent(type, canBubble, cancelable, view, keyIdentifier, location,
+ return adoptRefWillBeNoop(new KeyboardEvent(type, canBubble, cancelable, view, keyIdentifier, location,
ctrlKey, altKey, shiftKey, metaKey, altGraphKey));
}
@@ -92,13 +92,15 @@ public:
const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); }
- int keyCode() const; // key code for keydown and keyup, character for keypress
- int charCode() const; // character code for keypress, 0 for keydown and keyup
+ virtual int keyCode() const OVERRIDE; // key code for keydown and keyup, character for keypress
+ virtual int charCode() const OVERRIDE; // character code for keypress, 0 for keydown and keyup
bool repeat() const { return m_isAutoRepeat; }
- virtual const AtomicString& interfaceName() const;
- virtual bool isKeyboardEvent() const;
- virtual int which() const;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+ virtual bool isKeyboardEvent() const OVERRIDE;
+ virtual int which() const OVERRIDE;
+
+ virtual void trace(Visitor*) OVERRIDE;
private:
KeyboardEvent();
@@ -115,13 +117,11 @@ private:
bool m_isAutoRepeat : 1;
};
-KeyboardEvent* findKeyboardEvent(Event*);
-
class KeyboardEventDispatchMediator : public EventDispatchMediator {
public:
- static PassRefPtr<KeyboardEventDispatchMediator> create(PassRefPtr<KeyboardEvent>);
+ static PassRefPtrWillBeRawPtr<KeyboardEventDispatchMediator> create(PassRefPtrWillBeRawPtr<KeyboardEvent>);
private:
- explicit KeyboardEventDispatchMediator(PassRefPtr<KeyboardEvent>);
+ explicit KeyboardEventDispatchMediator(PassRefPtrWillBeRawPtr<KeyboardEvent>);
virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
};
diff --git a/chromium/third_party/WebKit/Source/core/events/MessageEvent.cpp b/chromium/third_party/WebKit/Source/core/events/MessageEvent.cpp
index 883b1f969e5..18efe773262 100644
--- a/chromium/third_party/WebKit/Source/core/events/MessageEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/MessageEvent.cpp
@@ -30,7 +30,6 @@
#include "bindings/v8/ExceptionMessages.h"
#include "bindings/v8/ExceptionState.h"
-#include "core/events/ThreadLocalEventNames.h"
namespace WebCore {
@@ -54,14 +53,14 @@ MessageEvent::MessageEvent(const AtomicString& type, const MessageEventInit& ini
, m_dataType(DataTypeScriptValue)
, m_origin(initializer.origin)
, m_lastEventId(initializer.lastEventId)
- , m_source(isValidSource(initializer.source.get()) ? initializer.source : 0)
+ , m_source(isValidSource(initializer.source.get()) ? initializer.source : nullptr)
, m_ports(adoptPtr(new MessagePortArray(initializer.ports)))
{
ScriptWrappable::init(this);
ASSERT(isValidSource(m_source.get()));
}
-MessageEvent::MessageEvent(const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, PassOwnPtr<MessagePortArray> ports)
+MessageEvent::MessageEvent(const String& origin, const String& lastEventId, PassRefPtrWillBeRawPtr<EventTarget> source, PassOwnPtr<MessagePortArray> ports)
: Event(EventTypeNames::message, false, false)
, m_dataType(DataTypeScriptValue)
, m_origin(origin)
@@ -73,7 +72,7 @@ MessageEvent::MessageEvent(const String& origin, const String& lastEventId, Pass
ASSERT(isValidSource(m_source.get()));
}
-MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, PassOwnPtr<MessagePortArray> ports)
+MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtrWillBeRawPtr<EventTarget> source, PassOwnPtr<MessagePortArray> ports)
: Event(EventTypeNames::message, false, false)
, m_dataType(DataTypeSerializedScriptValue)
, m_dataAsSerializedScriptValue(data)
@@ -88,7 +87,7 @@ MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String&
ASSERT(isValidSource(m_source.get()));
}
-MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, PassOwnPtr<MessagePortChannelArray> channels)
+MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtrWillBeRawPtr<EventTarget> source, PassOwnPtr<MessagePortChannelArray> channels)
: Event(EventTypeNames::message, false, false)
, m_dataType(DataTypeSerializedScriptValue)
, m_dataAsSerializedScriptValue(data)
@@ -112,7 +111,7 @@ MessageEvent::MessageEvent(const String& data, const String& origin)
ScriptWrappable::init(this);
}
-MessageEvent::MessageEvent(PassRefPtr<Blob> data, const String& origin)
+MessageEvent::MessageEvent(PassRefPtrWillBeRawPtr<Blob> data, const String& origin)
: Event(EventTypeNames::message, false, false)
, m_dataType(DataTypeBlob)
, m_dataAsBlob(data)
@@ -134,16 +133,16 @@ MessageEvent::~MessageEvent()
{
}
-PassRefPtr<MessageEvent> MessageEvent::create(const AtomicString& type, const MessageEventInit& initializer, ExceptionState& exceptionState)
+PassRefPtrWillBeRawPtr<MessageEvent> MessageEvent::create(const AtomicString& type, const MessageEventInit& initializer, ExceptionState& exceptionState)
{
if (initializer.source.get() && !isValidSource(initializer.source.get())) {
exceptionState.throwTypeError("The optional 'source' property is neither a Window nor MessagePort.");
- return 0;
+ return nullptr;
}
- return adoptRef(new MessageEvent(type, initializer));
+ return adoptRefWillBeNoop(new MessageEvent(type, initializer));
}
-void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray> ports)
+void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& origin, const String& lastEventId, LocalDOMWindow* source, PassOwnPtr<MessagePortArray> ports)
{
if (dispatched())
return;
@@ -157,7 +156,7 @@ void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bo
m_ports = ports;
}
-void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray> ports)
+void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, LocalDOMWindow* source, PassOwnPtr<MessagePortArray> ports)
{
if (dispatched())
return;
@@ -185,4 +184,11 @@ void MessageEvent::entangleMessagePorts(ExecutionContext* context)
m_ports = MessagePort::entanglePorts(*context, m_channels.release());
}
+void MessageEvent::trace(Visitor* visitor)
+{
+ visitor->trace(m_dataAsBlob);
+ visitor->trace(m_source);
+ Event::trace(visitor);
+}
+
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/MessageEvent.h b/chromium/third_party/WebKit/Source/core/events/MessageEvent.h
index 64df40f7718..966f620d413 100644
--- a/chromium/third_party/WebKit/Source/core/events/MessageEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/MessageEvent.h
@@ -33,7 +33,7 @@
#include "core/events/EventTarget.h"
#include "core/dom/MessagePort.h"
#include "core/fileapi/Blob.h"
-#include "core/frame/DOMWindow.h"
+#include "core/frame/LocalDOMWindow.h"
#include "wtf/ArrayBuffer.h"
namespace WebCore {
@@ -43,45 +43,45 @@ struct MessageEventInit : public EventInit {
String origin;
String lastEventId;
- RefPtr<EventTarget> source;
+ RefPtrWillBeMember<EventTarget> source;
MessagePortArray ports;
};
-class MessageEvent : public Event {
+class MessageEvent FINAL : public Event {
public:
- static PassRefPtr<MessageEvent> create()
+ static PassRefPtrWillBeRawPtr<MessageEvent> create()
{
- return adoptRef(new MessageEvent);
+ return adoptRefWillBeNoop(new MessageEvent);
}
- static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, const String& origin = String(), const String& lastEventId = String(), PassRefPtr<EventTarget> source = 0)
+ static PassRefPtrWillBeRawPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, const String& origin = String(), const String& lastEventId = String(), PassRefPtrWillBeRawPtr<EventTarget> source = nullptr)
{
- return adoptRef(new MessageEvent(origin, lastEventId, source, ports));
+ return adoptRefWillBeNoop(new MessageEvent(origin, lastEventId, source, ports));
}
- static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, PassRefPtr<SerializedScriptValue> data, const String& origin = String(), const String& lastEventId = String(), PassRefPtr<EventTarget> source = 0)
+ static PassRefPtrWillBeRawPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, PassRefPtr<SerializedScriptValue> data, const String& origin = String(), const String& lastEventId = String(), PassRefPtrWillBeRawPtr<EventTarget> source = nullptr)
{
- return adoptRef(new MessageEvent(data, origin, lastEventId, source, ports));
+ return adoptRefWillBeNoop(new MessageEvent(data, origin, lastEventId, source, ports));
}
- static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortChannelArray> channels, PassRefPtr<SerializedScriptValue> data, const String& origin = String(), const String& lastEventId = String(), PassRefPtr<EventTarget> source = 0)
+ static PassRefPtrWillBeRawPtr<MessageEvent> create(PassOwnPtr<MessagePortChannelArray> channels, PassRefPtr<SerializedScriptValue> data, const String& origin = String(), const String& lastEventId = String(), PassRefPtrWillBeRawPtr<EventTarget> source = nullptr)
{
- return adoptRef(new MessageEvent(data, origin, lastEventId, source, channels));
+ return adoptRefWillBeNoop(new MessageEvent(data, origin, lastEventId, source, channels));
}
- static PassRefPtr<MessageEvent> create(const String& data, const String& origin = String())
+ static PassRefPtrWillBeRawPtr<MessageEvent> create(const String& data, const String& origin = String())
{
- return adoptRef(new MessageEvent(data, origin));
+ return adoptRefWillBeNoop(new MessageEvent(data, origin));
}
- static PassRefPtr<MessageEvent> create(PassRefPtr<Blob> data, const String& origin = String())
+ static PassRefPtrWillBeRawPtr<MessageEvent> create(PassRefPtrWillBeRawPtr<Blob> data, const String& origin = String())
{
- return adoptRef(new MessageEvent(data, origin));
+ return adoptRefWillBeNoop(new MessageEvent(data, origin));
}
- static PassRefPtr<MessageEvent> create(PassRefPtr<ArrayBuffer> data, const String& origin = String())
+ static PassRefPtrWillBeRawPtr<MessageEvent> create(PassRefPtr<ArrayBuffer> data, const String& origin = String())
{
- return adoptRef(new MessageEvent(data, origin));
+ return adoptRefWillBeNoop(new MessageEvent(data, origin));
}
- static PassRefPtr<MessageEvent> create(const AtomicString& type, const MessageEventInit& initializer, ExceptionState&);
+ static PassRefPtrWillBeRawPtr<MessageEvent> create(const AtomicString& type, const MessageEventInit& initializer, ExceptionState&);
virtual ~MessageEvent();
- void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray>);
- void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray>);
+ void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& origin, const String& lastEventId, LocalDOMWindow* source, PassOwnPtr<MessagePortArray>);
+ void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, LocalDOMWindow* source, PassOwnPtr<MessagePortArray>);
const String& origin() const { return m_origin; }
const String& lastEventId() const { return m_lastEventId; }
@@ -90,7 +90,7 @@ public:
MessagePortArray ports() const { return m_ports ? *m_ports : MessagePortArray(); }
MessagePortChannelArray* channels() const { return m_channels ? m_channels.get() : 0; }
- virtual const AtomicString& interfaceName() const;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
enum DataType {
DataTypeScriptValue,
@@ -113,25 +113,27 @@ public:
void entangleMessagePorts(ExecutionContext*);
+ virtual void trace(Visitor*) OVERRIDE;
+
private:
MessageEvent();
MessageEvent(const AtomicString&, const MessageEventInit&);
- MessageEvent(const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, PassOwnPtr<MessagePortArray>);
- MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, PassOwnPtr<MessagePortArray>);
- MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, PassOwnPtr<MessagePortChannelArray>);
+ MessageEvent(const String& origin, const String& lastEventId, PassRefPtrWillBeRawPtr<EventTarget> source, PassOwnPtr<MessagePortArray>);
+ MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtrWillBeRawPtr<EventTarget> source, PassOwnPtr<MessagePortArray>);
+ MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtrWillBeRawPtr<EventTarget> source, PassOwnPtr<MessagePortChannelArray>);
- explicit MessageEvent(const String& data, const String& origin);
- explicit MessageEvent(PassRefPtr<Blob> data, const String& origin);
- explicit MessageEvent(PassRefPtr<ArrayBuffer> data, const String& origin);
+ MessageEvent(const String& data, const String& origin);
+ MessageEvent(PassRefPtrWillBeRawPtr<Blob> data, const String& origin);
+ MessageEvent(PassRefPtr<ArrayBuffer> data, const String& origin);
DataType m_dataType;
RefPtr<SerializedScriptValue> m_dataAsSerializedScriptValue;
String m_dataAsString;
- RefPtr<Blob> m_dataAsBlob;
+ RefPtrWillBeMember<Blob> m_dataAsBlob;
RefPtr<ArrayBuffer> m_dataAsArrayBuffer;
String m_origin;
String m_lastEventId;
- RefPtr<EventTarget> m_source;
+ RefPtrWillBeMember<EventTarget> m_source;
// m_ports are the MessagePorts in an engtangled state, and m_channels are
// the MessageChannels in a disentangled state. Only one of them can be
// non-empty at a time. entangleMessagePorts() moves between the states.
diff --git a/chromium/third_party/WebKit/Source/core/events/MessageEvent.idl b/chromium/third_party/WebKit/Source/core/events/MessageEvent.idl
index c482b082cfb..b9e155bd652 100644
--- a/chromium/third_party/WebKit/Source/core/events/MessageEvent.idl
+++ b/chromium/third_party/WebKit/Source/core/events/MessageEvent.idl
@@ -27,30 +27,21 @@
[
EventConstructor,
- GlobalContext=Window&WorkerGlobalScope,
+ Exposed=Window&Worker,
RaisesException=Constructor,
+ Custom=Wrap,
] interface MessageEvent : Event {
[InitializedByEventConstructor] readonly attribute DOMString origin;
[InitializedByEventConstructor] readonly attribute DOMString lastEventId;
[InitializedByEventConstructor] readonly attribute EventTarget? source; // May be a Window or a MessagePort
[InitializedByEventConstructor, Custom=Getter] readonly attribute any data;
[InitializedByEventConstructor] readonly attribute MessagePort[] ports;
- [Custom] void initMessageEvent([Default=Undefined] optional DOMString typeArg,
+ [Custom, MeasureAs=InitMessageEvent] void initMessageEvent([Default=Undefined] optional DOMString typeArg,
[Default=Undefined] optional boolean canBubbleArg,
[Default=Undefined] optional boolean cancelableArg,
[Default=Undefined] optional any dataArg,
[Default=Undefined] optional DOMString originArg,
[Default=Undefined] optional DOMString lastEventIdArg,
[Default=Undefined] optional Window sourceArg,
- [Default=Undefined] optional Array messagePorts);
-
- [Custom] void webkitInitMessageEvent([Default=Undefined] optional DOMString typeArg,
- [Default=Undefined] optional boolean canBubbleArg,
- [Default=Undefined] optional boolean cancelableArg,
- [Default=Undefined] optional any dataArg,
- [Default=Undefined] optional DOMString originArg,
- [Default=Undefined] optional DOMString lastEventIdArg,
- [Default=Undefined] optional Window sourceArg,
- [Default=Undefined] optional Array transferables);
+ [Default=Undefined] optional MessagePort[] messagePorts);
};
-
diff --git a/chromium/third_party/WebKit/Source/core/events/MouseEvent.cpp b/chromium/third_party/WebKit/Source/core/events/MouseEvent.cpp
index 1e6a6979b81..47977893d00 100644
--- a/chromium/third_party/WebKit/Source/core/events/MouseEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/MouseEvent.cpp
@@ -23,11 +23,9 @@
#include "config.h"
#include "core/events/MouseEvent.h"
-#include "core/dom/Clipboard.h"
+#include "core/clipboard/Clipboard.h"
#include "core/dom/Element.h"
#include "core/events/EventDispatcher.h"
-#include "core/events/EventRetargeter.h"
-#include "core/events/ThreadLocalEventNames.h"
#include "platform/PlatformMouseEvent.h"
namespace WebCore {
@@ -42,16 +40,16 @@ MouseEventInit::MouseEventInit()
, shiftKey(false)
, metaKey(false)
, button(0)
- , relatedTarget(0)
+ , relatedTarget(nullptr)
{
}
-PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& type, const MouseEventInit& initializer)
+PassRefPtrWillBeRawPtr<MouseEvent> MouseEvent::create(const AtomicString& type, const MouseEventInit& initializer)
{
- return adoptRef(new MouseEvent(type, initializer));
+ return adoptRefWillBeNoop(new MouseEvent(type, initializer));
}
-PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& eventType, PassRefPtr<AbstractView> view, const PlatformMouseEvent& event, int detail, PassRefPtr<Node> relatedTarget)
+PassRefPtrWillBeRawPtr<MouseEvent> MouseEvent::create(const AtomicString& eventType, PassRefPtrWillBeRawPtr<AbstractView> view, const PlatformMouseEvent& event, int detail, PassRefPtrWillBeRawPtr<Node> relatedTarget)
{
ASSERT(event.type() == PlatformEvent::MouseMoved || event.button() != NoButton);
@@ -59,33 +57,21 @@ PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& eventType, PassRef
bool isCancelable = !isMouseEnterOrLeave;
bool isBubbling = !isMouseEnterOrLeave;
- return MouseEvent::create(eventType, isBubbling, isCancelable, view,
+ return MouseEvent::create(
+ eventType, isBubbling, isCancelable, view,
detail, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(),
event.movementDelta().x(), event.movementDelta().y(),
event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.button(),
- relatedTarget, 0, false);
+ relatedTarget, nullptr, false);
}
-PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view,
+PassRefPtrWillBeRawPtr<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view,
int detail, int screenX, int screenY, int pageX, int pageY,
int movementX, int movementY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
- PassRefPtr<EventTarget> relatedTarget)
-
-{
- return MouseEvent::create(type, canBubble, cancelable, view,
- detail, screenX, screenY, pageX, pageY,
- movementX, movementY,
- ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, 0, false);
-}
-
-PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view,
- int detail, int screenX, int screenY, int pageX, int pageY,
- int movementX, int movementY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
- PassRefPtr<EventTarget> relatedTarget, PassRefPtr<Clipboard> clipboard, bool isSimulated)
+ PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, PassRefPtrWillBeRawPtr<Clipboard> clipboard, bool isSimulated)
{
- return adoptRef(new MouseEvent(type, canBubble, cancelable, view,
+ return adoptRefWillBeNoop(new MouseEvent(type, canBubble, cancelable, view,
detail, screenX, screenY, pageX, pageY,
movementX, movementY,
ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, clipboard, isSimulated));
@@ -98,12 +84,12 @@ MouseEvent::MouseEvent()
ScriptWrappable::init(this);
}
-MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view,
- int detail, int screenX, int screenY, int pageX, int pageY,
- int movementX, int movementY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
- unsigned short button, PassRefPtr<EventTarget> relatedTarget,
- PassRefPtr<Clipboard> clipboard, bool isSimulated)
+MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view,
+ int detail, int screenX, int screenY, int pageX, int pageY,
+ int movementX, int movementY,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
+ unsigned short button, PassRefPtrWillBeRawPtr<EventTarget> relatedTarget,
+ PassRefPtrWillBeRawPtr<Clipboard> clipboard, bool isSimulated)
: MouseRelatedEvent(eventType, canBubble, cancelable, view, detail, IntPoint(screenX, screenY),
IntPoint(pageX, pageY),
IntPoint(movementX, movementY),
@@ -124,7 +110,7 @@ MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& init
, m_button(initializer.button == (unsigned short)-1 ? 0 : initializer.button)
, m_buttonDown(initializer.button != (unsigned short)-1)
, m_relatedTarget(initializer.relatedTarget)
- , m_clipboard(0 /* clipboard */)
+ , m_clipboard(nullptr /* clipboard */)
{
ScriptWrappable::init(this);
initCoordinates(IntPoint(initializer.clientX, initializer.clientY));
@@ -134,10 +120,10 @@ MouseEvent::~MouseEvent()
{
}
-void MouseEvent::initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view,
+void MouseEvent::initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view,
int detail, int screenX, int screenY, int clientX, int clientY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
- unsigned short button, PassRefPtr<EventTarget> relatedTarget)
+ unsigned short button, PassRefPtrWillBeRawPtr<EventTarget> relatedTarget)
{
if (dispatched())
return;
@@ -204,19 +190,26 @@ Node* MouseEvent::fromElement() const
return target() ? target()->toNode() : 0;
}
-PassRefPtr<SimulatedMouseEvent> SimulatedMouseEvent::create(const AtomicString& eventType, PassRefPtr<AbstractView> view, PassRefPtr<Event> underlyingEvent)
+void MouseEvent::trace(Visitor* visitor)
+{
+ visitor->trace(m_relatedTarget);
+ visitor->trace(m_clipboard);
+ MouseRelatedEvent::trace(visitor);
+}
+
+PassRefPtrWillBeRawPtr<SimulatedMouseEvent> SimulatedMouseEvent::create(const AtomicString& eventType, PassRefPtrWillBeRawPtr<AbstractView> view, PassRefPtrWillBeRawPtr<Event> underlyingEvent)
{
- return adoptRef(new SimulatedMouseEvent(eventType, view, underlyingEvent));
+ return adoptRefWillBeNoop(new SimulatedMouseEvent(eventType, view, underlyingEvent));
}
SimulatedMouseEvent::~SimulatedMouseEvent()
{
}
-SimulatedMouseEvent::SimulatedMouseEvent(const AtomicString& eventType, PassRefPtr<AbstractView> view, PassRefPtr<Event> underlyingEvent)
+SimulatedMouseEvent::SimulatedMouseEvent(const AtomicString& eventType, PassRefPtrWillBeRawPtr<AbstractView> view, PassRefPtrWillBeRawPtr<Event> underlyingEvent)
: MouseEvent(eventType, true, true, view, 0, 0, 0, 0, 0,
0, 0,
- false, false, false, false, 0, 0, 0, true)
+ false, false, false, false, 0, nullptr, nullptr, true)
{
if (UIEventWithKeyState* keyStateEvent = findEventWithKeyState(underlyingEvent.get())) {
m_ctrlKey = keyStateEvent->ctrlKey();
@@ -233,12 +226,17 @@ SimulatedMouseEvent::SimulatedMouseEvent(const AtomicString& eventType, PassRefP
}
}
-PassRefPtr<MouseEventDispatchMediator> MouseEventDispatchMediator::create(PassRefPtr<MouseEvent> mouseEvent, MouseEventType mouseEventType)
+void SimulatedMouseEvent::trace(Visitor* visitor)
+{
+ MouseEvent::trace(visitor);
+}
+
+PassRefPtrWillBeRawPtr<MouseEventDispatchMediator> MouseEventDispatchMediator::create(PassRefPtrWillBeRawPtr<MouseEvent> mouseEvent, MouseEventType mouseEventType)
{
- return adoptRef(new MouseEventDispatchMediator(mouseEvent, mouseEventType));
+ return adoptRefWillBeNoop(new MouseEventDispatchMediator(mouseEvent, mouseEventType));
}
-MouseEventDispatchMediator::MouseEventDispatchMediator(PassRefPtr<MouseEvent> mouseEvent, MouseEventType mouseEventType)
+MouseEventDispatchMediator::MouseEventDispatchMediator(PassRefPtrWillBeRawPtr<MouseEvent> mouseEvent, MouseEventType mouseEventType)
: EventDispatchMediator(mouseEvent), m_mouseEventType(mouseEventType)
{
}
@@ -251,7 +249,7 @@ MouseEvent* MouseEventDispatchMediator::event() const
bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
{
if (isSyntheticMouseEvent()) {
- EventRetargeter::adjustForMouseEvent(dispatcher->node(), *event());
+ event()->eventPath().adjustForRelatedTarget(dispatcher->node(), event()->relatedTarget());
return dispatcher->dispatch();
}
@@ -264,7 +262,7 @@ bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) cons
ASSERT(!event()->target() || event()->target() != event()->relatedTarget());
EventTarget* relatedTarget = event()->relatedTarget();
- EventRetargeter::adjustForMouseEvent(dispatcher->node(), *event());
+ event()->eventPath().adjustForRelatedTarget(dispatcher->node(), relatedTarget);
dispatcher->dispatch();
bool swallowEvent = event()->defaultHandled() || event()->defaultPrevented();
@@ -275,7 +273,7 @@ bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) cons
// Special case: If it's a double click event, we also send the dblclick event. This is not part
// of the DOM specs, but is used for compatibility with the ondblclick="" attribute. This is treated
// as a separate event in other DOM-compliant browsers like Firefox, and so we do the same.
- RefPtr<MouseEvent> doubleClickEvent = MouseEvent::create();
+ RefPtrWillBeRawPtr<MouseEvent> doubleClickEvent = MouseEvent::create();
doubleClickEvent->initMouseEvent(EventTypeNames::dblclick, event()->bubbles(), event()->cancelable(), event()->view(),
event()->detail(), event()->screenX(), event()->screenY(), event()->clientX(), event()->clientY(),
event()->ctrlKey(), event()->altKey(), event()->shiftKey(), event()->metaKey(),
diff --git a/chromium/third_party/WebKit/Source/core/events/MouseEvent.h b/chromium/third_party/WebKit/Source/core/events/MouseEvent.h
index 41ab261eb8e..fc364c8e8c7 100644
--- a/chromium/third_party/WebKit/Source/core/events/MouseEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/MouseEvent.h
@@ -45,38 +45,32 @@ struct MouseEventInit : public UIEventInit {
bool shiftKey;
bool metaKey;
unsigned short button;
- RefPtr<EventTarget> relatedTarget;
+ RefPtrWillBeMember<EventTarget> relatedTarget;
};
class MouseEvent : public MouseRelatedEvent {
public:
- static PassRefPtr<MouseEvent> create()
+ static PassRefPtrWillBeRawPtr<MouseEvent> create()
{
- return adoptRef(new MouseEvent);
+ return adoptRefWillBeNoop(new MouseEvent);
}
- static PassRefPtr<MouseEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
+ static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>,
int detail, int screenX, int screenY, int pageX, int pageY,
int movementX, int movementY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
- PassRefPtr<EventTarget> relatedTarget);
+ PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, PassRefPtrWillBeRawPtr<Clipboard>, bool isSimulated = false);
- static PassRefPtr<MouseEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
- int detail, int screenX, int screenY, int pageX, int pageY,
- int movementX, int movementY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
- PassRefPtr<EventTarget> relatedTarget, PassRefPtr<Clipboard>, bool isSimulated = false);
-
- static PassRefPtr<MouseEvent> create(const AtomicString& eventType, PassRefPtr<AbstractView>, const PlatformMouseEvent&, int detail, PassRefPtr<Node> relatedTarget);
+ static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& eventType, PassRefPtrWillBeRawPtr<AbstractView>, const PlatformMouseEvent&, int detail, PassRefPtrWillBeRawPtr<Node> relatedTarget);
- static PassRefPtr<MouseEvent> create(const AtomicString& eventType, const MouseEventInit&);
+ static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& eventType, const MouseEventInit&);
virtual ~MouseEvent();
- void initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
+ void initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>,
int detail, int screenX, int screenY, int clientX, int clientY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
- unsigned short button, PassRefPtr<EventTarget> relatedTarget);
+ unsigned short button, PassRefPtrWillBeRawPtr<EventTarget> relatedTarget);
// WinIE uses 1,4,2 for left/middle/right but not for click (just for mousedown/up, maybe others),
// but we will match the standard DOM.
@@ -84,27 +78,27 @@ public:
bool buttonDown() const { return m_buttonDown; }
EventTarget* relatedTarget() const { return m_relatedTarget.get(); }
EventTarget* relatedTarget(bool& isNull) const { isNull = !m_relatedTarget; return m_relatedTarget.get(); }
- void setRelatedTarget(PassRefPtr<EventTarget> relatedTarget) { m_relatedTarget = relatedTarget; }
-
- Clipboard* clipboard() const { return m_clipboard.get(); }
+ void setRelatedTarget(PassRefPtrWillBeRawPtr<EventTarget> relatedTarget) { m_relatedTarget = relatedTarget; }
Node* toElement() const;
Node* fromElement() const;
Clipboard* dataTransfer() const { return isDragEvent() ? m_clipboard.get() : 0; }
- virtual const AtomicString& interfaceName() const;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+
+ virtual bool isMouseEvent() const OVERRIDE;
+ virtual bool isDragEvent() const OVERRIDE FINAL;
+ virtual int which() const OVERRIDE FINAL;
- virtual bool isMouseEvent() const;
- virtual bool isDragEvent() const;
- virtual int which() const;
+ virtual void trace(Visitor*) OVERRIDE;
protected:
- MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
+ MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>,
int detail, int screenX, int screenY, int pageX, int pageY,
int movementX, int movementY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
- PassRefPtr<EventTarget> relatedTarget, PassRefPtr<Clipboard>, bool isSimulated);
+ PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, PassRefPtrWillBeRawPtr<Clipboard>, bool isSimulated);
MouseEvent(const AtomicString& type, const MouseEventInit&);
@@ -113,26 +107,28 @@ protected:
private:
unsigned short m_button;
bool m_buttonDown;
- RefPtr<EventTarget> m_relatedTarget;
- RefPtr<Clipboard> m_clipboard;
+ RefPtrWillBeMember<EventTarget> m_relatedTarget;
+ RefPtrWillBeMember<Clipboard> m_clipboard;
};
-class SimulatedMouseEvent : public MouseEvent {
+class SimulatedMouseEvent FINAL : public MouseEvent {
public:
- static PassRefPtr<SimulatedMouseEvent> create(const AtomicString& eventType, PassRefPtr<AbstractView>, PassRefPtr<Event> underlyingEvent);
+ static PassRefPtrWillBeRawPtr<SimulatedMouseEvent> create(const AtomicString& eventType, PassRefPtrWillBeRawPtr<AbstractView>, PassRefPtrWillBeRawPtr<Event> underlyingEvent);
virtual ~SimulatedMouseEvent();
+ virtual void trace(Visitor*) OVERRIDE;
+
private:
- SimulatedMouseEvent(const AtomicString& eventType, PassRefPtr<AbstractView>, PassRefPtr<Event> underlyingEvent);
+ SimulatedMouseEvent(const AtomicString& eventType, PassRefPtrWillBeRawPtr<AbstractView>, PassRefPtrWillBeRawPtr<Event> underlyingEvent);
};
-class MouseEventDispatchMediator : public EventDispatchMediator {
+class MouseEventDispatchMediator FINAL : public EventDispatchMediator {
public:
enum MouseEventType { SyntheticMouseEvent, NonSyntheticMouseEvent};
- static PassRefPtr<MouseEventDispatchMediator> create(PassRefPtr<MouseEvent>, MouseEventType = NonSyntheticMouseEvent);
+ static PassRefPtrWillBeRawPtr<MouseEventDispatchMediator> create(PassRefPtrWillBeRawPtr<MouseEvent>, MouseEventType = NonSyntheticMouseEvent);
private:
- explicit MouseEventDispatchMediator(PassRefPtr<MouseEvent>, MouseEventType);
+ explicit MouseEventDispatchMediator(PassRefPtrWillBeRawPtr<MouseEvent>, MouseEventType);
MouseEvent* event() const;
virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
diff --git a/chromium/third_party/WebKit/Source/core/events/MouseEvent.idl b/chromium/third_party/WebKit/Source/core/events/MouseEvent.idl
index 7dd8284bf78..f5b03c862d9 100644
--- a/chromium/third_party/WebKit/Source/core/events/MouseEvent.idl
+++ b/chromium/third_party/WebKit/Source/core/events/MouseEvent.idl
@@ -30,8 +30,10 @@
[InitializedByEventConstructor] readonly attribute boolean metaKey;
[InitializedByEventConstructor] readonly attribute unsigned short button;
[InitializedByEventConstructor] readonly attribute EventTarget? relatedTarget;
- readonly attribute long webkitMovementX;
- readonly attribute long webkitMovementY;
+ [MeasureAs=MouseEventMovementX] readonly attribute long movementX;
+ [MeasureAs=MouseEventMovementY] readonly attribute long movementY;
+ [MeasureAs=PrefixedMouseEventMovementX, ImplementedAs=movementX] readonly attribute long webkitMovementX;
+ [MeasureAs=PrefixedMouseEventMovementY, ImplementedAs=movementY] readonly attribute long webkitMovementY;
void initMouseEvent([Default=Undefined] optional DOMString type,
[Default=Undefined] optional boolean canBubble,
@@ -57,6 +59,6 @@
readonly attribute Node fromElement;
readonly attribute Node toElement;
- readonly attribute Clipboard dataTransfer;
+ readonly attribute DataTransfer dataTransfer;
};
diff --git a/chromium/third_party/WebKit/Source/core/events/MouseRelatedEvent.cpp b/chromium/third_party/WebKit/Source/core/events/MouseRelatedEvent.cpp
index 4953243cae1..7ab48f3b5fd 100644
--- a/chromium/third_party/WebKit/Source/core/events/MouseRelatedEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/MouseRelatedEvent.cpp
@@ -24,9 +24,9 @@
#include "core/events/MouseRelatedEvent.h"
#include "core/dom/Document.h"
-#include "core/frame/DOMWindow.h"
-#include "core/frame/Frame.h"
+#include "core/frame/LocalDOMWindow.h"
#include "core/frame/FrameView.h"
+#include "core/frame/LocalFrame.h"
#include "core/rendering/RenderLayer.h"
#include "core/rendering/RenderObject.h"
@@ -42,7 +42,7 @@ static LayoutSize contentsScrollOffset(AbstractView* abstractView)
{
if (!abstractView)
return LayoutSize();
- Frame* frame = abstractView->frame();
+ LocalFrame* frame = abstractView->frame();
if (!frame)
return LayoutSize();
FrameView* frameView = frame->view();
@@ -52,7 +52,7 @@ static LayoutSize contentsScrollOffset(AbstractView* abstractView)
return LayoutSize(frameView->scrollX() / scaleFactor, frameView->scrollY() / scaleFactor);
}
-MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubble, bool cancelable, PassRefPtr<AbstractView> abstractView,
+MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> abstractView,
int detail, const IntPoint& screenLocation, const IntPoint& windowLocation,
const IntPoint& movementDelta,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool isSimulated)
@@ -64,7 +64,7 @@ MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubb
LayoutPoint adjustedPageLocation;
LayoutPoint scrollPosition;
- Frame* frame = view() ? view()->frame() : 0;
+ LocalFrame* frame = view() ? view()->frame() : 0;
if (frame && !isSimulated) {
if (FrameView* frameView = frame->view()) {
scrollPosition = frameView->scrollPosition();
@@ -110,10 +110,10 @@ void MouseRelatedEvent::initCoordinates(const LayoutPoint& clientLocation)
static float pageZoomFactor(const UIEvent* event)
{
- DOMWindow* window = event->view();
+ LocalDOMWindow* window = event->view();
if (!window)
return 1;
- Frame* frame = window->frame();
+ LocalFrame* frame = window->frame();
if (!frame)
return 1;
return frame->pageZoomFactor();
@@ -160,11 +160,9 @@ void MouseRelatedEvent::computeRelativePosition()
while (n && !n->renderer())
n = n->parentNode();
- RenderLayer* layer;
- if (n && (layer = n->renderer()->enclosingLayer())) {
- for (; layer; layer = layer->parent()) {
+ if (n) {
+ for (RenderLayer* layer = n->renderer()->enclosingLayer(); layer; layer = layer->parent())
m_layerLocation -= toLayoutSize(layer->location());
- }
}
m_hasCachedRelativePosition = true;
@@ -186,6 +184,8 @@ int MouseRelatedEvent::layerY()
int MouseRelatedEvent::offsetX()
{
+ if (isSimulated())
+ return 0;
if (!m_hasCachedRelativePosition)
computeRelativePosition();
return roundToInt(m_offsetLocation.x());
@@ -193,6 +193,8 @@ int MouseRelatedEvent::offsetX()
int MouseRelatedEvent::offsetY()
{
+ if (isSimulated())
+ return 0;
if (!m_hasCachedRelativePosition)
computeRelativePosition();
return roundToInt(m_offsetLocation.y());
@@ -208,11 +210,6 @@ int MouseRelatedEvent::pageY() const
return m_pageLocation.y();
}
-const LayoutPoint& MouseRelatedEvent::pageLocation() const
-{
- return m_pageLocation;
-}
-
int MouseRelatedEvent::x() const
{
// FIXME: This is not correct.
@@ -227,4 +224,9 @@ int MouseRelatedEvent::y() const
return m_clientLocation.y();
}
+void MouseRelatedEvent::trace(Visitor* visitor)
+{
+ UIEventWithKeyState::trace(visitor);
+}
+
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/MouseRelatedEvent.h b/chromium/third_party/WebKit/Source/core/events/MouseRelatedEvent.h
index fbaeb9c68aa..2dd28ca5b59 100644
--- a/chromium/third_party/WebKit/Source/core/events/MouseRelatedEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/MouseRelatedEvent.h
@@ -39,17 +39,16 @@ namespace WebCore {
const IntPoint& screenLocation() const { return m_screenLocation; }
int clientX() const { return m_clientLocation.x(); }
int clientY() const { return m_clientLocation.y(); }
- int webkitMovementX() const { return m_movementDelta.x(); }
- int webkitMovementY() const { return m_movementDelta.y(); }
+ int movementX() const { return m_movementDelta.x(); }
+ int movementY() const { return m_movementDelta.y(); }
const LayoutPoint& clientLocation() const { return m_clientLocation; }
- int layerX();
- int layerY();
+ virtual int layerX() OVERRIDE FINAL;
+ virtual int layerY() OVERRIDE FINAL;
int offsetX();
int offsetY();
bool isSimulated() const { return m_isSimulated; }
- virtual int pageX() const;
- virtual int pageY() const;
- virtual const LayoutPoint& pageLocation() const;
+ virtual int pageX() const OVERRIDE FINAL;
+ virtual int pageY() const OVERRIDE FINAL;
int x() const;
int y() const;
@@ -58,16 +57,18 @@ namespace WebCore {
const LayoutPoint& absoluteLocation() const { return m_absoluteLocation; }
void setAbsoluteLocation(const LayoutPoint& p) { m_absoluteLocation = p; }
+ virtual void trace(Visitor*) OVERRIDE;
+
protected:
MouseRelatedEvent();
- MouseRelatedEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
+ MouseRelatedEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>,
int detail, const IntPoint& screenLocation, const IntPoint& windowLocation,
const IntPoint& movementDelta,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool isSimulated = false);
void initCoordinates();
void initCoordinates(const LayoutPoint& clientLocation);
- virtual void receivedTarget();
+ virtual void receivedTarget() OVERRIDE FINAL;
void computePageLocation();
void computeRelativePosition();
diff --git a/chromium/third_party/WebKit/Source/core/events/MutationEvent.cpp b/chromium/third_party/WebKit/Source/core/events/MutationEvent.cpp
index 542b304505b..4c78269f9d9 100644
--- a/chromium/third_party/WebKit/Source/core/events/MutationEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/MutationEvent.cpp
@@ -23,8 +23,6 @@
#include "config.h"
#include "core/events/MutationEvent.h"
-#include "core/events/ThreadLocalEventNames.h"
-
namespace WebCore {
MutationEvent::MutationEvent()
@@ -33,7 +31,7 @@ MutationEvent::MutationEvent()
ScriptWrappable::init(this);
}
-MutationEvent::MutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<Node> relatedNode,
+MutationEvent::MutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<Node> relatedNode,
const String& prevValue, const String& newValue,
const String& attrName, unsigned short attrChange)
: Event(type, canBubble, cancelable)
@@ -50,7 +48,7 @@ MutationEvent::~MutationEvent()
{
}
-void MutationEvent::initMutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<Node> relatedNode,
+void MutationEvent::initMutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<Node> relatedNode,
const String& prevValue, const String& newValue,
const String& attrName, unsigned short attrChange)
{
@@ -71,4 +69,10 @@ const AtomicString& MutationEvent::interfaceName() const
return EventNames::MutationEvent;
}
+void MutationEvent::trace(Visitor* visitor)
+{
+ visitor->trace(m_relatedNode);
+ Event::trace(visitor);
+}
+
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/MutationEvent.h b/chromium/third_party/WebKit/Source/core/events/MutationEvent.h
index f0ef13e5b6c..251f2f53134 100644
--- a/chromium/third_party/WebKit/Source/core/events/MutationEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/MutationEvent.h
@@ -29,7 +29,7 @@
namespace WebCore {
- class MutationEvent : public Event {
+ class MutationEvent FINAL : public Event {
public:
virtual ~MutationEvent();
@@ -39,18 +39,19 @@ namespace WebCore {
REMOVAL = 3
};
- static PassRefPtr<MutationEvent> create()
+ static PassRefPtrWillBeRawPtr<MutationEvent> create()
{
- return adoptRef(new MutationEvent);
+ return adoptRefWillBeNoop(new MutationEvent);
}
- static PassRefPtr<MutationEvent> create(const AtomicString& type, bool canBubble, PassRefPtr<Node> relatedNode = 0,
+ static PassRefPtrWillBeRawPtr<MutationEvent> create(
+ const AtomicString& type, bool canBubble, PassRefPtrWillBeRawPtr<Node> relatedNode = nullptr,
const String& prevValue = String(), const String& newValue = String(), const String& attrName = String(), unsigned short attrChange = 0)
{
- return adoptRef(new MutationEvent(type, canBubble, false, relatedNode, prevValue, newValue, attrName, attrChange));
+ return adoptRefWillBeNoop(new MutationEvent(type, canBubble, false, relatedNode, prevValue, newValue, attrName, attrChange));
}
- void initMutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<Node> relatedNode,
+ void initMutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<Node> relatedNode,
const String& prevValue, const String& newValue,
const String& attrName, unsigned short attrChange);
@@ -60,15 +61,17 @@ namespace WebCore {
String attrName() const { return m_attrName; }
unsigned short attrChange() const { return m_attrChange; }
- virtual const AtomicString& interfaceName() const;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+
+ virtual void trace(Visitor*) OVERRIDE;
private:
MutationEvent();
- MutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<Node> relatedNode,
+ MutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<Node> relatedNode,
const String& prevValue, const String& newValue,
const String& attrName, unsigned short attrChange);
- RefPtr<Node> m_relatedNode;
+ RefPtrWillBeMember<Node> m_relatedNode;
String m_prevValue;
String m_newValue;
String m_attrName;
diff --git a/chromium/third_party/WebKit/Source/core/events/NavigatorEvents.cpp b/chromium/third_party/WebKit/Source/core/events/NavigatorEvents.cpp
index a4285c21ef8..526cdc8ca65 100644
--- a/chromium/third_party/WebKit/Source/core/events/NavigatorEvents.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/NavigatorEvents.cpp
@@ -31,15 +31,15 @@
#include "config.h"
#include "core/events/NavigatorEvents.h"
-#include "core/frame/Frame.h"
+#include "core/frame/LocalFrame.h"
#include "core/frame/Navigator.h"
#include "core/frame/Settings.h"
namespace WebCore {
-long NavigatorEvents::maxTouchPoints(Navigator* navigator)
+long NavigatorEvents::maxTouchPoints(Navigator& navigator)
{
- Frame* frame = navigator->frame();
+ LocalFrame* frame = navigator.frame();
if (!frame)
return 0;
if (Settings* settings = frame->settings())
diff --git a/chromium/third_party/WebKit/Source/core/events/NavigatorEvents.h b/chromium/third_party/WebKit/Source/core/events/NavigatorEvents.h
index 44cead91197..84f3ad7981e 100644
--- a/chromium/third_party/WebKit/Source/core/events/NavigatorEvents.h
+++ b/chromium/third_party/WebKit/Source/core/events/NavigatorEvents.h
@@ -37,7 +37,7 @@ class Navigator;
class NavigatorEvents {
public:
- static long maxTouchPoints(Navigator*);
+ static long maxTouchPoints(Navigator&);
};
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/NavigatorEvents.idl b/chromium/third_party/WebKit/Source/core/events/NavigatorEvents.idl
index fe899fc50b8..ed3d2068fff 100644
--- a/chromium/third_party/WebKit/Source/core/events/NavigatorEvents.idl
+++ b/chromium/third_party/WebKit/Source/core/events/NavigatorEvents.idl
@@ -29,6 +29,5 @@
*/
partial interface Navigator {
- [RuntimeEnabled=PointerEventsMaxTouchPoints]
- readonly attribute long maxTouchPoints;
-}; \ No newline at end of file
+ readonly attribute long maxTouchPoints;
+};
diff --git a/chromium/third_party/WebKit/Source/core/events/NodeEventContext.cpp b/chromium/third_party/WebKit/Source/core/events/NodeEventContext.cpp
new file mode 100644
index 00000000000..3cfac4c8f03
--- /dev/null
+++ b/chromium/third_party/WebKit/Source/core/events/NodeEventContext.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "config.h"
+#include "core/events/NodeEventContext.h"
+
+#include "core/dom/TouchList.h"
+#include "core/events/Event.h"
+#include "core/events/FocusEvent.h"
+#include "core/events/MouseEvent.h"
+#include "core/events/TouchEventContext.h"
+
+namespace WebCore {
+
+NodeEventContext::NodeEventContext(PassRefPtrWillBeRawPtr<Node> node, PassRefPtrWillBeRawPtr<EventTarget> currentTarget)
+ : m_node(node)
+ , m_currentTarget(currentTarget)
+{
+ ASSERT(m_node);
+}
+
+NodeEventContext::~NodeEventContext()
+{
+}
+
+void NodeEventContext::trace(Visitor* visitor)
+{
+ visitor->trace(m_node);
+ visitor->trace(m_currentTarget);
+ visitor->trace(m_treeScopeEventContext);
+}
+
+void NodeEventContext::handleLocalEvents(Event* event) const
+{
+ if (touchEventContext()) {
+ touchEventContext()->handleLocalEvents(event);
+ } else if (relatedTarget()) {
+ if (event->isMouseEvent()) {
+ toMouseEvent(event)->setRelatedTarget(relatedTarget());
+ } else if (event->isFocusEvent()) {
+ toFocusEvent(event)->setRelatedTarget(relatedTarget());
+ }
+ }
+ event->setTarget(target());
+ event->setCurrentTarget(m_currentTarget.get());
+ m_node->handleLocalEvents(event);
+}
+
+}
diff --git a/chromium/third_party/WebKit/Source/core/events/NodeEventContext.h b/chromium/third_party/WebKit/Source/core/events/NodeEventContext.h
new file mode 100644
index 00000000000..e54da1896c1
--- /dev/null
+++ b/chromium/third_party/WebKit/Source/core/events/NodeEventContext.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef NodeEventContext_h
+#define NodeEventContext_h
+
+#include "core/events/TreeScopeEventContext.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+
+namespace WebCore {
+
+class EventTarget;
+class Node;
+class TouchEventContext;
+
+class NodeEventContext {
+ ALLOW_ONLY_INLINE_ALLOCATION();
+public:
+ // FIXME: Use ContainerNode instead of Node.
+ NodeEventContext(PassRefPtrWillBeRawPtr<Node>, PassRefPtrWillBeRawPtr<EventTarget> currentTarget);
+ ~NodeEventContext();
+ void trace(Visitor*);
+
+ Node* node() const { return m_node.get(); }
+
+ void setTreeScopeEventContext(PassRefPtrWillBeRawPtr<TreeScopeEventContext> prpTreeScopeEventContext) { m_treeScopeEventContext = prpTreeScopeEventContext; }
+ TreeScopeEventContext& treeScopeEventContext() { ASSERT(m_treeScopeEventContext); return *m_treeScopeEventContext; }
+
+ EventTarget* target() const { return m_treeScopeEventContext->target(); }
+ EventTarget* relatedTarget() const { return m_treeScopeEventContext->relatedTarget(); }
+ TouchEventContext* touchEventContext() const { return m_treeScopeEventContext->touchEventContext(); }
+
+ bool currentTargetSameAsTarget() const { return m_currentTarget.get() == target(); }
+ void handleLocalEvents(Event*) const;
+
+private:
+ RefPtrWillBeMember<Node> m_node;
+ RefPtrWillBeMember<EventTarget> m_currentTarget;
+ RefPtrWillBeMember<TreeScopeEventContext> m_treeScopeEventContext;
+};
+
+}
+
+WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(WebCore::NodeEventContext);
+
+#endif // NodeEventContext_h
diff --git a/chromium/third_party/WebKit/Source/core/events/OverflowEvent.cpp b/chromium/third_party/WebKit/Source/core/events/OverflowEvent.cpp
index c958ce655e6..e6c469ddd5e 100644
--- a/chromium/third_party/WebKit/Source/core/events/OverflowEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/OverflowEvent.cpp
@@ -26,8 +26,6 @@
#include "config.h"
#include "core/events/OverflowEvent.h"
-#include "core/events/ThreadLocalEventNames.h"
-
namespace WebCore {
OverflowEventInit::OverflowEventInit()
@@ -76,14 +74,9 @@ const AtomicString& OverflowEvent::interfaceName() const
return EventNames::OverflowEvent;
}
-void OverflowEvent::initOverflowEvent(unsigned short orient, bool horizontalOverflow, bool verticalOverflow)
+void OverflowEvent::trace(Visitor* visitor)
{
- if (dispatched())
- return;
-
- m_orient = orient;
- m_horizontalOverflow = horizontalOverflow;
- m_verticalOverflow = verticalOverflow;
+ Event::trace(visitor);
}
}
diff --git a/chromium/third_party/WebKit/Source/core/events/OverflowEvent.h b/chromium/third_party/WebKit/Source/core/events/OverflowEvent.h
index 96c220b2198..3bc1dc3efb1 100644
--- a/chromium/third_party/WebKit/Source/core/events/OverflowEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/OverflowEvent.h
@@ -38,7 +38,7 @@ struct OverflowEventInit : public EventInit {
bool verticalOverflow;
};
-class OverflowEvent : public Event {
+class OverflowEvent FINAL : public Event {
public:
enum orientType {
HORIZONTAL = 0,
@@ -46,26 +46,26 @@ public:
BOTH = 2
};
- static PassRefPtr<OverflowEvent> create()
+ static PassRefPtrWillBeRawPtr<OverflowEvent> create()
{
- return adoptRef(new OverflowEvent);
+ return adoptRefWillBeNoop(new OverflowEvent);
}
- static PassRefPtr<OverflowEvent> create(bool horizontalOverflowChanged, bool horizontalOverflow, bool verticalOverflowChanged, bool verticalOverflow)
+ static PassRefPtrWillBeRawPtr<OverflowEvent> create(bool horizontalOverflowChanged, bool horizontalOverflow, bool verticalOverflowChanged, bool verticalOverflow)
{
- return adoptRef(new OverflowEvent(horizontalOverflowChanged, horizontalOverflow, verticalOverflowChanged, verticalOverflow));
+ return adoptRefWillBeNoop(new OverflowEvent(horizontalOverflowChanged, horizontalOverflow, verticalOverflowChanged, verticalOverflow));
}
- static PassRefPtr<OverflowEvent> create(const AtomicString& type, const OverflowEventInit& initializer)
+ static PassRefPtrWillBeRawPtr<OverflowEvent> create(const AtomicString& type, const OverflowEventInit& initializer)
{
- return adoptRef(new OverflowEvent(type, initializer));
+ return adoptRefWillBeNoop(new OverflowEvent(type, initializer));
}
- void initOverflowEvent(unsigned short orient, bool horizontalOverflow, bool verticalOverflow);
-
unsigned short orient() const { return m_orient; }
bool horizontalOverflow() const { return m_horizontalOverflow; }
bool verticalOverflow() const { return m_verticalOverflow; }
- virtual const AtomicString& interfaceName() const;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+
+ virtual void trace(Visitor*) OVERRIDE;
private:
OverflowEvent();
diff --git a/chromium/third_party/WebKit/Source/core/events/PageTransitionEvent.cpp b/chromium/third_party/WebKit/Source/core/events/PageTransitionEvent.cpp
index a1878c468c5..d6b9a66b3bc 100644
--- a/chromium/third_party/WebKit/Source/core/events/PageTransitionEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/PageTransitionEvent.cpp
@@ -26,8 +26,6 @@
#include "config.h"
#include "core/events/PageTransitionEvent.h"
-#include "core/events/ThreadLocalEventNames.h"
-
namespace WebCore {
PageTransitionEventInit::PageTransitionEventInit()
@@ -64,4 +62,9 @@ const AtomicString& PageTransitionEvent::interfaceName() const
return EventNames::PageTransitionEvent;
}
+void PageTransitionEvent::trace(Visitor* visitor)
+{
+ Event::trace(visitor);
+}
+
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/PageTransitionEvent.h b/chromium/third_party/WebKit/Source/core/events/PageTransitionEvent.h
index 1002f5562ad..b8b1ba4d80e 100644
--- a/chromium/third_party/WebKit/Source/core/events/PageTransitionEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/PageTransitionEvent.h
@@ -36,27 +36,29 @@ struct PageTransitionEventInit : public EventInit {
bool persisted;
};
-class PageTransitionEvent : public Event {
+class PageTransitionEvent FINAL : public Event {
public:
- static PassRefPtr<PageTransitionEvent> create()
+ static PassRefPtrWillBeRawPtr<PageTransitionEvent> create()
{
- return adoptRef(new PageTransitionEvent);
+ return adoptRefWillBeNoop(new PageTransitionEvent);
}
- static PassRefPtr<PageTransitionEvent> create(const AtomicString& type, bool persisted)
+ static PassRefPtrWillBeRawPtr<PageTransitionEvent> create(const AtomicString& type, bool persisted)
{
- return adoptRef(new PageTransitionEvent(type, persisted));
+ return adoptRefWillBeNoop(new PageTransitionEvent(type, persisted));
}
- static PassRefPtr<PageTransitionEvent> create(const AtomicString& type, const PageTransitionEventInit& initializer)
+ static PassRefPtrWillBeRawPtr<PageTransitionEvent> create(const AtomicString& type, const PageTransitionEventInit& initializer)
{
- return adoptRef(new PageTransitionEvent(type, initializer));
+ return adoptRefWillBeNoop(new PageTransitionEvent(type, initializer));
}
virtual ~PageTransitionEvent();
- virtual const AtomicString& interfaceName() const;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
bool persisted() const { return m_persisted; }
+ virtual void trace(Visitor*) OVERRIDE;
+
private:
PageTransitionEvent();
PageTransitionEvent(const AtomicString& type, bool persisted);
diff --git a/chromium/third_party/WebKit/Source/core/events/PopStateEvent.cpp b/chromium/third_party/WebKit/Source/core/events/PopStateEvent.cpp
index 2ab213a18f2..bab1ac01adf 100644
--- a/chromium/third_party/WebKit/Source/core/events/PopStateEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/PopStateEvent.cpp
@@ -28,27 +28,26 @@
#include "core/events/PopStateEvent.h"
#include "bindings/v8/SerializedScriptValue.h"
-#include "core/events/ThreadLocalEventNames.h"
#include "core/frame/History.h"
namespace WebCore {
PopStateEvent::PopStateEvent()
: Event(EventTypeNames::popstate, false, true)
- , m_serializedState(0)
- , m_history(0)
+ , m_serializedState(nullptr)
+ , m_history(nullptr)
{
ScriptWrappable::init(this);
}
PopStateEvent::PopStateEvent(const AtomicString& type, const PopStateEventInit& initializer)
: Event(type, initializer)
- , m_history(0)
+ , m_history(nullptr)
{
ScriptWrappable::init(this);
}
-PopStateEvent::PopStateEvent(PassRefPtr<SerializedScriptValue> serializedState, PassRefPtr<History> history)
+PopStateEvent::PopStateEvent(PassRefPtr<SerializedScriptValue> serializedState, PassRefPtrWillBeRawPtr<History> history)
: Event(EventTypeNames::popstate, false, true)
, m_serializedState(serializedState)
, m_history(history)
@@ -60,19 +59,19 @@ PopStateEvent::~PopStateEvent()
{
}
-PassRefPtr<PopStateEvent> PopStateEvent::create()
+PassRefPtrWillBeRawPtr<PopStateEvent> PopStateEvent::create()
{
- return adoptRef(new PopStateEvent);
+ return adoptRefWillBeNoop(new PopStateEvent);
}
-PassRefPtr<PopStateEvent> PopStateEvent::create(PassRefPtr<SerializedScriptValue> serializedState, PassRefPtr<History> history)
+PassRefPtrWillBeRawPtr<PopStateEvent> PopStateEvent::create(PassRefPtr<SerializedScriptValue> serializedState, PassRefPtrWillBeRawPtr<History> history)
{
- return adoptRef(new PopStateEvent(serializedState, history));
+ return adoptRefWillBeNoop(new PopStateEvent(serializedState, history));
}
-PassRefPtr<PopStateEvent> PopStateEvent::create(const AtomicString& type, const PopStateEventInit& initializer)
+PassRefPtrWillBeRawPtr<PopStateEvent> PopStateEvent::create(const AtomicString& type, const PopStateEventInit& initializer)
{
- return adoptRef(new PopStateEvent(type, initializer));
+ return adoptRefWillBeNoop(new PopStateEvent(type, initializer));
}
const AtomicString& PopStateEvent::interfaceName() const
@@ -80,4 +79,10 @@ const AtomicString& PopStateEvent::interfaceName() const
return EventNames::PopStateEvent;
}
+void PopStateEvent::trace(Visitor* visitor)
+{
+ visitor->trace(m_history);
+ Event::trace(visitor);
+}
+
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/PopStateEvent.h b/chromium/third_party/WebKit/Source/core/events/PopStateEvent.h
index 5f874ea0174..ba4996756cd 100644
--- a/chromium/third_party/WebKit/Source/core/events/PopStateEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/PopStateEvent.h
@@ -28,6 +28,7 @@
#define PopStateEvent_h
#include "core/events/Event.h"
+#include "platform/heap/Handle.h"
namespace WebCore {
@@ -36,12 +37,12 @@ class SerializedScriptValue;
typedef EventInit PopStateEventInit;
-class PopStateEvent : public Event {
+class PopStateEvent FINAL : public Event {
public:
virtual ~PopStateEvent();
- static PassRefPtr<PopStateEvent> create();
- static PassRefPtr<PopStateEvent> create(PassRefPtr<SerializedScriptValue>, PassRefPtr<History>);
- static PassRefPtr<PopStateEvent> create(const AtomicString&, const PopStateEventInit&);
+ static PassRefPtrWillBeRawPtr<PopStateEvent> create();
+ static PassRefPtrWillBeRawPtr<PopStateEvent> create(PassRefPtr<SerializedScriptValue>, PassRefPtrWillBeRawPtr<History>);
+ static PassRefPtrWillBeRawPtr<PopStateEvent> create(const AtomicString&, const PopStateEventInit&);
SerializedScriptValue* serializedState() const { return m_serializedState.get(); }
void setSerializedState(PassRefPtr<SerializedScriptValue> state)
@@ -51,15 +52,17 @@ public:
}
History* history() const { return m_history.get(); }
- virtual const AtomicString& interfaceName() const;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+
+ virtual void trace(Visitor*) OVERRIDE;
private:
PopStateEvent();
PopStateEvent(const AtomicString&, const PopStateEventInit&);
- explicit PopStateEvent(PassRefPtr<SerializedScriptValue>, PassRefPtr<History>);
+ PopStateEvent(PassRefPtr<SerializedScriptValue>, PassRefPtrWillBeRawPtr<History>);
RefPtr<SerializedScriptValue> m_serializedState;
- RefPtr<History> m_history;
+ RefPtrWillBeMember<History> m_history;
};
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/ProgressEvent.cpp b/chromium/third_party/WebKit/Source/core/events/ProgressEvent.cpp
index d50bdad5edf..176efe900c7 100644
--- a/chromium/third_party/WebKit/Source/core/events/ProgressEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/ProgressEvent.cpp
@@ -26,8 +26,6 @@
#include "config.h"
#include "core/events/ProgressEvent.h"
-#include "core/events/ThreadLocalEventNames.h"
-
namespace WebCore {
ProgressEventInit::ProgressEventInit()
@@ -68,4 +66,9 @@ const AtomicString& ProgressEvent::interfaceName() const
return EventNames::ProgressEvent;
}
+void ProgressEvent::trace(Visitor* visitor)
+{
+ Event::trace(visitor);
+}
+
}
diff --git a/chromium/third_party/WebKit/Source/core/events/ProgressEvent.h b/chromium/third_party/WebKit/Source/core/events/ProgressEvent.h
index eb5edb72a21..cb6bcd154df 100644
--- a/chromium/third_party/WebKit/Source/core/events/ProgressEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/ProgressEvent.h
@@ -40,24 +40,26 @@ struct ProgressEventInit : public EventInit {
class ProgressEvent : public Event {
public:
- static PassRefPtr<ProgressEvent> create()
+ static PassRefPtrWillBeRawPtr<ProgressEvent> create()
{
- return adoptRef(new ProgressEvent);
+ return adoptRefWillBeNoop(new ProgressEvent);
}
- static PassRefPtr<ProgressEvent> create(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total)
+ static PassRefPtrWillBeRawPtr<ProgressEvent> create(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total)
{
- return adoptRef(new ProgressEvent(type, lengthComputable, loaded, total));
+ return adoptRefWillBeNoop(new ProgressEvent(type, lengthComputable, loaded, total));
}
- static PassRefPtr<ProgressEvent> create(const AtomicString& type, const ProgressEventInit& initializer)
+ static PassRefPtrWillBeRawPtr<ProgressEvent> create(const AtomicString& type, const ProgressEventInit& initializer)
{
- return adoptRef(new ProgressEvent(type, initializer));
+ return adoptRefWillBeNoop(new ProgressEvent(type, initializer));
}
bool lengthComputable() const { return m_lengthComputable; }
unsigned long long loaded() const { return m_loaded; }
unsigned long long total() const { return m_total; }
- virtual const AtomicString& interfaceName() const;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+
+ virtual void trace(Visitor*) OVERRIDE;
protected:
ProgressEvent();
diff --git a/chromium/third_party/WebKit/Source/core/events/ResourceProgressEvent.cpp b/chromium/third_party/WebKit/Source/core/events/ResourceProgressEvent.cpp
index 59d10d4d27d..08fd75b2533 100644
--- a/chromium/third_party/WebKit/Source/core/events/ResourceProgressEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/ResourceProgressEvent.cpp
@@ -51,4 +51,9 @@ const AtomicString& ResourceProgressEvent::interfaceName() const
return EventNames::ResourceProgressEvent;
}
+void ResourceProgressEvent::trace(Visitor* visitor)
+{
+ ProgressEvent::trace(visitor);
+}
+
}
diff --git a/chromium/third_party/WebKit/Source/core/events/ResourceProgressEvent.h b/chromium/third_party/WebKit/Source/core/events/ResourceProgressEvent.h
index 9c88b193d38..b7feb94db71 100644
--- a/chromium/third_party/WebKit/Source/core/events/ResourceProgressEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/ResourceProgressEvent.h
@@ -42,20 +42,22 @@ namespace WebCore {
// (and translate in the case of PNaCl) multiple binary files. It is not
// constructable by web content at all, and so does not provide the usual
// EventInit pattern for Event construction.
-class ResourceProgressEvent : public ProgressEvent {
+class ResourceProgressEvent FINAL : public ProgressEvent {
public:
- static PassRefPtr<ResourceProgressEvent> create()
+ static PassRefPtrWillBeRawPtr<ResourceProgressEvent> create()
{
- return adoptRef(new ResourceProgressEvent);
+ return adoptRefWillBeNoop(new ResourceProgressEvent);
}
- static PassRefPtr<ResourceProgressEvent> create(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total, const String& url)
+ static PassRefPtrWillBeRawPtr<ResourceProgressEvent> create(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total, const String& url)
{
- return adoptRef(new ResourceProgressEvent(type, lengthComputable, loaded, total, url));
+ return adoptRefWillBeNoop(new ResourceProgressEvent(type, lengthComputable, loaded, total, url));
}
const String& url() const;
- virtual const AtomicString& interfaceName() const;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+
+ virtual void trace(Visitor*) OVERRIDE;
protected:
ResourceProgressEvent();
diff --git a/chromium/third_party/WebKit/Source/core/events/ScopedEventQueue.cpp b/chromium/third_party/WebKit/Source/core/events/ScopedEventQueue.cpp
index 459816941b0..04a6aa02864 100644
--- a/chromium/third_party/WebKit/Source/core/events/ScopedEventQueue.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/ScopedEventQueue.cpp
@@ -59,7 +59,7 @@ void ScopedEventQueue::initialize()
s_instance = instance.leakPtr();
}
-void ScopedEventQueue::enqueueEventDispatchMediator(PassRefPtr<EventDispatchMediator> mediator)
+void ScopedEventQueue::enqueueEventDispatchMediator(PassRefPtrWillBeRawPtr<EventDispatchMediator> mediator)
{
if (m_scopingLevel)
m_queuedEventDispatchMediators.append(mediator);
@@ -69,14 +69,14 @@ void ScopedEventQueue::enqueueEventDispatchMediator(PassRefPtr<EventDispatchMedi
void ScopedEventQueue::dispatchAllEvents()
{
- Vector<RefPtr<EventDispatchMediator> > queuedEventDispatchMediators;
+ WillBeHeapVector<RefPtrWillBeMember<EventDispatchMediator> > queuedEventDispatchMediators;
queuedEventDispatchMediators.swap(m_queuedEventDispatchMediators);
for (size_t i = 0; i < queuedEventDispatchMediators.size(); i++)
dispatchEvent(queuedEventDispatchMediators[i].release());
}
-void ScopedEventQueue::dispatchEvent(PassRefPtr<EventDispatchMediator> mediator) const
+void ScopedEventQueue::dispatchEvent(PassRefPtrWillBeRawPtr<EventDispatchMediator> mediator) const
{
ASSERT(mediator->event()->target());
Node* node = mediator->event()->target()->toNode();
diff --git a/chromium/third_party/WebKit/Source/core/events/ScopedEventQueue.h b/chromium/third_party/WebKit/Source/core/events/ScopedEventQueue.h
index 4f3c928cb70..1e92d5308f4 100644
--- a/chromium/third_party/WebKit/Source/core/events/ScopedEventQueue.h
+++ b/chromium/third_party/WebKit/Source/core/events/ScopedEventQueue.h
@@ -31,6 +31,7 @@
#ifndef ScopedEventQueue_h
#define ScopedEventQueue_h
+#include "platform/heap/Handle.h"
#include "wtf/Noncopyable.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefPtr.h"
@@ -45,7 +46,7 @@ class ScopedEventQueue {
public:
~ScopedEventQueue();
- void enqueueEventDispatchMediator(PassRefPtr<EventDispatchMediator>);
+ void enqueueEventDispatchMediator(PassRefPtrWillBeRawPtr<EventDispatchMediator>);
void dispatchAllEvents();
static ScopedEventQueue* instance();
@@ -55,9 +56,9 @@ public:
private:
ScopedEventQueue();
static void initialize();
- void dispatchEvent(PassRefPtr<EventDispatchMediator>) const;
+ void dispatchEvent(PassRefPtrWillBeRawPtr<EventDispatchMediator>) const;
- Vector<RefPtr<EventDispatchMediator> > m_queuedEventDispatchMediators;
+ WillBePersistentHeapVector<RefPtrWillBeMember<EventDispatchMediator> > m_queuedEventDispatchMediators;
unsigned m_scopingLevel;
static ScopedEventQueue* s_instance;
diff --git a/chromium/third_party/WebKit/Source/core/events/SecurityPolicyViolationEvent.h b/chromium/third_party/WebKit/Source/core/events/SecurityPolicyViolationEvent.h
index cc88d03875e..e35bb757f0d 100644
--- a/chromium/third_party/WebKit/Source/core/events/SecurityPolicyViolationEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/SecurityPolicyViolationEvent.h
@@ -26,7 +26,6 @@
#define SecurityPolicyViolationEvent_h
#include "core/events/Event.h"
-#include "core/events/ThreadLocalEventNames.h"
namespace WebCore {
@@ -47,16 +46,16 @@ struct SecurityPolicyViolationEventInit : public EventInit {
int statusCode;
};
-class SecurityPolicyViolationEvent : public Event {
+class SecurityPolicyViolationEvent FINAL : public Event {
public:
- static PassRefPtr<SecurityPolicyViolationEvent> create()
+ static PassRefPtrWillBeRawPtr<SecurityPolicyViolationEvent> create()
{
- return adoptRef(new SecurityPolicyViolationEvent());
+ return adoptRefWillBeNoop(new SecurityPolicyViolationEvent());
}
- static PassRefPtr<SecurityPolicyViolationEvent> create(const AtomicString& type, const SecurityPolicyViolationEventInit& initializer)
+ static PassRefPtrWillBeRawPtr<SecurityPolicyViolationEvent> create(const AtomicString& type, const SecurityPolicyViolationEventInit& initializer)
{
- return adoptRef(new SecurityPolicyViolationEvent(type, initializer));
+ return adoptRefWillBeNoop(new SecurityPolicyViolationEvent(type, initializer));
}
const String& documentURI() const { return m_documentURI; }
@@ -70,7 +69,9 @@ public:
int columnNumber() const { return m_columnNumber; }
int statusCode() const { return m_statusCode; }
- virtual const AtomicString& interfaceName() const { return EventNames::SecurityPolicyViolationEvent; }
+ virtual const AtomicString& interfaceName() const OVERRIDE { return EventNames::SecurityPolicyViolationEvent; }
+
+ virtual void trace(Visitor* visitor) OVERRIDE { Event::trace(visitor); }
private:
SecurityPolicyViolationEvent()
diff --git a/chromium/third_party/WebKit/Source/core/events/TextEvent.cpp b/chromium/third_party/WebKit/Source/core/events/TextEvent.cpp
index 2ed8274e580..6b014ce070d 100644
--- a/chromium/third_party/WebKit/Source/core/events/TextEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/TextEvent.cpp
@@ -31,29 +31,29 @@
namespace WebCore {
-PassRefPtr<TextEvent> TextEvent::create()
+PassRefPtrWillBeRawPtr<TextEvent> TextEvent::create()
{
- return adoptRef(new TextEvent);
+ return adoptRefWillBeNoop(new TextEvent);
}
-PassRefPtr<TextEvent> TextEvent::create(PassRefPtr<AbstractView> view, const String& data, TextEventInputType inputType)
+PassRefPtrWillBeRawPtr<TextEvent> TextEvent::create(PassRefPtrWillBeRawPtr<AbstractView> view, const String& data, TextEventInputType inputType)
{
- return adoptRef(new TextEvent(view, data, inputType));
+ return adoptRefWillBeNoop(new TextEvent(view, data, inputType));
}
-PassRefPtr<TextEvent> TextEvent::createForPlainTextPaste(PassRefPtr<AbstractView> view, const String& data, bool shouldSmartReplace)
+PassRefPtrWillBeRawPtr<TextEvent> TextEvent::createForPlainTextPaste(PassRefPtrWillBeRawPtr<AbstractView> view, const String& data, bool shouldSmartReplace)
{
- return adoptRef(new TextEvent(view, data, 0, shouldSmartReplace, false));
+ return adoptRefWillBeNoop(new TextEvent(view, data, nullptr, shouldSmartReplace, false));
}
-PassRefPtr<TextEvent> TextEvent::createForFragmentPaste(PassRefPtr<AbstractView> view, PassRefPtr<DocumentFragment> data, bool shouldSmartReplace, bool shouldMatchStyle)
+PassRefPtrWillBeRawPtr<TextEvent> TextEvent::createForFragmentPaste(PassRefPtrWillBeRawPtr<AbstractView> view, PassRefPtrWillBeRawPtr<DocumentFragment> data, bool shouldSmartReplace, bool shouldMatchStyle)
{
- return adoptRef(new TextEvent(view, "", data, shouldSmartReplace, shouldMatchStyle));
+ return adoptRefWillBeNoop(new TextEvent(view, "", data, shouldSmartReplace, shouldMatchStyle));
}
-PassRefPtr<TextEvent> TextEvent::createForDrop(PassRefPtr<AbstractView> view, const String& data)
+PassRefPtrWillBeRawPtr<TextEvent> TextEvent::createForDrop(PassRefPtrWillBeRawPtr<AbstractView> view, const String& data)
{
- return adoptRef(new TextEvent(view, data, TextEventInputDrop));
+ return adoptRefWillBeNoop(new TextEvent(view, data, TextEventInputDrop));
}
TextEvent::TextEvent()
@@ -64,18 +64,18 @@ TextEvent::TextEvent()
ScriptWrappable::init(this);
}
-TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, TextEventInputType inputType)
+TextEvent::TextEvent(PassRefPtrWillBeRawPtr<AbstractView> view, const String& data, TextEventInputType inputType)
: UIEvent(EventTypeNames::textInput, true, true, view, 0)
, m_inputType(inputType)
, m_data(data)
- , m_pastingFragment(0)
+ , m_pastingFragment(nullptr)
, m_shouldSmartReplace(false)
, m_shouldMatchStyle(false)
{
ScriptWrappable::init(this);
}
-TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, PassRefPtr<DocumentFragment> pastingFragment,
+TextEvent::TextEvent(PassRefPtrWillBeRawPtr<AbstractView> view, const String& data, PassRefPtrWillBeRawPtr<DocumentFragment> pastingFragment,
bool shouldSmartReplace, bool shouldMatchStyle)
: UIEvent(EventTypeNames::textInput, true, true, view, 0)
, m_inputType(TextEventInputPaste)
@@ -91,7 +91,7 @@ TextEvent::~TextEvent()
{
}
-void TextEvent::initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view, const String& data)
+void TextEvent::initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view, const String& data)
{
if (dispatched())
return;
@@ -106,4 +106,10 @@ const AtomicString& TextEvent::interfaceName() const
return EventNames::TextEvent;
}
+void TextEvent::trace(Visitor* visitor)
+{
+ visitor->trace(m_pastingFragment);
+ UIEvent::trace(visitor);
+}
+
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/TextEvent.h b/chromium/third_party/WebKit/Source/core/events/TextEvent.h
index 6c2f256cf14..fd15dcde25a 100644
--- a/chromium/third_party/WebKit/Source/core/events/TextEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/TextEvent.h
@@ -28,33 +28,31 @@
#define TextEvent_h
#include "core/events/TextEventInputType.h"
-#include "core/events/ThreadLocalEventNames.h"
#include "core/events/UIEvent.h"
namespace WebCore {
class DocumentFragment;
- class TextEvent : public UIEvent {
+ class TextEvent FINAL : public UIEvent {
public:
- static PassRefPtr<TextEvent> create();
- static PassRefPtr<TextEvent> create(PassRefPtr<AbstractView>, const String& data, TextEventInputType = TextEventInputKeyboard);
- static PassRefPtr<TextEvent> createForPlainTextPaste(PassRefPtr<AbstractView> view, const String& data, bool shouldSmartReplace);
- static PassRefPtr<TextEvent> createForFragmentPaste(PassRefPtr<AbstractView> view, PassRefPtr<DocumentFragment> data, bool shouldSmartReplace, bool shouldMatchStyle);
- static PassRefPtr<TextEvent> createForDrop(PassRefPtr<AbstractView> view, const String& data);
+ static PassRefPtrWillBeRawPtr<TextEvent> create();
+ static PassRefPtrWillBeRawPtr<TextEvent> create(PassRefPtrWillBeRawPtr<AbstractView>, const String& data, TextEventInputType = TextEventInputKeyboard);
+ static PassRefPtrWillBeRawPtr<TextEvent> createForPlainTextPaste(PassRefPtrWillBeRawPtr<AbstractView>, const String& data, bool shouldSmartReplace);
+ static PassRefPtrWillBeRawPtr<TextEvent> createForFragmentPaste(PassRefPtrWillBeRawPtr<AbstractView>, PassRefPtrWillBeRawPtr<DocumentFragment> data, bool shouldSmartReplace, bool shouldMatchStyle);
+ static PassRefPtrWillBeRawPtr<TextEvent> createForDrop(PassRefPtrWillBeRawPtr<AbstractView>, const String& data);
virtual ~TextEvent();
- void initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, const String& data);
+ void initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>, const String& data);
String data() const { return m_data; }
- virtual const AtomicString& interfaceName() const;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
bool isLineBreak() const { return m_inputType == TextEventInputLineBreak; }
bool isComposition() const { return m_inputType == TextEventInputComposition; }
- bool isBackTab() const { return m_inputType == TextEventInputBackTab; }
bool isPaste() const { return m_inputType == TextEventInputPaste; }
bool isDrop() const { return m_inputType == TextEventInputDrop; }
@@ -62,17 +60,19 @@ namespace WebCore {
bool shouldMatchStyle() const { return m_shouldMatchStyle; }
DocumentFragment* pastingFragment() const { return m_pastingFragment.get(); }
+ virtual void trace(Visitor*) OVERRIDE;
+
private:
TextEvent();
- TextEvent(PassRefPtr<AbstractView>, const String& data, TextEventInputType = TextEventInputKeyboard);
- TextEvent(PassRefPtr<AbstractView>, const String& data, PassRefPtr<DocumentFragment>,
+ TextEvent(PassRefPtrWillBeRawPtr<AbstractView>, const String& data, TextEventInputType = TextEventInputKeyboard);
+ TextEvent(PassRefPtrWillBeRawPtr<AbstractView>, const String& data, PassRefPtrWillBeRawPtr<DocumentFragment>,
bool shouldSmartReplace, bool shouldMatchStyle);
TextEventInputType m_inputType;
String m_data;
- RefPtr<DocumentFragment> m_pastingFragment;
+ RefPtrWillBeMember<DocumentFragment> m_pastingFragment;
bool m_shouldSmartReplace;
bool m_shouldMatchStyle;
};
diff --git a/chromium/third_party/WebKit/Source/core/events/ThreadLocalEventNames.h b/chromium/third_party/WebKit/Source/core/events/ThreadLocalEventNames.h
index efde7b6d451..fea7908a633 100644
--- a/chromium/third_party/WebKit/Source/core/events/ThreadLocalEventNames.h
+++ b/chromium/third_party/WebKit/Source/core/events/ThreadLocalEventNames.h
@@ -22,11 +22,11 @@
#ifndef ThreadLocalEventNames_h
#define ThreadLocalEventNames_h
-#include "EventInterfaces.h"
-#include "EventNames.h"
-#include "EventTargetInterfaces.h"
-#include "EventTargetNames.h"
-#include "EventTypeNames.h"
+#include "core/EventInterfaces.h"
+#include "core/EventNames.h"
+#include "core/EventTargetInterfaces.h"
+#include "core/EventTargetNames.h"
+#include "core/EventTypeNames.h"
#include "wtf/text/AtomicString.h"
namespace WebCore {
diff --git a/chromium/third_party/WebKit/Source/core/events/TouchEvent.cpp b/chromium/third_party/WebKit/Source/core/events/TouchEvent.cpp
index f0527eda7f4..d65bfe11478 100644
--- a/chromium/third_party/WebKit/Source/core/events/TouchEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/TouchEvent.cpp
@@ -29,8 +29,8 @@
#include "core/events/TouchEvent.h"
#include "core/events/EventDispatcher.h"
-#include "core/events/EventRetargeter.h"
-#include "core/events/ThreadLocalEventNames.h"
+#include "core/frame/FrameConsole.h"
+#include "core/frame/LocalFrame.h"
namespace WebCore {
@@ -41,11 +41,9 @@ TouchEvent::TouchEvent()
TouchEvent::TouchEvent(TouchList* touches, TouchList* targetTouches,
TouchList* changedTouches, const AtomicString& type,
- PassRefPtr<AbstractView> view, int screenX, int screenY, int pageX, int pageY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
- : MouseRelatedEvent(type, true, true, view, 0, IntPoint(screenX, screenY),
- IntPoint(pageX, pageY),
- IntPoint(0, 0),
+ PassRefPtrWillBeRawPtr<AbstractView> view,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool cancelable)
+ : UIEventWithKeyState(type, true, cancelable, view, 0,
ctrlKey, altKey, shiftKey, metaKey)
, m_touches(touches)
, m_targetTouches(targetTouches)
@@ -60,23 +58,26 @@ TouchEvent::~TouchEvent()
void TouchEvent::initTouchEvent(TouchList* touches, TouchList* targetTouches,
TouchList* changedTouches, const AtomicString& type,
- PassRefPtr<AbstractView> view, int screenX, int screenY, int clientX, int clientY,
+ PassRefPtrWillBeRawPtr<AbstractView> view,
+ int, int, int, int,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
{
if (dispatched())
return;
- initUIEvent(type, true, true, view, 0);
+ bool cancelable = true;
+ if (type == EventTypeNames::touchcancel)
+ cancelable = false;
+
+ initUIEvent(type, true, cancelable, view, 0);
m_touches = touches;
m_targetTouches = targetTouches;
m_changedTouches = changedTouches;
- m_screenLocation = IntPoint(screenX, screenY);
m_ctrlKey = ctrlKey;
m_altKey = altKey;
m_shiftKey = shiftKey;
m_metaKey = metaKey;
- initCoordinates(IntPoint(clientX, clientY));
}
const AtomicString& TouchEvent::interfaceName() const
@@ -89,12 +90,32 @@ bool TouchEvent::isTouchEvent() const
return true;
}
-PassRefPtr<TouchEventDispatchMediator> TouchEventDispatchMediator::create(PassRefPtr<TouchEvent> touchEvent)
+void TouchEvent::preventDefault()
+{
+ UIEventWithKeyState::preventDefault();
+
+ // A common developer error is to wait too long before attempting to stop
+ // scrolling by consuming a touchmove event. Generate a warning if this
+ // event is uncancelable.
+ if (!cancelable() && view() && view()->frame()) {
+ view()->frame()->console().addMessage(JSMessageSource, WarningMessageLevel,
+ "Ignored attempt to cancel a " + type() + " event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.");
+ }
+}
+void TouchEvent::trace(Visitor* visitor)
+{
+ visitor->trace(m_touches);
+ visitor->trace(m_targetTouches);
+ visitor->trace(m_changedTouches);
+ UIEventWithKeyState::trace(visitor);
+}
+
+PassRefPtrWillBeRawPtr<TouchEventDispatchMediator> TouchEventDispatchMediator::create(PassRefPtrWillBeRawPtr<TouchEvent> touchEvent)
{
- return adoptRef(new TouchEventDispatchMediator(touchEvent));
+ return adoptRefWillBeNoop(new TouchEventDispatchMediator(touchEvent));
}
-TouchEventDispatchMediator::TouchEventDispatchMediator(PassRefPtr<TouchEvent> touchEvent)
+TouchEventDispatchMediator::TouchEventDispatchMediator(PassRefPtrWillBeRawPtr<TouchEvent> touchEvent)
: EventDispatchMediator(touchEvent)
{
}
@@ -106,7 +127,7 @@ TouchEvent* TouchEventDispatchMediator::event() const
bool TouchEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
{
- EventRetargeter::adjustForTouchEvent(dispatcher->node(), *event());
+ event()->eventPath().adjustForTouchEvent(dispatcher->node(), *event());
return dispatcher->dispatch();
}
diff --git a/chromium/third_party/WebKit/Source/core/events/TouchEvent.h b/chromium/third_party/WebKit/Source/core/events/TouchEvent.h
index 25c6f610c63..9659c98d510 100644
--- a/chromium/third_party/WebKit/Source/core/events/TouchEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/TouchEvent.h
@@ -33,62 +33,63 @@
namespace WebCore {
-class TouchEvent : public MouseRelatedEvent {
+class TouchEvent FINAL : public UIEventWithKeyState {
public:
virtual ~TouchEvent();
- static PassRefPtr<TouchEvent> create()
+ static PassRefPtrWillBeRawPtr<TouchEvent> create()
{
- return adoptRef(new TouchEvent);
+ return adoptRefWillBeNoop(new TouchEvent);
}
- static PassRefPtr<TouchEvent> create(TouchList* touches,
- TouchList* targetTouches, TouchList* changedTouches,
- const AtomicString& type, PassRefPtr<AbstractView> view,
- int screenX, int screenY, int pageX, int pageY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
+ static PassRefPtrWillBeRawPtr<TouchEvent> create(TouchList* touches,
+ TouchList* targetTouches, TouchList* changedTouches,
+ const AtomicString& type, PassRefPtrWillBeRawPtr<AbstractView> view,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool cancelable)
{
- return adoptRef(new TouchEvent(touches, targetTouches, changedTouches,
- type, view, screenX, screenY, pageX, pageY,
- ctrlKey, altKey, shiftKey, metaKey));
+ return adoptRefWillBeNoop(new TouchEvent(touches, targetTouches, changedTouches, type, view,
+ ctrlKey, altKey, shiftKey, metaKey, cancelable));
}
void initTouchEvent(TouchList* touches, TouchList* targetTouches,
- TouchList* changedTouches, const AtomicString& type,
- PassRefPtr<AbstractView> view, int screenX, int screenY,
- int clientX, int clientY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
+ TouchList* changedTouches, const AtomicString& type,
+ PassRefPtrWillBeRawPtr<AbstractView>,
+ int, int, int, int, // unused useless members of web exposed API
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
TouchList* touches() const { return m_touches.get(); }
TouchList* targetTouches() const { return m_targetTouches.get(); }
TouchList* changedTouches() const { return m_changedTouches.get(); }
- void setTouches(PassRefPtr<TouchList> touches) { m_touches = touches; }
- void setTargetTouches(PassRefPtr<TouchList> targetTouches) { m_targetTouches = targetTouches; }
- void setChangedTouches(PassRefPtr<TouchList> changedTouches) { m_changedTouches = changedTouches; }
+ void setTouches(PassRefPtrWillBeRawPtr<TouchList> touches) { m_touches = touches; }
+ void setTargetTouches(PassRefPtrWillBeRawPtr<TouchList> targetTouches) { m_targetTouches = targetTouches; }
+ void setChangedTouches(PassRefPtrWillBeRawPtr<TouchList> changedTouches) { m_changedTouches = changedTouches; }
virtual bool isTouchEvent() const OVERRIDE;
- virtual const AtomicString& interfaceName() const;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+
+ virtual void preventDefault() OVERRIDE;
+
+ virtual void trace(Visitor*) OVERRIDE;
private:
TouchEvent();
TouchEvent(TouchList* touches, TouchList* targetTouches,
TouchList* changedTouches, const AtomicString& type,
- PassRefPtr<AbstractView>, int screenX, int screenY, int pageX,
- int pageY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
+ PassRefPtrWillBeRawPtr<AbstractView>,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool cancelable);
- RefPtr<TouchList> m_touches;
- RefPtr<TouchList> m_targetTouches;
- RefPtr<TouchList> m_changedTouches;
+ RefPtrWillBeMember<TouchList> m_touches;
+ RefPtrWillBeMember<TouchList> m_targetTouches;
+ RefPtrWillBeMember<TouchList> m_changedTouches;
};
-class TouchEventDispatchMediator : public EventDispatchMediator {
+class TouchEventDispatchMediator FINAL : public EventDispatchMediator {
public:
- static PassRefPtr<TouchEventDispatchMediator> create(PassRefPtr<TouchEvent>);
+ static PassRefPtrWillBeRawPtr<TouchEventDispatchMediator> create(PassRefPtrWillBeRawPtr<TouchEvent>);
private:
- explicit TouchEventDispatchMediator(PassRefPtr<TouchEvent>);
+ explicit TouchEventDispatchMediator(PassRefPtrWillBeRawPtr<TouchEvent>);
TouchEvent* event() const;
virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
};
diff --git a/chromium/third_party/WebKit/Source/core/events/TouchEvent.idl b/chromium/third_party/WebKit/Source/core/events/TouchEvent.idl
index f4b396e01f1..36f0ac54e64 100644
--- a/chromium/third_party/WebKit/Source/core/events/TouchEvent.idl
+++ b/chromium/third_party/WebKit/Source/core/events/TouchEvent.idl
@@ -36,10 +36,10 @@ interface TouchEvent : UIEvent {
[Default=Undefined] optional TouchList changedTouches,
[Default=Undefined] optional DOMString type,
[Default=Undefined] optional Window view,
- [Default=Undefined] optional long screenX,
- [Default=Undefined] optional long screenY,
- [Default=Undefined] optional long clientX,
- [Default=Undefined] optional long clientY,
+ [Default=Undefined] optional long unused1,
+ [Default=Undefined] optional long unused2,
+ [Default=Undefined] optional long unused3,
+ [Default=Undefined] optional long unused4,
[Default=Undefined] optional boolean ctrlKey,
[Default=Undefined] optional boolean altKey,
[Default=Undefined] optional boolean shiftKey,
diff --git a/chromium/third_party/WebKit/Source/core/events/EventContext.cpp b/chromium/third_party/WebKit/Source/core/events/TouchEventContext.cpp
index 5fa4d5e42a4..c95ba8bf7d2 100644
--- a/chromium/third_party/WebKit/Source/core/events/EventContext.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/TouchEventContext.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Google Inc. All Rights Reserved.
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,56 +25,17 @@
*/
#include "config.h"
-#include "core/events/EventContext.h"
+#include "core/events/TouchEventContext.h"
+#include "core/dom/TouchList.h"
#include "core/events/Event.h"
-#include "core/events/FocusEvent.h"
-#include "core/events/MouseEvent.h"
#include "core/events/TouchEvent.h"
-#include "core/dom/TouchList.h"
namespace WebCore {
-EventContext::EventContext(PassRefPtr<Node> node, PassRefPtr<EventTarget> currentTarget)
- : m_node(node)
- , m_currentTarget(currentTarget)
-{
- ASSERT(m_node);
-}
-
-EventContext::~EventContext()
-{
-}
-
-void EventContext::adoptEventPath(Vector<RefPtr<Node> >& nodes)
-{
- m_eventPath = StaticNodeList::adopt(nodes);
-}
-
-void EventContext::handleLocalEvents(Event* event) const
+PassRefPtrWillBeRawPtr<TouchEventContext> TouchEventContext::create()
{
- if (m_touchEventContext) {
- m_touchEventContext->handleLocalEvents(event);
- } else if (m_relatedTarget && event->isMouseEvent()) {
- toMouseEvent(event)->setRelatedTarget(m_relatedTarget.get());
- } else if (m_relatedTarget && event->isFocusEvent()) {
- toFocusEvent(event)->setRelatedTarget(m_relatedTarget.get());
- }
- event->setTarget(m_target);
- event->setCurrentTarget(m_currentTarget.get());
- m_node->handleLocalEvents(event);
-}
-
-TouchEventContext* EventContext::ensureTouchEventContext()
-{
- if (!m_touchEventContext)
- m_touchEventContext = TouchEventContext::create();
- return m_touchEventContext.get();
-}
-
-PassRefPtr<TouchEventContext> TouchEventContext::create()
-{
- return adoptRef(new TouchEventContext);
+ return adoptRefWillBeNoop(new TouchEventContext);
}
TouchEventContext::TouchEventContext()
@@ -84,9 +45,7 @@ TouchEventContext::TouchEventContext()
{
}
-TouchEventContext::~TouchEventContext()
-{
-}
+DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(TouchEventContext)
void TouchEventContext::handleLocalEvents(Event* event) const
{
@@ -97,4 +56,11 @@ void TouchEventContext::handleLocalEvents(Event* event) const
touchEvent->setChangedTouches(m_changedTouches);
}
+void TouchEventContext::trace(Visitor* visitor)
+{
+ visitor->trace(m_touches);
+ visitor->trace(m_targetTouches);
+ visitor->trace(m_changedTouches);
+}
+
}
diff --git a/chromium/third_party/WebKit/Source/core/events/BeforeLoadEvent.idl b/chromium/third_party/WebKit/Source/core/events/TouchEventContext.h
index 6f8eca6e654..c5044cfa04c 100644
--- a/chromium/third_party/WebKit/Source/core/events/BeforeLoadEvent.idl
+++ b/chromium/third_party/WebKit/Source/core/events/TouchEventContext.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,7 +10,7 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
@@ -24,9 +24,38 @@
*
*/
-[
- EventConstructor,
-] interface BeforeLoadEvent : Event {
- [InitializedByEventConstructor] readonly attribute DOMString url;
+#ifndef TouchEventContext_h
+#define TouchEventContext_h
+
+#include "platform/heap/Handle.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+
+namespace WebCore {
+
+class Event;
+class TouchList;
+
+class TouchEventContext : public RefCountedWillBeGarbageCollected<TouchEventContext> {
+ DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(TouchEventContext);
+public:
+ static PassRefPtrWillBeRawPtr<TouchEventContext> create();
+ void handleLocalEvents(Event*) const;
+ TouchList& touches() { return *m_touches; }
+ TouchList& targetTouches() { return *m_targetTouches; }
+ TouchList& changedTouches() { return *m_changedTouches; }
+
+ void trace(Visitor*);
+
+private:
+ TouchEventContext();
+
+ RefPtrWillBeMember<TouchList> m_touches;
+ RefPtrWillBeMember<TouchList> m_targetTouches;
+ RefPtrWillBeMember<TouchList> m_changedTouches;
};
+}
+
+#endif // TouchEventContext_h
diff --git a/chromium/third_party/WebKit/Source/core/events/TransitionEvent.cpp b/chromium/third_party/WebKit/Source/core/events/TransitionEvent.cpp
index dfc32fd33e1..074d7e04057 100644
--- a/chromium/third_party/WebKit/Source/core/events/TransitionEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/TransitionEvent.cpp
@@ -27,8 +27,6 @@
#include "config.h"
#include "core/events/TransitionEvent.h"
-#include "core/events/ThreadLocalEventNames.h"
-
namespace WebCore {
TransitionEventInit::TransitionEventInit()
@@ -84,4 +82,9 @@ const AtomicString& TransitionEvent::interfaceName() const
return EventNames::TransitionEvent;
}
+void TransitionEvent::trace(Visitor* visitor)
+{
+ Event::trace(visitor);
+}
+
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/TransitionEvent.h b/chromium/third_party/WebKit/Source/core/events/TransitionEvent.h
index e1d5fa26082..5c781a8ef41 100644
--- a/chromium/third_party/WebKit/Source/core/events/TransitionEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/TransitionEvent.h
@@ -39,19 +39,19 @@ struct TransitionEventInit : public EventInit {
String pseudoElement;
};
-class TransitionEvent : public Event {
+class TransitionEvent FINAL : public Event {
public:
- static PassRefPtr<TransitionEvent> create()
+ static PassRefPtrWillBeRawPtr<TransitionEvent> create()
{
- return adoptRef(new TransitionEvent);
+ return adoptRefWillBeNoop(new TransitionEvent);
}
- static PassRefPtr<TransitionEvent> create(const AtomicString& type, const String& propertyName, double elapsedTime, const String& pseudoElement)
+ static PassRefPtrWillBeRawPtr<TransitionEvent> create(const AtomicString& type, const String& propertyName, double elapsedTime, const String& pseudoElement)
{
- return adoptRef(new TransitionEvent(type, propertyName, elapsedTime, pseudoElement));
+ return adoptRefWillBeNoop(new TransitionEvent(type, propertyName, elapsedTime, pseudoElement));
}
- static PassRefPtr<TransitionEvent> create(const AtomicString& type, const TransitionEventInit& initializer)
+ static PassRefPtrWillBeRawPtr<TransitionEvent> create(const AtomicString& type, const TransitionEventInit& initializer)
{
- return adoptRef(new TransitionEvent(type, initializer));
+ return adoptRefWillBeNoop(new TransitionEvent(type, initializer));
}
virtual ~TransitionEvent();
@@ -60,7 +60,9 @@ public:
double elapsedTime() const;
const String& pseudoElement() const;
- virtual const AtomicString& interfaceName() const;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+
+ virtual void trace(Visitor*) OVERRIDE;
private:
TransitionEvent();
diff --git a/chromium/third_party/WebKit/Source/core/events/TreeScopeEventContext.cpp b/chromium/third_party/WebKit/Source/core/events/TreeScopeEventContext.cpp
new file mode 100644
index 00000000000..a332552d9b2
--- /dev/null
+++ b/chromium/third_party/WebKit/Source/core/events/TreeScopeEventContext.cpp
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "config.h"
+#include "core/events/TreeScopeEventContext.h"
+
+#include "core/dom/StaticNodeList.h"
+#include "core/dom/shadow/ShadowRoot.h"
+#include "core/events/EventPath.h"
+#include "core/events/TouchEventContext.h"
+
+namespace WebCore {
+
+PassRefPtrWillBeRawPtr<StaticNodeList> TreeScopeEventContext::ensureEventPath(EventPath& path)
+{
+ if (m_eventPath)
+ return m_eventPath;
+
+ WillBeHeapVector<RefPtrWillBeMember<Node> > nodes;
+ nodes.reserveInitialCapacity(path.size());
+ for (size_t i = 0; i < path.size(); ++i) {
+ TreeScope& treeScope = path[i].treeScopeEventContext().treeScope();
+ if (treeScope.rootNode().isShadowRoot() && toShadowRoot(treeScope).type() == ShadowRoot::AuthorShadowRoot)
+ nodes.append(path[i].node());
+ else if (path[i].treeScopeEventContext().isInclusiveAncestorOf(*this))
+ nodes.append(path[i].node());
+ }
+ m_eventPath = StaticNodeList::adopt(nodes);
+ return m_eventPath;
+}
+
+TouchEventContext* TreeScopeEventContext::ensureTouchEventContext()
+{
+ if (!m_touchEventContext)
+ m_touchEventContext = TouchEventContext::create();
+ return m_touchEventContext.get();
+}
+
+PassRefPtrWillBeRawPtr<TreeScopeEventContext> TreeScopeEventContext::create(TreeScope& treeScope)
+{
+ return adoptRefWillBeNoop(new TreeScopeEventContext(treeScope));
+}
+
+TreeScopeEventContext::TreeScopeEventContext(TreeScope& treeScope)
+ : m_treeScope(treeScope)
+ , m_preOrder(-1)
+ , m_postOrder(-1)
+{
+}
+
+DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(TreeScopeEventContext)
+
+void TreeScopeEventContext::trace(Visitor* visitor)
+{
+ visitor->trace(m_treeScope);
+ visitor->trace(m_target);
+ visitor->trace(m_relatedTarget);
+ visitor->trace(m_eventPath);
+ visitor->trace(m_touchEventContext);
+#if ENABLE(OILPAN)
+ visitor->trace(m_children);
+#endif
+}
+
+int TreeScopeEventContext::calculatePrePostOrderNumber(int orderNumber)
+{
+ m_preOrder = orderNumber;
+ for (size_t i = 0; i < m_children.size(); ++i)
+ orderNumber = m_children[i]->calculatePrePostOrderNumber(orderNumber + 1);
+ m_postOrder = orderNumber + 1;
+ return orderNumber + 1;
+}
+
+}
diff --git a/chromium/third_party/WebKit/Source/core/events/TreeScopeEventContext.h b/chromium/third_party/WebKit/Source/core/events/TreeScopeEventContext.h
new file mode 100644
index 00000000000..141dff94757
--- /dev/null
+++ b/chromium/third_party/WebKit/Source/core/events/TreeScopeEventContext.h
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef TreeScopeEventContext_h
+#define TreeScopeEventContext_h
+
+#include "core/dom/Node.h"
+#include "core/dom/TreeScope.h"
+#include "core/events/EventTarget.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
+
+namespace WebCore {
+
+class EventPath;
+class EventTarget;
+class Node;
+class StaticNodeList;
+class TouchEventContext;
+class TreeScope;
+
+class TreeScopeEventContext FINAL : public RefCountedWillBeGarbageCollected<TreeScopeEventContext> {
+ DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(TreeScopeEventContext);
+public:
+ static PassRefPtrWillBeRawPtr<TreeScopeEventContext> create(TreeScope&);
+ void trace(Visitor*);
+
+ TreeScope& treeScope() const { return *m_treeScope; }
+
+ EventTarget* target() const { return m_target.get(); }
+ void setTarget(PassRefPtrWillBeRawPtr<EventTarget>);
+
+ EventTarget* relatedTarget() const { return m_relatedTarget.get(); }
+ void setRelatedTarget(PassRefPtrWillBeRawPtr<EventTarget>);
+
+ TouchEventContext* touchEventContext() const { return m_touchEventContext.get(); }
+ TouchEventContext* ensureTouchEventContext();
+
+ PassRefPtrWillBeRawPtr<StaticNodeList> ensureEventPath(EventPath&);
+
+ bool isInclusiveAncestorOf(const TreeScopeEventContext&);
+ void addChild(TreeScopeEventContext& child) { m_children.append(&child); }
+
+ // For ancestor-descendant relationship check in Q(1).
+ // Preprocessing takes O(N).
+ int calculatePrePostOrderNumber(int orderNumber);
+
+private:
+ TreeScopeEventContext(TreeScope&);
+
+#ifndef NDEBUG
+ bool isUnreachableNode(EventTarget&);
+#endif
+
+ RawPtrWillBeMember<TreeScope> m_treeScope;
+ RefPtrWillBeMember<EventTarget> m_target;
+ RefPtrWillBeMember<EventTarget> m_relatedTarget;
+ RefPtrWillBeMember<StaticNodeList> m_eventPath;
+ RefPtrWillBeMember<TouchEventContext> m_touchEventContext;
+
+ WillBeHeapVector<RawPtrWillBeMember<TreeScopeEventContext> > m_children;
+ int m_preOrder;
+ int m_postOrder;
+};
+
+#ifndef NDEBUG
+inline bool TreeScopeEventContext::isUnreachableNode(EventTarget& target)
+{
+ // FIXME: Checks also for SVG elements.
+ return target.toNode() && !target.toNode()->isSVGElement() && !target.toNode()->treeScope().isInclusiveOlderSiblingShadowRootOrAncestorTreeScopeOf(treeScope());
+}
+#endif
+
+inline void TreeScopeEventContext::setTarget(PassRefPtrWillBeRawPtr<EventTarget> target)
+{
+ ASSERT(target);
+ ASSERT(!isUnreachableNode(*target));
+ m_target = target;
+}
+
+inline void TreeScopeEventContext::setRelatedTarget(PassRefPtrWillBeRawPtr<EventTarget> relatedTarget)
+{
+ ASSERT(relatedTarget);
+ ASSERT(!isUnreachableNode(*relatedTarget));
+ m_relatedTarget = relatedTarget;
+}
+
+inline bool TreeScopeEventContext::isInclusiveAncestorOf(const TreeScopeEventContext& other)
+{
+ ASSERT(m_preOrder != -1 && m_postOrder != -1 && other.m_preOrder != -1 && other.m_postOrder != -1);
+ return m_preOrder <= other.m_preOrder && other.m_postOrder <= m_postOrder;
+}
+
+}
+
+#endif // TreeScopeEventContext_h
diff --git a/chromium/third_party/WebKit/Source/core/events/UIEvent.cpp b/chromium/third_party/WebKit/Source/core/events/UIEvent.cpp
index 6a0db63dac8..ba85c8185a8 100644
--- a/chromium/third_party/WebKit/Source/core/events/UIEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/UIEvent.cpp
@@ -27,7 +27,7 @@
namespace WebCore {
UIEventInit::UIEventInit()
- : view(0)
+ : view(nullptr)
, detail(0)
{
}
@@ -38,7 +38,7 @@ UIEvent::UIEvent()
ScriptWrappable::init(this);
}
-UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, PassRefPtr<AbstractView> viewArg, int detailArg)
+UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, PassRefPtrWillBeRawPtr<AbstractView> viewArg, int detailArg)
: Event(eventType, canBubbleArg, cancelableArg)
, m_view(viewArg)
, m_detail(detailArg)
@@ -58,7 +58,7 @@ UIEvent::~UIEvent()
{
}
-void UIEvent::initUIEvent(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg, PassRefPtr<AbstractView> viewArg, int detailArg)
+void UIEvent::initUIEvent(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg, PassRefPtrWillBeRawPtr<AbstractView> viewArg, int detailArg)
{
if (dispatched())
return;
@@ -114,4 +114,10 @@ int UIEvent::which() const
return 0;
}
+void UIEvent::trace(Visitor* visitor)
+{
+ visitor->trace(m_view);
+ Event::trace(visitor);
+}
+
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/UIEvent.h b/chromium/third_party/WebKit/Source/core/events/UIEvent.h
index 27503311307..48935975ab0 100644
--- a/chromium/third_party/WebKit/Source/core/events/UIEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/UIEvent.h
@@ -26,43 +26,43 @@
#include "core/events/Event.h"
#include "core/events/EventDispatchMediator.h"
-#include "core/frame/DOMWindow.h"
+#include "core/frame/LocalDOMWindow.h"
namespace WebCore {
-typedef DOMWindow AbstractView;
+typedef LocalDOMWindow AbstractView;
struct UIEventInit : public EventInit {
UIEventInit();
- RefPtr<AbstractView> view;
+ RefPtrWillBeMember<AbstractView> view;
int detail;
};
class UIEvent : public Event {
public:
- static PassRefPtr<UIEvent> create()
+ static PassRefPtrWillBeRawPtr<UIEvent> create()
{
- return adoptRef(new UIEvent);
+ return adoptRefWillBeNoop(new UIEvent);
}
- static PassRefPtr<UIEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view, int detail)
+ static PassRefPtrWillBeRawPtr<UIEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view, int detail)
{
- return adoptRef(new UIEvent(type, canBubble, cancelable, view, detail));
+ return adoptRefWillBeNoop(new UIEvent(type, canBubble, cancelable, view, detail));
}
- static PassRefPtr<UIEvent> create(const AtomicString& type, const UIEventInit& initializer)
+ static PassRefPtrWillBeRawPtr<UIEvent> create(const AtomicString& type, const UIEventInit& initializer)
{
- return adoptRef(new UIEvent(type, initializer));
+ return adoptRefWillBeNoop(new UIEvent(type, initializer));
}
virtual ~UIEvent();
- void initUIEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, int detail);
+ void initUIEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>, int detail);
AbstractView* view() const { return m_view.get(); }
AbstractView* view(bool& isNull) const { isNull = !m_view; return m_view.get(); }
int detail() const { return m_detail; }
- virtual const AtomicString& interfaceName() const;
- virtual bool isUIEvent() const;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+ virtual bool isUIEvent() const OVERRIDE FINAL;
virtual int keyCode() const;
virtual int charCode() const;
@@ -75,13 +75,15 @@ public:
virtual int which() const;
+ virtual void trace(Visitor*) OVERRIDE;
+
protected:
UIEvent();
- UIEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, int detail);
+ UIEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>, int detail);
UIEvent(const AtomicString&, const UIEventInit&);
private:
- RefPtr<AbstractView> m_view;
+ RefPtrWillBeMember<AbstractView> m_view;
int m_detail;
};
diff --git a/chromium/third_party/WebKit/Source/core/events/UIEventWithKeyState.h b/chromium/third_party/WebKit/Source/core/events/UIEventWithKeyState.h
index 29c8c190044..97e5094ad7a 100644
--- a/chromium/third_party/WebKit/Source/core/events/UIEventWithKeyState.h
+++ b/chromium/third_party/WebKit/Source/core/events/UIEventWithKeyState.h
@@ -44,7 +44,7 @@ namespace WebCore {
{
}
- UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view,
+ UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view,
int detail, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
: UIEvent(type, canBubble, cancelable, view, detail)
, m_ctrlKey(ctrlKey)
diff --git a/chromium/third_party/WebKit/Source/core/events/WebKitAnimationEvent.cpp b/chromium/third_party/WebKit/Source/core/events/WebKitAnimationEvent.cpp
index cefe08f766c..68064f3bbfb 100644
--- a/chromium/third_party/WebKit/Source/core/events/WebKitAnimationEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/WebKitAnimationEvent.cpp
@@ -26,8 +26,6 @@
#include "config.h"
#include "core/events/WebKitAnimationEvent.h"
-#include "core/events/ThreadLocalEventNames.h"
-
namespace WebCore {
WebKitAnimationEventInit::WebKitAnimationEventInit()
@@ -77,4 +75,9 @@ const AtomicString& WebKitAnimationEvent::interfaceName() const
return EventNames::WebKitAnimationEvent;
}
+void WebKitAnimationEvent::trace(Visitor* visitor)
+{
+ Event::trace(visitor);
+}
+
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/events/WebKitAnimationEvent.h b/chromium/third_party/WebKit/Source/core/events/WebKitAnimationEvent.h
index b91c98005bd..0ce4ed035b0 100644
--- a/chromium/third_party/WebKit/Source/core/events/WebKitAnimationEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/WebKitAnimationEvent.h
@@ -40,19 +40,19 @@ struct WebKitAnimationEventInit : public EventInit {
double elapsedTime;
};
-class WebKitAnimationEvent : public Event {
+class WebKitAnimationEvent FINAL : public Event {
public:
- static PassRefPtr<WebKitAnimationEvent> create()
+ static PassRefPtrWillBeRawPtr<WebKitAnimationEvent> create()
{
- return adoptRef(new WebKitAnimationEvent);
+ return adoptRefWillBeNoop(new WebKitAnimationEvent);
}
- static PassRefPtr<WebKitAnimationEvent> create(const AtomicString& type, const String& animationName, double elapsedTime)
+ static PassRefPtrWillBeRawPtr<WebKitAnimationEvent> create(const AtomicString& type, const String& animationName, double elapsedTime)
{
- return adoptRef(new WebKitAnimationEvent(type, animationName, elapsedTime));
+ return adoptRefWillBeNoop(new WebKitAnimationEvent(type, animationName, elapsedTime));
}
- static PassRefPtr<WebKitAnimationEvent> create(const AtomicString& type, const WebKitAnimationEventInit& initializer)
+ static PassRefPtrWillBeRawPtr<WebKitAnimationEvent> create(const AtomicString& type, const WebKitAnimationEventInit& initializer)
{
- return adoptRef(new WebKitAnimationEvent(type, initializer));
+ return adoptRefWillBeNoop(new WebKitAnimationEvent(type, initializer));
}
virtual ~WebKitAnimationEvent();
@@ -60,7 +60,9 @@ public:
const String& animationName() const;
double elapsedTime() const;
- virtual const AtomicString& interfaceName() const;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+
+ virtual void trace(Visitor*) OVERRIDE;
private:
WebKitAnimationEvent();
diff --git a/chromium/third_party/WebKit/Source/core/events/WheelEvent.cpp b/chromium/third_party/WebKit/Source/core/events/WheelEvent.cpp
index 0c23299b6fc..7a1e16e5f9b 100644
--- a/chromium/third_party/WebKit/Source/core/events/WheelEvent.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/WheelEvent.cpp
@@ -24,8 +24,7 @@
#include "config.h"
#include "core/events/WheelEvent.h"
-#include "core/dom/Clipboard.h"
-#include "core/events/ThreadLocalEventNames.h"
+#include "core/clipboard/Clipboard.h"
#include "platform/PlatformWheelEvent.h"
namespace WebCore {
@@ -62,13 +61,13 @@ WheelEvent::WheelEvent(const AtomicString& type, const WheelEventInit& initializ
}
WheelEvent::WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, unsigned deltaMode,
- PassRefPtr<AbstractView> view, const IntPoint& screenLocation, const IntPoint& pageLocation,
+ PassRefPtrWillBeRawPtr<AbstractView> view, const IntPoint& screenLocation, const IntPoint& pageLocation,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvertedFromDevice)
: MouseEvent(EventTypeNames::wheel,
true, true, view, 0, screenLocation.x(), screenLocation.y(),
pageLocation.x(), pageLocation.y(),
0, 0,
- ctrlKey, altKey, shiftKey, metaKey, 0, 0, 0, false)
+ ctrlKey, altKey, shiftKey, metaKey, 0, nullptr, nullptr, false)
, m_wheelDelta(wheelTicks.x() * TickMultiplier, wheelTicks.y() * TickMultiplier)
, m_deltaX(-rawDelta.x())
, m_deltaY(-rawDelta.y())
@@ -79,7 +78,7 @@ WheelEvent::WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta,
ScriptWrappable::init(this);
}
-void WheelEvent::initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView> view,
+void WheelEvent::initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtrWillBeRawPtr<AbstractView> view,
int screenX, int screenY, int pageX, int pageY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
{
@@ -103,7 +102,7 @@ void WheelEvent::initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<Abstrac
initCoordinates(IntPoint(pageX, pageY));
}
-void WheelEvent::initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView> view,
+void WheelEvent::initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtrWillBeRawPtr<AbstractView> view,
int screenX, int screenY, int pageX, int pageY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
{
@@ -126,17 +125,22 @@ bool WheelEvent::isWheelEvent() const
return true;
}
+void WheelEvent::trace(Visitor* visitor)
+{
+ MouseEvent::trace(visitor);
+}
+
inline static unsigned deltaMode(const PlatformWheelEvent& event)
{
return event.granularity() == ScrollByPageWheelEvent ? WheelEvent::DOM_DELTA_PAGE : WheelEvent::DOM_DELTA_PIXEL;
}
-PassRefPtr<WheelEventDispatchMediator> WheelEventDispatchMediator::create(const PlatformWheelEvent& event, PassRefPtr<AbstractView> view)
+PassRefPtrWillBeRawPtr<WheelEventDispatchMediator> WheelEventDispatchMediator::create(const PlatformWheelEvent& event, PassRefPtrWillBeRawPtr<AbstractView> view)
{
- return adoptRef(new WheelEventDispatchMediator(event, view));
+ return adoptRefWillBeNoop(new WheelEventDispatchMediator(event, view));
}
-WheelEventDispatchMediator::WheelEventDispatchMediator(const PlatformWheelEvent& event, PassRefPtr<AbstractView> view)
+WheelEventDispatchMediator::WheelEventDispatchMediator(const PlatformWheelEvent& event, PassRefPtrWillBeRawPtr<AbstractView> view)
{
if (!(event.deltaX() || event.deltaY()))
return;
diff --git a/chromium/third_party/WebKit/Source/core/events/WheelEvent.h b/chromium/third_party/WebKit/Source/core/events/WheelEvent.h
index 6c8ea020cba..efe1c7572b2 100644
--- a/chromium/third_party/WebKit/Source/core/events/WheelEvent.h
+++ b/chromium/third_party/WebKit/Source/core/events/WheelEvent.h
@@ -44,7 +44,7 @@ struct WheelEventInit : public MouseEventInit {
unsigned deltaMode;
};
-class WheelEvent : public MouseEvent {
+class WheelEvent FINAL : public MouseEvent {
public:
enum { TickMultiplier = 120 };
@@ -54,30 +54,30 @@ public:
DOM_DELTA_PAGE
};
- static PassRefPtr<WheelEvent> create()
+ static PassRefPtrWillBeRawPtr<WheelEvent> create()
{
- return adoptRef(new WheelEvent);
+ return adoptRefWillBeNoop(new WheelEvent);
}
- static PassRefPtr<WheelEvent> create(const AtomicString& type, const WheelEventInit& initializer)
+ static PassRefPtrWillBeRawPtr<WheelEvent> create(const AtomicString& type, const WheelEventInit& initializer)
{
- return adoptRef(new WheelEvent(type, initializer));
+ return adoptRefWillBeNoop(new WheelEvent(type, initializer));
}
- static PassRefPtr<WheelEvent> create(const FloatPoint& wheelTicks,
- const FloatPoint& rawDelta, unsigned deltaMode, PassRefPtr<AbstractView> view,
+ static PassRefPtrWillBeRawPtr<WheelEvent> create(const FloatPoint& wheelTicks,
+ const FloatPoint& rawDelta, unsigned deltaMode, PassRefPtrWillBeRawPtr<AbstractView> view,
const IntPoint& screenLocation, const IntPoint& pageLocation,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvertedFromDevice)
{
- return adoptRef(new WheelEvent(wheelTicks, rawDelta, deltaMode, view,
+ return adoptRefWillBeNoop(new WheelEvent(wheelTicks, rawDelta, deltaMode, view,
screenLocation, pageLocation, ctrlKey, altKey, shiftKey, metaKey, directionInvertedFromDevice));
}
- void initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView>,
+ void initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtrWillBeRawPtr<AbstractView>,
int screenX, int screenY, int pageX, int pageY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
- void initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView>,
+ void initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtrWillBeRawPtr<AbstractView>,
int screenX, int screenY, int pageX, int pageY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
@@ -93,15 +93,17 @@ public:
bool webkitDirectionInvertedFromDevice() const { return m_directionInvertedFromDevice; }
- virtual const AtomicString& interfaceName() const;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
virtual bool isMouseEvent() const OVERRIDE;
virtual bool isWheelEvent() const OVERRIDE;
+ virtual void trace(Visitor*) OVERRIDE;
+
private:
WheelEvent();
WheelEvent(const AtomicString&, const WheelEventInit&);
WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta,
- unsigned, PassRefPtr<AbstractView>, const IntPoint& screenLocation, const IntPoint& pageLocation,
+ unsigned, PassRefPtrWillBeRawPtr<AbstractView>, const IntPoint& screenLocation, const IntPoint& pageLocation,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvertedFromDevice);
IntPoint m_wheelDelta;
@@ -114,11 +116,11 @@ private:
DEFINE_EVENT_TYPE_CASTS(WheelEvent);
-class WheelEventDispatchMediator : public EventDispatchMediator {
+class WheelEventDispatchMediator FINAL : public EventDispatchMediator {
public:
- static PassRefPtr<WheelEventDispatchMediator> create(const PlatformWheelEvent&, PassRefPtr<AbstractView>);
+ static PassRefPtrWillBeRawPtr<WheelEventDispatchMediator> create(const PlatformWheelEvent&, PassRefPtrWillBeRawPtr<AbstractView>);
private:
- WheelEventDispatchMediator(const PlatformWheelEvent&, PassRefPtr<AbstractView>);
+ WheelEventDispatchMediator(const PlatformWheelEvent&, PassRefPtrWillBeRawPtr<AbstractView>);
WheelEvent* event() const;
virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
};
diff --git a/chromium/third_party/WebKit/Source/core/events/WheelEvent.idl b/chromium/third_party/WebKit/Source/core/events/WheelEvent.idl
index 1cba713f668..6c7acff7177 100644
--- a/chromium/third_party/WebKit/Source/core/events/WheelEvent.idl
+++ b/chromium/third_party/WebKit/Source/core/events/WheelEvent.idl
@@ -39,8 +39,10 @@
readonly attribute long wheelDelta;
// WebKit Extension
+ [MeasureAs=PrefixedWheelEventDirectionInvertedFromDevice]
readonly attribute boolean webkitDirectionInvertedFromDevice;
+ [MeasureAs=PrefixedWheelEventInit]
void initWebKitWheelEvent([Default=Undefined] optional long wheelDeltaX,
[Default=Undefined] optional long wheelDeltaY,
[Default=Undefined] optional Window view,
diff --git a/chromium/third_party/WebKit/Source/core/events/WindowEventContext.cpp b/chromium/third_party/WebKit/Source/core/events/WindowEventContext.cpp
index 673ef36f5c6..b48725fdbfe 100644
--- a/chromium/third_party/WebKit/Source/core/events/WindowEventContext.cpp
+++ b/chromium/third_party/WebKit/Source/core/events/WindowEventContext.cpp
@@ -28,26 +28,26 @@
#include "core/events/WindowEventContext.h"
#include "core/dom/Document.h"
-#include "core/events/Event.h"
-#include "core/events/EventContext.h"
#include "core/dom/Node.h"
-#include "core/frame/DOMWindow.h"
+#include "core/events/Event.h"
+#include "core/events/NodeEventContext.h"
+#include "core/frame/LocalDOMWindow.h"
namespace WebCore {
-WindowEventContext::WindowEventContext(Event* event, PassRefPtr<Node> node, const EventContext* topEventContext)
+WindowEventContext::WindowEventContext(Event* event, PassRefPtrWillBeRawPtr<Node> node, const NodeEventContext* topNodeEventContext)
{
// We don't dispatch load events to the window. This quirk was originally
// added because Mozilla doesn't propagate load events to the window object.
if (event->type() == EventTypeNames::load)
return;
- Node* topLevelContainer = topEventContext ? topEventContext->node() : node.get();
+ Node* topLevelContainer = topNodeEventContext ? topNodeEventContext->node() : node.get();
if (!topLevelContainer->isDocumentNode())
return;
m_window = toDocument(topLevelContainer)->domWindow();
- m_target = topEventContext ? topEventContext->target() : node.get();
+ m_target = topNodeEventContext ? topNodeEventContext->target() : node.get();
}
bool WindowEventContext::handleLocalEvents(Event* event)
diff --git a/chromium/third_party/WebKit/Source/core/events/WindowEventContext.h b/chromium/third_party/WebKit/Source/core/events/WindowEventContext.h
index 25c5079c257..976c1756f6f 100644
--- a/chromium/third_party/WebKit/Source/core/events/WindowEventContext.h
+++ b/chromium/third_party/WebKit/Source/core/events/WindowEventContext.h
@@ -27,30 +27,32 @@
#ifndef WindowEventContext_h
#define WindowEventContext_h
+#include "platform/heap/Handle.h"
#include "wtf/RefPtr.h"
namespace WebCore {
-class DOMWindow;
+class LocalDOMWindow;
class EventTarget;
-class EventContext;
class Event;
class Node;
+class NodeEventContext;
class WindowEventContext {
+ STACK_ALLOCATED();
public:
- WindowEventContext(Event*, PassRefPtr<Node>, const EventContext*);
+ WindowEventContext(Event*, PassRefPtrWillBeRawPtr<Node>, const NodeEventContext*);
- DOMWindow* window() const;
+ LocalDOMWindow* window() const;
EventTarget* target() const;
bool handleLocalEvents(Event* event);
private:
- RefPtr<DOMWindow> m_window;
- RefPtr<EventTarget> m_target;
+ RefPtrWillBeMember<LocalDOMWindow> m_window;
+ RefPtrWillBeMember<EventTarget> m_target;
};
-inline DOMWindow* WindowEventContext::window() const
+inline LocalDOMWindow* WindowEventContext::window() const
{
return m_window.get();
}