OS X Lion and above allow the user to turn on/off iOS-style floating scroll bars – either manually via System Preferences, or by plugging in a mouse.
WebKit-based browsers (and maybe Opera?) switch their scroll bar style immediately – is there an event that fires when this occurs? (WebKit-only is just fine)
Some notes:
-
OS X fires
NSPreferredScrollerStyleDidChangeNotificationwhen the user switches their scroll bar style -
WebKit does not appear to subscribe to this event (no hits when grepping for it).
-
I suspect that WebKit is handling this via the
NSViewBoundsDidChangeNotificationevent (which, I assume, fires for the scroll view’s content view). -
WebKit handles this event within
-[WebHTMLView _frameOrBoundsChanged], which seems like one potential re-layouting point. -
There are also references to this notification in
WebPDFViewand the inspector’sWebNodeHighlight– both seem unrelated to this case. -
-[WebDynamicScrollBarsView adjustForScrollOriginChange]seems to indicate that events may not be fired (if so, it’d be nice to see some confirmation)
Polling for changes is not an acceptable answer to me (performance & the layout jumping after the user changes the value).
From everything I’ve read thus far, there is no DOM event fired during this style transition.
The most conclusive example is to create an
overflow: autodiv, and then log all of its events (in Safari or Chrome) viamonitorEvents. Nothing is logged when changing the scroll bar style.I have an open webkit bug on the issue (though it’s probably minor enough that we won’t see any movement on it).