Rewrite and refactor getVisibleElements() to make it more generic - address comments by @brendandahl
Merge pull request #2916 from Snuffleupagus/getVisibleElements

Rewrite and refactor getVisibleElements() to make it more generic
Merge remote-tracking branch 'upstream/master' into capture-zoom-event
WIP
WIP
WIP
WIP
WIP
WIP
WIP