Move unrelated code out of TextIterator#60819
Move unrelated code out of TextIterator#60819webkit-commit-queue merged 1 commit intoWebKit:mainfrom
Conversation
|
EWS run on previous version of this PR (hash 8cebce5) Details
|
brentfulgham
left a comment
There was a problem hiding this comment.
This clean-up looks nice. Please consider renaming the files (or the classname), since it's weird to have a class defined in a file with a totally different name.
r=me
| @@ -138,6 +134,7 @@ class SearchBuffer { | |||
| const bool m_targetRequiresKanaWorkaround; | |||
| Vector<char16_t> m_normalizedTarget; | |||
| mutable Vector<char16_t> m_normalizedMatch; | |||
| ICUSearcher m_ICUSearcher; | |||
There was a problem hiding this comment.
Do we always need an ICUSearcher object? Should it be lazily initialized if someone doesn't search?
There was a problem hiding this comment.
Yes, the SearchBuffer directly relies on the ICUSearcher, and it is initialized in the SearchBuffer constructor.
| || (m_options.contains(FindOption::AtWordEnds) && !isWordEndMatch(matchStart, matchedLength))) { | ||
| if ((m_targetRequiresKanaWorkaround && isBadMatch(m_buffer.subspan(matchStart, matchedLength), m_normalizedTarget.span(), m_normalizedMatch)) | ||
| || (m_options.contains(FindOption::AtWordStarts) && !isWordStartMatch(m_buffer, matchStart, matchedLength, m_options)) | ||
| || (m_options.contains(FindOption::AtWordEnds) && !isWordEndMatch(m_buffer, matchStart, matchedLength, m_options))) { |
There was a problem hiding this comment.
Are all of these changes needed for the switch to an external TextSearchICU object? It seems like some of this is new work related to your search improvements. I think we should keep that separate from this task.
There was a problem hiding this comment.
I think isBadMatch, isWordStartMatch, and isWordEndMatch are placed more appropriately in ICUSearcher, so these changes are needed.
| lockSearcher(); | ||
|
|
||
| SUPPRESS_FORWARD_DECL_ARG UStringSearch* searcher = WebCore::searcher(); | ||
| SUPPRESS_FORWARD_DECL_ARG UStringSearch* searcher = m_ICUSearcher.searcher(); |
There was a problem hiding this comment.
We should probably encapsulate all uses of UStringSearch* into SearchICU interface in a follow up change.
8cebce5 to
c1dfe00
Compare
|
EWS run on previous version of this PR (hash c1dfe00) Details
|
c1dfe00 to
e8045c0
Compare
|
EWS run on current version of this PR (hash e8045c0) Details |
|
Safe-Merge-Queue: Build #87024. |
https://bugs.webkit.org/show_bug.cgi?id=310147 rdar://172786702 Reviewed by Brent Fulgham and Ryosuke Niwa. There are a lot of helper functions in TextIterator.cpp that could be moved into it's own file. This change also allows other clients to use some of these helper functions. * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/dom/FragmentDirectiveRangeFinder.cpp: * Source/WebCore/editing/TextIterator.cpp: (WebCore::SearchBuffer::SearchBuffer): (WebCore::SearchBuffer::reachedBreak): (WebCore::SearchBuffer::search): (WebCore::foldQuoteMarkAndReplaceNoBreakSpace): Deleted. (WebCore::foldQuoteMarks): Deleted. (WebCore::createSearcher): Deleted. (WebCore::searcher): Deleted. (WebCore::lockSearcher): Deleted. (WebCore::unlockSearcher): Deleted. (WebCore::isKanaLetter): Deleted. (WebCore::isSmallKanaLetter): Deleted. (WebCore::composedVoicedSoundMark): Deleted. (WebCore::isCombiningVoicedSoundMark): Deleted. (WebCore::containsKanaLetters): Deleted. (WebCore::normalizeCharacters): Deleted. (WebCore::isNonLatin1Separator): Deleted. (WebCore::isSeparator): Deleted. (WebCore::SearchBuffer::~SearchBuffer): Deleted. (WebCore::SearchBuffer::isBadMatch const): Deleted. (WebCore::SearchBuffer::isWordEndMatch const): Deleted. (WebCore::SearchBuffer::isWordStartMatch const): Deleted. * Source/WebCore/editing/TextIterator.h: * Source/WebCore/editing/TextSearchICU.cpp: Added. (WebCore::createSearcher): (WebCore::globalSearcher): (WebCore::ICUSearcher::ICUSearcher): (WebCore::ICUSearcher::~ICUSearcher): (WebCore::ICUSearcher::lock): (WebCore::ICUSearcher::unlock): (WebCore::ICUSearcher::reset): (WebCore::ICUSearcher::searcher): (WebCore::isBadMatch): (WebCore::isWordStartMatch): (WebCore::isWordEndMatch): (WebCore::normalizeCharacters): (WebCore::foldQuoteMarkAndReplaceNoBreakSpace): (WebCore::isSeparator): (WebCore::containsKanaLetters): (WebCore::foldQuoteMarks): (WebCore::isKanaLetter): (WebCore::isSmallKanaLetter): (WebCore::composedVoicedSoundMark): (WebCore::isCombiningVoicedSoundMark): (WebCore::isNonLatin1Separator): * Source/WebCore/editing/TextSearchICU.h: Added. * Source/WebCore/page/text-extraction/TextExtraction.cpp: * Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm: * Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm: Canonical link: https://commits.webkit.org/309514@main
e8045c0 to
5f9b798
Compare
|
Committed 309514@main (5f9b798): https://commits.webkit.org/309514@main Reviewed commits have been landed. Closing PR #60819 and removing active labels. |
🛠 vision-apple
5f9b798
e8045c0