Why does only Safari have (nearly) perfect inertial scrolling in OS X?

I'm quite amazed that Safari is the only browser in OS X that manages to get (nearly) perfect inertial scrolling.

  • Even with lots of flash content on a website, Safari's scrolling is smooth.
  • There are websites with lots of content to load and Safari will continue to scroll smoothly while the content is being loaded and rendered.
  • Installing several extensions does not have an effect on the scrolling performance.

The major competitors to the Safari browser on OS X are Chrome and Firefox. Both don't manage to deliver the same smooth scrolling like one is used to in Safari:

  • Enabling flags like GPU compositing on all pages in Google Chrome (chrome://flags) or ...
  • smooth scrolling in Firefox (Options > Advanced) don't deliver the scrolling performance that Safari delivers per default.

Question

Is Safari using private API to deliver smooth scrolling that the Chrome/Firefox developers's can't access? How come Safari's scrolling is so much better and competitors don't manage to deliver non-broken scrolling.

I'm wondering especially about Chrome because it usually adapts to new OS X features really fast.


Solution 1:

The difference is likely to do with the architecture and interprocess communication choices of each browser.

Modern web browsers render pages in separate processes. Apple has a framework called IOSurface that provides a streamlined way for one process to pass an image to another process. This framework was introduced in Mac OS X 10.6, aka Snow Leopard, for the latest iteration of QuickTime.

QuickTime uses IOSurface to offload movie decoding to separate processes. With no decoding to do, the QuickTime Player application is left dealing solely with the user interface and showing images provided by the decoding processes.

I suspect Safari has learned from QuickTime and is using the same techniques. Web pages are offloaded to other processes, rendered, and passed back.

Could Chrome and Firefox do the same thing, absolutely. The challenge is ensuring the thread dealing with the user responds quickly and is not delayed waiting for the rendering to update.

Chrome does use separate processes and appears to use IOSurface on the Mac; this bug talks about improving Chrome's use of IOSurface.

IOSurface is a public framework available to any Mac OS X 10.6+ application. However there is little documentation and it is Mac specific.

This is all conjecture.