summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/DatasetDOMStringMap.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2013-09-13 12:51:20 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-19 20:50:05 +0200
commitd441d6f39bb846989d95bcf5caf387b42414718d (patch)
treee367e64a75991c554930278175d403c072de6bb8 /Source/WebCore/dom/DatasetDOMStringMap.cpp
parent0060b2994c07842f4c59de64b5e3e430525c4b90 (diff)
downloadqtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit. Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/WebCore/dom/DatasetDOMStringMap.cpp')
-rw-r--r--Source/WebCore/dom/DatasetDOMStringMap.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/Source/WebCore/dom/DatasetDOMStringMap.cpp b/Source/WebCore/dom/DatasetDOMStringMap.cpp
index d82c8bc0a..adf3b781e 100644
--- a/Source/WebCore/dom/DatasetDOMStringMap.cpp
+++ b/Source/WebCore/dom/DatasetDOMStringMap.cpp
@@ -39,10 +39,9 @@ static bool isValidAttributeName(const String& name)
if (!name.startsWith("data-"))
return false;
- const UChar* characters = name.characters();
unsigned length = name.length();
for (unsigned i = 5; i < length; ++i) {
- if (isASCIIUpper(characters[i]))
+ if (isASCIIUpper(name[i]))
return false;
}
@@ -53,15 +52,14 @@ static String convertAttributeNameToPropertyName(const String& name)
{
StringBuilder stringBuilder;
- const UChar* characters = name.characters();
unsigned length = name.length();
for (unsigned i = 5; i < length; ++i) {
- UChar character = characters[i];
+ UChar character = name[i];
if (character != '-')
stringBuilder.append(character);
else {
- if ((i + 1 < length) && isASCIILower(characters[i + 1])) {
- stringBuilder.append(toASCIIUpper(characters[i + 1]));
+ if ((i + 1 < length) && isASCIILower(name[i + 1])) {
+ stringBuilder.append(toASCIIUpper(name[i + 1]));
++i;
} else
stringBuilder.append(character);
@@ -76,19 +74,18 @@ static bool propertyNameMatchesAttributeName(const String& propertyName, const S
if (!attributeName.startsWith("data-"))
return false;
- const UChar* property = propertyName.characters();
- const UChar* attribute = attributeName.characters();
unsigned propertyLength = propertyName.length();
unsigned attributeLength = attributeName.length();
-
+
unsigned a = 5;
unsigned p = 0;
bool wordBoundary = false;
while (a < attributeLength && p < propertyLength) {
- if (attribute[a] == '-' && a + 1 < attributeLength && attribute[a + 1] != '-')
+ const UChar currentAttributeNameChar = attributeName[a];
+ if (currentAttributeNameChar == '-' && a + 1 < attributeLength && attributeName[a + 1] != '-')
wordBoundary = true;
else {
- if ((wordBoundary ? toASCIIUpper(attribute[a]) : attribute[a]) != property[p])
+ if ((wordBoundary ? toASCIIUpper(currentAttributeNameChar) : currentAttributeNameChar) != propertyName[p])
return false;
p++;
wordBoundary = false;
@@ -101,10 +98,9 @@ static bool propertyNameMatchesAttributeName(const String& propertyName, const S
static bool isValidPropertyName(const String& name)
{
- const UChar* characters = name.characters();
unsigned length = name.length();
for (unsigned i = 0; i < length; ++i) {
- if (characters[i] == '-' && (i + 1 < length) && isASCIILower(characters[i + 1]))
+ if (name[i] == '-' && (i + 1 < length) && isASCIILower(name[i + 1]))
return false;
}
return true;
@@ -115,10 +111,9 @@ static String convertPropertyNameToAttributeName(const String& name)
StringBuilder builder;
builder.append("data-");
- const UChar* characters = name.characters();
unsigned length = name.length();
for (unsigned i = 0; i < length; ++i) {
- UChar character = characters[i];
+ UChar character = name[i];
if (isASCIIUpper(character)) {
builder.append('-');
builder.append(toASCIILower(character));