2009-07-07 Nate Chapin <japhet@chromium.org>
authorjaphet@chromium.org <japhet@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Jul 2009 20:02:10 +0000 (20:02 +0000)
committerjaphet@chromium.org <japhet@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Jul 2009 20:02:10 +0000 (20:02 +0000)
        Reviewed by David Levin.

        Relanding r45559, which was rolled back at r45574.

        https://bugs.webkit.org/show_bug.cgi?id=26857

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@45603 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
WebCore/ChangeLog
WebCore/bindings/scripts/CodeGeneratorV8.pm
WebCore/bindings/v8/V8Binding.cpp [new file with mode: 0644]
WebCore/bindings/v8/V8Binding.h
WebCore/bindings/v8/V8LazyEventListener.cpp
WebCore/bindings/v8/V8Proxy.cpp
WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
WebCore/bindings/v8/custom/V8CustomXPathNSResolver.cpp
WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
WebCore/bindings/v8/custom/V8HTMLIFrameElementCustom.cpp
WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp
WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp

index cb3adcf..652caee 100644 (file)
@@ -1,3 +1,45 @@
+2009-07-07  Nate Chapin  <japhet@chromium.org>
+
+        Reviewed by David Levin.
+
+        Relanding r45559, which was rolled back at r45574.
+
+        https://bugs.webkit.org/show_bug.cgi?id=26857
+
+        * bindings/scripts/CodeGeneratorV8.pm: Updated a function name in auto-generated bindings.
+        * bindings/v8/V8Binding.cpp: Moved from src.chromium.org.
+        * bindings/v8/V8Binding.h: Contents moved from src.chromium.org.
+        * bindings/v8/V8LazyEventListener.cpp:
+        (WebCore::V8LazyEventListener::getListenerFunction):
+        * bindings/v8/V8Proxy.cpp:
+        (WebCore::handleConsoleMessage):
+        (WebCore::V8Proxy::compileScript):
+        (WebCore::V8Proxy::sourceName):
+        * bindings/v8/WorkerContextExecutionProxy.cpp:
+        (WebCore::handleConsoleMessage):
+        * bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp:
+        (WebCore::NAMED_PROPERTY_SETTER):
+        * bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8CustomXPathNSResolver.cpp:
+        (WebCore::V8CustomXPathNSResolver::lookupNamespaceURI):
+        * bindings/v8/custom/V8DOMWindowCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8HTMLIFrameElementCustom.cpp:
+        (WebCore::ACCESSOR_SETTER):
+        * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8HTMLSelectElementCustom.cpp:
+        (WebCore::removeElement):
+        * bindings/v8/custom/V8SQLTransactionCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8WorkerContextCustom.cpp:
+        (WebCore::SetTimeoutOrInterval):
+        * bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+
 2009-07-07  Gregory Hughes  <gfhughesVO+webkit@gmail.com>
 
         Reviewed by Darin Adler.
index a861c55..284c01b 100644 (file)
@@ -562,7 +562,7 @@ END
             $getterString = "imp_instance";
         }
         if ($nativeType eq "String") {
-            $getterString = "ToString($getterString)";
+            $getterString = "toString($getterString)";
         }
 
         my $result;
@@ -1053,7 +1053,7 @@ sub GenerateImplementation
     push(@implFixedHeader,
          "#include \"config.h\"\n" .
          "#include \"V8Proxy.h\"\n" .
-         "#include \"v8_binding.h\"\n\n" .
+         "#include \"V8Binding.h\"\n\n" .
          "#undef LOG\n\n");
 
     my $conditionalString;
@@ -1799,15 +1799,15 @@ sub JSValueToNative
     return "static_cast<$type>($value->NumberValue())" if $type eq "float" or $type eq "double";
     return "$value->NumberValue()" if $type eq "SVGNumber";
 
