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 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1270 if (m_activeSelectionAnchorIndex < 0 || !shiftSelect) | 1270 if (m_activeSelectionAnchorIndex < 0 || !shiftSelect) |
1271 setActiveSelectionAnchorIndex(listIndex); | 1271 setActiveSelectionAnchorIndex(listIndex); |
1272 | 1272 |
1273 setActiveSelectionEndIndex(listIndex); | 1273 setActiveSelectionEndIndex(listIndex); |
1274 updateListBoxSelection(!multiSelect); | 1274 updateListBoxSelection(!multiSelect); |
1275 } | 1275 } |
1276 | 1276 |
1277 void HTMLSelectElement::listBoxDefaultEventHandler(Event* event) | 1277 void HTMLSelectElement::listBoxDefaultEventHandler(Event* event) |
1278 { | 1278 { |
1279 const Vector<HTMLElement*>& listItems = this->listItems(); | 1279 const Vector<HTMLElement*>& listItems = this->listItems(); |
1280 | 1280 bool dragSelection = false; |
Inactive
2014/04/20 00:43:41
I don't understand how the changes to this file co
| |
1281 if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && t oMouseEvent(event)->button() == LeftButton) { | 1281 if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && t oMouseEvent(event)->button() == LeftButton) { |
1282 focus(); | 1282 focus(); |
1283 // Calling focus() may cause us to lose our renderer, in which case do n ot want to handle the event. | 1283 // Calling focus() may cause us to lose our renderer, in which case do n ot want to handle the event. |
1284 if (!renderer()) | 1284 if (!renderer()) |
1285 return; | 1285 return; |
1286 | 1286 |
1287 // Convert to coords relative to the list box if needed. | 1287 // Convert to coords relative to the list box if needed. |
1288 MouseEvent* mouseEvent = toMouseEvent(event); | 1288 MouseEvent* mouseEvent = toMouseEvent(event); |
1289 IntPoint localOffset = roundedIntPoint(renderer()->absoluteToLocal(mouse Event->absoluteLocation(), UseTransforms)); | 1289 IntPoint localOffset = roundedIntPoint(renderer()->absoluteToLocal(mouse Event->absoluteLocation(), UseTransforms)); |
1290 int listIndex = toRenderListBox(renderer())->listIndexAtOffset(toIntSize (localOffset)); | 1290 int listIndex = toRenderListBox(renderer())->listIndexAtOffset(toIntSize (localOffset)); |
(...skipping 25 matching lines...) Expand all Loading... | |
1316 return; | 1316 return; |
1317 | 1317 |
1318 setActiveSelectionEndIndex(listIndex); | 1318 setActiveSelectionEndIndex(listIndex); |
1319 updateListBoxSelection(false); | 1319 updateListBoxSelection(false); |
1320 } else { | 1320 } else { |
1321 setActiveSelectionAnchorIndex(listIndex); | 1321 setActiveSelectionAnchorIndex(listIndex); |
1322 setActiveSelectionEndIndex(listIndex); | 1322 setActiveSelectionEndIndex(listIndex); |
1323 updateListBoxSelection(true); | 1323 updateListBoxSelection(true); |
1324 } | 1324 } |
1325 } | 1325 } |
1326 event->setDefaultHandled(); | 1326 dragSelection = true; |
Inactive
2014/04/20 00:43:41
The clang static analyzer (rightfully) complains a
| |
1327 } | 1327 } |
1328 } else if (event->type() == EventTypeNames::mouseup && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton && renderer() && !toRenderBox(re nderer())->autoscrollInProgress()) { | 1328 } else if (event->type() == EventTypeNames::mouseup && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton && renderer() && !toRenderBox(re nderer())->autoscrollInProgress()) { |
1329 // We didn't start this click/drag on any options. | 1329 // We didn't start this click/drag on any options. |
1330 if (m_lastOnChangeSelection.isEmpty()) | 1330 if (m_lastOnChangeSelection.isEmpty()) |
1331 return; | 1331 return; |
1332 // This makes sure we fire dispatchFormControlChangeEvent for a single | 1332 // This makes sure we fire dispatchFormControlChangeEvent for a single |
1333 // click. For drag selection, onChange will fire when the autoscroll | 1333 // click. For drag selection, onChange will fire when the autoscroll |
1334 // timer stops. | 1334 // timer stops. |
1335 listBoxOnChange(); | 1335 if (!dragSelection) { |
Inactive
2014/04/20 00:43:41
dragSelection will always be false here since it i
| |
1336 listBoxOnChange(); | |
1337 } | |
1336 } else if (event->type() == EventTypeNames::keydown) { | 1338 } else if (event->type() == EventTypeNames::keydown) { |
1337 if (!event->isKeyboardEvent()) | 1339 if (!event->isKeyboardEvent()) |
1338 return; | 1340 return; |
1339 const String& keyIdentifier = toKeyboardEvent(event)->keyIdentifier(); | 1341 const String& keyIdentifier = toKeyboardEvent(event)->keyIdentifier(); |
1340 | 1342 |
1341 bool handled = false; | 1343 bool handled = false; |
1342 int endIndex = 0; | 1344 int endIndex = 0; |
1343 if (m_activeSelectionEndIndex < 0) { | 1345 if (m_activeSelectionEndIndex < 0) { |
1344 // Initialize the end index | 1346 // Initialize the end index |
1345 if (keyIdentifier == "Down" || keyIdentifier == "PageDown") { | 1347 if (keyIdentifier == "Down" || keyIdentifier == "PageDown") { |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1576 remove(index); | 1578 remove(index); |
1577 return true; | 1579 return true; |
1578 } | 1580 } |
1579 | 1581 |
1580 bool HTMLSelectElement::isInteractiveContent() const | 1582 bool HTMLSelectElement::isInteractiveContent() const |
1581 { | 1583 { |
1582 return true; | 1584 return true; |
1583 } | 1585 } |
1584 | 1586 |
1585 } // namespace | 1587 } // namespace |
OLD | NEW |