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

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

Issue 271533009: Oilpan: Prepare to move FormAssociatedElement to Oilpan heap, part 1. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove using Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLFormElement.h ('k') | Source/core/html/HTMLObjectElement.h » ('j') | 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, 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 HTMLFormControlElement* submitElement = submitElementFromEvent(event); 244 HTMLFormControlElement* submitElement = submitElementFromEvent(event);
245 if (submitElement && submitElement->formNoValidate()) 245 if (submitElement && submitElement->formNoValidate())
246 return true; 246 return true;
247 247
248 const Vector<FormAssociatedElement*>& elements = associatedElements(); 248 const Vector<FormAssociatedElement*>& elements = associatedElements();
249 for (unsigned i = 0; i < elements.size(); ++i) { 249 for (unsigned i = 0; i < elements.size(); ++i) {
250 if (elements[i]->isFormControlElement()) 250 if (elements[i]->isFormControlElement())
251 toHTMLFormControlElement(elements[i])->hideVisibleValidationMessage( ); 251 toHTMLFormControlElement(elements[i])->hideVisibleValidationMessage( );
252 } 252 }
253 253
254 Vector<RefPtr<FormAssociatedElement> > unhandledInvalidControls; 254 WillBeHeapVector<RefPtrWillBeMember<FormAssociatedElement> > unhandledInvali dControls;
255 if (!checkInvalidControlsAndCollectUnhandled(&unhandledInvalidControls)) 255 if (!checkInvalidControlsAndCollectUnhandled(&unhandledInvalidControls))
256 return true; 256 return true;
257 // Because the form has invalid controls, we abort the form submission and 257 // Because the form has invalid controls, we abort the form submission and
258 // show a validation message on a focusable form control. 258 // show a validation message on a focusable form control.
259 259
260 // Needs to update layout now because we'd like to call isFocusable(), which 260 // Needs to update layout now because we'd like to call isFocusable(), which
261 // has !renderer()->needsLayout() assertion. 261 // has !renderer()->needsLayout() assertion.
262 document().updateLayoutIgnorePendingStylesheets(); 262 document().updateLayoutIgnorePendingStylesheets();
263 263
264 RefPtr<HTMLFormElement> protector(this); 264 RefPtr<HTMLFormElement> protector(this);
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 } 638 }
639 639
640 return 0; 640 return 0;
641 } 641 }
642 642
643 bool HTMLFormElement::checkValidity() 643 bool HTMLFormElement::checkValidity()
644 { 644 {
645 return !checkInvalidControlsAndCollectUnhandled(0); 645 return !checkInvalidControlsAndCollectUnhandled(0);
646 } 646 }
647 647
648 bool HTMLFormElement::checkInvalidControlsAndCollectUnhandled(Vector<RefPtr<Form AssociatedElement> >* unhandledInvalidControls) 648 bool HTMLFormElement::checkInvalidControlsAndCollectUnhandled(WillBeHeapVector<R efPtrWillBeMember<FormAssociatedElement> >* unhandledInvalidControls)
649 { 649 {
650 RefPtr<HTMLFormElement> protector(this); 650 RefPtr<HTMLFormElement> protector(this);
651 // Copy associatedElements because event handlers called from 651 // Copy associatedElements because event handlers called from
652 // HTMLFormControlElement::checkValidity() might change associatedElements. 652 // HTMLFormControlElement::checkValidity() might change associatedElements.
653 const Vector<FormAssociatedElement*>& associatedElements = this->associatedE lements(); 653 const Vector<FormAssociatedElement*>& associatedElements = this->associatedE lements();
654 Vector<RefPtr<FormAssociatedElement> > elements; 654 WillBeHeapVector<RefPtrWillBeMember<FormAssociatedElement> > elements;
655 elements.reserveCapacity(associatedElements.size()); 655 elements.reserveCapacity(associatedElements.size());
656 for (unsigned i = 0; i < associatedElements.size(); ++i) 656 for (unsigned i = 0; i < associatedElements.size(); ++i)
657 elements.append(associatedElements[i]); 657 elements.append(associatedElements[i]);
658 bool hasInvalidControls = false; 658 bool hasInvalidControls = false;
659 for (unsigned i = 0; i < elements.size(); ++i) { 659 for (unsigned i = 0; i < elements.size(); ++i) {
660 if (elements[i]->form() == this && elements[i]->isFormControlElement()) { 660 if (elements[i]->form() == this && elements[i]->isFormControlElement()) {
661 HTMLFormControlElement* control = toHTMLFormControlElement(elements[ i].get()); 661 HTMLFormControlElement* control = toHTMLFormControlElement(elements[ i].get());
662 if (!control->checkValidity(unhandledInvalidControls) && control->fo rmOwner() == this) 662 if (!control->checkValidity(unhandledInvalidControls) && control->fo rmOwner() == this)
663 hasInvalidControls = true; 663 hasInvalidControls = true;
664 } 664 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 } 770 }
771 771
772 void HTMLFormElement::setDemoted(bool demoted) 772 void HTMLFormElement::setDemoted(bool demoted)
773 { 773 {
774 if (demoted) 774 if (demoted)
775 UseCounter::count(document(), UseCounter::DemotedFormElement); 775 UseCounter::count(document(), UseCounter::DemotedFormElement);
776 m_wasDemoted = demoted; 776 m_wasDemoted = demoted;
777 } 777 }
778 778
779 } // namespace 779 } // namespace
OLDNEW
« no previous file with comments | « Source/core/html/HTMLFormElement.h ('k') | Source/core/html/HTMLObjectElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698