nl_tokens: Resolve the size of the layout - node from the renderable itsself .
pl_tokens: function _contextResolveSize ( contextNodeOrId , parentSize ) { var contextNode = this . _nodesById ? _contextGet . call ( this , contextNodeOrId ) : contextNodeOrId ; var resolveSize = this . _pool . resolveSize ; if ( ! contextNode ) { resolveSize [ 0 ] = 0 ; resolveSize [ 1 ] = 0 ; return resolveSize ; } // Get in use size var renderNode = contextNode . renderNode ; var size = renderNode . getSize ( ) ; if ( ! size ) { return parentSize ; } // Check if true-size is used and it must be reavaluated. // This particular piece of code specifically handles true-size Surfaces in famo.us. // It contains portions that ensure that the true-size of a Surface is re-evaluated // and also workaround code that backs up the size of a Surface, so that when the surface // is re-added to the DOM (e.g. when scrolling) it doesn't temporarily have a size of 0. var configSize = _resolveConfigSize ( renderNode ) ; if ( configSize && ( ( configSize . size [ 0 ] === true ) || ( configSize . <mask> [ 1 ] === true ) ) ) { contextNode . usesTrueSize = true ; if ( configSize . renderNode instanceof Surface ) { var backupSize = configSize . renderNode . _backupSize ; if ( configSize . renderNode . _contentDirty || configSize . renderNode . _trueSizeCheck ) { this . _trueSizeRequested = true ; contextNode . trueSizeRequested = true ; } if ( configSize . renderNode . _trueSizeCheck ) { // Fix for true-size renderables. When true-size is used, the size // is incorrect for one render-cycle due to the fact that Surface.commit // updates the content after asking the DOM for the offsetHeight/offsetWidth. // The code below backs the size up, and re-uses that when this scenario // occurs. if ( backupSize && ( configSize . size !== size ) ) { var newWidth = ( configSize . size [ 0 ] === true ) ? Math . max ( backupSize [ 0 ] , size [ 0 ] ) : size [ 0 ] ; var newHeight = ( configSize . size [ 1 ] === true ) ? Math . max ( backupSize [ 1 ] , size [ 1 ] ) : size [ 1 ] ; backupSize [ 0 ] = newWidth ; backupSize [ 1 ] = newHeight ; size = backupSize ; configSize . renderNode . _backupSize = undefined ; backupSize = undefined ; } } if ( this . _reevalTrueSize || ( backupSize && ( ( backupSize [ 0 ] !== size [ 0 ] ) || ( backupSize [ 1 ] !== size [ 1 ] ) ) ) ) { configSize . renderNode . _trueSizeCheck = true ; // force request of true-size from DOM configSize . renderNode . _sizeDirty = true ; this . _trueSizeRequested = true ; } // Backup the size of the node if ( ! backupSize ) { configSize . renderNode . _backupSize = [ 0 , 0 ] ; backupSize = configSize . renderNode . _backupSize ; } backupSize [ 0 ] = size [ 0 ] ; backupSize [ 1 ] = size [ 1 ] ; } // Ensure re-layout when a child layout-controller is using true-size and it // has ben changed. else if ( configSize . renderNode . _nodes ) { if ( this . _reevalTrueSize || configSize . renderNode . _nodes . _trueSizeRequested ) { contextNode . trueSizeRequested = true ; this . _trueSizeRequested = true ; } } } // Resolve 'undefined' to parent-size and true to 0 if ( ( size [ 0 ] === undefined ) || ( size [ 0 ] === true ) || ( size [ 1 ] === undefined ) || ( size [ 1 ] === true ) ) { resolveSize [ 0 ] = size [ 0 ] ; resolveSize [ 1 ] = size [ 1 ] ; size = resolveSize ; if ( size [ 0 ] === undefined ) { size [ 0 ] = parentSize [ 0 ] ; } else if ( size [ 0 ] === true ) { size [ 0 ] = 0 ; this . _trueSizeRequested = true ; contextNode . trueSizeRequested = true ; } if ( size [ 1 ] === undefined ) { size [ 1 ] = parentSize [ 1 ] ; } else if ( size [ 1 ] === true ) { size [ 1 ] = 0 ; this . _trueSizeRequested = true ; contextNode . trueSizeRequested = true ; } } return size ; }