Title: [90806] trunk
Revision
90806
Author
hb...@chromium.org
Date
2011-07-11 19:51:39 -0700 (Mon, 11 Jul 2011)

Log Message

Reviewed by Adam Roben.

Implement layoutTestController.setTextDirection for WebKit2 and Windows.
https://bugs.webkit.org/show_bug.cgi?id=61931

This change implements layoutTextController.setTextDirection for WebKit2
and Windows so we can run a layout test added by r87770 on them. Each
implementation adds a wrapper function for Editor::setBaseWritingDirection()
so LayoutTestController can call it.

Source/WebKit/win:

* Interfaces/IWebFramePrivate.idl: Added setTextDirection to allow
LayoutTestController to change the text direction.
* WebFrame.cpp: ditto.
(WebFrame::setTextDirection):
* WebFrame.h: ditto.

Source/WebKit2:

* WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: Added
WKBundleFrameSetTextDirection to allow LayoutTestController to change the
text direction.
(WKBundleFrameSetTextDirection):
* WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h: ditto.
* WebProcess/WebPage/WebFrame.cpp: Added setTextDirection to allow
WKBundleFrame to change the text direction.
(WebKit::WebFrame::setTextDirection):
* WebProcess/WebPage/WebFrame.h: ditto.

Tools:

* DumpRenderTree/win/LayoutTestControllerWin.cpp:
(LayoutTestController::setTextDirection): Implemented the binding function
for layoutTestController.setTextDirection (Windows).
* WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
Added a binding function for layoutTestController.setTextDirection (WebKit2).
* WebKitTestRunner/InjectedBundle/LayoutTestController.cpp: ditto.
(WTR::LayoutTestController::setTextDirection):
* WebKitTestRunner/InjectedBundle/LayoutTestController.h: ditto.

LayoutTests:

* platform/mac-wk2/Skipped: Removed set-text-direction.html.
* platform/win/Skipped: ditto.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (90805 => 90806)


--- trunk/LayoutTests/ChangeLog	2011-07-12 02:20:09 UTC (rev 90805)
+++ trunk/LayoutTests/ChangeLog	2011-07-12 02:51:39 UTC (rev 90806)
@@ -1,3 +1,18 @@
+2011-07-11  Hironori Bono  <hb...@chromium.org>
+
+        Reviewed by Adam Roben.
+
+        Implement layoutTestController.setTextDirection for WebKit2 and Windows.
+        https://bugs.webkit.org/show_bug.cgi?id=61931
+
+        This change implements layoutTextController.setTextDirection for WebKit2
+        and Windows so we can run a layout test added by r87770 on them. Each
+        implementation adds a wrapper function for Editor::setBaseWritingDirection()
+        so LayoutTestController can call it.
+
+        * platform/mac-wk2/Skipped: Removed set-text-direction.html.
+        * platform/win/Skipped: ditto.
+
 2011-07-11  Ryosuke Niwa  <rn...@webkit.org>
 
         Skip hittest-on-relative-positioned-children.html in WebKit2.

Modified: trunk/LayoutTests/platform/win/Skipped (90805 => 90806)


--- trunk/LayoutTests/platform/win/Skipped	2011-07-12 02:20:09 UTC (rev 90805)
+++ trunk/LayoutTests/platform/win/Skipped	2011-07-12 02:51:39 UTC (rev 90806)
@@ -1007,9 +1007,6 @@
 # EditorClient::requestCheckingOfString() is not implemented
 editing/spelling/spellcheck-paste.html
 
-# layoutTestController::setTextDirection() is not implemented
-fast/html/set-text-direction.html
-
 # IndexedDB is not yet enabled.
 storage/indexeddb
 

Modified: trunk/LayoutTests/platform/wk2/Skipped (90805 => 90806)


