diff --git a/.travis.yml b/.travis.yml
index 887b26ab..46b74746 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,19 +1,17 @@
language: node_js
node_js:
+ - "7"
- "6"
- "5"
- "4"
- - "0.12"
- - "0.11"
- - "0.10"
env:
- - CXX=g++-4.8
+ - CXX=g++-4.9
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- - g++-4.8
+ - g++-4.9
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq libgif-dev libpng-dev libjpeg8-dev libpango1.0-dev libcairo2-dev
diff --git a/HEADER.js b/HEADER.js
index 7c40bf7c..70f0300e 100644
--- a/HEADER.js
+++ b/HEADER.js
@@ -1,6 +1,6 @@
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
-var fabric = fabric || { version: "1.7.6" };
+var fabric = fabric || { version: '1.7.6' };
if (typeof exports !== 'undefined') {
exports.fabric = fabric;
}
@@ -13,23 +13,22 @@ if (typeof document !== 'undefined' && typeof window !== 'undefined') {
}
else {
// assume we're running under node.js when document/window are not present
- fabric.document = require("jsdom")
+ fabric.document = require('jsdom')
.jsdom(
- decodeURIComponent("%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E")
- );
+ decodeURIComponent('%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E'),
+ { features: {
+ FetchExternalResources: ['img']
+ }
+ });
- if (fabric.document.createWindow) {
- fabric.window = fabric.document.createWindow();
- } else {
- fabric.window = fabric.document.parentWindow;
- }
+ fabric.window = fabric.document.defaultView;
}
/**
* True when in environment that supports touch events
* @type boolean
*/
-fabric.isTouchSupported = "ontouchstart" in fabric.document.documentElement;
+fabric.isTouchSupported = 'ontouchstart' in fabric.document.documentElement;
/**
* True when in environment that's probably Node.js
diff --git a/lib/excanvas-diff.patch b/lib/excanvas-diff.patch
deleted file mode 100644
index 37ad3c8b..00000000
--- a/lib/excanvas-diff.patch
+++ /dev/null
@@ -1,196 +0,0 @@
-Index: excanvas.js
-===================================================================
---- excanvas.js (revision 63)
-+++ excanvas.js (working copy)
-@@ -255,6 +255,7 @@
- o2.arcScaleX_ = o1.arcScaleX_;
- o2.arcScaleY_ = o1.arcScaleY_;
- o2.lineScale_ = o1.lineScale_;
-+ o2.rotation_ = o1.rotation_; // used for images
- }
-
- var colorData = {
-@@ -599,6 +600,7 @@
- this.arcScaleX_ = 1;
- this.arcScaleY_ = 1;
- this.lineScale_ = 1;
-+ this.rotation_ = 0;
- }
-
- var contextPrototype = CanvasRenderingContext2D_.prototype;
-@@ -763,23 +765,31 @@
- return gradient;
- };
-
-- contextPrototype.drawImage = function(image, var_args) {
-+ contextPrototype.drawImage = function(image) {
- var dx, dy, dw, dh, sx, sy, sw, sh;
--
-+
-+ // to fix new Image() we check the existance of runtimeStyle
-+ var rts = image.runtimeStyle.width;
-+
- // to find the original width we overide the width and height
-- var oldRuntimeWidth = image.runtimeStyle.width;
-- var oldRuntimeHeight = image.runtimeStyle.height;
-- image.runtimeStyle.width = 'auto';
-- image.runtimeStyle.height = 'auto';
-+ if(rts) {
-+ var oldRuntimeWidth = image.runtimeStyle.width;
-+ var oldRuntimeHeight = image.runtimeStyle.height;
-+
-+ image.runtimeStyle.width = 'auto';
-+ image.runtimeStyle.height = 'auto';
-+ }
-
- // get the original size
- var w = image.width;
- var h = image.height;
--
-+
- // and remove overides
-- image.runtimeStyle.width = oldRuntimeWidth;
-- image.runtimeStyle.height = oldRuntimeHeight;
--
-+ if(rts) {
-+ image.runtimeStyle.width = oldRuntimeWidth;
-+ image.runtimeStyle.height = oldRuntimeHeight;
-+ }
-+
- if (arguments.length == 3) {
- dx = arguments[1];
- dy = arguments[2];
-@@ -816,29 +826,44 @@
-
- var W = 10;
- var H = 10;
-+
-+ var scaleX = scaleY = 1;
-+
-+ // FIX: divs give better quality then vml image and also fixes transparent PNG's
-+ vmlStr.push('
' ,
-- '
',
-- '');
-+ vmlStr.push(' ">');
-
-- this.element_.insertAdjacentHTML('BeforeEnd', vmlStr.join(''));
-+ // Draw a special cropping div if needed
-+ if (sx || sy) {
-+ // Apply scales to width and height
-+ vmlStr.push('
');
-+ }
-+
-+
-+ // Apply scales to width and height
-+ vmlStr.push('
');
-+
-+ // Close the crop div if necessary
-+ if (sx || sy) vmlStr.push('
');
-+
-+ vmlStr.push('
');
-+
-+ this.element_.insertAdjacentHTML('beforeEnd', vmlStr.join(''));
- };
-
- contextPrototype.stroke = function(aFill) {
-@@ -1155,6 +1197,8 @@
- var c = mc(aRot);
- var s = ms(aRot);
-
-+ this.rotation_ += aRot;
-+
- var m1 = [
- [c, s, 0],
- [-s, c, 0],
-@@ -1308,7 +1352,11 @@
- }
- var doc = this.element_.ownerDocument;
- this.textMeasureEl_.innerHTML = '';
-- this.textMeasureEl_.style.font = this.font;
-+ // FIX: Apply current font style to textMeasureEl to get correct size
-+ var fontStyle = getComputedStyle(processFontStyle(this.font), this.element_),
-+ fontStyleString = buildStyle(fontStyle);
-+ this.textMeasureEl_.style.font = fontStyleString;
-+
- // Don't use innerHTML or innerText because they allow markup/whitespace.
- this.textMeasureEl_.appendChild(doc.createTextNode(text));
- return {width: this.textMeasureEl_.offsetWidth};
diff --git a/lib/excanvas.js b/lib/excanvas.js
deleted file mode 100644
index b95043cf..00000000
--- a/lib/excanvas.js
+++ /dev/null
@@ -1,1464 +0,0 @@
-// Copyright 2006 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-
-// Known Issues:
-//
-// * Patterns only support repeat.
-// * Radial gradient are not implemented. The VML version of these look very
-// different from the canvas one.
-// * Clipping paths are not implemented.
-// * Coordsize. The width and height attribute have higher priority than the
-// width and height style values which isn't correct.
-// * Painting mode isn't implemented.
-// * Canvas width/height should is using content-box by default. IE in
-// Quirks mode will draw the canvas using border-box. Either change your
-// doctype to HTML5
-// (http://www.whatwg.org/specs/web-apps/current-work/#the-doctype)
-// or use Box Sizing Behavior from WebFX
-// (http://webfx.eae.net/dhtml/boxsizing/boxsizing.html)
-// * Non uniform scaling does not correctly scale strokes.
-// * Optimize. There is always room for speed improvements.
-
-// Only add this code if we do not already have a canvas implementation
-if (!document.createElement('canvas').getContext) {
-
-(function() {
-
- // alias some functions to make (compiled) code shorter
- var m = Math;
- var mr = m.round;
- var ms = m.sin;
- var mc = m.cos;
- var abs = m.abs;
- var sqrt = m.sqrt;
-
- // this is used for sub pixel precision
- var Z = 10;
- var Z2 = Z / 2;
-
- var IE_VERSION = +navigator.userAgent.match(/MSIE ([\d.]+)?/)[1];
-
- /**
- * This funtion is assigned to the