Title: [116470] trunk
Revision
116470
Author
[email protected]
Date
2012-05-08 17:42:52 -0700 (Tue, 08 May 2012)

Log Message

[EFL] Pass a WTF::String directly from DRT to ewebkit when possible
https://bugs.webkit.org/show_bug.cgi?id=84634

Reviewed by Gustavo Noronha Silva.

Drop unnecessary const char* -> WTF::String conversions by
creating String objects directly in LayoutTestController out of
JSStringRef's and passing them to DumpRenderTreeSupportEfl.

Source/WebKit/efl:

* WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
(DumpRenderTreeSupportEfl::setValueForUser):
(DumpRenderTreeSupportEfl::addUserStyleSheet):
(DumpRenderTreeSupportEfl::findString):
* WebCoreSupport/DumpRenderTreeSupportEfl.h:

Tools:

* DumpRenderTree/efl/LayoutTestControllerEfl.cpp:
(LayoutTestController::queueLoad):
(LayoutTestController::setValueForUser):
(LayoutTestController::findString):
(LayoutTestController::addUserStyleSheet):

Modified Paths

Diff

Modified: trunk/Source/WebKit/efl/ChangeLog (116469 => 116470)


--- trunk/Source/WebKit/efl/ChangeLog	2012-05-09 00:24:15 UTC (rev 116469)
+++ trunk/Source/WebKit/efl/ChangeLog	2012-05-09 00:42:52 UTC (rev 116470)
@@ -1,3 +1,20 @@
+2012-04-23  Raphael Kubo da Costa  <[email protected]>
+
+        [EFL] Pass a WTF::String directly from DRT to ewebkit when possible
+        https://bugs.webkit.org/show_bug.cgi?id=84634
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Drop unnecessary const char* -> WTF::String conversions by
+        creating String objects directly in LayoutTestController out of
+        JSStringRef's and passing them to DumpRenderTreeSupportEfl.
+
+        * WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
+        (DumpRenderTreeSupportEfl::setValueForUser):
+        (DumpRenderTreeSupportEfl::addUserStyleSheet):
+        (DumpRenderTreeSupportEfl::findString):
+        * WebCoreSupport/DumpRenderTreeSupportEfl.h:
+
 2012-05-08  Krzysztof Czech  <[email protected]>
 
         [EFL] Update documentation of ewk_frame_contents_alternate_set and ewk_view_zoom_range_set.

Modified: trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp (116469 => 116470)


--- trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp	2012-05-09 00:24:15 UTC (rev 116469)
+++ trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp	2012-05-09 00:42:52 UTC (rev 116470)
@@ -47,8 +47,6 @@
 #include <bindings/js/GCController.h>
 #include <history/HistoryItem.h>
 #include <workers/WorkerThread.h>
-#include <wtf/OwnArrayPtr.h>
-#include <wtf/text/AtomicString.h>
 
 unsigned DumpRenderTreeSupportEfl::activeAnimationsCount(const Evas_Object* ewkFrame)
 {
@@ -336,7 +334,7 @@
         animationController->suspendAnimations();
 }
 
-void DumpRenderTreeSupportEfl::setValueForUser(JSContextRef context, JSValueRef nodeObject, JSStringRef value)
+void DumpRenderTreeSupportEfl::setValueForUser(JSContextRef context, JSValueRef nodeObject, const String& value)
 {
     JSC::ExecState* exec = toJS(context);
     WebCore::Element* element = WebCore::toElement(toJS(exec, nodeObject));
@@ -346,10 +344,7 @@
     if (!inputElement)
         return;
 
-    size_t bufferSize = JSStringGetMaximumUTF8CStringSize(value);
-    OwnArrayPtr<char> valueBuffer = adoptArrayPtr(new char[bufferSize]);
-    JSStringGetUTF8CString(value, valueBuffer.get(), bufferSize);
-    inputElement->setValueForUser(String::fromUTF8(valueBuffer.get()));
+    inputElement->setValueForUser(value);
 }
 
 void DumpRenderTreeSupportEfl::setAutofilled(JSContextRef context, JSValueRef nodeObject, bool autofilled)
@@ -384,7 +379,7 @@
     page->settings()->setLoadsSiteIconsIgnoringImageLoadingSetting(loadsSiteIconsIgnoringImageLoadingPreferences);
 }
 
-void DumpRenderTreeSupportEfl::addUserStyleSheet(const Evas_Object* ewkView, const char* sourceCode, bool allFrames)
+void DumpRenderTreeSupportEfl::addUserStyleSheet(const Evas_Object* ewkView, const String& sourceCode, bool allFrames)
 {
     WebCore::Page* page = EWKPrivate::corePage(ewkView);
     if (!page)
@@ -402,14 +397,14 @@
     page->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value);
 }
 
-bool DumpRenderTreeSupportEfl::findString(const Evas_Object* ewkView, const char* text, WebCore::FindOptions options)
+bool DumpRenderTreeSupportEfl::findString(const Evas_Object* ewkView, const String& text, WebCore::FindOptions options)
 {
     WebCore::Page* page = EWKPrivate::corePage(ewkView);
 
     if (!page)
         return false;
 
-    return page->findString(String::fromUTF8(text), options);
+    return page->findString(text, options);
 }
 
 void DumpRenderTreeSupportEfl::setJavaScriptProfilingEnabled(const Evas_Object* ewkView, bool enabled)

