Closed Bug 1934827 Opened 1 year ago Closed 1 year ago

Text-Fragments: Create Text Fragment from a range if there are other matches on the page

Categories

(Core :: DOM: Navigation, task)

task

Tracking

()

RESOLVED FIXED
136 Branch
Tracking Status
firefox136 --- fixed

People

(Reporter: jjaschke, Assigned: jjaschke)

References

(Blocks 2 open bugs)

Details

Attachments

(5 files)

This bug is a follow-up to 1934825 and covers more complex cases for creating a text fragment from a range:

  • Determine if it's impossible to create a text fragment because the context terms cannot be unique
  • Select appropriate context terms which are short enough but point to the correct range

This is a prerequisite commit and introduces a data structure that is used in the following patches.

This patch introduces a helper function that converts the content of a nsRange into a fold case string.
Furthermore, it introduces a hashmap-based cache, which keeps the fold case representations accessible by nsRange pointer.

This is a prerequisite commit which introduces helper algorithms required for the following patches.

Given two strings in fold case representation, the algorithms determine the common start or common end sub strings.

This patch uses an iterative approach to identify valid context terms to ensure that a text directive points to the correct range:
For each candidate which would match the currently selected candidate, new candidates are created by extending each context term until the candidate does not match anymore.
Then, each of these candidates is matched against all remaining candidates to assess the quality of the candidate.
Then the candidate which has the smallest amount of matches is chosen as current candidate.

See Also: → 1942080
See Also: → 1942121
Pushed by jjaschke@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2a12d7d6dc3f part 1 - Text Fragments: Find all matches for the input range in the document. r=farre https://hg.mozilla.org/integration/autoland/rev/21b2f024f889 part 2 - Text Fragments: Implement range content cache. r=farre https://hg.mozilla.org/integration/autoland/rev/883150cd2569 part 3 - Text Fragments: Implement helper to identify common start and end sub strings. r=hsivonen https://hg.mozilla.org/integration/autoland/rev/b2ab060fe7e4 part 4 - Text Fragments: Introduce helper to log the state of a text directive candidate. r=avandolder https://hg.mozilla.org/integration/autoland/rev/dd86e3d3e63a part 5 - Text Fragments: Implement algorithm to create text fragments which require expanding context terms. r=farre
Flags: needinfo?(jjaschke)
Pushed by jjaschke@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3a660933d356 part 1 - Text Fragments: Find all matches for the input range in the document. r=farre https://hg.mozilla.org/integration/autoland/rev/4d6a127a87d4 part 2 - Text Fragments: Implement range content cache. r=farre https://hg.mozilla.org/integration/autoland/rev/47d12af58cc9 part 3 - Text Fragments: Implement helper to identify common start and end sub strings. r=hsivonen https://hg.mozilla.org/integration/autoland/rev/bce86afcab54 part 4 - Text Fragments: Introduce helper to log the state of a text directive candidate. r=avandolder https://hg.mozilla.org/integration/autoland/rev/f8857d2987af part 5 - Text Fragments: Implement algorithm to create text fragments which require expanding context terms. r=farre
Pushed by sstanca@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/87a98810be58 An adittion for linux-base-toolchain. CLOSED TREE
See Also: → 1957557
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: