| OLD | NEW |
| 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 12 matching lines...) Expand all Loading... |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef HTMLEntityTable_h | 26 #ifndef HTMLEntityTable_h |
| 27 #define HTMLEntityTable_h | 27 #define HTMLEntityTable_h |
| 28 | 28 |
| 29 #include "wtf/text/WTFString.h" | 29 #include "wtf/text/WTFString.h" |
| 30 | 30 |
| 31 namespace WebCore { | 31 namespace WebCore { |
| 32 | 32 |
| 33 // Member order to optimize packing. There will be thousands of these objects. |
| 33 struct HTMLEntityTableEntry { | 34 struct HTMLEntityTableEntry { |
| 34 LChar lastCharacter() const { return entity[length - 1]; } | 35 LChar lastCharacter() const; |
| 35 | 36 |
| 36 const LChar* entity; | |
| 37 int length; | |
| 38 UChar32 firstValue; | 37 UChar32 firstValue; |
| 39 UChar32 secondValue; | 38 UChar secondValue; // UChar since double char sequences only use BMP chars. |
| 39 short entityOffset; |
| 40 short length; |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 class HTMLEntityTable { | 43 class HTMLEntityTable { |
| 43 public: | 44 public: |
| 44 static const HTMLEntityTableEntry* firstEntry(); | 45 static const HTMLEntityTableEntry* firstEntry(); |
| 45 static const HTMLEntityTableEntry* lastEntry(); | 46 static const HTMLEntityTableEntry* lastEntry(); |
| 46 | 47 |
| 47 static const HTMLEntityTableEntry* firstEntryStartingWith(UChar); | 48 static const HTMLEntityTableEntry* firstEntryStartingWith(UChar); |
| 48 static const HTMLEntityTableEntry* lastEntryStartingWith(UChar); | 49 static const HTMLEntityTableEntry* lastEntryStartingWith(UChar); |
| 50 |
| 51 static const LChar* entityString(const HTMLEntityTableEntry&); |
| 49 }; | 52 }; |
| 50 | 53 |
| 51 } | 54 } |
| 52 | 55 |
| 53 #endif | 56 #endif |
| OLD | NEW |