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

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

Issue 2201293002: FIELDSET element should not check inner controls in checkValidity(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/checkValidity-001-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 } 455 }
456 456
457 void HTMLFormControlElement::setNeedsWillValidateCheck() 457 void HTMLFormControlElement::setNeedsWillValidateCheck()
458 { 458 {
459 // We need to recalculate willValidate immediately because willValidate chan ge can causes style change. 459 // We need to recalculate willValidate immediately because willValidate chan ge can causes style change.
460 bool newWillValidate = recalcWillValidate(); 460 bool newWillValidate = recalcWillValidate();
461 if (m_willValidateInitialized && m_willValidate == newWillValidate) 461 if (m_willValidateInitialized && m_willValidate == newWillValidate)
462 return; 462 return;
463 m_willValidateInitialized = true; 463 m_willValidateInitialized = true;
464 m_willValidate = newWillValidate; 464 m_willValidate = newWillValidate;
465 // Needs to force setNeedsValidityCheck() to invalidate validity state of
466 // FORM/FIELDSET. If this element updates willValidate twice and
467 // isValidElement() is not called between them, the second call of this
468 // function still has m_validityIsDirty==true, which means
469 // setNeedsValidityCheck() doesn't invalidate validity state of
470 // FORM/FIELDSET.
471 m_validityIsDirty = false;
465 setNeedsValidityCheck(); 472 setNeedsValidityCheck();
466 // No need to trigger style recalculation here because 473 // No need to trigger style recalculation here because
467 // setNeedsValidityCheck() does it in the right away. This relies on 474 // setNeedsValidityCheck() does it in the right away. This relies on
468 // the assumption that valid() is always true if willValidate() is false. 475 // the assumption that valid() is always true if willValidate() is false.
469 476
470 if (!m_willValidate) 477 if (!m_willValidate)
471 hideVisibleValidationMessage(); 478 hideVisibleValidationMessage();
472 } 479 }
473 480
474 void HTMLFormControlElement::findCustomValidationMessageTextDirection(const Stri ng& message, TextDirection &messageDir, String& subMessage, TextDirection &subMe ssageDir) 481 void HTMLFormControlElement::findCustomValidationMessageTextDirection(const Stri ng& message, TextDirection &messageDir, String& subMessage, TextDirection &subMe ssageDir)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 { 531 {
525 Page* page = document().page(); 532 Page* page = document().page();
526 if (!page) 533 if (!page)
527 return nullptr; 534 return nullptr;
528 535
529 return &page->validationMessageClient(); 536 return &page->validationMessageClient();
530 } 537 }
531 538
532 bool HTMLFormControlElement::checkValidity(HeapVector<Member<HTMLFormControlElem ent>>* unhandledInvalidControls, CheckValidityEventBehavior eventBehavior) 539 bool HTMLFormControlElement::checkValidity(HeapVector<Member<HTMLFormControlElem ent>>* unhandledInvalidControls, CheckValidityEventBehavior eventBehavior)
533 { 540 {
541 if (!willValidate())
542 return true;
534 if (isValidElement()) 543 if (isValidElement())
535 return true; 544 return true;
536 if (eventBehavior != CheckValidityDispatchInvalidEvent) 545 if (eventBehavior != CheckValidityDispatchInvalidEvent)
537 return false; 546 return false;
538 Document* originalDocument = &document(); 547 Document* originalDocument = &document();
539 DispatchEventResult dispatchResult = dispatchEvent(Event::createCancelable(E ventTypeNames::invalid)); 548 DispatchEventResult dispatchResult = dispatchEvent(Event::createCancelable(E ventTypeNames::invalid));
540 if (dispatchResult == DispatchEventResult::NotCanceled && unhandledInvalidCo ntrols && isConnected() && originalDocument == document()) 549 if (dispatchResult == DispatchEventResult::NotCanceled && unhandledInvalidCo ntrols && isConnected() && originalDocument == document())
541 unhandledInvalidControls->append(this); 550 unhandledInvalidControls->append(this);
542 return false; 551 return false;
543 } 552 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 dispatchFormControlChangeEvent(); 662 dispatchFormControlChangeEvent();
654 } 663 }
655 664
656 void HTMLFormControlElement::copyNonAttributePropertiesFromElement(const Element & source) 665 void HTMLFormControlElement::copyNonAttributePropertiesFromElement(const Element & source)
657 { 666 {
658 HTMLElement::copyNonAttributePropertiesFromElement(source); 667 HTMLElement::copyNonAttributePropertiesFromElement(source);
659 setNeedsValidityCheck(); 668 setNeedsValidityCheck();
660 } 669 }
661 670
662 } // namespace blink 671 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/checkValidity-001-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698