Commit 7ac8cf00 authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

Make some |Event| arguments |const|

Make |Event| arguments of the following functions |const|:
- Node::DispatchSimulatedClick()
- HTMLFormElement::SubmitImplicitly()
- HTMLFormElement::PrepareForSubmission()
- HTMLFormElement::ScheduleFormSubmission()
- SelectType::DefaultEventHandler()

This CL has no behavior changes.

Change-Id: I91c233a6dead779f771ddeea357bad3f91a145f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2060214Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742072}
parent 22be0fa0
...@@ -2939,7 +2939,7 @@ DispatchEventResult Node::DispatchDOMActivateEvent(int detail, ...@@ -2939,7 +2939,7 @@ DispatchEventResult Node::DispatchDOMActivateEvent(int detail,
return EventTarget::GetDispatchEventResult(event); return EventTarget::GetDispatchEventResult(event);
} }
void Node::DispatchSimulatedClick(Event* underlying_event, void Node::DispatchSimulatedClick(const Event* underlying_event,
SimulatedClickMouseEventOptions event_options, SimulatedClickMouseEventOptions event_options,
SimulatedClickCreationScope scope) { SimulatedClickCreationScope scope) {
if (auto* element = IsElementNode() ? To<Element>(this) : parentElement()) { if (auto* element = IsElementNode() ? To<Element>(this) : parentElement()) {
......
...@@ -857,7 +857,7 @@ class CORE_EXPORT Node : public EventTarget { ...@@ -857,7 +857,7 @@ class CORE_EXPORT Node : public EventTarget {
DispatchEventResult DispatchDOMActivateEvent(int detail, DispatchEventResult DispatchDOMActivateEvent(int detail,
Event& underlying_event); Event& underlying_event);
void DispatchSimulatedClick(Event* underlying_event, void DispatchSimulatedClick(const Event* underlying_event,
SimulatedClickMouseEventOptions = kSendNoEvents, SimulatedClickMouseEventOptions = kSendNoEvents,
SimulatedClickCreationScope = SimulatedClickCreationScope =
SimulatedClickCreationScope::kFromUserAgent); SimulatedClickCreationScope::kFromUserAgent);
......
...@@ -181,7 +181,7 @@ HTMLElement* HTMLFormElement::item(unsigned index) { ...@@ -181,7 +181,7 @@ HTMLElement* HTMLFormElement::item(unsigned index) {
return elements()->item(index); return elements()->item(index);
} }
void HTMLFormElement::SubmitImplicitly(Event& event, void HTMLFormElement::SubmitImplicitly(const Event& event,
bool from_implicit_submission_trigger) { bool from_implicit_submission_trigger) {
int submission_trigger_count = 0; int submission_trigger_count = 0;
bool seen_default_button = false; bool seen_default_button = false;
...@@ -251,7 +251,7 @@ bool HTMLFormElement::ValidateInteractively() { ...@@ -251,7 +251,7 @@ bool HTMLFormElement::ValidateInteractively() {
} }
void HTMLFormElement::PrepareForSubmission( void HTMLFormElement::PrepareForSubmission(
Event* event, const Event* event,
HTMLFormControlElement* submit_button) { HTMLFormControlElement* submit_button) {
LocalFrame* frame = GetDocument().GetFrame(); LocalFrame* frame = GetDocument().GetFrame();
if (!frame || is_submitting_ || in_user_js_submit_event_) if (!frame || is_submitting_ || in_user_js_submit_event_)
...@@ -377,7 +377,7 @@ void HTMLFormElement::SubmitDialog(FormSubmission* form_submission) { ...@@ -377,7 +377,7 @@ void HTMLFormElement::SubmitDialog(FormSubmission* form_submission) {
} }
void HTMLFormElement::ScheduleFormSubmission( void HTMLFormElement::ScheduleFormSubmission(
Event* event, const Event* event,
HTMLFormControlElement* submit_button) { HTMLFormControlElement* submit_button) {
LocalFrameView* view = GetDocument().View(); LocalFrameView* view = GetDocument().View();
LocalFrame* frame = GetDocument().GetFrame(); LocalFrame* frame = GetDocument().GetFrame();
......
...@@ -71,13 +71,14 @@ class CORE_EXPORT HTMLFormElement final : public HTMLElement { ...@@ -71,13 +71,14 @@ class CORE_EXPORT HTMLFormElement final : public HTMLElement {
void Disassociate(HTMLImageElement&); void Disassociate(HTMLImageElement&);
void DidAssociateByParser(); void DidAssociateByParser();
void PrepareForSubmission(Event*, HTMLFormControlElement* submit_button); void PrepareForSubmission(const Event*,
HTMLFormControlElement* submit_button);
void submitFromJavaScript(); void submitFromJavaScript();
void requestSubmit(ExceptionState& exception_state); void requestSubmit(ExceptionState& exception_state);
void requestSubmit(HTMLElement* submitter, ExceptionState& exception_state); void requestSubmit(HTMLElement* submitter, ExceptionState& exception_state);
void reset(); void reset();
void SubmitImplicitly(Event&, bool from_implicit_submission_trigger); void SubmitImplicitly(const Event&, bool from_implicit_submission_trigger);
String GetName() const; String GetName() const;
...@@ -133,7 +134,8 @@ class CORE_EXPORT HTMLFormElement final : public HTMLElement { ...@@ -133,7 +134,8 @@ class CORE_EXPORT HTMLFormElement final : public HTMLElement {
} }
void SubmitDialog(FormSubmission*); void SubmitDialog(FormSubmission*);
void ScheduleFormSubmission(Event*, HTMLFormControlElement* submit_button); void ScheduleFormSubmission(const Event*,
HTMLFormControlElement* submit_button);
void CollectListedElements(Node& root, ListedElement::List&) const; void CollectListedElements(Node& root, ListedElement::List&) const;
void CollectImageElements(Node& root, HeapVector<Member<HTMLImageElement>>&); void CollectImageElements(Node& root, HeapVector<Member<HTMLImageElement>>&);
......
...@@ -64,7 +64,7 @@ class MenuListSelectType final : public SelectType { ...@@ -64,7 +64,7 @@ class MenuListSelectType final : public SelectType {
public: public:
explicit MenuListSelectType(HTMLSelectElement& select) : SelectType(select) {} explicit MenuListSelectType(HTMLSelectElement& select) : SelectType(select) {}
bool DefaultEventHandler(Event& event) override; bool DefaultEventHandler(const Event& event) override;
void DidSelectOption(HTMLOptionElement* element, void DidSelectOption(HTMLOptionElement* element,
HTMLSelectElement::SelectOptionFlags flags, HTMLSelectElement::SelectOptionFlags flags,
bool should_update_popup) override; bool should_update_popup) override;
...@@ -83,7 +83,7 @@ class MenuListSelectType final : public SelectType { ...@@ -83,7 +83,7 @@ class MenuListSelectType final : public SelectType {
bool has_updated_menulist_active_option_ = false; bool has_updated_menulist_active_option_ = false;
}; };
bool MenuListSelectType::DefaultEventHandler(Event& event) { bool MenuListSelectType::DefaultEventHandler(const Event& event) {
// We need to make the layout tree up-to-date to have GetLayoutObject() give // We need to make the layout tree up-to-date to have GetLayoutObject() give
// the correct result below. An author event handler may have set display to // the correct result below. An author event handler may have set display to
// some element to none which will cause a layout tree detach. // some element to none which will cause a layout tree detach.
...@@ -167,7 +167,7 @@ bool MenuListSelectType::DefaultEventHandler(Event& event) { ...@@ -167,7 +167,7 @@ bool MenuListSelectType::DefaultEventHandler(Event& event) {
return true; return true;
} }
auto& key_event = ToKeyboardEvent(event); const auto& key_event = ToKeyboardEvent(event);
if (select_->ShouldOpenPopupForKeyPressEvent(key_event)) if (select_->ShouldOpenPopupForKeyPressEvent(key_event))
return select_->HandlePopupOpenKeyboardEvent(event); return select_->HandlePopupOpenKeyboardEvent(event);
...@@ -180,7 +180,7 @@ bool MenuListSelectType::DefaultEventHandler(Event& event) { ...@@ -180,7 +180,7 @@ bool MenuListSelectType::DefaultEventHandler(Event& event) {
return false; return false;
} }
auto* mouse_event = DynamicTo<MouseEvent>(event); const auto* mouse_event = DynamicTo<MouseEvent>(event);
if (event.type() == event_type_names::kMousedown && mouse_event && if (event.type() == event_type_names::kMousedown && mouse_event &&
mouse_event->button() == mouse_event->button() ==
static_cast<int16_t>(WebPointerProperties::Button::kLeft)) { static_cast<int16_t>(WebPointerProperties::Button::kLeft)) {
...@@ -340,11 +340,11 @@ void MenuListSelectType::DidUpdateActiveOption(HTMLOptionElement* option) { ...@@ -340,11 +340,11 @@ void MenuListSelectType::DidUpdateActiveOption(HTMLOptionElement* option) {
class ListBoxSelectType final : public SelectType { class ListBoxSelectType final : public SelectType {
public: public:
explicit ListBoxSelectType(HTMLSelectElement& select) : SelectType(select) {} explicit ListBoxSelectType(HTMLSelectElement& select) : SelectType(select) {}
bool DefaultEventHandler(Event& event) override; bool DefaultEventHandler(const Event& event) override;
}; };
bool ListBoxSelectType::DefaultEventHandler(Event& event) { bool ListBoxSelectType::DefaultEventHandler(const Event& event) {
auto* mouse_event = DynamicTo<MouseEvent>(event); const auto* mouse_event = DynamicTo<MouseEvent>(event);
if (event.type() == event_type_names::kGesturetap && event.IsGestureEvent()) { if (event.type() == event_type_names::kGesturetap && event.IsGestureEvent()) {
select_->focus(); select_->focus();
// Calling focus() may cause us to lose our layoutObject or change the // Calling focus() may cause us to lose our layoutObject or change the
...@@ -353,7 +353,7 @@ bool ListBoxSelectType::DefaultEventHandler(Event& event) { ...@@ -353,7 +353,7 @@ bool ListBoxSelectType::DefaultEventHandler(Event& event) {
return false; return false;
// Convert to coords relative to the list box if needed. // Convert to coords relative to the list box if needed.
auto& gesture_event = ToGestureEvent(event); const auto& gesture_event = ToGestureEvent(event);
if (HTMLOptionElement* option = EventTargetOption(gesture_event)) { if (HTMLOptionElement* option = EventTargetOption(gesture_event)) {
if (!select_->IsDisabledFormControl()) { if (!select_->IsDisabledFormControl()) {
select_->UpdateSelectedState(option, true, gesture_event.shiftKey()); select_->UpdateSelectedState(option, true, gesture_event.shiftKey());
...@@ -445,7 +445,7 @@ bool ListBoxSelectType::DefaultEventHandler(Event& event) { ...@@ -445,7 +445,7 @@ bool ListBoxSelectType::DefaultEventHandler(Event& event) {
} }
if (event.type() == event_type_names::kKeydown) { if (event.type() == event_type_names::kKeydown) {
auto* keyboard_event = ToKeyboardEventOrNull(event); const auto* keyboard_event = ToKeyboardEventOrNull(event);
if (!keyboard_event) if (!keyboard_event)
return false; return false;
const String& key = keyboard_event->key(); const String& key = keyboard_event->key();
......
...@@ -21,7 +21,7 @@ class SelectType : public GarbageCollected<SelectType> { ...@@ -21,7 +21,7 @@ class SelectType : public GarbageCollected<SelectType> {
virtual void Trace(Visitor* visitor); virtual void Trace(Visitor* visitor);
// Returns true if the event is handled. // Returns true if the event is handled.
virtual bool DefaultEventHandler(Event& event) = 0; virtual bool DefaultEventHandler(const Event& event) = 0;
virtual void DidSelectOption(HTMLOptionElement* element, virtual void DidSelectOption(HTMLOptionElement* element,
HTMLSelectElement::SelectOptionFlags flags, HTMLSelectElement::SelectOptionFlags flags,
......
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