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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 { | 204 { |
| 205 bool isFirst = true; | 205 bool isFirst = true; |
| 206 bool isSecond = false; | 206 bool isSecond = false; |
| 207 bool isFirstCharHyphen = false; | 207 bool isFirstCharHyphen = false; |
| 208 unsigned index = 0; | 208 unsigned index = 0; |
| 209 while (index < identifier.length()) { | 209 while (index < identifier.length()) { |
| 210 UChar32 c = identifier.characterStartingAt(index); | 210 UChar32 c = identifier.characterStartingAt(index); |
| 211 if (c == 0) { | 211 if (c == 0) { |
| 212 // Check for lone surrogate which characterStartingAt does not retur n. | 212 // Check for lone surrogate which characterStartingAt does not retur n. |
| 213 c = identifier[index]; | 213 c = identifier[index]; |
| 214 if (c == 0) | |
| 215 return false; | |
|
Timothy Loh
2015/12/03 04:08:03
If this no longer returns false, we should just ma
ramya.v
2015/12/03 06:33:46
Done.
ramya.v
2015/12/03 06:33:46
Made changes to return type.
RaisesException is us
Timothy Loh
2015/12/03 07:16:51
I checked and the code works without RaisesExcepti
| |
| 216 } | 214 } |
| 217 | 215 |
| 218 index += U16_LENGTH(c); | 216 index += U16_LENGTH(c); |
| 219 | 217 |
| 220 if (c <= 0x1f || c == 0x7f || (0x30 <= c && c <= 0x39 && (isFirst || (is Second && isFirstCharHyphen)))) | 218 if (c <= 0x1f || c == 0x7f || (0x30 <= c && c <= 0x39 && (isFirst || (is Second && isFirstCharHyphen)))) |
| 221 serializeCharacterAsCodePoint(c, appendTo); | 219 serializeCharacterAsCodePoint(c, appendTo); |
| 220 else if (c == 0) | |
|
Timothy Loh
2015/12/03 07:16:51
Your code is returning \0 because the previous if
| |
| 221 serializeCharacterAsCodePoint(0xfffd, appendTo); | |
| 222 else if (c == 0x2d && isFirst && index == identifier.length()) | 222 else if (c == 0x2d && isFirst && index == identifier.length()) |
| 223 serializeCharacter(c, appendTo); | 223 serializeCharacter(c, appendTo); |
| 224 else if (0x80 <= c || c == 0x2d || c == 0x5f || (0x30 <= c && c <= 0x39) || (0x41 <= c && c <= 0x5a) || (0x61 <= c && c <= 0x7a)) | 224 else if (0x80 <= c || c == 0x2d || c == 0x5f || (0x30 <= c && c <= 0x39) || (0x41 <= c && c <= 0x5a) || (0x61 <= c && c <= 0x7a)) |
| 225 appendTo.append(c); | 225 appendTo.append(c); |
| 226 else | 226 else |
| 227 serializeCharacter(c, appendTo); | 227 serializeCharacter(c, appendTo); |
| 228 | 228 |
| 229 if (isFirst) { | 229 if (isFirst) { |
| 230 isFirst = false; | 230 isFirst = false; |
| 231 isSecond = true; | 231 isSecond = true; |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 262 serializeString(string, builder); | 262 serializeString(string, builder); |
| 263 return builder.toString(); | 263 return builder.toString(); |
| 264 } | 264 } |
| 265 | 265 |
| 266 String serializeURI(const String& string) | 266 String serializeURI(const String& string) |
| 267 { | 267 { |
| 268 return "url(" + serializeString(string) + ")"; | 268 return "url(" + serializeString(string) + ")"; |
| 269 } | 269 } |
| 270 | 270 |
| 271 } // namespace blink | 271 } // namespace blink |
| OLD | NEW |