From e8b154fd68f9b33be40a3590e58347f353835f5c Mon Sep 17 00:00:00 2001 From: Steve Block Date: Fri, 27 Aug 2010 11:02:25 +0100 Subject: Merge WebKit at r66079 : Initial merge by git Change-Id: Ie2e1440fb9d487d24e52c247342c076fecaecac7 --- WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp') 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 #include #include @@ -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(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); } } -- cgit v1.1