Skip to content

Commit bf99484

Browse files
committed
bug fixes for body background & firefox font
1 parent 2dc8b93 commit bf99484

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ For more information and examples, please visit the <a href="http://html2canvas.
3939

4040
v0.33 -
4141

42+
* SVG taint fix, and additional taint testing options for rendering (<a href="https://github.com/niklasvh/html2canvas/commit/2dc8b9385e656696cb019d615bdfa1d98b17d5d4">niklasvh</a>)
4243
* Added support for CORS images and option to create canvas as tainted (<a href="https://github.com/niklasvh/html2canvas/commit/3ad49efa0032cde25c6ed32a39e35d1505d3b2ef">niklasvh</a>)
4344
* Improved minification saved ~1K! (<a href="https://github.com/cobexer/html2canvas/commit/b82be022b2b9240bd503e078ac980bde2b953e43">cobexer</a>)
4445
* Added integrated support for Flashcanvas (<a href="https://github.com/niklasvh/html2canvas/commit/e9257191519f67d74fd5e364d8dee3c0963ba5fc">niklasvh</a>)

src/Parse.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,13 @@ html2canvas.Parse = function (element, images, opts) {
286286
}
287287

288288
ctx.setVariable("fillStyle", color);
289-
ctx.setVariable("font", font_variant + " " + bold + " " + font_style + " " + size + " " + family);
290-
291-
289+
290+
/*
291+
need to be defined in the order as defined in http://www.w3.org/TR/CSS21/fonts.html#font-shorthand
292+
to properly work in Firefox
293+
*/
294+
ctx.setVariable("font", font_style+ " " + font_variant + " " + bold + " " + size + " " + family);
295+
292296
if (align){
293297
ctx.setVariable("textAlign", "right");
294298
}else{
@@ -1260,6 +1264,9 @@ html2canvas.Parse = function (element, images, opts) {
12601264
parseElement(children[i], stack);
12611265
}
12621266

1267+
1268+
stack.backgroundColor = getCSS( body, "backgroundColor" );
1269+
12631270
return stack;
12641271

12651272
};

src/Renderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ html2canvas.Renderer = function(parseQueue, opts){
9494
canvas.height = canvas.style.height = (!usingFlashcanvas) ? options.height || zStack.ctx.height : Math.min(flashMaxSize, (options.height || zStack.ctx.height) );
9595

9696
fstyle = ctx.fillStyle;
97-
ctx.fillStyle = "#fff";
97+
ctx.fillStyle = zStack.backgroundColor;
9898
ctx.fillRect(0, 0, canvas.width, canvas.height);
9999
ctx.fillStyle = fstyle;
100100

0 commit comments

Comments
 (0)