--- trunk/LayoutTests/platform/wk2/Skipped	2011-07-12 02:20:09 UTC (rev 90805)
+++ trunk/LayoutTests/platform/wk2/Skipped	2011-07-12 02:51:39 UTC (rev 90806)
@@ -411,10 +411,6 @@
 scrollbars/scrollbar-miss-mousemove-disabled.html
 scrollbars/scrollevent-iframe-no-scrolling-wheel.html
 
-# WebKitTestRunner needs an implementation of setTextDirection.
-# <https://bugs.webkit.org/show_bug.cgi?id=61931>
-fast/html/set-text-direction.html
-
 # CONSOLE MESSAGE: line 0: SVG animation pause API missing!
 # [WK2] SVG animation pause API missing
 # https://bugs.webkit.org/show_bug.cgi?id=63396

Modified: trunk/Source/WebKit/win/ChangeLog (90805 => 90806)


--- trunk/Source/WebKit/win/ChangeLog	2011-07-12 02:20:09 UTC (rev 90805)
+++ trunk/Source/WebKit/win/ChangeLog	2011-07-12 02:51:39 UTC (rev 90806)
@@ -1,3 +1,21 @@
+2011-07-11  Hironori Bono  <hb...@chromium.org>
+
+        Reviewed by Adam Roben.
+
+        Implement layoutTestController.setTextDirection for WebKit2 and Windows.
+        https://bugs.webkit.org/show_bug.cgi?id=61931
+
+        This change implements layoutTextController.setTextDirection for WebKit2
+        and Windows so we can run a layout test added by r87770 on them. Each
+        implementation adds a wrapper function for Editor::setBaseWritingDirection()
+        so LayoutTestController can call it.
+
+        * Interfaces/IWebFramePrivate.idl: Added setTextDirection to allow
+        LayoutTestController to change the text direction.
+        * WebFrame.cpp: ditto.
+        (WebFrame::setTextDirection):
+        * WebFrame.h: ditto.
+
 2011-07-08  Chang Shu  <c...@webkit.org>
 
         Update calling sites after function renamed.

Modified: trunk/Source/WebKit/win/Interfaces/IWebFramePrivate.idl (90805 => 90806)


--- trunk/Source/WebKit/win/Interfaces/IWebFramePrivate.idl	2011-07-12 02:20:09 UTC (rev 90805)
+++ trunk/Source/WebKit/win/Interfaces/IWebFramePrivate.idl	2011-07-12 02:51:39 UTC (rev 90806)
@@ -120,4 +120,6 @@
     HRESULT hasSpellingMarker([in] UINT from, [in] UINT length, [out, retval] BOOL* result);
     
     HRESULT clearOpener();
+
+    HRESULT setTextDirection([in] BSTR direction);
 }

Modified: trunk/Source/WebKit/win/WebFrame.cpp (90805 => 90806)


--- trunk/Source/WebKit/win/WebFrame.cpp	2011-07-12 02:20:09 UTC (rev 90805)
+++ trunk/Source/WebKit/win/WebFrame.cpp	2011-07-12 02:51:39 UTC (rev 90806)
@@ -1061,6 +1061,22 @@
     return hr;
 }
 
