[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

pfeldman at chromium.org pfeldman at chromium.org
Wed Dec 22 12:33:58 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit a599b1b5e7db0094a38502a94507686cf8a42dba
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Aug 25 13:50:08 2010 +0000

    2010-08-25  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Yury Semikhatsky.
    
            Web Inspector: support disabled and checked context menu items.
            https://bugs.webkit.org/show_bug.cgi?id=44601
    
            * bindings/js/JSInspectorFrontendHostCustom.cpp:
            (WebCore::JSInspectorFrontendHost::showContextMenu):
            * bindings/v8/custom/V8InspectorFrontendHostCustom.cpp:
            (WebCore::V8InspectorFrontendHost::showContextMenuCallback):
            * inspector/front-end/ContextMenu.js:
            (WebInspector.ContextMenu.prototype.appendItem):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66010 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f8a1653..a4e9525 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-08-25  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: support disabled and checked context menu items.
+        https://bugs.webkit.org/show_bug.cgi?id=44601
+
+        * bindings/js/JSInspectorFrontendHostCustom.cpp:
+        (WebCore::JSInspectorFrontendHost::showContextMenu):
+        * bindings/v8/custom/V8InspectorFrontendHostCustom.cpp:
+        (WebCore::V8InspectorFrontendHost::showContextMenuCallback):
+        * inspector/front-end/ContextMenu.js:
+        (WebInspector.ContextMenu.prototype.appendItem):
+
 2010-08-25  Zaheer Ahmad <zaheer.mot at gmail.com>
 
         Reviewed by Xan Lopez.
diff --git a/WebCore/English.lproj/localizedStrings.js b/WebCore/English.lproj/localizedStrings.js
index 38f12ae..7d478ce 100644
Binary files a/WebCore/English.lproj/localizedStrings.js and b/WebCore/English.lproj/localizedStrings.js differ
diff --git a/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp b/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp
index b724f50..1df1af0 100644
--- a/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp
+++ b/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp
@@ -40,6 +40,7 @@
 #include "InspectorFrontendHost.h"
 #include "JSEvent.h"
 #include "MouseEvent.h"
+#include "PlatformString.h"
 #include <runtime/JSArray.h>
 #include <runtime/JSLock.h>
 #include <runtime/JSObject.h>
@@ -90,14 +91,26 @@ JSValue JSInspectorFrontendHost::showContextMenu(ExecState* exec)
     for (size_t i = 0; i < array->length(); ++i) {
         JSObject* item = asObject(array->getIndex(i));
         JSValue label = item->get(exec, Identifier(exec, "label"));
+        JSValue type = item->get(exec, Identifier(exec, "type"));
         JSValue id = item->get(exec, Identifier(exec, "id"));
-        if (label.isUndefined() || id.isUndefined())
+        JSValue enabled = item->get(exec, Identifier(exec, "enabled"));
+        JSValue checked = item->get(exec, Identifier(exec, "checked"));
+        if (!type.isString())
+            continue;
+
+        String typeString = ustringToString(type.toString(exec));
+        if (typeString == "separator") {
             items.append(new ContextMenuItem(SeparatorType,
                                              ContextMenuItemCustomTagNoAction,
                                              String()));
-        else {
+        } else {
             ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id.toInt32(exec));
-            items.append(new ContextMenuItem(ActionType, typedId, ustringToString(label.toString(exec))));
+            ContextMenuItem* menuItem = new ContextMenuItem((typeString == "checkbox" ? CheckableActionType : ActionType), typedId, ustringToString(label.toString(exec)));
+            if (!enabled.isUndefined())
+                menuItem->setEnabled(enabled.toBoolean(exec));
+            if (!checked.isUndefined())
+                menuItem->setChecked(checked.toBoolean(exec));
+            items.append(menuItem);
         }
     }
 
diff --git a/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp b/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
index 7733a70..25b9010 100644
--- a/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
@@ -33,6 +33,7 @@
 
 #include "InspectorController.h"
 #include "InspectorFrontendHost.h"
+#include "PlatformString.h"
 
 #include "V8Binding.h"
 #include "V8MouseEvent.h"
@@ -76,18 +77,26 @@ v8::Handle<v8::Value> V8InspectorFrontendHost::showContextMenuCallback(const v8:
 
     for (size_t i = 0; i < array->Length(); ++i) {
         v8::Local<v8::Object> item = v8::Local<v8::Object>::Cast(array->Get(v8::Integer::New(i)));
-        v8::Local<v8::Value> label = item->Get(v8::String::New("label"));
+        v8::Local<v8::Value> type = item->Get(v8::String::New("type"));
         v8::Local<v8::Value> id = item->Get(v8::String::New("id"));
-        if (label->IsUndefined() || id->IsUndefined()) {
-          items.append(new ContextMenuItem(SeparatorType,
-                                           ContextMenuItemCustomTagNoAction,
-                                           String()));
+        v8::Local<v8::Value> label = item->Get(v8::String::New("label"));
+        v8::Local<v8::Value> enabled = item->Get(v8::String::New("enabled"));
+        v8::Local<v8::Value> checked = item->Get(v8::String::New("checked"));
+        if (!type->IsString())
+            continue;
+        String typeString = toWebCoreStringWithNullCheck(type);
+        if (typeString == "separator") {
+            items.append(new ContextMenuItem(SeparatorType,
+                                             ContextMenuItemCustomTagNoAction,
+                                             String()));
         } else {
-          ContextMenuAction typedId = static_cast<ContextMenuAction>(
-              ContextMenuItemBaseCustomTag + id->ToInt32()->Value());
-          items.append(new ContextMenuItem(ActionType,
-                                           typedId,
-                                           toWebCoreStringWithNullCheck(label)));
+            ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id->ToInt32()->Value());
+            ContextMenuItem* menuItem = new ContextMenuItem((typeString == "checkbox" ? CheckableActionType : ActionType), typedId, toWebCoreStringWithNullCheck(label));
+            if (checked->IsBoolean())
+                menuItem->setChecked(checked->ToBoolean()->Value());
+            if (enabled->IsBoolean())
+                menuItem->setEnabled(enabled->ToBoolean()->Value());
+            items.append(menuItem);
         }
     }
 
diff --git a/WebCore/inspector/front-end/ConsoleView.js b/WebCore/inspector/front-end/ConsoleView.js
index 474c362..9785cd0 100644
--- a/WebCore/inspector/front-end/ConsoleView.js
+++ b/WebCore/inspector/front-end/ConsoleView.js
@@ -401,9 +401,9 @@ WebInspector.ConsoleView.prototype = {
 
         var contextMenu = new WebInspector.ContextMenu();
         if (!WebInspector.monitoringXHREnabled)
-            contextMenu.appendItem(WebInspector.UIString("Enable XMLHttpRequest logging"), InspectorBackend.enableMonitoringXHR.bind(InspectorBackend));
+            contextMenu.appendCheckboxItem(WebInspector.UIString("XMLHttpRequest logging"), InspectorBackend.enableMonitoringXHR.bind(InspectorBackend), false);
         else
-            contextMenu.appendItem(WebInspector.UIString("Disable XMLHttpRequest logging"), InspectorBackend.disableMonitoringXHR.bind(InspectorBackend));
+            contextMenu.appendCheckboxItem(WebInspector.UIString("XMLHttpRequest logging"), InspectorBackend.disableMonitoringXHR.bind(InspectorBackend), true);
         contextMenu.appendItem(WebInspector.UIString("Clear Console"), this.requestClearMessages.bind(this));
         contextMenu.show(event);
     },
diff --git a/WebCore/inspector/front-end/ContextMenu.js b/WebCore/inspector/front-end/ContextMenu.js
index 3cdb152..47045a2 100644
--- a/WebCore/inspector/front-end/ContextMenu.js
+++ b/WebCore/inspector/front-end/ContextMenu.js
@@ -46,10 +46,17 @@ WebInspector.ContextMenu.prototype = {
         }
     },
 
-    appendItem: function(label, handler)
+    appendItem: function(label, handler, disabled)
     {
         var id = this._items.length;
-        this._items.push({id: id, label: label});
+        this._items.push({type: "item", id: id, label: label, enabled: !disabled});
+        this._handlers[id] = handler;
+    },
+
+    appendCheckboxItem: function(label, handler, checked, disabled)
+    {
+        var id = this._items.length;
+        this._items.push({type: "checkbox", id: id, label: label, checked: !!checked, enabled: !disabled});
         this._handlers[id] = handler;
     },
 
@@ -60,7 +67,7 @@ WebInspector.ContextMenu.prototype = {
             return;
         if (!("id" in this._items[this._items.length - 1]))
             return;
-        this._items.push({});
+        this._items.push({type: "separator"});
     },
 
     _itemSelected: function(id)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list