-    return "ToInt32($value${maybeOkParam})" if $type eq "unsigned long" or $type eq "unsigned short" or $type eq "long";
+    return "toInt32($value${maybeOkParam})" if $type eq "unsigned long" or $type eq "unsigned short" or $type eq "long";
     return "static_cast<Range::CompareHow>($value->Int32Value())" if $type eq "CompareHow";
     return "static_cast<SVGPaint::SVGPaintType>($value->ToInt32()->Int32Value())" if $type eq "SVGPaintType";
 
-    return "ToWebCoreString($value)" if $type eq "AtomicString" or $type eq "DOMUserData";
+    return "toWebCoreString($value)" if $type eq "AtomicString" or $type eq "DOMUserData";
     if ($type eq "DOMString") {
-        return "valueToStringWithNullCheck($value)" if $signature->extendedAttributes->{"ConvertNullToNullString"};
-        return "valueToStringWithNullOrUndefinedCheck($value)" if $signature->extendedAttributes->{"ConvertUndefinedOrNullToNullString"};
-        return "ToWebCoreString($value)";
+        return "toWebCoreStringWithNullCheck($value)" if $signature->extendedAttributes->{"ConvertNullToNullString"};
+        return "toWebCoreStringWithNullOrUndefinedCheck($value)" if $signature->extendedAttributes->{"ConvertUndefinedOrNullToNullString"};
+        return "toWebCoreString($value)";
     }
 
     if ($type eq "NodeFilter") {
diff --git a/WebCore/bindings/v8/V8Binding.cpp b/WebCore/bindings/v8/V8Binding.cpp
new file mode 100644 (file)
index 0000000..efc2075
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "V8Binding.h"
+
+#include "AtomicString.h"
+#include "CString.h"
+#include "MathExtras.h"
+#include "PlatformString.h"
+#include "StringBuffer.h"
+
+#include <v8.h>
+
+namespace WebCore {
+
+// WebCoreStringResource is a helper class for v8ExternalString. It is used
+// to manage the life-cycle of the underlying buffer of the external string.
+class WebCoreStringResource : public v8::String::ExternalStringResource {
+public:
+    explicit WebCoreStringResource(const String& string)
+        : m_impl(string.impl())
+    {
+    }
+
+    virtual ~WebCoreStringResource() { }
+
+    const uint16_t* data() const
+    {
+        return reinterpret_cast<const uint16_t*>(m_impl.characters());
+    }
+
+    size_t length() const { return m_impl.length(); }
+
+    String webcoreString() { return m_impl; }
+
+private:
+    // A shallow copy of the string. Keeps the string buffer alive until the V8 engine garbage collects it.
+    String m_impl;
+};
+
+String v8StringToWebCoreString(v8::Handle<v8::String> v8String, bool externalize)
+{
+    WebCoreStringResource* stringResource = static_cast<WebCoreStringResource*>(v8String->GetExternalStringResource());
+    if (stringResource)
+        return stringResource->webcoreString();
+
+    int length = v8String->Length();
+    if (!length) {
+        // Avoid trying to morph empty strings, as they do not have enough room to contain the external reference.
+        return StringImpl::empty();
+    }
+
+    UChar* buffer;
+    String result = String::createUninitialized(length, buffer);
+    v8String->Write(reinterpret_cast<uint16_t*>(buffer), 0, length);
+
+    if (externalize) {
+        WebCoreStringResource* resource = new WebCoreStringResource(result);
+        if (!v8String->MakeExternal(resource)) {
+            // In case of a failure delete the external resource as it was not used.
+            delete resource;
+        }
+    }
+    return result;
+}
+
+String v8ValueToWebCoreString(v8::Handle<v8::Value> object)
+{
+    if (object->IsString()) 
+        return v8StringToWebCoreString(v8::Handle<v8::String>::Cast(object), true);
+
+    if (object->IsInt32()) {
+        int value = object->Int32Value();
+        // Most numbers used are <= 100. Even if they aren't used there's very little in using the space.
+        const int kLowNumbers = 100;
+        static AtomicString lowNumbers[kLowNumbers + 1];
+        String webCoreString;
+        if (0 <= value && value <= kLowNumbers) {
+            webCoreString = lowNumbers[value];
+            if (!webCoreString) {
+                AtomicString valueString = AtomicString(String::number(value));
+                lowNumbers[value] = valueString;
+                webCoreString = valueString;
+            }
+        } else 
+            webCoreString = String::number(value);
+        return webCoreString;
+    }
+
+    v8::TryCatch block;
+    v8::Handle<v8::String> v8String = object->ToString();
+    // Check for empty handles to handle the case where an exception
+    // is thrown as part of invoking toString on the objectect.
+    if (v8String.IsEmpty())
+        return StringImpl::empty();
+    return v8StringToWebCoreString(v8String, false);
+}
+
+AtomicString v8StringToAtomicWebCoreString(v8::Handle<v8::String> v8String)
+{
+    String string = v8StringToWebCoreString(v8String, true);
+    return AtomicString(string);
+}
+
+AtomicString v8ValueToAtomicWebCoreString(v8::Handle<v8::Value> v8String)
+{
+    String string = v8ValueToWebCoreString(v8String);
+    return AtomicString(string);
+}
+
+v8::Handle<v8::String> v8String(const String& string)
+{
+    if (!string.length())
+        return v8::String::Empty();
+    return v8::String::NewExternal(new WebCoreStringResource(string));
+}
+
+v8::Local<v8::String> v8ExternalString(const String& string)
+{
+    if (!string.length())
+        return v8::String::Empty();
+    return v8::String::NewExternal(new WebCoreStringResource(string));
+}
+
+} // namespace WebCore
index 9fce3f2..2ef9f57 100644 (file)
 #ifndef V8Binding_h
 #define V8Binding_h
 
-// FIXME: This is a temporary forwarding header until all bindings have migrated
-// over and v8_binding actually becomes V8Binding.
-#include "v8_binding.h"
+#include "MathExtras.h"
+#include "PlatformString.h"
+
+#include <v8.h>
 
 namespace WebCore {
 
-    // FIXME: Remove once migration is complete.
+    // Convert v8 types to a WebCore::String. If the V8 string is not already
+    // an external string then it is transformed into an external string at this
+    // point to avoid repeated conversions.
+    String v8StringToWebCoreString(v8::Handle<v8::String>, bool externalize);
+    String v8ValueToWebCoreString(v8::Handle<v8::Value>);
+
+    // Convert v8 types to a WebCore::AtomicString.
+    AtomicString v8StringToAtomicWebCoreString(v8::Handle<v8::String>);
+    AtomicString v8ValueToAtomicWebCoreString(v8::Handle<v8::Value>);
+
+    // Convert a string to a V8 string.
+    v8::Handle<v8::String> v8String(const String&);
+
+    inline String toString(const String& string)\r
+    {\r
+        return string;\r
+    }
+
+    // Return a V8 external string that shares the underlying buffer with the given
+    // WebCore string. The reference counting mechanism is used to keep the
+    // underlying buffer alive while the string is still live in the V8 engine.
+    v8::Local<v8::String> v8ExternalString(const String&);
+
+    // Convert a value to a 32-bit integer.  The conversion fails if the
+    // value cannot be converted to an integer or converts to nan or to an infinity.
+    inline int toInt32(v8::Handle<v8::Value> value, bool& ok)
+    {
+        ok = true;
+
+        // Fast case.  The value is already a 32-bit integer.
+        if (value->IsInt32())
+            return value->Int32Value();
+
+        // Can the value be converted to a number?
+        v8::Local<v8::Number> numberObject = value->ToNumber();
+        if (numberObject.IsEmpty()) {
+            ok = false;
+            return 0;
+        }
+
+        // Does the value convert to nan or to an infinity?
+        double numberValue = numberObject->Value();
+        if (isnan(numberValue) || isinf(numberValue)) {
+            ok = false;
+            return 0;
+        }
+
+        // Can the value be converted to a 32-bit integer?
+        v8::Local<v8::Int32> intValue = value->ToInt32();
+        if (intValue.IsEmpty()) {
+            ok = false;
+            return 0;
+        }
+
+        // Return the result of the int32 conversion.
+        return intValue->Value();
+    }
+
+    // Convert a value to a 32-bit integer assuming the conversion cannot fail.
     inline int toInt32(v8::Handle<v8::Value> value)
     {
-        return ToInt32(value);
+        bool ok;
+        return toInt32(value, ok);
     }
 
     inline float toFloat(v8::Local<v8::Value> value)
@@ -48,22 +108,17 @@ namespace WebCore {
         return static_cast<float>(value->NumberValue());
     }
 
-    // FIXME: Remove once migration is complete.
-    inline String toWebCoreString(v8::Handle<v8::Value> obj)
+    // FIXME: Drop this in favor of the type specific v8ValueToWebCoreString when we rework the code generation.
+    inline String toWebCoreString(v8::Handle<v8::Value> object)
     {
-        return ToWebCoreString(obj);
+        return v8ValueToWebCoreString(object);
     }
 
-    // FIXME: Remove once migration is complete.
+    // The string returned by this function is still owned by the argument
+    // and will be deallocated when the argument is deallocated.
     inline const uint16_t* fromWebCoreString(const String& str)
     {
-        return FromWebCoreString(str);
-    }
-
-    // FIXME: Rename valueToStringWithNullCheck once migration is complete.
-    inline String toWebCoreStringWithNullCheck(v8::Handle<v8::Value> value)
-    {
-        return valueToStringWithNullCheck(value);
+        return reinterpret_cast<const uint16_t*>(str.characters());
     }
 
     inline bool isUndefinedOrNull(v8::Handle<v8::Value> value)
@@ -75,7 +130,40 @@ namespace WebCore {
     {
         return value ? v8::True() : v8::False();
     }
+   
+    inline String toWebCoreStringWithNullCheck(v8::Handle<v8::Value> value)
+    {
+        if (value->IsNull()) 
+            return String();
+        return v8ValueToWebCoreString(value);
+    }
+
+    inline String toWebCoreStringWithNullOrUndefinedCheck(v8::Handle<v8::Value> value)
+    {
+        if (value->IsNull() || value->IsUndefined())
+            return String();
+        return toWebCoreString(value);
+    }
+    inline v8::Handle<v8::String> v8UndetectableString(const String& str)
+    {
+        return v8::String::NewUndetectable(fromWebCoreString(str), str.length());
+    }
 
-}
+    inline v8::Handle<v8::Value> v8StringOrNull(const String& str)
+    {
+        return str.isNull() ? v8::Handle<v8::Value>(v8::Null()) : v8::Handle<v8::Value>(v8String(str));
+    }
+
+    inline v8::Handle<v8::Value> v8StringOrUndefined(const String& str)
+    {
+        return str.isNull() ? v8::Handle<v8::Value>(v8::Undefined()) : v8::Handle<v8::Value>(v8String(str));
+    }
+
+    inline v8::Handle<v8::Value> v8StringOrFalse(const String& str)
+    {
+        return str.isNull() ? v8::Handle<v8::Value>(v8::False()) : v8::Handle<v8::Value>(v8String(str));
+    }
+} // namespace WebCore
 
 #endif // V8Binding_h
index c2336aa..d4f079d 100644 (file)
@@ -110,7 +110,7 @@ v8::Local<v8::Function> V8LazyEventListener::getListenerFunction()
             if (!value.IsEmpty()) {
                 ASSERT(value->IsFunction());
                 v8::Local<v8::Function> listenerFunction = v8::Local<v8::Function>::Cast(value);
-                listenerFunction->SetName(v8::String::New(FromWebCoreString(m_functionName), m_functionName.length()));
+                listenerFunction->SetName(v8::String::New(fromWebCoreString(m_functionName), m_functionName.length()));
 
                 m_listener = v8::Persistent<v8::Function>::New(listenerFunction);
 #ifndef NDEBUG
index 86a6fb9..faec86b 100644 (file)
@@ -707,11 +707,11 @@ static void handleConsoleMessage(v8::Handle<v8::Message> message, v8::Handle<v8:
 
     v8::Handle<v8::String> errorMessageString = message->Get();
     ASSERT(!errorMessageString.IsEmpty());
-    String errorMessage = ToWebCoreString(errorMessageString);
+    String errorMessage = toWebCoreString(errorMessageString);
 
     v8::Handle<v8::Value> resourceName = message->GetScriptResourceName();
     bool useURL = resourceName.IsEmpty() || !resourceName->IsString();
-    String resourceNameString = useURL ? frame->document()->url() : ToWebCoreString(resourceName);
+    String resourceNameString = useURL ? frame->document()->url() : toWebCoreString(resourceName);
     JavaScriptConsoleMessage consoleMessage(errorMessage, resourceNameString, message->GetLineNumber());
     ConsoleMessageManager::addMessage(page, consoleMessage);
 }
@@ -965,7 +965,7 @@ void V8Proxy::disconnectEventListeners()
 
 v8::Handle<v8::Script> V8Proxy::compileScript(v8::Handle<v8::String> code, const String& fileName, int baseLine)
 {
-    const uint16_t* fileNameString = FromWebCoreString(fileName);
+    const uint16_t* fileNameString = fromWebCoreString(fileName);
     v8::Handle<v8::String> name = v8::String::New(fileNameString, fileName.length());
     v8::Handle<v8::Integer> line = v8::Integer::New(baseLine);
     v8::ScriptOrigin origin(name, line);
@@ -3208,7 +3208,7 @@ String V8Proxy::sourceName()
     frameSourceName = v8::Local<v8::Function>::Cast(v8UtilityContext->Global()->Get(v8::String::New("frameSourceName")));
     if (frameSourceName.IsEmpty())
         return String();
-    return ToWebCoreString(v8::Debug::Call(frameSourceName));
+    return toWebCoreString(v8::Debug::Call(frameSourceName));
 }
 
 void V8Proxy::registerExtension(v8::Extension* extension, const String& schemeRestriction)
index e95a06a..651dadb 100644 (file)
@@ -71,11 +71,11 @@ static void handleConsoleMessage(v8::Handle<v8::Message> message, v8::Handle<v8:
     
     v8::Handle<v8::String> errorMessageString = message->Get();
     ASSERT(!errorMessageString.IsEmpty());
-    String errorMessage = ToWebCoreString(errorMessageString);
+    String errorMessage = toWebCoreString(errorMessageString);
     
     v8::Handle<v8::Value> resourceName = message->GetScriptResourceName();
     bool useURL = (resourceName.IsEmpty() || !resourceName->IsString());
-    String resourceNameString = useURL ? workerContext->url() : ToWebCoreString(resourceName);
+    String resourceNameString = useURL ? workerContext->url() : toWebCoreString(resourceName);
     
     workerContext->addMessage(ConsoleDestination, JSMessageSource, ErrorMessageLevel, errorMessage, message->GetLineNumber(), resourceNameString);
 }
index 42e1621..f9480f9 100644 (file)
@@ -201,7 +201,7 @@ NAMED_PROPERTY_SETTER(CSSStyleDeclaration)
     if (!propInfo)
         return notHandledByInterceptor();
 
-    String propertyValue = valueToStringWithNullCheck(value);
+    String propertyValue = toWebCoreStringWithNullCheck(value);
     if (propInfo->hadPixelOrPosPrefix)
         propertyValue.append("px");
 
index e9d8105..cd9411d 100644 (file)
@@ -105,13 +105,13 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetStrokeColor)
     switch (args.Length()) {
     case 1:
         if (args[0]->IsString())
-            context->setStrokeColor(ToWebCoreString(args[0]));
+            context->setStrokeColor(toWebCoreString(args[0]));
         else
             context->setStrokeColor(toFloat(args[0]));
         break;
     case 2:
         if (args[0]->IsString())
-            context->setStrokeColor(ToWebCoreString(args[0]), toFloat(args[1]));
+            context->setStrokeColor(toWebCoreString(args[0]), toFloat(args[1]));
         else
             context->setStrokeColor(toFloat(args[0]), toFloat(args[1]));
         break;
@@ -135,13 +135,13 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetFillColor)
     switch (args.Length()) {
     case 1:
         if (args[0]->IsString())
-            context->setFillColor(ToWebCoreString(args[0]));
+            context->setFillColor(toWebCoreString(args[0]));
         else 
             context->setFillColor(toFloat(args[0]));
         break;
     case 2:
         if (args[0]->IsString())
-            context->setFillColor(ToWebCoreString(args[0]), toFloat(args[1]));
+            context->setFillColor(toWebCoreString(args[0]), toFloat(args[1]));
         else
             context->setFillColor(toFloat(args[0]), toFloat(args[1]));
         break;
@@ -184,13 +184,13 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetShadow)
         break;
     case 4:
         if (args[3]->IsString())
-            context->setShadow(toFloat(args[0]), toFloat(args[1]), toFloat(args[2]), ToWebCoreString(args[3]));
+            context->setShadow(toFloat(args[0]), toFloat(args[1]), toFloat(args[2]), toWebCoreString(args[3]));
         else
             context->setShadow(toFloat(args[0]), toFloat(args[1]), toFloat(args[2]), toFloat(args[3]));
         break;
     case 5:
         if (args[3]->IsString())
-            context->setShadow(toFloat(args[0]), toFloat(args[1]), toFloat(args[2]), ToWebCoreString(args[3]), toFloat(args[4]));
+            context->setShadow(toFloat(args[0]), toFloat(args[1]), toFloat(args[2]), toWebCoreString(args[3]), toFloat(args[4]));
         else
             context->setShadow(toFloat(args[0]), toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]));
         break;
