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

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

Issue 242113014: Partial revert of r164563 as those changes have no effect (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | « no previous file | 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 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 if (m_activeSelectionAnchorIndex < 0 || !shiftSelect) 1330 if (m_activeSelectionAnchorIndex < 0 || !shiftSelect)
1331 setActiveSelectionAnchorIndex(listIndex); 1331 setActiveSelectionAnchorIndex(listIndex);
1332 1332
1333 setActiveSelectionEndIndex(listIndex); 1333 setActiveSelectionEndIndex(listIndex);
1334 updateListBoxSelection(!multiSelect); 1334 updateListBoxSelection(!multiSelect);
1335 } 1335 }
1336 1336
1337 void HTMLSelectElement::listBoxDefaultEventHandler(Event* event) 1337 void HTMLSelectElement::listBoxDefaultEventHandler(Event* event)
1338 { 1338 {
1339 const Vector<HTMLElement*>& listItems = this->listItems(); 1339 const Vector<HTMLElement*>& listItems = this->listItems();
1340 bool dragSelection = false;
1341 if (event->type() == EventTypeNames::gesturetap && event->isGestureEvent()) { 1340 if (event->type() == EventTypeNames::gesturetap && event->isGestureEvent()) {
1342 focus(); 1341 focus();
1343 // 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. 1342 // 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.
1344 if (!renderer() || !renderer()->isListBox()) 1343 if (!renderer() || !renderer()->isListBox())
1345 return; 1344 return;
1346 1345
1347 // Convert to coords relative to the list box if needed. 1346 // Convert to coords relative to the list box if needed.
1348 GestureEvent& gestureEvent = toGestureEvent(*event); 1347 GestureEvent& gestureEvent = toGestureEvent(*event);
1349 IntPoint localOffset = roundedIntPoint(renderer()->absoluteToLocal(gestu reEvent.absoluteLocation(), UseTransforms)); 1348 IntPoint localOffset = roundedIntPoint(renderer()->absoluteToLocal(gestu reEvent.absoluteLocation(), UseTransforms));
1350 int listIndex = toRenderListBox(renderer())->listIndexAtOffset(toIntSize (localOffset)); 1349 int listIndex = toRenderListBox(renderer())->listIndexAtOffset(toIntSize (localOffset));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1391 return; 1390 return;
1392 1391
1393 setActiveSelectionEndIndex(listIndex); 1392 setActiveSelectionEndIndex(listIndex);
1394 updateListBoxSelection(false); 1393 updateListBoxSelection(false);
1395 } else { 1394 } else {
1396 setActiveSelectionAnchorIndex(listIndex); 1395 setActiveSelectionAnchorIndex(listIndex);
1397 setActiveSelectionEndIndex(listIndex); 1396 setActiveSelectionEndIndex(listIndex);
1398 updateListBoxSelection(true); 1397 updateListBoxSelection(true);
1399 } 1398 }
1400 } 1399 }
1401 dragSelection = true;
1402 } 1400 }
1403 } else if (event->type() == EventTypeNames::mouseup && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton && renderer() && !toRenderBox(re nderer())->autoscrollInProgress()) { 1401 } else if (event->type() == EventTypeNames::mouseup && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton && renderer() && !toRenderBox(re nderer())->autoscrollInProgress()) {
1404 // We didn't start this click/drag on any options. 1402 // We didn't start this click/drag on any options.
1405 if (m_lastOnChangeSelection.isEmpty()) 1403 if (m_lastOnChangeSelection.isEmpty())
1406 return; 1404 return;
1407 // This makes sure we fire dispatchFormControlChangeEvent for a single 1405 listBoxOnChange();
1408 // click. For drag selection, onChange will fire when the autoscroll
1409 // timer stops.
1410 if (!dragSelection) {
1411 listBoxOnChange();
1412 }
1413 } else if (event->type() == EventTypeNames::keydown) { 1406 } else if (event->type() == EventTypeNames::keydown) {
1414 if (!event->isKeyboardEvent()) 1407 if (!event->isKeyboardEvent())
1415 return; 1408 return;
1416 const String& keyIdentifier = toKeyboardEvent(event)->keyIdentifier(); 1409 const String& keyIdentifier = toKeyboardEvent(event)->keyIdentifier();
1417 1410
1418 bool handled = false; 1411 bool handled = false;
1419 int endIndex = 0; 1412 int endIndex = 0;
1420 if (m_activeSelectionEndIndex < 0) { 1413 if (m_activeSelectionEndIndex < 0) {
1421 // Initialize the end index 1414 // Initialize the end index
1422 if (keyIdentifier == "Down" || keyIdentifier == "PageDown") { 1415 if (keyIdentifier == "Down" || keyIdentifier == "PageDown") {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 { 1649 {
1657 return true; 1650 return true;
1658 } 1651 }
1659 1652
1660 void HTMLSelectElement::updateListOnRenderer() 1653 void HTMLSelectElement::updateListOnRenderer()
1661 { 1654 {
1662 setOptionsChangedOnRenderer(); 1655 setOptionsChangedOnRenderer();
1663 } 1656 }
1664 1657
1665 } // namespace 1658 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698