mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-19 07:26:26 +00:00
![Masayuki Nakano](/assets/img/avatar_default.png)
`UIEvent::GetRangeParent()` retrieves `nsIContent` instance but it needs to return `already_AddRefed<nsINode>` because of a WebIDL method. However, `nsIContent` is better type in C++ code. Therefore, this patch renames it to `UIEvent::GetRangeParentContent()` and makes new `UIEvent::GetRangeParent()` and just call it. Additionally, some callers call `UIEvent::RangeOffset()` too, but that means that they compute same things twice because both of them use `nsLayoutUtils::GetContainerAndOffsetAtEvent()` with same input arguments. Thus, `UIEvent::GetRangeParentContent()` should also return offset with optional out argument. (Note that this does not make `RangeOffset()` use `GetRangeParentContent()` because using out parameter for range parent causes unnecessary computation cost for `RangeOffset()`.) Therefore, finally, `UIEvent::GetRangeParentContent()` becomes also an alias of raw method `UIEvent::GetRangeParentContentAndOffset()` which also returns offset with out argument. Differential Revision: https://phabricator.services.mozilla.com/D60095 --HG-- extra : moz-landing-system : lando