Title: [89939] trunk/Source/WebKit/chromium
Revision
89939
Author
[email protected]
Date
2011-06-28 09:58:00 -0700 (Tue, 28 Jun 2011)

Log Message

2011-06-27  James Hawkins  <[email protected]>

        Reviewed by Darin Fisher.

        [Chromium] Pass an optional WebNode that is the node receiving the context menu action.
        https://bugs.webkit.org/show_bug.cgi?id=63503

        * public/WebFrame.h:
        * src/WebFrameImpl.cpp:
        (WebKit::pluginContainerFromNode):
        (WebKit::WebFrameImpl::executeCommand):
        (WebKit::WebFrameImpl::printBegin):
        * src/WebFrameImpl.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (89938 => 89939)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-06-28 16:48:59 UTC (rev 89938)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-06-28 16:58:00 UTC (rev 89939)
@@ -1,3 +1,17 @@
+2011-06-27  James Hawkins  <[email protected]>
+
+        Reviewed by Darin Fisher.
+
+        [Chromium] Pass an optional WebNode that is the node receiving the context menu action.
+        https://bugs.webkit.org/show_bug.cgi?id=63503
+
+        * public/WebFrame.h:
+        * src/WebFrameImpl.cpp:
+        (WebKit::pluginContainerFromNode):
+        (WebKit::WebFrameImpl::executeCommand):
+        (WebKit::WebFrameImpl::printBegin):
+        * src/WebFrameImpl.h:
+
 2011-06-27  Ryosuke Niwa  <[email protected]>
 
         Rolled DEPS.

Modified: trunk/Source/WebKit/chromium/public/WebFrame.h (89938 => 89939)


--- trunk/Source/WebKit/chromium/public/WebFrame.h	2011-06-28 16:48:59 UTC (rev 89938)
+++ trunk/Source/WebKit/chromium/public/WebFrame.h	2011-06-28 16:58:00 UTC (rev 89939)
@@ -392,7 +392,7 @@
     // Supports commands like Undo, Redo, Cut, Copy, Paste, SelectAll,
     // Unselect, etc. See EditorCommand.cpp for the full list of supported
     // commands.
-    virtual bool executeCommand(const WebString&) = 0;
+    virtual bool executeCommand(const WebString&, const WebNode& = WebNode()) = 0;
     virtual bool executeCommand(const WebString&, const WebString& value) = 0;
     virtual bool isCommandEnabled(const WebString&) const = 0;
 

Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp (89938 => 89939)


--- trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp	2011-06-28 16:48:59 UTC (rev 89938)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp	2011-06-28 16:58:00 UTC (rev 89939)
@@ -285,6 +285,20 @@
     return ++next;
 }
 
+static WebPluginContainerImpl* pluginContainerFromNode(const WebNode& node)
+{
+    const Node* coreNode = node.constUnwrap<Node>();
+    if (coreNode->hasTagName(HTMLNames::objectTag) || coreNode->hasTagName(HTMLNames::embedTag)) {
+        RenderObject* object = coreNode->renderer();
+        if (object && object->isWidget()) {
+            Widget* widget = toRenderWidget(object)->widget();
+            if (widget && widget->isPluginContainer())
+                return static_cast<WebPluginContainerImpl*>(widget);
+        }
+    }
+    return 0;
+}
+
 WebPluginContainerImpl* WebFrameImpl::pluginContainerFromFrame(Frame* frame)
 {
     if (!frame)
@@ -296,7 +310,7 @@
 }
 
 // Simple class to override some of PrintContext behavior. Some of the methods
-// made virtual so that they can be overriden by ChromePluginPrintContext.
+// made virtual so that they can be overridden by ChromePluginPrintContext.
 class ChromePrintContext : public PrintContext {
     WTF_MAKE_NONCOPYABLE(ChromePrintContext);
 public:
@@ -1100,7 +1114,7 @@
     return location;
 }
 
-bool WebFrameImpl::executeCommand(const WebString& name)
+bool WebFrameImpl::executeCommand(const WebString& name, const WebNode& node)
 {
     ASSERT(frame());
 
@@ -1120,6 +1134,8 @@
 
     if (command == "Copy") {
         WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame());
+        if (!pluginContainer)
+            pluginContainer = pluginContainerFromNode(node);
         if (pluginContainer) {
             pluginContainer->copy();
             return true;
@@ -1307,15 +1323,7 @@
         pluginContainer = pluginContainerFromFrame(frame());
     } else {
         // We only support printing plugin nodes for now.
-        const Node* coreNode = constrainToNode.constUnwrap<Node>();
-        if (coreNode->hasTagName(HTMLNames::objectTag) || coreNode->hasTagName(HTMLNames::embedTag)) {
-            RenderObject* object = coreNode->renderer();
-            if (object && object->isWidget()) {
-                Widget* widget = toRenderWidget(object)->widget();
-                if (widget && widget->isPluginContainer())
-                    pluginContainer =  static_cast<WebPluginContainerImpl*>(widget);
-            }
-        }
+        pluginContainer = pluginContainerFromNode(constrainToNode);
     }
 
     if (pluginContainer && pluginContainer->supportsPaginatedPrint())

Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.h (89938 => 89939)


--- trunk/Source/WebKit/chromium/src/WebFrameImpl.h	2011-06-28 16:48:59 UTC (rev 89938)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.h	2011-06-28 16:58:00 UTC (rev 89939)
@@ -149,7 +149,7 @@
     virtual WebRange markedRange() const;
     virtual bool firstRectForCharacterRange(unsigned location, unsigned length, WebRect&) const;
     virtual size_t characterIndexForPoint(const WebPoint&) const;
-    virtual bool executeCommand(const WebString&);
+    virtual bool executeCommand(const WebString&, const WebNode& = WebNode());
     virtual bool executeCommand(const WebString&, const WebString& value);
     virtual bool isCommandEnabled(const WebString&) const;
     virtual void enableContinuousSpellChecking(bool);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to