Index: Source/core/dom/EventTarget.cpp |
diff --git a/Source/core/dom/EventTarget.cpp b/Source/core/dom/EventTarget.cpp |
index 233fd701603c29d73a41f6330a47ea94537e1114..eda818b0a57136bbca277c407855f7bc502649fd 100644 |
--- a/Source/core/dom/EventTarget.cpp |
+++ b/Source/core/dom/EventTarget.cpp |
@@ -68,6 +68,13 @@ DOMWindow* EventTarget::toDOMWindow() |
return 0; |
} |
+inline DOMWindow* EventTarget::browsingContext() |
+{ |
+ if (ScriptExecutionContext* context = scriptExecutionContext()) |
+ return context->browsingContext(); |
+ return 0; |
+} |
+ |
bool EventTarget::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture) |
{ |
EventTargetData* d = ensureEventTargetData(); |
@@ -203,17 +210,14 @@ bool EventTarget::fireEventListeners(Event* event) |
} |
if (!prefixedTypeName.isEmpty()) { |
- ScriptExecutionContext* context = scriptExecutionContext(); |
- if (context && context->isDocument()) { |
- Document* document = toDocument(context); |
- if (document->domWindow()) { |
- if (listenerPrefixedVector) |
- if (listenerUnprefixedVector) |
- UseCounter::count(document->domWindow(), UseCounter::PrefixedAndUnprefixedTransitionEndEvent); |
- else |
- UseCounter::count(document->domWindow(), UseCounter::PrefixedTransitionEndEvent); |
- else if (listenerUnprefixedVector) |
- UseCounter::count(document->domWindow(), UseCounter::UnprefixedTransitionEndEvent); |
+ if (DOMWindow* browsingContext = this->browsingContext()) { |
+ if (listenerPrefixedVector) { |
+ if (listenerUnprefixedVector) |
+ UseCounter::count(browsingContext, UseCounter::PrefixedAndUnprefixedTransitionEndEvent); |
+ else |
+ UseCounter::count(browsingContext, UseCounter::PrefixedTransitionEndEvent); |
+ } else if (listenerUnprefixedVector) { |
+ UseCounter::count(browsingContext, UseCounter::UnprefixedTransitionEndEvent); |
} |
} |
} |
@@ -231,12 +235,10 @@ void EventTarget::fireEventListeners(Event* event, EventTargetData* d, EventList |
// index |size|, so iterating up to (but not including) |size| naturally excludes |
// new event listeners. |
- ScriptExecutionContext* context = scriptExecutionContext(); |
- if (context && context->isDocument() && event->type() == eventNames().beforeunloadEvent) { |
- Document* document = toDocument(context); |
- if (DOMWindow* domWindow = document->domWindow()) { |
- if (domWindow != domWindow->top()) |
- UseCounter::count(domWindow, UseCounter::SubFrameBeforeUnloadFired); |
+ if (event->type() == eventNames().beforeunloadEvent) { |
+ if (DOMWindow* browsingContext = this->browsingContext()) { |
+ if (browsingContext->top()) |
+ UseCounter::count(browsingContext, UseCounter::SubFrameBeforeUnloadFired); |
} |
} |
@@ -269,11 +271,8 @@ void EventTarget::fireEventListeners(Event* event, EventTargetData* d, EventList |
} |
d->firingEventIterators->removeLast(); |
if (userEventWasHandled) { |
- ScriptExecutionContext* context = scriptExecutionContext(); |
- if (context && context->isDocument()) { |
- Document* document = toDocument(context); |
- document->resetLastHandledUserGestureTimestamp(); |
- } |
+ if (ScriptExecutionContext* context = scriptExecutionContext()) |
+ context->userEventWasHandled(); |
abarth-chromium
2013/08/09 16:25:53
userEventWasHandled -> didHandleUserEvent ?
|
} |
} |