summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2016-01-27 23:32:05 +0100
committerMarco Cecchetti <marco.cecchetti@collabora.com>2016-01-28 00:12:39 +0100
commit840ad19b6409070bfb27b7644cec7cae86aa5d3c (patch)
treeffabefa323e91bc474e21a4e94530910b5e4f44f /filter
parent1a83c2259498b070c8d38beb44017f319cbdbee4 (diff)
svg export - skip/rewind slide transition
The following actions messed up the animation engine if they were performed while a slide transition was running: - rewind/skip currect playing effect (Left/Right key) - rewind last/skip next effect (Up/Down key) - rewind/skip all effect (PgUp/PgDown key) - jump to first/last slide (Home/End key) Now: - Left/Up/PgUp key: rewind slide transition - Right/Down key: skip slide transition - PgDown key: skip slide transition and all new slide effects - Home key: skip slide transition and jump to first slide - End key: skip slide transition and jump to last slide Moreover the parsing of transition node properties missed to report some type of not supported transitions which caused the animation engine to hung. Change-Id: I7018b8e8fb3041a95cc80e250431b6544c875e98
Diffstat (limited to 'filter')
-rw-r--r--filter/source/svg/presentation_engine.js86
1 files changed, 85 insertions, 1 deletions
diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js
index d2afe9c5794e..4432ddf8de85 100644
--- a/filter/source/svg/presentation_engine.js
+++ b/filter/source/svg/presentation_engine.js
@@ -9740,6 +9740,7 @@ SlideTransition.prototype.createSlideTransition = function( aLeavingSlide, aEnte
SlideTransition.prototype.parseElement = function()
{
+ this.bIsValid = true;
var aAnimElem = this.aElement;
// type attribute
@@ -9751,6 +9752,7 @@ SlideTransition.prototype.parseElement = function()
}
else
{
+ this.bIsValid = false;
log( 'SlideTransition.parseElement: transition type not valid: ' + sTypeAttr );
}
@@ -9762,13 +9764,19 @@ SlideTransition.prototype.parseElement = function()
if( sSubTypeAttr && ( aTransitionSubtypeInMap[ sSubTypeAttr ] !== undefined ) )
{
this.eTransitionSubType = aTransitionSubtypeInMap[ sSubTypeAttr ];
- this.bIsValid = true;
}
else
{
+ this.bIsValid = false;
log( 'SlideTransition.parseElement: transition subtype not valid: ' + sSubTypeAttr );
}
+ if( this.bIsValid && aTransitionInfoTable[this.eTransitionType][this.eTransitionSubType] === undefined )
+ {
+ this.bIsValid = false;
+ log( 'SlideTransition.parseElement: transition not valid: type: ' + sTypeAttr + ' subtype: ' + sSubTypeAttr );
+ }
+
// direction attribute
this.bReverseDirection = false;
var sDirectionAttr = aAnimElem.getAttributeNS( NSS['smil'], 'direction' );
@@ -12271,6 +12279,7 @@ function SlideShow()
this.bIsIdle = true;
this.bIsEnabled = true;
this.bNoSlideTransition = false;
+ this.bIsTransitionRunning = false;
this.nCurrentEffect = 0;
this.bIsNextEffectRunning = false;
@@ -12357,6 +12366,11 @@ SlideShow.prototype.isRunning = function()
return !this.bIsIdle;
};
+SlideShow.prototype.isTransitionPlaying = function()
+{
+ return this.bIsTransitionRunning;
+};
+
SlideShow.prototype.isMainEffectPlaying = function()
{
return this.bIsNextEffectRunning;
@@ -12438,6 +12452,17 @@ SlideShow.prototype.notifyTransitionEnd = function( nSlideIndex )
theMetaDoc.getCurrentSlide().slideElement.setAttribute('clip-path', sRef);
}
+ this.bIsTransitionRunning = false;
+ if( this.bIsRewinding )
+ {
+ theMetaDoc.aMetaSlideSet[nSlideIndex].hide();
+ var nIndex = nCurSlide !== undefined ? nCurSlide : -1;
+ this.displaySlide( nIndex, true );
+ this.skipAllEffects();
+ this.bIsRewinding = false;
+ return;
+ }
+
theMetaDoc.setCurrentSlide(nSlideIndex);
if( this.aSlideViewElement )
@@ -12486,6 +12511,12 @@ SlideShow.prototype.nextEffect = function()
if( !this.isEnabled() )
return false;
+ if( this.isTransitionPlaying() )
+ {
+ this.skipTransition();
+ return true;
+ }
+
if( this.isAnyEffectPlaying() )
{
this.skipAllPlayingEffects();
@@ -12506,6 +12537,23 @@ SlideShow.prototype.nextEffect = function()
return true;
};
+/** skipTransition
+ * Skip the current playing slide transition.
+ */
+SlideShow.prototype.skipTransition = function()
+{
+ if( this.bIsSkipping || this.bIsRewinding )
+ return;
+
+ this.bIsSkipping = true;
+
+ this.aActivityQueue.endAll();
+ this.aTimerEventQueue.forceEmpty();
+ this.aActivityQueue.endAll();
+ this.update();
+ this.bIsSkipping = false;
+};
+
/** skipAllPlayingEffects
* Skip all playing effect, independently to which animation sequence they
* belong.
@@ -12576,6 +12624,12 @@ SlideShow.prototype.skipNextEffect = function()
*/
SlideShow.prototype.skipPlayingOrNextEffect = function()
{
+ if( this.isTransitionPlaying() )
+ {
+ this.skipTransition();
+ return true;
+ }
+
if( this.isAnyEffectPlaying() )
return this.skipAllPlayingEffects();
else
@@ -12598,6 +12652,11 @@ SlideShow.prototype.skipAllEffects = function()
this.bIsSkippingAll = true;
+ if( this.isTransitionPlaying() )
+ {
+ this.skipTransition();
+ }
+
if( this.isAnyEffectPlaying() )
{
this.skipAllPlayingEffects();
@@ -12623,6 +12682,20 @@ SlideShow.prototype.skipAllEffects = function()
return true;
};
+/** rewindTransition
+ * Rewind the current playing slide transition.
+ */
+SlideShow.prototype.rewindTransition = function()
+{
+ if( this.bIsSkipping || this.bIsRewinding )
+ return;
+
+ this.bIsRewinding = true;
+ this.aActivityQueue.endAll();
+ this.update();
+ this.bIsRewinding = false;
+};
+
/** rewindEffect
* Rewind all the effects started after at least one of the current playing
* effects. If there is no playing effect, it rewinds the last played one,
@@ -12732,6 +12805,11 @@ SlideShow.prototype.rewindEffect = function()
*/
SlideShow.prototype.rewindToPreviousSlide = function()
{
+ if( this.isTransitionPlaying() )
+ {
+ this.rewindTransition();
+ return;
+ }
if( this.isAnyEffectPlaying() )
return;
var nNewSlide = nCurSlide - 1;
@@ -12772,6 +12850,11 @@ SlideShow.prototype.displaySlide = function( nNewSlide, bSkipSlideTransition )
return;
}
+ if( this.isTransitionPlaying() )
+ {
+ this.skipTransition();
+ }
+
// handle current slide
var nOldSlide = nCurSlide;
if( nOldSlide !== undefined )
@@ -12842,6 +12925,7 @@ SlideShow.prototype.displaySlide = function( nNewSlide, bSkipSlideTransition )
if( aTransitionActivity )
{
+ this.bIsTransitionRunning = true;
this.aActivityQueue.addActivity( aTransitionActivity );
this.update();
}