Changeset 87770 in webkit


Ignore:
Timestamp:
May 31, 2011 7:25:47 PM (13 years ago)
Author:
morrita@google.com
Message:

2011-05-31 Hironori Bono <hbono@chromium.org>

Reviewed by Eric Seidel.

Send an input event when we change the text direction.
https://bugs.webkit.org/show_bug.cgi?id=50952

This adds a new layout test to verify that we can receive input events
when we change the text direction of a <textarea> element and an <input>
element.

  • fast/html/set-text-direction-expected.txt: Added.
  • fast/html/set-text-direction.html: Added.
  • platform/gtk/Skipped:
  • platform/mac-leopard/Skipped:
  • platform/mac-tiger/Skipped:
  • platform/qt/Skipped:
  • platform/win/Skipped:

2011-05-31 Hironori Bono <hbono@chromium.org>

Reviewed by Eric Seidel.

Send an input event when we change the text direction.
https://bugs.webkit.org/show_bug.cgi?id=50952

Both Safari and Chrome call Editor::setBaseWritingDirection() to change
the text direction of an editable element with their UIs. This change
calls dispatchInputEvent() to send an input event when the function
actually changes the "dir" attribute so we can send an input event as
written in the HTML5 spec.

Test: fast/html/set-text-direction.html

  • editing/Editor.cpp: (WebCore::Editor::setBaseWritingDirection):

2011-05-31 Hironori Bono <hbono@chromium.org>

Reviewed by Eric Seidel.

Add a JavaScript function layoutTestController.setTextDirection().
https://bugs.webkit.org/show_bug.cgi?id=50952

This change adds a new JavaScript function setTextDirection() to the
LayoutTestController class of Safari and Chrome to write layout tests
that changes the text direction of an editable element.

  • DumpRenderTree/LayoutTestController.cpp: (setTextDirectionCallback): (LayoutTestController::staticFunctions):
  • DumpRenderTree/LayoutTestController.h:
  • DumpRenderTree/chromium/LayoutTestController.cpp: (LayoutTestController::LayoutTestController): (LayoutTestController::setTextDirection):
  • DumpRenderTree/chromium/LayoutTestController.h:
  • DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: (LayoutTestController::setTextDirection):
  • DumpRenderTree/mac/LayoutTestControllerMac.mm: (LayoutTestController::setTextDirection):
  • DumpRenderTree/win/LayoutTestControllerWin.cpp: (LayoutTestController::setTextDirection):
