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

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

Issue 2149893003: Rename Node::inShadowIncludingDocument() to Node::isConnected() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Created 4 years, 5 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
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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 Node::InsertionNotificationRequest HTMLFormControlElement::insertedInto(Containe rNode* insertionPoint) 262 Node::InsertionNotificationRequest HTMLFormControlElement::insertedInto(Containe rNode* insertionPoint)
263 { 263 {
264 m_ancestorDisabledState = AncestorDisabledStateUnknown; 264 m_ancestorDisabledState = AncestorDisabledStateUnknown;
265 m_dataListAncestorState = Unknown; 265 m_dataListAncestorState = Unknown;
266 setNeedsWillValidateCheck(); 266 setNeedsWillValidateCheck();
267 HTMLElement::insertedInto(insertionPoint); 267 HTMLElement::insertedInto(insertionPoint);
268 FormAssociatedElement::insertedInto(insertionPoint); 268 FormAssociatedElement::insertedInto(insertionPoint);
269 fieldSetAncestorsSetNeedsValidityCheck(insertionPoint); 269 fieldSetAncestorsSetNeedsValidityCheck(insertionPoint);
270 270
271 // Trigger for elements outside of forms. 271 // Trigger for elements outside of forms.
272 if (!formOwner() && insertionPoint->inShadowIncludingDocument()) 272 if (!formOwner() && insertionPoint->isConnected())
273 document().didAssociateFormControl(this); 273 document().didAssociateFormControl(this);
274 274
275 return InsertionDone; 275 return InsertionDone;
276 } 276 }
277 277
278 void HTMLFormControlElement::removedFrom(ContainerNode* insertionPoint) 278 void HTMLFormControlElement::removedFrom(ContainerNode* insertionPoint)
279 { 279 {
280 fieldSetAncestorsSetNeedsValidityCheck(insertionPoint); 280 fieldSetAncestorsSetNeedsValidityCheck(insertionPoint);
281 hideVisibleValidationMessage(); 281 hideVisibleValidationMessage();
282 m_hasValidationMessage = false; 282 m_hasValidationMessage = false;
(...skipping 10 matching lines...) Expand all
293 FormAssociatedElement::willChangeForm(); 293 FormAssociatedElement::willChangeForm();
294 formOwnerSetNeedsValidityCheck(); 294 formOwnerSetNeedsValidityCheck();
295 if (formOwner() && canBeSuccessfulSubmitButton()) 295 if (formOwner() && canBeSuccessfulSubmitButton())
296 formOwner()->invalidateDefaultButtonStyle(); 296 formOwner()->invalidateDefaultButtonStyle();
297 } 297 }
298 298
299 void HTMLFormControlElement::didChangeForm() 299 void HTMLFormControlElement::didChangeForm()
300 { 300 {
301 FormAssociatedElement::didChangeForm(); 301 FormAssociatedElement::didChangeForm();
302 formOwnerSetNeedsValidityCheck(); 302 formOwnerSetNeedsValidityCheck();
303 if (formOwner() && inShadowIncludingDocument() && canBeSuccessfulSubmitButto n()) 303 if (formOwner() && isConnected() && canBeSuccessfulSubmitButton())
304 formOwner()->invalidateDefaultButtonStyle(); 304 formOwner()->invalidateDefaultButtonStyle();
305 } 305 }
306 306
307 void HTMLFormControlElement::formOwnerSetNeedsValidityCheck() 307 void HTMLFormControlElement::formOwnerSetNeedsValidityCheck()
308 { 308 {
309 if (HTMLFormElement* form = formOwner()) { 309 if (HTMLFormElement* form = formOwner()) {
310 form->pseudoStateChanged(CSSSelector::PseudoValid); 310 form->pseudoStateChanged(CSSSelector::PseudoValid);
311 form->pseudoStateChanged(CSSSelector::PseudoInvalid); 311 form->pseudoStateChanged(CSSSelector::PseudoInvalid);
312 } 312 }
313 } 313 }
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 } 531 }
532 532
533 bool HTMLFormControlElement::checkValidity(HeapVector<Member<HTMLFormControlElem ent>>* unhandledInvalidControls, CheckValidityEventBehavior eventBehavior) 533 bool HTMLFormControlElement::checkValidity(HeapVector<Member<HTMLFormControlElem ent>>* unhandledInvalidControls, CheckValidityEventBehavior eventBehavior)
534 { 534 {
535 if (isValidElement()) 535 if (isValidElement())
536 return true; 536 return true;
537 if (eventBehavior != CheckValidityDispatchInvalidEvent) 537 if (eventBehavior != CheckValidityDispatchInvalidEvent)
538 return false; 538 return false;
539 Document* originalDocument = &document(); 539 Document* originalDocument = &document();
540 DispatchEventResult dispatchResult = dispatchEvent(Event::createCancelable(E ventTypeNames::invalid)); 540 DispatchEventResult dispatchResult = dispatchEvent(Event::createCancelable(E ventTypeNames::invalid));
541 if (dispatchResult == DispatchEventResult::NotCanceled && unhandledInvalidCo ntrols && inShadowIncludingDocument() && originalDocument == document()) 541 if (dispatchResult == DispatchEventResult::NotCanceled && unhandledInvalidCo ntrols && isConnected() && originalDocument == document())
542 unhandledInvalidControls->append(this); 542 unhandledInvalidControls->append(this);
543 return false; 543 return false;
544 } 544 }
545 545
546 void HTMLFormControlElement::showValidationMessage() 546 void HTMLFormControlElement::showValidationMessage()
547 { 547 {
548 scrollIntoViewIfNeeded(false); 548 scrollIntoViewIfNeeded(false);
549 focus(); 549 focus();
550 updateVisibleValidationMessage(); 550 updateVisibleValidationMessage();
551 } 551 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 dispatchFormControlChangeEvent(); 654 dispatchFormControlChangeEvent();
655 } 655 }
656 656
657 void HTMLFormControlElement::copyNonAttributePropertiesFromElement(const Element & source) 657 void HTMLFormControlElement::copyNonAttributePropertiesFromElement(const Element & source)
658 { 658 {
659 HTMLElement::copyNonAttributePropertiesFromElement(source); 659 HTMLElement::copyNonAttributePropertiesFromElement(source);
660 setNeedsValidityCheck(); 660 setNeedsValidityCheck();
661 } 661 }
662 662
663 } // namespace blink 663 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698