Closed
Bug 414076
Opened 17 years ago
Closed 17 years ago
[FIX]Find previous does not wrap (reports "Phrase not found")
Categories
(Core :: DOM: Core & HTML, defect, P2)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
People
(Reporter: elmar.ludwig, Assigned: bzbarsky)
References
Details
(Keywords: regression, testcase)
Attachments
(3 files)
59 bytes,
text/html
|
Details | |
8.76 KB,
patch
|
sicking
:
review+
sicking
:
superreview+
|
Details | Diff | Splinter Review |
873 bytes,
patch
|
bzbarsky
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
The "Previous" button on the find toolbar sometimes stops at the first match on the page and does not wrap. Steps to reproduce:
1. Load the attached testcase
2. Open find toolbar and search for "elmar" (without the quotes)
3. Press "Next" a few times, observe that wrap around works
4. Press "Prev" a few times, find stops at first match and reports
"Phrase not found"
Searching for "rss" in the testcase wraps correctly in both directions.
Note that the structure of the HTML in the testcase is slightly broken: there is a DIV before the HTML element. This is the same as in the original page from which this testcase was derived. Fixing the HTML structure makes find previous work correctly.
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b3pre) Gecko/2008012404 Minefield/3.0b3pre ID:2008012404
Reporter | ||
Comment 1•17 years ago
|
||
This works fine in Firefox 2.0.0.11, so this is a regression.
I haven't tried to identify the regression range yet, but a quick test shows that the problem was already present in Gecko/20070518 Minefield/3.0a5pre.
Keywords: regression,
testcase
Reporter | ||
Comment 2•17 years ago
|
||
Regression range:
2006-10-20-04 (works)
2006-10-21-04 (fails)
Checkins between 2006-10-20 04:00 and 2006-10-21 04:59:
http://bonsai.mozilla.org/cvsquery.cgi?date=explicit&mindate=2006-10-20+04%3A00%3A00&maxdate=2006-10-21+04%3A59%3A59
This points to bug 357445 as the only likely candidate.
Blocks: 357445
Updated•17 years ago
|
Component: Find Toolbar / FastFind → DOM
Product: Firefox → Core
QA Contact: fast.find → general
Comment 3•17 years ago
|
||
Possibly related to bug 336279 and/or bug 379280.
Flags: blocking1.9?
OS: Linux → All
Hardware: PC → All
Assignee: nobody → jonas
Flags: blocking1.9? → blocking1.9+
Priority: -- → P2
Comment 4•17 years ago
|
||
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9b4pre) Gecko/2008022204 Minefield/3.0b4pre ID:2008022204
WFM on above nightly. Can you test again?
Reporter | ||
Comment 5•17 years ago
|
||
(In reply to comment #4)
> WFM on above nightly. Can you test again?
It still does not work for me in the attached testcase here with Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b4pre) Gecko/2008022204 Minefield/3.0b4pre ID:2008022204.
Updated•17 years ago
|
Flags: tracking1.9+ → blocking1.9+
![]() |
Assignee | |
Comment 6•17 years ago
|
||
The issue was that the change made in bug 357445 to the ContentIsInTraversalRange call in nsContentIterator::PositionAt was wrong: it used parent nodes that had nothing to do with the offsets that were being passed in. To fix that, it was easiest to change ContentToParentOffset to return nsIContent, and simplify it drastically in the process. That covers the PositionAt changes.
That left precious few callers of GetNumChildren, so I nixed the few remaining ones, and in the process got rid of the GetChildAt callers too. That's the Init() changes. If you prefer, I could leave those out while still fixing this bug, but they're quite safe and straightforward, and make the code clearer, imo. Not to mention the cruft-method removal...
I'd love it if someone can come up with a mochitest for this. Should be pretty doable, since the find apis are scriptable (after all, the findbar uses them!). I just don't know them off the top of my head, so it would take me a while to write the test.
Assignee: jonas → bzbarsky
Status: NEW → ASSIGNED
Attachment #309592 -
Flags: superreview?(jonas)
Attachment #309592 -
Flags: review?(jonas)
![]() |
Assignee | |
Comment 7•17 years ago
|
||
Oh, and that patch fixes bug 379280 too. Makes sense given the debugging Alex did there.
Blocks: 379280
Flags: in-testsuite?
Summary: Find previous does not wrap (reports "Phrase not found") → [FIX]Find previous does not wrap (reports "Phrase not found")
Comment on attachment 309592 [details] [diff] [review]
Fix
Yay! Thanks!
Attachment #309592 -
Flags: superreview?(jonas)
Attachment #309592 -
Flags: superreview+
Attachment #309592 -
Flags: review?(jonas)
Attachment #309592 -
Flags: review+
![]() |
Assignee | |
Comment 9•17 years ago
|
||
Fixed. I'd still love a hand on those tests. Otherwise I'll do them myself sometime in May or June...
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Comment 10•17 years ago
|
||
Comment on attachment 309592 [details] [diff] [review]
Fix
- numChildren = GetNumChildren(firstNode);
-
- if (numChildren)
+ if (firstNode->GetChildCount())
firstOffset = numChildren;
else
- ContentToParentOffset(mFirst, getter_AddRefs(firstNode), &firstOffset);
+ firstNode = ContentToParentOffset(mFirst, &firstOffset);
numChildren is not initialized
Attachment #310608 -
Flags: review?(jonas)
![]() |
Assignee | |
Comment 11•17 years ago
|
||
Comment on attachment 310608 [details] [diff] [review]
follow-up to fix use of uninitialized variable
Ah, indeed. Thanks for catching this!
Attachment #310608 -
Flags: superreview+
Attachment #310608 -
Flags: review?(jonas)
Attachment #310608 -
Flags: review+
![]() |
Assignee | |
Comment 12•17 years ago
|
||
I checked in the followup patch. Thank you again for fixing that.
Comment 13•17 years ago
|
||
(In reply to comment #12)
> I checked in the followup patch. Thank you again for fixing that.
>
You're welcome!
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•