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

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

Issue 93723003: Rename HTMLElement::form() to formOwner(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 // that says "add this form element to the end of the array". 569 // that says "add this form element to the end of the array".
570 if (ElementTraversal::next(associatedHTMLElement, this)) { 570 if (ElementTraversal::next(associatedHTMLElement, this)) {
571 unsigned i = m_associatedElementsBeforeIndex; 571 unsigned i = m_associatedElementsBeforeIndex;
572 for (Element* element = this; element; element = ElementTraversal::next( *element, this)) { 572 for (Element* element = this; element; element = ElementTraversal::next( *element, this)) {
573 if (element == associatedHTMLElement) { 573 if (element == associatedHTMLElement) {
574 ++m_associatedElementsAfterIndex; 574 ++m_associatedElementsAfterIndex;
575 return i; 575 return i;
576 } 576 }
577 if (!element->isFormControlElement() && !element->hasTagName(objectT ag)) 577 if (!element->isFormControlElement() && !element->hasTagName(objectT ag))
578 continue; 578 continue;
579 if (!element->isHTMLElement() || toHTMLElement(element)->form() != t his) 579 if (!element->isHTMLElement() || toHTMLElement(element)->formOwner() != this)
580 continue; 580 continue;
581 ++i; 581 ++i;
582 } 582 }
583 } 583 }
584 return m_associatedElementsAfterIndex++; 584 return m_associatedElementsAfterIndex++;
585 } 585 }
586 586
587 void HTMLFormElement::registerFormElement(FormAssociatedElement& e) 587 void HTMLFormElement::registerFormElement(FormAssociatedElement& e)
588 { 588 {
589 m_associatedElements.insert(formElementIndex(e), &e); 589 m_associatedElements.insert(formElementIndex(e), &e);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 // Copy m_associatedElements because event handlers called from 706 // Copy m_associatedElements because event handlers called from
707 // HTMLFormControlElement::checkValidity() might change m_associatedElements . 707 // HTMLFormControlElement::checkValidity() might change m_associatedElements .
708 Vector<RefPtr<FormAssociatedElement> > elements; 708 Vector<RefPtr<FormAssociatedElement> > elements;
709 elements.reserveCapacity(m_associatedElements.size()); 709 elements.reserveCapacity(m_associatedElements.size());
710 for (unsigned i = 0; i < m_associatedElements.size(); ++i) 710 for (unsigned i = 0; i < m_associatedElements.size(); ++i)
711 elements.append(m_associatedElements[i]); 711 elements.append(m_associatedElements[i]);
712 bool hasInvalidControls = false; 712 bool hasInvalidControls = false;
713 for (unsigned i = 0; i < elements.size(); ++i) { 713 for (unsigned i = 0; i < elements.size(); ++i) {
714 if (elements[i]->form() == this && elements[i]->isFormControlElement()) { 714 if (elements[i]->form() == this && elements[i]->isFormControlElement()) {
715 HTMLFormControlElement* control = toHTMLFormControlElement(elements[ i].get()); 715 HTMLFormControlElement* control = toHTMLFormControlElement(elements[ i].get());
716 if (!control->checkValidity(unhandledInvalidControls, dispatchEvents ) && control->form() == this) 716 if (!control->checkValidity(unhandledInvalidControls, dispatchEvents ) && control->formOwner() == this)
717 hasInvalidControls = true; 717 hasInvalidControls = true;
718 } 718 }
719 } 719 }
720 return hasInvalidControls; 720 return hasInvalidControls;
721 } 721 }
722 722
723 Node* HTMLFormElement::elementFromPastNamesMap(const AtomicString& pastName) con st 723 Node* HTMLFormElement::elementFromPastNamesMap(const AtomicString& pastName) con st
724 { 724 {
725 if (pastName.isEmpty() || !m_pastNamesMap) 725 if (pastName.isEmpty() || !m_pastNamesMap)
726 return 0; 726 return 0;
727 Node* node = m_pastNamesMap->get(pastName); 727 Node* node = m_pastNamesMap->get(pastName);
728 #if !ASSERT_DISABLED 728 #if !ASSERT_DISABLED
729 if (!node) 729 if (!node)
730 return 0; 730 return 0;
731 ASSERT_WITH_SECURITY_IMPLICATION(toHTMLElement(node)->form() == this); 731 ASSERT_WITH_SECURITY_IMPLICATION(toHTMLElement(node)->formOwner() == this);
732 if (node->hasTagName(imgTag)) { 732 if (node->hasTagName(imgTag)) {
733 ASSERT_WITH_SECURITY_IMPLICATION(m_imageElements.find(node) != kNotFound ); 733 ASSERT_WITH_SECURITY_IMPLICATION(m_imageElements.find(node) != kNotFound );
734 } else if (node->hasTagName(objectTag)) { 734 } else if (node->hasTagName(objectTag)) {
735 ASSERT_WITH_SECURITY_IMPLICATION(m_associatedElements.find(toHTMLObjectE lement(node)) != kNotFound); 735 ASSERT_WITH_SECURITY_IMPLICATION(m_associatedElements.find(toHTMLObjectE lement(node)) != kNotFound);
736 } else { 736 } else {
737 ASSERT_WITH_SECURITY_IMPLICATION(m_associatedElements.find(toHTMLFormCon trolElement(node)) != kNotFound); 737 ASSERT_WITH_SECURITY_IMPLICATION(m_associatedElements.find(toHTMLFormCon trolElement(node)) != kNotFound);
738 } 738 }
739 #endif 739 #endif
740 return node; 740 return node;
741 } 741 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 } 820 }
821 821
822 void HTMLFormElement::setDemoted(bool demoted) 822 void HTMLFormElement::setDemoted(bool demoted)
823 { 823 {
824 if (demoted) 824 if (demoted)
825 UseCounter::count(document(), UseCounter::DemotedFormElement); 825 UseCounter::count(document(), UseCounter::DemotedFormElement);
826 m_wasDemoted = demoted; 826 m_wasDemoted = demoted;
827 } 827 }
828 828
829 } // namespace 829 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698