[Webkit-unassigned] [Bug 25868] New: Frame::markAllMatchesForText prematurely aborts while highlighting text

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue May 19 10:39:01 PDT 2009


           Summary: Frame::markAllMatchesForText prematurely aborts while
                    highlighting text
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: All
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: New Bugs
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: finnur.webkit at gmail.com

I can easily reproduce a problem with highlighting in

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>
  <input type=text value="html"> 
  Call markAllMatchesForText with html[space] and it should highlight these
words: html html done.

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).

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

More information about the webkit-unassigned mailing list