| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "web/ExternalPopupMenu.h" | 31 #include "web/ExternalPopupMenu.h" |
| 32 | 32 |
| 33 #include "core/dom/ExecutionContextTask.h" | |
| 34 #include "core/dom/NodeComputedStyle.h" | 33 #include "core/dom/NodeComputedStyle.h" |
| 35 #include "core/dom/TaskRunnerHelper.h" | 34 #include "core/dom/TaskRunnerHelper.h" |
| 36 #include "core/frame/FrameHost.h" | 35 #include "core/frame/FrameHost.h" |
| 37 #include "core/frame/FrameView.h" | 36 #include "core/frame/FrameView.h" |
| 38 #include "core/frame/LocalFrame.h" | 37 #include "core/frame/LocalFrame.h" |
| 39 #include "core/html/HTMLOptionElement.h" | 38 #include "core/html/HTMLOptionElement.h" |
| 40 #include "core/html/HTMLSelectElement.h" | 39 #include "core/html/HTMLSelectElement.h" |
| 41 #include "core/layout/LayoutBox.h" | 40 #include "core/layout/LayoutBox.h" |
| 42 #include "core/page/Page.h" | 41 #include "core/page/Page.h" |
| 43 #include "core/style/ComputedStyle.h" | 42 #include "core/style/ComputedStyle.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 m_webExternalPopupMenu = 0; | 139 m_webExternalPopupMenu = 0; |
| 141 } | 140 } |
| 142 | 141 |
| 143 void ExternalPopupMenu::updateFromElement(UpdateReason reason) { | 142 void ExternalPopupMenu::updateFromElement(UpdateReason reason) { |
| 144 switch (reason) { | 143 switch (reason) { |
| 145 case BySelectionChange: | 144 case BySelectionChange: |
| 146 case ByDOMChange: | 145 case ByDOMChange: |
| 147 if (m_needsUpdate) | 146 if (m_needsUpdate) |
| 148 return; | 147 return; |
| 149 m_needsUpdate = true; | 148 m_needsUpdate = true; |
| 150 m_ownerElement->document().postTask( | 149 TaskRunnerHelper::get(TaskType::UserInteraction, |
| 151 TaskType::UserInteraction, BLINK_FROM_HERE, | 150 &m_ownerElement->document()) |
| 152 createSameThreadTask(&ExternalPopupMenu::update, | 151 ->postTask(BLINK_FROM_HERE, WTF::bind(&ExternalPopupMenu::update, |
| 153 wrapPersistent(this))); | 152 wrapPersistent(this))); |
| 154 break; | 153 break; |
| 155 | 154 |
| 156 case ByStyleChange: | 155 case ByStyleChange: |
| 157 // TOOD(tkent): We should update the popup location/content in some | 156 // TOOD(tkent): We should update the popup location/content in some |
| 158 // cases. e.g. Updating ComputedStyle of the SELECT element affects | 157 // cases. e.g. Updating ComputedStyle of the SELECT element affects |
| 159 // popup position and OPTION style. | 158 // popup position and OPTION style. |
| 160 break; | 159 break; |
| 161 } | 160 } |
| 162 } | 161 } |
| 163 | 162 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 if (ownerElement.itemIsDisplayNone(*items[i])) | 301 if (ownerElement.itemIsDisplayNone(*items[i])) |
| 303 continue; | 302 continue; |
| 304 if (popupMenuItemIndex == i) | 303 if (popupMenuItemIndex == i) |
| 305 return indexTracker; | 304 return indexTracker; |
| 306 ++indexTracker; | 305 ++indexTracker; |
| 307 } | 306 } |
| 308 return -1; | 307 return -1; |
| 309 } | 308 } |
| 310 | 309 |
| 311 } // namespace blink | 310 } // namespace blink |
| OLD | NEW |