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 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 if (menuList->popupIsVisible()) | 1276 if (menuList->popupIsVisible()) |
1277 menuList->hidePopup(); | 1277 menuList->hidePopup(); |
1278 } | 1278 } |
1279 } | 1279 } |
1280 } | 1280 } |
1281 | 1281 |
1282 void HTMLSelectElement::updateSelectedState(int listIndex, bool multi, bool shif
t) | 1282 void HTMLSelectElement::updateSelectedState(int listIndex, bool multi, bool shif
t) |
1283 { | 1283 { |
1284 ASSERT(listIndex >= 0); | 1284 ASSERT(listIndex >= 0); |
1285 | 1285 |
| 1286 HTMLElement* clickedElement = listItems()[listIndex]; |
| 1287 ASSERT(clickedElement); |
| 1288 if (isHTMLOptGroupElement(clickedElement)) |
| 1289 return; |
| 1290 |
1286 // Save the selection so it can be compared to the new selection when | 1291 // Save the selection so it can be compared to the new selection when |
1287 // dispatching change events during mouseup, or after autoscroll finishes. | 1292 // dispatching change events during mouseup, or after autoscroll finishes. |
1288 saveLastSelection(); | 1293 saveLastSelection(); |
1289 | 1294 |
1290 m_activeSelectionState = true; | 1295 m_activeSelectionState = true; |
1291 | 1296 |
1292 bool shiftSelect = m_multiple && shift; | 1297 bool shiftSelect = m_multiple && shift; |
1293 bool multiSelect = m_multiple && multi && !shift; | 1298 bool multiSelect = m_multiple && multi && !shift; |
1294 | 1299 |
1295 HTMLElement* clickedElement = listItems()[listIndex]; | |
1296 ASSERT(clickedElement); | |
1297 if (isHTMLOptionElement(*clickedElement)) { | 1300 if (isHTMLOptionElement(*clickedElement)) { |
1298 // Keep track of whether an active selection (like during drag | 1301 // Keep track of whether an active selection (like during drag |
1299 // selection), should select or deselect. | 1302 // selection), should select or deselect. |
1300 if (toHTMLOptionElement(*clickedElement).selected() && multiSelect) | 1303 if (toHTMLOptionElement(*clickedElement).selected() && multiSelect) |
1301 m_activeSelectionState = false; | 1304 m_activeSelectionState = false; |
1302 if (!m_activeSelectionState) | 1305 if (!m_activeSelectionState) |
1303 toHTMLOptionElement(*clickedElement).setSelectedState(false); | 1306 toHTMLOptionElement(*clickedElement).setSelectedState(false); |
1304 } | 1307 } |
1305 | 1308 |
1306 // If we're not in any special multiple selection mode, then deselect all | 1309 // If we're not in any special multiple selection mode, then deselect all |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1646 { | 1649 { |
1647 return true; | 1650 return true; |
1648 } | 1651 } |
1649 | 1652 |
1650 bool HTMLSelectElement::supportsAutofocus() const | 1653 bool HTMLSelectElement::supportsAutofocus() const |
1651 { | 1654 { |
1652 return true; | 1655 return true; |
1653 } | 1656 } |
1654 | 1657 |
1655 } // namespace | 1658 } // namespace |
OLD | NEW |