github web-platform-tests/wpt merge_pr_48484

latest releases: merge_pr_49470, epochs/three_hourly/2024-12-03_06H, epochs/six_hourly/2024-12-03_06H...
4 months ago

Make SelectionMovementUtils::GetFrameForNodeOffset use last frame when the loop ended with invisible content

The editor in ChatGPT has only invisible <br> (display: none) and text
content as ::after. SelectionMovementUtils::GetFrameForNodeOffset assumes
that at least one child has a primary frame. Therefore, it may return nullptr
and nsCaret fails to paint the caret due to no frame. So, it should use a
parent frame in such case.

However, doing it may cause an assertion failure [1] when
IMEContentObserver::UpdateSelectionCache() is called while an editor gets
focus and the editor does not have visible children. Therefore, this patch
makes it allow to flush pending notifications when it gets current selection
range in the flattened text. Fortunately, this change does not make damage
to the performance. I guess the reason is, sending focus notification
synchronously will calling ContentCacheInChild::CacheAll soon. Then,
it collects all information which should be cached in the parent process with
flushing the pending layout. Therefore, this change should just do that a
little bit faster than before.

  1. https://searchfox.org/mozilla-central/rev/7e0ae4372c52b8183d1178132dd6493edb576738/layout/generic/nsIFrame.cpp#2039

Differential Revision: https://phabricator.services.mozilla.com/D224561

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1921146
gecko-commit: 02bd95b16de9ef621d6b04626d655e3a346da296
gecko-reviewers: emilio

Don't miss a new wpt release

NewReleases is sending notifications on new releases.