| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
| 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 4 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 4 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights
reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights
reserved. |
| 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 8 * Copyright (C) 2010 Google Inc. All rights reserved. | 8 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 10 * | 10 * |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 // FIXME: This is horribly factored. | 370 // FIXME: This is horribly factored. |
| 371 if (Attribute* sizeAttribute = ensureUniqueElementData().attributes(
).find(sizeAttr)) | 371 if (Attribute* sizeAttribute = ensureUniqueElementData().attributes(
).find(sizeAttr)) |
| 372 sizeAttribute->setValue(attrSize); | 372 sizeAttribute->setValue(attrSize); |
| 373 } | 373 } |
| 374 m_size = std::max(size, 0u); | 374 m_size = std::max(size, 0u); |
| 375 setNeedsValidityCheck(); | 375 setNeedsValidityCheck(); |
| 376 if (m_size != oldSize) { | 376 if (m_size != oldSize) { |
| 377 if (inActiveDocument()) | 377 if (inActiveDocument()) |
| 378 lazyReattachIfAttached(); | 378 lazyReattachIfAttached(); |
| 379 resetToDefaultSelection(); | 379 resetToDefaultSelection(); |
| 380 if (!usesMenuList()) |
| 381 saveListboxActiveSelection(); |
| 380 } | 382 } |
| 381 } else if (name == multipleAttr) { | 383 } else if (name == multipleAttr) { |
| 382 parseMultipleAttribute(value); | 384 parseMultipleAttribute(value); |
| 383 } else if (name == accesskeyAttr) { | 385 } else if (name == accesskeyAttr) { |
| 384 // FIXME: ignore for the moment. | 386 // FIXME: ignore for the moment. |
| 385 // | 387 // |
| 386 } else if (name == disabledAttr) { | 388 } else if (name == disabledAttr) { |
| 387 HTMLFormControlElementWithState::parseAttribute(name, oldValue, value); | 389 HTMLFormControlElementWithState::parseAttribute(name, oldValue, value); |
| 388 if (popupIsVisible()) | 390 if (popupIsVisible()) |
| 389 hidePopup(); | 391 hidePopup(); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 } | 635 } |
| 634 | 636 |
| 635 m_lastOnChangeSelection.clear(); | 637 m_lastOnChangeSelection.clear(); |
| 636 for (auto& element : listItems()) | 638 for (auto& element : listItems()) |
| 637 m_lastOnChangeSelection.append(isHTMLOptionElement(*element) && toHTMLOp
tionElement(element)->selected()); | 639 m_lastOnChangeSelection.append(isHTMLOptionElement(*element) && toHTMLOp
tionElement(element)->selected()); |
| 638 } | 640 } |
| 639 | 641 |
| 640 void HTMLSelectElement::setActiveSelectionAnchor(HTMLOptionElement* option) | 642 void HTMLSelectElement::setActiveSelectionAnchor(HTMLOptionElement* option) |
| 641 { | 643 { |
| 642 m_activeSelectionAnchor = option; | 644 m_activeSelectionAnchor = option; |
| 645 if (!usesMenuList()) |
| 646 saveListboxActiveSelection(); |
| 647 } |
| 643 | 648 |
| 649 void HTMLSelectElement::saveListboxActiveSelection() |
| 650 { |
| 644 // Cache the selection state so we can restore the old selection as the new | 651 // Cache the selection state so we can restore the old selection as the new |
| 645 // selection pivots around this anchor index. | 652 // selection pivots around this anchor index. |
| 646 // Example: | 653 // Example: |
| 647 // 1. Press the mouse button on the second OPTION | 654 // 1. Press the mouse button on the second OPTION |
| 648 // m_activeSelectionAnchorIndex = 1 | 655 // m_activeSelectionAnchorIndex = 1 |
| 649 // 2. Drag the mouse pointer onto the fifth OPTION | 656 // 2. Drag the mouse pointer onto the fifth OPTION |
| 650 // m_activeSelectionEndIndex = 4, options at 1-4 indices are selected. | 657 // m_activeSelectionEndIndex = 4, options at 1-4 indices are selected. |
| 651 // 3. Drag the mouse pointer onto the fourth OPTION | 658 // 3. Drag the mouse pointer onto the fourth OPTION |
| 652 // m_activeSelectionEndIndex = 3, options at 1-3 indices are selected. | 659 // m_activeSelectionEndIndex = 3, options at 1-3 indices are selected. |
| 653 // updateListBoxSelection needs to clear selection of the fifth OPTION. | 660 // updateListBoxSelection needs to clear selection of the fifth OPTION. |
| (...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2078 } | 2085 } |
| 2079 | 2086 |
| 2080 void HTMLSelectElement::didMutateSubtree() | 2087 void HTMLSelectElement::didMutateSubtree() |
| 2081 { | 2088 { |
| 2082 DCHECK(popupIsVisible()); | 2089 DCHECK(popupIsVisible()); |
| 2083 DCHECK(m_popup); | 2090 DCHECK(m_popup); |
| 2084 m_popup->updateFromElement(PopupMenu::ByDOMChange); | 2091 m_popup->updateFromElement(PopupMenu::ByDOMChange); |
| 2085 } | 2092 } |
| 2086 | 2093 |
| 2087 } // namespace blink | 2094 } // namespace blink |
| OLD | NEW |