// TODO(danilatos): clean this mess up.
boolean hackEditorNeverConsumes = name.equals("contextmenu") || name.equals("click")
|| name.equals("mousedown");
try {
EditorEvent event = SignalEventImpl.create(EditorEventImpl.FACTORY,
rawEvent, !hackEditorNeverConsumes);
try {
if (UserAgent.isMac() &&
rawEvent.getCtrlKey() && rawEvent.getAltKey()
&& rawEvent.getTypeInt() == Event.ONKEYPRESS) {
// In mac safari, Ctrl+Alt+something often inserts weird invisible
// characters in the dom!!! Always cancel the event, no matter what
// (We can still handle it programmatically if we wish)
// Cancel for FF as well just in case - but if this causes an issue
// it should be OK to enable for FF. We get keypress events, but
// no dom munge.
// Don't cancel it on Windows, because that prevents AltGr combos
// from working in european languages
EditorStaticDeps.logger.trace().log("Cancelling dangerous: " + rawEvent.getType());
rawEvent.preventDefault();
}
} catch (JavaScriptException e) {
// If this fails, swallow it. Seems to cause issues with dom mutation
// events when setting contentEditable with JUnit tests.
}
if (event == null) {
if (!hackEditorNeverConsumes) {
try {
rawEvent.stopPropagation();
} catch (JavaScriptException e) {
// If this fails, swallow it. Seems to cause issues with dom mutation
// events when setting contentEditable with JUnit tests.
}
}
return;
}
boolean cancel = false;
if (!hackEditorNeverConsumes) {
if (editorRelevantEvent(event)) {
try {
event.stopPropagation();
} catch (JavaScriptException e) {
// If this fails, swallow it. Seems to cause issues with dom mutation
// events when setting contentEditable with JUnit tests.
}
} else {
return;
}
}
boolean isMutationEvent = event.isMutationEvent();
if (!isMutationEvent || !EditorStaticDeps.shouldIgnoreMutations()) {
EditorStaticDeps.startIgnoreMutations();
try {
if (debugDisabled) {