@@ -291,7 +291,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DDrawImageFromRect)
 
     if (V8HTMLImageElement::HasInstance(arg)) {
         HTMLImageElement* image_element = V8Proxy::convertDOMWrapperToNode<HTMLImageElement>(arg);
-        context->drawImageFromRect(image_element,  toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]), toFloat(args[5]), toFloat(args[6]), toFloat(args[7]), toFloat(args[8]), ToWebCoreString(args[9]));
+        context->drawImageFromRect(image_element,  toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]), toFloat(args[5]), toFloat(args[6]), toFloat(args[7]), toFloat(args[8]), toWebCoreString(args[9]));
     } else
         V8Proxy::throwError(V8Proxy::TypeError, "drawImageFromRect: Invalid type of arguments");
 
@@ -308,7 +308,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DCreatePattern)
     if (V8HTMLImageElement::HasInstance(arg)) {
         HTMLImageElement* image_element = V8Proxy::convertDOMWrapperToNode<HTMLImageElement>(arg);
         ExceptionCode ec = 0;
-        RefPtr<CanvasPattern> pattern = context->createPattern(image_element, valueToStringWithNullCheck(args[1]), ec);
+        RefPtr<CanvasPattern> pattern = context->createPattern(image_element, toWebCoreStringWithNullCheck(args[1]), ec);
         if (ec != 0) {
             V8Proxy::setDOMException(ec);
             return notHandledByInterceptor();
@@ -319,7 +319,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DCreatePattern)
     if (V8HTMLCanvasElement::HasInstance(arg)) {
         HTMLCanvasElement* canvas_element = V8Proxy::convertDOMWrapperToNode<HTMLCanvasElement>(arg);
         ExceptionCode ec = 0;
-        RefPtr<CanvasPattern> pattern = context->createPattern(canvas_element, valueToStringWithNullCheck(args[1]), ec);
+        RefPtr<CanvasPattern> pattern = context->createPattern(canvas_element, toWebCoreStringWithNullCheck(args[1]), ec);
         if (ec != 0) {
             V8Proxy::setDOMException(ec);
             return notHandledByInterceptor();
@@ -345,7 +345,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DFillText)
         return notHandledByInterceptor();
     }
 
-    String text = ToWebCoreString(args[0]);
+    String text = toWebCoreString(args[0]);
     float x = toFloat(args[1]);
     float y = toFloat(args[2]);
 
@@ -371,7 +371,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DStrokeText)
         return notHandledByInterceptor();
     }
 
