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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLFormControlElement.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 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 534
535 bool HTMLFormControlElement::checkValidity(WillBeHeapVector<RefPtrWillBeMember<H TMLFormControlElement>>* unhandledInvalidControls, CheckValidityEventBehavior ev entBehavior) 535 bool HTMLFormControlElement::checkValidity(WillBeHeapVector<RefPtrWillBeMember<H TMLFormControlElement>>* unhandledInvalidControls, CheckValidityEventBehavior ev entBehavior)
536 { 536 {
537 if (isValidElement()) 537 if (isValidElement())
538 return true; 538 return true;
539 if (eventBehavior != CheckValidityDispatchInvalidEvent) 539 if (eventBehavior != CheckValidityDispatchInvalidEvent)
540 return false; 540 return false;
541 // An event handler can deref this object. 541 // An event handler can deref this object.
542 RefPtrWillBeRawPtr<HTMLFormControlElement> protector(this); 542 RefPtrWillBeRawPtr<HTMLFormControlElement> protector(this);
543 RefPtrWillBeRawPtr<Document> originalDocument(document()); 543 RefPtrWillBeRawPtr<Document> originalDocument(document());
544 bool needsDefaultAction = dispatchEvent(Event::createCancelable(EventTypeNam es::invalid)); 544 WebInputEventResult eventResult = dispatchEvent(Event::createCancelable(Even tTypeNames::invalid));
545 if (needsDefaultAction && unhandledInvalidControls && inDocument() && origin alDocument == document()) 545 if (eventResult == WebInputEventResult::NotHandled && unhandledInvalidContro ls && inDocument() && originalDocument == document())
546 unhandledInvalidControls->append(this); 546 unhandledInvalidControls->append(this);
547 return false; 547 return false;
548 } 548 }
549 549
550 void HTMLFormControlElement::showValidationMessage() 550 void HTMLFormControlElement::showValidationMessage()
551 { 551 {
552 scrollIntoViewIfNeeded(false); 552 scrollIntoViewIfNeeded(false);
553 RefPtrWillBeRawPtr<HTMLFormControlElement> protector(this); 553 RefPtrWillBeRawPtr<HTMLFormControlElement> protector(this);
554 focus(); 554 focus();
555 updateVisibleValidationMessage(); 555 updateVisibleValidationMessage();
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 dispatchFormControlChangeEvent(); 664 dispatchFormControlChangeEvent();
665 } 665 }
666 666
667 void HTMLFormControlElement::copyNonAttributePropertiesFromElement(const Element & source) 667 void HTMLFormControlElement::copyNonAttributePropertiesFromElement(const Element & source)
668 { 668 {
669 HTMLElement::copyNonAttributePropertiesFromElement(source); 669 HTMLElement::copyNonAttributePropertiesFromElement(source);
670 setNeedsValidityCheck(); 670 setNeedsValidityCheck();
671 } 671 }
672 672
673 } // namespace blink 673 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698