author | Brian Grinstead <bgrinstead@mozilla.com> |
Tue, 05 May 2015 11:47:33 -0700 | |
changeset 242403 | 164c7af2cc5d8798435571dd10ebd1971d8ef554 |
parent 242402 | abc82c17827305670522281c6e3703db667a6005 |
child 242404 | 0f16abb82c08d5033af4caea5f21a48fb5c267b2 |
push id | 28693 |
push user | kwierso@gmail.com |
push date | Wed, 06 May 2015 03:23:28 +0000 |
treeherder | mozilla-central@f938222ff4ce [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | vporof |
bugs | 1145784 |
milestone | 40.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/browser/devtools/performance/test/head.js +++ b/browser/devtools/performance/test/head.js @@ -471,25 +471,25 @@ function waitUntil(predicate, interval = return deferred.promise; } // EventUtils just doesn't work! function dragStart(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseDown({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseDown({ testX: x, testY: y }); } function dragStop(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseUp({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseUp({ testX: x, testY: y }); } function dropSelection(graph) { graph.dropSelection(); graph.emit("selecting"); } /**
--- a/browser/devtools/profiler/test/browser_profiler_tabbed-browser-03.js +++ b/browser/devtools/profiler/test/browser_profiler_tabbed-browser-03.js @@ -71,18 +71,18 @@ registerCleanupFunction(() => { "devtools.profiler.ui.show-platform-data", gPrevShowPlatformData); }); // EventUtils just doesn't work! function dragStart(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseDown({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseDown({ testX: x, testY: y }); } function dragStop(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseUp({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseUp({ testX: x, testY: y }); }
--- a/browser/devtools/shared/test/browser_flame-graph-03a.js +++ b/browser/devtools/shared/test/browser_flame-graph-03a.js @@ -86,37 +86,37 @@ function testGraph(graph) { "The selection end boundary is correct (8)."); } // EventUtils just doesn't work! function hover(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); } function dragStart(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseDown({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseDown({ testX: x, testY: y }); } function dragStop(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseUp({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseUp({ testX: x, testY: y }); } let HORIZONTAL_AXIS = 1; let VERTICAL_AXIS = 2; function scroll(graph, wheel, axis, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseWheel({ clientX: x, clientY: y, axis, detail: wheel, axis, + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseWheel({ testX: x, testY: y, axis, detail: wheel, axis, HORIZONTAL_AXIS, VERTICAL_AXIS }); }
--- a/browser/devtools/shared/test/browser_flame-graph-03b.js +++ b/browser/devtools/shared/test/browser_flame-graph-03b.js @@ -63,14 +63,14 @@ function testGraph(graph) { // EventUtils just doesn't work! let HORIZONTAL_AXIS = 1; let VERTICAL_AXIS = 2; function scroll(graph, wheel, axis, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseWheel({ clientX: x, clientY: y, axis, detail: wheel, axis, + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseWheel({ testX: x, testY: y, axis, detail: wheel, axis, HORIZONTAL_AXIS, VERTICAL_AXIS }); }
--- a/browser/devtools/shared/test/browser_flame-graph-03c.js +++ b/browser/devtools/shared/test/browser_flame-graph-03c.js @@ -116,24 +116,24 @@ function testGraph(graph) { "The vertical offset is correct (9)."); } // EventUtils just doesn't work! function hover(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); } function dragStart(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseDown({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseDown({ testX: x, testY: y }); } function dragStop(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseUp({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseUp({ testX: x, testY: y }); }
--- a/browser/devtools/shared/test/browser_graphs-06.js +++ b/browser/devtools/shared/test/browser_graphs-06.js @@ -79,12 +79,12 @@ function map(value, istart, istop, ostar return ostart + (ostop - ostart) * ((value - istart) / (istop - istart)); } // EventUtils just doesn't work! function click(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseDown({ clientX: x, clientY: y }); - graph._onMouseUp({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseDown({ testX: x, testY: y }); + graph._onMouseUp({ testX: x, testY: y }); }
--- a/browser/devtools/shared/test/browser_graphs-07a.js +++ b/browser/devtools/shared/test/browser_graphs-07a.js @@ -167,50 +167,50 @@ function testGraph(graph, dragStop) { "The current selection end value is correct (17)."); } // EventUtils just doesn't work! function hover(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); } function click(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseDown({ clientX: x, clientY: y }); - graph._onMouseUp({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseDown({ testX: x, testY: y }); + graph._onMouseUp({ testX: x, testY: y }); } function dragStart(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseDown({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseDown({ testX: x, testY: y }); } function normalDragStop(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseUp({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseUp({ testX: x, testY: y }); } function buggyDragStop(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; // Only fire a mousemove instead of a mouseup. // This happens when the mouseup happens outside of the toolbox, // see Bug 1066504. - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseMove({ clientX: x, clientY: y, buttons: 0 }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseMove({ testX: x, testY: y, buttons: 0 }); } function scroll(graph, wheel, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseWheel({ clientX: x, clientY: y, detail: wheel }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseWheel({ testX: x, testY: y, detail: wheel }); }
--- a/browser/devtools/shared/test/browser_graphs-07b.js +++ b/browser/devtools/shared/test/browser_graphs-07b.js @@ -43,24 +43,24 @@ function testGraph(graph) { "The graph shouldn't have a selection (3)."); } // EventUtils just doesn't work! function hover(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); } function dragStart(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseDown({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseDown({ testX: x, testY: y }); } function dragStop(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseUp({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseUp({ testX: x, testY: y }); }
--- a/browser/devtools/shared/test/browser_graphs-08.js +++ b/browser/devtools/shared/test/browser_graphs-08.js @@ -41,26 +41,26 @@ function testGraph(graph) { "The selection should be dropped."); } // EventUtils just doesn't work! function click(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseDown({ clientX: x, clientY: y }); - graph._onMouseUp({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseDown({ testX: x, testY: y }); + graph._onMouseUp({ testX: x, testY: y }); } function dragStart(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseDown({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseDown({ testX: x, testY: y }); } function dragStop(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseUp({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseUp({ testX: x, testY: y }); }
--- a/browser/devtools/shared/test/browser_graphs-10a.js +++ b/browser/devtools/shared/test/browser_graphs-10a.js @@ -116,24 +116,24 @@ function* testGraph(host, graph) { "The current selection end value is correct (6)."); } // EventUtils just doesn't work! function hover(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); } function dragStart(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseDown({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseDown({ testX: x, testY: y }); } function dragStop(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseUp({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseUp({ testX: x, testY: y }); }
--- a/browser/devtools/shared/test/browser_graphs-12.js +++ b/browser/devtools/shared/test/browser_graphs-12.js @@ -130,24 +130,24 @@ function testGraphs(graph1, graph2) { "The current selection end value is correct (6.2)."); } // EventUtils just doesn't work! function hover(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); } function dragStart(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseDown({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseDown({ testX: x, testY: y }); } function dragStop(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseUp({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseUp({ testX: x, testY: y }); }
--- a/browser/devtools/shared/test/browser_graphs-14.js +++ b/browser/devtools/shared/test/browser_graphs-14.js @@ -65,25 +65,25 @@ function* testGraph(graph) { "One scroll event should have been fired."); } // EventUtils just doesn't work! function dragStart(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseDown({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseDown({ testX: x, testY: y }); } function dragStop(graph, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseUp({ clientX: x, clientY: y }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseUp({ testX: x, testY: y }); } function scroll(graph, wheel, x, y = 1) { x /= window.devicePixelRatio; y /= window.devicePixelRatio; - graph._onMouseMove({ clientX: x, clientY: y }); - graph._onMouseWheel({ clientX: x, clientY: y, detail: wheel }); + graph._onMouseMove({ testX: x, testY: y }); + graph._onMouseWheel({ testX: x, testY: y, detail: wheel }); }
--- a/browser/devtools/shared/widgets/FlameGraph.js +++ b/browser/devtools/shared/widgets/FlameGraph.js @@ -726,19 +726,17 @@ FlameGraph.prototype = { } return ""; }, /** * Listener for the "mousemove" event on the graph's container. */ _onMouseMove: function(e) { - let offset = this._getContainerOffset(); - let mouseX = (e.clientX - offset.left) * this._pixelRatio; - let mouseY = (e.clientY - offset.top) * this._pixelRatio; + let {mouseX, mouseY} = this._getRelativeEventCoordinates(e); let canvasWidth = this._width; let canvasHeight = this._height; let selection = this._selection; let selectionWidth = selection.end - selection.start; let selectionScale = canvasWidth / selectionWidth; @@ -778,19 +776,17 @@ FlameGraph.prototype = { this.emit("panning-vertically"); } }, /** * Listener for the "mousedown" event on the graph's container. */ _onMouseDown: function(e) { - let offset = this._getContainerOffset(); - let mouseX = (e.clientX - offset.left) * this._pixelRatio; - let mouseY = (e.clientY - offset.top) * this._pixelRatio; + let {mouseX, mouseY} = this._getRelativeEventCoordinates(e); this._selectionDragger.origin = mouseX; this._selectionDragger.anchor.start = this._selection.start; this._selectionDragger.anchor.end = this._selection.end; this._verticalOffsetDragger.origin = mouseY; this._verticalOffsetDragger.anchor = this._verticalOffset; @@ -812,18 +808,17 @@ FlameGraph.prototype = { this._verticalDragDirection = 0; this._canvas.removeAttribute("input"); }, /** * Listener for the "wheel" event on the graph's container. */ _onMouseWheel: function(e) { - let offset = this._getContainerOffset(); - let mouseX = (e.clientX - offset.left) * this._pixelRatio; + let {mouseX} = this._getRelativeEventCoordinates(e); let canvasWidth = this._width; let canvasHeight = this._height; let selection = this._selection; let selectionWidth = selection.end - selection.start; let selectionScale = canvasWidth / selectionWidth; @@ -937,16 +932,37 @@ FlameGraph.prototype = { x += node.offsetLeft; y += node.offsetTop; } return { left: x, top: y }; }, /** + * Given a MouseEvent, make it relative to this._canvas. + * @return object {mouseX,mouseY} + */ + _getRelativeEventCoordinates: function(e) { + // For ease of testing, testX and testY can be passed in as the event + // object. + if ("testX" in e && "testY" in e) { + return { + mouseX: e.testX * this._pixelRatio, + mouseY: e.testY * this._pixelRatio + }; + } + + let offset = this._getContainerOffset(); + let mouseX = (e.clientX - offset.left) * this._pixelRatio; + let mouseY = (e.clientY - offset.top) * this._pixelRatio; + + return {mouseX,mouseY}; + }, + + /** * Listener for the "resize" event on the graph's parent node. */ _onResize: function() { if (this.hasData()) { setNamedTimeout(this._uid, GRAPH_RESIZE_EVENTS_DRAIN, this.refresh); } } };
--- a/browser/devtools/shared/widgets/Graphs.jsm +++ b/browser/devtools/shared/widgets/Graphs.jsm @@ -941,20 +941,20 @@ AbstractCanvasGraph.prototype = { /** * Given a MouseEvent, make it relative to this._canvas. * @return object {mouseX,mouseY} */ _getRelativeEventCoordinates: function(e) { // For ease of testing, testX and testY can be passed in as the event // object. If so, just return this. - if (e.screenX === undefined) { + if ("testX" in e && "testY" in e) { return { - mouseX: e.clientX * this._pixelRatio, - mouseY: e.clientY * this._pixelRatio + mouseX: e.testX * this._pixelRatio, + mouseY: e.testY * this._pixelRatio }; } let quad = this._canvas.getBoxQuads({ relativeTo: this._topWindow.document })[0]; let x = (e.screenX - this._topWindow.screenX) - quad.p1.x;