6920842: Wheel events do not bubbling to the browser if they was not treated in applet.
Reviewed-by: art, anthony, peterz
--- a/jdk/src/share/classes/java/awt/Component.java Wed Jul 05 17:08:50 2017 +0200
+++ b/jdk/src/share/classes/java/awt/Component.java Wed Apr 14 15:28:37 2010 +0400
@@ -4941,9 +4941,13 @@
// If we dispatch the event to toplevel ancestor,
// this could encolse the loop: 6480024.
anc.dispatchEventToSelf(newMWE);
- }
- }
- return true;
+ if (newMWE.isConsumed()) {
+ e.consume();
+ }
+ return true;
+ }
+ }
+ return false;
}
boolean checkWindowClosingException() {
--- a/jdk/src/share/classes/java/awt/Container.java Wed Jul 05 17:08:50 2017 +0200
+++ b/jdk/src/share/classes/java/awt/Container.java Wed Apr 14 15:28:37 2010 +0400
@@ -4492,7 +4492,10 @@
retargetMouseEvent(mouseOver, id, e);
break;
}
- e.consume();
+ //Consuming of wheel events is implemented in "retargetMouseEvent".
+ if (id != MouseEvent.MOUSE_WHEEL) {
+ e.consume();
+ }
}
return e.isConsumed();
}
@@ -4800,6 +4803,12 @@
target.dispatchEvent(retargeted);
}
}
+ if (id == MouseEvent.MOUSE_WHEEL && retargeted.isConsumed()) {
+ //An exception for wheel bubbling to the native system.
+ //In "processMouseEvent" total event consuming for wheel events is skipped.
+ //Protection from bubbling of Java-accepted wheel events.
+ e.consume();
+ }
}
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java Wed Jul 05 17:08:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java Wed Apr 14 15:28:37 2010 +0400
@@ -870,6 +870,8 @@
orientation = SwingConstants.HORIZONTAL;
}
+ e.consume();
+
if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
JViewport vp = scrollpane.getViewport();
if (vp == null) { return; }