-    String text = ToWebCoreString(args[0]);
+    String text = toWebCoreString(args[0]);
     float x = toFloat(args[1]);
     float y = toFloat(args[2]);
 
index f25c316..1458c12 100644 (file)
@@ -80,7 +80,7 @@ String V8CustomXPathNSResolver::lookupNamespaceURI(const String& prefix)
     if (try_catch.HasCaught())
         return String();
 
-    return valueToStringWithNullCheck(retval);
+    return toWebCoreStringWithNullCheck(retval);
 }
 
 } // namespace WebCore
index f47700a..0ebe934 100644 (file)
@@ -277,9 +277,9 @@ CALLBACK_FUNC_DECL(DOMWindowPostMessage)
     if (args.Length() > 2) {
         if (V8Proxy::isWrapperOfType(args[1], V8ClassIndex::MESSAGEPORT))
             port = V8Proxy::convertToNativeObject<MessagePort>(V8ClassIndex::MESSAGEPORT, args[1]);
-        targetOrigin = valueToStringWithNullOrUndefinedCheck(args[2]);
+        targetOrigin = toWebCoreStringWithNullOrUndefinedCheck(args[2]);
     } else {
-        targetOrigin = valueToStringWithNullOrUndefinedCheck(args[1]);
+        targetOrigin = toWebCoreStringWithNullOrUndefinedCheck(args[1]);
     }
 
     if (tryCatch.HasCaught())
