Diff
Modified: trunk/Source/WebCore/ChangeLog (124953 => 124954)
--- trunk/Source/WebCore/ChangeLog 2012-08-08 00:46:26 UTC (rev 124953)
+++ trunk/Source/WebCore/ChangeLog 2012-08-08 00:54:36 UTC (rev 124954)
@@ -1,3 +1,32 @@
+2012-08-07 Fady Samuel <fsam...@chromium.org>
+
+ Allow plugins to decide whether they are keyboard focusable
+ https://bugs.webkit.org/show_bug.cgi?id=88958
+
+ Reviewed by Anders Carlsson.
+
+ * dom/Node.h:
+ (WebCore::Node::isPluginElement):
+ * html/HTMLEmbedElement.cpp:
+ (WebCore::HTMLEmbedElement::renderWidgetForJSBindings):
+ * html/HTMLEmbedElement.h:
+ (HTMLEmbedElement):
+ * html/HTMLObjectElement.cpp:
+ (WebCore::HTMLObjectElement::renderWidgetForJSBindings):
+ * html/HTMLObjectElement.h:
+ (HTMLObjectElement):
+ * html/HTMLPlugInElement.cpp:
+ (WebCore::HTMLPlugInElement::pluginWidget):
+ (WebCore::HTMLPlugInElement::isKeyboardFocusable):
+ (WebCore):
+ (WebCore::HTMLPlugInElement::isPluginElement):
+ * html/HTMLPlugInElement.h:
+ (HTMLPlugInElement):
+ * page/FocusController.cpp:
+ (WebCore::FocusController::advanceFocusInDocumentOrder):
+ * plugins/PluginViewBase.h:
+ (WebCore::PluginViewBase::supportsKeyboardFocus):
+
2012-08-07 Anna Cavender <ann...@chromium.org>
Create a MediaSource object.
Modified: trunk/Source/WebCore/dom/Node.h (124953 => 124954)
--- trunk/Source/WebCore/dom/Node.h 2012-08-08 00:46:26 UTC (rev 124953)
+++ trunk/Source/WebCore/dom/Node.h 2012-08-08 00:54:36 UTC (rev 124954)
@@ -222,6 +222,7 @@
virtual bool isAttributeNode() const { return false; }
virtual bool isCharacterDataNode() const { return false; }
virtual bool isFrameOwnerElement() const { return false; }
+ virtual bool isPluginElement() const { return false; }
bool isDocumentNode() const;
bool isShadowRoot() const { return getFlag(IsShadowRootFlag); }
bool inNamedFlow() const { return getFlag(InNamedFlowFlag); }
Modified: trunk/Source/WebCore/html/HTMLAppletElement.cpp (124953 => 124954)
--- trunk/Source/WebCore/html/HTMLAppletElement.cpp 2012-08-08 00:46:26 UTC (rev 124953)
+++ trunk/Source/WebCore/html/HTMLAppletElement.cpp 2012-08-08 00:54:36 UTC (rev 124954)
@@ -81,7 +81,7 @@
return new (document()->renderArena()) RenderApplet(this);
}
-RenderWidget* HTMLAppletElement::renderWidgetForJSBindings()
+RenderWidget* HTMLAppletElement::renderWidgetForJSBindings() const
{
if (!canEmbedJava())
return 0;
Modified: trunk/Source/WebCore/html/HTMLAppletElement.h (124953 => 124954)
--- trunk/Source/WebCore/html/HTMLAppletElement.h 2012-08-08 00:46:26 UTC (rev 124953)
+++ trunk/Source/WebCore/html/HTMLAppletElement.h 2012-08-08 00:54:36 UTC (rev 124954)
@@ -39,7 +39,7 @@
virtual bool rendererIsNeeded(const NodeRenderingContext&) OVERRIDE;
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) OVERRIDE;
- virtual RenderWidget* renderWidgetForJSBindings();
+ virtual RenderWidget* renderWidgetForJSBindings() const;
virtual void updateWidget(PluginCreationOption) OVERRIDE;
bool canEmbedJava() const;
Modified: trunk/Source/WebCore/html/HTMLEmbedElement.cpp (124953 => 124954)
--- trunk/Source/WebCore/html/HTMLEmbedElement.cpp 2012-08-08 00:46:26 UTC (rev 124953)
+++ trunk/Source/WebCore/html/HTMLEmbedElement.cpp 2012-08-08 00:54:36 UTC (rev 124954)
@@ -68,7 +68,7 @@
return 0;
}
-RenderWidget* HTMLEmbedElement::renderWidgetForJSBindings()
+RenderWidget* HTMLEmbedElement::renderWidgetForJSBindings() const
{
document()->updateLayoutIgnorePendingStylesheets();
return findWidgetRenderer(this);
Modified: trunk/Source/WebCore/html/HTMLEmbedElement.h (124953 => 124954)
--- trunk/Source/WebCore/html/HTMLEmbedElement.h 2012-08-08 00:46:26 UTC (rev 124953)
+++ trunk/Source/WebCore/html/HTMLEmbedElement.h 2012-08-08 00:54:36 UTC (rev 124954)
@@ -43,7 +43,7 @@
virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
virtual const QualifiedName& imageSourceAttributeName() const;
- virtual RenderWidget* renderWidgetForJSBindings();
+ virtual RenderWidget* renderWidgetForJSBindings() const;
virtual void updateWidget(PluginCreationOption);
Modified: trunk/Source/WebCore/html/HTMLObjectElement.cpp (124953 => 124954)
--- trunk/Source/WebCore/html/HTMLObjectElement.cpp 2012-08-08 00:46:26 UTC (rev 124953)
+++ trunk/Source/WebCore/html/HTMLObjectElement.cpp 2012-08-08 00:54:36 UTC (rev 124954)
@@ -73,7 +73,7 @@
return adoptRef(new HTMLObjectElement(tagName, document, form, createdByParser));
}
-RenderWidget* HTMLObjectElement::renderWidgetForJSBindings()
+RenderWidget* HTMLObjectElement::renderWidgetForJSBindings() const
{
document()->updateLayoutIgnorePendingStylesheets();
return renderPart(); // This will return 0 if the renderer is not a RenderPart.
Modified: trunk/Source/WebCore/html/HTMLObjectElement.h (124953 => 124954)
--- trunk/Source/WebCore/html/HTMLObjectElement.h 2012-08-08 00:46:26 UTC (rev 124953)
+++ trunk/Source/WebCore/html/HTMLObjectElement.h 2012-08-08 00:54:36 UTC (rev 124954)
@@ -82,7 +82,7 @@
virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
virtual const QualifiedName& imageSourceAttributeName() const;
- virtual RenderWidget* renderWidgetForJSBindings();
+ virtual RenderWidget* renderWidgetForJSBindings() const;
virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
Modified: trunk/Source/WebCore/html/HTMLPlugInElement.cpp (124953 => 124954)
--- trunk/Source/WebCore/html/HTMLPlugInElement.cpp 2012-08-08 00:46:26 UTC (rev 124953)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.cpp 2012-08-08 00:54:36 UTC (rev 124954)
@@ -33,6 +33,7 @@
#include "FrameTree.h"
#include "HTMLNames.h"
#include "Page.h"
+#include "PluginViewBase.h"
#include "RenderEmbeddedObject.h"
#include "RenderWidget.h"
#include "Settings.h"
@@ -125,7 +126,7 @@
return beforeLoadAllowedLoad;
}
-Widget* HTMLPlugInElement::pluginWidget()
+Widget* HTMLPlugInElement::pluginWidget() const
{
if (m_inBeforeLoadEventHandler) {
// The plug-in hasn't loaded yet, and it makes no sense to try to load if beforeload handler happened to touch the plug-in element.
@@ -190,6 +191,23 @@
HTMLFrameOwnerElement::defaultEventHandler(event);
}
+bool HTMLPlugInElement::isKeyboardFocusable(KeyboardEvent* event) const
+{
+ if (!document()->page())
+ return false;
+
+ const PluginViewBase* plugin = pluginWidget() && pluginWidget()->isPluginViewBase() ? static_cast<const PluginViewBase*>(pluginWidget()) : 0;
+ if (plugin)
+ return plugin->supportsKeyboardFocus();
+
+ return false;
+}
+
+bool HTMLPlugInElement::isPluginElement() const
+{
+ return true;
+}
+
#if ENABLE(NETSCAPE_PLUGIN_API)
NPObject* HTMLPlugInElement::getNPObject()
Modified: trunk/Source/WebCore/html/HTMLPlugInElement.h (124953 => 124954)
--- trunk/Source/WebCore/html/HTMLPlugInElement.h 2012-08-08 00:46:26 UTC (rev 124953)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.h 2012-08-08 00:54:36 UTC (rev 124954)
@@ -45,7 +45,7 @@
PassScriptInstance getInstance();
- Widget* pluginWidget();
+ Widget* pluginWidget() const;
#if ENABLE(NETSCAPE_PLUGIN_API)
NPObject* getNPObject();
@@ -72,8 +72,11 @@
virtual void defaultEventHandler(Event*);
- virtual RenderWidget* renderWidgetForJSBindings() = 0;
+ virtual RenderWidget* renderWidgetForJSBindings() const = 0;
+ virtual bool isKeyboardFocusable(KeyboardEvent*) const;
+ virtual bool isPluginElement() const;
+
private:
mutable ScriptInstance m_instance;
#if ENABLE(NETSCAPE_PLUGIN_API)
Modified: trunk/Source/WebCore/page/FocusController.cpp (124953 => 124954)
--- trunk/Source/WebCore/page/FocusController.cpp 2012-08-08 00:46:26 UTC (rev 124953)
+++ trunk/Source/WebCore/page/FocusController.cpp 2012-08-08 00:54:36 UTC (rev 124954)
@@ -352,7 +352,7 @@
// FIXME: May need a way to focus a document here.
return false;
- if (node->isFrameOwnerElement()) {
+ if (node->isFrameOwnerElement() && (!node->isPluginElement() || !node->isKeyboardFocusable(event))) {
// We focus frames rather than frame owners.
// FIXME: We should not focus frames that have no scrollbars, as focusing them isn't useful to the user.
HTMLFrameOwnerElement* owner = static_cast<HTMLFrameOwnerElement*>(node.get());
Modified: trunk/Source/WebCore/plugins/PluginViewBase.h (124953 => 124954)
--- trunk/Source/WebCore/plugins/PluginViewBase.h 2012-08-08 00:46:26 UTC (rev 124953)
+++ trunk/Source/WebCore/plugins/PluginViewBase.h 2012-08-08 00:54:36 UTC (rev 124954)
@@ -59,6 +59,7 @@
// FIXME: This is a hack that works around the fact that the WebKit2 PluginView isn't a ScrollableArea.
virtual bool wantsWheelEvents() { return false; }
+ virtual bool supportsKeyboardFocus() const { return false; }
protected:
explicit PluginViewBase(PlatformWidget widget = 0) : Widget(widget) { }
Modified: trunk/Source/WebKit/chromium/ChangeLog (124953 => 124954)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-08-08 00:46:26 UTC (rev 124953)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-08-08 00:54:36 UTC (rev 124954)
@@ -1,3 +1,20 @@
+2012-08-07 Fady Samuel <fsam...@chromium.org>
+
+ Allow plugins to decide whether they are keyboard focusable
+ https://bugs.webkit.org/show_bug.cgi?id=88958
+
+ Reviewed by Anders Carlsson.
+
+ * public/WebPlugin.h:
+ (WebKit::WebPlugin::supportsKeyboardFocus):
+ * src/WebInputEventConversion.cpp:
+ (WebKit::WebKeyboardEventBuilder::WebKeyboardEventBuilder):
+ * src/WebPluginContainerImpl.cpp:
+ (WebKit::WebPluginContainerImpl::supportsKeyboardFocus):
+ (WebKit):
+ * src/WebPluginContainerImpl.h:
+ (WebPluginContainerImpl):
+
2012-08-07 Kentaro Hara <hara...@chromium.org>
[V8] Implement V8Proxy::registerExtensionIfNeeded() and remove redundant methods
Modified: trunk/Source/WebKit/chromium/public/WebPlugin.h (124953 => 124954)
--- trunk/Source/WebKit/chromium/public/WebPlugin.h 2012-08-08 00:46:26 UTC (rev 124953)
+++ trunk/Source/WebKit/chromium/public/WebPlugin.h 2012-08-08 00:54:36 UTC (rev 124954)
@@ -65,6 +65,7 @@
// from the plugin. The value would be associated with the name attribute
// of the corresponding object element.
virtual bool getFormValue(WebString&) { return false; }
+ virtual bool supportsKeyboardFocus() const { return false; }
virtual void paint(WebCanvas*, const WebRect&) = 0;
Modified: trunk/Source/WebKit/chromium/src/WebInputEventConversion.cpp (124953 => 124954)
--- trunk/Source/WebKit/chromium/src/WebInputEventConversion.cpp 2012-08-08 00:46:26 UTC (rev 124953)
+++ trunk/Source/WebKit/chromium/src/WebInputEventConversion.cpp 2012-08-08 00:54:36 UTC (rev 124954)
@@ -464,6 +464,7 @@
text[i] = event.keyEvent()->text()[i];
unmodifiedText[i] = event.keyEvent()->unmodifiedText()[i];
}
+ memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), event.keyIdentifier().length());
}
#if ENABLE(TOUCH_EVENTS)
Modified: trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp (124953 => 124954)
--- trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp 2012-08-08 00:46:26 UTC (rev 124953)
+++ trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp 2012-08-08 00:54:36 UTC (rev 124954)
@@ -560,6 +560,11 @@
return false;
}
+bool WebPluginContainerImpl::supportsKeyboardFocus() const
+{
+ return m_webPlugin->supportsKeyboardFocus();
+}
+
void WebPluginContainerImpl::willDestroyPluginLoadObserver(WebPluginLoadObserver* observer)
{
size_t pos = m_pluginLoadObservers.find(observer);
Modified: trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.h (124953 => 124954)
--- trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.h 2012-08-08 00:46:26 UTC (rev 124953)
+++ trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.h 2012-08-08 00:54:36 UTC (rev 124954)
@@ -77,6 +77,7 @@
// PluginViewBase methods
virtual bool getFormValue(String&);
+ virtual bool supportsKeyboardFocus() const;
// Widget methods
virtual void setFrameRect(const WebCore::IntRect&);