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

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

Issue 2105243002: Remove unnecessary code from HTMLOptGroupElement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLOptGroupElement.h ('k') | no next file » | 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, 2010 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 HTMLOptGroupElement* optGroupElement = new HTMLOptGroupElement(document); 50 HTMLOptGroupElement* optGroupElement = new HTMLOptGroupElement(document);
51 optGroupElement->ensureUserAgentShadowRoot(); 51 optGroupElement->ensureUserAgentShadowRoot();
52 return optGroupElement; 52 return optGroupElement;
53 } 53 }
54 54
55 bool HTMLOptGroupElement::isDisabledFormControl() const 55 bool HTMLOptGroupElement::isDisabledFormControl() const
56 { 56 {
57 return fastHasAttribute(disabledAttr); 57 return fastHasAttribute(disabledAttr);
58 } 58 }
59 59
60 void HTMLOptGroupElement::childrenChanged(const ChildrenChange& change)
61 {
62 recalcSelectOptions();
63 HTMLElement::childrenChanged(change);
64 }
65
66 void HTMLOptGroupElement::parseAttribute(const QualifiedName& name, const Atomic String& oldValue, const AtomicString& value) 60 void HTMLOptGroupElement::parseAttribute(const QualifiedName& name, const Atomic String& oldValue, const AtomicString& value)
67 { 61 {
68 HTMLElement::parseAttribute(name, oldValue, value); 62 HTMLElement::parseAttribute(name, oldValue, value);
69 recalcSelectOptions();
70 63
71 if (name == disabledAttr) { 64 if (name == disabledAttr) {
72 pseudoStateChanged(CSSSelector::PseudoDisabled); 65 pseudoStateChanged(CSSSelector::PseudoDisabled);
73 pseudoStateChanged(CSSSelector::PseudoEnabled); 66 pseudoStateChanged(CSSSelector::PseudoEnabled);
74 } else if (name == labelAttr) { 67 } else if (name == labelAttr) {
75 updateGroupLabel(); 68 updateGroupLabel();
76 } 69 }
77 } 70 }
78 71
79 void HTMLOptGroupElement::recalcSelectOptions()
80 {
81 // TODO(tkent): Should use ownerSelectElement().
82 if (HTMLSelectElement* select = Traversal<HTMLSelectElement>::firstAncestor( *this))
83 select->setRecalcListItems();
84 }
85
86 void HTMLOptGroupElement::attach(const AttachContext& context) 72 void HTMLOptGroupElement::attach(const AttachContext& context)
87 { 73 {
88 if (context.resolvedStyle) { 74 if (context.resolvedStyle) {
89 ASSERT(!m_style || m_style == context.resolvedStyle); 75 ASSERT(!m_style || m_style == context.resolvedStyle);
90 m_style = context.resolvedStyle; 76 m_style = context.resolvedStyle;
91 } 77 }
92 HTMLElement::attach(context); 78 HTMLElement::attach(context);
93 } 79 }
94 80
95 void HTMLOptGroupElement::detach(const AttachContext& context) 81 void HTMLOptGroupElement::detach(const AttachContext& context)
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 label.setTextContent(labelText); 174 label.setTextContent(labelText);
189 label.setAttribute(aria_labelAttr, AtomicString(labelText)); 175 label.setAttribute(aria_labelAttr, AtomicString(labelText));
190 } 176 }
191 177
192 HTMLDivElement& HTMLOptGroupElement::optGroupLabelElement() const 178 HTMLDivElement& HTMLOptGroupElement::optGroupLabelElement() const
193 { 179 {
194 return *toHTMLDivElement(userAgentShadowRoot()->getElementById(ShadowElement Names::optGroupLabel())); 180 return *toHTMLDivElement(userAgentShadowRoot()->getElementById(ShadowElement Names::optGroupLabel()));
195 } 181 }
196 182
197 } // namespace blink 183 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLOptGroupElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698