summaryrefslogtreecommitdiffstats
path: root/WebCore/css/FontFamilyValue.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-04-27 16:31:00 +0100
committerSteve Block <steveblock@google.com>2010-05-11 14:42:12 +0100
commitdcc8cf2e65d1aa555cce12431a16547e66b469ee (patch)
tree92a8d65cd5383bca9749f5327fb5e440563926e6 /WebCore/css/FontFamilyValue.cpp
parentccac38a6b48843126402088a309597e682f40fe6 (diff)
downloadexternal_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip
external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz
external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'WebCore/css/FontFamilyValue.cpp')
-rw-r--r--WebCore/css/FontFamilyValue.cpp41
1 files changed, 3 insertions, 38 deletions
diff --git a/WebCore/css/FontFamilyValue.cpp b/WebCore/css/FontFamilyValue.cpp
index 90a8c9d..ebe9645 100644
--- a/WebCore/css/FontFamilyValue.cpp
+++ b/WebCore/css/FontFamilyValue.cpp
@@ -21,44 +21,9 @@
#include "config.h"
#include "FontFamilyValue.h"
-namespace WebCore {
-
-// FIXME: This appears identical to isCSSTokenizerIdentifier from CSSPrimitiveValue.cpp, we should use a single function.
-static bool isValidCSSIdentifier(const String& string)
-{
- unsigned length = string.length();
- if (!length)
- return false;
-
- const UChar* characters = string.characters();
- UChar c = characters[0];
- if (!(c == '_' || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '-' || c >= 0x80))
- return false;
-
- for (unsigned i = 1; i < length; ++i) {
- c = characters[i];
- if (!(c == '_' || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '-' || c >= 0x80))
- return false;
- }
+#include "CSSParser.h"
- return true;
-}
-
-// Quotes the string if it needs quoting.
-// We use single quotes because serialization code uses double quotes, and it's nice to
-// avoid having to turn all the quote marks into &quot; as we would have to.
-static String quoteStringIfNeeded(const String& string)
-{
- if (isValidCSSIdentifier(string))
- return string;
-
- // FIXME: Also need to transform control characters (00-1F) into \ sequences.
- // FIXME: This is inefficient -- should use a Vector<UChar> instead.
- String quotedString = string;
- quotedString.replace('\\', "\\\\");
- quotedString.replace('\'', "\\'");
- return "'" + quotedString + "'";
-}
+namespace WebCore {
FontFamilyValue::FontFamilyValue(const String& familyName)
: CSSPrimitiveValue(String(), CSS_STRING)
@@ -101,7 +66,7 @@ void FontFamilyValue::appendSpaceSeparated(const UChar* characters, unsigned len
String FontFamilyValue::cssText() const
{
- return quoteStringIfNeeded(m_familyName);
+ return quoteCSSStringIfNeeded(m_familyName);
}
}