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

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

Issue 195813003: Use new is*Element() helper functions further more in HTML code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix bad assertion Created 6 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 | Annotate | Revision Log
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 HTMLElement::parseAttribute(name, value); 69 HTMLElement::parseAttribute(name, value);
70 recalcSelectOptions(); 70 recalcSelectOptions();
71 71
72 if (name == disabledAttr) 72 if (name == disabledAttr)
73 didAffectSelector(AffectedSelectorDisabled | AffectedSelectorEnabled); 73 didAffectSelector(AffectedSelectorDisabled | AffectedSelectorEnabled);
74 } 74 }
75 75
76 void HTMLOptGroupElement::recalcSelectOptions() 76 void HTMLOptGroupElement::recalcSelectOptions()
77 { 77 {
78 ContainerNode* select = parentNode(); 78 ContainerNode* select = parentNode();
79 while (select && !select->hasTagName(selectTag)) 79 while (select && !isHTMLSelectElement(*select))
80 select = select->parentNode(); 80 select = select->parentNode();
81 if (select) 81 if (select)
82 toHTMLSelectElement(select)->setRecalcListItems(); 82 toHTMLSelectElement(select)->setRecalcListItems();
83 } 83 }
84 84
85 void HTMLOptGroupElement::attach(const AttachContext& context) 85 void HTMLOptGroupElement::attach(const AttachContext& context)
86 { 86 {
87 if (context.resolvedStyle) { 87 if (context.resolvedStyle) {
88 ASSERT(!m_style || m_style == context.resolvedStyle); 88 ASSERT(!m_style || m_style == context.resolvedStyle);
89 m_style = context.resolvedStyle; 89 m_style = context.resolvedStyle;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 itemText = itemText.stripWhiteSpace(); 121 itemText = itemText.stripWhiteSpace();
122 // We want to collapse our whitespace too. This will match other browsers. 122 // We want to collapse our whitespace too. This will match other browsers.
123 itemText = itemText.simplifyWhiteSpace(); 123 itemText = itemText.simplifyWhiteSpace();
124 124
125 return itemText; 125 return itemText;
126 } 126 }
127 127
128 HTMLSelectElement* HTMLOptGroupElement::ownerSelectElement() const 128 HTMLSelectElement* HTMLOptGroupElement::ownerSelectElement() const
129 { 129 {
130 ContainerNode* select = parentNode(); 130 ContainerNode* select = parentNode();
131 while (select && !select->hasTagName(selectTag)) 131 while (select && !isHTMLSelectElement(*select))
132 select = select->parentNode(); 132 select = select->parentNode();
133 133
134 if (!select) 134 if (!select)
135 return 0; 135 return 0;
136 136
137 return toHTMLSelectElement(select); 137 return toHTMLSelectElement(select);
138 } 138 }
139 139
140 void HTMLOptGroupElement::accessKeyAction(bool) 140 void HTMLOptGroupElement::accessKeyAction(bool)
141 { 141 {
142 HTMLSelectElement* select = ownerSelectElement(); 142 HTMLSelectElement* select = ownerSelectElement();
143 // send to the parent to bring focus to the list box 143 // send to the parent to bring focus to the list box
144 if (select && !select->focused()) 144 if (select && !select->focused())
145 select->accessKeyAction(false); 145 select->accessKeyAction(false);
146 } 146 }
147 147
148 } // namespace 148 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698