Refactoring: Make a function to check whether an <input> is associated to a <datalist> with valid <option>s.

The function will be used by TextFieldInputType later.

BUG=152375
TEST=none; no behavior changes.

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

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