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

Side by Side Diff: perf/dashboard/ui/endure_js/dom_utils.js

Issue 1654813003: Remove old dead perf dashboard pages and js (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/
Patch Set: Created 4 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file.
5 */
6
7 /**
8 * @fileoverview Collection of functions which operate on DOM.
9 */
10
11 var domUtils = window['domUtils'] || {};
12
13 /**
14 * Returns pageX and pageY of the given element.
15 *
16 * @param {Element} element An element of which the top-left position is to be
17 * returned in the coordinate system of the document page.
18 * @return {Object} A point object which has {@code x} and {@code y} fields.
19 */
20 domUtils.pageXY = function(element) {
21 var x = 0, y = 0;
22 for (; element; element = element.offsetParent) {
23 x += element.offsetLeft;
24 y += element.offsetTop;
25 }
26 return {'x': x, 'y': y};
27 };
28
29 /**
30 * Returns pageX and pageY of the given event.
31 *
32 * @param {Event} event An event of which the position is to be returned in
33 * the coordinate system of the document page.
34 * @return {Object} A point object which has {@code x} and {@code y} fields.
35 */
36 domUtils.pageXYOfEvent = function(event) {
37 return (event.pageX != null && event.pageY != null) ?
38 {'x': event.pageX, 'y': event.pageY} :
39 {'x': event.clientX + document.body.scrollLeft +
40 document.documentElement.scrollLeft,
41 'y': event.clientY + document.body.scrollTop +
42 document.documentElement.scrollTop};
43 };
OLDNEW
« no previous file with comments | « perf/dashboard/ui/endure_js/coordinates.js ('k') | perf/dashboard/ui/endure_js/endure_plotter.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698