+17
−5
+8
−4
+4
−2
Loading
Currently, `PuppetWidget` calls `ContentCacheInChild::CacheSelection` directly. However, `mText` can be `Nothing` or `mText` can be outdated, but `mSelection` becomes the latest one. Therefore, we may notify the parent process with invalid data combination. The callers in `PuppetWidget` are: 1. `NotifyIMEOfCompositionUpdate` 2. `NotifyIMEOfPositionChange` I think that the former does not need to cache anything here because `IMEContentObserver` should've updated the text/selection changes. However, stopping caching everything at this point is risky. In the most cases, outdated data appears as odd IME UI position. Therefore, let's keep updating only caret and text rectangles. The latter is reported with new crash reports which is crashed by a `MOZ_DIAGNOSTIC_ASSERT` failure added by the previous patch. In the case, if `mText` and `mSelection` has not been cached, we don't need to notify the parent process with them because they will be sent later. And also even if they are not available, it may be useful that the character rectangles not related to `Selection` (e.g., the first character rect). Therefore, let's keep caching same things as the former case. Therefore, this patch makes `CacheSelection` a private method and add `CacheCaretAndTextRects` for them. Differential Revision: https://phabricator.services.mozilla.com/D178145