This is a straightforward conversion except that `NS_SUBTREE_DIRTY(this)` can be written terser as `IsSubtreeDirty()`. Differential Revision: https://phabricator.services.mozilla.com/D82811