Add Traversal<*Element>::firstAncestor() API

Add Traversal<*Element>::firstAncestor() API to traverse elements of a specific
type. It is a common pattern in our code base to traverse the ancestors of a
Node until we find an Element of a specific type. This new firstAncestor() API
makes the code much simpler. This CL already makes use of the new API in
several places.

R=esprehn, eseidel
BUG=346733

Review URL: https://codereview.chromium.org/201293002

git-svn-id: svn://svn.chromium.org/blink/trunk@170211 bbb929c8-8fbe-4397-9dbb-9b2b20218538