DescriptionFix conditional TouchEvent creation support
Prior to M2, document.createEvent("TouchEvent") would only succeed when touch support was enabled (eg. we detected a touch screen). Some websites use this as a signal that a touch screen is present. In M32 the location of TouchEvent.idl moved (http://src.chromium.org/viewvc/blink?view=revision&revision=158219) but the old path was still used in EventAliases.idl, and this caused the generated Event.cpp code to have redundant entries making the RuntimeEnabled annotation useless:
if (type == "TouchEvent")
return TouchEvent::create();
if (type == "TouchEvent" && RuntimeEnabledFeatures::touchEnabled())
return TouchEvent::create();
This change fixes that problem by updating EventAliases.idl with the correct path.
This also updates the code generation scripts to flag this sort of mistake an error. Normally an incorrectly typed name in the EventAliases.in file would result in a compile error when we try to include the relevant header file. However the support for 'aliases' requires that when we see a second entry for the same cpp_name (class name) we don't try to include header files for it again (we rely on the fact that we don't need to know the full path in this case). So we just flag an error whenever we see multiple entries with the same script_name.
Note that we probably can't just make the entire TouchEvent interface RuntimeEnabled because even when touch support is disabled, chrome dev tools can be used to emulate touch and create instances of TouchEvent objects. Ultimately touch events should really be supported all the time, but that's a larger issue with site compatibility issues.
BUG=332588
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=165361
Patch Set 1 #Patch Set 2 : Add build-time validation #
Messages
Total messages: 9 (0 generated)
|