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

Side by Side Diff: Source/core/html/HTMLPlugInElement.cpp

Issue 732783002: Reland HTMLPlugInElement: Use custom focus logic only when there is a plugin. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 1 month 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/core/html/HTMLPlugInElement.h ('k') | no next file » | 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de)
5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 LocalFrame* frame = toPluginView(widget)->pluginFrame(); 122 LocalFrame* frame = toPluginView(widget)->pluginFrame();
123 ASSERT(frame); 123 ASSERT(frame);
124 frame->registerPluginElement(this); 124 frame->registerPluginElement(this);
125 } 125 }
126 #endif 126 #endif
127 m_persistedPluginWidget = widget; 127 m_persistedPluginWidget = widget;
128 } 128 }
129 129
130 bool HTMLPlugInElement::canProcessDrag() const 130 bool HTMLPlugInElement::canProcessDrag() const
131 { 131 {
132 return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(plug inWidget())->canProcessDrag(); 132 if (Widget* widget = existingPluginWidget())
133 return widget->isPluginView() && toPluginView(widget)->canProcessDrag();
134 return false;
133 } 135 }
134 136
135 bool HTMLPlugInElement::willRespondToMouseClickEvents() 137 bool HTMLPlugInElement::willRespondToMouseClickEvents()
136 { 138 {
137 if (isDisabledFormControl()) 139 if (isDisabledFormControl())
138 return false; 140 return false;
139 RenderObject* r = renderer(); 141 RenderObject* r = renderer();
140 return r && (r->isEmbeddedObject() || r->isRenderPart()); 142 return r && (r->isEmbeddedObject() || r->isRenderPart());
141 } 143 }
142 144
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 305
304 // If the host dynamically turns off JavaScript (or Java) we will still 306 // If the host dynamically turns off JavaScript (or Java) we will still
305 // return the cached allocated Bindings::Instance. Not supporting this 307 // return the cached allocated Bindings::Instance. Not supporting this
306 // edge-case is OK. 308 // edge-case is OK.
307 if (!m_pluginWrapper) { 309 if (!m_pluginWrapper) {
308 Widget* plugin; 310 Widget* plugin;
309 311
310 if (m_persistedPluginWidget) 312 if (m_persistedPluginWidget)
311 plugin = m_persistedPluginWidget.get(); 313 plugin = m_persistedPluginWidget.get();
312 else 314 else
313 plugin = pluginWidget(); 315 plugin = pluginWidgetForJSBindings();
314 316
315 if (plugin) 317 if (plugin)
316 m_pluginWrapper = frame->script().createPluginWrapper(plugin); 318 m_pluginWrapper = frame->script().createPluginWrapper(plugin);
317 } 319 }
318 return m_pluginWrapper.get(); 320 return m_pluginWrapper.get();
319 } 321 }
320 322
321 Widget* HTMLPlugInElement::pluginWidget() const 323 Widget* HTMLPlugInElement::existingPluginWidget() const
324 {
325 if (RenderPart* renderPart = existingRenderPart())
326 return renderPart->widget();
327 return nullptr;
328 }
329
330 Widget* HTMLPlugInElement::pluginWidgetForJSBindings()
322 { 331 {
323 if (RenderPart* renderPart = renderPartForJSBindings()) 332 if (RenderPart* renderPart = renderPartForJSBindings())
324 return renderPart->widget(); 333 return renderPart->widget();
325 return nullptr; 334 return nullptr;
326 } 335 }
327 336
328 bool HTMLPlugInElement::isPresentationAttribute(const QualifiedName& name) const 337 bool HTMLPlugInElement::isPresentationAttribute(const QualifiedName& name) const
329 { 338 {
330 if (name == widthAttr || name == heightAttr || name == vspaceAttr || name == hspaceAttr || name == alignAttr) 339 if (name == widthAttr || name == heightAttr || name == vspaceAttr || name == hspaceAttr || name == alignAttr)
331 return true; 340 return true;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 { 392 {
384 // Needs to load the plugin immediatedly because this function is called 393 // Needs to load the plugin immediatedly because this function is called
385 // when JavaScript code accesses the plugin. 394 // when JavaScript code accesses the plugin.
386 // FIXME: Check if dispatching events here is safe. 395 // FIXME: Check if dispatching events here is safe.
387 document().updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks Synchronously); 396 document().updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks Synchronously);
388 return existingRenderPart(); 397 return existingRenderPart();
389 } 398 }
390 399
391 bool HTMLPlugInElement::isKeyboardFocusable() const 400 bool HTMLPlugInElement::isKeyboardFocusable() const
392 { 401 {
402 if (useFallbackContent() || usePlaceholderContent())
403 return HTMLElement::isKeyboardFocusable();
404
393 if (!document().isActive()) 405 if (!document().isActive())
394 return false; 406 return false;
395 return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(plug inWidget())->supportsKeyboardFocus(); 407
408 if (Widget* widget = existingPluginWidget())
409 return widget->isPluginView() && toPluginView(widget)->supportsKeyboardF ocus();
410
411 return false;
396 } 412 }
397 413
398 bool HTMLPlugInElement::hasCustomFocusLogic() const 414 bool HTMLPlugInElement::hasCustomFocusLogic() const
399 { 415 {
400 return !hasAuthorShadowRoot(); 416 return !useFallbackContent() && !usePlaceholderContent();
401 } 417 }
402 418
403 bool HTMLPlugInElement::isPluginElement() const 419 bool HTMLPlugInElement::isPluginElement() const
404 { 420 {
405 return true; 421 return true;
406 } 422 }
407 423
408 bool HTMLPlugInElement::rendererIsFocusable() const 424 bool HTMLPlugInElement::rendererIsFocusable() const
409 { 425 {
410 if (HTMLFrameOwnerElement::supportsFocus() && HTMLFrameOwnerElement::rendere rIsFocusable()) 426 if (HTMLFrameOwnerElement::supportsFocus() && HTMLFrameOwnerElement::rendere rIsFocusable())
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 return hasAuthorShadowRoot(); 662 return hasAuthorShadowRoot();
647 } 663 }
648 664
649 void HTMLPlugInElement::lazyReattachIfNeeded() 665 void HTMLPlugInElement::lazyReattachIfNeeded()
650 { 666 {
651 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate() && renderer() && !isImageType()) 667 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate() && renderer() && !isImageType())
652 lazyReattachIfAttached(); 668 lazyReattachIfAttached();
653 } 669 }
654 670
655 } 671 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLPlugInElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698