Location:
trunk
Files:
2 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r87762 r87770  
     12011-05-31  Hironori Bono  <hbono@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Send an input event when we change the text direction.
     6        https://bugs.webkit.org/show_bug.cgi?id=50952
     7
     8        This adds a new layout test to verify that we can receive input events
     9        when we change the text direction of a <textarea> element and an <input>
     10        element.
     11
     12        * fast/html/set-text-direction-expected.txt: Added.
     13        * fast/html/set-text-direction.html: Added.
     14        * platform/gtk/Skipped:
     15        * platform/mac-leopard/Skipped:
     16        * platform/mac-tiger/Skipped:
     17        * platform/qt/Skipped:
     18        * platform/win/Skipped:
     19
    1202011-05-27  Adrienne Walker  <enne@google.com>
    221
  • trunk/LayoutTests/platform/gtk/Skipped

    r87696 r87770  
    14101410editing/spelling/grammar.html
    14111411
     1412# layoutTestController::setTextDirection() is not implemented.
     1413fast/html/set-text-direction.html
     1414
    14121415# https://bugs.webkit.org/show_bug.cgi?id=57160
    14131416# [GTK] layoutTestController.overridePreference("WebKitDefaultFontSize"...) does not take into account screen DPI
  • trunk/LayoutTests/platform/mac-leopard/Skipped

    r87326 r87770  
    9595# Available 10.6 or later
    9696editing/spelling/spellcheck-paste.html
     97fast/html/set-text-direction.html
    9798
    9899# Disable tests which started failing after r66961
  • trunk/LayoutTests/platform/qt/Skipped

    r87691 r87770  
    25192519fast/events/selectstart-by-drag.html
    25202520
     2521# LayoutTestController::setTextDirection is not implemented.
     2522fast/html/set-text-direction.html
     2523
    25212524# JSC does not support setIsolatedWorldSecurityOrigin (http://webkit.org/b/61540)
    25222525http/tests/security/isolatedWorld/cross-origin-xhr.html
  • trunk/LayoutTests/platform/win/Skipped

    r87691 r87770  
    991991editing/spelling/spellcheck-paste.html
    992992
     993# layoutTestController::setTextDirection() is not implemented
     994fast/html/set-text-direction.html
     995
    993996# IndexedDB is not yet enabled.
    994997storage/indexeddb
  • trunk/Source/WebCore/ChangeLog

    r87768 r87770  
     12011-05-31  Hironori Bono  <hbono@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Send an input event when we change the text direction.
     6        https://bugs.webkit.org/show_bug.cgi?id=50952
     7
     8        Both Safari and Chrome call Editor::setBaseWritingDirection() to change
     9        the text direction of an editable element with their UIs. This change
     10        calls dispatchInputEvent() to send an input event when the function
     11        actually changes the "dir" attribute so we can send an input event as
     12        written in the HTML5 spec.
     13
     14        Test: fast/html/set-text-direction.html
     15
     16        * editing/Editor.cpp:
     17        (WebCore::Editor::setBaseWritingDirection):
     18
    1192011-05-31  Jer Noble  <jer.noble@apple.com>
    220
  • trunk/Source/WebCore/editing/Editor.cpp

    r87483 r87770  
    14481448            return;
    14491449        toHTMLElement(focusedNode)->setAttribute(dirAttr, direction == LeftToRightWritingDirection ? "ltr" : "rtl");
     1450        focusedNode->dispatchInputEvent();
    14501451        frame()->document()->updateStyleIfNeeded();
    14511452        return;
  • trunk/Tools/ChangeLog

    r87763 r87770  
     12011-05-31  Hironori Bono  <hbono@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Add a JavaScript function layoutTestController.setTextDirection().
     6        https://bugs.webkit.org/show_bug.cgi?id=50952
     7
     8        This change adds a new JavaScript function setTextDirection() to the
     9        LayoutTestController class of Safari and Chrome to write layout tests
     10        that changes the text direction of an editable element.
     11
     12        * DumpRenderTree/LayoutTestController.cpp:
     13        (setTextDirectionCallback):
     14        (LayoutTestController::staticFunctions):
     15        * DumpRenderTree/LayoutTestController.h:
     16        * DumpRenderTree/chromium/LayoutTestController.cpp:
     17        (LayoutTestController::LayoutTestController):
     18        (LayoutTestController::setTextDirection):
     19        * DumpRenderTree/chromium/LayoutTestController.h:
     20        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
     21        (LayoutTestController::setTextDirection):
     22        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
     23        (LayoutTestController::setTextDirection):
     24        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
     25        (LayoutTestController::setTextDirection):
     26
    1272011-05-31  Ademar de Souza Reis Jr  <ademar.reis@openbossa.org>
    228
  • trunk/Tools/DumpRenderTree/LayoutTestController.cpp

    r86644 r87770  
    22102210    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
    22112211    controller->setMinimumTimerInterval(minimum);
     2212
     2213    return JSValueMakeUndefined(context);
     2214}
     2215
     2216static JSValueRef setTextDirectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     2217{
     2218    if (argumentCount == 1) {
     2219        JSRetainPtr<JSStringRef> direction(Adopt, JSValueToStringCopy(context, arguments[0], exception));
     2220        LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     2221        controller->setTextDirection(direction.get());
     2222    }
    22122223
    22132224    return JSValueMakeUndefined(context);
     
    24232434        { "originsWithLocalStorage", originsWithLocalStorageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    24242435        { "setShouldPaintBrokenImage", setShouldPaintBrokenImageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     2436        { "setTextDirection", setTextDirectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    24252437        { "shadowPseudoId", shadowPseudoIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    24262438        { 0, 0, 0 }
  • trunk/Tools/DumpRenderTree/LayoutTestController.h

    r87469 r87770  
    346346    void setMinimumTimerInterval(double);
    347347
     348    void setTextDirection(JSStringRef);
     349
    348350private:
    349351    LayoutTestController(const std::string& testPathOrURL, const std::string& expectedPixelHash);
  • trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp

    r87597 r87770  
    191191    bindMethod("waitUntilDone", &LayoutTestController::waitUntilDone);
    192192    bindMethod("windowCount", &LayoutTestController::windowCount);
     193    bindMethod("setTextDirection", &LayoutTestController::setTextDirection);
    193194
    194195    // The following are stubs.
     
    18541855    }
    18551856}
     1857
     1858void LayoutTestController::setTextDirection(const CppArgumentList& arguments, CppVariant* result)
     1859{
     1860    result->setNull();
     1861    if (arguments.size() != 1 || !arguments[0].isString())
     1862        return;
     1863
     1864    // Map a direction name to a WebTextDirection value.
     1865    std::string directionName = arguments[0].toString();
     1866    WebKit::WebTextDirection direction;
     1867    if (directionName == "auto")
     1868        direction = WebKit::WebTextDirectionDefault;
     1869    else if (directionName == "rtl")
     1870        direction = WebKit::WebTextDirectionRightToLeft;
     1871    else if (directionName == "ltr")
     1872        direction = WebKit::WebTextDirectionLeftToRight;
     1873    else
     1874        return;
     1875
     1876    m_shell->webView()->setTextDirection(direction);
     1877}
  • trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h

    r87597 r87770  
    379379    void resetPageVisibility(const CppArgumentList&, CppVariant*);
    380380
     381    // Changes the direction of the focused element.
     382    void setTextDirection(const CppArgumentList&, CppVariant*);
     383
    381384public:
    382385    // The following methods are not exposed to JavaScript.
  • trunk/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp

    r86644 r87770  
    10011001    DumpRenderTreeSupportGtk::setMinimumTimerInterval(webView, minimumTimerInterval);
    10021002}
     1003
     1004void LayoutTestController::setTextDirection(JSStringRef direction)
     1005{
     1006    // FIXME: Implement.
     1007}
  • trunk/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm

    r86644 r87770  
    11541154    [[mainFrame webView] _setMinimumTimerInterval:minimumTimerInterval];
    11551155}
     1156
     1157void LayoutTestController::setTextDirection(JSStringRef directionName)
     1158{
     1159#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
     1160    if (JSStringIsEqualToUTF8CString(directionName, "ltr"))
     1161        [[mainFrame webView] makeBaseWritingDirectionLeftToRight:0];
     1162    else if (JSStringIsEqualToUTF8CString(directionName, "rtl"))
     1163        [[mainFrame webView] makeBaseWritingDirectionRightToLeft:0];
     1164    else
     1165        ASSERT_NOT_REACHED();
     1166#endif
     1167}
  • trunk/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp

    r86644 r87770  
    15781578}
    15791579
    1580 
     1580void LayoutTestController::setTextDirection(JSStringRef direction)
     1581{
     1582    // FIXME: Implement.
     1583}
Note: See TracChangeset for help on using the changeset viewer.