Inline some isUndefined calls

This commit is contained in:
Devon Govett
2015-10-03 23:14:04 -07:00
parent 0f5d3ae8f0
commit 5af85c5ef6

View File

@@ -357,11 +357,11 @@ var computeLayout = (function() {
} }
function isDimDefined(node, axis) { function isDimDefined(node, axis) {
return !isUndefined(node.style[dim[axis]]) && node.style[dim[axis]] >= 0; return node.style[dim[axis]] != null && node.style[dim[axis]] >= 0;
} }
function isPosDefined(node, pos) { function isPosDefined(node, pos) {
return !isUndefined(node.style[pos]); return node.style[pos] != null;
} }
function isMeasureDefined(node) { function isMeasureDefined(node) {
@@ -391,10 +391,10 @@ var computeLayout = (function() {
}[axis]; }[axis];
var boundValue = value; var boundValue = value;
if (!isUndefined(max) && max >= 0 && boundValue > max) { if (max != null && max >= 0 && boundValue > max) {
boundValue = max; boundValue = max;
} }
if (!isUndefined(min) && min >= 0 && boundValue < min) { if (min != null && min >= 0 && boundValue < min) {
boundValue = min; boundValue = min;
} }
return boundValue; return boundValue;
@@ -410,7 +410,7 @@ var computeLayout = (function() {
// When the user specifically sets a value for width or height // When the user specifically sets a value for width or height
function setDimensionFromStyle(node, axis) { function setDimensionFromStyle(node, axis) {
// The parent already computed us a width or height. We just skip it // The parent already computed us a width or height. We just skip it
if (!isUndefined(node.layout[dim[axis]])) { if (node.layout[dim[axis]] != null) {
return; return;
} }
// We only run if there's a width or height defined // We only run if there's a width or height defined