OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. |
3 * Copyright (C) 2005 Alexey Proskuryakov. | 3 * Copyright (C) 2005 Alexey Proskuryakov. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 return m_words.last() & (1U << shift); | 151 return m_words.last() & (1U << shift); |
152 } | 152 } |
153 | 153 |
154 unsigned BitStack::size() const | 154 unsigned BitStack::size() const |
155 { | 155 { |
156 return m_size; | 156 return m_size; |
157 } | 157 } |
158 | 158 |
159 // -------- | 159 // -------- |
160 | 160 |
161 #if ASSERT_ENABLED | 161 #if ENABLE(ASSERT) |
162 | 162 |
163 static unsigned depthCrossingShadowBoundaries(Node* node) | 163 static unsigned depthCrossingShadowBoundaries(Node* node) |
164 { | 164 { |
165 unsigned depth = 0; | 165 unsigned depth = 0; |
166 for (Node* parent = node->parentOrShadowHostNode(); parent; parent = parent-
>parentOrShadowHostNode()) | 166 for (Node* parent = node->parentOrShadowHostNode(); parent; parent = parent-
>parentOrShadowHostNode()) |
167 ++depth; | 167 ++depth; |
168 return depth; | 168 return depth; |
169 } | 169 } |
170 | 170 |
171 #endif | 171 #endif |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 setUpFullyClippedStack(m_fullyClippedStack, m_node); | 1269 setUpFullyClippedStack(m_fullyClippedStack, m_node); |
1270 m_offset = endOffset; | 1270 m_offset = endOffset; |
1271 m_handledNode = false; | 1271 m_handledNode = false; |
1272 m_handledChildren = !endOffset; | 1272 m_handledChildren = !endOffset; |
1273 | 1273 |
1274 m_startNode = startNode; | 1274 m_startNode = startNode; |
1275 m_startOffset = startOffset; | 1275 m_startOffset = startOffset; |
1276 m_endNode = endNode; | 1276 m_endNode = endNode; |
1277 m_endOffset = endOffset; | 1277 m_endOffset = endOffset; |
1278 | 1278 |
1279 #ifndef NDEBUG | 1279 #if ENABLE(ASSERT) |
1280 // Need this just because of the assert. | 1280 // Need this just because of the assert. |
1281 m_positionNode = endNode; | 1281 m_positionNode = endNode; |
1282 #endif | 1282 #endif |
1283 | 1283 |
1284 m_lastTextNode = nullptr; | 1284 m_lastTextNode = nullptr; |
1285 m_lastCharacter = '\n'; | 1285 m_lastCharacter = '\n'; |
1286 | 1286 |
1287 m_havePassedStartNode = false; | 1287 m_havePassedStartNode = false; |
1288 | 1288 |
1289 advance(); | 1289 advance(); |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1743 { | 1743 { |
1744 if (!m_buffer.isEmpty()) | 1744 if (!m_buffer.isEmpty()) |
1745 return m_buffer[index]; | 1745 return m_buffer[index]; |
1746 return m_textIterator.characterAt(index); | 1746 return m_textIterator.characterAt(index); |
1747 } | 1747 } |
1748 | 1748 |
1749 // -------- | 1749 // -------- |
1750 | 1750 |
1751 static const size_t minimumSearchBufferSize = 8192; | 1751 static const size_t minimumSearchBufferSize = 8192; |
1752 | 1752 |
1753 #ifndef NDEBUG | 1753 #if ENABLE(ASSERT) |
1754 static bool searcherInUse; | 1754 static bool searcherInUse; |
1755 #endif | 1755 #endif |
1756 | 1756 |
1757 static UStringSearch* createSearcher() | 1757 static UStringSearch* createSearcher() |
1758 { | 1758 { |
1759 // Provide a non-empty pattern and non-empty text so usearch_open will not f
ail, | 1759 // Provide a non-empty pattern and non-empty text so usearch_open will not f
ail, |
1760 // but it doesn't matter exactly what it is, since we don't perform any sear
ches | 1760 // but it doesn't matter exactly what it is, since we don't perform any sear
ches |
1761 // without setting both the pattern and the text. | 1761 // without setting both the pattern and the text. |
1762 UErrorCode status = U_ZERO_ERROR; | 1762 UErrorCode status = U_ZERO_ERROR; |
1763 String searchCollatorName = currentSearchLocaleID() + String("@collation=sea
rch"); | 1763 String searchCollatorName = currentSearchLocaleID() + String("@collation=sea
rch"); |
1764 UStringSearch* searcher = usearch_open(&newlineCharacter, 1, &newlineCharact
er, 1, searchCollatorName.utf8().data(), 0, &status); | 1764 UStringSearch* searcher = usearch_open(&newlineCharacter, 1, &newlineCharact
er, 1, searchCollatorName.utf8().data(), 0, &status); |
1765 ASSERT(status == U_ZERO_ERROR || status == U_USING_FALLBACK_WARNING || statu
s == U_USING_DEFAULT_WARNING); | 1765 ASSERT(status == U_ZERO_ERROR || status == U_USING_FALLBACK_WARNING || statu
s == U_USING_DEFAULT_WARNING); |
1766 return searcher; | 1766 return searcher; |
1767 } | 1767 } |
1768 | 1768 |
1769 static UStringSearch* searcher() | 1769 static UStringSearch* searcher() |
1770 { | 1770 { |
1771 static UStringSearch* searcher = createSearcher(); | 1771 static UStringSearch* searcher = createSearcher(); |
1772 return searcher; | 1772 return searcher; |
1773 } | 1773 } |
1774 | 1774 |
1775 static inline void lockSearcher() | 1775 static inline void lockSearcher() |
1776 { | 1776 { |
1777 #ifndef NDEBUG | 1777 #if ENABLE(ASSERT) |
1778 ASSERT(!searcherInUse); | 1778 ASSERT(!searcherInUse); |
1779 searcherInUse = true; | 1779 searcherInUse = true; |
1780 #endif | 1780 #endif |
1781 } | 1781 } |
1782 | 1782 |
1783 static inline void unlockSearcher() | 1783 static inline void unlockSearcher() |
1784 { | 1784 { |
1785 #ifndef NDEBUG | 1785 #if ENABLE(ASSERT) |
1786 ASSERT(searcherInUse); | 1786 ASSERT(searcherInUse); |
1787 searcherInUse = false; | 1787 searcherInUse = false; |
1788 #endif | 1788 #endif |
1789 } | 1789 } |
1790 | 1790 |
1791 inline SearchBuffer::SearchBuffer(const String& target, FindOptions options) | 1791 inline SearchBuffer::SearchBuffer(const String& target, FindOptions options) |
1792 : m_options(options) | 1792 : m_options(options) |
1793 , m_prefixLength(0) | 1793 , m_prefixLength(0) |
1794 , m_numberOfCharactersJustAppended(0) | 1794 , m_numberOfCharactersJustAppended(0) |
1795 , m_atBreak(true) | 1795 , m_atBreak(true) |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2214 resultEnd = collapseTo; | 2214 resultEnd = collapseTo; |
2215 return; | 2215 return; |
2216 } | 2216 } |
2217 } | 2217 } |
2218 | 2218 |
2219 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo
rFindPlainText); | 2219 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo
rFindPlainText); |
2220 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re
sultStart, resultEnd); | 2220 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re
sultStart, resultEnd); |
2221 } | 2221 } |
2222 | 2222 |
2223 } | 2223 } |
OLD | NEW |