summaryrefslogtreecommitdiff
path: root/Source/WebCore/html/HTMLFontElement.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-29 12:18:48 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-29 12:18:57 +0100
commit4c01d0526ba4dd8cff0c0ff22a6f0ab5eb973064 (patch)
treebed2fe914fe0f7ec70abfb47d2d84af8a3604d09 /Source/WebCore/html/HTMLFontElement.cpp
parent01485457c9a5da3f1121015afd25bb53af77662e (diff)
downloadqtwebkit-4c01d0526ba4dd8cff0c0ff22a6f0ab5eb973064.tar.gz
Imported WebKit commit c60cfe0fc09efd257aa0111d7b133b02deb8a63e (http://svn.webkit.org/repository/webkit/trunk@136119)
New snapshot that includes the fix for installing the QtWebProcess into libexec Change-Id: I01344e079cbdac5678c4cba6ffcc05f4597cf0d7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/WebCore/html/HTMLFontElement.cpp')
-rw-r--r--Source/WebCore/html/HTMLFontElement.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/Source/WebCore/html/HTMLFontElement.cpp b/Source/WebCore/html/HTMLFontElement.cpp
index a5bc8de31..1bad02e73 100644
--- a/Source/WebCore/html/HTMLFontElement.cpp
+++ b/Source/WebCore/html/HTMLFontElement.cpp
@@ -51,13 +51,14 @@ PassRefPtr<HTMLFontElement> HTMLFontElement::create(const QualifiedName& tagName
}
// http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#fonts-and-colors
-static bool parseFontSize(const String& input, int& size)
+template <typename CharacterType>
+static bool parseFontSize(const CharacterType* characters, unsigned length, int& size)
{
// Step 1
// Step 2
- const UChar* position = input.characters();
- const UChar* end = position + input.length();
+ const CharacterType* position = characters;
+ const CharacterType* end = characters + length;
// Step 3
while (position < end) {
@@ -106,7 +107,12 @@ static bool parseFontSize(const String& input, int& size)
return false;
// Step 8
- int value = charactersToIntStrict(digits.characters(), digits.length());
+ int value;
+
+ if (digits.is8Bit())
+ value = charactersToIntStrict(digits.characters8(), digits.length());
+ else
+ value = charactersToIntStrict(digits.characters16(), digits.length());
// Step 9
if (mode == RelativePlus)
@@ -126,6 +132,17 @@ static bool parseFontSize(const String& input, int& size)
return true;
}
+static bool parseFontSize(const String& input, int& size)
+{
+ if (input.isEmpty())
+ return false;
+
+ if (input.is8Bit())
+ return parseFontSize(input.characters8(), input.length(), size);
+
+ return parseFontSize(input.characters16(), input.length(), size);
+}
+
bool HTMLFontElement::cssValueFromFontSizeNumber(const String& s, int& size)
{
int num = 0;