Fix the issue where checking a form for :valid/:invalid would trigger invalid events for its elements (if set).

BUG=360466
TEST=added a case to the layout test, to test for the issue

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

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