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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 appendTo.append(c); | 75 appendTo.append(c); |
| 76 } | 76 } |
| 77 | 77 |
| 78 static void serializeCharacterAsCodePoint(UChar32 c, StringBuilder& appendTo) | 78 static void serializeCharacterAsCodePoint(UChar32 c, StringBuilder& appendTo) |
| 79 { | 79 { |
| 80 appendTo.append('\\'); | 80 appendTo.append('\\'); |
| 81 appendUnsignedAsHex(c, appendTo, Lowercase); | 81 appendUnsignedAsHex(c, appendTo, Lowercase); |
| 82 appendTo.append(' '); | 82 appendTo.append(' '); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void serializeIdentifier(const String& identifier, StringBuilder& appendTo) | 85 void serializeIdentifier(const String& identifier, StringBuilder& appendTo, bool skipStartChecks) |
| 86 { | 86 { |
| 87 bool isFirst = true; | 87 bool isFirst = true; |
|
Timothy Loh
2016/06/23 21:37:32
could just write bool isFirst = !skipStartChecks;
ramya.v
2016/06/24 04:31:52
Done.
| |
| 88 if (skipStartChecks) | |
| 89 isFirst = false; | |
| 88 bool isSecond = false; | 90 bool isSecond = false; |
| 89 bool isFirstCharHyphen = false; | 91 bool isFirstCharHyphen = false; |
| 90 unsigned index = 0; | 92 unsigned index = 0; |
| 91 while (index < identifier.length()) { | 93 while (index < identifier.length()) { |
| 92 UChar32 c = identifier.characterStartingAt(index); | 94 UChar32 c = identifier.characterStartingAt(index); |
| 93 if (c == 0) { | 95 if (c == 0) { |
| 94 // Check for lone surrogate which characterStartingAt does not retur n. | 96 // Check for lone surrogate which characterStartingAt does not retur n. |
| 95 c = identifier[index]; | 97 c = identifier[index]; |
| 96 } | 98 } |
| 97 | 99 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 { | 151 { |
| 150 return "url(" + serializeString(string) + ")"; | 152 return "url(" + serializeString(string) + ")"; |
| 151 } | 153 } |
| 152 | 154 |
| 153 String serializeFontFamily(const String& string) | 155 String serializeFontFamily(const String& string) |
| 154 { | 156 { |
| 155 return isCSSTokenizerIdentifier(string) ? string : serializeString(string); | 157 return isCSSTokenizerIdentifier(string) ? string : serializeString(string); |
| 156 } | 158 } |
| 157 | 159 |
| 158 } // namespace blink | 160 } // namespace blink |
| OLD | NEW |