Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 function windowUtils() {
6 return content.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
7 .getInterface(Components.interfaces.nsIDOMWindowUtils);
8 }
10 function recvSetViewport(w, h) {
12 dump("setting viewport to "+ w +"x"+ h +"\n");
14 windowUtils().setCSSViewport(w, h);
15 }
17 function recvSetDisplayPort(x, y, w, h) {
19 dump("setting displayPort to <"+ x +", "+ y +", "+ w +", "+ h +">\n");
21 windowUtils().setDisplayPortForElement(x, y, w, h, content.document.documentElement, 0);
22 }
24 function recvSetResolution(xres, yres) {
26 dump("setting xres="+ xres +" yres="+ yres +"\n");
28 windowUtils().setResolution(xres, yres);
29 }
31 function recvScrollBy(dx, dy) {
32 content.scrollBy(dx, dy);
33 }
35 function recvScrollTo(x, y) {
36 content.scrollTo(x, y);
37 }
39 addMessageListener(
40 "setViewport",
41 function (m) { recvSetViewport(m.json.w, m.json.h); }
42 );
44 addMessageListener(
45 "setDisplayPort",
46 function (m) { recvSetDisplayPort(m.json.x, m.json.y,
47 m.json.w, m.json.h); }
48 );
50 addMessageListener(
51 "setResolution",
52 function (m) { recvSetResolution(m.json.xres, m.json.yres); }
53 );
55 addMessageListener(
56 "scrollBy",
57 function(m) { recvScrollBy(m.json.dx, m.json.dy); }
58 );
60 addMessageListener(
61 "scrollTo",
62 function(m) { recvScrollTo(m.json.x, m.json.y); }
63 );