OnDemandList: Invert _calcRowHeight logic to resolve scroll glitches

The glitches manifested particularly when removeDistantNodes was run.
tree: Improve logic around rendering child levels

* Don't bother creating a preload node when not using OnDemandList
* Create preload nodes at both ends of the child level and improve code flow
* Simplify OnDemandList#renderQuery arguments (preloadNode no longer needed)
OnDemandList: Improve scroll-direction-detecting logic

When tree is used, its top preload node will also have a rowIndex of 0, so
this check wrongly assumed that it is above, even if it isn't.

We still check rowIndex first because it's cheaper than checking offsetTop,
and this is still not a 100% accurate fix if the user scrolls very fast.
Fix typos in JsonRest test page
tree: Improve logic around rendering child levels

* Don't bother creating a preload node when not using OnDemandList
* Create preload nodes at both ends of the child level and improve code flow
* Remove preloadNode argument from OnDemandList#renderQuery

Ported manually from 5f5dc8ea45a6044486115b378f314b14193f15bb
OnDemandList: Improve scroll-direction-detecting logic

When tree is used, its top preload node will also have a rowIndex of 0, so
this check wrongly assumed that it is above, even if it isn't.

We still check rowIndex first because it's cheaper than checking offsetTop,
and this is still not a 100% accurate fix if the user scrolls very fast.

Ported manually from 1ee538f0588dcd3541820e993b3c33b54db125d6
Merge commit 'c81eeff4d53d6695671436330ffe219e10a1de69' into dev-0.4
Merge branch 'master' into dev-0.4