Title: [121896] trunk/Source/WebCore
Revision
121896
Author
commit-qu...@webkit.org
Date
2012-07-05 03:33:54 -0700 (Thu, 05 Jul 2012)

Log Message

Web Inspector: Having a "Scroll into view" for nodes through web inspector.
https://bugs.webkit.org/show_bug.cgi?id=89554

Added options for scrolling-into-view the  element node through web
inspector.

Patch by Sam D <dsam2...@gmail.com> on 2012-07-05
Reviewed by Pavel Feldman.

No new tests. UI change.

* English.lproj/localizedStrings.js:
* inspector/front-end/ElementsTreeOutline.js:
(WebInspector.ElementsTreeElement.prototype._populateTagContextMenu):
(.):
* inspector/front-end/RemoteObject.js:
(WebInspector.RemoteObject.prototype.callFunction):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (121895 => 121896)


--- trunk/Source/WebCore/ChangeLog	2012-07-05 09:34:46 UTC (rev 121895)
+++ trunk/Source/WebCore/ChangeLog	2012-07-05 10:33:54 UTC (rev 121896)
@@ -1,3 +1,22 @@
+2012-07-05  Sam D  <dsam2...@gmail.com>
+
+        Web Inspector: Having a "Scroll into view" for nodes through web inspector.
+        https://bugs.webkit.org/show_bug.cgi?id=89554
+
+        Added options for scrolling-into-view the  element node through web
+        inspector.
+
+        Reviewed by Pavel Feldman.
+
+        No new tests. UI change.
+
+        * English.lproj/localizedStrings.js:
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeElement.prototype._populateTagContextMenu):
+        (.):
+        * inspector/front-end/RemoteObject.js:
+        (WebInspector.RemoteObject.prototype.callFunction):
+
 2012-07-05  Zan Dobersek  <zandober...@gmail.com>
 
         Add Gamepad logging channel

Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js (121895 => 121896)


--- trunk/Source/WebCore/English.lproj/localizedStrings.js	2012-07-05 09:34:46 UTC (rev 121895)
+++ trunk/Source/WebCore/English.lproj/localizedStrings.js	2012-07-05 10:33:54 UTC (rev 121896)
@@ -356,6 +356,8 @@
 localizedStrings["Script"] = "Script";
 localizedStrings["Scripting"] = "Scripting";
 localizedStrings["Scripts Panel"] = "Scripts Panel";
+localizedStrings["Scroll into view"] = "Scroll into view";
+localizedStrings["Scroll Into View"] = "Scroll Into View";
 localizedStrings["Source Code Panel"] = "Source Code Panel";
 localizedStrings["Scripts"] = "Scripts";
 localizedStrings["Source Code"] = "Source Code";

Modified: trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js (121895 => 121896)


--- trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js	2012-07-05 09:34:46 UTC (rev 121895)
+++ trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js	2012-07-05 10:33:54 UTC (rev 121896)
@@ -1162,6 +1162,9 @@
 
         this._populateNodeContextMenu(contextMenu);
         this.treeOutline._populateContextMenu(contextMenu, this.representedObject);
+
+        contextMenu.appendSeparator();
+        contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Scroll into view" : "Scroll Into View"), this._scrollIntoView.bind(this)); 
     },
 
     _populateForcedPseudoStateItems: function(subMenu)
@@ -1912,6 +1915,22 @@
 
         this._highlightResult = [];
         WebInspector.highlightSearchResults(this.listItemElement, matchRanges, this._highlightResult);
+    },
+
+    _scrollIntoView: function()
+    {
+        function scrollIntoViewCallback(object)
+        {
+            function scrollIntoView()
+            {
+                this.scrollIntoViewIfNeeded(true);
+            }
+
+            if (object)
+                object.callFunction(scrollIntoView);
+        }
+        
+        WebInspector.RemoteObject.resolveNode(this.representedObject, "", scrollIntoViewCallback);
     }
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/RemoteObject.js (121895 => 121896)


--- trunk/Source/WebCore/inspector/front-end/RemoteObject.js	2012-07-05 09:34:46 UTC (rev 121895)
+++ trunk/Source/WebCore/inspector/front-end/RemoteObject.js	2012-07-05 10:33:54 UTC (rev 121896)
@@ -272,8 +272,8 @@
 
     /**
      * @param {function(this:Object)} functionDeclaration
-     * @param {Array.<RuntimeAgent.CallArgument>|undefined} args
-     * @param {function(?WebInspector.RemoteObject)} callback
+     * @param {Array.<RuntimeAgent.CallArgument>=} args
+     * @param {function(?WebInspector.RemoteObject)=} callback
      */
     callFunction: function(functionDeclaration, args, callback)
     {
@@ -284,6 +284,9 @@
          */
         function mycallback(error, result, wasThrown)
         {
+            if (!callback)
+                return;
+
             callback((error || wasThrown) ? null : WebInspector.RemoteObject.fromPayload(result));
         }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to