| 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 |
| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 256 |
| 259 m_isSelected = selected; | 257 m_isSelected = selected; |
| 260 didAffectSelector(AffectedSelectorChecked); | 258 didAffectSelector(AffectedSelectorChecked); |
| 261 | 259 |
| 262 if (HTMLSelectElement* select = ownerSelectElement()) | 260 if (HTMLSelectElement* select = ownerSelectElement()) |
| 263 select->invalidateSelectedItems(); | 261 select->invalidateSelectedItems(); |
| 264 } | 262 } |
| 265 | 263 |
| 266 void HTMLOptionElement::childrenChanged(bool changedByParser, Node* beforeChange
, Node* afterChange, int childCountDelta) | 264 void HTMLOptionElement::childrenChanged(bool changedByParser, Node* beforeChange
, Node* afterChange, int childCountDelta) |
| 267 { | 265 { |
| 268 #if ENABLE(DATALIST_ELEMENT) | |
| 269 if (HTMLDataListElement* dataList = ownerDataListElement()) | 266 if (HTMLDataListElement* dataList = ownerDataListElement()) |
| 270 dataList->optionElementChildrenChanged(); | 267 dataList->optionElementChildrenChanged(); |
| 271 else | 268 else |
| 272 #endif | |
| 273 if (HTMLSelectElement* select = ownerSelectElement()) | 269 if (HTMLSelectElement* select = ownerSelectElement()) |
| 274 select->optionElementChildrenChanged(); | 270 select->optionElementChildrenChanged(); |
| 275 HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, chi
ldCountDelta); | 271 HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, chi
ldCountDelta); |
| 276 } | 272 } |
| 277 | 273 |
| 278 #if ENABLE(DATALIST_ELEMENT) | |
| 279 HTMLDataListElement* HTMLOptionElement::ownerDataListElement() const | 274 HTMLDataListElement* HTMLOptionElement::ownerDataListElement() const |
| 280 { | 275 { |
| 281 for (ContainerNode* parent = parentNode(); parent ; parent = parent->parentN
ode()) { | 276 for (ContainerNode* parent = parentNode(); parent ; parent = parent->parentN
ode()) { |
| 282 if (parent->hasTagName(datalistTag)) | 277 if (parent->hasTagName(datalistTag)) |
| 283 return static_cast<HTMLDataListElement*>(parent); | 278 return static_cast<HTMLDataListElement*>(parent); |
| 284 } | 279 } |
| 285 return 0; | 280 return 0; |
| 286 } | 281 } |
| 287 #endif | |
| 288 | 282 |
| 289 HTMLSelectElement* HTMLOptionElement::ownerSelectElement() const | 283 HTMLSelectElement* HTMLOptionElement::ownerSelectElement() const |
| 290 { | 284 { |
| 291 ContainerNode* select = parentNode(); | 285 ContainerNode* select = parentNode(); |
| 292 while (select && !select->hasTagName(selectTag)) | 286 while (select && !select->hasTagName(selectTag)) |
| 293 select = select->parentNode(); | 287 select = select->parentNode(); |
| 294 | 288 |
| 295 if (!select) | 289 if (!select) |
| 296 return 0; | 290 return 0; |
| 297 | 291 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 | 394 |
| 401 const HTMLOptionElement* toHTMLOptionElement(const Node* node) | 395 const HTMLOptionElement* toHTMLOptionElement(const Node* node) |
| 402 { | 396 { |
| 403 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(optionTag)); | 397 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(optionTag)); |
| 404 return static_cast<const HTMLOptionElement*>(node); | 398 return static_cast<const HTMLOptionElement*>(node); |
| 405 } | 399 } |
| 406 | 400 |
| 407 #endif | 401 #endif |
| 408 | 402 |
| 409 } // namespace | 403 } // namespace |
| OLD | NEW |