Reimplement handling scroll events originated from content

This PR makes scrolling less jumpy.