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" | 10 #include "core/dom/ExecutionContextTask.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 void PopupMenuImpl::writeDocument(SharedBuffer* data) | 246 void PopupMenuImpl::writeDocument(SharedBuffer* data) |
247 { | 247 { |
248 HTMLSelectElement& ownerElement = *m_ownerElement; | 248 HTMLSelectElement& ownerElement = *m_ownerElement; |
249 IntRect anchorRectInScreen = m_chromeClient->viewportToScreen(ownerElement.e
lementRectRelativeToViewport(), ownerElement.document().view()); | 249 IntRect anchorRectInScreen = m_chromeClient->viewportToScreen(ownerElement.e
lementRectRelativeToViewport(), ownerElement.document().view()); |
250 | 250 |
251 PagePopupClient::addString("<!DOCTYPE html><head><meta charset='UTF-8'><styl
e>\n", data); | 251 PagePopupClient::addString("<!DOCTYPE html><head><meta charset='UTF-8'><styl
e>\n", data); |
252 data->append(Platform::current()->loadResource("pickerCommon.css")); | 252 data->append(Platform::current()->loadResource("pickerCommon.css")); |
253 data->append(Platform::current()->loadResource("listPicker.css")); | 253 data->append(Platform::current()->loadResource("listPicker.css")); |
254 PagePopupClient::addString("</style></head><body><div id=main>Loading...</di
v><script>\n" | 254 PagePopupClient::addString("</style></head><body><div id=main>Loading...</di
v><script>\n" |
255 "window.dialogArguments = {\n", data); | 255 "window.dialogArguments = {\n", data); |
256 addProperty("selectedIndex", ownerElement.optionToListIndex(ownerElement.sel
ectedIndex()), data); | 256 addProperty("selectedIndex", ownerElement.selectedListIndex(), data); |
257 const ComputedStyle* ownerStyle = ownerElement.computedStyle(); | 257 const ComputedStyle* ownerStyle = ownerElement.computedStyle(); |
258 ItemIterationContext context(*ownerStyle, data); | 258 ItemIterationContext context(*ownerStyle, data); |
259 context.serializeBaseStyle(); | 259 context.serializeBaseStyle(); |
260 PagePopupClient::addString("children: [\n", data); | 260 PagePopupClient::addString("children: [\n", data); |
261 const HeapVector<Member<HTMLElement>>& items = ownerElement.listItems(); | 261 const HeapVector<Member<HTMLElement>>& items = ownerElement.listItems(); |
262 for (; context.m_listIndex < items.size(); ++context.m_listIndex) { | 262 for (; context.m_listIndex < items.size(); ++context.m_listIndex) { |
263 Element& child = *items[context.m_listIndex]; | 263 Element& child = *items[context.m_listIndex]; |
264 if (!isHTMLOptGroupElement(child.parentNode())) | 264 if (!isHTMLOptGroupElement(child.parentNode())) |
265 context.finishGroupIfNecessary(); | 265 context.finishGroupIfNecessary(); |
266 if (isHTMLOptionElement(child)) | 266 if (isHTMLOptionElement(child)) |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 | 520 |
521 void PopupMenuImpl::disconnectClient() | 521 void PopupMenuImpl::disconnectClient() |
522 { | 522 { |
523 m_ownerElement = nullptr; | 523 m_ownerElement = nullptr; |
524 // Cannot be done during finalization, so instead done when the | 524 // Cannot be done during finalization, so instead done when the |
525 // layout object is destroyed and disconnected. | 525 // layout object is destroyed and disconnected. |
526 dispose(); | 526 dispose(); |
527 } | 527 } |
528 | 528 |
529 } // namespace blink | 529 } // namespace blink |
OLD | NEW |