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: Fix typo Created 4 years, 9 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) 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 319
320 // Interactive validation must be done before dispatching the submit event. 320 // Interactive validation must be done before dispatching the submit event.
321 if (!skipValidation && !validateInteractively()) 321 if (!skipValidation && !validateInteractively())
322 return; 322 return;
323 323
324 m_isSubmittingOrInUserJSSubmitEvent = true; 324 m_isSubmittingOrInUserJSSubmitEvent = true;
325 m_shouldSubmit = false; 325 m_shouldSubmit = false;
326 326
327 frame->loader().client()->dispatchWillSendSubmitEvent(this); 327 frame->loader().client()->dispatchWillSendSubmitEvent(this);
328 328
329 if (dispatchEvent(Event::createCancelableBubble(EventTypeNames::submit))) 329 if (dispatchEvent(Event::createCancelableBubble(EventTypeNames::submit)) == DispatchEventResult::NotCanceled)
330 m_shouldSubmit = true; 330 m_shouldSubmit = true;
331 331
332 m_isSubmittingOrInUserJSSubmitEvent = false; 332 m_isSubmittingOrInUserJSSubmitEvent = false;
333 333
334 if (m_shouldSubmit) 334 if (m_shouldSubmit)
335 submit(event, true, true); 335 submit(event, true, true);
336 } 336 }
337 337
338 void HTMLFormElement::submitFromJavaScript() 338 void HTMLFormElement::submitFromJavaScript()
339 { 339 {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 } 440 }
441 441
442 void HTMLFormElement::reset() 442 void HTMLFormElement::reset()
443 { 443 {
444 LocalFrame* frame = document().frame(); 444 LocalFrame* frame = document().frame();
445 if (m_isInResetFunction || !frame) 445 if (m_isInResetFunction || !frame)
446 return; 446 return;
447 447
448 m_isInResetFunction = true; 448 m_isInResetFunction = true;
449 449
450 if (!dispatchEvent(Event::createCancelableBubble(EventTypeNames::reset))) { 450 if (dispatchEvent(Event::createCancelableBubble(EventTypeNames::reset)) != D ispatchEventResult::NotCanceled) {
451 m_isInResetFunction = false; 451 m_isInResetFunction = false;
452 return; 452 return;
453 } 453 }
454 454
455 const FormAssociatedElement::List& elements = associatedElements(); 455 const FormAssociatedElement::List& elements = associatedElements();
456 for (unsigned i = 0; i < elements.size(); ++i) { 456 for (unsigned i = 0; i < elements.size(); ++i) {
457 if (elements[i]->isFormControlElement()) 457 if (elements[i]->isFormControlElement())
458 toHTMLFormControlElement(elements[i])->reset(); 458 toHTMLFormControlElement(elements[i])->reset();
459 } 459 }
460 460
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 } 831 }
832 832
833 void HTMLFormElement::setDemoted(bool demoted) 833 void HTMLFormElement::setDemoted(bool demoted)
834 { 834 {
835 if (demoted) 835 if (demoted)
836 UseCounter::count(document(), UseCounter::DemotedFormElement); 836 UseCounter::count(document(), UseCounter::DemotedFormElement);
837 m_wasDemoted = demoted; 837 m_wasDemoted = demoted;
838 } 838 }
839 839
840 } // namespace blink 840 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698