mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 588452 - Don't render to zoom snapshot canvas before prior render finishes [r=stechz]
--HG-- extra : rebase_source : f4994456ae0bd2704aa8ae52f80810607a6c2bbd
This commit is contained in:
parent
8d359fcdd9
commit
dfbfe6f8d4
@ -51,6 +51,10 @@ let Cu = Components.utils;
|
||||
function AnimatedZoom(aBrowserView) {
|
||||
this.bv = aBrowserView;
|
||||
|
||||
this.snapshot = AnimatedZoom.createCanvas();
|
||||
if (this.snapshot.pending_render)
|
||||
return;
|
||||
|
||||
// Render a snapshot of the viewport contents around the visible rect
|
||||
let [w, h] = this.bv.getViewportDimensions();
|
||||
let viewportRect = new Rect(0, 0, w, h);
|
||||
@ -61,8 +65,6 @@ function AnimatedZoom(aBrowserView) {
|
||||
|
||||
// sanitize the snapshot rectangle to fit inside viewport
|
||||
this.snapshotRect.translateInside(viewportRect).restrictTo(viewportRect).expandToIntegers();
|
||||
|
||||
this.snapshot = AnimatedZoom.createCanvas();
|
||||
this.snapshotRect.width = Math.min(this.snapshotRect.width, this.snapshot.width);
|
||||
this.snapshotRect.height = Math.min(this.snapshotRect.height, this.snapshot.height);
|
||||
|
||||
@ -74,6 +76,7 @@ function AnimatedZoom(aBrowserView) {
|
||||
if (remote) {
|
||||
this.canvasReady = false;
|
||||
this.snapshot.addEventListener("MozAsyncCanvasRender", this, false);
|
||||
this.snapshot.pending_render = true;
|
||||
} else {
|
||||
this.canvasReady = true;
|
||||
this.startAnimation();
|
||||
@ -82,8 +85,11 @@ function AnimatedZoom(aBrowserView) {
|
||||
|
||||
AnimatedZoom.prototype.handleEvent = function(aEvent) {
|
||||
if (aEvent.type == "MozAsyncCanvasRender") {
|
||||
this.snapshot.removeEventListener("MozAsyncCanvasRender", this, false);
|
||||
if (aEvent.originalTarget == this.snapshot) {
|
||||
let snapshot = aEvent.originalTarget;
|
||||
snapshot.pending_render = false;
|
||||
snapshot.removeEventListener("MozAsyncCanvasRender", this, false);
|
||||
|
||||
if (this.snapshot == snapshot) {
|
||||
this.canvasReady = true;
|
||||
this.startAnimation();
|
||||
}
|
||||
@ -150,6 +156,9 @@ AnimatedZoom.prototype.startAnimation = function()
|
||||
AnimatedZoom.prototype.updateTo = function(nextRect) {
|
||||
this.zoomRect = nextRect;
|
||||
|
||||
if (this.snapshot.pending_render)
|
||||
return;
|
||||
|
||||
// prepare to draw to the zoom canvas
|
||||
let canvasRect = new Rect(0, 0, Elements.viewBuffer.width, Elements.viewBuffer.height);
|
||||
let ctx = Elements.viewBuffer.getContext("2d");
|
||||
|
Loading…
Reference in New Issue
Block a user