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 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1400 if (event->type() == EventTypeNames::gesturetap && event->isGestureEvent())
{ | 1400 if (event->type() == EventTypeNames::gesturetap && event->isGestureEvent())
{ |
1401 focus(); | 1401 focus(); |
1402 // Calling focus() may cause us to lose our renderer or change the rende
r type, in which case do not want to handle the event. | 1402 // Calling focus() may cause us to lose our renderer or change the rende
r type, in which case do not want to handle the event. |
1403 if (!renderer() || !renderer()->isListBox()) | 1403 if (!renderer() || !renderer()->isListBox()) |
1404 return; | 1404 return; |
1405 | 1405 |
1406 // Convert to coords relative to the list box if needed. | 1406 // Convert to coords relative to the list box if needed. |
1407 GestureEvent& gestureEvent = toGestureEvent(*event); | 1407 GestureEvent& gestureEvent = toGestureEvent(*event); |
1408 int listIndex = listIndexForEventTargetOption(gestureEvent); | 1408 int listIndex = listIndexForEventTargetOption(gestureEvent); |
1409 if (listIndex >= 0) { | 1409 if (listIndex >= 0) { |
1410 if (!isDisabledFormControl()) | 1410 if (!isDisabledFormControl()) { |
1411 updateSelectedState(listIndex, true, gestureEvent.shiftKey()); | 1411 updateSelectedState(listIndex, true, gestureEvent.shiftKey()); |
| 1412 listBoxOnChange(); |
| 1413 } |
1412 event->setDefaultHandled(); | 1414 event->setDefaultHandled(); |
1413 } | 1415 } |
1414 } else if (event->type() == EventTypeNames::mousedown && event->isMouseEvent
() && toMouseEvent(event)->button() == LeftButton) { | 1416 } else if (event->type() == EventTypeNames::mousedown && event->isMouseEvent
() && toMouseEvent(event)->button() == LeftButton) { |
1415 focus(); | 1417 focus(); |
1416 // Calling focus() may cause us to lose our renderer, in which case do n
ot want to handle the event. | 1418 // Calling focus() may cause us to lose our renderer, in which case do n
ot want to handle the event. |
1417 if (!renderer() || !renderer()->isListBox() || isDisabledFormControl()) | 1419 if (!renderer() || !renderer()->isListBox() || isDisabledFormControl()) |
1418 return; | 1420 return; |
1419 | 1421 |
1420 // Convert to coords relative to the list box if needed. | 1422 // Convert to coords relative to the list box if needed. |
1421 MouseEvent* mouseEvent = toMouseEvent(event); | 1423 MouseEvent* mouseEvent = toMouseEvent(event); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1738 int focusedIndex = activeSelectionEndListIndex(); | 1740 int focusedIndex = activeSelectionEndListIndex(); |
1739 if (focusedIndex < 0) | 1741 if (focusedIndex < 0) |
1740 focusedIndex = firstSelectableListIndex(); | 1742 focusedIndex = firstSelectableListIndex(); |
1741 if (focusedIndex < 0) | 1743 if (focusedIndex < 0) |
1742 return nullptr; | 1744 return nullptr; |
1743 HTMLElement* focused = listItems()[focusedIndex]; | 1745 HTMLElement* focused = listItems()[focusedIndex]; |
1744 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr
; | 1746 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr
; |
1745 } | 1747 } |
1746 | 1748 |
1747 } // namespace | 1749 } // namespace |
OLD | NEW |