+HRESULT WebFrame::setTextDirection(BSTR direction)
+{
+    Frame* coreFrame = core(this);
+    if (!coreFrame || !coreFrame->editor())
+        return E_FAIL;
+
+    String directionString(direction, SysStringLen(direction));
+    if (directionString == "auto")
+        coreFrame->editor()->setBaseWritingDirection(NaturalWritingDirection);
+    else if (directionString == "ltr")
+        coreFrame->editor()->setBaseWritingDirection(LeftToRightWritingDirection);
+    else if (directionString == "rtl")
+        coreFrame->editor()->setBaseWritingDirection(RightToLeftWritingDirection);
+    return S_OK;
+}
+
 // IWebDocumentText -----------------------------------------------------------
 
 HRESULT STDMETHODCALLTYPE WebFrame::supportsTextEncoding( 

Modified: trunk/Source/WebKit/win/WebFrame.h (90805 => 90806)


--- trunk/Source/WebKit/win/WebFrame.h	2011-07-12 02:20:09 UTC (rev 90805)
+++ trunk/Source/WebKit/win/WebFrame.h	2011-07-12 02:51:39 UTC (rev 90806)
@@ -283,6 +283,8 @@
 
     virtual HRESULT STDMETHODCALLTYPE clearOpener();
 
+    virtual HRESULT STDMETHODCALLTYPE setTextDirection(BSTR);
+
     // IWebDocumentText
     virtual HRESULT STDMETHODCALLTYPE supportsTextEncoding( 
         /* [retval][out] */ BOOL* result);

Modified: trunk/Source/WebKit2/ChangeLog (90805 => 90806)


--- trunk/Source/WebKit2/ChangeLog	2011-07-12 02:20:09 UTC (rev 90805)
+++ trunk/Source/WebKit2/ChangeLog	2011-07-12 02:51:39 UTC (rev 90806)
@@ -1,3 +1,25 @@
+2011-07-11  Hironori Bono  <hb...@chromium.org>
+
+        Reviewed by Adam Roben.
+
+        Implement layoutTestController.setTextDirection for WebKit2 and Windows.
+        https://bugs.webkit.org/show_bug.cgi?id=61931
+
+        This change implements layoutTextController.setTextDirection for WebKit2
+        and Windows so we can run a layout test added by r87770 on them. Each
+        implementation adds a wrapper function for Editor::setBaseWritingDirection()
+        so LayoutTestController can call it.
+
+        * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: Added
+        WKBundleFrameSetTextDirection to allow LayoutTestController to change the
+        text direction.
+        (WKBundleFrameSetTextDirection):
+        * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h: ditto.
+        * WebProcess/WebPage/WebFrame.cpp: Added setTextDirection to allow
+        WKBundleFrame to change the text direction.
+        (WebKit::WebFrame::setTextDirection):
+        * WebProcess/WebPage/WebFrame.h: ditto.
+
 2011-07-11  Benjamin Poulain  <benja...@webkit.org>
 
         [Qt][WK2] Get rid of focusNextPrevChild()

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp (90805 => 90806)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp	2011-07-12 02:20:09 UTC (rev 90805)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp	2011-07-12 02:51:39 UTC (rev 90806)
@@ -235,3 +235,8 @@
 {
     return toImpl(frameRef)->containsAnyFormElements();
 }
+
+void WKBundleFrameSetTextDirection(WKBundleFrameRef frameRef, WKStringRef directionRef)
+{
+    toImpl(frameRef)->setTextDirection(toImpl(directionRef)->string());
+}

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h (90805 => 90806)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h	2011-07-12 02:20:09 UTC (rev 90805)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h	2011-07-12 02:51:39 UTC (rev 90806)
@@ -51,6 +51,7 @@
 WK_EXPORT void WKBundleFrameClearOpener(WKBundleFrameRef frame);
 
 WK_EXPORT bool WKBundleFrameContainsAnyFormElements(WKBundleFrameRef frame);
+WK_EXPORT void WKBundleFrameSetTextDirection(WKBundleFrameRef frame, WKStringRef);
 
 #ifdef __cplusplus
 }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp (90805 => 90806)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp	2011-07-12 02:20:09 UTC (rev 90805)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp	2011-07-12 02:51:39 UTC (rev 90806)
@@ -705,4 +705,17 @@
     return page()->cachedResponseMIMETypeForURL(url);
 }
 
