Changeset 96234 in webkit


Ignore:
Timestamp:
Sep 28, 2011 10:40:14 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

[Gtk] Implement textInputController.doCommand
https://bugs.webkit.org/show_bug.cgi?id=66496

Patch by Kaustubh Atrawalkar <Kaustubh Atrawalkar> on 2011-09-28
Reviewed by Martin Robinson.

Source/WebKit/gtk:

  • WebCoreSupport/DumpRenderTreeSupportGtk.cpp:

(DumpRenderTreeSupportGtk::doCommand): Function definition for doCommand
callback. Converted Incoming command to match with WebCore::Editor CommandMap.

  • WebCoreSupport/DumpRenderTreeSupportGtk.h:

Tools:

  • DumpRenderTree/gtk/TextInputController.cpp:

(doCommandCallback): Callback function for textInputController.doCommand

LayoutTests:

Removed skipped tests under textInputController.doCommand for Gtk Port.

  • platform/gtk/Skipped:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r96231 r96234  
     12011-09-28  Kaustubh Atrawalkar  <kaustubh@motorola.com>
     2
     3        [Gtk] Implement textInputController.doCommand
     4        https://bugs.webkit.org/show_bug.cgi?id=66496
     5
     6        Reviewed by Martin Robinson.
     7
     8        Removed skipped tests under textInputController.doCommand for Gtk Port.
     9
     10        * platform/gtk/Skipped:
     11
    1122011-09-28  Tom Sepez  <tsepez@chromium.org>
    213
  • trunk/LayoutTests/platform/gtk/Skipped

    r96218 r96234  
    15461546fast/html/set-text-direction.html
    15471547
    1548 # textInputController.doCommand is not implemented.
    1549 # https://bugs.webkit.org/show_bug.cgi?id=66496
    1550 editing/input/password-echo-passnode.html
    1551 editing/input/password-echo-passnode2.html
    1552 editing/input/password-echo-passnode3.html
    1553 editing/input/password-echo-textnode.html
    1554 
    15551548# https://bugs.webkit.org/show_bug.cgi?id=57160
    15561549# [GTK] layoutTestController.overridePreference("WebKitDefaultFontSize"...) does not take into account screen DPI
  • trunk/Source/WebKit/gtk/ChangeLog

    r96087 r96234  
     12011-09-28  Kaustubh Atrawalkar  <kaustubh@motorola.com>
     2
     3        [Gtk] Implement textInputController.doCommand
     4        https://bugs.webkit.org/show_bug.cgi?id=66496
     5
     6        Reviewed by Martin Robinson.
     7
     8        * WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
     9        (DumpRenderTreeSupportGtk::doCommand): Function definition for doCommand
     10        callback. Converted Incoming command to match with WebCore::Editor CommandMap.
     11        * WebCoreSupport/DumpRenderTreeSupportGtk.h:
     12
    1132011-09-27  Carlos Garcia Campos  <cgarcia@igalia.com>
    214
  • trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp

    r95901 r96234  
    576576}
    577577
     578void DumpRenderTreeSupportGtk::doCommand(WebKitWebView* webView, const char* command)
     579{
     580    g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
     581    Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
     582    if (!frame)
     583        return;
     584
     585    Editor* editor = frame->editor();
     586    if (!editor)
     587        return;
     588
     589    String commandString(command);
     590    // Remove ending : here.
     591    if (commandString.endsWith(":", true))
     592        commandString = commandString.left(commandString.length() - 1);
     593
     594    // Make the first char in upper case.
     595    String firstChar = commandString.left(1);
     596    commandString = commandString.right(commandString.length() - 1);
     597    firstChar.makeUpper();
     598    commandString.insert(firstChar, 0);
     599
     600    editor->command(commandString).execute();
     601}
     602
    578603bool DumpRenderTreeSupportGtk::firstRectForCharacterRange(WebKitWebView* webView, int location, int length, cairo_rectangle_int_t* rect)
    579604{
  • trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h

    r95901 r96234  
    110110    static bool firstRectForCharacterRange(WebKitWebView*, int location, int length, cairo_rectangle_int_t*);
    111111    static bool selectedRange(WebKitWebView*, int* start, int* length);
    112 
     112    static void doCommand(WebKitWebView*, const char*);
    113113    // GC
    114114    static void gcCollectJavascriptObjects();
  • trunk/Tools/ChangeLog

    r96232 r96234  
     12011-09-28  Kaustubh Atrawalkar  <kaustubh@motorola.com>
     2
     3        [Gtk] Implement textInputController.doCommand
     4        https://bugs.webkit.org/show_bug.cgi?id=66496
     5
     6        Reviewed by Martin Robinson.
     7
     8        * DumpRenderTree/gtk/TextInputController.cpp:
     9        (doCommandCallback): Callback function for textInputController.doCommand
     10
    1112011-09-28  David Levin  <levin@chromium.org>
    212
  • trunk/Tools/DumpRenderTree/gtk/TextInputController.cpp

    r89133 r96234  
    163163}
    164164
     165static JSValueRef doCommandCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     166{
     167    WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
     168    ASSERT(view);
     169    if (argumentCount < 1)
     170        return JSValueMakeUndefined(context);
     171
     172    JSStringRef string = JSValueToStringCopy(context, arguments[0], exception);
     173    ASSERT(!exception || !*exception);
     174
     175    size_t bufferSize = JSStringGetMaximumUTF8CStringSize(string);
     176    GOwnPtr<gchar> stringBuffer(static_cast<gchar*>(g_malloc(bufferSize)));
     177    JSStringGetUTF8CString(string, stringBuffer.get(), bufferSize);
     178    JSStringRelease(string);
     179
     180    DumpRenderTreeSupportGtk::doCommand(view, stringBuffer.get());
     181    return JSValueMakeUndefined(context);
     182}
     183
    165184static JSStaticFunction staticFunctions[] = {
    166185    { "setMarkedText", setMarkedTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     
    171190    { "firstRectForCharacterRange", firstRectForCharacterRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    172191    { "selectedRange", selectedRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     192    { "doCommand", doCommandCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    173193    { 0, 0, 0 }
    174194};
Note: See TracChangeset for help on using the changeset viewer.