Chromium Code Reviews| 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 260 select->optionSelectionStateChanged(this, selected); | 260 select->optionSelectionStateChanged(this, selected); |
| 261 } | 261 } |
| 262 | 262 |
| 263 bool HTMLOptionElement::selectedForBinding() const | 263 bool HTMLOptionElement::selectedForBinding() const |
| 264 { | 264 { |
| 265 return selected(); | 265 return selected(); |
| 266 } | 266 } |
| 267 | 267 |
| 268 void HTMLOptionElement::setSelectedForBinding(bool selected) | 268 void HTMLOptionElement::setSelectedForBinding(bool selected) |
| 269 { | 269 { |
| 270 bool wasSelected = m_isSelected; | |
| 270 setSelected(selected); | 271 setSelected(selected); |
| 272 | |
| 273 // As of December 2015, the HTML specification says the dirtiness becomes | |
|
tfarina
2015/12/23 23:04:36
is it worth pointing to the link for that specific
| |
| 274 // true by |selected| setter unconditionally. However it caused a real bug, | |
| 275 // crbug.com/570367, and is not compatible with other browsers. | |
| 276 // Firefox seems not to set dirtiness if an option is owned by a select | |
| 277 // element and selectedness is not changed. | |
| 278 if (ownerSelectElement() && wasSelected == m_isSelected) | |
| 279 return; | |
| 280 | |
| 271 m_isDirty = true; | 281 m_isDirty = true; |
| 272 } | 282 } |
| 273 | 283 |
| 274 void HTMLOptionElement::setSelectedState(bool selected) | 284 void HTMLOptionElement::setSelectedState(bool selected) |
| 275 { | 285 { |
| 276 if (m_isSelected == selected) | 286 if (m_isSelected == selected) |
| 277 return; | 287 return; |
| 278 | 288 |
| 279 m_isSelected = selected; | 289 m_isSelected = selected; |
| 280 pseudoStateChanged(CSSSelector::PseudoChecked); | 290 pseudoStateChanged(CSSSelector::PseudoChecked); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 459 ASSERT(parent); | 469 ASSERT(parent); |
| 460 if (isHTMLOptGroupElement(*parent)) { | 470 if (isHTMLOptGroupElement(*parent)) { |
| 461 const ComputedStyle* parentStyle = parent->computedStyle() ? parent- >computedStyle() : parent->ensureComputedStyle(); | 471 const ComputedStyle* parentStyle = parent->computedStyle() ? parent- >computedStyle() : parent->ensureComputedStyle(); |
| 462 return !parentStyle || parentStyle->display() == NONE; | 472 return !parentStyle || parentStyle->display() == NONE; |
| 463 } | 473 } |
| 464 } | 474 } |
| 465 return m_style->display() == NONE; | 475 return m_style->display() == NONE; |
| 466 } | 476 } |
| 467 | 477 |
| 468 } // namespace blink | 478 } // namespace blink |
| OLD | NEW |