Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
| 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
| 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
| 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
| 10 * | 10 * |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 appendTo.append('\"'); | 256 appendTo.append('\"'); |
| 257 } | 257 } |
| 258 | 258 |
| 259 String serializeString(const String& string) | 259 String serializeString(const String& string) |
| 260 { | 260 { |
| 261 StringBuilder builder; | 261 StringBuilder builder; |
| 262 serializeString(string, builder); | 262 serializeString(string, builder); |
| 263 return builder.toString(); | 263 return builder.toString(); |
| 264 } | 264 } |
| 265 | 265 |
| 266 String serializeStringWithoutQuotations(const String& string) | |
|
Timothy Loh
2015/09/15 12:20:47
Is this a separate change?
nainar
2015/09/16 07:16:49
Answered above.
| |
| 267 { | |
| 268 StringBuilder appendTo; | |
| 269 | |
| 270 unsigned index = 0; | |
| 271 while (index < string.length()) { | |
| 272 UChar32 c = string.characterStartingAt(index); | |
| 273 index += U16_LENGTH(c); | |
| 274 if (c <= 0x1f) | |
| 275 serializeCharacterAsCodePoint(c, appendTo); | |
| 276 else if (c == 0x22 || c == 0x5c) | |
| 277 serializeCharacter(c, appendTo); | |
| 278 else | |
| 279 appendTo.append(c); | |
| 280 } | |
| 281 | |
| 282 return appendTo.toString(); | |
| 283 } | |
| 284 | |
| 266 } // namespace blink | 285 } // namespace blink |
| OLD | NEW |