| 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 HTMLFormControlElementWithState::parseAttribute(name, value); | 315 HTMLFormControlElementWithState::parseAttribute(name, value); |
| 316 } | 316 } |
| 317 | 317 |
| 318 bool HTMLSelectElement::isKeyboardFocusable(KeyboardEvent* event) const | 318 bool HTMLSelectElement::isKeyboardFocusable(KeyboardEvent* event) const |
| 319 { | 319 { |
| 320 if (renderer()) | 320 if (renderer()) |
| 321 return isFocusable(); | 321 return isFocusable(); |
| 322 return HTMLFormControlElementWithState::isKeyboardFocusable(event); | 322 return HTMLFormControlElementWithState::isKeyboardFocusable(event); |
| 323 } | 323 } |
| 324 | 324 |
| 325 bool HTMLSelectElement::isMouseFocusable() const | 325 bool HTMLSelectElement::shouldShowFocusRingOnMouseFocus() const |
| 326 { | 326 { |
| 327 if (renderer()) | 327 return true; |
| 328 return isFocusable(); | |
| 329 return HTMLFormControlElementWithState::isMouseFocusable(); | |
| 330 } | 328 } |
| 331 | 329 |
| 332 bool HTMLSelectElement::canSelectAll() const | 330 bool HTMLSelectElement::canSelectAll() const |
| 333 { | 331 { |
| 334 return !usesMenuList(); | 332 return !usesMenuList(); |
| 335 } | 333 } |
| 336 | 334 |
| 337 RenderObject* HTMLSelectElement::createRenderer(RenderArena* arena, RenderStyle*
) | 335 RenderObject* HTMLSelectElement::createRenderer(RenderArena* arena, RenderStyle*
) |
| 338 { | 336 { |
| 339 if (usesMenuList()) | 337 if (usesMenuList()) |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 #endif | 1098 #endif |
| 1101 | 1099 |
| 1102 void HTMLSelectElement::menuListDefaultEventHandler(Event* event) | 1100 void HTMLSelectElement::menuListDefaultEventHandler(Event* event) |
| 1103 { | 1101 { |
| 1104 const Page* page = document()->page(); | 1102 const Page* page = document()->page(); |
| 1105 RefPtr<RenderTheme> renderTheme = page ? page->theme() : RenderTheme::defaul
tTheme(); | 1103 RefPtr<RenderTheme> renderTheme = page ? page->theme() : RenderTheme::defaul
tTheme(); |
| 1106 | 1104 |
| 1107 if (event->type() == eventNames().keydownEvent) { | 1105 if (event->type() == eventNames().keydownEvent) { |
| 1108 if (!renderer() || !event->isKeyboardEvent()) | 1106 if (!renderer() || !event->isKeyboardEvent()) |
| 1109 return; | 1107 return; |
| 1108 willHandleKeyDownEvent(); |
| 1110 | 1109 |
| 1111 if (platformHandleKeydownEvent(static_cast<KeyboardEvent*>(event))) | 1110 if (platformHandleKeydownEvent(static_cast<KeyboardEvent*>(event))) |
| 1112 return; | 1111 return; |
| 1113 | 1112 |
| 1114 // When using spatial navigation, we want to be able to navigate away | 1113 // When using spatial navigation, we want to be able to navigate away |
| 1115 // from the select element when the user hits any of the arrow keys, | 1114 // from the select element when the user hits any of the arrow keys, |
| 1116 // instead of changing the selection. | 1115 // instead of changing the selection. |
| 1117 if (isSpatialNavigationEnabled(document()->frame())) { | 1116 if (isSpatialNavigationEnabled(document()->frame())) { |
| 1118 if (!m_activeSelectionState) | 1117 if (!m_activeSelectionState) |
| 1119 return; | 1118 return; |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1341 // We didn't start this click/drag on any options. | 1340 // We didn't start this click/drag on any options. |
| 1342 if (m_lastOnChangeSelection.isEmpty()) | 1341 if (m_lastOnChangeSelection.isEmpty()) |
| 1343 return; | 1342 return; |
| 1344 // This makes sure we fire dispatchFormControlChangeEvent for a single | 1343 // This makes sure we fire dispatchFormControlChangeEvent for a single |
| 1345 // click. For drag selection, onChange will fire when the autoscroll | 1344 // click. For drag selection, onChange will fire when the autoscroll |
| 1346 // timer stops. | 1345 // timer stops. |
| 1347 listBoxOnChange(); | 1346 listBoxOnChange(); |
| 1348 } else if (event->type() == eventNames().keydownEvent) { | 1347 } else if (event->type() == eventNames().keydownEvent) { |
| 1349 if (!event->isKeyboardEvent()) | 1348 if (!event->isKeyboardEvent()) |
| 1350 return; | 1349 return; |
| 1350 willHandleKeyDownEvent(); |
| 1351 const String& keyIdentifier = static_cast<KeyboardEvent*>(event)->keyIde
ntifier(); | 1351 const String& keyIdentifier = static_cast<KeyboardEvent*>(event)->keyIde
ntifier(); |
| 1352 | 1352 |
| 1353 bool handled = false; | 1353 bool handled = false; |
| 1354 int endIndex = 0; | 1354 int endIndex = 0; |
| 1355 if (m_activeSelectionEndIndex < 0) { | 1355 if (m_activeSelectionEndIndex < 0) { |
| 1356 // Initialize the end index | 1356 // Initialize the end index |
| 1357 if (keyIdentifier == "Down" || keyIdentifier == "PageDown") { | 1357 if (keyIdentifier == "Down" || keyIdentifier == "PageDown") { |
| 1358 int startIndex = lastSelectedListIndex(); | 1358 int startIndex = lastSelectedListIndex(); |
| 1359 handled = true; | 1359 handled = true; |
| 1360 if (keyIdentifier == "Down") | 1360 if (keyIdentifier == "Down") |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1577 { | 1577 { |
| 1578 if (!value) { | 1578 if (!value) { |
| 1579 ec = TYPE_MISMATCH_ERR; | 1579 ec = TYPE_MISMATCH_ERR; |
| 1580 return false; | 1580 return false; |
| 1581 } | 1581 } |
| 1582 setOption(index, value.get(), ec); | 1582 setOption(index, value.get(), ec); |
| 1583 return true; | 1583 return true; |
| 1584 } | 1584 } |
| 1585 | 1585 |
| 1586 } // namespace | 1586 } // namespace |
| OLD | NEW |