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

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

Issue 2648213006: FIELDSET element: Correct nested FIELDSET behavior for descendant |disabled| state. (Closed)
Patch Set: Created 3 years, 11 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 void HTMLFormControlElement::setFormMethod(const AtomicString& value) { 103 void HTMLFormControlElement::setFormMethod(const AtomicString& value) {
104 setAttribute(formmethodAttr, value); 104 setAttribute(formmethodAttr, value);
105 } 105 }
106 106
107 bool HTMLFormControlElement::formNoValidate() const { 107 bool HTMLFormControlElement::formNoValidate() const {
108 return fastHasAttribute(formnovalidateAttr); 108 return fastHasAttribute(formnovalidateAttr);
109 } 109 }
110 110
111 void HTMLFormControlElement::updateAncestorDisabledState() const { 111 void HTMLFormControlElement::updateAncestorDisabledState() const {
112 HTMLFieldSetElement* fieldSetAncestor = 0; 112 HTMLFieldSetElement* highestDisabledFieldSetAncestor = nullptr;
113 ContainerNode* legendAncestor = 0; 113 ContainerNode* highestLegendAncestor = nullptr;
114 for (HTMLElement* ancestor = Traversal<HTMLElement>::firstAncestor(*this); 114 for (HTMLElement* ancestor = Traversal<HTMLElement>::firstAncestor(*this);
115 ancestor; ancestor = Traversal<HTMLElement>::firstAncestor(*ancestor)) { 115 ancestor; ancestor = Traversal<HTMLElement>::firstAncestor(*ancestor)) {
116 if (!legendAncestor && isHTMLLegendElement(*ancestor)) 116 if (isHTMLLegendElement(*ancestor))
117 legendAncestor = ancestor; 117 highestLegendAncestor = ancestor;
118 if (isHTMLFieldSetElement(*ancestor)) { 118 if (isHTMLFieldSetElement(*ancestor) && ancestor->isDisabledFormControl())
119 fieldSetAncestor = toHTMLFieldSetElement(ancestor); 119 highestDisabledFieldSetAncestor = toHTMLFieldSetElement(ancestor);
120 break;
121 }
122 } 120 }
123 m_ancestorDisabledState = 121 m_ancestorDisabledState =
124 (fieldSetAncestor && fieldSetAncestor->isDisabledFormControl() && 122 (highestDisabledFieldSetAncestor &&
125 !(legendAncestor && legendAncestor == fieldSetAncestor->legend())) 123 !(highestLegendAncestor &&
124 highestLegendAncestor == highestDisabledFieldSetAncestor->legend()))
126 ? AncestorDisabledStateDisabled 125 ? AncestorDisabledStateDisabled
127 : AncestorDisabledStateEnabled; 126 : AncestorDisabledStateEnabled;
128 } 127 }
129 128
130 void HTMLFormControlElement::ancestorDisabledStateWasChanged() { 129 void HTMLFormControlElement::ancestorDisabledStateWasChanged() {
131 m_ancestorDisabledState = AncestorDisabledStateUnknown; 130 m_ancestorDisabledState = AncestorDisabledStateUnknown;
132 disabledAttributeChanged(); 131 disabledAttributeChanged();
133 } 132 }
134 133
135 void HTMLFormControlElement::reset() { 134 void HTMLFormControlElement::reset() {
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 const Element& source) { 634 const Element& source) {
636 HTMLElement::copyNonAttributePropertiesFromElement(source); 635 HTMLElement::copyNonAttributePropertiesFromElement(source);
637 setNeedsValidityCheck(); 636 setNeedsValidityCheck();
638 } 637 }
639 638
640 void HTMLFormControlElement::associateWith(HTMLFormElement* form) { 639 void HTMLFormControlElement::associateWith(HTMLFormElement* form) {
641 associateByParser(form); 640 associateByParser(form);
642 }; 641 };
643 642
644 } // namespace blink 643 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-fieldset-element/disabled-001-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698