summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp')
-rw-r--r--Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp b/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
index 1e750e5..c41c15b 100644
--- a/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
+++ b/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
@@ -34,6 +34,8 @@
#include <runtime/StringPrototype.h>
#include <wtf/ASCIICType.h>
#include <wtf/text/AtomicString.h>
+#include <wtf/text/StringBuilder.h>
+#include <wtf/text/StringConcatenate.h>
using namespace JSC;
using namespace WTF;
@@ -94,8 +96,8 @@ static String cssPropertyName(const Identifier& propertyName, bool* hadPixelOrPo
if (!length)
return String();
- Vector<UChar> name;
- name.reserveInitialCapacity(length);
+ StringBuilder builder;
+ builder.reserveCapacity(length);
unsigned i = 0;
@@ -112,32 +114,30 @@ static String cssPropertyName(const Identifier& propertyName, bool* hadPixelOrPo
} else if (hasCSSPropertyNamePrefix(propertyName, "webkit")
|| hasCSSPropertyNamePrefix(propertyName, "khtml")
|| hasCSSPropertyNamePrefix(propertyName, "apple"))
- name.append('-');
+ builder.append('-');
else {
if (isASCIIUpper(propertyName.characters()[0]))
return String();
}
- name.append(toASCIILower(propertyName.characters()[i++]));
+ builder.append(toASCIILower(propertyName.characters()[i++]));
for (; i < length; ++i) {
UChar c = propertyName.characters()[i];
if (!isASCIIUpper(c))
- name.append(c);
- else {
- name.append('-');
- name.append(toASCIILower(c));
- }
+ builder.append(c);
+ else
+ builder.append(makeString('-', toASCIILower(c)));
}
- return String::adopt(name);
+ return builder.toString();
}
-static bool isCSSPropertyName(const Identifier& propertyName)
+static bool isCSSPropertyName(const Identifier& propertyIdentifier)
{
// FIXME: This mallocs a string for the property name and then throws it
// away. This shows up on peacekeeper's domDynamicCreationCreateElement.
- return CSSStyleDeclaration::isPropertyName(cssPropertyName(propertyName));
+ return CSSStyleDeclaration::isPropertyName(cssPropertyName(propertyIdentifier));
}
bool JSCSSStyleDeclaration::canGetItemsForName(ExecState*, CSSStyleDeclaration*, const Identifier& propertyName)
@@ -178,11 +178,11 @@ JSValue JSCSSStyleDeclaration::nameGetter(ExecState* exec, JSValue slotBase, con
bool JSCSSStyleDeclaration::putDelegate(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot&)
{
- if (!isCSSPropertyName(propertyName))
- return false;
-
bool pixelOrPos;
String prop = cssPropertyName(propertyName, &pixelOrPos);
+ if (!CSSStyleDeclaration::isPropertyName(prop))
+ return false;
+
String propValue = valueToStringWithNullCheck(exec, value);
if (pixelOrPos)
propValue += "px";