Chromium Code Reviews| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 , m_typeAhead(this) | 67 , m_typeAhead(this) |
| 68 , m_size(0) | 68 , m_size(0) |
| 69 , m_lastOnChangeIndex(-1) | 69 , m_lastOnChangeIndex(-1) |
| 70 , m_activeSelectionAnchorIndex(-1) | 70 , m_activeSelectionAnchorIndex(-1) |
| 71 , m_activeSelectionEndIndex(-1) | 71 , m_activeSelectionEndIndex(-1) |
| 72 , m_isProcessingUserDrivenChange(false) | 72 , m_isProcessingUserDrivenChange(false) |
| 73 , m_multiple(false) | 73 , m_multiple(false) |
| 74 , m_activeSelectionState(false) | 74 , m_activeSelectionState(false) |
| 75 , m_shouldRecalcListItems(false) | 75 , m_shouldRecalcListItems(false) |
| 76 , m_isParsingInProgress(createdByParser) | 76 , m_isParsingInProgress(createdByParser) |
| 77 , m_onChangeFired(true) | |
|
eseidel
2013/12/28 19:57:00
When the element is created the "on change" has al
gnana
2014/01/03 07:50:02
In my latest patch i dont use it any more so i rem
| |
| 77 { | 78 { |
| 78 ScriptWrappable::init(this); | 79 ScriptWrappable::init(this); |
| 79 } | 80 } |
| 80 | 81 |
| 81 PassRefPtr<HTMLSelectElement> HTMLSelectElement::create(Document& document) | 82 PassRefPtr<HTMLSelectElement> HTMLSelectElement::create(Document& document) |
| 82 { | 83 { |
| 83 return adoptRef(new HTMLSelectElement(document, 0, false)); | 84 return adoptRef(new HTMLSelectElement(document, 0, false)); |
| 84 } | 85 } |
| 85 | 86 |
| 86 PassRefPtr<HTMLSelectElement> HTMLSelectElement::create(Document& document, HTML FormElement* form, bool createdByParser) | 87 PassRefPtr<HTMLSelectElement> HTMLSelectElement::create(Document& document, HTML FormElement* form, bool createdByParser) |
| (...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1293 #if OS(MACOSX) | 1294 #if OS(MACOSX) |
| 1294 updateSelectedState(listIndex, mouseEvent->metaKey(), mouseEvent ->shiftKey()); | 1295 updateSelectedState(listIndex, mouseEvent->metaKey(), mouseEvent ->shiftKey()); |
| 1295 #else | 1296 #else |
| 1296 updateSelectedState(listIndex, mouseEvent->ctrlKey(), mouseEvent ->shiftKey()); | 1297 updateSelectedState(listIndex, mouseEvent->ctrlKey(), mouseEvent ->shiftKey()); |
| 1297 #endif | 1298 #endif |
| 1298 } | 1299 } |
| 1299 if (Frame* frame = document().frame()) | 1300 if (Frame* frame = document().frame()) |
| 1300 frame->eventHandler().setMouseDownMayStartAutoscroll(); | 1301 frame->eventHandler().setMouseDownMayStartAutoscroll(); |
| 1301 | 1302 |
| 1302 event->setDefaultHandled(); | 1303 event->setDefaultHandled(); |
| 1304 setOnChangeFired(false); | |
| 1303 } | 1305 } |
| 1304 } else if (event->type() == EventTypeNames::mousemove && event->isMouseEvent () && !toRenderBox(renderer())->canBeScrolledAndHasScrollableArea()) { | 1306 } else if (event->type() == EventTypeNames::mousemove && event->isMouseEvent () && !toRenderBox(renderer())->canBeScrolledAndHasScrollableArea()) { |
| 1305 MouseEvent* mouseEvent = toMouseEvent(event); | 1307 MouseEvent* mouseEvent = toMouseEvent(event); |
| 1306 if (mouseEvent->button() != LeftButton || !mouseEvent->buttonDown()) | 1308 if (mouseEvent->button() != LeftButton || !mouseEvent->buttonDown()) |
| 1307 return; | 1309 return; |
| 1308 | 1310 |
| 1309 IntPoint localOffset = roundedIntPoint(renderer()->absoluteToLocal(mouse Event->absoluteLocation(), UseTransforms)); | 1311 IntPoint localOffset = roundedIntPoint(renderer()->absoluteToLocal(mouse Event->absoluteLocation(), UseTransforms)); |
| 1310 int listIndex = toRenderListBox(renderer())->listIndexAtOffset(toIntSize (localOffset)); | 1312 int listIndex = toRenderListBox(renderer())->listIndexAtOffset(toIntSize (localOffset)); |
| 1311 if (listIndex >= 0) { | 1313 if (listIndex >= 0) { |
| 1312 if (!isDisabledFormControl()) { | 1314 if (!isDisabledFormControl()) { |
| 1313 if (m_multiple) { | 1315 if (m_multiple) { |
| 1314 // Only extend selection if there is something selected. | 1316 // Only extend selection if there is something selected. |
| 1315 if (m_activeSelectionAnchorIndex < 0) | 1317 if (m_activeSelectionAnchorIndex < 0) |
| 1316 return; | 1318 return; |
| 1317 | 1319 |
| 1318 setActiveSelectionEndIndex(listIndex); | 1320 setActiveSelectionEndIndex(listIndex); |
| 1319 updateListBoxSelection(false); | 1321 updateListBoxSelection(false); |
| 1320 } else { | 1322 } else { |
| 1321 setActiveSelectionAnchorIndex(listIndex); | 1323 setActiveSelectionAnchorIndex(listIndex); |
| 1322 setActiveSelectionEndIndex(listIndex); | 1324 setActiveSelectionEndIndex(listIndex); |
| 1323 updateListBoxSelection(true); | 1325 updateListBoxSelection(true); |
| 1324 } | 1326 } |
| 1325 } | 1327 } |
| 1326 event->setDefaultHandled(); | 1328 // event->setDefaultHandled(); |
|
eseidel
2013/12/28 19:57:00
Please don't commit commented out code.
gnana
2014/01/03 07:50:02
Done.
| |
| 1327 } | 1329 } |
| 1328 } else if (event->type() == EventTypeNames::mouseup && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton && renderer() && !toRenderBox(re nderer())->autoscrollInProgress()) { | 1330 } 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. | 1331 // We didn't start this click/drag on any options. |
| 1330 if (m_lastOnChangeSelection.isEmpty()) | 1332 if (m_lastOnChangeSelection.isEmpty()) |
| 1331 return; | 1333 return; |
| 1332 // This makes sure we fire dispatchFormControlChangeEvent for a single | 1334 // This makes sure we fire dispatchFormControlChangeEvent for a single |
| 1333 // click. For drag selection, onChange will fire when the autoscroll | 1335 // click. For drag selection, onChange will fire when the autoscroll |
| 1334 // timer stops. | 1336 // timer stops. |
| 1335 listBoxOnChange(); | 1337 if (!isOnChangeFired()) { |
| 1338 setOnChangeFired(true); | |
| 1339 listBoxOnChange(); | |
| 1340 } | |
| 1336 } else if (event->type() == EventTypeNames::keydown) { | 1341 } else if (event->type() == EventTypeNames::keydown) { |
| 1337 if (!event->isKeyboardEvent()) | 1342 if (!event->isKeyboardEvent()) |
| 1338 return; | 1343 return; |
| 1339 const String& keyIdentifier = toKeyboardEvent(event)->keyIdentifier(); | 1344 const String& keyIdentifier = toKeyboardEvent(event)->keyIdentifier(); |
| 1340 | 1345 |
| 1341 bool handled = false; | 1346 bool handled = false; |
| 1342 int endIndex = 0; | 1347 int endIndex = 0; |
| 1343 if (m_activeSelectionEndIndex < 0) { | 1348 if (m_activeSelectionEndIndex < 0) { |
| 1344 // Initialize the end index | 1349 // Initialize the end index |
| 1345 if (keyIdentifier == "Down" || keyIdentifier == "PageDown") { | 1350 if (keyIdentifier == "Down" || keyIdentifier == "PageDown") { |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1576 remove(index); | 1581 remove(index); |
| 1577 return true; | 1582 return true; |
| 1578 } | 1583 } |
| 1579 | 1584 |
| 1580 bool HTMLSelectElement::isInteractiveContent() const | 1585 bool HTMLSelectElement::isInteractiveContent() const |
| 1581 { | 1586 { |
| 1582 return true; | 1587 return true; |
| 1583 } | 1588 } |
| 1584 | 1589 |
| 1585 } // namespace | 1590 } // namespace |
| OLD | NEW |