FooSoft / yomichan

Japanese pop-up dictionary extension for Chrome and Firefox.
https://foosoft.net/projects/yomichan
Other
1.05k stars 203 forks source link

TextSource* API updates #2236

Closed toasted-nutbread closed 1 year ago

toasted-nutbread commented 1 year ago

This change updates the TextSourceRange and TextSourceElement APIs to remove anything that is unused, simplify the constructors, and fix an issue related to returning stale rects.

The fixed issue would occur when scanning an element which creates an imposter (such as a textarea) and then the window is resized, which triggers a repositioning of the popup. When this repositioning occurred, it would cause the getRect/getRects function to be called, which is selecting a range which is no longer connected to the document, so the popup position would be incorrect.