Bug 6451

Summary: REGRESSION: After Find, selected text sometimes includes preceding img element
Product: WebKit Reporter: John Sullivan <sullivan>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal Keywords: InRadar
Priority: P1    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
A few test cases that show this bug. none

Description John Sullivan 2006-01-09 08:10:45 PST
This is also in Radar as: <rdar://problem/4402375> REGRESSION (417.8 - TOT): finding text sometimes 
also selects previous image

In certain cases, after performing a Find, the resulting selection highlights both the found text and a 
preceding image element. This did not happen on the last released version of WebKit/Safari.

I'll attach a test case with steps that are appropriate to that test case momentarily.
Comment 1 John Sullivan 2006-01-09 08:13:47 PST
Created attachment 5570 [details]
A few test cases that show this bug.

To reproduce with this test page:
1. Load the test page
2. Command-F in Safari to bring up Find UI
3. Type "Throw" and hit Return to find first instance of Throw

Note that the text "Throw" has the selection highlight, and the image right
before the text also has the selection highlight. If you search for more
instances with Find Next (command-G) the same thing occurs for the other test
cases.
Comment 2 John Sullivan 2006-01-09 08:14:41 PST
From <rdar://problem/4402375>:

This bug does not occur in Safari-417.8, so it's a regression in TOT. The bug is probably in 
KWQKHTMLPart::findString, perhaps in this line:

    setSelection(SelectionController(resultRange.get(), DOWNSTREAM, VP_UPSTREAM_IF_POSSIBLE));
Comment 3 John Sullivan 2006-01-09 08:16:18 PST
It's possible that I introduced this bug at some point since I did some work in findString a while back, but I 
suspect that the regression is instead caused by some other change, perhaps editing-related.
Comment 4 Alexey Proskuryakov 2006-01-09 10:02:48 PST
Mitz points out that this looks very similar to bug 5127, and I agree.
Comment 5 John Sullivan 2006-01-09 10:28:51 PST
Yep, it seems extremely likely that this is the same as 5127 (and thus not directly related to findString).
Comment 6 Alice Liu 2006-01-10 14:37:42 PST

*** This bug has been marked as a duplicate of 5127 ***