diff options
author | Ben Murdoch <benm@google.com> | 2011-06-02 12:07:03 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-10 10:47:21 +0100 |
commit | 2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch) | |
tree | e4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp | |
parent | 87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff) | |
download | external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2 |
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp')
-rw-r--r-- | Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp | 30 |
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"; |