Closed Bug 1654270 Opened 4 years ago Closed 4 years ago

Find breaks on usage of css content in search string

Categories

(Core :: Find Backend, defect, P3)

78 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla80
Tracking Status
firefox-esr68 --- unaffected
firefox-esr78 --- wontfix
firefox78 --- wontfix
firefox79 --- wontfix
firefox80 --- fixed

People

(Reporter: moz, Assigned: emilio)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0

Steps to reproduce:

Go to https://developer.mozilla.org/en-US/docs/Web/CSS/::before and use find bar to search for "he said, are"

Actual results:

No results found.

Expected results:

Like with Firefox 76 (have currently no 77 to check) the css q::before content should be ignored.

Other Example (https://jsfiddle.net/4n0ojy9s/):
css:
span::after { content: ","; }
html:
1<span></span>234
Should be searchable with "1234".

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Find Toolbar
Product: Firefox → Toolkit

The behavior was changed by Bug 1627643.

Blocks: 1627643
No longer blocks: 1627643
Regressed by: 1627643
Has Regression Range: --- → yes
Component: Find Toolbar → Find Backend
Product: Toolkit → Core

Thanks for the reference to Bug 1627643.
With the pref browser.find.anonymous_content.enabled = false the expected result is back.

I'd argue that the expected result is different.

Ideally, I think you should be able to find your 1<span></span>234 text with 1,234. But we don't support that because the range spans an anonymous boundary (the pseudo-element).

So I think restoring the previous behavior in the case that the match would go across an anonymous boundary is better. I can poke.

Assignee: nobody → emilio
Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3

This restores our previous behavior when matching across anonymous
boundaries, as that's not something we currently can support because DOM
ranges can't represent that.

Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f91b6b609218 When an ongoing match crosses an anonymous boundary, ignore it instead of forcing the end of the match. r=jfkthame
Flags: needinfo?(emilio)

This was kind of a pre-existing bug, though not surfaced because we
didn't have conditionally-appearing text nodes I guess.

If we are doing a match in a non-anonymous subtree, we'd skip the
anonymous text (that's alright). But if we actually reach the end of the
document (as it is the case on the test that starts failing with the
other patch in this bug), we'd just early-return, rather than restarting
where we left off, which is not fine and means that potential matches in
anonymous subtrees that were skipped won't show up.

This fixes the bug... Eventually we should probably come up with a
better structure than this gigantic while (true), probably moving all
these variables into their own struct, but today is not that day :)

Thank you very for working so fast on this.

You are right, searching including the pseudo-element might be a solution, too. But I fear the discussion. There might be more similar cases like following or custom elements:

1<svg style="width:4px;height:13px;vertical-align:bottom"><text y="10">,</text></svg>234<br>
a<img style="vertical-align:bottom" src='data:image/svg+xml;utf8,<svg width="4" height="13" xmlns="http://www.w3.org/2000/svg"><text y="10">,</text></svg>'>bcd<br>
x<q>y</q>z

The first one can be found with "1,23", the second as "abc" and the third with "xyz" (only with browser.find.anonymous_content.enabled=false).

Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/43c100fa56ed When an ongoing match crosses an anonymous boundary, ignore it instead of forcing the end of the match. r=jfkthame https://hg.mozilla.org/integration/autoland/rev/aa337bc4d669 Properly restart after a partial match if we reach the end of the document. r=jfkthame
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla80

(In reply to Axel Sander from comment #9)

You are right, searching including the pseudo-element might be a solution, too. But I fear the discussion. There might be more similar cases like following or custom elements...

Yeah, I'm generally of the opinion that people should find by what they see. Quotes are a good example where we may want to skip quotes regardless of whether they're pseudo-elements or not. Or maybe find-in-page should have an "ignore punctuation" setting, not sure.

But anyhow, for now the behavior you want is restored. In order to find mixed pseudo and non-pseudo content we'd need to also fix stuff like selection across shadow boundaries, for example. Which is something that there's other people working on, but until that's ready... :)

Regressions: 1659897
Regressions: 1663411
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: