| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |