OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ | 3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ |
4 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 4 * Copyright (C) 2010 Google, Inc. All Rights Reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 unconsumeCharacters(source, consumedCharacters); | 124 unconsumeCharacters(source, consumedCharacters); |
125 return false; | 125 return false; |
126 } | 126 } |
127 if (entitySearch.mostRecentMatch()->length != entitySearch.currentLength())
{ | 127 if (entitySearch.mostRecentMatch()->length != entitySearch.currentLength())
{ |
128 // We've consumed too many characters. We need to walk the | 128 // We've consumed too many characters. We need to walk the |
129 // source back to the point at which we had consumed an | 129 // source back to the point at which we had consumed an |
130 // actual entity. | 130 // actual entity. |
131 unconsumeCharacters(source, consumedCharacters); | 131 unconsumeCharacters(source, consumedCharacters); |
132 consumedCharacters.clear(); | 132 consumedCharacters.clear(); |
133 const int length = entitySearch.mostRecentMatch()->length; | 133 const int length = entitySearch.mostRecentMatch()->length; |
134 const UChar* reference = entitySearch.mostRecentMatch()->entity; | 134 const LChar* reference = entitySearch.mostRecentMatch()->entity; |
135 for (int i = 0; i < length; ++i) { | 135 for (int i = 0; i < length; ++i) { |
136 cc = source.currentChar(); | 136 cc = source.currentChar(); |
137 ASSERT_UNUSED(reference, cc == *reference++); | 137 ASSERT_UNUSED(reference, cc == *reference++); |
138 consumedCharacters.append(cc); | 138 consumedCharacters.append(cc); |
139 source.advanceAndASSERT(cc); | 139 source.advanceAndASSERT(cc); |
140 ASSERT(!source.isEmpty()); | 140 ASSERT(!source.isEmpty()); |
141 } | 141 } |
142 cc = source.currentChar(); | 142 cc = source.currentChar(); |
143 } | 143 } |
144 if (entitySearch.mostRecentMatch()->lastCharacter() == ';' | 144 if (entitySearch.mostRecentMatch()->lastCharacter() == ';' |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 if (!search.isEntityPrefix()) | 295 if (!search.isEntityPrefix()) |
296 return 0; | 296 return 0; |
297 | 297 |
298 size_t numberOfCodePoints = appendUChar32ToUCharArray(search.mostRecentMatch
()->firstValue, result); | 298 size_t numberOfCodePoints = appendUChar32ToUCharArray(search.mostRecentMatch
()->firstValue, result); |
299 if (!search.mostRecentMatch()->secondValue) | 299 if (!search.mostRecentMatch()->secondValue) |
300 return numberOfCodePoints; | 300 return numberOfCodePoints; |
301 return numberOfCodePoints + appendUChar32ToUCharArray(search.mostRecentMatch
()->secondValue, result + numberOfCodePoints); | 301 return numberOfCodePoints + appendUChar32ToUCharArray(search.mostRecentMatch
()->secondValue, result + numberOfCodePoints); |
302 } | 302 } |
303 | 303 |
304 } // namespace WebCore | 304 } // namespace WebCore |
OLD | NEW |