提交 bd6e8a10 编写于 作者: U uta

6920842: Wheel events do not bubbling to the browser if they was not treated in applet.

Reviewed-by: art, anthony, peterz
上级 66340dd8
...@@ -4941,9 +4941,13 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -4941,9 +4941,13 @@ public abstract class Component implements ImageObserver, MenuContainer,
// If we dispatch the event to toplevel ancestor, // If we dispatch the event to toplevel ancestor,
// this could encolse the loop: 6480024. // this could encolse the loop: 6480024.
anc.dispatchEventToSelf(newMWE); anc.dispatchEventToSelf(newMWE);
if (newMWE.isConsumed()) {
e.consume();
}
return true;
} }
} }
return true; return false;
} }
boolean checkWindowClosingException() { boolean checkWindowClosingException() {
......
...@@ -4492,7 +4492,10 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener { ...@@ -4492,7 +4492,10 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
retargetMouseEvent(mouseOver, id, e); retargetMouseEvent(mouseOver, id, e);
break; break;
} }
e.consume(); //Consuming of wheel events is implemented in "retargetMouseEvent".
if (id != MouseEvent.MOUSE_WHEEL) {
e.consume();
}
} }
return e.isConsumed(); return e.isConsumed();
} }
...@@ -4800,6 +4803,12 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener { ...@@ -4800,6 +4803,12 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
target.dispatchEvent(retargeted); 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();
}
} }
} }
......
...@@ -870,6 +870,8 @@ public class BasicScrollPaneUI ...@@ -870,6 +870,8 @@ public class BasicScrollPaneUI
orientation = SwingConstants.HORIZONTAL; orientation = SwingConstants.HORIZONTAL;
} }
e.consume();
if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
JViewport vp = scrollpane.getViewport(); JViewport vp = scrollpane.getViewport();
if (vp == null) { return; } if (vp == null) { return; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册