diff options
Diffstat (limited to 'WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp')
-rw-r--r-- | WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp | 50 |
1 files changed, 3 insertions, 47 deletions
diff --git a/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp b/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp index 1970bf7..7b06bac 100644 --- a/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp +++ b/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp @@ -36,18 +36,10 @@ #if ENABLE(INSPECTOR) #include "ContextMenuItem.h" -#include "ExceptionCode.h" -#include "Frame.h" #include "InspectorController.h" #include "InspectorFrontendHost.h" #include "JSEvent.h" -#include "JSNode.h" -#include "JSRange.h" #include "MouseEvent.h" -#include "Node.h" -#include "Page.h" -#include "TextIterator.h" -#include "VisiblePosition.h" #include <runtime/JSArray.h> #include <runtime/JSLock.h> #include <runtime/JSObject.h> @@ -57,42 +49,6 @@ using namespace JSC; namespace WebCore { -JSValue JSInspectorFrontendHost::search(ExecState* exec, const ArgList& args) -{ - if (args.size() < 2) - return jsUndefined(); - - Node* node = toNode(args.at(0)); - if (!node) - return jsUndefined(); - - String target = args.at(1).toString(exec); - if (exec->hadException()) - return jsUndefined(); - - MarkedArgumentBuffer result; - RefPtr<Range> searchRange(rangeOfContents(node)); - - ExceptionCode ec = 0; - do { - RefPtr<Range> resultRange(findPlainText(searchRange.get(), target, true, false)); - if (resultRange->collapsed(ec)) - break; - - // A non-collapsed result range can in some funky whitespace cases still not - // advance the range's start position (4509328). Break to avoid infinite loop. - VisiblePosition newStart = endVisiblePosition(resultRange.get(), DOWNSTREAM); - if (newStart == startVisiblePosition(searchRange.get(), DOWNSTREAM)) - break; - - result.append(toJS(exec, resultRange.get())); - - setStart(searchRange.get(), newStart); - } while (true); - - return constructArray(exec, result); -} - JSValue JSInspectorFrontendHost::showContextMenu(ExecState* execState, const ArgList& args) { if (args.size() < 2) @@ -101,17 +57,17 @@ JSValue JSInspectorFrontendHost::showContextMenu(ExecState* execState, const Arg Event* event = toEvent(args.at(0)); JSArray* array = asArray(args.at(1)); - Vector<ContextMenuItem> items; + Vector<ContextMenuItem*> items; for (size_t i = 0; i < array->length(); ++i) { JSObject* item = asObject(array->getIndex(i)); JSValue label = item->get(execState, Identifier(execState, "label")); JSValue id = item->get(execState, Identifier(execState, "id")); if (label.isUndefined() || id.isUndefined()) - items.append(ContextMenuItem(SeparatorType, ContextMenuItemTagNoAction, String())); + items.append(new ContextMenuItem(SeparatorType, ContextMenuItemTagNoAction, String())); else { ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id.toInt32(execState)); - items.append(ContextMenuItem(ActionType, typedId, label.toString(execState))); + items.append(new ContextMenuItem(ActionType, typedId, label.toString(execState))); } } |