Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: chrome/content/ui/sendReport.js

Issue 29333400: Issue 3503 - Fixed: Screenshot marker in Issue Reporter is no longer red (Closed)
Patch Set: Created Jan. 12, 2016, 4:12 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/ui/sendReport.js
===================================================================
--- a/chrome/content/ui/sendReport.js
+++ b/chrome/content/ui/sendReport.js
@@ -354,36 +354,43 @@ var screenshotDataSource =
setData: function(screenshot)
{
let canvas = E("screenshotCanvas");
// Do not resize canvas any more (no idea why Gecko requires both to be set)
canvas.parentNode.style.MozBoxAlign = "center";
canvas.parentNode.align = "center";
- // Init canvas settings
let context = canvas.getContext("2d");
- context.fillStyle = "rgb(0, 0, 0)";
- context.strokeStyle = "rgba(255, 0, 0, 0.7)";
- context.lineWidth = 3;
- context.lineJoin = "round";
-
this._canvas = canvas;
this._context = context;
- if (screenshot)
- {
- let image = new Image();
- image.src = screenshot;
- image.addEventListener("load", () => {
- canvas.width = image.width + this.imageOffset * 2;
- canvas.height = image.height + this.imageOffset * 2;
- context.drawImage(image, this.imageOffset, this.imageOffset);
- });
- }
+ let drawScreenshot = new Promise((resolve, reject) => {
+ if (screenshot)
+ {
+ let image = new Image();
+ image.src = screenshot;
+ image.addEventListener("load", () => {
+ canvas.width = image.width + this.imageOffset * 2;
+ canvas.height = image.height + this.imageOffset * 2;
+ context.drawImage(image, this.imageOffset, this.imageOffset);
+ resolve();
+ });
+ }
+ else
+ resolve();
+ });
+
+ drawScreenshot.then(() => {
+ // Init canvas settings, this has to be done after the canvas size is set
+ context.fillStyle = "rgb(0, 0, 0)";
+ context.strokeStyle = "rgba(255, 0, 0, 0.7)";
+ context.lineWidth = 3;
+ context.lineJoin = "round";
+ });
},
get enabled()
{
return this._enabled
},
set enabled(enabled)
{
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld