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 "config.h" | 5 #include "config.h" |
6 #include "web/PopupMenuImpl.h" | 6 #include "web/PopupMenuImpl.h" |
7 | 7 |
8 #include "core/HTMLNames.h" | 8 #include "core/HTMLNames.h" |
9 #include "core/css/CSSFontSelector.h" | 9 #include "core/css/CSSFontSelector.h" |
10 #include "core/dom/StyleEngine.h" | 10 #include "core/dom/StyleEngine.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 closePopup(); | 73 closePopup(); |
74 } | 74 } |
75 | 75 |
76 IntSize PopupMenuImpl::contentSize() | 76 IntSize PopupMenuImpl::contentSize() |
77 { | 77 { |
78 return IntSize(); | 78 return IntSize(); |
79 } | 79 } |
80 | 80 |
81 void PopupMenuImpl::writeDocument(SharedBuffer* data) | 81 void PopupMenuImpl::writeDocument(SharedBuffer* data) |
82 { | 82 { |
83 IntRect anchorRectInScreen = m_chromeClient->rootViewToScreen(m_client->elem
entRectRelativeToRootView()); | 83 IntRect anchorRectInScreen = m_chromeClient->viewportToScreen(m_client->elem
entRectRelativeToViewport()); |
84 | 84 |
85 PagePopupClient::addString("<!DOCTYPE html><head><meta charset='UTF-8'><styl
e>\n", data); | 85 PagePopupClient::addString("<!DOCTYPE html><head><meta charset='UTF-8'><styl
e>\n", data); |
86 data->append(Platform::current()->loadResource("pickerCommon.css")); | 86 data->append(Platform::current()->loadResource("pickerCommon.css")); |
87 data->append(Platform::current()->loadResource("listPicker.css")); | 87 data->append(Platform::current()->loadResource("listPicker.css")); |
88 PagePopupClient::addString("</style></head><body><div id=main>Loading...</di
v><script>\n" | 88 PagePopupClient::addString("</style></head><body><div id=main>Loading...</di
v><script>\n" |
89 "window.dialogArguments = {\n", data); | 89 "window.dialogArguments = {\n", data); |
90 addProperty("selectedIndex", m_client->selectedIndex(), data); | 90 addProperty("selectedIndex", m_client->selectedIndex(), data); |
91 PagePopupClient::addString("children: [\n", data); | 91 PagePopupClient::addString("children: [\n", data); |
92 for (HTMLElement& child : Traversal<HTMLElement>::childrenOf(ownerElement())
) { | 92 for (HTMLElement& child : Traversal<HTMLElement>::childrenOf(ownerElement())
) { |
93 if (isHTMLOptionElement(child)) | 93 if (isHTMLOptionElement(child)) |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 } | 259 } |
260 | 260 |
261 void PopupMenuImpl::dispose() | 261 void PopupMenuImpl::dispose() |
262 { | 262 { |
263 closePopup(); | 263 closePopup(); |
264 } | 264 } |
265 | 265 |
266 void PopupMenuImpl::show(const FloatQuad& /*controlPosition*/, const IntSize& /*
controlSize*/, int /*index*/) | 266 void PopupMenuImpl::show(const FloatQuad& /*controlPosition*/, const IntSize& /*
controlSize*/, int /*index*/) |
267 { | 267 { |
268 ASSERT(!m_popup); | 268 ASSERT(!m_popup); |
269 m_popup = m_chromeClient->openPagePopup(this, m_client->elementRectRelativeT
oRootView()); | 269 m_popup = m_chromeClient->openPagePopup(this); |
270 } | 270 } |
271 | 271 |
272 void PopupMenuImpl::hide() | 272 void PopupMenuImpl::hide() |
273 { | 273 { |
274 if (m_popup) | 274 if (m_popup) |
275 m_chromeClient->closePagePopup(m_popup); | 275 m_chromeClient->closePagePopup(m_popup); |
276 } | 276 } |
277 | 277 |
278 void PopupMenuImpl::updateFromElement() | 278 void PopupMenuImpl::updateFromElement() |
279 { | 279 { |
(...skipping 21 matching lines...) Expand all Loading... |
301 #if ENABLE(OILPAN) | 301 #if ENABLE(OILPAN) |
302 // Cannot be done during finalization, so instead done when the | 302 // Cannot be done during finalization, so instead done when the |
303 // render object is destroyed and disconnected. | 303 // render object is destroyed and disconnected. |
304 // | 304 // |
305 // FIXME: do this always, regardless of ENABLE(OILPAN). | 305 // FIXME: do this always, regardless of ENABLE(OILPAN). |
306 dispose(); | 306 dispose(); |
307 #endif | 307 #endif |
308 } | 308 } |
309 | 309 |
310 } // namespace blink | 310 } // namespace blink |
OLD | NEW |