@@ -562,9 +562,9 @@ CALLBACK_FUNC_DECL(DOMWindowShowModalDialog)
     if (!canShowModalDialogNow(frame) || !allowPopUp())
         return v8::Undefined();
 
-    String url = valueToStringWithNullOrUndefinedCheck(args[0]);
+    String url = toWebCoreStringWithNullOrUndefinedCheck(args[0]);
     v8::Local<v8::Value> dialogArgs = args[1];
-    String featureArgs = valueToStringWithNullOrUndefinedCheck(args[2]);
+    String featureArgs = toWebCoreStringWithNullOrUndefinedCheck(args[2]);
 
     const HashMap<String, String> features = parseModalDialogFeatures(featureArgs);
 
@@ -651,7 +651,7 @@ CALLBACK_FUNC_DECL(DOMWindowOpen)
     if (!page)
         return v8::Undefined();
 
-    String urlString = valueToStringWithNullOrUndefinedCheck(args[0]);
+    String urlString = toWebCoreStringWithNullOrUndefinedCheck(args[0]);
     AtomicString frameName = (args[1]->IsUndefined() || args[1]->IsNull()) ? "_blank" : AtomicString(toWebCoreString(args[1]));
 
     // Because FrameTree::find() returns true for empty strings, we must check
@@ -700,7 +700,7 @@ CALLBACK_FUNC_DECL(DOMWindowOpen)
     // Parse the values, and then work with a copy of the parsed values
     // so we can restore the values we may not want to overwrite after
     // we do the multiple monitor fixes.
