Closed Bug 384706 Opened 17 years ago Closed 17 years ago

[FIX]Searching text in xml pretty print doesn't work anymore

Categories

(Core :: General, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9alpha8

People

(Reporter: martijn.martijn, Assigned: bzbarsky)

References

()

Details

(Keywords: regression, testcase)

Attachments

(1 file, 1 obsolete file)

To reproduce:
- Press Ctrl-F
- Search for "ab" for instance

It should find that text, but that doesn't happen anymore in current trunk builds.
This regressed on trunk between 2007-02-28 and 2007-03-01:

http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=all&branch=HEAD&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=2&date=explicit&mindate=2007-02-28+04&maxdate=2007-03-01+08&cvsroot=%2Fcvsroot
I think a regression from bug 372086, somehow.
Note that this didn't work without problems, though, see bug 263049.
Confirmed with Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a6pre) Gecko/20070617 Minefield/3.0a6pre
OS: Windows XP → All
Ugh.  Well, nsIFind assumes all find-related stuff can be represented as a DOM range.  That's not really true with anonymous content, and bug 372086 just enforces that invalid ranges are not created.

I guess we can just pass in nsIDOMRanges here that happen to not be nsRange...
Component: Find Toolbar / FastFind → General
Product: Firefox → Core
QA Contact: fast.find → general
Attached patch Not working (obsolete) — Splinter Review
No, that doesn't work either.  The find iterator uses standard content iterators which it tries to initialize with a "range" which has one endpoint in the native anonymous content (at a text node) and the other one at the root XML node (which is not anonymous inthis case).  This collapses to an empty range, so no finding happens.

So basically, either we need to rewrite find around the assumption that nsIRange cannot represent all possible ranges of interest, give up on find working with anonymous content, or back out bug 372086 (and accept the performance and security problems).
This basically makes the ranges used by find work the way they used to while everything else works the new way...
Assignee: nobody → bzbarsky
Attachment #268720 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #268723 - Flags: superreview?(jonas)
Attachment #268723 - Flags: review?(jonas)
Summary: Searching text in xml pretty print doesn't work anymore → [FIX]Searching text in xml pretty print doesn't work anymore
Target Milestone: --- → mozilla1.9beta1
Nice! Any chance this might be wanted in other places as well? Like serializing the contents of a selection for a copy/paste?
Akkana, right now (on trunk) you can't even create a selection that spans across anonymous content boundaries (because selection works with ranges, and ranges can't express that).  We sort of want that -- for any non-temporary ranges, we don't want them spanning such boundaries as things stand.  See also bug 372470.
Comment on attachment 268723 [details] [diff] [review]
Or we could do this....

>+      mSpanAnonymousSubtrees(PR_FALSE)

Please call this 'mMaySpanAnonymousSubtrees' since the bool means that the range is allowed to span anontrees, not that it actually does, right?

r/sr=me with that.
Attachment #268723 - Flags: superreview?(jonas)
Attachment #268723 - Flags: superreview+
Attachment #268723 - Flags: review?(jonas)
Attachment #268723 - Flags: review+
Checked in, with that change throughout.  Not sure how to write a test for this...  I guess it'd need some UniversalXPConnect and some search fu.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: