Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Unified Diff: third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-event-properties.html

Issue 2314093002: Revert of Make a pen in eraser mode visible thru PointerEvent.buttons (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-event-properties.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-event-properties.html b/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-event-properties.html
index 13e83b1e3926497eeb03bfa9dfaaa82025d4da11..dda1ac0c9cc8dd62c5f36dac8dc59d1673105407 100644
--- a/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-event-properties.html
+++ b/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-event-properties.html
@@ -19,8 +19,6 @@
description("Verifies that pointer event parameters are correct when fired through mouse events.");
var checkKeyModifiers = false;
-
-var inputPointerType = "";
var pointerType = "";
var penId = 0;
@@ -56,33 +54,6 @@
"height",
];
-function getExpectedNumericAttributeValueForPE(mouseEvent, attribute) {
- var expectedValue = eval("mouseEvent." + attribute);
-
- // Fix expectedValue for the cases where PE & ME differs
- if (attribute == "button") {
- if (mouseEvent.type != "mousedown" && mouseEvent.type != "mouseup")
- expectedValue = -1;
- else if (inputPointerType == "eraser")
- expectedValue = 5;
- } else if (attribute == "buttons") {
- if (inputPointerType == "eraser" && mouseEvent.type == "mousedown")
- expectedValue = 32;
- } else if (attribute == "width" || attribute == "height") {
- expectedValue = 1;
- } else if (attribute == "pressure") {
- if (pointerType == "mouse")
- expectedValue = (mouseEvent.buttons == 0)? 0.0 : 0.5;
- else
- expectedValue = penPressure;
- } else if (attribute == "tiltX") {
- expectedValue = (pointerType == "mouse")? 0 : penTiltX;
- } else if (attribute == "tiltY") {
- expectedValue = (pointerType == "mouse")? 0 : penTiltY;
- }
- return expectedValue;
-}
-
function init() {
var targetDiv = document.getElementById("target");
@@ -118,10 +89,24 @@
shouldBeTrue("lastPointerEvents[0].isPrimary");
numericAttributes.forEach(function(attribute) {
- var expectedValue = getExpectedNumericAttributeValueForPE(event, attribute);
+ var expectedValue = eval("event." + attribute);
+ if (attribute == "button" && event.type != "mousedown" && event.type != "mouseup")
+ expectedValue = -1;
+ else if (attribute == "width" || attribute == "height")
+ expectedValue = 1;
+ else if (attribute == "pressure") {
+ if (pointerType == "mouse")
+ expectedValue = (event.buttons == 0)? 0.0 : 0.5;
+ else
+ expectedValue = penPressure;
+ }
+ else if (attribute == "tiltX")
+ expectedValue = (pointerType == "mouse")? 0 : penTiltX;
+ else if (attribute == "tiltY")
+ expectedValue = (pointerType == "mouse")? 0 : penTiltY;
+
shouldBeEqualToNumber("lastPointerEvents[0]." + attribute, expectedValue);
});
-
shouldBeEqualToString("lastPointerEvents[0].view.name", "mainWindow");
} else {
@@ -179,30 +164,29 @@
debug("");
}
-function runPenTests(x, y, id, eraseMode) {
- debug("===== pen tests " + (eraseMode? "(erase mode)" : "(draw mode)") + " =====");
+function runPenTests(x, y) {
+ debug("===== pen tests =====");
pointerType = "pen";
- inputPointerType = eraseMode? "eraser" : "pen";
- penId = id;
+ penId = 2;
penPressure = 0.0;
penTiltX = 0;
penTiltY = 0;
debug("--- move pen into target ---");
- eventSender.mouseMoveTo(x + 5, y + 5, [], inputPointerType, penId, penPressure, penTiltX, penTiltY);
+ eventSender.mouseMoveTo(x + 5, y + 5, [], "pen", penId, penPressure, penTiltX, penTiltY);
debug("");
debug("--- move within target & tap ---");
penTiltX = 45;
penTiltY = -34;
- eventSender.mouseMoveTo(x + 15, y + 15, [], inputPointerType, penId, penPressure, penTiltX, penTiltY);
+ eventSender.mouseMoveTo(x + 15, y + 15, [], "pen", penId, penPressure, penTiltX, penTiltY);
penPressure = 0.75;
- eventSender.mouseDown(0, [], inputPointerType, penId, penPressure, penTiltX, penTiltY);
+ eventSender.mouseDown(0, [], "pen", penId, penPressure, penTiltX, penTiltY);
penPressure = 0.0;
- eventSender.mouseUp(0, [], inputPointerType, penId, penPressure, penTiltX, penTiltY);
+ eventSender.mouseUp(0, [], "pen", penId, penPressure, penTiltX, penTiltY);
debug("--- move pen out of target ---");
- eventSender.mouseMoveTo(x - 5, y - 5, [], inputPointerType, penId, penPressure, penTiltX, penTiltY);
+ eventSender.mouseMoveTo(x - 5, y - 5, [], "pen", penId, penPressure, penTiltX, penTiltY);
debug("");
}
@@ -211,8 +195,7 @@
var rect = document.getElementById("target").getBoundingClientRect();
runMouseTests(rect.left, rect.top);
- runPenTests(rect.left, rect.top, 2, false);
- runPenTests(rect.left, rect.top, 3, true);
+ runPenTests(rect.left, rect.top);
}
init();

Powered by Google App Engine
This is Rietveld 408576698