-    WindowFeatures rawFeatures(valueToStringWithNullOrUndefinedCheck(args[2]));
+    WindowFeatures rawFeatures(toWebCoreStringWithNullOrUndefinedCheck(args[2]));
     WindowFeatures windowFeatures(rawFeatures);
     FloatRect screenRect = screenAvailableRect(page->mainFrame()->view());
 
index 81ecb44..39fc683 100644 (file)
@@ -43,7 +43,7 @@ CALLBACK_FUNC_DECL(HTMLCanvasElementGetContext)
     INC_STATS("DOM.HTMLCanvasElement.context");
     v8::Handle<v8::Value> holder = args.Holder();
     HTMLCanvasElement* imp = V8Proxy::convertDOMWrapperToNode<HTMLCanvasElement>(holder);
-    String contextId = ToWebCoreString(args[0]);
+    String contextId = toWebCoreString(args[0]);
     CanvasRenderingContext2D* result = imp->getContext(contextId);
     return V8Proxy::convertToV8Object(V8ClassIndex::CANVASRENDERINGCONTEXT2D, result);
 }
index 4e446b6..485c58e 100644 (file)
@@ -40,7 +40,7 @@ namespace WebCore {
 ACCESSOR_SETTER(HTMLIFrameElementSrc)
 {
     HTMLIFrameElement* iframe = V8Proxy::convertDOMWrapperToNode<HTMLIFrameElement>(info.Holder());
-    String v = valueToStringWithNullCheck(value);
+    String v = toWebCoreStringWithNullCheck(value);
 
     if (!allowSettingFrameSrcToJavascriptUrl(iframe, v))
         return;
index aff0620..9779102 100644 (file)
@@ -67,7 +67,7 @@ CALLBACK_FUNC_DECL(HTMLOptionsCollectionAdd)
     else {
         bool ok;
         v8::TryCatch try_catch;
-        int index = ToInt32(args[1], ok);
+        int index = toInt32(args[1], ok);
 
         if (try_catch.HasCaught())
             return v8::Undefined();
index 7afdd00..b222377 100644 (file)
@@ -56,7 +56,7 @@ v8::Handle<v8::Value> removeElement(HTMLSelectElement* imp, const v8::Arguments&
         return v8::Undefined();
     }
 
-    imp->remove(ToInt32(args[0]));
+    imp->remove(toInt32(args[0]));
     return v8::Undefined();
 }
 
index 89178b8..4d86055 100644 (file)
@@ -54,7 +54,7 @@ CALLBACK_FUNC_DECL(SQLTransactionExecuteSql)
         return v8::Undefined();
     }
 
-    String statement = ToWebCoreString(args[0]);
+    String statement = toWebCoreString(args[0]);
 
     Vector<SQLValue> sqlValues;
 
@@ -75,7 +75,7 @@ CALLBACK_FUNC_DECL(SQLTransactionExecuteSql)
             else if (value->IsNumber())
                 sqlValues.append(SQLValue(value->NumberValue()));
             else
-                sqlValues.append(SQLValue(ToWebCoreString(value)));
+                sqlValues.append(SQLValue(toWebCoreString(value)));
         }
     }
 
