The two functions normally should give consistent results: either both null, or both non-null.
For effeciency, the two functions also cache results in SelectionEditor; furthermore, if one of them gets null, it also changes the other's cached result to null.
However, we found some cases where the two functions return inconsistent result. This leads to some surprising execution, for example:
VisibleSelection vs = ComputeVisibleSelectionInDOMTree(); // non-null
... ComputeVisibleSelectionInFlatTree() ... // null
VisibleSelection vs2 = ComputeVisibleSelectionInDOMTree(); // null
// assumes |vs == vs2| and run into trouble
Comment 1 by xiaoche...@chromium.org
, May 25 2018