44
55 Released under MIT License
66*/
7-
87( function ( window , document , undefined ) {
98
109"use strict" ;
@@ -891,6 +890,128 @@ _html2canvas.Util.Font = (function () {
891890 } ;
892891
893892} ) ( ) ;
893+ function h2cRenderContext ( width , height ) {
894+ var storage = [ ] ;
895+ return {
896+ storage : storage ,
897+ width : width ,
898+ height : height ,
899+ clip : function ( ) {
900+ storage . push ( {
901+ type : "function" ,
902+ name : "clip" ,
903+ 'arguments' : arguments
904+ } ) ;
905+ } ,
906+ translate : function ( ) {
907+ storage . push ( {
908+ type : "function" ,
909+ name : "translate" ,
910+ 'arguments' : arguments
911+ } ) ;
912+ } ,
913+ fill : function ( ) {
914+ storage . push ( {
915+ type : "function" ,
916+ name : "fill" ,
917+ 'arguments' : arguments
918+ } ) ;
919+ } ,
920+ save : function ( ) {
921+ storage . push ( {
922+ type : "function" ,
923+ name : "save" ,
924+ 'arguments' : arguments
925+ } ) ;
926+ } ,
927+ restore : function ( ) {
928+ storage . push ( {
929+ type : "function" ,
930+ name : "restore" ,
931+ 'arguments' : arguments
932+ } ) ;
933+ } ,
934+ fillRect : function ( ) {
935+ storage . push ( {
936+ type : "function" ,
937+ name : "fillRect" ,
938+ 'arguments' : arguments
939+ } ) ;
940+ } ,
941+ createPattern : function ( ) {
942+ storage . push ( {
943+ type : "function" ,
944+ name : "createPattern" ,
945+ 'arguments' : arguments
946+ } ) ;
947+ } ,
948+ drawShape : function ( ) {
949+
950+ var shape = [ ] ;
951+
952+ storage . push ( {
953+ type : "function" ,
954+ name : "drawShape" ,
955+ 'arguments' : shape
956+ } ) ;
957+
958+ return {
959+ moveTo : function ( ) {
960+ shape . push ( {
961+ name : "moveTo" ,
962+ 'arguments' : arguments
963+ } ) ;
964+ } ,
965+ lineTo : function ( ) {
966+ shape . push ( {
967+ name : "lineTo" ,
968+ 'arguments' : arguments
969+ } ) ;
970+ } ,
971+ arcTo : function ( ) {
972+ shape . push ( {
973+ name : "arcTo" ,
974+ 'arguments' : arguments
975+ } ) ;
976+ } ,
977+ bezierCurveTo : function ( ) {
978+ shape . push ( {
979+ name : "bezierCurveTo" ,
980+ 'arguments' : arguments
981+ } ) ;
982+ } ,
983+ quadraticCurveTo : function ( ) {
984+ shape . push ( {
985+ name : "quadraticCurveTo" ,
986+ 'arguments' : arguments
987+ } ) ;
988+ }
989+ } ;
990+
991+ } ,
992+ drawImage : function ( ) {
993+ storage . push ( {
994+ type : "function" ,
995+ name : "drawImage" ,
996+ 'arguments' : arguments
997+ } ) ;
998+ } ,
999+ fillText : function ( ) {
1000+ storage . push ( {
1001+ type : "function" ,
1002+ name : "fillText" ,
1003+ 'arguments' : arguments
1004+ } ) ;
1005+ } ,
1006+ setVariable : function ( variable , value ) {
1007+ storage . push ( {
1008+ type : "variable" ,
1009+ name : variable ,
1010+ 'arguments' : value
1011+ } ) ;
1012+ }
1013+ } ;
1014+ }
8941015_html2canvas . Parse = function ( images , options ) {
8951016 window . scroll ( 0 , 0 ) ;
8961017
@@ -1668,7 +1789,12 @@ _html2canvas.Parse = function (images, options) {
16681789 elps . className = pseudoHide + "-before " + pseudoHide + "-after" ;
16691790
16701791 Object . keys ( elStyle ) . filter ( indexedProperty ) . forEach ( function ( prop ) {
1671- elps . style [ prop ] = elStyle [ prop ] ;
1792+ // Prevent assigning of read only CSS Rules, ex. length, parentRule
1793+ try {
1794+ elps . style [ prop ] = elStyle [ prop ] ;
1795+ } catch ( e ) {
1796+ h2clog ( [ 'Tried to assign readonly property ' , prop , 'Error:' , e ] ) ;
1797+ }
16721798 } ) ;
16731799
16741800 if ( isImage ) {
@@ -2371,128 +2497,6 @@ _html2canvas.Preload = function( options ) {
23712497 return methods ;
23722498
23732499} ;
2374- function h2cRenderContext ( width , height ) {
2375- var storage = [ ] ;
2376- return {
2377- storage : storage ,
2378- width : width ,
2379- height : height ,
2380- clip : function ( ) {
2381- storage . push ( {
2382- type : "function" ,
2383- name : "clip" ,
2384- 'arguments' : arguments
2385- } ) ;
2386- } ,
2387- translate : function ( ) {
2388- storage . push ( {
2389- type : "function" ,
2390- name : "translate" ,
2391- 'arguments' : arguments
2392- } ) ;
2393- } ,
2394- fill : function ( ) {
2395- storage . push ( {
2396- type : "function" ,
2397- name : "fill" ,
2398- 'arguments' : arguments
2399- } ) ;
2400- } ,
2401- save : function ( ) {
2402- storage . push ( {
2403- type : "function" ,
2404- name : "save" ,
2405- 'arguments' : arguments
2406- } ) ;
2407- } ,
2408- restore : function ( ) {
2409- storage . push ( {
2410- type : "function" ,
2411- name : "restore" ,
2412- 'arguments' : arguments
2413- } ) ;
2414- } ,
2415- fillRect : function ( ) {
2416- storage . push ( {
2417- type : "function" ,
2418- name : "fillRect" ,
2419- 'arguments' : arguments
2420- } ) ;
2421- } ,
2422- createPattern : function ( ) {
2423- storage . push ( {
2424- type : "function" ,
2425- name : "createPattern" ,
2426- 'arguments' : arguments
2427- } ) ;
2428- } ,
2429- drawShape : function ( ) {
2430-
2431- var shape = [ ] ;
2432-
2433- storage . push ( {
2434- type : "function" ,
2435- name : "drawShape" ,
2436- 'arguments' : shape
2437- } ) ;
2438-
2439- return {
2440- moveTo : function ( ) {
2441- shape . push ( {
2442- name : "moveTo" ,
2443- 'arguments' : arguments
2444- } ) ;
2445- } ,
2446- lineTo : function ( ) {
2447- shape . push ( {
2448- name : "lineTo" ,
2449- 'arguments' : arguments
2450- } ) ;
2451- } ,
2452- arcTo : function ( ) {
2453- shape . push ( {
2454- name : "arcTo" ,
2455- 'arguments' : arguments
2456- } ) ;
2457- } ,
2458- bezierCurveTo : function ( ) {
2459- shape . push ( {
2460- name : "bezierCurveTo" ,
2461- 'arguments' : arguments
2462- } ) ;
2463- } ,
2464- quadraticCurveTo : function ( ) {
2465- shape . push ( {
2466- name : "quadraticCurveTo" ,
2467- 'arguments' : arguments
2468- } ) ;
2469- }
2470- } ;
2471-
2472- } ,
2473- drawImage : function ( ) {
2474- storage . push ( {
2475- type : "function" ,
2476- name : "drawImage" ,
2477- 'arguments' : arguments
2478- } ) ;
2479- } ,
2480- fillText : function ( ) {
2481- storage . push ( {
2482- type : "function" ,
2483- name : "fillText" ,
2484- 'arguments' : arguments
2485- } ) ;
2486- } ,
2487- setVariable : function ( variable , value ) {
2488- storage . push ( {
2489- type : "variable" ,
2490- name : variable ,
2491- 'arguments' : value
2492- } ) ;
2493- }
2494- } ;
2495- }
24962500_html2canvas . Renderer = function ( parseQueue , options ) {
24972501
24982502 function createRenderQueue ( parseQueue ) {
@@ -2834,4 +2838,4 @@ _html2canvas.Renderer.Canvas = function(options) {
28342838 return canvas ;
28352839 } ;
28362840} ;
2837- } ) ( window , document ) ;
2841+ } ) ( window , document ) ;
0 commit comments