Commit 49c7980a authored by Hwanseung Lee's avatar Hwanseung Lee Committed by Commit Bot

Use Event& instead of Event* as a parameter of PreDispatchEventHandler

When PreDispatchEventHandler is called, Event object was passed as a
parameter. and it is never nullptr.
so it can be changed to reference instead of pointer.

Bug: 871637
Change-Id: Id8f1b05c51024e6418eaf2e7517f6dfb2ec70699
Reviewed-on: https://chromium-review.googlesource.com/1179520Reviewed-by: default avatarHayato Ito <hayato@chromium.org>
Commit-Queue: Hwanseung Lee <hs1217.lee@samsung.com>
Cr-Commit-Position: refs/heads/master@{#584358}
parent c75d117b
...@@ -206,7 +206,7 @@ inline EventDispatchContinuation EventDispatcher::DispatchEventPreProcess( ...@@ -206,7 +206,7 @@ inline EventDispatchContinuation EventDispatcher::DispatchEventPreProcess(
// legacy-pre-activation behavior. // legacy-pre-activation behavior.
if (activation_target) { if (activation_target) {
pre_dispatch_event_handler_result = pre_dispatch_event_handler_result =
activation_target->PreDispatchEventHandler(event_.Get()); activation_target->PreDispatchEventHandler(*event_);
} }
return (event_->GetEventPath().IsEmpty() || event_->PropagationStopped()) return (event_->GetEventPath().IsEmpty() || event_->PropagationStopped())
? kDoneDispatching ? kDoneDispatching
......
...@@ -771,7 +771,7 @@ class CORE_EXPORT Node : public EventTarget { ...@@ -771,7 +771,7 @@ class CORE_EXPORT Node : public EventTarget {
// Handlers to do/undo actions on the target node before an event is // Handlers to do/undo actions on the target node before an event is
// dispatched to it and after the event has been dispatched. The data pointer // dispatched to it and after the event has been dispatched. The data pointer
// is handed back by the preDispatch and passed to postDispatch. // is handed back by the preDispatch and passed to postDispatch.
virtual EventDispatchHandlingState* PreDispatchEventHandler(Event*) { virtual EventDispatchHandlingState* PreDispatchEventHandler(Event&) {
return nullptr; return nullptr;
} }
virtual void PostDispatchEventHandler(Event*, EventDispatchHandlingState*) {} virtual void PostDispatchEventHandler(Event*, EventDispatchHandlingState*) {}
......
...@@ -1230,16 +1230,16 @@ void HTMLInputElement::SetValueFromRenderer(const String& value) { ...@@ -1230,16 +1230,16 @@ void HTMLInputElement::SetValueFromRenderer(const String& value) {
} }
EventDispatchHandlingState* HTMLInputElement::PreDispatchEventHandler( EventDispatchHandlingState* HTMLInputElement::PreDispatchEventHandler(
Event* event) { Event& event) {
if (event->type() == EventTypeNames::textInput && if (event.type() == EventTypeNames::textInput &&
input_type_view_->ShouldSubmitImplicitly(*event)) { input_type_view_->ShouldSubmitImplicitly(event)) {
event->stopPropagation(); event.stopPropagation();
return nullptr; return nullptr;
} }
if (event->type() != EventTypeNames::click) if (event.type() != EventTypeNames::click)
return nullptr; return nullptr;
if (!event->IsMouseEvent() || if (!event.IsMouseEvent() ||
ToMouseEvent(event)->button() != ToMouseEvent(event).button() !=
static_cast<short>(WebPointerProperties::Button::kLeft)) static_cast<short>(WebPointerProperties::Button::kLeft))
return nullptr; return nullptr;
return input_type_view_->WillDispatchClick(); return input_type_view_->WillDispatchClick();
......
...@@ -361,7 +361,7 @@ class CORE_EXPORT HTMLInputElement ...@@ -361,7 +361,7 @@ class CORE_EXPORT HTMLInputElement
void ResetImpl() final; void ResetImpl() final;
bool SupportsAutofocus() const final; bool SupportsAutofocus() const final;
EventDispatchHandlingState* PreDispatchEventHandler(Event*) final; EventDispatchHandlingState* PreDispatchEventHandler(Event&) final;
void PostDispatchEventHandler(Event*, EventDispatchHandlingState*) final; void PostDispatchEventHandler(Event*, EventDispatchHandlingState*) final;
bool IsURLAttribute(const Attribute&) const final; bool IsURLAttribute(const Attribute&) const final;
......
...@@ -70,13 +70,13 @@ class DataListIndicatorElement final : public HTMLDivElement { ...@@ -70,13 +70,13 @@ class DataListIndicatorElement final : public HTMLDivElement {
return new LayoutDetailsMarker(this); return new LayoutDetailsMarker(this);
} }
EventDispatchHandlingState* PreDispatchEventHandler(Event* event) override { EventDispatchHandlingState* PreDispatchEventHandler(Event& event) override {
// Chromium opens autofill popup in a mousedown event listener // Chromium opens autofill popup in a mousedown event listener
// associated to the document. We don't want to open it in this case // associated to the document. We don't want to open it in this case
// because we opens a datalist chooser later. // because we opens a datalist chooser later.
// FIXME: We should dispatch mousedown events even in such case. // FIXME: We should dispatch mousedown events even in such case.
if (event->type() == EventTypeNames::mousedown) if (event.type() == EventTypeNames::mousedown)
event->stopPropagation(); event.stopPropagation();
return nullptr; return nullptr;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment