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

Side by Side Diff: third_party/WebKit/Source/core/events/Event.cpp

Issue 1586563005: Add Event.scoped (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 * Copyright (C) 2003, 2005, 2006, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2005, 2006, 2008 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 16 matching lines...) Expand all
27 #include "core/events/EventTarget.h" 27 #include "core/events/EventTarget.h"
28 #include "core/frame/OriginsUsingFeatures.h" 28 #include "core/frame/OriginsUsingFeatures.h"
29 #include "core/frame/UseCounter.h" 29 #include "core/frame/UseCounter.h"
30 #include "core/svg/SVGElement.h" 30 #include "core/svg/SVGElement.h"
31 #include "core/timing/DOMWindowPerformance.h" 31 #include "core/timing/DOMWindowPerformance.h"
32 #include "core/timing/Performance.h" 32 #include "core/timing/Performance.h"
33 #include "wtf/CurrentTime.h" 33 #include "wtf/CurrentTime.h"
34 34
35 namespace blink { 35 namespace blink {
36 36
37 static bool defaultScopedFromEventType(const AtomicString& eventType)
38 {
39 if (eventType == EventTypeNames::abort
hayato 2016/01/15 03:59:52 You do not have to use "if (xxx) { return true; }
yuzuchan 2016/01/15 05:32:27 Done.
40 || eventType == EventTypeNames::change
41 || eventType == EventTypeNames::error
42 || eventType == EventTypeNames::load
43 || eventType == EventTypeNames::reset
44 || eventType == EventTypeNames::resize
45 || eventType == EventTypeNames::scroll
46 || eventType == EventTypeNames::select
47 || eventType == EventTypeNames::selectstart) {
48 return true;
49 }
50 return false;
51 }
52
37 Event::Event() 53 Event::Event()
38 : Event("", false, false) 54 : Event("", false, false)
39 { 55 {
40 } 56 }
41 57
42 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g) 58 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g)
43 : Event(eventType, canBubbleArg, cancelableArg, monotonicallyIncreasingTime( )) 59 : Event(eventType, canBubbleArg, cancelableArg, defaultScopedFromEventType(e ventType), monotonicallyIncreasingTime())
44 { 60 {
45 } 61 }
46 62
47 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, double platformTimeStamp) 63 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, double platformTimeStamp)
64 : Event(eventType, canBubbleArg, cancelableArg, defaultScopedFromEventType(e ventType), platformTimeStamp)
65 {
66 }
67
68 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, bool scoped)
69 : Event(eventType, canBubbleArg, cancelableArg, scoped, monotonicallyIncreas ingTime())
70 {
71 }
72
73 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, bool scoped, double platformTimeStamp)
48 : m_type(eventType) 74 : m_type(eventType)
49 , m_canBubble(canBubbleArg) 75 , m_canBubble(canBubbleArg)
50 , m_cancelable(cancelableArg) 76 , m_cancelable(cancelableArg)
77 , m_scoped(scoped)
51 , m_propagationStopped(false) 78 , m_propagationStopped(false)
52 , m_immediatePropagationStopped(false) 79 , m_immediatePropagationStopped(false)
53 , m_defaultPrevented(false) 80 , m_defaultPrevented(false)
54 , m_defaultHandled(false) 81 , m_defaultHandled(false)
55 , m_cancelBubble(false) 82 , m_cancelBubble(false)
56 , m_isTrusted(false) 83 , m_isTrusted(false)
57 , m_handlingPassive(false) 84 , m_handlingPassive(false)
58 , m_eventPhase(0) 85 , m_eventPhase(0)
59 , m_currentTarget(nullptr) 86 , m_currentTarget(nullptr)
60 , m_createTime(convertSecondsToDOMTimeStamp(currentTime())) 87 , m_createTime(convertSecondsToDOMTimeStamp(currentTime()))
61 , m_platformTimeStamp(platformTimeStamp) 88 , m_platformTimeStamp(platformTimeStamp)
62 { 89 {
63 } 90 }
64 91
65 Event::Event(const AtomicString& eventType, const EventInit& initializer) 92 Event::Event(const AtomicString& eventType, const EventInit& initializer)
66 : Event(eventType, initializer.bubbles(), initializer.cancelable()) 93 : Event(eventType, initializer.bubbles(), initializer.cancelable(), initiali zer.scoped())
67 { 94 {
68 } 95 }
69 96
70 Event::~Event() 97 Event::~Event()
71 { 98 {
72 } 99 }
73 100
74 void Event::initEvent(const AtomicString& eventTypeArg, bool canBubbleArg, bool cancelableArg) 101 void Event::initEvent(const AtomicString& eventTypeArg, bool canBubbleArg, bool cancelableArg)
75 { 102 {
76 if (dispatched()) 103 if (dispatched())
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 324
298 DEFINE_TRACE(Event) 325 DEFINE_TRACE(Event)
299 { 326 {
300 visitor->trace(m_currentTarget); 327 visitor->trace(m_currentTarget);
301 visitor->trace(m_target); 328 visitor->trace(m_target);
302 visitor->trace(m_underlyingEvent); 329 visitor->trace(m_underlyingEvent);
303 visitor->trace(m_eventPath); 330 visitor->trace(m_eventPath);
304 } 331 }
305 332
306 } // namespace blink 333 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698