| 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 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1328 } | 1328 } |
| 1329 | 1329 |
| 1330 if (!LayoutTheme::theme().popsMenuByReturnKey() && keyCode == '\r') { | 1330 if (!LayoutTheme::theme().popsMenuByReturnKey() && keyCode == '\r') { |
| 1331 if (form()) | 1331 if (form()) |
| 1332 form()->submitImplicitly(event, false); | 1332 form()->submitImplicitly(event, false); |
| 1333 dispatchInputAndChangeEventForMenuList(); | 1333 dispatchInputAndChangeEventForMenuList(); |
| 1334 event->setDefaultHandled(); | 1334 event->setDefaultHandled(); |
| 1335 } | 1335 } |
| 1336 } | 1336 } |
| 1337 | 1337 |
| 1338 if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && t
oMouseEvent(event)->button() == static_cast<short>(WebPointerProperties::Button:
:Left)) { | 1338 if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && t
oMouseEvent(event)->button() == LeftButton) { |
| 1339 InputDeviceCapabilities* sourceCapabilities = toMouseEvent(event)->fromT
ouch() ? InputDeviceCapabilities::firesTouchEventsSourceCapabilities() : InputDe
viceCapabilities::doesntFireTouchEventsSourceCapabilities(); | 1339 InputDeviceCapabilities* sourceCapabilities = toMouseEvent(event)->fromT
ouch() ? InputDeviceCapabilities::firesTouchEventsSourceCapabilities() : InputDe
viceCapabilities::doesntFireTouchEventsSourceCapabilities(); |
| 1340 focus(FocusParams(SelectionBehaviorOnFocus::Restore, WebFocusTypeNone, s
ourceCapabilities)); | 1340 focus(FocusParams(SelectionBehaviorOnFocus::Restore, WebFocusTypeNone, s
ourceCapabilities)); |
| 1341 if (layoutObject() && layoutObject()->isMenuList() && !isDisabledFormCon
trol()) { | 1341 if (layoutObject() && layoutObject()->isMenuList() && !isDisabledFormCon
trol()) { |
| 1342 if (popupIsVisible()) { | 1342 if (popupIsVisible()) { |
| 1343 hidePopup(); | 1343 hidePopup(); |
| 1344 } else { | 1344 } else { |
| 1345 // Save the selection so it can be compared to the new selection | 1345 // Save the selection so it can be compared to the new selection |
| 1346 // when we call onChange during selectOption, which gets called | 1346 // when we call onChange during selectOption, which gets called |
| 1347 // from selectOptionByPopup, which gets called after the user | 1347 // from selectOptionByPopup, which gets called after the user |
| 1348 // makes a selection from the menu. | 1348 // makes a selection from the menu. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1456 // Convert to coords relative to the list box if needed. | 1456 // Convert to coords relative to the list box if needed. |
| 1457 GestureEvent& gestureEvent = toGestureEvent(*event); | 1457 GestureEvent& gestureEvent = toGestureEvent(*event); |
| 1458 if (HTMLOptionElement* option = eventTargetOption(gestureEvent)) { | 1458 if (HTMLOptionElement* option = eventTargetOption(gestureEvent)) { |
| 1459 if (!isDisabledFormControl()) { | 1459 if (!isDisabledFormControl()) { |
| 1460 updateSelectedState(option, true, gestureEvent.shiftKey()); | 1460 updateSelectedState(option, true, gestureEvent.shiftKey()); |
| 1461 listBoxOnChange(); | 1461 listBoxOnChange(); |
| 1462 } | 1462 } |
| 1463 event->setDefaultHandled(); | 1463 event->setDefaultHandled(); |
| 1464 } | 1464 } |
| 1465 | 1465 |
| 1466 } else if (event->type() == EventTypeNames::mousedown && event->isMouseEvent
() && toMouseEvent(event)->button() == static_cast<short>(WebPointerProperties::
Button::Left)) { | 1466 } else if (event->type() == EventTypeNames::mousedown && event->isMouseEvent
() && toMouseEvent(event)->button() == LeftButton) { |
| 1467 focus(); | 1467 focus(); |
| 1468 // Calling focus() may cause us to lose our layoutObject, in which case | 1468 // Calling focus() may cause us to lose our layoutObject, in which case |
| 1469 // do not want to handle the event. | 1469 // do not want to handle the event. |
| 1470 if (!layoutObject() || !layoutObject()->isListBox() || isDisabledFormCon
trol()) | 1470 if (!layoutObject() || !layoutObject()->isListBox() || isDisabledFormCon
trol()) |
| 1471 return; | 1471 return; |
| 1472 | 1472 |
| 1473 // Convert to coords relative to the list box if needed. | 1473 // Convert to coords relative to the list box if needed. |
| 1474 MouseEvent* mouseEvent = toMouseEvent(event); | 1474 MouseEvent* mouseEvent = toMouseEvent(event); |
| 1475 if (HTMLOptionElement* option = eventTargetOption(*mouseEvent)) { | 1475 if (HTMLOptionElement* option = eventTargetOption(*mouseEvent)) { |
| 1476 if (!isDisabledFormControl()) { | 1476 if (!isDisabledFormControl()) { |
| 1477 #if OS(MACOSX) | 1477 #if OS(MACOSX) |
| 1478 updateSelectedState(option, mouseEvent->metaKey(), mouseEvent->s
hiftKey()); | 1478 updateSelectedState(option, mouseEvent->metaKey(), mouseEvent->s
hiftKey()); |
| 1479 #else | 1479 #else |
| 1480 updateSelectedState(option, mouseEvent->ctrlKey(), mouseEvent->s
hiftKey()); | 1480 updateSelectedState(option, mouseEvent->ctrlKey(), mouseEvent->s
hiftKey()); |
| 1481 #endif | 1481 #endif |
| 1482 } | 1482 } |
| 1483 if (LocalFrame* frame = document().frame()) | 1483 if (LocalFrame* frame = document().frame()) |
| 1484 frame->eventHandler().setMouseDownMayStartAutoscroll(); | 1484 frame->eventHandler().setMouseDownMayStartAutoscroll(); |
| 1485 | 1485 |
| 1486 event->setDefaultHandled(); | 1486 event->setDefaultHandled(); |
| 1487 } | 1487 } |
| 1488 | 1488 |
| 1489 } else if (event->type() == EventTypeNames::mousemove && event->isMouseEvent
()) { | 1489 } else if (event->type() == EventTypeNames::mousemove && event->isMouseEvent
()) { |
| 1490 MouseEvent* mouseEvent = toMouseEvent(event); | 1490 MouseEvent* mouseEvent = toMouseEvent(event); |
| 1491 if (mouseEvent->button() != static_cast<short>(WebPointerProperties::But
ton::Left) || !mouseEvent->buttonDown()) | 1491 if (mouseEvent->button() != LeftButton || !mouseEvent->buttonDown()) |
| 1492 return; | 1492 return; |
| 1493 | 1493 |
| 1494 if (Page* page = document().page()) | 1494 if (Page* page = document().page()) |
| 1495 page->autoscrollController().startAutoscrollForSelection(layoutObjec
t()); | 1495 page->autoscrollController().startAutoscrollForSelection(layoutObjec
t()); |
| 1496 // Mousedown didn't happen in this element. | 1496 // Mousedown didn't happen in this element. |
| 1497 if (m_lastOnChangeSelection.isEmpty()) | 1497 if (m_lastOnChangeSelection.isEmpty()) |
| 1498 return; | 1498 return; |
| 1499 | 1499 |
| 1500 if (HTMLOptionElement* option = eventTargetOption(*mouseEvent)) { | 1500 if (HTMLOptionElement* option = eventTargetOption(*mouseEvent)) { |
| 1501 if (!isDisabledFormControl()) { | 1501 if (!isDisabledFormControl()) { |
| 1502 if (m_multiple) { | 1502 if (m_multiple) { |
| 1503 // Only extend selection if there is something selected. | 1503 // Only extend selection if there is something selected. |
| 1504 if (!m_activeSelectionAnchor) | 1504 if (!m_activeSelectionAnchor) |
| 1505 return; | 1505 return; |
| 1506 | 1506 |
| 1507 setActiveSelectionEnd(option); | 1507 setActiveSelectionEnd(option); |
| 1508 updateListBoxSelection(false); | 1508 updateListBoxSelection(false); |
| 1509 } else { | 1509 } else { |
| 1510 setActiveSelectionAnchor(option); | 1510 setActiveSelectionAnchor(option); |
| 1511 setActiveSelectionEnd(option); | 1511 setActiveSelectionEnd(option); |
| 1512 updateListBoxSelection(true); | 1512 updateListBoxSelection(true); |
| 1513 } | 1513 } |
| 1514 } | 1514 } |
| 1515 } | 1515 } |
| 1516 | 1516 |
| 1517 } else if (event->type() == EventTypeNames::mouseup && event->isMouseEvent()
&& toMouseEvent(event)->button() == static_cast<short>(WebPointerProperties::Bu
tton::Left) && layoutObject()) { | 1517 } else if (event->type() == EventTypeNames::mouseup && event->isMouseEvent()
&& toMouseEvent(event)->button() == LeftButton && layoutObject()) { |
| 1518 if (document().page() && document().page()->autoscrollController().autos
crollInProgress(toLayoutBox(layoutObject()))) | 1518 if (document().page() && document().page()->autoscrollController().autos
crollInProgress(toLayoutBox(layoutObject()))) |
| 1519 document().page()->autoscrollController().stopAutoscroll(); | 1519 document().page()->autoscrollController().stopAutoscroll(); |
| 1520 else | 1520 else |
| 1521 handleMouseRelease(); | 1521 handleMouseRelease(); |
| 1522 | 1522 |
| 1523 } else if (event->type() == EventTypeNames::keydown) { | 1523 } else if (event->type() == EventTypeNames::keydown) { |
| 1524 if (!event->isKeyboardEvent()) | 1524 if (!event->isKeyboardEvent()) |
| 1525 return; | 1525 return; |
| 1526 const String& key = toKeyboardEvent(event)->key(); | 1526 const String& key = toKeyboardEvent(event)->key(); |
| 1527 | 1527 |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2023 } | 2023 } |
| 2024 | 2024 |
| 2025 void HTMLSelectElement::didMutateSubtree() | 2025 void HTMLSelectElement::didMutateSubtree() |
| 2026 { | 2026 { |
| 2027 DCHECK(popupIsVisible()); | 2027 DCHECK(popupIsVisible()); |
| 2028 DCHECK(m_popup); | 2028 DCHECK(m_popup); |
| 2029 m_popup->updateFromElement(PopupMenu::ByDOMChange); | 2029 m_popup->updateFromElement(PopupMenu::ByDOMChange); |
| 2030 } | 2030 } |
| 2031 | 2031 |
| 2032 } // namespace blink | 2032 } // namespace blink |
| OLD | NEW |