summaryrefslogtreecommitdiff
path: root/filter/source/svg/presentation_engine.js
diff options
context:
space:
mode:
Diffstat (limited to 'filter/source/svg/presentation_engine.js')
-rw-r--r--filter/source/svg/presentation_engine.js293
1 files changed, 135 insertions, 158 deletions
diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js
index 600bc612d533..757f4e149dbb 100644
--- a/filter/source/svg/presentation_engine.js
+++ b/filter/source/svg/presentation_engine.js
@@ -75,25 +75,25 @@
* @param node element of the document
* @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'
*/
function getElementsByProperty( node, name )
{
- var elems = new Array();
+ var elements = [];
if( node.getAttribute( name ) )
- elems.push( node );
+ elements.push( node );
for( var counter = 0; counter < node.childNodes.length; ++counter )
{
if( node.childNodes[counter].nodeType == 1 )
{
- var subElems = getElementsByProperty( node.childNodes[counter], name );
- elems = elems.concat( subElems );
+ var subElements = getElementsByProperty( node.childNodes[counter], name );
+ elements = elements.concat( subElements );
}
}
- return elems;
+ return elements;
}
/** Event handler for key press.
@@ -141,14 +141,14 @@ function onKeyPress( aEvt )
/** Function to supply the default key code dictionary.
*
- * @returns default key code dictionary
+ * @returns Object default key code dictionary
*/
function getDefaultKeyCodeDictionary()
{
- var keyCodeDict = new Object();
+ var keyCodeDict = {};
- keyCodeDict[SLIDE_MODE] = new Object();
- keyCodeDict[INDEX_MODE] = new Object();
+ keyCodeDict[SLIDE_MODE] = {};
+ keyCodeDict[INDEX_MODE] = {};
// slide mode
keyCodeDict[SLIDE_MODE][LEFT_KEY]
@@ -199,14 +199,14 @@ function getDefaultKeyCodeDictionary()
/** Function to supply the default char code dictionary.
*
- * @returns default char code dictionary
+ * @returns Object char code dictionary
*/
function getDefaultCharCodeDictionary()
{
- var charCodeDict = new Object();
+ var charCodeDict = {};
- charCodeDict[SLIDE_MODE] = new Object();
- charCodeDict[INDEX_MODE] = new Object();
+ charCodeDict[SLIDE_MODE] = {};
+ charCodeDict[INDEX_MODE] = {};
// slide mode
charCodeDict[SLIDE_MODE]['i']
@@ -390,14 +390,14 @@ function mouseClickHelper( aEvt )
/** Function to supply the default mouse handler dictionary.
*
- * @returns default mouse handler dictionary
+ * @returns Object default mouse handler dictionary
*/
function getDefaultMouseHandlerDictionary()
{
- var mouseHandlerDict = new Object();
+ var mouseHandlerDict = {};
- mouseHandlerDict[SLIDE_MODE] = new Object();
- mouseHandlerDict[INDEX_MODE] = new Object();
+ mouseHandlerDict[SLIDE_MODE] = {};
+ mouseHandlerDict[INDEX_MODE] = {};
// slide mode
mouseHandlerDict[SLIDE_MODE][MOUSE_UP]
@@ -548,7 +548,7 @@ function configureDetectionTools()
dav = n.appVersion,
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('webkit', parseFloat(dua.split('WebKit/')[1]) || undefined);
has.add('chrome', parseFloat(dua.split('Chrome/')[1]) || undefined);
@@ -584,7 +584,7 @@ function configureDetectionTools()
//Make sure isIE reflects the desired version.
//document.documentMode of 5 means quirks mode.
//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;
if(mode && mode != 5 && Math.floor(isIE) != mode){
isIE = mode;
@@ -720,7 +720,7 @@ function configureDetectionTools()
* Several parts of the following code are the result of the porting,
* started on August 2011, of the C++ code included in the source
* 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.
* @source http://cgit.freedesktop.org/libreoffice/core/tree/slideshow/source
*
@@ -770,7 +770,7 @@ var aFooterClassName = 'Footer';
var aHeaderClassName = 'Header';
// Creating a namespace dictionary.
-var NSS = new Object();
+var NSS = {};
NSS['svg']='http://www.w3.org/2000/svg';
NSS['rdf']='http://www.w3.org/1999/02/22-rdf-syntax-ns#';
NSS['xlink']='http://www.w3.org/1999/xlink';
@@ -790,7 +790,7 @@ var MOUSE_DOWN = 2;
var MOUSE_MOVE = 3;
var MOUSE_WHEEL = 4;
-// Keycodes.
+// Key-codes.
var LEFT_KEY = 37; // cursor left keycode
var UP_KEY = 38; // cursor up keycode
var RIGHT_KEY = 39; // cursor right keycode
@@ -874,7 +874,7 @@ function extend( aSubType, aSuperType )
function instantiate( TemplateClass, BaseType )
{
if( !TemplateClass.instanceSet )
- TemplateClass.instanceSet = new Array();
+ TemplateClass.instanceSet = [];
var nSize = TemplateClass.instanceSet.length;
@@ -884,7 +884,7 @@ function instantiate( TemplateClass, BaseType )
return TemplateClass.instanceSet[i].instance;
}
- TemplateClass.instanceSet[ nSize ] = new Object();
+ TemplateClass.instanceSet[ nSize ] = {};
TemplateClass.instanceSet[ nSize ].base = BaseType;
TemplateClass.instanceSet[ nSize ].instance = TemplateClass( BaseType );
@@ -985,7 +985,7 @@ function checkElemAndSetAttribute( aElem, sAttrName, aValue )
function getElementsByClassName( aElem, sClassName )
{
- var aElementSet = new Array();
+ var aElementSet = [];
// not all browsers support the 'getElementsByClassName' method
if( 'getElementsByClassName' in aElem )
{
@@ -1215,16 +1215,16 @@ function MetaDocument()
// The collections for handling properties of each slide, svg elements
// related to master pages and content and properties of text fields.
- this.aMetaSlideSet = new Array();
- this.aMasterPageSet = new Object();
- this.aTextFieldHandlerSet = new Object();
- this.aTextFieldContentProviderSet = new Array();
+ this.aMetaSlideSet = [];
+ this.aMasterPageSet = {};
+ this.aTextFieldHandlerSet = {};
+ this.aTextFieldContentProviderSet = [];
this.aSlideNumberProvider = new SlideNumberProvider( this.nStartSlideNumber + 1, this.sPageNumberingType );
// We create a map with key an id and value the svg element containing
// the animations performed on the slide with such an id.
this.bIsAnimated = false;
- this.aSlideAnimationsMap = new Object();
+ this.aSlideAnimationsMap = {};
this.initSlideAnimationsMap();
// We initialize dummy slide - used as leaving slide for transition on the first slide
@@ -1386,7 +1386,7 @@ function MetaSlide( sMetaSlideId, aMetaDoc )
this.bIsDateTimeVariable = undefined;
// 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[aDateTimeClassName] = this.initDateTimeFieldContentProvider( aOOOAttrDateTimeField );
this.aTextFieldContentProviderSet[aFooterClassName] = this.initFixedTextFieldContentProvider( aOOOAttrFooterField );
@@ -1471,7 +1471,7 @@ initMasterPage : function()
// We initialize aTextFieldHandlerSet[ sMasterPageId ] to an empty
// collection.
- this.theMetaDoc.aTextFieldHandlerSet[ sMasterPageId ] = new Object();
+ this.theMetaDoc.aTextFieldHandlerSet[ sMasterPageId ] = {};
}
return this.theMetaDoc.aMasterPageSet[ sMasterPageId ];
},
@@ -1549,7 +1549,7 @@ initFixedTextFieldContentProvider : function( aOOOAttribute )
collectTextShapes : function()
{
- var aTextShapeSet = new Array();
+ var aTextShapeSet = [];
var aTextShapeIndexElem = getElementByClassName( document, 'TextShapeIndex' );
if( aTextShapeIndexElem )
{
@@ -1588,7 +1588,7 @@ collectTextShapes : function()
initHyperlinks : function()
{
- var aHyperlinkSet = new Object();
+ var aHyperlinkSet = {};
var i;
for( i = 0; i < this.aTextShapeSet.length; ++i )
{
@@ -1655,6 +1655,8 @@ getSlideAnimationsRoot : function()
* @param sMasterPageId
* A string representing the value of the id attribute of the master page
* element to be handled.
+ * @param aMetaSlide
+ * A meta slide having as master page the one with the passed id.
*/
function MasterPage( sMasterPageId, aMetaSlide )
{
@@ -1695,7 +1697,7 @@ function MasterPage( sMasterPageId, aMetaSlide )
var nSubGroupId = 1;
var sClass;
var sId = '';
- this.aBackgroundObjectSubGroupIdList = new Array();
+ this.aBackgroundObjectSubGroupIdList = [];
var i = 0;
for( ; i < aBackgroundObjectList.length; ++i )
{
@@ -1735,7 +1737,7 @@ function MasterPage( sMasterPageId, aMetaSlide )
}
// We populate the collection of placeholders.
- this.aPlaceholderShapeSet = new Object();
+ this.aPlaceholderShapeSet = {};
this.initPlaceholderShapes();
}
@@ -1978,7 +1980,7 @@ MasterPageView.prototype.createElement = function()
// clone and initialize text field elements
var aBackgroundObjectSubGroupIdList = this.aMasterPage.aBackgroundObjectSubGroupIdList;
- this.aBackgroundSubGroupElementSet = new Array();
+ this.aBackgroundSubGroupElementSet = [];
var aPlaceholderShapeSet = this.aMasterPage.aPlaceholderShapeSet;
var aTextFieldContentProviderSet = this.aMetaSlide.aTextFieldContentProviderSet;
// where cloned elements are appended
@@ -3069,17 +3071,6 @@ function bind2( aFunction )
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()
{
return ( new Date() ).getTime();
@@ -3096,11 +3087,12 @@ function getSlideAnimationsRoot( sSlideId )
*
* @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 )
{
- var aChildrenArray = new Array();
+ var aChildrenArray = [];
var nSize = aElement.childNodes.length;
@@ -3119,8 +3111,8 @@ function removeWhiteSpaces( str )
return '';
var re = / */;
- var aSplittedString = str.split( re );
- return aSplittedString.join('');
+ var aSplitString = str.split( re );
+ return aSplitString.join('');
}
function clamp( nValue, nMinimum, nMaximum )
@@ -3805,7 +3797,7 @@ function SVGPathMatrixTransform( aPath, aSVGMatrix )
function PriorityQueue( aCompareFunc )
{
- this.aSequence = new Array();
+ this.aSequence = [];
this.aCompareFunc = aCompareFunc;
}
@@ -3844,7 +3836,7 @@ PriorityQueue.prototype.push = function( aValue )
PriorityQueue.prototype.clear = function()
{
- this.aSequence = new Array();
+ this.aSequence = [];
};
PriorityQueue.prototype.pop = function()
@@ -4150,7 +4142,7 @@ PINWHEELWIPE_TRANSITION = 6; // 23
PUSHWIPE_TRANSITION = 7; // 35
SLIDEWIPE_TRANSITION = 8; // 36
FADE_TRANSITION = 9; // 37
-RANDOMBARWIPE_TRANSITION = 10 // 38
+RANDOMBARWIPE_TRANSITION = 10; // 38
CHECKERBOARDWIPE_TRANSITION = 11; // 39
DISSOLVE_TRANSITION = 12; // 40
@@ -4182,7 +4174,7 @@ CORNERSIN_TRANS_SUBTYPE = 3; // 11
CORNERSOUT_TRANS_SUBTYPE = 4;
VERTICAL_TRANS_SUBTYPE = 5;
HORIZONTAL_TRANS_SUBTYPE = 6; // 14
-DOWN_TRANS_SUBTYPE = 7 // 19
+DOWN_TRANS_SUBTYPE = 7; // 19
CIRCLE_TRANS_SUBTYPE = 8; // 27
CLOCKWISETWELVE_TRANS_SUBTYPE = 9; // 33
CLOCKWISETHREE_TRANS_SUBTYPE = 10;
@@ -4537,15 +4529,14 @@ aTransitionInfoTable[DISSOLVE_TRANSITION][DEFAULT_TRANS_SUBTYPE] =
function createStateTransitionTable()
{
- var aSTT = {}
- var aTable = null;
+ var aSTT = {};
aSTT[RESTART_MODE_NEVER] = {};
aSTT[RESTART_MODE_WHEN_NOT_ACTIVE] = {};
aSTT[RESTART_MODE_ALWAYS] = {};
// transition table for restart=NEVER, fill=REMOVE
- aTable =
+ var aTable =
aSTT[RESTART_MODE_NEVER][FILL_MODE_REMOVE] = {};
aTable[INVALID_NODE] = INVALID_NODE;
aTable[UNRESOLVED_NODE] = RESOLVED_NODE | ENDED_NODE;
@@ -4610,7 +4601,6 @@ function createStateTransitionTable()
aTable[FROZEN_NODE] = RESOLVED_NODE | ACTIVE_NODE | ENDED_NODE; // restart is possible
aTable[ENDED_NODE] = RESOLVED_NODE | ACTIVE_NODE | ENDED_NODE; // restart is possible
-
return aSTT;
}
@@ -4769,7 +4759,7 @@ Timing.prototype.parse = function()
}
else
{
- var aTimingSplit = new Array();
+ var aTimingSplit = [];
bPositiveOffset = true;
if( this.sTimingDescription.indexOf( '+' ) != -1 )
{
@@ -5138,7 +5128,7 @@ function BaseNode( aAnimElem, aParentNode, aNodeContext )
this.nStartDelay = aNodeContext.nStartDelay;
this.eCurrentState = UNRESOLVED_NODE;
this.nCurrentStateTransition = 0;
- this.aDeactivatingListenerArray = new Array();
+ this.aDeactivatingListenerArray = [];
this.aActivationEvent = null;
this.aDeactivationEvent = null;
@@ -5221,7 +5211,7 @@ BaseNode.prototype.parseElement = function()
this.nReapeatCount = 1;
else
this.nReapeatCount = parseFloat( sRepeatCount );
- if( ( this.nReapeatCount == NaN ) && ( sRepeatCount != 'indefinite' ) )
+ if( ( isNaN(this.nReapeatCount) ) && ( sRepeatCount != 'indefinite' ) )
this.nReapeatCount = 1;
// accelerate attribute
@@ -5229,7 +5219,7 @@ BaseNode.prototype.parseElement = function()
var sAccelerateAttr = aAnimElem.getAttributeNS( NSS['smil'], 'accelerate' );
if( sAccelerateAttr )
this.nAccelerate = parseFloat( sAccelerateAttr );
- if( this.nAccelerate == NaN )
+ if( isNaN(this.nAccelerate) )
this.nAccelerate = 0.0;
// decelerate attribute
@@ -5237,7 +5227,7 @@ BaseNode.prototype.parseElement = function()
var sDecelerateAttr = aAnimElem.getAttributeNS( NSS['smil'], 'decelerate' );
if( sDecelerateAttr )
this.nDecelerate = parseFloat( sDecelerateAttr );
- if( this.nDecelerate == NaN )
+ if( isNaN(this.nDecelerate) )
this.nDecelerate = 0.0;
// autoReverse attribute
@@ -5430,7 +5420,7 @@ BaseNode.prototype.dispose = function()
this.aActivationEvent.dispose();
if( this.aDeactivationEvent )
this.aDeactivationEvent.dispose();
- this.aDeactivatingListenerArray = new Array();
+ this.aDeactivatingListenerArray = [];
};
BaseNode.prototype.getState = function()
@@ -6025,7 +6015,7 @@ AnimationBaseNode3.prototype.parseElement = function()
this.aByValue = aAnimElem.getAttributeNS( NSS['smil'], 'by' );
// keyTimes attribute
- this.aKeyTimes = new Array();
+ this.aKeyTimes = [];
var sKeyTimesAttr = aAnimElem.getAttributeNS( NSS['smil'], 'keyTimes' );
sKeyTimesAttr = removeWhiteSpaces( sKeyTimesAttr );
if( sKeyTimesAttr )
@@ -6043,7 +6033,7 @@ AnimationBaseNode3.prototype.parseElement = function()
}
else
{
- this.aValues = new Array();
+ this.aValues = [];
}
return bRet;
@@ -6121,7 +6111,7 @@ function BaseContainerNode( aAnimElem, aParentNode, aNodeContext )
this.sClassName = 'BaseContainerNode';
this.bIsContainer = true;
- this.aChildrenArray = new Array();
+ this.aChildrenArray = [];
this.nFinishedChildren = 0;
this.bDurationIndefinite = false;
this.nLeftIterations = 1;
@@ -6343,7 +6333,7 @@ BaseContainerNode.prototype.saveStateOfAnimatedElement = function()
{
this.aChildrenArray[i].saveStateOfAnimatedElement();
}
-}
+};
BaseContainerNode.prototype.forEachChildNode = function( aFunction, eNodeStateMask )
{
@@ -7539,8 +7529,6 @@ function SlideChangeBase(aLeavingSlide, aEnteringSlide)
*/
SlideChangeBase.prototype.start = function()
{
- if( this.bIsFinished )
- return;
};
/** end
@@ -7851,7 +7839,7 @@ extend( ClippedSlideChange, SlideChangeBase );
ClippedSlideChange.prototype.start = function()
{
ClippedSlideChange.superclass.start.call( this );
- this.aEnteringSlide.notifyUsedAttribute( 'clip-path' );;
+ this.aEnteringSlide.notifyUsedAttribute( 'clip-path' );
this.performIn( 0 );
this.aEnteringSlide.show();
};
@@ -7932,7 +7920,7 @@ function ClippingFunctor( aParametricPolyPolygon, aTransitionInfo,
switch( aTransitionInfo.reverseMethod )
{
default:
- log( 'ClippingFunctor: unexpected reverse method.' )
+ log( 'ClippingFunctor: unexpected reverse method.' );
break;
case REVERSEMETHOD_IGNORE:
break;
@@ -7996,7 +7984,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.
* @param nHeight
* 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
* operation.
*/
@@ -8147,7 +8135,7 @@ function BarWipePath( nBars /* nBars > 1: blinds effect */ )
*
* @param nT
* A parameter in [0,1] representing the width of the generated bars.
- * @return {SVGPathElement}
+ * @return SVGPathElement
* A svg <path> element representing a multi-bars.
*/
BarWipePath.prototype.perform = function( nT )
@@ -8376,7 +8364,7 @@ function CheckerBoardWipePath( unitsPerEdge )
*
* @param nT
* A parameter in [0,1] representing the width of the generated bars.
- * @return {SVGPathElement}
+ * @return SVGPathElement
* A svg <path> element representing a multi-bars.
*/
CheckerBoardWipePath.prototype.perform = function( nT )
@@ -8431,28 +8419,28 @@ function RandomWipePath( nElements, bRandomBars )
this.aClipPath = createEmptyPath();
this.nAlreadyAppendedElements = 0;
+ var fEdgeLength, nPos, aTransform;
+
if( bRandomBars ) // random bar wipe
{
- var fEdgeLength = 1.0 / nElements;
- var nPos;
+ fEdgeLength = 1.0 / nElements;
for( nPos = 0; nPos < nElements; ++nPos )
{
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
{
var nSqrtElements = Math.round( Math.sqrt( nElements ) );
- var fEdgeLength = 1.0 / nSqrtElements;
- var nPos;
+ fEdgeLength = 1.0 / nSqrtElements;
for( nPos = 0; nPos < nElements; ++nPos )
{
this.aPositionArray[nPos] = {
x: pruneScaleValue( ( nPos % nSqrtElements ) * fEdgeLength ),
y: pruneScaleValue( ( nPos / nSqrtElements ) * fEdgeLength ) }
}
- var aTransform = SVGIdentityMatrix.scale( pruneScaleValue( fEdgeLength ) );
+ aTransform = SVGIdentityMatrix.scale( pruneScaleValue( fEdgeLength ) );
}
this.aBasePath.matrixTransform( aTransform );
@@ -8471,7 +8459,7 @@ function RandomWipePath( nElements, bRandomBars )
*
* @param nT
* 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.
*/
RandomWipePath.prototype.perform = function( nT )
@@ -8526,7 +8514,7 @@ function AnimatedSlide( aMetaSlide )
this.aSlideElement = this.aMetaSlide.slideElement;
this.sSlideId = this.aMetaSlide.slideId;
- this.aUsedAttributeSet = new Array();
+ this.aUsedAttributeSet = [];
this.aClipPathElement = null;
this.aClipPathContent = null;
@@ -8587,7 +8575,7 @@ AnimatedSlide.prototype.reset = function()
var sAttrName = this.aUsedAttributeSet[i];
this.aSlideElement.removeAttribute( sAttrName );
}
- this.aUsedAttributeSet = new Array();
+ this.aUsedAttributeSet = [];
};
/** initClipPath
@@ -8769,7 +8757,7 @@ function AnimatedElement( aElement )
this.aClipPathContent = null;
this.aPreviousElement = null;
- this.aStateSet = new Object();
+ this.aStateSet = {};
this.eAdditiveMode = ADDITIVE_MODE_REPLACE;
this.bIsUpdated = true;
@@ -8923,7 +8911,7 @@ AnimatedElement.prototype.saveState = function( nAnimationNodeId )
ANIMDBG.print( 'AnimatedElement(' + this.getId() + ').saveState(' + nAnimationNodeId +')' );
if( !this.aStateSet[ nAnimationNodeId ] )
{
- this.aStateSet[ nAnimationNodeId ] = new Object();
+ this.aStateSet[ nAnimationNodeId ] = {};
}
var aState = this.aStateSet[ nAnimationNodeId ];
aState.aElement = this.aActiveElement.cloneNode( true );
@@ -9399,12 +9387,12 @@ function AnimatedTextElement( aElement, aEventMultiplexer )
}
// In case there are embedded bitmaps we need to clone them
- var aBitmapElemSet = new Array();
- var aBitmapCloneSet = new Array();
+ var aBitmapElemSet = [];
+ var aBitmapCloneSet = [];
var aBitmapPlaceholderSet = getElementsByClassName( aElement, 'BitmapPlaceholder' );
+ var i;
if( aBitmapPlaceholderSet )
{
- var i;
for( i = 0; i < aBitmapPlaceholderSet.length; ++i )
{
sId = aBitmapPlaceholderSet[i].getAttribute( 'id' );
@@ -9485,11 +9473,10 @@ function AnimatedTextElement( aElement, aEventMultiplexer )
this.nRunningAnimations = 0;
// we collect all hyperlink ids
- this.aHyperlinkIdSet = new Array();
+ this.aHyperlinkIdSet = [];
var aHyperlinkElementSet = getElementsByClassName( this.aParagraphElement, 'UrlField' );
- var i = 0;
var sHyperlinkId;
- for( ; i < aHyperlinkElementSet.length; ++i )
+ for( i = 0; i < aHyperlinkElementSet.length; ++i )
{
sHyperlinkId = aHyperlinkElementSet[i].getAttribute( 'id' );
if( sHyperlinkId )
@@ -9498,7 +9485,6 @@ function AnimatedTextElement( aElement, aEventMultiplexer )
log( 'error: AnimatedTextElement constructor: hyperlink element has no id' );
}
-
AnimatedTextElement.superclass.constructor.call( this, aAnimatableElement, aEventMultiplexer );
}
@@ -9908,11 +9894,11 @@ SlideTransition.prototype.info = function()
function SlideAnimations( aSlideShowContext )
{
this.aContext = new NodeContext( aSlideShowContext );
- this.aAnimationNodeMap = new Object();
- this.aAnimatedElementMap = new Object();
- this.aSourceEventElementMap = new Object();
+ this.aAnimationNodeMap = {};
+ this.aAnimatedElementMap = {};
+ this.aSourceEventElementMap = {};
this.aNextEffectEventArray = new NextEffectEventArray();
- this.aInteractiveAnimationSequenceMap = new Object();
+ this.aInteractiveAnimationSequenceMap = {};
this.aEventMultiplexer = new EventMultiplexer( aSlideShowContext.aTimerEventQueue );
this.aRootNode = null;
this.bElementsParsed = false;
@@ -9990,10 +9976,7 @@ SlideAnimations.prototype.start = function()
return false;
// resolve root node
- if( !this.aRootNode.resolve() )
- return false;
-
- return true;
+ return this.aRootNode.resolve();
};
SlideAnimations.prototype.end = function( bLeftEffectsSkipped )
@@ -10187,8 +10170,7 @@ function registerEvent( nNodeId, aTiming, aEvent, aNodeContext )
if( !aInteractiveAnimationSequenceMap[ nNodeId ] )
{
- var aInteractiveAnimationSequence = new InteractiveAnimationSequence( nNodeId );
- aInteractiveAnimationSequenceMap[ nNodeId ] = aInteractiveAnimationSequence;
+ aInteractiveAnimationSequenceMap[ nNodeId ] = new InteractiveAnimationSequence(nNodeId);
}
var bEventRegistered = false;
@@ -10430,7 +10412,6 @@ HyperlinkElement.prototype.handleClick = function( aMouseEvent )
}
}
-
return true;
};
@@ -10529,7 +10510,7 @@ function PriorityEntry( aValue, nPriority )
* An instance of type PriorityEntry.
* @param aRhsEntry
* 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 higher priority of the right entry,
* 0 if the two entry have the same priority
@@ -10557,17 +10538,17 @@ function EventMultiplexer( aTimerEventQueue )
{
this.nId = EventMultiplexer.getUniqueId();
this.aTimerEventQueue = aTimerEventQueue;
- this.aEventMap = new Object();
- this.aSkipEffectEndHandlerSet = new Array();
+ this.aEventMap = {};
+ this.aSkipEffectEndHandlerSet = [];
this.aMouseClickHandlerSet = new PriorityQueue( PriorityEntry.compare );
this.aSkipEffectEvent = null;
this.aRewindCurrentEffectEvent = null;
this.aRewindLastEffectEvent = null;
- this.aSkipInteractiveEffectEventSet = new Object();
- this.aRewindRunningInteractiveEffectEventSet = new Object();
- this.aRewindEndedInteractiveEffectEventSet = new Object();
- this.aRewindedEffectHandlerSet = new Object();
- this.aElementChangedHandlerSet = new Object();
+ this.aSkipInteractiveEffectEventSet = {};
+ this.aRewindRunningInteractiveEffectEventSet = {};
+ this.aRewindEndedInteractiveEffectEventSet = {};
+ this.aRewindedEffectHandlerSet = {};
+ this.aElementChangedHandlerSet = {};
}
EventMultiplexer.CURR_UNIQUE_ID = 0;
@@ -10581,12 +10562,12 @@ EventMultiplexer.getUniqueId = function()
EventMultiplexer.prototype.getId = function()
{
return this.nId;
-}
+};
EventMultiplexer.prototype.hasRegisteredMouseClickHandlers = function()
{
return !this.aMouseClickHandlerSet.isEmpty();
-}
+};
EventMultiplexer.prototype.registerMouseClickHandler = function( aHandler, nPriority )
{
@@ -10611,11 +10592,11 @@ EventMultiplexer.prototype.registerEvent = function( eEventType, aNotifierId, aE
this.DBG( 'registerEvent', eEventType, aNotifierId );
if( !this.aEventMap[ eEventType ] )
{
- this.aEventMap[ eEventType ] = new Object();
+ this.aEventMap[ eEventType ] = {};
}
if( !this.aEventMap[ eEventType ][ aNotifierId ] )
{
- this.aEventMap[ eEventType ][ aNotifierId ] = new Array();
+ this.aEventMap[ eEventType ][ aNotifierId ] = [];
}
this.aEventMap[ eEventType ][ aNotifierId ].push( aEvent );
};
@@ -10650,7 +10631,7 @@ EventMultiplexer.prototype.notifyNextEffectEndEvent = function()
{
(this.aSkipEffectEndHandlerSet[i])();
}
- this.aSkipEffectEndHandlerSet = new Array();
+ this.aSkipEffectEndHandlerSet = [];
};
EventMultiplexer.prototype.registerSkipEffectEvent = function( aEvent )
@@ -10750,7 +10731,7 @@ EventMultiplexer.prototype.notifyRewindedEffectEvent = function( aNotifierId )
EventMultiplexer.prototype.registerElementChangedHandler = function( aNotifierId, aHandler )
{
this.aElementChangedHandlerSet[ aNotifierId ] = aHandler;
-}
+};
EventMultiplexer.prototype.notifyElementChangedEvent = function( aNotifierId, aElement )
{
@@ -10779,7 +10760,7 @@ EventMultiplexer.prototype.DBG = function( sMethodName, eEventType, aNotifierId,
* Interpolator Handler and KeyStopLerp
**********************************************************************************************/
-var aInterpolatorHandler = new Object();
+var aInterpolatorHandler = {};
aInterpolatorHandler.getInterpolator = function( eCalcMode, eValueType, eValueSubtype )
{
@@ -10801,9 +10782,9 @@ aInterpolatorHandler.getInterpolator = function( eCalcMode, eValueType, eValueSu
}
};
-aInterpolatorHandler.aLerpFunctorMap = new Array();
-aInterpolatorHandler.aLerpFunctorMap[ CALC_MODE_DISCRETE ] = new Array();
-aInterpolatorHandler.aLerpFunctorMap[ CALC_MODE_LINEAR ] = new Array();
+aInterpolatorHandler.aLerpFunctorMap = [];
+aInterpolatorHandler.aLerpFunctorMap[ CALC_MODE_DISCRETE ] = [];
+aInterpolatorHandler.aLerpFunctorMap[ CALC_MODE_LINEAR ] = [];
// interpolators for linear calculation
@@ -10814,7 +10795,7 @@ aInterpolatorHandler.aLerpFunctorMap[ CALC_MODE_LINEAR ][ NUMBER_PROPERTY ] =
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 ] =
function ( nFrom, nTo, nT )
@@ -10840,7 +10821,7 @@ function KeyStopLerp( aValueList )
{
KeyStopLerp.validateInput( aValueList );
- this.aKeyStopList = new Array();
+ this.aKeyStopList = [];
this.nLastIndex = 0;
this.nKeyStopDistance = aValueList[1] - aValueList[0];
if( this.nKeyStopDistance <= 0 )
@@ -10892,7 +10873,7 @@ KeyStopLerp.prototype.lerp = function( nAlpha )
nRawLerp = clamp( nRawLerp, 0.0, 1.0 );
- var aResult = new Object();
+ var aResult = {};
aResult.nIndex = this.nLastIndex;
aResult.nLerp = nRawLerp;
@@ -10921,7 +10902,7 @@ KeyStopLerp.prototype.lerp_ported = function( nAlpha )
nRawLerp = clamp( nRawLerp, 0.0, 1.0 );
- var aResult = new Object();
+ var aResult = {};
aResult.nIndex = this.nLastIndex;
aResult.nLerp = nRawLerp;
@@ -10934,10 +10915,10 @@ KeyStopLerp.prototype.lerp_ported = function( nAlpha )
* Operators
**********************************************************************************************/
-var aOperatorSetMap = new Array();
+var aOperatorSetMap = [];
// number operators
-aOperatorSetMap[ NUMBER_PROPERTY ] = new Object();
+aOperatorSetMap[ NUMBER_PROPERTY ] = {};
aOperatorSetMap[ NUMBER_PROPERTY ].equal = function( a, b )
{
@@ -10955,7 +10936,7 @@ aOperatorSetMap[ NUMBER_PROPERTY ].scale = function( k, v )
};
// color operators
-aOperatorSetMap[ COLOR_PROPERTY ] = new Object();
+aOperatorSetMap[ COLOR_PROPERTY ] = {};
aOperatorSetMap[ COLOR_PROPERTY ].equal = function( a, b )
{
@@ -10996,7 +10977,7 @@ function ActivityParamSet()
this.nDecelerationFraction = 0.0;
this.nSlideWidth = undefined;
this.nSlideHeight = undefined;
- this.aDiscreteTimes = new Array();
+ this.aDiscreteTimes = [];
}
@@ -11267,10 +11248,7 @@ ActivityBase.prototype.getTargetElement = function()
ActivityBase.prototype.isRepeatCountValid = function()
{
- if( this.nRepeats )
- return true;
- else
- return false;
+ return !!this.nRepeats; // first ! convert to bool
};
ActivityBase.prototype.getRepeatCount = function()
@@ -12070,7 +12048,7 @@ function createValueListActivity( aActivityParamSet, aAnimationNode, aAnimation,
var aValueSet = aAnimationNode.getValues();
- var aValueList = new Array();
+ var aValueList = [];
extractAttributeValues( eValueType,
aValueList,
@@ -12099,7 +12077,7 @@ function createFromToByActivity( aActivityParamSet, aAnimationNode, aAnimation,
var aOperatorSet = aOperatorSetMap[ eValueType ];
assert( aOperatorSet, 'createFromToByActivity: no operator set found' );
- var aValueSet = new Array();
+ var aValueSet = [];
aValueSet[0] = aAnimationNode.getFromValue();
aValueSet[1] = aAnimationNode.getToValue();
aValueSet[2] = aAnimationNode.getByValue();
@@ -12109,7 +12087,7 @@ function createFromToByActivity( aActivityParamSet, aAnimationNode, aAnimation,
', aTo = ' + aValueSet[1] +
', aBy = ' + aValueSet[2] );
- var aValueList = new Array();
+ var aValueList = [];
extractAttributeValues( eValueType,
aValueList,
@@ -12209,8 +12187,7 @@ function Effect( nId )
{
this.nId = ( typeof( nId ) === typeof( 1 ) ) ? nId : -1;
this.eState = Effect.NOT_STARTED;
-};
-
+}
Effect.NOT_STARTED = 0;
Effect.PLAYING = 1;
Effect.ENDED = 2;
@@ -12274,8 +12251,8 @@ function SlideShow()
this.bIsSkipping = false;
this.bIsSkippingAll = false;
this.nTotalInteractivePlayingEffects = 0;
- this.aStartedEffectList = new Array();
- this.aStartedEffectIndexMap = new Object();
+ this.aStartedEffectList = [];
+ this.aStartedEffectIndexMap = {};
this.aStartedEffectIndexMap[ -1 ] = undefined;
}
@@ -12406,8 +12383,8 @@ SlideShow.prototype.notifySlideStart = function( nNewSlideIndex, nOldSlideIndex
this.bIsSkipping = false;
this.bIsSkippingAll = false;
this.nTotalInteractivePlayingEffects = 0;
- this.aStartedEffectList = new Array();
- this.aStartedEffectIndexMap = new Object();
+ this.aStartedEffectList = [];
+ this.aStartedEffectIndexMap = {};
this.aStartedEffectIndexMap[ -1 ] = undefined;
var aAnimatedElementMap;
@@ -12463,7 +12440,7 @@ SlideShow.prototype.notifyInteractiveAnimationSequenceStart = function( nNodeId
SlideShow.prototype.notifyInteractiveAnimationSequenceEnd = function( nNodeId )
{
assert( this.isInteractiveEffectPlaying(),
- 'SlideShow.notifyInteractiveAnimationSequenceEnd: no interactive effect playing.' )
+ 'SlideShow.notifyInteractiveAnimationSequenceEnd: no interactive effect playing.' );
this.aStartedEffectList[ this.aStartedEffectIndexMap[ nNodeId ] ].end();
--this.nTotalInteractivePlayingEffects;
@@ -12993,7 +12970,7 @@ FrameSynchronization.prototype.deactivate = function()
function NextEffectEventArray()
{
- this.aEventArray = new Array();
+ this.aEventArray = [];
}
@@ -13025,7 +13002,7 @@ NextEffectEventArray.prototype.appendEvent = function( aEvent )
NextEffectEventArray.prototype.clear = function( )
{
- this.aEventArray = new Array();
+ this.aEventArray = [];
};
@@ -13157,9 +13134,9 @@ EventEntry.compare = function( aLhsEventEntry, aRhsEventEntry )
function ActivityQueue( aTimer )
{
this.aTimer = aTimer;
- this.aCurrentActivityWaitingSet = new Array();
- this.aCurrentActivityReinsertSet = new Array();
- this.aDequeuedActivitySet = new Array();
+ this.aCurrentActivityWaitingSet = [];
+ this.aCurrentActivityReinsertSet = [];
+ this.aDequeuedActivitySet = [];
}
@@ -13222,7 +13199,7 @@ ActivityQueue.prototype.process = function()
{
// TODO: optimization, try to swap reference here
this.aCurrentActivityWaitingSet = this.aCurrentActivityReinsertSet;
- this.aCurrentActivityReinsertSet = new Array();
+ this.aCurrentActivityReinsertSet = [];
}
};
@@ -13233,7 +13210,7 @@ ActivityQueue.prototype.processDequeued = function()
for( var i = 0; i < nSize; ++i )
this.aDequeuedActivitySet[i].dequeued();
- this.aDequeuedActivitySet = new Array();
+ this.aDequeuedActivitySet = [];
};
ActivityQueue.prototype.isEmpty = function()
@@ -13249,12 +13226,12 @@ ActivityQueue.prototype.clear = function()
var i;
for( i = 0; i < nSize; ++i )
this.aCurrentActivityWaitingSet[i].dequeued();
- this.aCurrentActivityWaitingSet = new Array();
+ this.aCurrentActivityWaitingSet = [];
nSize = this.aCurrentActivityReinsertSet.length;
for( i = 0; i < nSize; ++i )
this.aCurrentActivityReinsertSet[i].dequeued();
- this.aCurrentActivityReinsertSet = new Array();
+ this.aCurrentActivityReinsertSet = [];
};
ActivityQueue.prototype.endAll = function()
@@ -13264,12 +13241,12 @@ ActivityQueue.prototype.endAll = function()
var i;
for( i = 0; i < nSize; ++i )
this.aCurrentActivityWaitingSet[i].end();
- this.aCurrentActivityWaitingSet = new Array();
+ this.aCurrentActivityWaitingSet = [];
nSize = this.aCurrentActivityReinsertSet.length;
for( i = 0; i < nSize; ++i )
this.aCurrentActivityReinsertSet[i].end();
- this.aCurrentActivityReinsertSet = new Array();
+ this.aCurrentActivityReinsertSet = [];
};
ActivityQueue.prototype.getTimer = function()