| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 removeChildren(); | 139 removeChildren(); |
| 140 appendChild(Text::create(document(), text), exceptionState); | 140 appendChild(Text::create(document(), text), exceptionState); |
| 141 } | 141 } |
| 142 | 142 |
| 143 if (selectIsMenuList && select->selectedIndex() != oldSelectedIndex) | 143 if (selectIsMenuList && select->selectedIndex() != oldSelectedIndex) |
| 144 select->setSelectedIndex(oldSelectedIndex); | 144 select->setSelectedIndex(oldSelectedIndex); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void HTMLOptionElement::accessKeyAction(bool) | 147 void HTMLOptionElement::accessKeyAction(bool) |
| 148 { | 148 { |
| 149 HTMLSelectElement* select = ownerSelectElement(); | 149 if (HTMLSelectElement* select = ownerSelectElement()) |
| 150 if (select) | |
| 151 select->accessKeySetSelectedIndex(index()); | 150 select->accessKeySetSelectedIndex(index()); |
| 152 } | 151 } |
| 153 | 152 |
| 154 int HTMLOptionElement::index() const | 153 int HTMLOptionElement::index() const |
| 155 { | 154 { |
| 156 // It would be faster to cache the index, but harder to get it right in all
cases. | 155 // It would be faster to cache the index, but harder to get it right in all
cases. |
| 157 | 156 |
| 158 HTMLSelectElement* selectElement = ownerSelectElement(); | 157 HTMLSelectElement* selectElement = ownerSelectElement(); |
| 159 if (!selectElement) | 158 if (!selectElement) |
| 160 return 0; | 159 return 0; |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 if (node->isElementNode() && toScriptLoaderIfPossible(toElement(node))) | 360 if (node->isElementNode() && toScriptLoaderIfPossible(toElement(node))) |
| 362 node = NodeTraversal::nextSkippingChildren(*node, this); | 361 node = NodeTraversal::nextSkippingChildren(*node, this); |
| 363 else | 362 else |
| 364 node = NodeTraversal::next(*node, this); | 363 node = NodeTraversal::next(*node, this); |
| 365 } | 364 } |
| 366 return text.toString(); | 365 return text.toString(); |
| 367 } | 366 } |
| 368 | 367 |
| 369 HTMLFormElement* HTMLOptionElement::form() const | 368 HTMLFormElement* HTMLOptionElement::form() const |
| 370 { | 369 { |
| 371 HTMLSelectElement* selectElement = ownerSelectElement(); | 370 if (HTMLSelectElement* selectElement = ownerSelectElement()) |
| 372 if (!selectElement) | 371 return selectElement->formOwner(); |
| 373 return 0; | |
| 374 | 372 |
| 375 return selectElement->formOwner(); | 373 return 0; |
| 376 } | 374 } |
| 377 | 375 |
| 378 } // namespace WebCore | 376 } // namespace WebCore |
| OLD | NEW |