[Pkg-mozext-commits] [firegestures] 05/18: cache html:canvas element

David Prévot taffit at moszumanska.debian.org
Sat May 23 10:58:41 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository firegestures.

commit ed1f816147ccdb66f3aa4262dc0e9190b64e41a9
Author: Gomita <gomita at xuldev.org>
Date:   Sat May 16 00:17:04 2015 +0900

    cache html:canvas element
---
 components/xdGestureHandler.js | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/components/xdGestureHandler.js b/components/xdGestureHandler.js
index 37cf7a6..90fd6a1 100644
--- a/components/xdGestureHandler.js
+++ b/components/xdGestureHandler.js
@@ -108,6 +108,8 @@ xdGestureHandler.prototype = {
 		}
 		this.sourceNode = null;
 		this._drawArea = null;
+		this._trailArea = null;
+		this._trailContext = null;
 		this._gestureObserver = null;
 		// log("detach()");	// #debug
 	},
@@ -652,6 +654,10 @@ xdGestureHandler.prototype = {
 
 	// called from _startGesture
 	createTrail: function FGH_createTrail(event) {
+		if (this._trailArea) {
+			this._trailArea.style.display = "-moz-box";
+			return;
+		}
 		var doc = this._drawArea.ownerDocument;
 		var box = doc.documentElement.boxObject;
 		var css = "-moz-user-focus: none !important;"
@@ -673,6 +679,7 @@ xdGestureHandler.prototype = {
 		        + "left: " + box.x + "px !important;"
 		        + "z-index: 2147483647 !important;";
 		this._trailArea = doc.createElement("hbox");
+		this._trailArea.id = "FireGesturesTrail";
 		this._trailArea.style.cssText = css;
 		this._trailOffsetX = box.screenX;
 		this._trailOffsetY = box.screenY;
@@ -701,11 +708,11 @@ xdGestureHandler.prototype = {
 
 	// called from _stopGesture
 	eraseTrail: function FGH_eraseTrail() {
-		if (this._trailArea && this._trailArea.parentNode) {
-			this._trailArea.parentNode.removeChild(this._trailArea);
-		}
-		this._trailArea = null;
-		this._trailContext = null;
+		if (!this._trailArea)
+			return;
+		var canvas = this._trailArea.firstChild;
+		this._trailContext.clearRect(0, 0, canvas.getAttribute("width"), canvas.getAttribute("height"));
+		this._trailArea.style.display = "none";
 	},
 
 };

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firegestures.git



More information about the Pkg-mozext-commits mailing list