Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(590)

Side by Side Diff: Source/web/WebPagePopupImpl.cpp

Issue 736883002: Implement <select> Popup Menu using PagePopup (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed tests for mac Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/web/WebPagePopupImpl.h ('k') | Source/web/web.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 30 matching lines...) Expand all
41 #include "core/page/DOMWindowPagePopup.h" 41 #include "core/page/DOMWindowPagePopup.h"
42 #include "core/page/EventHandler.h" 42 #include "core/page/EventHandler.h"
43 #include "core/page/FocusController.h" 43 #include "core/page/FocusController.h"
44 #include "core/page/Page.h" 44 #include "core/page/Page.h"
45 #include "core/page/PagePopupClient.h" 45 #include "core/page/PagePopupClient.h"
46 #include "core/rendering/RenderView.h" 46 #include "core/rendering/RenderView.h"
47 #include "modules/accessibility/AXObject.h" 47 #include "modules/accessibility/AXObject.h"
48 #include "modules/accessibility/AXObjectCacheImpl.h" 48 #include "modules/accessibility/AXObjectCacheImpl.h"
49 #include "platform/EventDispatchForbiddenScope.h" 49 #include "platform/EventDispatchForbiddenScope.h"
50 #include "platform/LayoutTestSupport.h" 50 #include "platform/LayoutTestSupport.h"
51 #include "platform/ScriptForbiddenScope.h"
51 #include "platform/TraceEvent.h" 52 #include "platform/TraceEvent.h"
52 #include "platform/heap/Handle.h" 53 #include "platform/heap/Handle.h"
53 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h" 54 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h"
54 #include "public/platform/WebCursorInfo.h" 55 #include "public/platform/WebCursorInfo.h"
55 #include "public/web/WebAXObject.h" 56 #include "public/web/WebAXObject.h"
56 #include "public/web/WebFrameClient.h" 57 #include "public/web/WebFrameClient.h"
57 #include "public/web/WebViewClient.h" 58 #include "public/web/WebViewClient.h"
58 #include "public/web/WebWidgetClient.h" 59 #include "public/web/WebWidgetClient.h"
59 #include "web/WebInputEventConversion.h" 60 #include "web/WebInputEventConversion.h"
60 #include "web/WebLocalFrameImpl.h" 61 #include "web/WebLocalFrameImpl.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 { 167 {
167 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(m_popup->m_popup Client->ownerElement().document().frame()); 168 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(m_popup->m_popup Client->ownerElement().document().frame());
168 if (obj && frame && frame->client()) 169 if (obj && frame && frame->client())
169 frame->client()->postAccessibilityEvent(WebAXObject(obj), static_cas t<WebAXEvent>(notification)); 170 frame->client()->postAccessibilityEvent(WebAXObject(obj), static_cas t<WebAXEvent>(notification));
170 171
171 // FIXME: Delete these lines once Chromium only uses the frame client in terface, above. 172 // FIXME: Delete these lines once Chromium only uses the frame client in terface, above.
172 if (obj && m_popup->m_webView->client()) 173 if (obj && m_popup->m_webView->client())
173 m_popup->m_webView->client()->postAccessibilityEvent(WebAXObject(obj ), static_cast<WebAXEvent>(notification)); 174 m_popup->m_webView->client()->postAccessibilityEvent(WebAXObject(obj ), static_cast<WebAXEvent>(notification));
174 } 175 }
175 176
177 virtual void setToolTip(const String& tooltipText, TextDirection dir) overri de
178 {
179 if (m_popup->m_webView->client())
180 m_popup->m_webView->client()->setToolTipText(tooltipText, toWebTextD irection(dir));
181 }
182
176 WebPagePopupImpl* m_popup; 183 WebPagePopupImpl* m_popup;
177 }; 184 };
178 185
179 class PagePopupFeaturesClient : public ContextFeaturesClient { 186 class PagePopupFeaturesClient : public ContextFeaturesClient {
180 virtual bool isEnabled(Document*, ContextFeatures::FeatureType, bool) overri de; 187 virtual bool isEnabled(Document*, ContextFeatures::FeatureType, bool) overri de;
181 }; 188 };
182 189
183 bool PagePopupFeaturesClient::isEnabled(Document*, ContextFeatures::FeatureType type, bool defaultValue) 190 bool PagePopupFeaturesClient::isEnabled(Document*, ContextFeatures::FeatureType type, bool defaultValue)
184 { 191 {
185 if (type == ContextFeatures::PagePopup) 192 if (type == ContextFeatures::PagePopup)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 if (AXObjectCache* cache = m_popupClient->ownerElement().document().existing AXObjectCache()) 255 if (AXObjectCache* cache = m_popupClient->ownerElement().document().existing AXObjectCache())
249 cache->childrenChanged(&m_popupClient->ownerElement()); 256 cache->childrenChanged(&m_popupClient->ownerElement());
250 257
251 ASSERT(frame->localDOMWindow()); 258 ASSERT(frame->localDOMWindow());
252 DOMWindowPagePopup::install(*frame->localDOMWindow(), m_popupClient); 259 DOMWindowPagePopup::install(*frame->localDOMWindow(), m_popupClient);
253 ASSERT(m_popupClient->ownerElement().document().existingAXObjectCache() == f rame->document()->existingAXObjectCache()); 260 ASSERT(m_popupClient->ownerElement().document().existingAXObjectCache() == f rame->document()->existingAXObjectCache());
254 261
255 RefPtr<SharedBuffer> data = SharedBuffer::create(); 262 RefPtr<SharedBuffer> data = SharedBuffer::create();
256 m_popupClient->writeDocument(data.get()); 263 m_popupClient->writeDocument(data.get());
257 frame->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data, "t ext/html", "UTF-8", KURL(), ForceSynchronousLoad))); 264 frame->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data, "t ext/html", "UTF-8", KURL(), ForceSynchronousLoad)));
265
266 m_popupClient->didWriteDocument(*frame->document());
267
258 return true; 268 return true;
259 } 269 }
260 270
271 void WebPagePopupImpl::postMessage(const String& message)
272 {
273 if (!m_page)
274 return;
275 ScriptForbiddenScope::AllowUserAgentScript allowScript;
276 if (LocalDOMWindow* window = toLocalFrame(m_page->mainFrame())->localDOMWind ow())
277 window->dispatchEvent(MessageEvent::create(message));
278 }
279
261 void WebPagePopupImpl::destroyPage() 280 void WebPagePopupImpl::destroyPage()
262 { 281 {
263 if (!m_page) 282 if (!m_page)
264 return; 283 return;
265 284
266 m_page->willBeDestroyed(); 285 m_page->willBeDestroyed();
267 m_page.clear(); 286 m_page.clear();
268 } 287 }
269 288
270 AXObject* WebPagePopupImpl::rootAXObject() 289 AXObject* WebPagePopupImpl::rootAXObject()
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 // A WebPagePopupImpl instance usually has two references. 484 // A WebPagePopupImpl instance usually has two references.
466 // - One owned by the instance itself. It represents the visible widget. 485 // - One owned by the instance itself. It represents the visible widget.
467 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the 486 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the
468 // WebPagePopupImpl to close. 487 // WebPagePopupImpl to close.
469 // We need them because the closing operation is asynchronous and the widget 488 // We need them because the closing operation is asynchronous and the widget
470 // can be closed while the WebViewImpl is unaware of it. 489 // can be closed while the WebViewImpl is unaware of it.
471 return adoptRef(new WebPagePopupImpl(client)).leakRef(); 490 return adoptRef(new WebPagePopupImpl(client)).leakRef();
472 } 491 }
473 492
474 } // namespace blink 493 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebPagePopupImpl.h ('k') | Source/web/web.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698