Generate casting functions for Event subclasses by DEFINE_TYPE_CASTS macro.

This reduces source code size, and adds const/reference support.
This CL introduces DEFINE_EVENT_TYPE_CASTS macro for cases that Event
class has isTypeName() function.

BUG=309516
TEST=none; no behavior changes.

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

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