+void WebFrame::setTextDirection(const String& direction)
+{
+    if (!m_coreFrame || !m_coreFrame->editor())
+        return;
+
+    if (direction == "auto")
+        m_coreFrame->editor()->setBaseWritingDirection(NaturalWritingDirection);
+    else if (direction == "ltr")
+        m_coreFrame->editor()->setBaseWritingDirection(LeftToRightWritingDirection);
+    else if (direction == "rtl")
+        m_coreFrame->editor()->setBaseWritingDirection(RightToLeftWritingDirection);
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h (90805 => 90806)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h	2011-07-12 02:20:09 UTC (rev 90805)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h	2011-07-12 02:51:39 UTC (rev 90806)
@@ -121,6 +121,8 @@
     String suggestedFilenameForResourceWithURL(const WebCore::KURL&) const;
     String mimeTypeForResourceWithURL(const WebCore::KURL&) const;
 
+    void setTextDirection(const String&);
+
     // Simple listener class used by plug-ins to know when frames finish or fail loading.
     class LoadListener {
     public:

Modified: trunk/Tools/ChangeLog (90805 => 90806)


--- trunk/Tools/ChangeLog	2011-07-12 02:20:09 UTC (rev 90805)
+++ trunk/Tools/ChangeLog	2011-07-12 02:51:39 UTC (rev 90806)
@@ -1,3 +1,24 @@
+2011-07-11  Hironori Bono  <hb...@chromium.org>
+
+        Reviewed by Adam Roben.
+
+        Implement layoutTestController.setTextDirection for WebKit2 and Windows.
+        https://bugs.webkit.org/show_bug.cgi?id=61931
+
+        This change implements layoutTextController.setTextDirection for WebKit2
+        and Windows so we can run a layout test added by r87770 on them. Each
+        implementation adds a wrapper function for Editor::setBaseWritingDirection()
+        so LayoutTestController can call it.
+
+        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
+        (LayoutTestController::setTextDirection): Implemented the binding function
+        for layoutTestController.setTextDirection (Windows).
+        * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
+        Added a binding function for layoutTestController.setTextDirection (WebKit2).
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp: ditto.
+        (WTR::LayoutTestController::setTextDirection):
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.h: ditto.
+
 2011-07-11  Raphael Kubo da Costa  <k...@profusion.mobi>
 
         [EFL] ImageDiff: Make sure gEcoreEvas is destroyed at the right time.

Modified: trunk/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp (90805 => 90806)


--- trunk/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp	2011-07-12 02:20:09 UTC (rev 90805)
+++ trunk/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp	2011-07-12 02:51:39 UTC (rev 90806)
@@ -1524,7 +1524,11 @@
 
 void LayoutTestController::setTextDirection(JSStringRef direction)
 {
-    // FIXME: Implement.
+    COMPtr<IWebFramePrivate> framePrivate(Query, frame);
+    if (!framePrivate)
+        return;
+
+    framePrivate->setTextDirection(bstrT(direction).GetBSTR());
 }
 
 void LayoutTestController::allowRoundingHacks()

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl (90805 => 90806)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl	2011-07-12 02:20:09 UTC (rev 90805)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl	2011-07-12 02:51:39 UTC (rev 90806)
@@ -108,6 +108,8 @@
 
         void setPOSIXLocale(in DOMString locale);
 
+        void setTextDirection(in DOMString direction);
+
         void setWillSendRequestReturnsNull(in boolean flag);
     };
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp (90805 => 90806)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp	2011-07-12 02:20:09 UTC (rev 90805)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp	2011-07-12 02:51:39 UTC (rev 90806)
@@ -473,4 +473,10 @@
     setlocale(LC_ALL, localeBuf);
 }
 
+void LayoutTestController::setTextDirection(JSStringRef direction)
+{
+    WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
+    return WKBundleFrameSetTextDirection(mainFrame, toWK(direction).get());
+}
+
 } // namespace WTR

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h (90805 => 90806)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h	2011-07-12 02:20:09 UTC (rev 90805)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h	2011-07-12 02:51:39 UTC (rev 90806)
@@ -162,6 +162,8 @@
     bool willSendRequestReturnsNull() { return m_willSendRequestReturnsNull; }
     void setWillSendRequestReturnsNull(bool f) { m_willSendRequestReturnsNull = f; }
 
+    void setTextDirection(JSStringRef);
+
 private:
     static const double waitToDumpWatchdogTimerInterval;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to