summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-08-27 11:02:25 +0100
committerSteve Block <steveblock@google.com>2010-09-02 17:17:20 +0100
commite8b154fd68f9b33be40a3590e58347f353835f5c (patch)
tree0733ce26384183245aaa5656af26c653636fe6c1 /WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp
parentda56157816334089526a7a115a85fd85a6e9a1dc (diff)
downloadexternal_webkit-e8b154fd68f9b33be40a3590e58347f353835f5c.zip
external_webkit-e8b154fd68f9b33be40a3590e58347f353835f5c.tar.gz
external_webkit-e8b154fd68f9b33be40a3590e58347f353835f5c.tar.bz2
Merge WebKit at r66079 : Initial merge by git
Change-Id: Ie2e1440fb9d487d24e52c247342c076fecaecac7
Diffstat (limited to 'WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp')
-rw-r--r--WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp19
1 files changed, 16 insertions, 3 deletions
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);
}
}