Merge branch 'master' of github.com:airbnb/lottie-web
diff --git a/player/js/animation/AnimationItem.js b/player/js/animation/AnimationItem.js
index 6de0e83..8ed2292 100644
--- a/player/js/animation/AnimationItem.js
+++ b/player/js/animation/AnimationItem.js
@@ -350,8 +350,8 @@
   }
 };
 
-AnimationItem.prototype.resize = function () {
-  this.renderer.updateContainerSize();
+AnimationItem.prototype.resize = function (width, height) {
+  this.renderer.updateContainerSize(width, height);
 };
 
 AnimationItem.prototype.setSubframe = function (flag) {
diff --git a/player/js/renderers/CanvasRenderer.js b/player/js/renderers/CanvasRenderer.js
index d5e9323..231d06f 100644
--- a/player/js/renderers/CanvasRenderer.js
+++ b/player/js/renderers/CanvasRenderer.js
@@ -17,6 +17,7 @@
     contentVisibility: (config && config.contentVisibility) || 'visible',
     className: (config && config.className) || '',
     id: (config && config.id) || '',
+    runExpressions: !config || config.runExpressions === undefined || config.runExpressions,
   };
   this.renderConfig.dpr = (config && config.dpr) || 1;
   if (this.animationItem.wrapper) {
diff --git a/player/js/renderers/CanvasRendererBase.js b/player/js/renderers/CanvasRendererBase.js
index 6a0b097..eeed531 100644
--- a/player/js/renderers/CanvasRendererBase.js
+++ b/player/js/renderers/CanvasRendererBase.js
@@ -195,19 +195,21 @@
   this.updateContainerSize();
 };
 
-CanvasRendererBase.prototype.updateContainerSize = function () {
+CanvasRendererBase.prototype.updateContainerSize = function (width, height) {
   this.reset();
   var elementWidth;
   var elementHeight;
   if (this.animationItem.wrapper && this.animationItem.container) {
-    elementWidth = this.animationItem.wrapper.offsetWidth;
-    elementHeight = this.animationItem.wrapper.offsetHeight;
-    this.animationItem.container.setAttribute('width', elementWidth * this.renderConfig.dpr);
-    this.animationItem.container.setAttribute('height', elementHeight * this.renderConfig.dpr);
+    elementWidth = this.animationItem.wrapper.offsetWidth * this.renderConfig.dpr;
+    elementHeight = this.animationItem.wrapper.offsetHeight * this.renderConfig.dpr;
   } else {
-    elementWidth = this.canvasContext.canvas.width * this.renderConfig.dpr;
-    elementHeight = this.canvasContext.canvas.height * this.renderConfig.dpr;
+    elementWidth = width || this.canvasContext.canvas.width * this.renderConfig.dpr;
+    elementHeight = height || this.canvasContext.canvas.height * this.renderConfig.dpr;
   }
+
+  this.canvasContext.canvas.width = elementWidth;
+  this.canvasContext.canvas.height = elementHeight;
+
   var elementRel;
   var animationRel;
   if (this.renderConfig.preserveAspectRatio.indexOf('meet') !== -1 || this.renderConfig.preserveAspectRatio.indexOf('slice') !== -1) {
diff --git a/player/js/renderers/HybridRenderer.js b/player/js/renderers/HybridRenderer.js
index aa01bb5..f5188d3 100644
--- a/player/js/renderers/HybridRenderer.js
+++ b/player/js/renderers/HybridRenderer.js
@@ -19,6 +19,7 @@
       x: (config && config.filterSize && config.filterSize.x) || '-100%',
       y: (config && config.filterSize && config.filterSize.y) || '-100%',
     },
+    runExpressions: !config || config.runExpressions === undefined || config.runExpressions,
   };
   this.globalData = {
     _mdf: false,
diff --git a/player/js/renderers/SVGRenderer.js b/player/js/renderers/SVGRenderer.js
index 20df797..d9d5551 100644
--- a/player/js/renderers/SVGRenderer.js
+++ b/player/js/renderers/SVGRenderer.js
@@ -58,6 +58,7 @@
     },
     width: (config && config.width),
     height: (config && config.height),
+    runExpressions: !config || config.runExpressions === undefined || config.runExpressions,
   };
 
   this.globalData = {
diff --git a/player/js/renderers/SVGRendererBase.js b/player/js/renderers/SVGRendererBase.js
index 0768cf7..64fa08d 100644
--- a/player/js/renderers/SVGRendererBase.js
+++ b/player/js/renderers/SVGRendererBase.js
@@ -44,6 +44,7 @@
 
 SVGRendererBase.prototype.configAnimation = function (animData) {
   this.svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
+  this.svgElement.setAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');
   if (this.renderConfig.viewBoxSize) {
     this.svgElement.setAttribute('viewBox', this.renderConfig.viewBoxSize);
   } else {
diff --git a/player/js/utils/expressions/ExpressionManager.js b/player/js/utils/expressions/ExpressionManager.js
index 4f0b264..f6c6d35 100644
--- a/player/js/utils/expressions/ExpressionManager.js
+++ b/player/js/utils/expressions/ExpressionManager.js
@@ -382,6 +382,14 @@
   }
 
   function initiateExpression(elem, data, property) {
+    // Bail out if we don't want expressions
+    function noOp(_value) {
+      return _value;
+    }
+    if (!elem.globalData.renderConfig.runExpressions) {
+      return noOp;
+    }
+
     var val = data.x;
     var needsVelocity = /velocity(?![\w\d])/.test(val);
     var _needsRandom = val.indexOf('random') !== -1;
@@ -666,6 +674,7 @@
     var parent;
     var randSeed = Math.floor(Math.random() * 1000000);
     var globalData = elem.globalData;
+
     function executeExpression(_value) {
       // globalData.pushExpression();
       value = _value;
diff --git a/player/js/worker_wrapper.js b/player/js/worker_wrapper.js
index 63c41a9..5cd5a19 100644
--- a/player/js/worker_wrapper.js
+++ b/player/js/worker_wrapper.js
@@ -332,7 +332,7 @@
       }
     } else if (type === 'resize') {
       if (animations[payload.id]) {
-        animations[payload.id].animation.resize();
+        animations[payload.id].animation.resize(payload.width, payload.height);
       }
     } else if (type === 'playSegments') {
       if (animations[payload.id]) {
@@ -692,11 +692,15 @@
           });
         }
       },
-      resize: function () {
+      resize: function (width, height) {
+        var devicePixelRatio = window.devicePixelRatio || 1;
         workerInstance.postMessage({
           type: 'resize',
           payload: {
             id: animationId,
+            // Till Worker thread knows nothing about container, we've to pass it here
+            width: width || (animation.container ? animation.container.offsetWidth * devicePixelRatio : 0),
+            height: height || (animation.container ? animation.container.offsetHeight * devicePixelRatio : 0),
           },
         });
       },
@@ -730,10 +734,11 @@
 
           // If no custom canvas was passed
           if (!canvas) {
+            var devicePixelRatio = window.devicePixelRatio || 1;
             canvas = document.createElement('canvas');
             animation.container.appendChild(canvas);
-            canvas.width = animationParams.animationData.w;
-            canvas.height = animationParams.animationData.h;
+            canvas.width = (animation.container ? animation.container.offsetWidth : animationParams.animationData.w) * devicePixelRatio;
+            canvas.height = (animation.container ? animation.container.offsetHeight : animationParams.animationData.h) * devicePixelRatio;
             canvas.style.width = '100%';
             canvas.style.height = '100%';
           }