| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 int HTMLOptionElement::index() const | 154 int HTMLOptionElement::index() const |
| 155 { | 155 { |
| 156 // It would be faster to cache the index, but harder to get it right in all
cases. | 156 // It would be faster to cache the index, but harder to get it right in all
cases. |
| 157 | 157 |
| 158 HTMLSelectElement* selectElement = ownerSelectElement(); | 158 HTMLSelectElement* selectElement = ownerSelectElement(); |
| 159 if (!selectElement) | 159 if (!selectElement) |
| 160 return 0; | 160 return 0; |
| 161 | 161 |
| 162 int optionIndex = 0; | 162 int optionIndex = 0; |
| 163 | 163 |
| 164 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement> >& items = selectElem
ent->listItems(); | 164 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& items = selectEleme
nt->listItems(); |
| 165 size_t length = items.size(); | 165 size_t length = items.size(); |
| 166 for (size_t i = 0; i < length; ++i) { | 166 for (size_t i = 0; i < length; ++i) { |
| 167 if (!isHTMLOptionElement(*items[i])) | 167 if (!isHTMLOptionElement(*items[i])) |
| 168 continue; | 168 continue; |
| 169 if (items[i].get() == this) | 169 if (items[i].get() == this) |
| 170 return optionIndex; | 170 return optionIndex; |
| 171 ++optionIndex; | 171 ++optionIndex; |
| 172 } | 172 } |
| 173 | 173 |
| 174 return 0; | 174 return 0; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 node = NodeTraversal::next(*node, this); | 370 node = NodeTraversal::next(*node, this); |
| 371 } | 371 } |
| 372 return text.toString(); | 372 return text.toString(); |
| 373 } | 373 } |
| 374 | 374 |
| 375 HTMLFormElement* HTMLOptionElement::form() const | 375 HTMLFormElement* HTMLOptionElement::form() const |
| 376 { | 376 { |
| 377 if (HTMLSelectElement* selectElement = ownerSelectElement()) | 377 if (HTMLSelectElement* selectElement = ownerSelectElement()) |
| 378 return selectElement->formOwner(); | 378 return selectElement->formOwner(); |
| 379 | 379 |
| 380 return 0; | 380 return nullptr; |
| 381 } | 381 } |
| 382 | 382 |
| 383 void HTMLOptionElement::didAddUserAgentShadowRoot(ShadowRoot& root) | 383 void HTMLOptionElement::didAddUserAgentShadowRoot(ShadowRoot& root) |
| 384 { | 384 { |
| 385 updateLabel(); | 385 updateLabel(); |
| 386 } | 386 } |
| 387 | 387 |
| 388 void HTMLOptionElement::updateLabel() | 388 void HTMLOptionElement::updateLabel() |
| 389 { | 389 { |
| 390 if (ShadowRoot* root = userAgentShadowRoot()) | 390 if (ShadowRoot* root = userAgentShadowRoot()) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 411 ASSERT(parent); | 411 ASSERT(parent); |
| 412 if (isHTMLOptGroupElement(*parent)) { | 412 if (isHTMLOptGroupElement(*parent)) { |
| 413 RenderStyle* parentStyle = parent->renderStyle() ? parent->renderSty
le() : parent->computedStyle(); | 413 RenderStyle* parentStyle = parent->renderStyle() ? parent->renderSty
le() : parent->computedStyle(); |
| 414 return !parentStyle || parentStyle->display() == NONE; | 414 return !parentStyle || parentStyle->display() == NONE; |
| 415 } | 415 } |
| 416 } | 416 } |
| 417 return m_style->display() == NONE; | 417 return m_style->display() == NONE; |
| 418 } | 418 } |
| 419 | 419 |
| 420 } // namespace blink | 420 } // namespace blink |
| OLD | NEW |