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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLFormElement.cpp

Issue 1479923002: Enumerate the return value of dispatchEvent so it is clear. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_passive_uma_add
Patch Set: Rebase Created 5 years 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 320
321 // Interactive validation must be done before dispatching the submit event. 321 // Interactive validation must be done before dispatching the submit event.
322 if (!skipValidation && !validateInteractively()) 322 if (!skipValidation && !validateInteractively())
323 return; 323 return;
324 324
325 m_isSubmittingOrInUserJSSubmitEvent = true; 325 m_isSubmittingOrInUserJSSubmitEvent = true;
326 m_shouldSubmit = false; 326 m_shouldSubmit = false;
327 327
328 frame->loader().client()->dispatchWillSendSubmitEvent(this); 328 frame->loader().client()->dispatchWillSendSubmitEvent(this);
329 329
330 if (dispatchEvent(Event::createCancelableBubble(EventTypeNames::submit))) 330 if (dispatchEvent(Event::createCancelableBubble(EventTypeNames::submit)) == WebInputEventResult::NotHandled)
331 m_shouldSubmit = true; 331 m_shouldSubmit = true;
332 332
333 m_isSubmittingOrInUserJSSubmitEvent = false; 333 m_isSubmittingOrInUserJSSubmitEvent = false;
334 334
335 if (m_shouldSubmit) 335 if (m_shouldSubmit)
336 submit(event, true, true); 336 submit(event, true, true);
337 } 337 }
338 338
339 void HTMLFormElement::submitFromJavaScript() 339 void HTMLFormElement::submitFromJavaScript()
340 { 340 {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 } 441 }
442 442
443 void HTMLFormElement::reset() 443 void HTMLFormElement::reset()
444 { 444 {
445 LocalFrame* frame = document().frame(); 445 LocalFrame* frame = document().frame();
446 if (m_isInResetFunction || !frame) 446 if (m_isInResetFunction || !frame)
447 return; 447 return;
448 448
449 m_isInResetFunction = true; 449 m_isInResetFunction = true;
450 450
451 if (!dispatchEvent(Event::createCancelableBubble(EventTypeNames::reset))) { 451 if (dispatchEvent(Event::createCancelableBubble(EventTypeNames::reset)) != W ebInputEventResult::NotHandled) {
452 m_isInResetFunction = false; 452 m_isInResetFunction = false;
453 return; 453 return;
454 } 454 }
455 455
456 const FormAssociatedElement::List& elements = associatedElements(); 456 const FormAssociatedElement::List& elements = associatedElements();
457 for (unsigned i = 0; i < elements.size(); ++i) { 457 for (unsigned i = 0; i < elements.size(); ++i) {
458 if (elements[i]->isFormControlElement()) 458 if (elements[i]->isFormControlElement())
459 toHTMLFormControlElement(elements[i])->reset(); 459 toHTMLFormControlElement(elements[i])->reset();
460 } 460 }
461 461
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 } 823 }
824 824
825 void HTMLFormElement::setDemoted(bool demoted) 825 void HTMLFormElement::setDemoted(bool demoted)
826 { 826 {
827 if (demoted) 827 if (demoted)
828 UseCounter::count(document(), UseCounter::DemotedFormElement); 828 UseCounter::count(document(), UseCounter::DemotedFormElement);
829 m_wasDemoted = demoted; 829 m_wasDemoted = demoted;
830 } 830 }
831 831
832 } // namespace 832 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698