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

Side by Side Diff: Source/core/html/parser/HTMLEntitySearch.cpp

Issue 199103002: Better storage of HTML entities. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 months 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 29 matching lines...) Expand all
40 , m_mostRecentMatch(0) 40 , m_mostRecentMatch(0)
41 , m_first(HTMLEntityTable::firstEntry()) 41 , m_first(HTMLEntityTable::firstEntry())
42 , m_last(HTMLEntityTable::lastEntry()) 42 , m_last(HTMLEntityTable::lastEntry())
43 { 43 {
44 } 44 }
45 45
46 HTMLEntitySearch::CompareResult HTMLEntitySearch::compare(const HTMLEntityTableE ntry* entry, UChar nextCharacter) const 46 HTMLEntitySearch::CompareResult HTMLEntitySearch::compare(const HTMLEntityTableE ntry* entry, UChar nextCharacter) const
47 { 47 {
48 if (entry->length < m_currentLength + 1) 48 if (entry->length < m_currentLength + 1)
49 return Before; 49 return Before;
50 UChar entryNextCharacter = entry->entity[m_currentLength]; 50 const LChar* entityString = HTMLEntityTable::entityString(*entry);
51 UChar entryNextCharacter = entityString[m_currentLength];
51 if (entryNextCharacter == nextCharacter) 52 if (entryNextCharacter == nextCharacter)
52 return Prefix; 53 return Prefix;
53 return entryNextCharacter < nextCharacter ? Before : After; 54 return entryNextCharacter < nextCharacter ? Before : After;
54 } 55 }
55 56
56 const HTMLEntityTableEntry* HTMLEntitySearch::findFirst(UChar nextCharacter) con st 57 const HTMLEntityTableEntry* HTMLEntitySearch::findFirst(UChar nextCharacter) con st
57 { 58 {
58 const HTMLEntityTableEntry* left = m_first; 59 const HTMLEntityTableEntry* left = m_first;
59 const HTMLEntityTableEntry* right = m_last; 60 const HTMLEntityTableEntry* right = m_last;
60 if (left == right) 61 if (left == right)
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return fail(); 119 return fail();
119 } 120 }
120 ++m_currentLength; 121 ++m_currentLength;
121 if (m_first->length != m_currentLength) { 122 if (m_first->length != m_currentLength) {
122 return; 123 return;
123 } 124 }
124 m_mostRecentMatch = m_first; 125 m_mostRecentMatch = m_first;
125 } 126 }
126 127
127 } 128 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698