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 if (name == disabledAttr) { |
202 #endif | |
203 if (name == disabledAttr) { | |
204 bool oldDisabled = m_disabled; | 201 bool oldDisabled = m_disabled; |
205 m_disabled = !value.isNull(); | 202 m_disabled = !value.isNull(); |
206 if (oldDisabled != m_disabled) { | 203 if (oldDisabled != m_disabled) { |
207 didAffectSelector(AffectedSelectorDisabled | AffectedSelectorEnabled
); | 204 didAffectSelector(AffectedSelectorDisabled | AffectedSelectorEnabled
); |
208 if (renderer() && renderer()->style()->hasAppearance()) | 205 if (renderer() && renderer()->style()->hasAppearance()) |
209 renderer()->theme()->stateChanged(renderer(), EnabledState); | 206 renderer()->theme()->stateChanged(renderer(), EnabledState); |
210 } | 207 } |
211 } else if (name == selectedAttr) { | 208 } else if (name == selectedAttr) { |
212 // FIXME: This doesn't match what the HTML specification says. | 209 // FIXME: This doesn't match what the HTML specification says. |
213 // The specification implies that removing the selected attribute or | 210 // The specification implies that removing the selected attribute or |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 265 |
269 m_isSelected = selected; | 266 m_isSelected = selected; |
270 didAffectSelector(AffectedSelectorChecked); | 267 didAffectSelector(AffectedSelectorChecked); |
271 | 268 |
272 if (HTMLSelectElement* select = ownerSelectElement()) | 269 if (HTMLSelectElement* select = ownerSelectElement()) |
273 select->invalidateSelectedItems(); | 270 select->invalidateSelectedItems(); |
274 } | 271 } |
275 | 272 |
276 void HTMLOptionElement::childrenChanged(bool changedByParser, Node* beforeChange
, Node* afterChange, int childCountDelta) | 273 void HTMLOptionElement::childrenChanged(bool changedByParser, Node* beforeChange
, Node* afterChange, int childCountDelta) |
277 { | 274 { |
278 #if ENABLE(DATALIST_ELEMENT) | |
279 if (HTMLDataListElement* dataList = ownerDataListElement()) | 275 if (HTMLDataListElement* dataList = ownerDataListElement()) |
280 dataList->optionElementChildrenChanged(); | 276 dataList->optionElementChildrenChanged(); |
281 else | 277 else if (HTMLSelectElement* select = ownerSelectElement()) |
282 #endif | |
283 if (HTMLSelectElement* select = ownerSelectElement()) | |
284 select->optionElementChildrenChanged(); | 278 select->optionElementChildrenChanged(); |
285 HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, chi
ldCountDelta); | 279 HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, chi
ldCountDelta); |
286 } | 280 } |
287 | 281 |
288 #if ENABLE(DATALIST_ELEMENT) | |
289 HTMLDataListElement* HTMLOptionElement::ownerDataListElement() const | 282 HTMLDataListElement* HTMLOptionElement::ownerDataListElement() const |
290 { | 283 { |
291 for (ContainerNode* parent = parentNode(); parent ; parent = parent->parentN
ode()) { | 284 for (ContainerNode* parent = parentNode(); parent ; parent = parent->parentN
ode()) { |
292 if (parent->hasTagName(datalistTag)) | 285 if (parent->hasTagName(datalistTag)) |
293 return static_cast<HTMLDataListElement*>(parent); | 286 return static_cast<HTMLDataListElement*>(parent); |
294 } | 287 } |
295 return 0; | 288 return 0; |
296 } | 289 } |
297 #endif | |
298 | 290 |
299 HTMLSelectElement* HTMLOptionElement::ownerSelectElement() const | 291 HTMLSelectElement* HTMLOptionElement::ownerSelectElement() const |
300 { | 292 { |
301 ContainerNode* select = parentNode(); | 293 ContainerNode* select = parentNode(); |
302 while (select && !select->hasTagName(selectTag)) | 294 while (select && !select->hasTagName(selectTag)) |
303 select = select->parentNode(); | 295 select = select->parentNode(); |
304 | 296 |
305 if (!select) | 297 if (!select) |
306 return 0; | 298 return 0; |
307 | 299 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 | 402 |
411 const HTMLOptionElement* toHTMLOptionElement(const Node* node) | 403 const HTMLOptionElement* toHTMLOptionElement(const Node* node) |
412 { | 404 { |
413 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(optionTag)); | 405 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(optionTag)); |
414 return static_cast<const HTMLOptionElement*>(node); | 406 return static_cast<const HTMLOptionElement*>(node); |
415 } | 407 } |
416 | 408 |
417 #endif | 409 #endif |
418 | 410 |
419 } // namespace | 411 } // namespace |
OLD | NEW |