| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "web/PopupMenuImpl.h" | 5 #include "web/PopupMenuImpl.h" |
| 6 | 6 |
| 7 #include "core/HTMLNames.h" | 7 #include "core/HTMLNames.h" |
| 8 #include "core/css/CSSFontSelector.h" | 8 #include "core/css/CSSFontSelector.h" |
| 9 #include "core/dom/ElementTraversal.h" | 9 #include "core/dom/ElementTraversal.h" |
| 10 #include "core/dom/ExecutionContextTask.h" | |
| 11 #include "core/dom/NodeComputedStyle.h" | 10 #include "core/dom/NodeComputedStyle.h" |
| 12 #include "core/dom/StyleEngine.h" | 11 #include "core/dom/StyleEngine.h" |
| 13 #include "core/dom/TaskRunnerHelper.h" | 12 #include "core/dom/TaskRunnerHelper.h" |
| 14 #include "core/events/ScopedEventQueue.h" | 13 #include "core/events/ScopedEventQueue.h" |
| 15 #include "core/frame/FrameView.h" | 14 #include "core/frame/FrameView.h" |
| 16 #include "core/frame/LocalFrame.h" | 15 #include "core/frame/LocalFrame.h" |
| 17 #include "core/html/HTMLHRElement.h" | 16 #include "core/html/HTMLHRElement.h" |
| 18 #include "core/html/HTMLOptGroupElement.h" | 17 #include "core/html/HTMLOptGroupElement.h" |
| 19 #include "core/html/HTMLOptionElement.h" | 18 #include "core/html/HTMLOptionElement.h" |
| 20 #include "core/html/HTMLSelectElement.h" | 19 #include "core/html/HTMLSelectElement.h" |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 } | 495 } |
| 497 | 496 |
| 498 void PopupMenuImpl::hide() { | 497 void PopupMenuImpl::hide() { |
| 499 closePopup(); | 498 closePopup(); |
| 500 } | 499 } |
| 501 | 500 |
| 502 void PopupMenuImpl::updateFromElement(UpdateReason) { | 501 void PopupMenuImpl::updateFromElement(UpdateReason) { |
| 503 if (m_needsUpdate) | 502 if (m_needsUpdate) |
| 504 return; | 503 return; |
| 505 m_needsUpdate = true; | 504 m_needsUpdate = true; |
| 506 ownerElement().document().postTask( | 505 TaskRunnerHelper::get(TaskType::UserInteraction, &ownerElement().document()) |
| 507 TaskType::UserInteraction, BLINK_FROM_HERE, | 506 ->postTask(BLINK_FROM_HERE, |
| 508 createSameThreadTask(&PopupMenuImpl::update, wrapPersistent(this))); | 507 WTF::bind(&PopupMenuImpl::update, wrapPersistent(this))); |
| 509 } | 508 } |
| 510 | 509 |
| 511 void PopupMenuImpl::update() { | 510 void PopupMenuImpl::update() { |
| 512 if (!m_popup || !m_ownerElement) | 511 if (!m_popup || !m_ownerElement) |
| 513 return; | 512 return; |
| 514 ownerElement().document().updateStyleAndLayoutTree(); | 513 ownerElement().document().updateStyleAndLayoutTree(); |
| 515 // disconnectClient() might have been called. | 514 // disconnectClient() might have been called. |
| 516 if (!m_ownerElement) | 515 if (!m_ownerElement) |
| 517 return; | 516 return; |
| 518 m_needsUpdate = false; | 517 m_needsUpdate = false; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 } | 555 } |
| 557 | 556 |
| 558 void PopupMenuImpl::disconnectClient() { | 557 void PopupMenuImpl::disconnectClient() { |
| 559 m_ownerElement = nullptr; | 558 m_ownerElement = nullptr; |
| 560 // Cannot be done during finalization, so instead done when the | 559 // Cannot be done during finalization, so instead done when the |
| 561 // layout object is destroyed and disconnected. | 560 // layout object is destroyed and disconnected. |
| 562 dispose(); | 561 dispose(); |
| 563 } | 562 } |
| 564 | 563 |
| 565 } // namespace blink | 564 } // namespace blink |
| OLD | NEW |