Commit Graph

501 Commits

Author SHA1 Message Date
Niklas von Hertzen
8a6fb5f733 Library rewrite 2017-08-01 00:25:58 +08:00
Niklas von Hertzen
3b49cba21c Fix rendering of content when window is scrolled 2016-01-23 22:05:43 +02:00
Niklas von Hertzen
4ebe9c5fcc Don't require logger to be exposed to window object 2016-01-23 20:41:53 +02:00
Usman Akeju
318ca48157 Linear gradients now parse color names
Also:
- Cleans up color stop and linear gradient regular expressions.
- Handles percentage-based linear gradient positions (fixes Firefox).

Fixes niklasvh/html2canvas#469.
2015-10-25 09:44:14 -04:00
Niklas von Hertzen
e88ac871a3 Remove Promise polyfill 2015-10-19 01:25:03 +03:00
Niklas von Hertzen
aa05241ff8 Fix gradient tests 2015-10-18 23:57:41 +03:00
Niklas von Hertzen
364a8aac1c Merge remote-tracking branch 'origin/pr/645' 2015-10-18 23:15:12 +03:00
Niklas von Hertzen
46078acf71 Fix #688 fatal exception on unmatched color stop 2015-10-18 16:51:53 +03:00
Niklas von Hertzen
4b37909f09 Fix support for requirejs/amd 2015-08-30 02:27:38 +03:00
hyojin.kwak
90f9eeba83 Fix #599 2015-06-10 16:13:17 +09:00
Niklas von Hertzen
98ee30643a Fix iOS scrolling issue on clone 2015-03-30 00:58:50 +03:00
Niklas von Hertzen
a49c3a2320 Correctly handle named colors in gradients 2015-03-29 23:20:17 +03:00
Corné Dorrestijn
9201cf7e95 Accept matrix3d and convert it 2015-03-05 15:52:23 +01:00
Niklas von Hertzen
c2baf42145 Fix fail on transparent colors in linear gradients 2015-03-01 17:43:18 +02:00
Niklas von Hertzen
585a96a918 Preserve scrolling positions of nodes on clone (#511) 2015-02-28 16:51:52 +02:00
Niklas von Hertzen
3671de81f9 Fix module name casing 2015-02-03 21:39:57 +02:00
Niklas von Hertzen
f3b6df267e Switch build to use browserify (#502) 2015-02-03 21:34:05 +02:00
Niklas von Hertzen
60619dca72 Fix #517 2015-01-26 22:55:10 +02:00
Niklas von Hertzen
ed299b3db1 Remove dead code 2015-01-20 19:51:52 +02:00
Niklas von Hertzen
edb113c230 Make html2canvas requireable in nodejs 2015-01-19 23:33:29 +02:00
Niklas von Hertzen
fc01263f68 Add comment regarding IE9 clone node 2015-01-19 22:30:10 +02:00
Niklas von Hertzen
399ae9f33d Fix #503 2015-01-19 22:28:10 +02:00
Niklas von Hertzen
77c73c478f Fix iframe proxy 2015-01-18 21:38:05 +02:00
Niklas von Hertzen
7a58ad019f Fix background rendering regression #496 2015-01-10 20:53:06 +02:00
Niklas von Hertzen
9b372a4399 Correctly clone <select> and <textarea> value property 2015-01-05 22:58:36 +02:00
Niklas von Hertzen
498527918c Correctly render input[type="password"] value 2015-01-05 21:36:53 +02:00
Usman Akeju
e2713cd6f9 Temporarily add manual update to es6-promise polyfill
This replaces an old and outdated Promise polyfill that was included
with previous versions of html2canvas, and which consistently overwrote
native browser implementations when it shouldn't have. It is essentially
a (slightly modified) paste of the most current minified version of
es6-promise, found here:
https://es6-promises.s3.amazonaws.com/es6-promise-2.0.1.min.js

The plan is to eventually include this polyfill as a submodule
dependency, but the build process for es6-promise is a bit
cumbersome/opaque/painful at the moment, so this manual update was an
easier interim solution.

Please note that I had to manually add the actual call to
`ES6Promise.polyfill()` to load the polyfill--this will become
unnecessarry in future versions of es6-promise. Note also that I had to
manually pass `window` to the polyfill's IIFE, since `this` is an empty
object in the current scope.

Ref niklasvh/html2canvas#494.
2014-12-29 16:35:39 +01:00
Niklas von Hertzen
2f5f9f6e59 Allow multiple renders to occur simultaneously 2014-12-24 17:34:31 +02:00
Niklas von Hertzen
f5e318d968 Manually call toString for colors 2014-12-13 19:23:00 +02:00
Niklas von Hertzen
612e59c3d3 Implement border-inset color transforms 2014-12-13 19:00:29 +02:00
Niklas von Hertzen
fcbcb9bfaa Add color object to accept array of rgb(a) 2014-12-13 18:30:52 +02:00
Niklas von Hertzen
3b0352a3d7 Use Color objects for colors 2014-12-13 18:10:41 +02:00
Niklas von Hertzen
313c227a1f Add color parsing 2014-12-13 17:24:54 +02:00
Niklas von Hertzen
893ce74a33 Implement checkbox and radio input element rendering 2014-12-06 18:17:04 +02:00
Niklas von Hertzen
069140974b Don't scroll owner document after cloned document load 2014-11-30 14:23:52 +02:00
Niklas von Hertzen
1e826e32ae Fix scroll to top with pages using hashtag anchors 2014-11-30 14:16:02 +02:00
Dan Alstadt
d4cb7e8868 add html2canvas-container classname to iframe 2014-11-20 14:27:34 -06:00
Niklas von Hertzen
657eb983cf Add options.background option 2014-11-04 21:53:26 +02:00
Niklas von Hertzen
fc800bff9d Partial fix for borders 2014-11-04 21:40:09 +02:00
Niklas von Hertzen
aa3aafbc0c Fix race condition for content load 2014-11-03 23:29:57 +02:00
Niklas von Hertzen
525b5c4f36 Fix font rendering for IE with multiple inherited fonts 2014-11-02 22:15:48 +02:00
Niklas von Hertzen
772767d0d9 Disable transitions for cloned page 2014-11-02 20:26:25 +02:00
Niklas von Hertzen
7ebd191488 Fix form placeholder/value positioning for scrolled pages 2014-11-02 19:18:39 +02:00
Niklas von Hertzen
6ece2a3d5a Fix svg matching performance issue 2014-11-02 18:54:39 +02:00
Niklas von Hertzen
1793b802b1 Add onclone callback option to allow modifying cloned document prior to rendering 2014-10-26 19:10:09 +02:00
Niklas von Hertzen
04bdb48cba Fix layer ordering with multiple stacks on same auto z-index 2014-10-19 22:29:34 +03:00
Niklas von Hertzen
7e13231807 Fix canvas cropping with type: 'view' 2014-10-15 20:28:26 +03:00
Niklas von Hertzen
199685ebd1 Disable animations on rendered page 2014-10-12 20:44:39 +03:00
Niklas von Hertzen
444869e3ca Implement css clipping for rect() (with pixel values) 2014-10-12 20:32:47 +03:00
Niklas von Hertzen
5712b621ca Correctly clip content that has border-radius (#399) 2014-10-07 19:11:24 +03:00
Niklas von Hertzen
6073928978 Fix origin check for IE (#460) 2014-10-07 18:59:26 +03:00
Niklas von Hertzen
e103ad8219 Fix pseudoelement rendering (with nth-child selectors etc.) 2014-10-06 22:46:43 +03:00
Niklas von Hertzen
b60b4b2a45 Add option to use existing canvas for rendering 2014-09-28 22:51:11 +03:00
Niklas von Hertzen
bd1abe1857 Provide fallbacks for html parsing 2014-09-28 00:11:54 +03:00
Niklas von Hertzen
8a3d1d7f22 Fix firefox cross-origin iframe rendering 2014-09-27 23:03:57 +03:00
Niklas von Hertzen
19777c6623 Add simpler api for rendering external urls 2014-09-27 21:07:25 +03:00
Niklas von Hertzen
1e19832171 Add google maps test 2014-09-27 20:20:08 +03:00
Niklas von Hertzen
fa659ad1df Fix background-size with background-repeat x and y as well (#447) 2014-09-27 18:03:18 +03:00
Niklas von Hertzen
f517a35781 Clone and render canvas content correctly 2014-09-27 18:00:14 +03:00
Niklas von Hertzen
3f3424e49c Fix: Render background-size correctly with no-repeat #447 2014-09-27 17:02:46 +03:00
Niklas von Hertzen
1d8a316f13 Correctly handle overflow content 2014-09-27 16:54:53 +03:00
Niklas von Hertzen
b1f948bb60 Fix z-index stacking with fixed position 2014-09-21 11:44:11 +03:00
Niklas von Hertzen
24d9a22556 Correctly apply canvas background color 2014-09-21 11:24:20 +03:00
Niklas von Hertzen
7ee2f411b0 Continue render with failed svg images 2014-09-20 21:54:03 +03:00
Niklas von Hertzen
0a7df6d9b9 Correctly use native rendering with inline <svg> nodes if possible 2014-09-20 20:21:25 +03:00
Niklas von Hertzen
70241a789d Fallback to jsonp proxy if browser doesn't support cors xhr/image 2014-09-20 19:53:22 +03:00
Niklas von Hertzen
3b8d4dece2 Use correct window size for cloned iframe 2014-09-20 18:01:57 +03:00
Niklas von Hertzen
e80fe312ee Merge branch 'fix-doc-measurements' of https://github.com/ddrscott/html2canvas into ddrscott-fix-doc-measurements
Conflicts:
	dist/html2canvas.js
	dist/html2canvas.min.js
	src/core.js
2014-09-20 17:40:09 +03:00
Niklas von Hertzen
b141c9f0d1 Begin implementing cross-origin iframes 2014-09-20 17:36:15 +03:00
Niklas von Hertzen
d4c9a41873 Add preliminary support for same-origin iframes 2014-09-16 20:12:13 +03:00
Niklas von Hertzen
6347e7f043 Use correct document context for canvas render 2014-09-14 20:14:38 +03:00
Niklas von Hertzen
9d088fa431 Use punycode to parse unicode characters correctly 2014-09-14 19:32:26 +03:00
Niklas von Hertzen
9907149513 Don't parse/render input hidden nodes 2014-09-14 17:44:55 +03:00
Niklas von Hertzen
0325a9b836 Add atob polyfill for ie9 for SVG base64 rendering 2014-09-09 18:42:00 +03:00
Niklas von Hertzen
36052c2765 Add support for inline, base64 and node svg's 2014-09-08 23:44:10 +03:00
Niklas von Hertzen
44b958beaf Default to element dimension if image size cannot be determined (vector images) 2014-09-08 21:25:21 +03:00
Niklas von Hertzen
2a020e5a21 Allow tainting images to be drawn if option enabled 2014-09-08 21:24:26 +03:00
Niklas von Hertzen
c20e679f2c Prefer native svg rendering if available 2014-09-08 21:16:30 +03:00
Scott Pierce
52c669fe5b Merge branch 'master' of https://github.com/niklasvh/html2canvas
Conflicts:
	build/html2canvas.min.js
	dist/html2canvas.js
	src/core.js
2014-09-04 16:24:23 -05:00
Scott Pierce
382c16a522 use cloned document for measurements 2014-09-04 14:02:44 -05:00
Niklas von Hertzen
ba9d5201cf Add svg rendering with fabric.js 2014-09-04 20:50:31 +03:00
Niklas von Hertzen
2e2d722e3d Fix rendering for safari 6 2014-09-04 19:29:42 +03:00
Niklas von Hertzen
07f793b0ed Preliminary support for svg rendering 2014-09-04 18:47:06 +03:00
Niklas von Hertzen
ce1c4c84f5 Fix CSS gradients fail to render when non-vendor prefix property is included #388 2014-05-18 23:20:45 +03:00
Niklas von Hertzen
6959058560 Fix linear gradient rendering 2014-05-18 19:14:22 +03:00
Niklas von Hertzen
d6ed6c0194 Fallback to DummyImageContainer if no suitable ImageContainer found 2014-05-18 17:48:32 +03:00
Niklas von Hertzen
9ee87339a3 Fix cors loading of images 2014-05-18 17:40:01 +03:00
Niklas von Hertzen
281e6bbedf Use backgroundColor from documentElement if rendered element lacks backgroundColor 2014-04-06 21:43:20 +03:00
Niklas von Hertzen
fee91055b2 Fix bug with iframe not being loaded in-time 2014-03-24 19:05:32 +02:00
Niklas von Hertzen
650ead63e5 Fix transform nesting 2014-03-15 14:30:26 +02:00
Niklas von Hertzen
b35fcaeaf9 Move non-canvas supported fallback to seperate file 2014-03-15 13:22:55 +02:00
Niklas von Hertzen
81c22866bc Don't fail on broken images 2014-03-15 13:20:05 +02:00
Niklas von Hertzen
25d892f525 Fix IE9 https origin check bug 2014-03-15 13:01:04 +02:00
Niklas von Hertzen
12d85e3c04 Fail with a Promise.reject when no canvas support 2014-03-10 18:46:25 +02:00
Niklas von Hertzen
3101f2007a Fix Firefox DOM clone not being ready 2014-03-05 22:24:53 +02:00
Niklas von Hertzen
85b77ca49f Fix cropping bug 2014-03-05 19:19:24 +02:00
Niklas von Hertzen
bb8c5a973b Limit crop to the maximum size of outputted canvas 2014-03-04 21:54:24 +02:00
Niklas von Hertzen
cfe4137bcc Account for negative bounds in cropping 2014-03-04 20:42:34 +02:00
Niklas von Hertzen
d2c3378c3e Correctly crop content 2014-03-03 21:19:28 +02:00
Niklas von Hertzen
95f4bcea0a Render input elements correctly 2014-03-02 19:51:46 +02:00
Niklas von Hertzen
9bae5b610a Fix IE misalignment of content after scroll 2014-03-02 18:03:30 +02:00
Niklas von Hertzen
7ce46e95cd Fix logging in IE9 2014-03-02 16:55:40 +02:00
Niklas von Hertzen
84c1dc6283 Remove script tags from cloned DOM 2014-03-02 16:03:22 +02:00
Niklas von Hertzen
15ca3381eb Fix text rendering for IE and Opera 2014-03-02 16:00:59 +02:00
Niklas von Hertzen
18d95d669b Partial implementation for transforms 2014-02-23 17:35:46 +02:00
Niklas von Hertzen
5137e5f35a Render correct element 2014-02-23 17:02:49 +02:00
Niklas von Hertzen
314d26f1f1 Hide iframe container from view during render 2014-02-23 16:26:23 +02:00
Niklas von Hertzen
82e5a8a7c0 Fix image loading for cross-origin resources 2014-02-17 00:04:09 +02:00
Niklas von Hertzen
9af96d3812 Fix render ordering of nodes that form fake stacking contexts 2014-02-15 00:33:09 +02:00
Niklas von Hertzen
6f2a775841 Fix background position rendering 2014-02-15 00:31:48 +02:00
Niklas von Hertzen
d9d516d27e Force doctype for iframe 2014-02-10 19:53:13 +02:00
Niklas von Hertzen
899d5321d4 Fix pseudoelement rendering for Firefox 2014-02-08 17:42:40 +02:00
Niklas von Hertzen
5d20493f46 Add support for pseudoelements 2014-02-08 16:52:41 +02:00
Niklas von Hertzen
b5891c49b4 Correctly assign image loading method for <img> elements 2014-02-08 14:07:20 +02:00
Niklas von Hertzen
467ff87482 Switch to using Promises 2014-02-03 19:42:42 +02:00
Niklas von Hertzen
9beae48cf0 Start implementing background gradients 2014-02-01 21:48:30 +02:00
Niklas von Hertzen
17731169e9 Add support for single text-shadow 2014-02-01 20:03:23 +02:00
Niklas von Hertzen
e27c41efd3 Add font metrics and text-decorations 2014-02-01 19:36:43 +02:00
Niklas von Hertzen
1f90defbfa Fix text rendering for Opera/IE 2014-02-01 19:11:59 +02:00
Niklas von Hertzen
b4bb34c95b Move NodeParser to seperate file 2014-02-01 18:52:53 +02:00
Niklas von Hertzen
64668fe694 ios window size and scroll fixes 2014-02-01 18:32:05 +02:00
Niklas von Hertzen
9ebae161e2 Fix IE issues 2014-01-26 20:43:50 +02:00
Niklas von Hertzen
729bc88d1f Increase logging 2014-01-26 20:43:36 +02:00
Niklas von Hertzen
b1c2f03ae9 Add option to only render current view 2014-01-26 20:42:57 +02:00
Niklas von Hertzen
74cb3466ec Draw <img> elements 2014-01-26 18:10:04 +02:00
Niklas von Hertzen
2afdcaff35 Add Promise polyfill 2014-01-26 16:06:39 +02:00
Niklas von Hertzen
1070cec852 Implement background rendering 2014-01-26 16:06:16 +02:00
Niklas von Hertzen
ba9a33b1bc Add work around for chrome related background-image issues in iframe 2014-01-26 15:50:13 +02:00
Niklas von Hertzen
f474542382 Begin implementing background-image rendering 2014-01-21 21:41:00 +02:00
Niklas von Hertzen
0cb259f6cd Cache backgroundImages request for nodes 2014-01-20 22:42:58 +02:00
Niklas von Hertzen
1a7f5732bf Filter nodes and render correct size correctly 2014-01-20 22:42:39 +02:00
Niklas von Hertzen
2b8389cb64 Make image loading to work on top of Promises/polyfill 2014-01-19 21:05:07 +02:00
Niklas von Hertzen
8b8c080841 0.5.0 rewrite 2014-01-19 18:04:27 +02:00
Niklas von Hertzen
6201e09118 Merge branch 'patch-1' of github.com:bensho/html2canvas into bensho-patch-1 2013-12-23 16:33:58 +02:00
Niklas von Hertzen
517fd8cd1d Refactor background parsing 2013-12-23 16:07:49 +02:00
Niklas von Hertzen
e228fc57ce Merge branch 'patch-2' of github.com:brcontainer/html2canvas into brcontainer-patch-2 2013-12-23 15:32:18 +02:00
Niklas von Hertzen
46cc8b6975 Fix z-index ordering bug 2013-12-23 15:27:46 +02:00
Guilherme Nascimento
0b213eecef Fix bug in WebKitGTK+, backgroundRepeat return "wrong" values 2013-12-06 09:49:37 -02:00
Ben Sholds
cea3005056 Fix invalid selector exception with empty class values
After removing :before and :after pseudo selectors, a class name may be empty, causing an invalid selector string when joined. Remove empty elements before calling querySelectorAll.
2013-11-25 09:48:12 -05:00
Grom-S
f00b23a9ec incorect z-index sorting fixed
If you omit compare function in javascript `sort()` method it will sort  lexicographically (in dictionary order) according to the string conversion of each element. 

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters

For example 
[0, 9, 8, 10].sort()
will place element with z-index 10 on 2nd position of the array
2013-11-21 20:37:40 +02:00
Niklas von Hertzen
e9afe03960 Implement background-size cover/contain 2013-11-12 19:35:28 +02:00
Niklas von Hertzen
57d20a9794 Fix missing background color bug 2013-11-12 19:34:20 +02:00
Niklas von Hertzen
7cc7f80ee2 Add dom depth information to render queue 2013-10-27 22:08:12 +02:00
ssafejava
8bea01b81d Speed & accuracy improvements to pseudo element rendering.
Previously, pseudo elements would be processed as they were found in the DOM tree, which was
an expensive operation as each element's computed :before and :after style was checked for
'content' styles.

This commit traverses the user's stylesheets for :before and :after selectors, gathers the classes
affected, selects all elements that likely have a pseudo element present, then checks computed style.
If there is actually an element present, it is created but *not* appended to the DOM until after
all elements have been processed.

After all elements have been found and created, they are added to the DOM in a single batch, and the original
pseudo elements are hidden in a single batch. This prevents the layout invalidation / relayout loop that was
occuring previously, and in my tests speeds parsing by as much as 50% or more, depending on how many
pseudo elements your page uses.

Additionally, this commit contains a bugfix to the handling of ":before" pseudo elements; the browser effectively
inserts them as the first child of the element, not before the element. This fixes a few rendering inconsistencies
and complicated pages look almost perfect in my tests.
2013-09-18 13:38:21 +08:00
ssafejava
e115180731 Add async parsing option.
In my testing, the major time sink is parsing. This commit adds a setTimeout() around parsing
of each item so control can return to the browser. This increases the total time it takes to finish
a screenshot but will not freeze the browser when it does. This is a good option when e.g. doing
error reporting, where you might not want to freeze the browser while sending debugging information
back to your server.
2013-09-18 13:38:21 +08:00
Niklas von Hertzen
b6ebf2acf6 Remove unnecessary custom complete event checker 2013-09-04 20:17:38 +03:00
Niklas von Hertzen
e9c3d9d332 Fix background color rendering layering with no documentElement color 2013-09-04 20:03:16 +03:00
Niklas von Hertzen
c759600c06 Refactoring 2013-09-04 19:29:12 +03:00
arrix
564634ba97 stacking context creator should be at the bottom
passes z-index12. issue #256
2013-08-15 23:24:01 +08:00
arrix
ea7d6b485d preserve stacking nesting with special ancestor. issue #256 2013-08-15 02:12:38 +08:00