| 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 { | 323 { |
| 324 if (ownElementDisabled()) | 324 if (ownElementDisabled()) |
| 325 return true; | 325 return true; |
| 326 if (Element* parent = parentElement()) | 326 if (Element* parent = parentElement()) |
| 327 return isHTMLOptGroupElement(*parent) && parent->isDisabledFormControl()
; | 327 return isHTMLOptGroupElement(*parent) && parent->isDisabledFormControl()
; |
| 328 return false; | 328 return false; |
| 329 } | 329 } |
| 330 | 330 |
| 331 Node::InsertionNotificationRequest HTMLOptionElement::insertedInto(ContainerNode
* insertionPoint) | 331 Node::InsertionNotificationRequest HTMLOptionElement::insertedInto(ContainerNode
* insertionPoint) |
| 332 { | 332 { |
| 333 HTMLElement::insertedInto(insertionPoint); |
| 333 if (HTMLSelectElement* select = ownerSelectElement()) { | 334 if (HTMLSelectElement* select = ownerSelectElement()) { |
| 334 select->setRecalcListItems(); | 335 select->setRecalcListItems(); |
| 335 // Do not call selected() since calling updateListItemSelectedStates() | 336 select->optionInserted(*this, m_isSelected); |
| 336 // at this time won't do the right thing. (Why, exactly?) | |
| 337 if (m_isSelected) { | |
| 338 // FIXME: Might be better to call this unconditionally, always | |
| 339 // passing m_isSelected, rather than only calling it if we are | |
| 340 // selected. | |
| 341 select->optionSelectionStateChanged(this, true); | |
| 342 select->scrollToSelection(); | |
| 343 } | |
| 344 } | 337 } |
| 345 | 338 return InsertionDone; |
| 346 return HTMLElement::insertedInto(insertionPoint); | |
| 347 } | 339 } |
| 348 | 340 |
| 349 void HTMLOptionElement::removedFrom(ContainerNode* insertionPoint) | 341 void HTMLOptionElement::removedFrom(ContainerNode* insertionPoint) |
| 350 { | 342 { |
| 351 if (HTMLSelectElement* select = Traversal<HTMLSelectElement>::firstAncestorO
rSelf(*insertionPoint)) { | 343 if (HTMLSelectElement* select = Traversal<HTMLSelectElement>::firstAncestorO
rSelf(*insertionPoint)) { |
| 352 select->setRecalcListItems(); | 344 select->setRecalcListItems(); |
| 353 select->optionRemoved(*this); | 345 select->optionRemoved(*this); |
| 354 } | 346 } |
| 355 HTMLElement::removedFrom(insertionPoint); | 347 HTMLElement::removedFrom(insertionPoint); |
| 356 } | 348 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 379 } | 371 } |
| 380 | 372 |
| 381 void HTMLOptionElement::didAddUserAgentShadowRoot(ShadowRoot& root) | 373 void HTMLOptionElement::didAddUserAgentShadowRoot(ShadowRoot& root) |
| 382 { | 374 { |
| 383 updateLabel(); | 375 updateLabel(); |
| 384 } | 376 } |
| 385 | 377 |
| 386 void HTMLOptionElement::updateLabel() | 378 void HTMLOptionElement::updateLabel() |
| 387 { | 379 { |
| 388 if (ShadowRoot* root = userAgentShadowRoot()) | 380 if (ShadowRoot* root = userAgentShadowRoot()) |
| 389 root->setTextContent(textIndentedToRespectGroupLabel()); | 381 root->setTextContent(text()); |
| 390 } | 382 } |
| 391 | 383 |
| 392 bool HTMLOptionElement::spatialNavigationFocused() const | 384 bool HTMLOptionElement::spatialNavigationFocused() const |
| 393 { | 385 { |
| 394 HTMLSelectElement* select = ownerSelectElement(); | 386 HTMLSelectElement* select = ownerSelectElement(); |
| 395 if (!select || !select->focused()) | 387 if (!select || !select->focused()) |
| 396 return false; | 388 return false; |
| 397 return select->spatialNavigationFocusedOption() == this; | 389 return select->spatialNavigationFocusedOption() == this; |
| 398 } | 390 } |
| 399 | 391 |
| 400 bool HTMLOptionElement::isDisplayNone() const | 392 bool HTMLOptionElement::isDisplayNone() const |
| 401 { | 393 { |
| 402 // If m_style is not set, then the node is still unattached. | 394 // If m_style is not set, then the node is still unattached. |
| 403 // We have to wait till it gets attached to read the display property. | 395 // We have to wait till it gets attached to read the display property. |
| 404 if (!m_style) | 396 if (!m_style) |
| 405 return false; | 397 return false; |
| 406 | 398 |
| 407 if (m_style->display() != NONE) { | 399 if (m_style->display() != NONE) { |
| 408 Element* parent = parentElement(); | 400 Element* parent = parentElement(); |
| 409 ASSERT(parent); | 401 ASSERT(parent); |
| 410 if (isHTMLOptGroupElement(*parent)) { | 402 if (isHTMLOptGroupElement(*parent)) { |
| 411 RenderStyle* parentStyle = parent->renderStyle() ? parent->renderSty
le() : parent->computedStyle(); | 403 RenderStyle* parentStyle = parent->renderStyle() ? parent->renderSty
le() : parent->computedStyle(); |
| 412 return !parentStyle || parentStyle->display() == NONE; | 404 return !parentStyle || parentStyle->display() == NONE; |
| 413 } | 405 } |
| 414 } | 406 } |
| 415 return m_style->display() == NONE; | 407 return m_style->display() == NONE; |
| 416 } | 408 } |
| 417 | 409 |
| 418 } // namespace blink | 410 } // namespace blink |
| OLD | NEW |