summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryuzus <yuzus@chromium.org>2016-03-18 03:54:54 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-18 10:56:04 +0000
commit19bc947948fe95fd5fae7cbe3e9a8ef71d8cf0c0 (patch)
tree561114411295abfe18b93130579b765aa8756637
parent763bbe944c22635b01caaa86cceb65a21fa1bb4c (diff)
downloadchromium_src-19bc947948fe95fd5fae7cbe3e9a8ef71d8cf0c0.zip
chromium_src-19bc947948fe95fd5fae7cbe3e9a8ef71d8cf0c0.tar.gz
chromium_src-19bc947948fe95fd5fae7cbe3e9a8ef71d8cf0c0.tar.bz2
Implement Event.relatedTargetScoped
This CL implements Event.relatedTargetScoped flag, which is set to false by default and should be set to true only if the event is trusted and has a related target or if the user sets it to true. See the spec here: https://w3c.github.io/webcomponents/spec/shadow/#dfn-relatedtargetscoped-flag BUG=589782 TBR=holte@chromium.org Review URL: https://codereview.chromium.org/1817453002 Cr-Commit-Position: refs/heads/master@{#381929}
-rw-r--r--third_party/WebKit/LayoutTests/fast/xmlhttprequest/xmlhttprequest-get-expected.txt1
-rw-r--r--third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt1
-rw-r--r--third_party/WebKit/LayoutTests/shadow-dom/events-related-target-scoped.html114
-rw-r--r--third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt1
-rw-r--r--third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt1
-rw-r--r--third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt1
-rw-r--r--third_party/WebKit/Source/core/events/Event.cpp21
-rw-r--r--third_party/WebKit/Source/core/events/Event.h6
-rw-r--r--third_party/WebKit/Source/core/events/Event.idl1
-rw-r--r--third_party/WebKit/Source/core/events/EventInit.idl1
-rw-r--r--third_party/WebKit/Source/core/events/FocusEvent.cpp2
-rw-r--r--third_party/WebKit/Source/core/events/GestureEvent.cpp2
-rw-r--r--third_party/WebKit/Source/core/events/MouseEvent.cpp2
-rw-r--r--third_party/WebKit/Source/core/events/MouseRelatedEvent.cpp4
-rw-r--r--third_party/WebKit/Source/core/events/MouseRelatedEvent.h2
-rw-r--r--third_party/WebKit/Source/core/events/RelatedEvent.cpp2
-rw-r--r--third_party/WebKit/Source/core/events/UIEvent.cpp16
-rw-r--r--third_party/WebKit/Source/core/events/UIEvent.h2
-rw-r--r--third_party/WebKit/Source/core/events/UIEventWithKeyState.cpp7
-rw-r--r--third_party/WebKit/Source/core/events/UIEventWithKeyState.h2
-rw-r--r--third_party/WebKit/Source/core/frame/UseCounter.h1
-rw-r--r--tools/metrics/histograms/histograms.xml1
22 files changed, 178 insertions, 13 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/xmlhttprequest/xmlhttprequest-get-expected.txt b/third_party/WebKit/LayoutTests/fast/xmlhttprequest/xmlhttprequest-get-expected.txt
index f534286..6ef69bd 100644
--- a/third_party/WebKit/LayoutTests/fast/xmlhttprequest/xmlhttprequest-get-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/xmlhttprequest/xmlhttprequest-get-expected.txt
@@ -56,6 +56,7 @@ lengthComputable : 'true'
loaded : '0'
path : ''
preventDefault : 'function preventDefault() { [native code] }'
+relatedTargetScoped : 'false'
returnValue : 'true'
scoped : 'true'
srcElement : '[object XMLHttpRequest]'
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
index 68d927f..ad186d6 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -149,6 +149,7 @@ interface Event
getter defaultPrevented
getter eventPhase
getter path
+ getter relatedTargetScoped
getter returnValue
getter scoped
getter srcElement
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/events-related-target-scoped.html b/third_party/WebKit/LayoutTests/shadow-dom/events-related-target-scoped.html
new file mode 100644
index 0000000..9871c64
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/shadow-dom/events-related-target-scoped.html
@@ -0,0 +1,114 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="../fast/dom/shadow/resources/shadow-dom.js"></script>
+
+<div id="log"></div>
+<div id="sandbox">
+ <div id = "host">
+ <template>
+ <input id="target1"></input>
+ <input id="target2"></input>
+ <input id="target3"></input>
+ <input id="target4"></input>
+ <input id="target5"></input>
+ </template>
+ </div>
+</div>
+
+<script>
+
+function moveMouseOver(element)
+{
+ if (!window.eventSender || !window.internals)
+ return;
+
+ var x = element.offsetLeft + element.offsetWidth / 2;
+ var y;
+ if (element.hasChildNodes() || window.internals.shadowRoot(element))
+ y = element.offsetTop;
+ else
+ y = element.offsetTop + element.offsetHeight / 2;
+ eventSender.mouseMoveTo(x, y);
+}
+
+var sandbox = document.getElementById('sandbox');
+convertTemplatesToShadowRootsWithin(sandbox);
+var target1 = getNodeInComposedTree('host/target1');
+var target2 = getNodeInComposedTree('host/target2');
+var target3 = getNodeInComposedTree('host/target3');
+var target4 = getNodeInComposedTree('host/target4');
+var target5 = getNodeInComposedTree('host/target5');
+
+async_test(function(t) {
+ target1.onfocus = function(e) {
+ t.step(function() {
+ assert_equals(e.relatedTarget, null);
+ assert_false(e.relatedTargetScoped);
+ t.done();
+ });
+ };
+}, 'Trusted events should have relatedTargetScoped set to false by default.');
+
+async_test(function(t) {
+ target3.onfocus = function(e) {
+ t.step(function() {
+ assert_equals(e.relatedTarget, target2);
+ assert_true(e.relatedTargetScoped);
+ t.done();
+ });
+ };
+}, 'Trusted focus events with a related target should have relatedTargetScoped true.');
+
+async_test(function(t) {
+ target1.onmouseenter = function(e) {
+ t.step(function() {
+ assert_equals(e.relatedTarget, null);
+ assert_false(e.relatedTargetScoped);
+ t.done();
+ });
+ };
+}, 'Trusted mouse events without a related target should have relatedTargetScoped set to false.');
+
+async_test(function(t) {
+ target3.onmouseenter = function(e) {
+ t.step(function() {
+ assert_equals(e.relatedTarget, target2);
+ assert_true(e.relatedTargetScoped);
+ t.done();
+ });
+ };
+}, 'Trusted mouse events with a related target should have relatedTargetScoped true.');
+
+async_test(function(t) {
+ target4.onfocus = function(e) {
+ t.step(function() {
+ assert_equals(e.relatedTarget, target5);
+ assert_false(e.relatedTargetScoped);
+ t.done();
+ });
+ };
+}, 'Untrusted events should have relatedTargetScoped set to false by default.');
+
+async_test(function(t) {
+ target5.onfocus = function(e) {
+ t.step(function() {
+ assert_equals(e.relatedTarget, target4);
+ assert_true(e.relatedTargetScoped);
+ t.done();
+ });
+ };
+}, 'Trusted focus events with a related target should have relatedTargetScoped true.');
+
+target1.focus();
+target2.focus();
+target3.focus();
+moveMouseOver(target1);
+moveMouseOver(target2);
+moveMouseOver(target3);
+var userFocus1 = new FocusEvent('focus', { relatedTarget: target5 });
+target4.dispatchEvent(userFocus1);
+var userFocus2 = new FocusEvent('focus', { relatedTarget: target4, relatedTargetScoped: true });
+target5.dispatchEvent(userFocus2);
+
+</script>
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt
index 17a0eb9..b574145 100644
--- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt
+++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -163,6 +163,7 @@ Starting worker: resources/global-interface-listing.js
[Worker] getter defaultPrevented
[Worker] getter eventPhase
[Worker] getter path
+[Worker] getter relatedTargetScoped
[Worker] getter returnValue
[Worker] getter scoped
[Worker] getter srcElement
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
index 0d52baa..08b56d1 100644
--- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
+++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
@@ -1513,6 +1513,7 @@ interface Event
getter defaultPrevented
getter eventPhase
getter path
+ getter relatedTargetScoped
getter returnValue
getter scoped
getter srcElement
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt
index 0a17f53..0a3d6c7 100644
--- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt
+++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -150,6 +150,7 @@ Starting worker: resources/global-interface-listing.js
[Worker] getter defaultPrevented
[Worker] getter eventPhase
[Worker] getter path
+[Worker] getter relatedTargetScoped
[Worker] getter returnValue
[Worker] getter scoped
[Worker] getter srcElement
diff --git a/third_party/WebKit/Source/core/events/Event.cpp b/third_party/WebKit/Source/core/events/Event.cpp
index 960db36..298fe00 100644
--- a/third_party/WebKit/Source/core/events/Event.cpp
+++ b/third_party/WebKit/Source/core/events/Event.cpp
@@ -54,25 +54,36 @@ Event::Event()
}
Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg)
- : Event(eventType, canBubbleArg, cancelableArg, defaultScopedFromEventType(eventType), monotonicallyIncreasingTime())
+ : Event(eventType, canBubbleArg, cancelableArg, defaultScopedFromEventType(eventType), false, monotonicallyIncreasingTime())
+{
+}
+
+Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, EventTarget* relatedTarget)
+ : Event(eventType, canBubbleArg, cancelableArg, defaultScopedFromEventType(eventType), relatedTarget ? true : false, monotonicallyIncreasingTime())
{
}
Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, double platformTimeStamp)
- : Event(eventType, canBubbleArg, cancelableArg, defaultScopedFromEventType(eventType), platformTimeStamp)
+ : Event(eventType, canBubbleArg, cancelableArg, defaultScopedFromEventType(eventType), false, platformTimeStamp)
+{
+}
+
+Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, EventTarget* relatedTarget, double platformTimeStamp)
+ : Event(eventType, canBubbleArg, cancelableArg, defaultScopedFromEventType(eventType), relatedTarget ? true : false, platformTimeStamp)
{
}
Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, bool scoped)
- : Event(eventType, canBubbleArg, cancelableArg, scoped, monotonicallyIncreasingTime())
+ : Event(eventType, canBubbleArg, cancelableArg, scoped, false, monotonicallyIncreasingTime())
{
}
-Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, bool scoped, double platformTimeStamp)
+Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, bool scoped, bool relatedTargetScoped, double platformTimeStamp)
: m_type(eventType)
, m_canBubble(canBubbleArg)
, m_cancelable(cancelableArg)
, m_scoped(scoped)
+ , m_relatedTargetScoped(relatedTargetScoped)
, m_propagationStopped(false)
, m_immediatePropagationStopped(false)
, m_defaultPrevented(false)
@@ -88,7 +99,7 @@ Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr
}
Event::Event(const AtomicString& eventType, const EventInit& initializer)
- : Event(eventType, initializer.bubbles(), initializer.cancelable(), initializer.scoped())
+ : Event(eventType, initializer.bubbles(), initializer.cancelable(), initializer.scoped(), initializer.relatedTargetScoped(), monotonicallyIncreasingTime())
{
}
diff --git a/third_party/WebKit/Source/core/events/Event.h b/third_party/WebKit/Source/core/events/Event.h
index ab661b8..845a442 100644
--- a/third_party/WebKit/Source/core/events/Event.h
+++ b/third_party/WebKit/Source/core/events/Event.h
@@ -124,6 +124,7 @@ public:
bool bubbles() const { return m_canBubble; }
bool cancelable() const { return m_cancelable; }
bool scoped() const { return m_scoped; }
+ bool relatedTargetScoped() const { return m_relatedTargetScoped; }
// Event creation timestamp in milliseconds. If |HiResEventTimeStamp|
// runtime feature is enabled it returns a DOMHighResTimeStamp using the
@@ -207,9 +208,11 @@ public:
protected:
Event();
Event(const AtomicString& type, bool canBubble, bool cancelable);
+ Event(const AtomicString& type, bool canBubble, bool cancelable, EventTarget* relatedTarget);
Event(const AtomicString& type, bool canBubble, bool cancelable, double platformTimeStamp);
+ Event(const AtomicString& type, bool canBubble, bool cancelable, EventTarget* relatedTarget, double platformTimeStamp);
Event(const AtomicString& type, bool canBubble, bool cancelable, bool scoped);
- Event(const AtomicString& type, bool canBubble, bool cancelable, bool scoped, double platformTimeStamp);
+ Event(const AtomicString& type, bool canBubble, bool cancelable, bool scoped, bool relatedTargetScoped, double platformTimeStamp);
Event(const AtomicString& type, const EventInit&);
virtual void receivedTarget();
@@ -229,6 +232,7 @@ private:
unsigned m_canBubble:1;
unsigned m_cancelable:1;
unsigned m_scoped:1;
+ unsigned m_relatedTargetScoped:1;
unsigned m_propagationStopped:1;
unsigned m_immediatePropagationStopped:1;
diff --git a/third_party/WebKit/Source/core/events/Event.idl b/third_party/WebKit/Source/core/events/Event.idl
index e2f5a1c..f04cb53 100644
--- a/third_party/WebKit/Source/core/events/Event.idl
+++ b/third_party/WebKit/Source/core/events/Event.idl
@@ -44,6 +44,7 @@
readonly attribute boolean defaultPrevented;
[RuntimeEnabled=ShadowDOMV1, MeasureAs=EventScoped] readonly attribute boolean scoped;
+ [RuntimeEnabled=ShadowDOMV1, MeasureAs=EventRelatedTargetScoped] readonly attribute boolean relatedTargetScoped;
[RuntimeEnabled=TrustedEvents, Unforgeable] readonly attribute boolean isTrusted;
diff --git a/third_party/WebKit/Source/core/events/EventInit.idl b/third_party/WebKit/Source/core/events/EventInit.idl
index 0ddc8ca..e40f7a2 100644
--- a/third_party/WebKit/Source/core/events/EventInit.idl
+++ b/third_party/WebKit/Source/core/events/EventInit.idl
@@ -8,4 +8,5 @@ dictionary EventInit {
boolean bubbles = false;
boolean cancelable = false;
[RuntimeEnabled=ShadowDOMV1] boolean scoped = false;
+ [RuntimeEnabled=ShadowDOMV1] boolean relatedTargetScoped = false;
};
diff --git a/third_party/WebKit/Source/core/events/FocusEvent.cpp b/third_party/WebKit/Source/core/events/FocusEvent.cpp
index 5be36bd..a43489c 100644
--- a/third_party/WebKit/Source/core/events/FocusEvent.cpp
+++ b/third_party/WebKit/Source/core/events/FocusEvent.cpp
@@ -45,7 +45,7 @@ FocusEvent::FocusEvent()
}
FocusEvent::FocusEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view, int detail, EventTarget* relatedTarget, InputDeviceCapabilities* sourceCapabilities)
- : UIEvent(type, canBubble, cancelable, view, detail, sourceCapabilities)
+ : UIEvent(type, canBubble, cancelable, relatedTarget, view, detail, sourceCapabilities)
, m_relatedTarget(relatedTarget)
{
}
diff --git a/third_party/WebKit/Source/core/events/GestureEvent.cpp b/third_party/WebKit/Source/core/events/GestureEvent.cpp
index e79fc0c..f758af2 100644
--- a/third_party/WebKit/Source/core/events/GestureEvent.cpp
+++ b/third_party/WebKit/Source/core/events/GestureEvent.cpp
@@ -115,7 +115,7 @@ GestureEvent::GestureEvent()
}
GestureEvent::GestureEvent(const AtomicString& type, PassRefPtrWillBeRawPtr<AbstractView> view, int screenX, int screenY, int clientX, int clientY, PlatformEvent::Modifiers modifiers, float deltaX, float deltaY, float velocityX, float velocityY, bool inertial, double platformTimeStamp, int resendingPluginId, GestureSource source)
- : MouseRelatedEvent(type, true, true, view, 0, IntPoint(screenX, screenY), IntPoint(clientX, clientY), IntPoint(0, 0), modifiers, platformTimeStamp, PositionType::Position)
+ : MouseRelatedEvent(type, true, true, nullptr, view, 0, IntPoint(screenX, screenY), IntPoint(clientX, clientY), IntPoint(0, 0), modifiers, platformTimeStamp, PositionType::Position)
, m_deltaX(deltaX)
, m_deltaY(deltaY)
, m_velocityX(velocityX)
diff --git a/third_party/WebKit/Source/core/events/MouseEvent.cpp b/third_party/WebKit/Source/core/events/MouseEvent.cpp
index efc2349..cca9e8e 100644
--- a/third_party/WebKit/Source/core/events/MouseEvent.cpp
+++ b/third_party/WebKit/Source/core/events/MouseEvent.cpp
@@ -119,7 +119,7 @@ MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cance
double platformTimeStamp,
PlatformMouseEvent::SyntheticEventType syntheticEventType,
const String& region)
- : MouseRelatedEvent(eventType, canBubble, cancelable, view, detail, IntPoint(screenX, screenY),
+ : MouseRelatedEvent(eventType, canBubble, cancelable, relatedTarget.get(), view, detail, IntPoint(screenX, screenY),
IntPoint(windowX, windowY), IntPoint(movementX, movementY), modifiers,
platformTimeStamp,
syntheticEventType == PlatformMouseEvent::Positionless ? PositionType::Positionless : PositionType::Position,
diff --git a/third_party/WebKit/Source/core/events/MouseRelatedEvent.cpp b/third_party/WebKit/Source/core/events/MouseRelatedEvent.cpp
index dedb8a4..bf3dad1 100644
--- a/third_party/WebKit/Source/core/events/MouseRelatedEvent.cpp
+++ b/third_party/WebKit/Source/core/events/MouseRelatedEvent.cpp
@@ -51,11 +51,11 @@ static LayoutSize contentsScrollOffset(AbstractView* abstractView)
return LayoutSize(frameView->scrollX() / scaleFactor, frameView->scrollY() / scaleFactor);
}
-MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubble, bool cancelable,
+MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubble, bool cancelable, EventTarget* relatedTarget,
PassRefPtrWillBeRawPtr<AbstractView> abstractView, int detail, const IntPoint& screenLocation,
const IntPoint& rootFrameLocation, const IntPoint& movementDelta, PlatformEvent::Modifiers modifiers,
double platformTimeStamp, PositionType positionType, InputDeviceCapabilities* sourceCapabilities)
- : UIEventWithKeyState(eventType, canBubble, cancelable, abstractView, detail, modifiers, platformTimeStamp, sourceCapabilities)
+ : UIEventWithKeyState(eventType, canBubble, cancelable, relatedTarget, abstractView, detail, modifiers, platformTimeStamp, sourceCapabilities)
, m_screenLocation(screenLocation)
, m_movementDelta(movementDelta)
, m_positionType(positionType)
diff --git a/third_party/WebKit/Source/core/events/MouseRelatedEvent.h b/third_party/WebKit/Source/core/events/MouseRelatedEvent.h
index 466efc6..0f0975a 100644
--- a/third_party/WebKit/Source/core/events/MouseRelatedEvent.h
+++ b/third_party/WebKit/Source/core/events/MouseRelatedEvent.h
@@ -71,7 +71,7 @@ protected:
MouseRelatedEvent();
// TODO(lanwei): Will make this argument non-optional and all the callers need to provide
// sourceCapabilities even when it is null, see https://crbug.com/476530.
- MouseRelatedEvent(const AtomicString& type, bool canBubble, bool cancelable,
+ MouseRelatedEvent(const AtomicString& type, bool canBubble, bool cancelable, EventTarget* relatedTarget,
PassRefPtrWillBeRawPtr<AbstractView>, int detail, const IntPoint& screenLocation,
const IntPoint& rootFrameLocation, const IntPoint& movementDelta, PlatformEvent::Modifiers,
double platformTimeStamp, PositionType, InputDeviceCapabilities* sourceCapabilities = nullptr);
diff --git a/third_party/WebKit/Source/core/events/RelatedEvent.cpp b/third_party/WebKit/Source/core/events/RelatedEvent.cpp
index 142bf3c..17f3bb8 100644
--- a/third_party/WebKit/Source/core/events/RelatedEvent.cpp
+++ b/third_party/WebKit/Source/core/events/RelatedEvent.cpp
@@ -30,7 +30,7 @@ RelatedEvent::RelatedEvent()
}
RelatedEvent::RelatedEvent(const AtomicString& type, bool canBubble, bool cancelable, EventTarget* relatedTarget)
- : Event(type, canBubble, cancelable)
+ : Event(type, canBubble, cancelable, relatedTarget)
, m_relatedTarget(relatedTarget)
{
}
diff --git a/third_party/WebKit/Source/core/events/UIEvent.cpp b/third_party/WebKit/Source/core/events/UIEvent.cpp
index 47bfb3b..fac5087 100644
--- a/third_party/WebKit/Source/core/events/UIEvent.cpp
+++ b/third_party/WebKit/Source/core/events/UIEvent.cpp
@@ -40,6 +40,14 @@ UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelab
{
}
+UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, EventTarget* relatedTarget, PassRefPtrWillBeRawPtr<AbstractView> viewArg, int detailArg, InputDeviceCapabilities* sourceCapabilitiesArg)
+ : Event(eventType, canBubbleArg, cancelableArg, relatedTarget)
+ , m_view(viewArg)
+ , m_detail(detailArg)
+ , m_sourceCapabilities(sourceCapabilitiesArg)
+{
+}
+
UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, double platformTimeStamp, PassRefPtrWillBeRawPtr<AbstractView> viewArg, int detailArg, InputDeviceCapabilities* sourceCapabilitiesArg)
: Event(eventType, canBubbleArg, cancelableArg, platformTimeStamp)
, m_view(viewArg)
@@ -48,6 +56,14 @@ UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelab
{
}
+UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, EventTarget* relatedTarget, double platformTimeStamp, PassRefPtrWillBeRawPtr<AbstractView> viewArg, int detailArg, InputDeviceCapabilities* sourceCapabilitiesArg)
+ : Event(eventType, canBubbleArg, cancelableArg, relatedTarget, platformTimeStamp)
+ , m_view(viewArg)
+ , m_detail(detailArg)
+ , m_sourceCapabilities(sourceCapabilitiesArg)
+{
+}
+
UIEvent::UIEvent(const AtomicString& eventType, const UIEventInit& initializer)
: Event(eventType, initializer)
, m_view(initializer.view())
diff --git a/third_party/WebKit/Source/core/events/UIEvent.h b/third_party/WebKit/Source/core/events/UIEvent.h
index 430ee40..47e4337 100644
--- a/third_party/WebKit/Source/core/events/UIEvent.h
+++ b/third_party/WebKit/Source/core/events/UIEvent.h
@@ -71,7 +71,9 @@ protected:
UIEvent();
// TODO(crbug.com/563542): Remove of this ctor in favor of making platformTimeStamp (and perhaps sourceCapabilities) required in all constructions sites
UIEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>, int detail, InputDeviceCapabilities* sourceCapabilities = nullptr);
+ UIEvent(const AtomicString& type, bool canBubble, bool cancelable, EventTarget* relatedTarget, PassRefPtrWillBeRawPtr<AbstractView>, int detail, InputDeviceCapabilities* sourceCapabilities = nullptr);
UIEvent(const AtomicString& type, bool canBubble, bool cancelable, double platformTimeStamp, PassRefPtrWillBeRawPtr<AbstractView>, int detail, InputDeviceCapabilities* sourceCapabilities);
+ UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, EventTarget* relatedTarget, double platformTimeStamp, PassRefPtrWillBeRawPtr<AbstractView> viewArg, int detailArg, InputDeviceCapabilities* sourceCapabilitiesArg);
UIEvent(const AtomicString&, const UIEventInit&);
private:
diff --git a/third_party/WebKit/Source/core/events/UIEventWithKeyState.cpp b/third_party/WebKit/Source/core/events/UIEventWithKeyState.cpp
index 0449cf8..0f6a9a871 100644
--- a/third_party/WebKit/Source/core/events/UIEventWithKeyState.cpp
+++ b/third_party/WebKit/Source/core/events/UIEventWithKeyState.cpp
@@ -29,6 +29,13 @@ UIEventWithKeyState::UIEventWithKeyState(const AtomicString& type, bool canBubbl
{
}
+UIEventWithKeyState::UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, EventTarget* relatedTarget, PassRefPtrWillBeRawPtr<AbstractView> view,
+ int detail, PlatformEvent::Modifiers modifiers, double platformTimeStamp, InputDeviceCapabilities* sourceCapabilities)
+ : UIEvent(type, canBubble, cancelable, relatedTarget, platformTimeStamp, view, detail, sourceCapabilities)
+ , m_modifiers(modifiers)
+{
+}
+
UIEventWithKeyState::UIEventWithKeyState(const AtomicString& type, const EventModifierInit& initializer)
: UIEvent(type, initializer)
, m_modifiers(0)
diff --git a/third_party/WebKit/Source/core/events/UIEventWithKeyState.h b/third_party/WebKit/Source/core/events/UIEventWithKeyState.h
index e78c30c..2bdee7e 100644
--- a/third_party/WebKit/Source/core/events/UIEventWithKeyState.h
+++ b/third_party/WebKit/Source/core/events/UIEventWithKeyState.h
@@ -57,6 +57,8 @@ protected:
UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view,
int detail, PlatformEvent::Modifiers, double platformTimeStamp, InputDeviceCapabilities* sourceCapabilities = nullptr);
+ UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, EventTarget* relatedTarget, PassRefPtrWillBeRawPtr<AbstractView> view,
+ int detail, PlatformEvent::Modifiers, double platformTimeStamp, InputDeviceCapabilities* sourceCapabilities = nullptr);
UIEventWithKeyState(const AtomicString& type, const EventModifierInit& initializer);
void initModifiers(bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.h b/third_party/WebKit/Source/core/frame/UseCounter.h
index 002b037..7f609aa 100644
--- a/third_party/WebKit/Source/core/frame/UseCounter.h
+++ b/third_party/WebKit/Source/core/frame/UseCounter.h
@@ -1082,6 +1082,7 @@ public:
HTMLLabelElementControlForNonFormAssociatedElement = 1263,
PatternAttributeUnicodeFlagIsIncompatible = 1264,
HTMLMediaElementLoadNetworkEmptyNotPaused = 1265,
+ EventRelatedTargetScoped = 1266,
// Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots.
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index cf520ef..02c325c 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -68600,6 +68600,7 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
<int value="1263" label="HTMLLabelElementControlForNonFormAssociatedElement"/>
<int value="1264" label="PatternAttributeUnicodeFlagIsIncompatible"/>
<int value="1265" label="HTMLMediaElementLoadNetworkEmptyNotPaused"/>
+ <int value="1266" label="EventRelatedTargetScoped"/>
</enum>
<enum name="FetchRequestMode" type="int">