UNCONFIRMED 25868
Frame::markAllMatchesForText prematurely aborts while highlighting text
https://bugs.webkit.org/show_bug.cgi?id=25868
Summary Frame::markAllMatchesForText prematurely aborts while highlighting text
Finnur Thorarinsson
Reported 2009-05-19 10:39:00 PDT
I can easily reproduce a problem with highlighting in Frame::markAllMatchesForText. The problem is this: On certain HTML files, the markAllMatchesForText is aborted before reaching the end (resulting in failure to highlight matches). A superficial look through the annotations lead me to a bug titled "Searching in text areas" (https://bugs.webkit.org/show_bug.cgi?id=7023), which was fixed and I think causes this. I have a reduced HTML code that I use to reproduce this bug: <!doctype html> <body> <input type=text value="html"> Call markAllMatchesForText with html[space] and it should highlight these words: html html done. </body> Note that <input type=text> has the string "html" in it. If you call markAllMatchesForText for "html " (note the trailing space) on this frame, it will break and not highlight anything (see comment). Observe my comment in the snippet below, which is where it breaks. unsigned Frame::markAllMatchesForText(const String& target, bool caseFlag, unsigned limit) { if (target.isEmpty()) return 0; RefPtr<Range> searchRange(rangeOfContents(document())); ExceptionCode exception = 0; unsigned matchCount = 0; do { RefPtr<Range> resultRange(findPlainText(searchRange.get(), target, true, caseFlag)); if (resultRange->collapsed(exception)) { if (!resultRange->startContainer()->isInShadowTree()) break; // << NOTE: THIS IS WHERE IT ABORTS. If it is easy to fix, feel free to suggest changes to this code that will make this work and I would be happy to try it out in my tree and submit a patch (if it works).
Attachments
Ahmad Saleem
Comment 1 2023-06-02 19:26:43 PDT
This looks totally different code now: https://searchfox.org/wubkat/source/Source/WebCore/page/Page.cpp#983 unsigned Page::markAllMatchesForText(const String& target, FindOptions options, bool shouldHighlight, unsigned maxMatchCount) { return findMatchesForText(target, options, maxMatchCount, shouldHighlight ? HighlightMatches : DoNotHighlightMatches, MarkMatches); } Anything to do here?
Note You need to log in before you can comment on or make changes to this bug.