index af3f80d..6e1b333 100755 (executable)
@@ -105,7 +105,7 @@ v8::Handle<v8::Value> SetTimeoutOrInterval(const v8::Arguments& args, bool singl
     int timerId;
 
     if (function->IsString()) {
-        WebCore::String stringFunction = ToWebCoreString(function);
+        WebCore::String stringFunction = toWebCoreString(function);
         timerId = DOMTimer::install(workerContext, new ScheduledAction(stringFunction, workerContext->url()), timeout, singleShot);
     } else if (function->IsFunction()) {
         size_t paramCount = argumentCount >= 2 ? argumentCount - 2 : 0;
index aea49bf..109bbc8 100644 (file)
@@ -345,10 +345,10 @@ CALLBACK_FUNC_DECL(XMLHttpRequestOpen)
     ExceptionCode ec = 0;
     String user, passwd;
     if (args.Length() >= 4 && !args[3]->IsUndefined()) {
-        user = valueToStringWithNullCheck(args[3]);
+        user = toWebCoreStringWithNullCheck(args[3]);
 
         if (args.Length() >= 5 && !args[4]->IsUndefined()) {
-            passwd = valueToStringWithNullCheck(args[4]);
+            passwd = toWebCoreStringWithNullCheck(args[4]);
             xmlHttpRequest->open(method, url, async, user, passwd, ec);
         } else
             xmlHttpRequest->open(method, url, async, user, ec);
@@ -384,7 +384,7 @@ CALLBACK_FUNC_DECL(XMLHttpRequestSend)
             ASSERT(document);
             xmlHttpRequest->send(document, ec);
         } else
-            xmlHttpRequest->send(valueToStringWithNullCheck(arg), ec);
+            xmlHttpRequest->send(toWebCoreStringWithNullCheck(arg), ec);
     }
 
     if (ec)