Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1061)

Unified Diff: third_party/WebKit/Source/core/css/CSSMarkup.cpp

Issue 1498473004: CSS.escape('\0') should not throw. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding idl file changes Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSMarkup.h ('k') | third_party/WebKit/Source/core/css/DOMWindowCSS.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/CSSMarkup.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSMarkup.cpp b/third_party/WebKit/Source/core/css/CSSMarkup.cpp
index 7c5e890579db48b3c997dffb425a2d0530aeaaf0..8515fca97654276be2ca12c982fbde3fa5c984b4 100644
--- a/third_party/WebKit/Source/core/css/CSSMarkup.cpp
+++ b/third_party/WebKit/Source/core/css/CSSMarkup.cpp
@@ -200,7 +200,7 @@ static void serializeCharacterAsCodePoint(UChar32 c, StringBuilder& appendTo)
appendTo.append(' ');
}
-bool serializeIdentifier(const String& identifier, StringBuilder& appendTo)
+void serializeIdentifier(const String& identifier, StringBuilder& appendTo)
{
bool isFirst = true;
bool isSecond = false;
@@ -211,13 +211,13 @@ bool serializeIdentifier(const String& identifier, StringBuilder& appendTo)
if (c == 0) {
// Check for lone surrogate which characterStartingAt does not return.
c = identifier[index];
- if (c == 0)
- return false;
}
index += U16_LENGTH(c);
- if (c <= 0x1f || c == 0x7f || (0x30 <= c && c <= 0x39 && (isFirst || (isSecond && isFirstCharHyphen))))
+ if (c == 0)
+ appendTo.append(0xfffd);
+ else if (c <= 0x1f || c == 0x7f || (0x30 <= c && c <= 0x39 && (isFirst || (isSecond && isFirstCharHyphen))))
serializeCharacterAsCodePoint(c, appendTo);
else if (c == 0x2d && isFirst && index == identifier.length())
serializeCharacter(c, appendTo);
@@ -234,7 +234,6 @@ bool serializeIdentifier(const String& identifier, StringBuilder& appendTo)
isSecond = false;
}
}
- return true;
}
void serializeString(const String& string, StringBuilder& appendTo)
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSMarkup.h ('k') | third_party/WebKit/Source/core/css/DOMWindowCSS.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698