OLD | NEW |
---|---|
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 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 5 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
6 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. |
7 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. All rights reserved. |
8 * Copyright (C) 2011 Motorola Mobility, Inc. All rights reserved. | 8 * Copyright (C) 2011 Motorola Mobility, Inc. All rights reserved. |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 if (items[i] == this) | 187 if (items[i] == this) |
188 return optionIndex; | 188 return optionIndex; |
189 ++optionIndex; | 189 ++optionIndex; |
190 } | 190 } |
191 | 191 |
192 return 0; | 192 return 0; |
193 } | 193 } |
194 | 194 |
195 void HTMLOptionElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) | 195 void HTMLOptionElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) |
196 { | 196 { |
197 #if ENABLE(DATALIST_ELEMENT) | |
198 if (name == valueAttr) { | 197 if (name == valueAttr) { |
199 if (HTMLDataListElement* dataList = ownerDataListElement()) | 198 if (HTMLDataListElement* dataList = ownerDataListElement()) |
200 dataList->optionElementChildrenChanged(); | 199 dataList->optionElementChildrenChanged(); |
201 } else | 200 } else |
tkent
2013/05/20 21:32:11
should be "} else if (..."
| |
202 #endif | |
203 if (name == disabledAttr) { | 201 if (name == disabledAttr) { |
204 bool oldDisabled = m_disabled; | 202 bool oldDisabled = m_disabled; |
205 m_disabled = !value.isNull(); | 203 m_disabled = !value.isNull(); |
206 if (oldDisabled != m_disabled) { | 204 if (oldDisabled != m_disabled) { |
207 didAffectSelector(AffectedSelectorDisabled | AffectedSelectorEnabled ); | 205 didAffectSelector(AffectedSelectorDisabled | AffectedSelectorEnabled ); |
208 if (renderer() && renderer()->style()->hasAppearance()) | 206 if (renderer() && renderer()->style()->hasAppearance()) |
209 renderer()->theme()->stateChanged(renderer(), EnabledState); | 207 renderer()->theme()->stateChanged(renderer(), EnabledState); |
210 } | 208 } |
211 } else if (name == selectedAttr) { | 209 } else if (name == selectedAttr) { |
212 // FIXME: This doesn't match what the HTML specification says. | 210 // FIXME: This doesn't match what the HTML specification says. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
268 | 266 |
269 m_isSelected = selected; | 267 m_isSelected = selected; |
270 didAffectSelector(AffectedSelectorChecked); | 268 didAffectSelector(AffectedSelectorChecked); |
271 | 269 |
272 if (HTMLSelectElement* select = ownerSelectElement()) | 270 if (HTMLSelectElement* select = ownerSelectElement()) |
273 select->invalidateSelectedItems(); | 271 select->invalidateSelectedItems(); |
274 } | 272 } |
275 | 273 |
276 void HTMLOptionElement::childrenChanged(bool changedByParser, Node* beforeChange , Node* afterChange, int childCountDelta) | 274 void HTMLOptionElement::childrenChanged(bool changedByParser, Node* beforeChange , Node* afterChange, int childCountDelta) |
277 { | 275 { |
278 #if ENABLE(DATALIST_ELEMENT) | |
279 if (HTMLDataListElement* dataList = ownerDataListElement()) | 276 if (HTMLDataListElement* dataList = ownerDataListElement()) |
280 dataList->optionElementChildrenChanged(); | 277 dataList->optionElementChildrenChanged(); |
281 else | 278 else |
tkent
2013/05/20 21:32:11
should be "else if (..."
| |
282 #endif | |
283 if (HTMLSelectElement* select = ownerSelectElement()) | 279 if (HTMLSelectElement* select = ownerSelectElement()) |
284 select->optionElementChildrenChanged(); | 280 select->optionElementChildrenChanged(); |
285 HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, chi ldCountDelta); | 281 HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, chi ldCountDelta); |
286 } | 282 } |
287 | 283 |
288 #if ENABLE(DATALIST_ELEMENT) | |
289 HTMLDataListElement* HTMLOptionElement::ownerDataListElement() const | 284 HTMLDataListElement* HTMLOptionElement::ownerDataListElement() const |
290 { | 285 { |
291 for (ContainerNode* parent = parentNode(); parent ; parent = parent->parentN ode()) { | 286 for (ContainerNode* parent = parentNode(); parent ; parent = parent->parentN ode()) { |
292 if (parent->hasTagName(datalistTag)) | 287 if (parent->hasTagName(datalistTag)) |
293 return static_cast<HTMLDataListElement*>(parent); | 288 return static_cast<HTMLDataListElement*>(parent); |
294 } | 289 } |
295 return 0; | 290 return 0; |
296 } | 291 } |
297 #endif | |
298 | 292 |
299 HTMLSelectElement* HTMLOptionElement::ownerSelectElement() const | 293 HTMLSelectElement* HTMLOptionElement::ownerSelectElement() const |
300 { | 294 { |
301 ContainerNode* select = parentNode(); | 295 ContainerNode* select = parentNode(); |
302 while (select && !select->hasTagName(selectTag)) | 296 while (select && !select->hasTagName(selectTag)) |
303 select = select->parentNode(); | 297 select = select->parentNode(); |
304 | 298 |
305 if (!select) | 299 if (!select) |
306 return 0; | 300 return 0; |
307 | 301 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
410 | 404 |
411 const HTMLOptionElement* toHTMLOptionElement(const Node* node) | 405 const HTMLOptionElement* toHTMLOptionElement(const Node* node) |
412 { | 406 { |
413 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(optionTag)); | 407 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(optionTag)); |
414 return static_cast<const HTMLOptionElement*>(node); | 408 return static_cast<const HTMLOptionElement*>(node); |
415 } | 409 } |
416 | 410 |
417 #endif | 411 #endif |
418 | 412 |
419 } // namespace | 413 } // namespace |
OLD | NEW |