| 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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights |
| 7 * reserved. | 7 * reserved. |
| 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 9 * Copyright (C) 2010 Google Inc. All rights reserved. | 9 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 10 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 10 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "core/html/HTMLSelectElement.h" | 30 #include "core/html/HTMLSelectElement.h" |
| 31 | 31 |
| 32 #include "bindings/core/v8/ExceptionMessages.h" | 32 #include "bindings/core/v8/ExceptionMessages.h" |
| 33 #include "bindings/core/v8/ExceptionState.h" | 33 #include "bindings/core/v8/ExceptionState.h" |
| 34 #include "bindings/core/v8/HTMLElementOrLong.h" | 34 #include "bindings/core/v8/HTMLElementOrLong.h" |
| 35 #include "bindings/core/v8/HTMLOptionElementOrHTMLOptGroupElement.h" | 35 #include "bindings/core/v8/HTMLOptionElementOrHTMLOptGroupElement.h" |
| 36 #include "core/HTMLNames.h" | 36 #include "core/HTMLNames.h" |
| 37 #include "core/dom/AXObjectCache.h" | 37 #include "core/dom/AXObjectCache.h" |
| 38 #include "core/dom/Attribute.h" | 38 #include "core/dom/Attribute.h" |
| 39 #include "core/dom/ElementTraversal.h" | 39 #include "core/dom/ElementTraversal.h" |
| 40 #include "core/dom/ExecutionContextTask.h" | |
| 41 #include "core/dom/MutationCallback.h" | 40 #include "core/dom/MutationCallback.h" |
| 42 #include "core/dom/MutationObserver.h" | 41 #include "core/dom/MutationObserver.h" |
| 43 #include "core/dom/MutationObserverInit.h" | 42 #include "core/dom/MutationObserverInit.h" |
| 44 #include "core/dom/MutationRecord.h" | 43 #include "core/dom/MutationRecord.h" |
| 45 #include "core/dom/NodeComputedStyle.h" | 44 #include "core/dom/NodeComputedStyle.h" |
| 46 #include "core/dom/NodeListsNodeData.h" | 45 #include "core/dom/NodeListsNodeData.h" |
| 47 #include "core/dom/NodeTraversal.h" | 46 #include "core/dom/NodeTraversal.h" |
| 48 #include "core/dom/TaskRunnerHelper.h" | 47 #include "core/dom/TaskRunnerHelper.h" |
| 49 #include "core/events/GestureEvent.h" | 48 #include "core/events/GestureEvent.h" |
| 50 #include "core/events/KeyboardEvent.h" | 49 #include "core/events/KeyboardEvent.h" |
| (...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 if (!option) | 887 if (!option) |
| 889 return; | 888 return; |
| 890 if (usesMenuList()) | 889 if (usesMenuList()) |
| 891 return; | 890 return; |
| 892 bool hasPendingTask = m_optionToScrollTo; | 891 bool hasPendingTask = m_optionToScrollTo; |
| 893 // We'd like to keep an HTMLOptionElement reference rather than the index of | 892 // We'd like to keep an HTMLOptionElement reference rather than the index of |
| 894 // the option because the task should work even if unselected option is | 893 // the option because the task should work even if unselected option is |
| 895 // inserted before executing scrollToOptionTask(). | 894 // inserted before executing scrollToOptionTask(). |
| 896 m_optionToScrollTo = option; | 895 m_optionToScrollTo = option; |
| 897 if (!hasPendingTask) | 896 if (!hasPendingTask) |
| 898 document().postTask( | 897 TaskRunnerHelper::get(TaskType::UserInteraction, &document()) |
| 899 TaskType::UserInteraction, BLINK_FROM_HERE, | 898 ->postTask(BLINK_FROM_HERE, |
| 900 createSameThreadTask(&HTMLSelectElement::scrollToOptionTask, | 899 WTF::bind(&HTMLSelectElement::scrollToOptionTask, |
| 901 wrapPersistent(this))); | 900 wrapPersistent(this))); |
| 902 } | 901 } |
| 903 | 902 |
| 904 void HTMLSelectElement::scrollToOptionTask() { | 903 void HTMLSelectElement::scrollToOptionTask() { |
| 905 HTMLOptionElement* option = m_optionToScrollTo.release(); | 904 HTMLOptionElement* option = m_optionToScrollTo.release(); |
| 906 if (!option || !isConnected()) | 905 if (!option || !isConnected()) |
| 907 return; | 906 return; |
| 908 // optionRemoved() makes sure m_optionToScrollTo doesn't have an option with | 907 // optionRemoved() makes sure m_optionToScrollTo doesn't have an option with |
| 909 // another owner. | 908 // another owner. |
| 910 DCHECK_EQ(option->ownerSelectElement(), this); | 909 DCHECK_EQ(option->ownerSelectElement(), this); |
| (...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2042 m_popupUpdater = nullptr; | 2041 m_popupUpdater = nullptr; |
| 2043 } | 2042 } |
| 2044 | 2043 |
| 2045 void HTMLSelectElement::didMutateSubtree() { | 2044 void HTMLSelectElement::didMutateSubtree() { |
| 2046 DCHECK(popupIsVisible()); | 2045 DCHECK(popupIsVisible()); |
| 2047 DCHECK(m_popup); | 2046 DCHECK(m_popup); |
| 2048 m_popup->updateFromElement(PopupMenu::ByDOMChange); | 2047 m_popup->updateFromElement(PopupMenu::ByDOMChange); |
| 2049 } | 2048 } |
| 2050 | 2049 |
| 2051 } // namespace blink | 2050 } // namespace blink |
| OLD | NEW |