Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(968)

Side by Side Diff: Source/core/html/HTMLSelectElement.cpp

Issue 486583002: Regression: r170111 Tapping listbox items should fire change/input event (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/forms/select/listbox-tap-input-change-event-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/select/listbox-tap-input-change-event-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698