The default bug view has changed. See this FAQ.

Add an about:config option for toggling SVG Animation (SMIL) support

RESOLVED FIXED

Status

()

Core
SVG
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: dholbert, Assigned: dholbert)

Tracking

({dev-doc-complete})

Trunk
dev-doc-complete
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(2 attachments, 1 obsolete attachment)

(Assignee)

Description

8 years ago
I'm filing this bug on adding an about:config flag to let users toggle SMIL support on/off.

(Then, we can hopefully default-disable SMIL via this about:config flag and turn on the "--enable-smil" build-time flag in nightly builds.  That would allow interested users to experiment with SMIL without needing to generate custom builds.)
(Assignee)

Updated

8 years ago
Summary: Add an about:config option for toggling SMIL support → Add an about:config option for toggling SVG Animation (SMIL) support
(Assignee)

Updated

8 years ago
Hardware: x86 → All

Comment 1

8 years ago
Might want to think about moving from --enable-smil to --disable-smil either as part of this patch or a follow-up.
(Assignee)

Comment 2

8 years ago
(In reply to comment #1)
> Might want to think about moving from --enable-smil to --disable-smil either as
> part of this patch or a follow-up.

I've posted a patch that does this in bug 473705.
(Assignee)

Comment 3

8 years ago
Created attachment 365395 [details] [diff] [review]
patch v1

Here's a simple WIP patch for this.  So far, it does the following:
 - Adds a pref called 'svg.smil.enabled', which defaults to false
 - When a Document is initialized, it takes a snapshot of this pref's current value
 - If this snapshotted value is false, the Document will refuse to create a nsSMILAnimationController (and will return 'null' to any GetAnimationController() calls)

This disables the main SMIL animation / sampling code (for any documents initialized while the pref is disabled).  It also disables all nsSMILValue-parsing code, because currently all nsSMILValue parsing is done at sample-time.

For thoroughness, we should probably disable initialization of nsSVGSVGElement::mTimedDocumentRoot, too, though I'm not yet sure of the best way to do that.  (I want to think a bit more about cases with dynamic SVG element creation / transfer between documents, particularly when one document is created while SMIL is on and the other is created when SMIL is off)
(Assignee)

Updated

8 years ago
Assignee: nobody → dholbert
(Assignee)

Updated

8 years ago
Status: NEW → ASSIGNED
(Assignee)

Comment 4

8 years ago
(In reply to comment #3)
> For thoroughness, we should probably disable initialization of
> nsSVGSVGElement::mTimedDocumentRoot, too, though I'm not yet sure of the best
> way to do that.

This is now taken care of via Bug 481562.

If SMIL is turned off via 'svg.smil.enabled' in patch v1 here, then nsDocument::GetAnimationController() will return null (via this bug's patch), and that'll make Bug 481562's patch disable initialization of mTimedDocumentRoot.  Yay!
(Assignee)

Updated

8 years ago
Attachment #365395 - Flags: superreview?(roc)
Attachment #365395 - Flags: review?(roc)
This stops animation from working but the DOM APIs are still present and detectable. That might be bad if people use them to do feature detection. Can we also dynamically disable creation of SMIL element types at least, like we do for SVG in general?
(Assignee)

Comment 6

8 years ago
Created attachment 366441 [details] [diff] [review]
patch v2

Ok, this new patch maintains a single global smil-enabled boolean (like we do with SVG enabled-ness).  This boolean controls...
   (a) whether we allow ourselves to create animation-related SVG nodes in nsSVGElementFactory.cpp
   (b) whether we return NS_ERROR_NOT_IMPLEMENTED in animation-related API functions on <svg> elements
   (c) whether we recognize "TimeControl" in nsGenericElement::InternalIsSupported()
   (d) whether we allow nsDocument to create an animation controller

Part (d) is basically the same as in my previous patch, but parts a/b/c are new and should block any feature detection when SMIL is disabled.
Attachment #365395 - Attachment is obsolete: true
Attachment #365395 - Flags: superreview?(roc)
Attachment #365395 - Flags: review?(roc)
(Assignee)

Comment 7

8 years ago
Created attachment 366444 [details] [diff] [review]
patch v2 (diff -w version)

Here's a version of patch v2 with whitespace-changes excluded. (since a number of the changes are simply adding "if (NS_SMILEnabled()) {" above a block of code)
Attachment #366444 - Flags: superreview?(roc)
Attachment #366444 - Flags: review?(roc)
(Assignee)

Comment 8

8 years ago
BTW, I've confirmed that we pass all SMIL reftests with this patch applied (and with the svg.smil.enabled pref turned on).
Attachment #366444 - Flags: superreview?(roc)
Attachment #366444 - Flags: superreview+
Attachment #366444 - Flags: review?(roc)
Attachment #366444 - Flags: review+
(Assignee)

Comment 9

8 years ago
Pushed attachment 366441 [details] [diff] [review]: http://hg.mozilla.org/mozilla-central/rev/ba3ad61aa365
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
(Assignee)

Updated

8 years ago
Blocks: 482402
Keywords: dev-doc-needed
This is mentioned in several places in the SVG documentation, as well as in this new article that's under construction:

https://developer.mozilla.org/en/SVG_animation_%28SMIL%29_in_Firefox
Keywords: dev-doc-needed → dev-doc-complete

Comment 11

8 years ago
We've just turned off support in 3.6 (bug 512594) Animation is now 1.9.3 only.
You need to log in before you can comment on or make changes to this bug.