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

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

Issue 1763553002: Invalidate :default pseudo classes when a default button is added or removed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: return -> continue Created 4 years, 9 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 setNeedsWillValidateCheck(); 294 setNeedsWillValidateCheck();
295 HTMLElement::removedFrom(insertionPoint); 295 HTMLElement::removedFrom(insertionPoint);
296 FormAssociatedElement::removedFrom(insertionPoint); 296 FormAssociatedElement::removedFrom(insertionPoint);
297 document().removeFormAssociation(this); 297 document().removeFormAssociation(this);
298 } 298 }
299 299
300 void HTMLFormControlElement::willChangeForm() 300 void HTMLFormControlElement::willChangeForm()
301 { 301 {
302 FormAssociatedElement::willChangeForm(); 302 FormAssociatedElement::willChangeForm();
303 formOwnerSetNeedsValidityCheck(); 303 formOwnerSetNeedsValidityCheck();
304 if (formOwner() && canBeSuccessfulSubmitButton())
305 formOwner()->invalidateDefaultButtonStyle();
304 } 306 }
305 307
306 void HTMLFormControlElement::didChangeForm() 308 void HTMLFormControlElement::didChangeForm()
307 { 309 {
308 FormAssociatedElement::didChangeForm(); 310 FormAssociatedElement::didChangeForm();
309 formOwnerSetNeedsValidityCheck(); 311 formOwnerSetNeedsValidityCheck();
312 if (formOwner() && inDocument() && canBeSuccessfulSubmitButton())
313 formOwner()->invalidateDefaultButtonStyle();
310 } 314 }
311 315
312 void HTMLFormControlElement::formOwnerSetNeedsValidityCheck() 316 void HTMLFormControlElement::formOwnerSetNeedsValidityCheck()
313 { 317 {
314 if (HTMLFormElement* form = formOwner()) { 318 if (HTMLFormElement* form = formOwner()) {
315 form->pseudoStateChanged(CSSSelector::PseudoValid); 319 form->pseudoStateChanged(CSSSelector::PseudoValid);
316 form->pseudoStateChanged(CSSSelector::PseudoInvalid); 320 form->pseudoStateChanged(CSSSelector::PseudoInvalid);
317 } 321 }
318 } 322 }
319 323
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 dispatchFormControlChangeEvent(); 668 dispatchFormControlChangeEvent();
665 } 669 }
666 670
667 void HTMLFormControlElement::copyNonAttributePropertiesFromElement(const Element & source) 671 void HTMLFormControlElement::copyNonAttributePropertiesFromElement(const Element & source)
668 { 672 {
669 HTMLElement::copyNonAttributePropertiesFromElement(source); 673 HTMLElement::copyNonAttributePropertiesFromElement(source);
670 setNeedsValidityCheck(); 674 setNeedsValidityCheck();
671 } 675 }
672 676
673 } // namespace blink 677 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLButtonElement.cpp ('k') | third_party/WebKit/Source/core/html/HTMLFormElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698