Modified: trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h (116469 => 116470)


--- trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h	2012-05-09 00:24:15 UTC (rev 116469)
+++ trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h	2012-05-09 00:42:52 UTC (rev 116470)
@@ -66,14 +66,14 @@
     static WebCore::IntRect selectionRectangle(const Evas_Object* ewkFrame);
     static String suitableDRTFrameName(const Evas_Object* ewkFrame);
     static void suspendAnimations(Evas_Object* ewkFrame);
-    static void setValueForUser(JSContextRef, JSValueRef nodeObject, JSStringRef value);
+    static void setValueForUser(JSContextRef, JSValueRef nodeObject, const String& value);
     static void setAutofilled(JSContextRef, JSValueRef nodeObject, bool autofilled);
     static void setDefersLoading(Evas_Object* ewkView, bool defers);
     static void setLoadsSiteIconsIgnoringImageLoadingSetting(Evas_Object* ewkView, bool loadsSiteIconsIgnoringImageLoadingPreferences);
 
-    static void addUserStyleSheet(const Evas_Object* ewkView, const char* sourceCode, bool allFrames);
+    static void addUserStyleSheet(const Evas_Object* ewkView, const String& sourceCode, bool allFrames);
     static void executeCoreCommandByName(const Evas_Object* ewkView, const char* name, const char* value);
-    static bool findString(const Evas_Object* ewkView, const char* text, WebCore::FindOptions);
+    static bool findString(const Evas_Object* ewkView, const String& text, WebCore::FindOptions);
     static bool isCommandEnabled(const Evas_Object* ewkView, const char* name);
     static void setJavaScriptProfilingEnabled(const Evas_Object* ewkView, bool enabled);
     static void setSmartInsertDeleteEnabled(Evas_Object* ewkView, bool enabled);

Modified: trunk/Tools/ChangeLog (116469 => 116470)


--- trunk/Tools/ChangeLog	2012-05-09 00:24:15 UTC (rev 116469)
+++ trunk/Tools/ChangeLog	2012-05-09 00:42:52 UTC (rev 116470)
@@ -1,3 +1,20 @@
+2012-04-23  Raphael Kubo da Costa  <[email protected]>
+
+        [EFL] Pass a WTF::String directly from DRT to ewebkit when possible
+        https://bugs.webkit.org/show_bug.cgi?id=84634
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Drop unnecessary const char* -> WTF::String conversions by
+        creating String objects directly in LayoutTestController out of
+        JSStringRef's and passing them to DumpRenderTreeSupportEfl.
+
+        * DumpRenderTree/efl/LayoutTestControllerEfl.cpp:
+        (LayoutTestController::queueLoad):
+        (LayoutTestController::setValueForUser):
+        (LayoutTestController::findString):
+        (LayoutTestController::addUserStyleSheet):
+
 2012-05-08  Alexander Shalamov  <[email protected]>
 
         [EFL][DRT] EventSender needs implementation of leapForward function

Modified: trunk/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp (116469 => 116470)


--- trunk/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp	2012-05-09 00:24:15 UTC (rev 116469)
+++ trunk/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp	2012-05-09 00:42:52 UTC (rev 116470)
@@ -184,7 +184,7 @@
 void LayoutTestController::queueLoad(JSStringRef url, JSStringRef target)
 {
     WebCore::KURL baseURL(WebCore::KURL(), String::fromUTF8(ewk_frame_uri_get(browser->mainFrame())));
-    WebCore::KURL absoluteURL(baseURL, WTF::String(url->characters(), url->length()));
+    WebCore::KURL absoluteURL(baseURL, WTF::String(url->ustring().impl()));
 
     JSRetainPtr<JSStringRef> jsAbsoluteURL(
         Adopt, JSStringCreateWithUTF8CString(absoluteURL.string().utf8().data()));
@@ -270,7 +270,7 @@
 
 void LayoutTestController::setValueForUser(JSContextRef context, JSValueRef nodeObject, JSStringRef value)
 {
-    DumpRenderTreeSupportEfl::setValueForUser(context, nodeObject, value);
+    DumpRenderTreeSupportEfl::setValueForUser(context, nodeObject, WTF::String(value->ustring().impl()));
 }
 
 void LayoutTestController::setViewModeMediaFeature(JSStringRef mode)
@@ -515,7 +515,7 @@
             options |= WebCore::StartInSelection;
     }
 
-    return DumpRenderTreeSupportEfl::findString(browser->mainView(), target->ustring().utf8().data(), options);
+    return DumpRenderTreeSupportEfl::findString(browser->mainView(), WTF::String(target->ustring().impl()), options);
 }
 
 bool LayoutTestController::isCommandEnabled(JSStringRef name)
@@ -701,7 +701,7 @@
 
 void LayoutTestController::addUserStyleSheet(JSStringRef source, bool allFrames)
 {
-    DumpRenderTreeSupportEfl::addUserStyleSheet(browser->mainView(), source->ustring().utf8().data(), allFrames);
+    DumpRenderTreeSupportEfl::addUserStyleSheet(browser->mainView(), WTF::String(source->ustring().impl()), allFrames);
 }
 
 void LayoutTestController::setDeveloperExtrasEnabled(bool enabled)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to