Kaydet (Commit) a38ef594 authored tarafından Marco Cecchetti's avatar Marco Cecchetti Kaydeden (comit) Marco Cecchetti

svg export: presentation engine: source code clean up

Change-Id: I83f6d524feb21197ad930180f36224feae565ab0
Reviewed-on: https://gerrit.libreoffice.org/20808Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarco Cecchetti <mrcekets@gmail.com>
(cherry picked from commit 84dc88a0)
Reviewed-on: https://gerrit.libreoffice.org/20831Tested-by: 's avatarMarco Cecchetti <mrcekets@gmail.com>
üst 3efce450
...@@ -75,25 +75,25 @@ ...@@ -75,25 +75,25 @@
* @param node element of the document * @param node element of the document
* @param name attribute name * @param name attribute name
* *
* @returns an array containing all the elements of the tree with root * @returns Array array containing all the elements of the tree with root
* 'node' that own the property 'name' * 'node' that own the property 'name'
*/ */
function getElementsByProperty( node, name ) function getElementsByProperty( node, name )
{ {
var elems = new Array(); var elements = [];
if( node.getAttribute( name ) ) if( node.getAttribute( name ) )
elems.push( node ); elements.push( node );
for( var counter = 0; counter < node.childNodes.length; ++counter ) for( var counter = 0; counter < node.childNodes.length; ++counter )
{ {
if( node.childNodes[counter].nodeType == 1 ) if( node.childNodes[counter].nodeType == 1 )
{ {
var subElems = getElementsByProperty( node.childNodes[counter], name ); var subElements = getElementsByProperty( node.childNodes[counter], name );
elems = elems.concat( subElems ); elements = elements.concat( subElements );
} }
} }
return elems; return elements;
} }
/** Event handler for key press. /** Event handler for key press.
...@@ -141,14 +141,14 @@ function onKeyPress( aEvt ) ...@@ -141,14 +141,14 @@ function onKeyPress( aEvt )
/** Function to supply the default key code dictionary. /** Function to supply the default key code dictionary.
* *
* @returns default key code dictionary * @returns Object default key code dictionary
*/ */
function getDefaultKeyCodeDictionary() function getDefaultKeyCodeDictionary()
{ {
var keyCodeDict = new Object(); var keyCodeDict = {};
keyCodeDict[SLIDE_MODE] = new Object(); keyCodeDict[SLIDE_MODE] = {};
keyCodeDict[INDEX_MODE] = new Object(); keyCodeDict[INDEX_MODE] = {};
// slide mode // slide mode
keyCodeDict[SLIDE_MODE][LEFT_KEY] keyCodeDict[SLIDE_MODE][LEFT_KEY]
...@@ -199,14 +199,14 @@ function getDefaultKeyCodeDictionary() ...@@ -199,14 +199,14 @@ function getDefaultKeyCodeDictionary()
/** Function to supply the default char code dictionary. /** Function to supply the default char code dictionary.
* *
* @returns default char code dictionary * @returns Object char code dictionary
*/ */
function getDefaultCharCodeDictionary() function getDefaultCharCodeDictionary()
{ {
var charCodeDict = new Object(); var charCodeDict = {};
charCodeDict[SLIDE_MODE] = new Object(); charCodeDict[SLIDE_MODE] = {};
charCodeDict[INDEX_MODE] = new Object(); charCodeDict[INDEX_MODE] = {};
// slide mode // slide mode
charCodeDict[SLIDE_MODE]['i'] charCodeDict[SLIDE_MODE]['i']
...@@ -390,14 +390,14 @@ function mouseClickHelper( aEvt ) ...@@ -390,14 +390,14 @@ function mouseClickHelper( aEvt )
/** Function to supply the default mouse handler dictionary. /** Function to supply the default mouse handler dictionary.
* *
* @returns default mouse handler dictionary * @returns Object default mouse handler dictionary
*/ */
function getDefaultMouseHandlerDictionary() function getDefaultMouseHandlerDictionary()
{ {
var mouseHandlerDict = new Object(); var mouseHandlerDict = {};
mouseHandlerDict[SLIDE_MODE] = new Object(); mouseHandlerDict[SLIDE_MODE] = {};
mouseHandlerDict[INDEX_MODE] = new Object(); mouseHandlerDict[INDEX_MODE] = {};
// slide mode // slide mode
mouseHandlerDict[SLIDE_MODE][MOUSE_UP] mouseHandlerDict[SLIDE_MODE][MOUSE_UP]
...@@ -548,7 +548,7 @@ function configureDetectionTools() ...@@ -548,7 +548,7 @@ function configureDetectionTools()
dav = n.appVersion, dav = n.appVersion,
tv = parseFloat(dav); tv = parseFloat(dav);
has.add('air', dua.indexOf('AdobeAIR') >= 0), has.add('air', dua.indexOf('AdobeAIR') >= 0);
has.add('khtml', dav.indexOf('Konqueror') >= 0 ? tv : undefined); has.add('khtml', dav.indexOf('Konqueror') >= 0 ? tv : undefined);
has.add('webkit', parseFloat(dua.split('WebKit/')[1]) || undefined); has.add('webkit', parseFloat(dua.split('WebKit/')[1]) || undefined);
has.add('chrome', parseFloat(dua.split('Chrome/')[1]) || undefined); has.add('chrome', parseFloat(dua.split('Chrome/')[1]) || undefined);
...@@ -584,7 +584,7 @@ function configureDetectionTools() ...@@ -584,7 +584,7 @@ function configureDetectionTools()
//Make sure isIE reflects the desired version. //Make sure isIE reflects the desired version.
//document.documentMode of 5 means quirks mode. //document.documentMode of 5 means quirks mode.
//Only switch the value if documentMode's major version //Only switch the value if documentMode's major version
//is different from isIE's major version. //is different from isIE major version.
var mode = document.documentMode; var mode = document.documentMode;
if(mode && mode != 5 && Math.floor(isIE) != mode){ if(mode && mode != 5 && Math.floor(isIE) != mode){
isIE = mode; isIE = mode;
...@@ -720,7 +720,7 @@ function configureDetectionTools() ...@@ -720,7 +720,7 @@ function configureDetectionTools()
* Several parts of the following code are the result of the porting, * Several parts of the following code are the result of the porting,
* started on August 2011, of the C++ code included in the source * started on August 2011, of the C++ code included in the source
* files placed under the folder '/slideshow/source' and * files placed under the folder '/slideshow/source' and
* subfolders. This got later rebased onto the AL2-licensed versions * sub-folders. This got later rebased onto the AL2-licensed versions
* of those files in early 2013. * of those files in early 2013.
* @source http://cgit.freedesktop.org/libreoffice/core/tree/slideshow/source * @source http://cgit.freedesktop.org/libreoffice/core/tree/slideshow/source
* *
...@@ -770,7 +770,7 @@ var aFooterClassName = 'Footer'; ...@@ -770,7 +770,7 @@ var aFooterClassName = 'Footer';
var aHeaderClassName = 'Header'; var aHeaderClassName = 'Header';
// Creating a namespace dictionary. // Creating a namespace dictionary.
var NSS = new Object(); var NSS = {};
NSS['svg']='http://www.w3.org/2000/svg'; NSS['svg']='http://www.w3.org/2000/svg';
NSS['rdf']='http://www.w3.org/1999/02/22-rdf-syntax-ns#'; NSS['rdf']='http://www.w3.org/1999/02/22-rdf-syntax-ns#';
NSS['xlink']='http://www.w3.org/1999/xlink'; NSS['xlink']='http://www.w3.org/1999/xlink';
...@@ -790,7 +790,7 @@ var MOUSE_DOWN = 2; ...@@ -790,7 +790,7 @@ var MOUSE_DOWN = 2;
var MOUSE_MOVE = 3; var MOUSE_MOVE = 3;
var MOUSE_WHEEL = 4; var MOUSE_WHEEL = 4;
// Keycodes. // Key-codes.
var LEFT_KEY = 37; // cursor left keycode var LEFT_KEY = 37; // cursor left keycode
var UP_KEY = 38; // cursor up keycode var UP_KEY = 38; // cursor up keycode
var RIGHT_KEY = 39; // cursor right keycode var RIGHT_KEY = 39; // cursor right keycode
...@@ -874,7 +874,7 @@ function extend( aSubType, aSuperType ) ...@@ -874,7 +874,7 @@ function extend( aSubType, aSuperType )
function instantiate( TemplateClass, BaseType ) function instantiate( TemplateClass, BaseType )
{ {
if( !TemplateClass.instanceSet ) if( !TemplateClass.instanceSet )
TemplateClass.instanceSet = new Array(); TemplateClass.instanceSet = [];
var nSize = TemplateClass.instanceSet.length; var nSize = TemplateClass.instanceSet.length;
...@@ -884,7 +884,7 @@ function instantiate( TemplateClass, BaseType ) ...@@ -884,7 +884,7 @@ function instantiate( TemplateClass, BaseType )
return TemplateClass.instanceSet[i].instance; return TemplateClass.instanceSet[i].instance;
} }
TemplateClass.instanceSet[ nSize ] = new Object(); TemplateClass.instanceSet[ nSize ] = {};
TemplateClass.instanceSet[ nSize ].base = BaseType; TemplateClass.instanceSet[ nSize ].base = BaseType;
TemplateClass.instanceSet[ nSize ].instance = TemplateClass( BaseType ); TemplateClass.instanceSet[ nSize ].instance = TemplateClass( BaseType );
...@@ -985,7 +985,7 @@ function checkElemAndSetAttribute( aElem, sAttrName, aValue ) ...@@ -985,7 +985,7 @@ function checkElemAndSetAttribute( aElem, sAttrName, aValue )
function getElementsByClassName( aElem, sClassName ) function getElementsByClassName( aElem, sClassName )
{ {
var aElementSet = new Array(); var aElementSet = [];
// not all browsers support the 'getElementsByClassName' method // not all browsers support the 'getElementsByClassName' method
if( 'getElementsByClassName' in aElem ) if( 'getElementsByClassName' in aElem )
{ {
...@@ -1215,16 +1215,16 @@ function MetaDocument() ...@@ -1215,16 +1215,16 @@ function MetaDocument()
// The collections for handling properties of each slide, svg elements // The collections for handling properties of each slide, svg elements
// related to master pages and content and properties of text fields. // related to master pages and content and properties of text fields.
this.aMetaSlideSet = new Array(); this.aMetaSlideSet = [];
this.aMasterPageSet = new Object(); this.aMasterPageSet = {};
this.aTextFieldHandlerSet = new Object(); this.aTextFieldHandlerSet = {};
this.aTextFieldContentProviderSet = new Array(); this.aTextFieldContentProviderSet = [];
this.aSlideNumberProvider = new SlideNumberProvider( this.nStartSlideNumber + 1, this.sPageNumberingType ); this.aSlideNumberProvider = new SlideNumberProvider( this.nStartSlideNumber + 1, this.sPageNumberingType );
// We create a map with key an id and value the svg element containing // We create a map with key an id and value the svg element containing
// the animations performed on the slide with such an id. // the animations performed on the slide with such an id.
this.bIsAnimated = false; this.bIsAnimated = false;
this.aSlideAnimationsMap = new Object(); this.aSlideAnimationsMap = {};
this.initSlideAnimationsMap(); this.initSlideAnimationsMap();
// We initialize dummy slide - used as leaving slide for transition on the first slide // We initialize dummy slide - used as leaving slide for transition on the first slide
...@@ -1386,7 +1386,7 @@ function MetaSlide( sMetaSlideId, aMetaDoc ) ...@@ -1386,7 +1386,7 @@ function MetaSlide( sMetaSlideId, aMetaDoc )
this.bIsDateTimeVariable = undefined; this.bIsDateTimeVariable = undefined;
// We initialize the objects responsible to provide the content to text field. // We initialize the objects responsible to provide the content to text field.
this.aTextFieldContentProviderSet = new Object(); this.aTextFieldContentProviderSet = {};
this.aTextFieldContentProviderSet[aSlideNumberClassName] = this.initSlideNumberFieldContentProvider(); this.aTextFieldContentProviderSet[aSlideNumberClassName] = this.initSlideNumberFieldContentProvider();
this.aTextFieldContentProviderSet[aDateTimeClassName] = this.initDateTimeFieldContentProvider( aOOOAttrDateTimeField ); this.aTextFieldContentProviderSet[aDateTimeClassName] = this.initDateTimeFieldContentProvider( aOOOAttrDateTimeField );
this.aTextFieldContentProviderSet[aFooterClassName] = this.initFixedTextFieldContentProvider( aOOOAttrFooterField ); this.aTextFieldContentProviderSet[aFooterClassName] = this.initFixedTextFieldContentProvider( aOOOAttrFooterField );
...@@ -1471,7 +1471,7 @@ initMasterPage : function() ...@@ -1471,7 +1471,7 @@ initMasterPage : function()
// We initialize aTextFieldHandlerSet[ sMasterPageId ] to an empty // We initialize aTextFieldHandlerSet[ sMasterPageId ] to an empty
// collection. // collection.
this.theMetaDoc.aTextFieldHandlerSet[ sMasterPageId ] = new Object(); this.theMetaDoc.aTextFieldHandlerSet[ sMasterPageId ] = {};
} }
return this.theMetaDoc.aMasterPageSet[ sMasterPageId ]; return this.theMetaDoc.aMasterPageSet[ sMasterPageId ];
}, },
...@@ -1549,7 +1549,7 @@ initFixedTextFieldContentProvider : function( aOOOAttribute ) ...@@ -1549,7 +1549,7 @@ initFixedTextFieldContentProvider : function( aOOOAttribute )
collectTextShapes : function() collectTextShapes : function()
{ {
var aTextShapeSet = new Array(); var aTextShapeSet = [];
var aTextShapeIndexElem = getElementByClassName( document, 'TextShapeIndex' ); var aTextShapeIndexElem = getElementByClassName( document, 'TextShapeIndex' );
if( aTextShapeIndexElem ) if( aTextShapeIndexElem )
{ {
...@@ -1588,7 +1588,7 @@ collectTextShapes : function() ...@@ -1588,7 +1588,7 @@ collectTextShapes : function()
initHyperlinks : function() initHyperlinks : function()
{ {
var aHyperlinkSet = new Object(); var aHyperlinkSet = {};
var i; var i;
for( i = 0; i < this.aTextShapeSet.length; ++i ) for( i = 0; i < this.aTextShapeSet.length; ++i )
{ {
...@@ -1655,6 +1655,8 @@ getSlideAnimationsRoot : function() ...@@ -1655,6 +1655,8 @@ getSlideAnimationsRoot : function()
* @param sMasterPageId * @param sMasterPageId
* A string representing the value of the id attribute of the master page * A string representing the value of the id attribute of the master page
* element to be handled. * element to be handled.
* @param aMetaSlide
* A meta slide having as master page the one with the passed id.
*/ */
function MasterPage( sMasterPageId, aMetaSlide ) function MasterPage( sMasterPageId, aMetaSlide )
{ {
...@@ -1695,7 +1697,7 @@ function MasterPage( sMasterPageId, aMetaSlide ) ...@@ -1695,7 +1697,7 @@ function MasterPage( sMasterPageId, aMetaSlide )
var nSubGroupId = 1; var nSubGroupId = 1;
var sClass; var sClass;
var sId = ''; var sId = '';
this.aBackgroundObjectSubGroupIdList = new Array(); this.aBackgroundObjectSubGroupIdList = [];
var i = 0; var i = 0;
for( ; i < aBackgroundObjectList.length; ++i ) for( ; i < aBackgroundObjectList.length; ++i )
{ {
...@@ -1735,7 +1737,7 @@ function MasterPage( sMasterPageId, aMetaSlide ) ...@@ -1735,7 +1737,7 @@ function MasterPage( sMasterPageId, aMetaSlide )
} }
// We populate the collection of placeholders. // We populate the collection of placeholders.
this.aPlaceholderShapeSet = new Object(); this.aPlaceholderShapeSet = {};
this.initPlaceholderShapes(); this.initPlaceholderShapes();
} }
...@@ -1978,7 +1980,7 @@ MasterPageView.prototype.createElement = function() ...@@ -1978,7 +1980,7 @@ MasterPageView.prototype.createElement = function()
// clone and initialize text field elements // clone and initialize text field elements
var aBackgroundObjectSubGroupIdList = this.aMasterPage.aBackgroundObjectSubGroupIdList; var aBackgroundObjectSubGroupIdList = this.aMasterPage.aBackgroundObjectSubGroupIdList;
this.aBackgroundSubGroupElementSet = new Array(); this.aBackgroundSubGroupElementSet = [];
var aPlaceholderShapeSet = this.aMasterPage.aPlaceholderShapeSet; var aPlaceholderShapeSet = this.aMasterPage.aPlaceholderShapeSet;
var aTextFieldContentProviderSet = this.aMetaSlide.aTextFieldContentProviderSet; var aTextFieldContentProviderSet = this.aMetaSlide.aTextFieldContentProviderSet;
// where cloned elements are appended // where cloned elements are appended
...@@ -3069,17 +3071,6 @@ function bind2( aFunction ) ...@@ -3069,17 +3071,6 @@ function bind2( aFunction )
return aResultFunction; return aResultFunction;
} }
//function concat3( s1, s2, s3 )
//{
// log( s1 + s2 + s3 );
//}
//
//var bound1 = bind2( concat3, 'Qui' );
//bound1( 'Quo', 'Qua' );
//
//var bound2 = bind2( concat3, 'Qui', 'Quo' );
//bound2( 'Qua' );
function getCurrentSystemTime() function getCurrentSystemTime()
{ {
return ( new Date() ).getTime(); return ( new Date() ).getTime();
...@@ -3096,11 +3087,12 @@ function getSlideAnimationsRoot( sSlideId ) ...@@ -3096,11 +3087,12 @@ function getSlideAnimationsRoot( sSlideId )
* *
* @param aElement any XML element * @param aElement any XML element
* *
* @returns an array that contains all children elements * @returns Array
* an array that contains all children elements
*/ */
function getElementChildren( aElement ) function getElementChildren( aElement )
{ {
var aChildrenArray = new Array(); var aChildrenArray = [];
var nSize = aElement.childNodes.length; var nSize = aElement.childNodes.length;
...@@ -3119,8 +3111,8 @@ function removeWhiteSpaces( str ) ...@@ -3119,8 +3111,8 @@ function removeWhiteSpaces( str )
return ''; return '';
var re = / */; var re = / */;
var aSplittedString = str.split( re ); var aSplitString = str.split( re );
return aSplittedString.join(''); return aSplitString.join('');
} }
function clamp( nValue, nMinimum, nMaximum ) function clamp( nValue, nMinimum, nMaximum )
...@@ -3805,7 +3797,7 @@ function SVGPathMatrixTransform( aPath, aSVGMatrix ) ...@@ -3805,7 +3797,7 @@ function SVGPathMatrixTransform( aPath, aSVGMatrix )
function PriorityQueue( aCompareFunc ) function PriorityQueue( aCompareFunc )
{ {
this.aSequence = new Array(); this.aSequence = [];
this.aCompareFunc = aCompareFunc; this.aCompareFunc = aCompareFunc;
} }
...@@ -3844,7 +3836,7 @@ PriorityQueue.prototype.push = function( aValue ) ...@@ -3844,7 +3836,7 @@ PriorityQueue.prototype.push = function( aValue )
PriorityQueue.prototype.clear = function() PriorityQueue.prototype.clear = function()
{ {
this.aSequence = new Array(); this.aSequence = [];
}; };
PriorityQueue.prototype.pop = function() PriorityQueue.prototype.pop = function()
...@@ -4148,7 +4140,7 @@ PINWHEELWIPE_TRANSITION = 6; // 23 ...@@ -4148,7 +4140,7 @@ PINWHEELWIPE_TRANSITION = 6; // 23
PUSHWIPE_TRANSITION = 7; // 35 PUSHWIPE_TRANSITION = 7; // 35
SLIDEWIPE_TRANSITION = 8; // 36 SLIDEWIPE_TRANSITION = 8; // 36
FADE_TRANSITION = 9; // 37 FADE_TRANSITION = 9; // 37
RANDOMBARWIPE_TRANSITION = 10 // 38 RANDOMBARWIPE_TRANSITION = 10; // 38
CHECKERBOARDWIPE_TRANSITION = 11; // 39 CHECKERBOARDWIPE_TRANSITION = 11; // 39
DISSOLVE_TRANSITION = 12; // 40 DISSOLVE_TRANSITION = 12; // 40
...@@ -4180,7 +4172,7 @@ CORNERSIN_TRANS_SUBTYPE = 3; // 11 ...@@ -4180,7 +4172,7 @@ CORNERSIN_TRANS_SUBTYPE = 3; // 11
CORNERSOUT_TRANS_SUBTYPE = 4; CORNERSOUT_TRANS_SUBTYPE = 4;
VERTICAL_TRANS_SUBTYPE = 5; VERTICAL_TRANS_SUBTYPE = 5;
HORIZONTAL_TRANS_SUBTYPE = 6; // 14 HORIZONTAL_TRANS_SUBTYPE = 6; // 14
DOWN_TRANS_SUBTYPE = 7 // 19 DOWN_TRANS_SUBTYPE = 7; // 19
CIRCLE_TRANS_SUBTYPE = 8; // 27 CIRCLE_TRANS_SUBTYPE = 8; // 27
CLOCKWISETWELVE_TRANS_SUBTYPE = 9; // 33 CLOCKWISETWELVE_TRANS_SUBTYPE = 9; // 33
CLOCKWISETHREE_TRANS_SUBTYPE = 10; CLOCKWISETHREE_TRANS_SUBTYPE = 10;
...@@ -4535,15 +4527,14 @@ aTransitionInfoTable[DISSOLVE_TRANSITION][DEFAULT_TRANS_SUBTYPE] = ...@@ -4535,15 +4527,14 @@ aTransitionInfoTable[DISSOLVE_TRANSITION][DEFAULT_TRANS_SUBTYPE] =
function createStateTransitionTable() function createStateTransitionTable()
{ {
var aSTT = {} var aSTT = {};
var aTable = null;
aSTT[RESTART_MODE_NEVER] = {}; aSTT[RESTART_MODE_NEVER] = {};
aSTT[RESTART_MODE_WHEN_NOT_ACTIVE] = {}; aSTT[RESTART_MODE_WHEN_NOT_ACTIVE] = {};
aSTT[RESTART_MODE_ALWAYS] = {}; aSTT[RESTART_MODE_ALWAYS] = {};
// transition table for restart=NEVER, fill=REMOVE // transition table for restart=NEVER, fill=REMOVE
aTable = var aTable =
aSTT[RESTART_MODE_NEVER][FILL_MODE_REMOVE] = {}; aSTT[RESTART_MODE_NEVER][FILL_MODE_REMOVE] = {};
aTable[INVALID_NODE] = INVALID_NODE; aTable[INVALID_NODE] = INVALID_NODE;
aTable[UNRESOLVED_NODE] = RESOLVED_NODE | ENDED_NODE; aTable[UNRESOLVED_NODE] = RESOLVED_NODE | ENDED_NODE;
...@@ -4608,7 +4599,6 @@ function createStateTransitionTable() ...@@ -4608,7 +4599,6 @@ function createStateTransitionTable()
aTable[FROZEN_NODE] = RESOLVED_NODE | ACTIVE_NODE | ENDED_NODE; // restart is possible aTable[FROZEN_NODE] = RESOLVED_NODE | ACTIVE_NODE | ENDED_NODE; // restart is possible
aTable[ENDED_NODE] = RESOLVED_NODE | ACTIVE_NODE | ENDED_NODE; // restart is possible aTable[ENDED_NODE] = RESOLVED_NODE | ACTIVE_NODE | ENDED_NODE; // restart is possible
return aSTT; return aSTT;
} }
...@@ -4767,7 +4757,7 @@ Timing.prototype.parse = function() ...@@ -4767,7 +4757,7 @@ Timing.prototype.parse = function()
} }
else else
{ {
var aTimingSplit = new Array(); var aTimingSplit = [];
bPositiveOffset = true; bPositiveOffset = true;
if( this.sTimingDescription.indexOf( '+' ) != -1 ) if( this.sTimingDescription.indexOf( '+' ) != -1 )
{ {
...@@ -5136,7 +5126,7 @@ function BaseNode( aAnimElem, aParentNode, aNodeContext ) ...@@ -5136,7 +5126,7 @@ function BaseNode( aAnimElem, aParentNode, aNodeContext )
this.nStartDelay = aNodeContext.nStartDelay; this.nStartDelay = aNodeContext.nStartDelay;
this.eCurrentState = UNRESOLVED_NODE; this.eCurrentState = UNRESOLVED_NODE;
this.nCurrentStateTransition = 0; this.nCurrentStateTransition = 0;
this.aDeactivatingListenerArray = new Array(); this.aDeactivatingListenerArray = [];
this.aActivationEvent = null; this.aActivationEvent = null;
this.aDeactivationEvent = null; this.aDeactivationEvent = null;
...@@ -5219,7 +5209,7 @@ BaseNode.prototype.parseElement = function() ...@@ -5219,7 +5209,7 @@ BaseNode.prototype.parseElement = function()
this.nReapeatCount = 1; this.nReapeatCount = 1;
else else
this.nReapeatCount = parseFloat( sRepeatCount ); this.nReapeatCount = parseFloat( sRepeatCount );
if( ( this.nReapeatCount == NaN ) && ( sRepeatCount != 'indefinite' ) ) if( ( isNaN(this.nReapeatCount) ) && ( sRepeatCount != 'indefinite' ) )
this.nReapeatCount = 1; this.nReapeatCount = 1;
// accelerate attribute // accelerate attribute
...@@ -5227,7 +5217,7 @@ BaseNode.prototype.parseElement = function() ...@@ -5227,7 +5217,7 @@ BaseNode.prototype.parseElement = function()
var sAccelerateAttr = aAnimElem.getAttributeNS( NSS['smil'], 'accelerate' ); var sAccelerateAttr = aAnimElem.getAttributeNS( NSS['smil'], 'accelerate' );
if( sAccelerateAttr ) if( sAccelerateAttr )
this.nAccelerate = parseFloat( sAccelerateAttr ); this.nAccelerate = parseFloat( sAccelerateAttr );
if( this.nAccelerate == NaN ) if( isNaN(this.nAccelerate) )
this.nAccelerate = 0.0; this.nAccelerate = 0.0;
// decelerate attribute // decelerate attribute
...@@ -5235,7 +5225,7 @@ BaseNode.prototype.parseElement = function() ...@@ -5235,7 +5225,7 @@ BaseNode.prototype.parseElement = function()
var sDecelerateAttr = aAnimElem.getAttributeNS( NSS['smil'], 'decelerate' ); var sDecelerateAttr = aAnimElem.getAttributeNS( NSS['smil'], 'decelerate' );
if( sDecelerateAttr ) if( sDecelerateAttr )
this.nDecelerate = parseFloat( sDecelerateAttr ); this.nDecelerate = parseFloat( sDecelerateAttr );
if( this.nDecelerate == NaN ) if( isNaN(this.nDecelerate) )
this.nDecelerate = 0.0; this.nDecelerate = 0.0;
// autoReverse attribute // autoReverse attribute
...@@ -5428,7 +5418,7 @@ BaseNode.prototype.dispose = function() ...@@ -5428,7 +5418,7 @@ BaseNode.prototype.dispose = function()
this.aActivationEvent.dispose(); this.aActivationEvent.dispose();
if( this.aDeactivationEvent ) if( this.aDeactivationEvent )
this.aDeactivationEvent.dispose(); this.aDeactivationEvent.dispose();
this.aDeactivatingListenerArray = new Array(); this.aDeactivatingListenerArray = [];
}; };
BaseNode.prototype.getState = function() BaseNode.prototype.getState = function()
...@@ -6023,7 +6013,7 @@ AnimationBaseNode3.prototype.parseElement = function() ...@@ -6023,7 +6013,7 @@ AnimationBaseNode3.prototype.parseElement = function()
this.aByValue = aAnimElem.getAttributeNS( NSS['smil'], 'by' ); this.aByValue = aAnimElem.getAttributeNS( NSS['smil'], 'by' );
// keyTimes attribute // keyTimes attribute
this.aKeyTimes = new Array(); this.aKeyTimes = [];
var sKeyTimesAttr = aAnimElem.getAttributeNS( NSS['smil'], 'keyTimes' ); var sKeyTimesAttr = aAnimElem.getAttributeNS( NSS['smil'], 'keyTimes' );
sKeyTimesAttr = removeWhiteSpaces( sKeyTimesAttr ); sKeyTimesAttr = removeWhiteSpaces( sKeyTimesAttr );
if( sKeyTimesAttr ) if( sKeyTimesAttr )
...@@ -6041,7 +6031,7 @@ AnimationBaseNode3.prototype.parseElement = function() ...@@ -6041,7 +6031,7 @@ AnimationBaseNode3.prototype.parseElement = function()
} }
else else
{ {
this.aValues = new Array(); this.aValues = [];
} }
return bRet; return bRet;
...@@ -6119,7 +6109,7 @@ function BaseContainerNode( aAnimElem, aParentNode, aNodeContext ) ...@@ -6119,7 +6109,7 @@ function BaseContainerNode( aAnimElem, aParentNode, aNodeContext )
this.sClassName = 'BaseContainerNode'; this.sClassName = 'BaseContainerNode';
this.bIsContainer = true; this.bIsContainer = true;
this.aChildrenArray = new Array(); this.aChildrenArray = [];
this.nFinishedChildren = 0; this.nFinishedChildren = 0;
this.bDurationIndefinite = false; this.bDurationIndefinite = false;
this.nLeftIterations = 1; this.nLeftIterations = 1;
...@@ -6341,7 +6331,7 @@ BaseContainerNode.prototype.saveStateOfAnimatedElement = function() ...@@ -6341,7 +6331,7 @@ BaseContainerNode.prototype.saveStateOfAnimatedElement = function()
{ {
this.aChildrenArray[i].saveStateOfAnimatedElement(); this.aChildrenArray[i].saveStateOfAnimatedElement();
} }
} };
BaseContainerNode.prototype.forEachChildNode = function( aFunction, eNodeStateMask ) BaseContainerNode.prototype.forEachChildNode = function( aFunction, eNodeStateMask )
{ {
...@@ -7531,8 +7521,6 @@ function SlideChangeBase(aLeavingSlide, aEnteringSlide) ...@@ -7531,8 +7521,6 @@ function SlideChangeBase(aLeavingSlide, aEnteringSlide)
*/ */
SlideChangeBase.prototype.start = function() SlideChangeBase.prototype.start = function()
{ {
if( this.bIsFinished )
return;
}; };
/** end /** end
...@@ -7843,7 +7831,7 @@ extend( ClippedSlideChange, SlideChangeBase ); ...@@ -7843,7 +7831,7 @@ extend( ClippedSlideChange, SlideChangeBase );
ClippedSlideChange.prototype.start = function() ClippedSlideChange.prototype.start = function()
{ {
ClippedSlideChange.superclass.start.call( this ); ClippedSlideChange.superclass.start.call( this );
this.aEnteringSlide.notifyUsedAttribute( 'clip-path' );; this.aEnteringSlide.notifyUsedAttribute( 'clip-path' );
this.performIn( 0 ); this.performIn( 0 );
this.aEnteringSlide.show(); this.aEnteringSlide.show();
}; };
...@@ -7924,7 +7912,7 @@ function ClippingFunctor( aParametricPolyPolygon, aTransitionInfo, ...@@ -7924,7 +7912,7 @@ function ClippingFunctor( aParametricPolyPolygon, aTransitionInfo,
switch( aTransitionInfo.reverseMethod ) switch( aTransitionInfo.reverseMethod )
{ {
default: default:
log( 'ClippingFunctor: unexpected reverse method.' ) log( 'ClippingFunctor: unexpected reverse method.' );
break; break;
case REVERSEMETHOD_IGNORE: case REVERSEMETHOD_IGNORE:
break; break;
...@@ -7988,7 +7976,7 @@ ClippingFunctor.aBoundingPath.setAttribute( 'd', 'M -1 -1 L 2 -1 L 2 2 L -1 2 L ...@@ -7988,7 +7976,7 @@ ClippingFunctor.aBoundingPath.setAttribute( 'd', 'M -1 -1 L 2 -1 L 2 2 L -1 2 L
* The width of the bounding box of the slide/shape to be clipped. * The width of the bounding box of the slide/shape to be clipped.
* @param nHeight * @param nHeight
* The height of the bounding box of the slide/shape to be clipped. * The height of the bounding box of the slide/shape to be clipped.
* @return {SVGPathElement} * @return SVGPathElement
* A svg <path> element representing the path to be used for the clipping * A svg <path> element representing the path to be used for the clipping
* operation. * operation.
*/ */
...@@ -8139,7 +8127,7 @@ function BarWipePath( nBars /* nBars > 1: blinds effect */ ) ...@@ -8139,7 +8127,7 @@ function BarWipePath( nBars /* nBars > 1: blinds effect */ )
* *
* @param nT * @param nT
* A parameter in [0,1] representing the width of the generated bars. * A parameter in [0,1] representing the width of the generated bars.
* @return {SVGPathElement} * @return SVGPathElement
* A svg <path> element representing a multi-bars. * A svg <path> element representing a multi-bars.
*/ */
BarWipePath.prototype.perform = function( nT ) BarWipePath.prototype.perform = function( nT )
...@@ -8368,7 +8356,7 @@ function CheckerBoardWipePath( unitsPerEdge ) ...@@ -8368,7 +8356,7 @@ function CheckerBoardWipePath( unitsPerEdge )
* *
* @param nT * @param nT
* A parameter in [0,1] representing the width of the generated bars. * A parameter in [0,1] representing the width of the generated bars.
* @return {SVGPathElement} * @return SVGPathElement
* A svg <path> element representing a multi-bars. * A svg <path> element representing a multi-bars.
*/ */
CheckerBoardWipePath.prototype.perform = function( nT ) CheckerBoardWipePath.prototype.perform = function( nT )
...@@ -8423,28 +8411,28 @@ function RandomWipePath( nElements, bRandomBars ) ...@@ -8423,28 +8411,28 @@ function RandomWipePath( nElements, bRandomBars )
this.aClipPath = createEmptyPath(); this.aClipPath = createEmptyPath();
this.nAlreadyAppendedElements = 0; this.nAlreadyAppendedElements = 0;
var fEdgeLength, nPos, aTransform;
if( bRandomBars ) // random bar wipe if( bRandomBars ) // random bar wipe
{ {
var fEdgeLength = 1.0 / nElements; fEdgeLength = 1.0 / nElements;
var nPos;
for( nPos = 0; nPos < nElements; ++nPos ) for( nPos = 0; nPos < nElements; ++nPos )
{ {
this.aPositionArray[nPos] = { x: 0.0, y: pruneScaleValue( nPos * fEdgeLength ) } this.aPositionArray[nPos] = { x: 0.0, y: pruneScaleValue( nPos * fEdgeLength ) }
} }
var aTransform = SVGIdentityMatrix.scaleNonUniform( 1.0, pruneScaleValue( fEdgeLength ) ); aTransform = SVGIdentityMatrix.scaleNonUniform( 1.0, pruneScaleValue( fEdgeLength ) );
} }
else // dissolve wipe else // dissolve wipe
{ {
var nSqrtElements = Math.round( Math.sqrt( nElements ) ); var nSqrtElements = Math.round( Math.sqrt( nElements ) );
var fEdgeLength = 1.0 / nSqrtElements; fEdgeLength = 1.0 / nSqrtElements;
var nPos;
for( nPos = 0; nPos < nElements; ++nPos ) for( nPos = 0; nPos < nElements; ++nPos )
{ {
this.aPositionArray[nPos] = { this.aPositionArray[nPos] = {
x: pruneScaleValue( ( nPos % nSqrtElements ) * fEdgeLength ), x: pruneScaleValue( ( nPos % nSqrtElements ) * fEdgeLength ),
y: pruneScaleValue( ( nPos / nSqrtElements ) * fEdgeLength ) } y: pruneScaleValue( ( nPos / nSqrtElements ) * fEdgeLength ) }
} }
var aTransform = SVGIdentityMatrix.scale( pruneScaleValue( fEdgeLength ) ); aTransform = SVGIdentityMatrix.scale( pruneScaleValue( fEdgeLength ) );
} }
this.aBasePath.matrixTransform( aTransform ); this.aBasePath.matrixTransform( aTransform );
...@@ -8463,7 +8451,7 @@ function RandomWipePath( nElements, bRandomBars ) ...@@ -8463,7 +8451,7 @@ function RandomWipePath( nElements, bRandomBars )
* *
* @param nT * @param nT
* A parameter in [0,1] representing the width of the generated bars or squares. * A parameter in [0,1] representing the width of the generated bars or squares.
* @return {SVGPathElement} * @return SVGPathElement
* A svg <path> element representing a multi bars or a multi squared cells. * A svg <path> element representing a multi bars or a multi squared cells.
*/ */
RandomWipePath.prototype.perform = function( nT ) RandomWipePath.prototype.perform = function( nT )
...@@ -8518,7 +8506,7 @@ function AnimatedSlide( aMetaSlide ) ...@@ -8518,7 +8506,7 @@ function AnimatedSlide( aMetaSlide )
this.aSlideElement = this.aMetaSlide.slideElement; this.aSlideElement = this.aMetaSlide.slideElement;
this.sSlideId = this.aMetaSlide.slideId; this.sSlideId = this.aMetaSlide.slideId;
this.aUsedAttributeSet = new Array(); this.aUsedAttributeSet = [];
this.aClipPathElement = null; this.aClipPathElement = null;
this.aClipPathContent = null; this.aClipPathContent = null;
...@@ -8579,7 +8567,7 @@ AnimatedSlide.prototype.reset = function() ...@@ -8579,7 +8567,7 @@ AnimatedSlide.prototype.reset = function()
var sAttrName = this.aUsedAttributeSet[i]; var sAttrName = this.aUsedAttributeSet[i];
this.aSlideElement.removeAttribute( sAttrName ); this.aSlideElement.removeAttribute( sAttrName );
} }
this.aUsedAttributeSet = new Array(); this.aUsedAttributeSet = [];
}; };
/** initClipPath /** initClipPath
...@@ -8761,7 +8749,7 @@ function AnimatedElement( aElement ) ...@@ -8761,7 +8749,7 @@ function AnimatedElement( aElement )
this.aClipPathContent = null; this.aClipPathContent = null;
this.aPreviousElement = null; this.aPreviousElement = null;
this.aStateSet = new Object(); this.aStateSet = {};
this.eAdditiveMode = ADDITIVE_MODE_REPLACE; this.eAdditiveMode = ADDITIVE_MODE_REPLACE;
this.bIsUpdated = true; this.bIsUpdated = true;
...@@ -8915,7 +8903,7 @@ AnimatedElement.prototype.saveState = function( nAnimationNodeId ) ...@@ -8915,7 +8903,7 @@ AnimatedElement.prototype.saveState = function( nAnimationNodeId )
ANIMDBG.print( 'AnimatedElement(' + this.getId() + ').saveState(' + nAnimationNodeId +')' ); ANIMDBG.print( 'AnimatedElement(' + this.getId() + ').saveState(' + nAnimationNodeId +')' );
if( !this.aStateSet[ nAnimationNodeId ] ) if( !this.aStateSet[ nAnimationNodeId ] )
{ {
this.aStateSet[ nAnimationNodeId ] = new Object(); this.aStateSet[ nAnimationNodeId ] = {};
} }
var aState = this.aStateSet[ nAnimationNodeId ]; var aState = this.aStateSet[ nAnimationNodeId ];
aState.aElement = this.aActiveElement.cloneNode( true ); aState.aElement = this.aActiveElement.cloneNode( true );
...@@ -9391,12 +9379,12 @@ function AnimatedTextElement( aElement, aEventMultiplexer ) ...@@ -9391,12 +9379,12 @@ function AnimatedTextElement( aElement, aEventMultiplexer )
} }
// In case there are embedded bitmaps we need to clone them // In case there are embedded bitmaps we need to clone them
var aBitmapElemSet = new Array(); var aBitmapElemSet = [];
var aBitmapCloneSet = new Array(); var aBitmapCloneSet = [];
var aBitmapPlaceholderSet = getElementsByClassName( aElement, 'BitmapPlaceholder' ); var aBitmapPlaceholderSet = getElementsByClassName( aElement, 'BitmapPlaceholder' );
var i;
if( aBitmapPlaceholderSet ) if( aBitmapPlaceholderSet )
{ {
var i;
for( i = 0; i < aBitmapPlaceholderSet.length; ++i ) for( i = 0; i < aBitmapPlaceholderSet.length; ++i )
{ {
sId = aBitmapPlaceholderSet[i].getAttribute( 'id' ); sId = aBitmapPlaceholderSet[i].getAttribute( 'id' );
...@@ -9477,11 +9465,10 @@ function AnimatedTextElement( aElement, aEventMultiplexer ) ...@@ -9477,11 +9465,10 @@ function AnimatedTextElement( aElement, aEventMultiplexer )
this.nRunningAnimations = 0; this.nRunningAnimations = 0;
// we collect all hyperlink ids // we collect all hyperlink ids
this.aHyperlinkIdSet = new Array(); this.aHyperlinkIdSet = [];
var aHyperlinkElementSet = getElementsByClassName( this.aParagraphElement, 'UrlField' ); var aHyperlinkElementSet = getElementsByClassName( this.aParagraphElement, 'UrlField' );
var i = 0;
var sHyperlinkId; var sHyperlinkId;
for( ; i < aHyperlinkElementSet.length; ++i ) for( i = 0; i < aHyperlinkElementSet.length; ++i )
{ {
sHyperlinkId = aHyperlinkElementSet[i].getAttribute( 'id' ); sHyperlinkId = aHyperlinkElementSet[i].getAttribute( 'id' );
if( sHyperlinkId ) if( sHyperlinkId )
...@@ -9490,7 +9477,6 @@ function AnimatedTextElement( aElement, aEventMultiplexer ) ...@@ -9490,7 +9477,6 @@ function AnimatedTextElement( aElement, aEventMultiplexer )
log( 'error: AnimatedTextElement constructor: hyperlink element has no id' ); log( 'error: AnimatedTextElement constructor: hyperlink element has no id' );
} }
AnimatedTextElement.superclass.constructor.call( this, aAnimatableElement, aEventMultiplexer ); AnimatedTextElement.superclass.constructor.call( this, aAnimatableElement, aEventMultiplexer );
} }
...@@ -9900,11 +9886,11 @@ SlideTransition.prototype.info = function() ...@@ -9900,11 +9886,11 @@ SlideTransition.prototype.info = function()
function SlideAnimations( aSlideShowContext ) function SlideAnimations( aSlideShowContext )
{ {
this.aContext = new NodeContext( aSlideShowContext ); this.aContext = new NodeContext( aSlideShowContext );
this.aAnimationNodeMap = new Object(); this.aAnimationNodeMap = {};
this.aAnimatedElementMap = new Object(); this.aAnimatedElementMap = {};
this.aSourceEventElementMap = new Object(); this.aSourceEventElementMap = {};
this.aNextEffectEventArray = new NextEffectEventArray(); this.aNextEffectEventArray = new NextEffectEventArray();
this.aInteractiveAnimationSequenceMap = new Object(); this.aInteractiveAnimationSequenceMap = {};
this.aEventMultiplexer = new EventMultiplexer( aSlideShowContext.aTimerEventQueue ); this.aEventMultiplexer = new EventMultiplexer( aSlideShowContext.aTimerEventQueue );
this.aRootNode = null; this.aRootNode = null;
this.bElementsParsed = false; this.bElementsParsed = false;
...@@ -9982,10 +9968,7 @@ SlideAnimations.prototype.start = function() ...@@ -9982,10 +9968,7 @@ SlideAnimations.prototype.start = function()
return false; return false;
// resolve root node // resolve root node
if( !this.aRootNode.resolve() ) return this.aRootNode.resolve();
return false;
return true;
}; };
SlideAnimations.prototype.end = function( bLeftEffectsSkipped ) SlideAnimations.prototype.end = function( bLeftEffectsSkipped )
...@@ -10179,8 +10162,7 @@ function registerEvent( nNodeId, aTiming, aEvent, aNodeContext ) ...@@ -10179,8 +10162,7 @@ function registerEvent( nNodeId, aTiming, aEvent, aNodeContext )
if( !aInteractiveAnimationSequenceMap[ nNodeId ] ) if( !aInteractiveAnimationSequenceMap[ nNodeId ] )
{ {
var aInteractiveAnimationSequence = new InteractiveAnimationSequence( nNodeId ); aInteractiveAnimationSequenceMap[ nNodeId ] = new InteractiveAnimationSequence(nNodeId);
aInteractiveAnimationSequenceMap[ nNodeId ] = aInteractiveAnimationSequence;
} }
var bEventRegistered = false; var bEventRegistered = false;
...@@ -10422,7 +10404,6 @@ HyperlinkElement.prototype.handleClick = function( aMouseEvent ) ...@@ -10422,7 +10404,6 @@ HyperlinkElement.prototype.handleClick = function( aMouseEvent )
} }
} }
return true; return true;
}; };
...@@ -10521,7 +10502,7 @@ function PriorityEntry( aValue, nPriority ) ...@@ -10521,7 +10502,7 @@ function PriorityEntry( aValue, nPriority )
* An instance of type PriorityEntry. * An instance of type PriorityEntry.
* @param aRhsEntry * @param aRhsEntry
* An instance of type PriorityEntry. * An instance of type PriorityEntry.
* @return {Integer} * @return Integer
* -1 if the left entry has lower priority of the right entry, * -1 if the left entry has lower priority of the right entry,
* 1 if the left entry has higher priority of the right entry, * 1 if the left entry has higher priority of the right entry,
* 0 if the two entry have the same priority * 0 if the two entry have the same priority
...@@ -10549,17 +10530,17 @@ function EventMultiplexer( aTimerEventQueue ) ...@@ -10549,17 +10530,17 @@ function EventMultiplexer( aTimerEventQueue )
{ {
this.nId = EventMultiplexer.getUniqueId(); this.nId = EventMultiplexer.getUniqueId();
this.aTimerEventQueue = aTimerEventQueue; this.aTimerEventQueue = aTimerEventQueue;
this.aEventMap = new Object(); this.aEventMap = {};
this.aSkipEffectEndHandlerSet = new Array(); this.aSkipEffectEndHandlerSet = [];
this.aMouseClickHandlerSet = new PriorityQueue( PriorityEntry.compare ); this.aMouseClickHandlerSet = new PriorityQueue( PriorityEntry.compare );
this.aSkipEffectEvent = null; this.aSkipEffectEvent = null;
this.aRewindCurrentEffectEvent = null; this.aRewindCurrentEffectEvent = null;
this.aRewindLastEffectEvent = null; this.aRewindLastEffectEvent = null;
this.aSkipInteractiveEffectEventSet = new Object(); this.aSkipInteractiveEffectEventSet = {};
this.aRewindRunningInteractiveEffectEventSet = new Object(); this.aRewindRunningInteractiveEffectEventSet = {};
this.aRewindEndedInteractiveEffectEventSet = new Object(); this.aRewindEndedInteractiveEffectEventSet = {};
this.aRewindedEffectHandlerSet = new Object(); this.aRewindedEffectHandlerSet = {};
this.aElementChangedHandlerSet = new Object(); this.aElementChangedHandlerSet = {};
} }
EventMultiplexer.CURR_UNIQUE_ID = 0; EventMultiplexer.CURR_UNIQUE_ID = 0;
...@@ -10573,12 +10554,12 @@ EventMultiplexer.getUniqueId = function() ...@@ -10573,12 +10554,12 @@ EventMultiplexer.getUniqueId = function()
EventMultiplexer.prototype.getId = function() EventMultiplexer.prototype.getId = function()
{ {
return this.nId; return this.nId;
} };
EventMultiplexer.prototype.hasRegisteredMouseClickHandlers = function() EventMultiplexer.prototype.hasRegisteredMouseClickHandlers = function()
{ {
return !this.aMouseClickHandlerSet.isEmpty(); return !this.aMouseClickHandlerSet.isEmpty();
} };
EventMultiplexer.prototype.registerMouseClickHandler = function( aHandler, nPriority ) EventMultiplexer.prototype.registerMouseClickHandler = function( aHandler, nPriority )
{ {
...@@ -10603,11 +10584,11 @@ EventMultiplexer.prototype.registerEvent = function( eEventType, aNotifierId, aE ...@@ -10603,11 +10584,11 @@ EventMultiplexer.prototype.registerEvent = function( eEventType, aNotifierId, aE
this.DBG( 'registerEvent', eEventType, aNotifierId ); this.DBG( 'registerEvent', eEventType, aNotifierId );
if( !this.aEventMap[ eEventType ] ) if( !this.aEventMap[ eEventType ] )
{ {
this.aEventMap[ eEventType ] = new Object(); this.aEventMap[ eEventType ] = {};
} }
if( !this.aEventMap[ eEventType ][ aNotifierId ] ) if( !this.aEventMap[ eEventType ][ aNotifierId ] )
{ {
this.aEventMap[ eEventType ][ aNotifierId ] = new Array(); this.aEventMap[ eEventType ][ aNotifierId ] = [];
} }
this.aEventMap[ eEventType ][ aNotifierId ].push( aEvent ); this.aEventMap[ eEventType ][ aNotifierId ].push( aEvent );
}; };
...@@ -10642,7 +10623,7 @@ EventMultiplexer.prototype.notifyNextEffectEndEvent = function() ...@@ -10642,7 +10623,7 @@ EventMultiplexer.prototype.notifyNextEffectEndEvent = function()
{ {
(this.aSkipEffectEndHandlerSet[i])(); (this.aSkipEffectEndHandlerSet[i])();
} }
this.aSkipEffectEndHandlerSet = new Array(); this.aSkipEffectEndHandlerSet = [];
}; };
EventMultiplexer.prototype.registerSkipEffectEvent = function( aEvent ) EventMultiplexer.prototype.registerSkipEffectEvent = function( aEvent )
...@@ -10742,7 +10723,7 @@ EventMultiplexer.prototype.notifyRewindedEffectEvent = function( aNotifierId ) ...@@ -10742,7 +10723,7 @@ EventMultiplexer.prototype.notifyRewindedEffectEvent = function( aNotifierId )
EventMultiplexer.prototype.registerElementChangedHandler = function( aNotifierId, aHandler ) EventMultiplexer.prototype.registerElementChangedHandler = function( aNotifierId, aHandler )
{ {
this.aElementChangedHandlerSet[ aNotifierId ] = aHandler; this.aElementChangedHandlerSet[ aNotifierId ] = aHandler;
} };
EventMultiplexer.prototype.notifyElementChangedEvent = function( aNotifierId, aElement ) EventMultiplexer.prototype.notifyElementChangedEvent = function( aNotifierId, aElement )
{ {
...@@ -10771,7 +10752,7 @@ EventMultiplexer.prototype.DBG = function( sMethodName, eEventType, aNotifierId, ...@@ -10771,7 +10752,7 @@ EventMultiplexer.prototype.DBG = function( sMethodName, eEventType, aNotifierId,
* Interpolator Handler and KeyStopLerp * Interpolator Handler and KeyStopLerp
**********************************************************************************************/ **********************************************************************************************/
var aInterpolatorHandler = new Object(); var aInterpolatorHandler = {};
aInterpolatorHandler.getInterpolator = function( eCalcMode, eValueType, eValueSubtype ) aInterpolatorHandler.getInterpolator = function( eCalcMode, eValueType, eValueSubtype )
{ {
...@@ -10793,9 +10774,9 @@ aInterpolatorHandler.getInterpolator = function( eCalcMode, eValueType, eValueSu ...@@ -10793,9 +10774,9 @@ aInterpolatorHandler.getInterpolator = function( eCalcMode, eValueType, eValueSu
} }
}; };
aInterpolatorHandler.aLerpFunctorMap = new Array(); aInterpolatorHandler.aLerpFunctorMap = [];
aInterpolatorHandler.aLerpFunctorMap[ CALC_MODE_DISCRETE ] = new Array(); aInterpolatorHandler.aLerpFunctorMap[ CALC_MODE_DISCRETE ] = [];
aInterpolatorHandler.aLerpFunctorMap[ CALC_MODE_LINEAR ] = new Array(); aInterpolatorHandler.aLerpFunctorMap[ CALC_MODE_LINEAR ] = [];
// interpolators for linear calculation // interpolators for linear calculation
...@@ -10806,7 +10787,7 @@ aInterpolatorHandler.aLerpFunctorMap[ CALC_MODE_LINEAR ][ NUMBER_PROPERTY ] = ...@@ -10806,7 +10787,7 @@ aInterpolatorHandler.aLerpFunctorMap[ CALC_MODE_LINEAR ][ NUMBER_PROPERTY ] =
return ( ( 1.0 - nT )* nFrom + nT * nTo ); return ( ( 1.0 - nT )* nFrom + nT * nTo );
}; };
aInterpolatorHandler.aLerpFunctorMap[ CALC_MODE_LINEAR ][ COLOR_PROPERTY ] = new Array(); aInterpolatorHandler.aLerpFunctorMap[ CALC_MODE_LINEAR ][ COLOR_PROPERTY ] = [];
aInterpolatorHandler.aLerpFunctorMap[ CALC_MODE_LINEAR ][ COLOR_PROPERTY ][ COLOR_SPACE_RGB ] = aInterpolatorHandler.aLerpFunctorMap[ CALC_MODE_LINEAR ][ COLOR_PROPERTY ][ COLOR_SPACE_RGB ] =
function ( nFrom, nTo, nT ) function ( nFrom, nTo, nT )
...@@ -10832,7 +10813,7 @@ function KeyStopLerp( aValueList ) ...@@ -10832,7 +10813,7 @@ function KeyStopLerp( aValueList )
{ {
KeyStopLerp.validateInput( aValueList ); KeyStopLerp.validateInput( aValueList );
this.aKeyStopList = new Array(); this.aKeyStopList = [];
this.nLastIndex = 0; this.nLastIndex = 0;
this.nKeyStopDistance = aValueList[1] - aValueList[0]; this.nKeyStopDistance = aValueList[1] - aValueList[0];
if( this.nKeyStopDistance <= 0 ) if( this.nKeyStopDistance <= 0 )
...@@ -10884,7 +10865,7 @@ KeyStopLerp.prototype.lerp = function( nAlpha ) ...@@ -10884,7 +10865,7 @@ KeyStopLerp.prototype.lerp = function( nAlpha )
nRawLerp = clamp( nRawLerp, 0.0, 1.0 ); nRawLerp = clamp( nRawLerp, 0.0, 1.0 );
var aResult = new Object(); var aResult = {};
aResult.nIndex = this.nLastIndex; aResult.nIndex = this.nLastIndex;
aResult.nLerp = nRawLerp; aResult.nLerp = nRawLerp;
...@@ -10913,7 +10894,7 @@ KeyStopLerp.prototype.lerp_ported = function( nAlpha ) ...@@ -10913,7 +10894,7 @@ KeyStopLerp.prototype.lerp_ported = function( nAlpha )
nRawLerp = clamp( nRawLerp, 0.0, 1.0 ); nRawLerp = clamp( nRawLerp, 0.0, 1.0 );
var aResult = new Object(); var aResult = {};
aResult.nIndex = this.nLastIndex; aResult.nIndex = this.nLastIndex;
aResult.nLerp = nRawLerp; aResult.nLerp = nRawLerp;
...@@ -10926,10 +10907,10 @@ KeyStopLerp.prototype.lerp_ported = function( nAlpha ) ...@@ -10926,10 +10907,10 @@ KeyStopLerp.prototype.lerp_ported = function( nAlpha )
* Operators * Operators
**********************************************************************************************/ **********************************************************************************************/
var aOperatorSetMap = new Array(); var aOperatorSetMap = [];
// number operators // number operators
aOperatorSetMap[ NUMBER_PROPERTY ] = new Object(); aOperatorSetMap[ NUMBER_PROPERTY ] = {};
aOperatorSetMap[ NUMBER_PROPERTY ].equal = function( a, b ) aOperatorSetMap[ NUMBER_PROPERTY ].equal = function( a, b )
{ {
...@@ -10947,7 +10928,7 @@ aOperatorSetMap[ NUMBER_PROPERTY ].scale = function( k, v ) ...@@ -10947,7 +10928,7 @@ aOperatorSetMap[ NUMBER_PROPERTY ].scale = function( k, v )
}; };
// color operators // color operators
aOperatorSetMap[ COLOR_PROPERTY ] = new Object(); aOperatorSetMap[ COLOR_PROPERTY ] = {};
aOperatorSetMap[ COLOR_PROPERTY ].equal = function( a, b ) aOperatorSetMap[ COLOR_PROPERTY ].equal = function( a, b )
{ {
...@@ -10988,7 +10969,7 @@ function ActivityParamSet() ...@@ -10988,7 +10969,7 @@ function ActivityParamSet()
this.nDecelerationFraction = 0.0; this.nDecelerationFraction = 0.0;
this.nSlideWidth = undefined; this.nSlideWidth = undefined;
this.nSlideHeight = undefined; this.nSlideHeight = undefined;
this.aDiscreteTimes = new Array(); this.aDiscreteTimes = [];
} }
...@@ -11259,10 +11240,7 @@ ActivityBase.prototype.getTargetElement = function() ...@@ -11259,10 +11240,7 @@ ActivityBase.prototype.getTargetElement = function()
ActivityBase.prototype.isRepeatCountValid = function() ActivityBase.prototype.isRepeatCountValid = function()
{ {
if( this.nRepeats ) return !!this.nRepeats; // first ! convert to bool
return true;
else
return false;
}; };
ActivityBase.prototype.getRepeatCount = function() ActivityBase.prototype.getRepeatCount = function()
...@@ -12062,7 +12040,7 @@ function createValueListActivity( aActivityParamSet, aAnimationNode, aAnimation, ...@@ -12062,7 +12040,7 @@ function createValueListActivity( aActivityParamSet, aAnimationNode, aAnimation,
var aValueSet = aAnimationNode.getValues(); var aValueSet = aAnimationNode.getValues();
var aValueList = new Array(); var aValueList = [];
extractAttributeValues( eValueType, extractAttributeValues( eValueType,
aValueList, aValueList,
...@@ -12091,7 +12069,7 @@ function createFromToByActivity( aActivityParamSet, aAnimationNode, aAnimation, ...@@ -12091,7 +12069,7 @@ function createFromToByActivity( aActivityParamSet, aAnimationNode, aAnimation,
var aOperatorSet = aOperatorSetMap[ eValueType ]; var aOperatorSet = aOperatorSetMap[ eValueType ];
assert( aOperatorSet, 'createFromToByActivity: no operator set found' ); assert( aOperatorSet, 'createFromToByActivity: no operator set found' );
var aValueSet = new Array(); var aValueSet = [];
aValueSet[0] = aAnimationNode.getFromValue(); aValueSet[0] = aAnimationNode.getFromValue();
aValueSet[1] = aAnimationNode.getToValue(); aValueSet[1] = aAnimationNode.getToValue();
aValueSet[2] = aAnimationNode.getByValue(); aValueSet[2] = aAnimationNode.getByValue();
...@@ -12101,7 +12079,7 @@ function createFromToByActivity( aActivityParamSet, aAnimationNode, aAnimation, ...@@ -12101,7 +12079,7 @@ function createFromToByActivity( aActivityParamSet, aAnimationNode, aAnimation,
', aTo = ' + aValueSet[1] + ', aTo = ' + aValueSet[1] +
', aBy = ' + aValueSet[2] ); ', aBy = ' + aValueSet[2] );
var aValueList = new Array(); var aValueList = [];
extractAttributeValues( eValueType, extractAttributeValues( eValueType,
aValueList, aValueList,
...@@ -12201,8 +12179,7 @@ function Effect( nId ) ...@@ -12201,8 +12179,7 @@ function Effect( nId )
{ {
this.nId = ( typeof( nId ) === typeof( 1 ) ) ? nId : -1; this.nId = ( typeof( nId ) === typeof( 1 ) ) ? nId : -1;
this.eState = Effect.NOT_STARTED; this.eState = Effect.NOT_STARTED;
}; }
Effect.NOT_STARTED = 0; Effect.NOT_STARTED = 0;
Effect.PLAYING = 1; Effect.PLAYING = 1;
Effect.ENDED = 2; Effect.ENDED = 2;
...@@ -12266,8 +12243,8 @@ function SlideShow() ...@@ -12266,8 +12243,8 @@ function SlideShow()
this.bIsSkipping = false; this.bIsSkipping = false;
this.bIsSkippingAll = false; this.bIsSkippingAll = false;
this.nTotalInteractivePlayingEffects = 0; this.nTotalInteractivePlayingEffects = 0;
this.aStartedEffectList = new Array(); this.aStartedEffectList = [];
this.aStartedEffectIndexMap = new Object(); this.aStartedEffectIndexMap = {};
this.aStartedEffectIndexMap[ -1 ] = undefined; this.aStartedEffectIndexMap[ -1 ] = undefined;
} }
...@@ -12398,8 +12375,8 @@ SlideShow.prototype.notifySlideStart = function( nNewSlideIndex, nOldSlideIndex ...@@ -12398,8 +12375,8 @@ SlideShow.prototype.notifySlideStart = function( nNewSlideIndex, nOldSlideIndex
this.bIsSkipping = false; this.bIsSkipping = false;
this.bIsSkippingAll = false; this.bIsSkippingAll = false;
this.nTotalInteractivePlayingEffects = 0; this.nTotalInteractivePlayingEffects = 0;
this.aStartedEffectList = new Array(); this.aStartedEffectList = [];
this.aStartedEffectIndexMap = new Object(); this.aStartedEffectIndexMap = {};
this.aStartedEffectIndexMap[ -1 ] = undefined; this.aStartedEffectIndexMap[ -1 ] = undefined;
var aAnimatedElementMap; var aAnimatedElementMap;
...@@ -12455,7 +12432,7 @@ SlideShow.prototype.notifyInteractiveAnimationSequenceStart = function( nNodeId ...@@ -12455,7 +12432,7 @@ SlideShow.prototype.notifyInteractiveAnimationSequenceStart = function( nNodeId
SlideShow.prototype.notifyInteractiveAnimationSequenceEnd = function( nNodeId ) SlideShow.prototype.notifyInteractiveAnimationSequenceEnd = function( nNodeId )
{ {
assert( this.isInteractiveEffectPlaying(), assert( this.isInteractiveEffectPlaying(),
'SlideShow.notifyInteractiveAnimationSequenceEnd: no interactive effect playing.' ) 'SlideShow.notifyInteractiveAnimationSequenceEnd: no interactive effect playing.' );
this.aStartedEffectList[ this.aStartedEffectIndexMap[ nNodeId ] ].end(); this.aStartedEffectList[ this.aStartedEffectIndexMap[ nNodeId ] ].end();
--this.nTotalInteractivePlayingEffects; --this.nTotalInteractivePlayingEffects;
...@@ -12985,7 +12962,7 @@ FrameSynchronization.prototype.deactivate = function() ...@@ -12985,7 +12962,7 @@ FrameSynchronization.prototype.deactivate = function()
function NextEffectEventArray() function NextEffectEventArray()
{ {
this.aEventArray = new Array(); this.aEventArray = [];
} }
...@@ -13017,7 +12994,7 @@ NextEffectEventArray.prototype.appendEvent = function( aEvent ) ...@@ -13017,7 +12994,7 @@ NextEffectEventArray.prototype.appendEvent = function( aEvent )
NextEffectEventArray.prototype.clear = function( ) NextEffectEventArray.prototype.clear = function( )
{ {
this.aEventArray = new Array(); this.aEventArray = [];
}; };
...@@ -13149,9 +13126,9 @@ EventEntry.compare = function( aLhsEventEntry, aRhsEventEntry ) ...@@ -13149,9 +13126,9 @@ EventEntry.compare = function( aLhsEventEntry, aRhsEventEntry )
function ActivityQueue( aTimer ) function ActivityQueue( aTimer )
{ {
this.aTimer = aTimer; this.aTimer = aTimer;
this.aCurrentActivityWaitingSet = new Array(); this.aCurrentActivityWaitingSet = [];
this.aCurrentActivityReinsertSet = new Array(); this.aCurrentActivityReinsertSet = [];
this.aDequeuedActivitySet = new Array(); this.aDequeuedActivitySet = [];
} }
...@@ -13214,7 +13191,7 @@ ActivityQueue.prototype.process = function() ...@@ -13214,7 +13191,7 @@ ActivityQueue.prototype.process = function()
{ {
// TODO: optimization, try to swap reference here // TODO: optimization, try to swap reference here
this.aCurrentActivityWaitingSet = this.aCurrentActivityReinsertSet; this.aCurrentActivityWaitingSet = this.aCurrentActivityReinsertSet;
this.aCurrentActivityReinsertSet = new Array(); this.aCurrentActivityReinsertSet = [];
} }
}; };
...@@ -13225,7 +13202,7 @@ ActivityQueue.prototype.processDequeued = function() ...@@ -13225,7 +13202,7 @@ ActivityQueue.prototype.processDequeued = function()
for( var i = 0; i < nSize; ++i ) for( var i = 0; i < nSize; ++i )
this.aDequeuedActivitySet[i].dequeued(); this.aDequeuedActivitySet[i].dequeued();
this.aDequeuedActivitySet = new Array(); this.aDequeuedActivitySet = [];
}; };
ActivityQueue.prototype.isEmpty = function() ActivityQueue.prototype.isEmpty = function()
...@@ -13241,12 +13218,12 @@ ActivityQueue.prototype.clear = function() ...@@ -13241,12 +13218,12 @@ ActivityQueue.prototype.clear = function()
var i; var i;
for( i = 0; i < nSize; ++i ) for( i = 0; i < nSize; ++i )
this.aCurrentActivityWaitingSet[i].dequeued(); this.aCurrentActivityWaitingSet[i].dequeued();
this.aCurrentActivityWaitingSet = new Array(); this.aCurrentActivityWaitingSet = [];
nSize = this.aCurrentActivityReinsertSet.length; nSize = this.aCurrentActivityReinsertSet.length;
for( i = 0; i < nSize; ++i ) for( i = 0; i < nSize; ++i )
this.aCurrentActivityReinsertSet[i].dequeued(); this.aCurrentActivityReinsertSet[i].dequeued();
this.aCurrentActivityReinsertSet = new Array(); this.aCurrentActivityReinsertSet = [];
}; };
ActivityQueue.prototype.endAll = function() ActivityQueue.prototype.endAll = function()
...@@ -13256,12 +13233,12 @@ ActivityQueue.prototype.endAll = function() ...@@ -13256,12 +13233,12 @@ ActivityQueue.prototype.endAll = function()
var i; var i;
for( i = 0; i < nSize; ++i ) for( i = 0; i < nSize; ++i )
this.aCurrentActivityWaitingSet[i].end(); this.aCurrentActivityWaitingSet[i].end();
this.aCurrentActivityWaitingSet = new Array(); this.aCurrentActivityWaitingSet = [];
nSize = this.aCurrentActivityReinsertSet.length; nSize = this.aCurrentActivityReinsertSet.length;
for( i = 0; i < nSize; ++i ) for( i = 0; i < nSize; ++i )
this.aCurrentActivityReinsertSet[i].end(); this.aCurrentActivityReinsertSet[i].end();
this.aCurrentActivityReinsertSet = new Array(); this.aCurrentActivityReinsertSet = [];
}; };
ActivityQueue.prototype.getTimer = function() ActivityQueue.prototype.getTimer = function()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment