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

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

Issue 892083003: Revert Implement <select> Popup Menu using PagePopup (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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"
52 #include "platform/TraceEvent.h" 51 #include "platform/TraceEvent.h"
53 #include "platform/heap/Handle.h" 52 #include "platform/heap/Handle.h"
54 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h" 53 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h"
55 #include "public/platform/WebCursorInfo.h" 54 #include "public/platform/WebCursorInfo.h"
56 #include "public/web/WebAXObject.h" 55 #include "public/web/WebAXObject.h"
57 #include "public/web/WebFrameClient.h" 56 #include "public/web/WebFrameClient.h"
58 #include "public/web/WebViewClient.h" 57 #include "public/web/WebViewClient.h"
59 #include "public/web/WebWidgetClient.h" 58 #include "public/web/WebWidgetClient.h"
60 #include "web/WebInputEventConversion.h" 59 #include "web/WebInputEventConversion.h"
61 #include "web/WebLocalFrameImpl.h" 60 #include "web/WebLocalFrameImpl.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 { 166 {
168 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(m_popup->m_popup Client->ownerElement().document().frame()); 167 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(m_popup->m_popup Client->ownerElement().document().frame());
169 if (obj && frame && frame->client()) 168 if (obj && frame && frame->client())
170 frame->client()->postAccessibilityEvent(WebAXObject(obj), static_cas t<WebAXEvent>(notification)); 169 frame->client()->postAccessibilityEvent(WebAXObject(obj), static_cas t<WebAXEvent>(notification));
171 170
172 // FIXME: Delete these lines once Chromium only uses the frame client in terface, above. 171 // FIXME: Delete these lines once Chromium only uses the frame client in terface, above.
173 if (obj && m_popup->m_webView->client()) 172 if (obj && m_popup->m_webView->client())
174 m_popup->m_webView->client()->postAccessibilityEvent(WebAXObject(obj ), static_cast<WebAXEvent>(notification)); 173 m_popup->m_webView->client()->postAccessibilityEvent(WebAXObject(obj ), static_cast<WebAXEvent>(notification));
175 } 174 }
176 175
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
183 WebPagePopupImpl* m_popup; 176 WebPagePopupImpl* m_popup;
184 }; 177 };
185 178
186 class PagePopupFeaturesClient : public ContextFeaturesClient { 179 class PagePopupFeaturesClient : public ContextFeaturesClient {
187 virtual bool isEnabled(Document*, ContextFeatures::FeatureType, bool) overri de; 180 virtual bool isEnabled(Document*, ContextFeatures::FeatureType, bool) overri de;
188 }; 181 };
189 182
190 bool PagePopupFeaturesClient::isEnabled(Document*, ContextFeatures::FeatureType type, bool defaultValue) 183 bool PagePopupFeaturesClient::isEnabled(Document*, ContextFeatures::FeatureType type, bool defaultValue)
191 { 184 {
192 if (type == ContextFeatures::PagePopup) 185 if (type == ContextFeatures::PagePopup)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 if (AXObjectCache* cache = m_popupClient->ownerElement().document().existing AXObjectCache()) 248 if (AXObjectCache* cache = m_popupClient->ownerElement().document().existing AXObjectCache())
256 cache->childrenChanged(&m_popupClient->ownerElement()); 249 cache->childrenChanged(&m_popupClient->ownerElement());
257 250
258 ASSERT(frame->localDOMWindow()); 251 ASSERT(frame->localDOMWindow());
259 DOMWindowPagePopup::install(*frame->localDOMWindow(), m_popupClient); 252 DOMWindowPagePopup::install(*frame->localDOMWindow(), m_popupClient);
260 ASSERT(m_popupClient->ownerElement().document().existingAXObjectCache() == f rame->document()->existingAXObjectCache()); 253 ASSERT(m_popupClient->ownerElement().document().existingAXObjectCache() == f rame->document()->existingAXObjectCache());
261 254
262 RefPtr<SharedBuffer> data = SharedBuffer::create(); 255 RefPtr<SharedBuffer> data = SharedBuffer::create();
263 m_popupClient->writeDocument(data.get()); 256 m_popupClient->writeDocument(data.get());
264 frame->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data, "t ext/html", "UTF-8", KURL(), ForceSynchronousLoad))); 257 frame->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data, "t ext/html", "UTF-8", KURL(), ForceSynchronousLoad)));
265
266 m_popupClient->didWriteDocument(*frame->document());
267
268 return true; 258 return true;
269 } 259 }
270 260
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
280 void WebPagePopupImpl::destroyPage() 261 void WebPagePopupImpl::destroyPage()
281 { 262 {
282 if (!m_page) 263 if (!m_page)
283 return; 264 return;
284 265
285 m_page->willBeDestroyed(); 266 m_page->willBeDestroyed();
286 m_page.clear(); 267 m_page.clear();
287 } 268 }
288 269
289 AXObject* WebPagePopupImpl::rootAXObject() 270 AXObject* WebPagePopupImpl::rootAXObject()
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 // A WebPagePopupImpl instance usually has two references. 465 // A WebPagePopupImpl instance usually has two references.
485 // - One owned by the instance itself. It represents the visible widget. 466 // - One owned by the instance itself. It represents the visible widget.
486 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the 467 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the
487 // WebPagePopupImpl to close. 468 // WebPagePopupImpl to close.
488 // We need them because the closing operation is asynchronous and the widget 469 // We need them because the closing operation is asynchronous and the widget
489 // can be closed while the WebViewImpl is unaware of it. 470 // can be closed while the WebViewImpl is unaware of it.
490 return adoptRef(new WebPagePopupImpl(client)).leakRef(); 471 return adoptRef(new WebPagePopupImpl(client)).leakRef();
491 } 472 }
492 473
493 } // namespace blink 474 } // 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