Commit Graph

278 Commits

Author SHA1 Message Date
Brian Birtles
ebedef2a25 Bug 849593 - Skip samples of active SMIL timed elements when the sample time precedes the current interval; r=dholbert
In some circumstances it is possible to sample a timed element in the active
state with a time that precedes is current interval.

One possible sequence of steps leading to this situation is as follows:

1. A timed element (e.g. <set>, <animate>) with a non-zero begin time is the
   child of <svg> element A (its "time container") but has yet to be sampled.

2. In order to resolve its initial interval, the timed element registers a
   startup milestone with its time container at time 0.

3. However, before the sample is performed where the timed element's initial
   current interval is resolved, <svg> element A is detached from the document
   tree.

4. The timed element is then attached to a different <svg> element B that has
   a current time greater than the begin time of the timed element and less than
   that of <svg> element A.

5. Since the timed element is still in its startup state it registers its
   startup milestone again, this time with its new time container, i.e. <svg>
   element B.

6. A tick occurs or the document has its style flushed such that a sample is
   performed.

   This includes running the milestone sample which causes the timed element to
   resolve its initial current interval. Furthermore the subsequent regular
   sample of the timed element causes it to transition into its active state
   because the current time of <svg> element B is greater than the begin time of
   the timed element.

7. <svg> element A is re-attached to the document.

8. When we go to run the next sample, we iterate through all time containers
   associated with the document's animation controller which includes both <svg>
   element A, and <svg> element B.

9. <svg> element A renders up its 0 milestone from step (2) since it has yet to
   run it. It converts this to parent time, i.e. the time space of the animation
   controller, which will be zero or less depending on the current time of <svg>
   element A when it was re-attached.

10. Since the milestone from <svg> element A will be the earliest milestone
    time, it will be used as the next milestone sample time.

11. The timed element is then sampled using this time, but first it is converted
    to a time in the time space of the timed element's time container, which is
    now <svg> element B.

    As a result of this conversion, the sample time may end up being *before*
    the beginning of the timed element's current interval. Since timed elements
    never expect the time to go backwards an assertion fails when it detects
    that it is active, but is being sampled before its current interval.

For this particular case, ignoring the "early" sample seems to be the most
appropriate action.

More generally, however, we can anticipate other cases similar to this where
milestones are registered that cause the sample time to temporarily go
backwards. A quick audit of nsSMILTimedElement::DoSampleAt suggests that, with
the code changes from this patch, that is probably ok.

As an alternative we could, perhaps, try to drop and re-create all milestones
when time containers are re-attached to the document tree but that would add
more complexity and would not necessarily cover other similar cases of this
situation.

I have verified that the crashtest included in this changeset fails without the
code changes also in this changeset.

MozReview-Commit-ID: KKGYRayNkpo

--HG--
extra : rebase_source : 832d4b357a2a2fe07abf9eab3a6046599aff3ef5
2017-10-24 13:06:04 +09:00
Robert Longson
71d7fc5d25 Bug 1322849 - Add a range check when the duration is multiplied by the repeat count. r=birtles 2017-10-17 22:19:54 +01:00
Nathan Froyd
c322875b57 Bug 1406441 - provide nsSMILCompositor with a move constructor, rather than a copy constructor; r=dholbert
Using a copy constructor here means that reallocating hashtables
containing nsSMILCompositor does a bunch of unnecessary work; we can use
a move constructor to avoid a lot of that unnecessary work.
2017-10-09 10:39:38 -04:00
Nathan Froyd
3e4ac652e8 Bug 1406440 - don't inline nsSMILNullType::Singleton(); r=dholbert
Defining Singleton() in the declaration of nsSMILNullType implicitly
sticks an "inline" on the function, which is not what we want: inlining
it spreads around a lot of static initialization code.  Providing an
out-of-line definition is much better in terms of code size.
2017-10-09 10:39:38 -04:00
Nicholas Nethercote
d225f7151b Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro.
(Path is actually r=froydnj.)

Bug 1400459 devirtualized nsIAtom so that it is no longer a subclass of
nsISupports. This means that nsAtom is now a better name for it than nsIAtom.

MozReview-Commit-ID: 91U22X2NydP

--HG--
rename : xpcom/ds/nsIAtom.h => xpcom/ds/nsAtom.h
extra : rebase_source : ac3e904a21b8b48e74534fff964f1623ee937c67
2017-10-03 09:05:19 +11:00
Sebastian Hengst
fd1c572923 merge mozilla-central to mozilla-inbound. r=merge a=merge on a CLOSED TREE 2017-10-05 11:47:25 +02:00
Jonathan Watt
3251040469 Bug 1403500, part 5 - Document and do some renaming for nsSMILTimeValueSpec's TimeReferenceElement. r=longsonr
MozReview-Commit-ID: AWIAeHy4DTI
2017-09-13 08:22:55 +01:00
Brian Birtles
e0a0a47d5c Bug 1402547 - Add crashtest for multiple empty SMIL values; r=hiro
I have verified that this fails without the code changes from the previous patch
in this series, and passes with them.

MozReview-Commit-ID: 1respvNVQaC

--HG--
extra : rebase_source : 82007792f23465edb1d286b721edeea850e2aaa3
2017-10-02 14:04:24 +09:00
Brian Birtles
8f3566ea35 Bug 1402547 - Handle addition/interpolate of nsSMILCSSValueType objects when both objects are empty; r=hiro
In some rare cases we can end up with both arguments passed to
nsSMILCSSValueType::SandwichAdd being "empty", that is, having the type
nsSMILCSSValueType but a null pointer.

This can happen, for example, when we have a two by-animations and linear
interpolation causing us to pass the "empty" from-value up as the underlying
value from the first by-animation to the second by-animation (which it will try
to add with its empty from-value).

In this case the result of adding "empty" to "empty" should just be "empty"
which we achieve by just doing an early return (since the fallback behavior for
failed addition is to just use the second argument as the result; note that if
we return true though the result would also be the same).

We don't currently have a test case that produces this for interpolate but it
makes sense that trying to interpolate "empty" to "empty" should likewise fail
and just produce "empty". In this case failing will make us fall back to
discrete animation and just use the "empty" values as-is. Indicating failure,
however, has the additional effect of making us use the special keyTimes
behavior defined for discrete animation.

MozReview-Commit-ID: IZ5qg0Mk5Uy

--HG--
extra : rebase_source : 402e881cd8639885568e0a32fb49aa4dfa7cbbde
2017-10-02 14:03:53 +09:00
Brian Birtles
ab450ccdb9 Bug 1404803 - Convert empty values to suitable zero values even when using discrete interpolation; r=hiro
Normally when we interpolate values for CSS properties we convert empty values
(such as the empty "from" value created for a by-animation) to a suitable zero
value. However, when we use discrete interpolation that step never occurs and in
some rare cases that means we end up setting the empty value on the target
attribute directly which will have an incorrect result (e.g. setting "" for the
height property will have no effect, whereas setting "0px" will).

This patch makes us perform the empty value to zero value conversion when
performing discrete animation.

Unfortunately it is not possible to test this behavior with shorthands since
there are currently no shorthand properties that are additive.

MozReview-Commit-ID: JFT1tis1RAR

--HG--
extra : rebase_source : cc444b6d4d5571c8ab231d88c4d349ea0713baaa
2017-10-04 15:04:23 +09:00
Wes Kocher
61c098eae7 Merge inbound to m-c a=merge CLOSED TREE
MozReview-Commit-ID: 3pMHYV9oXLm

--HG--
rename : dom/base/nsReferencedElement.cpp => dom/base/IDTracker.cpp
rename : dom/base/nsReferencedElement.h => dom/base/IDTracker.h
2017-09-27 16:51:49 -07:00
Jonathan Watt
862c8e7e8d Bug 1403345, part 4 - Rename nsReferencedElement to dom::IDTracker. r=longsonr
MozReview-Commit-ID: 3cGMHDHEhx0
2017-09-08 10:02:05 +01:00
Jonathan Watt
0d623a1609 Bug 1403345, part 3 - Move nsReferencedElement.h/.cpp to IDTracker.h/.cpp. r=longsonr
MozReview-Commit-ID: Ki6oS79xuhJ

--HG--
rename : dom/base/nsReferencedElement.cpp => dom/base/IDTracker.cpp
rename : dom/base/nsReferencedElement.h => dom/base/IDTracker.h
2017-09-08 10:02:05 +01:00
Sebastian Hengst
cdcf3bf44b Backed out changeset 59252e3229f1 (bug 1403345)
--HG--
rename : dom/base/IDTracker.cpp => dom/base/nsReferencedElement.cpp
rename : dom/base/IDTracker.h => dom/base/nsReferencedElement.h
2017-09-27 10:43:54 +02:00
Sebastian Hengst
ec33e563cc Backed out changeset 1b5d3684ecfb (bug 1403345) 2017-09-27 10:43:49 +02:00
Jonathan Watt
3c6336aaca Bug 1403345, part 3 - Rename nsReferencedElement to dom::IDTracker. r=longsonr
MozReview-Commit-ID: AkNuXab6xQr
2017-09-05 11:17:50 +01:00
Jonathan Watt
462030153c Bug 1403345, part 2 - Move nsReferencedElement.h/.cpp to IDTracker.h/.cpp. r=longsonr
MozReview-Commit-ID: 7yiAaKnXhCq

--HG--
rename : dom/base/nsReferencedElement.cpp => dom/base/IDTracker.cpp
rename : dom/base/nsReferencedElement.h => dom/base/IDTracker.h
2017-09-05 10:45:18 +01:00
Nicholas Nethercote
dfd3b7e7aa Bug 1400459 (part 2) - Devirtualize nsIAtom. r=heycam.
This patch merges nsAtom into nsIAtom. For the moment, both names can be used
interchangeably due to a typedef. The patch also devirtualizes nsIAtom, by
making it not inherit from nsISupports, removing NS_DECL_NSIATOM, and dropping
the use of NS_IMETHOD_. It also removes nsIAtom's IIDs.

These changes trigger knock-on changes throughout the codebase, changing the
types of lots of things as follows.

- nsCOMPtr<nsIAtom> --> RefPtr<nsIAtom>

- nsCOMArray<nsIAtom> --> nsTArray<RefPtr<nsIAtom>>
  - Count() --> Length()
  - ObjectAt() --> ElementAt()
  - AppendObject() --> AppendElement()
  - RemoveObjectAt() --> RemoveElementAt()

- ns*Hashtable<nsISupportsHashKey, ...> -->
  ns*Hashtable<nsRefPtrHashKey<nsIAtom>, ...>

- nsInterfaceHashtable<T, nsIAtom> --> nsRefPtrHashtable<T, nsIAtom>
  - This requires adding a Get() method to nsRefPtrHashtable that it lacks but
    nsInterfaceHashtable has.

- nsCOMPtr<nsIMutableArray> --> nsTArray<RefPtr<nsIAtom>>
  - nsArrayBase::Create() --> nsTArray()
  - GetLength() --> Length()
  - do_QueryElementAt() --> operator[]

The patch also has some changes to Rust code that manipulates nsIAtom.

MozReview-Commit-ID: DykOl8aEnUJ

--HG--
extra : rebase_source : 254404e318e94b4c93ec8d4081ff0f0fda8aa7d1
2017-09-26 08:33:21 +10:00
Andrew Halberstadt
7527e600f0 Bug 1392787 - Disable manifestparser tests using 'disabled' key instead of comment, r=jmaher
MozReview-Commit-ID: IQL7hWxQX9F

--HG--
extra : rebase_source : b78cbf7913fc1b0a27dfa085c38957e2bc2467d0
2017-08-22 16:56:02 -04:00
Brian Birtles
4237554d55 Bug 1357296 - Drop warning about needing to factor out text-zoom in SMIL; r=hiro
I'm not sure exactly how this works, but test_smilTextZoom.xhtml passes so this
appears to be taken care of.

MozReview-Commit-ID: C04XjX2rtZw

--HG--
extra : rebase_source : 19c08a1267f8764f83e9e7b31731bb82e52df9e6
2017-09-07 15:50:21 +09:00
Mantaroh Yoshinaga
9124cb5ce3 Bug 1390367 - Pass SMIL mochitests of stroke-* even if a computed value has no px unit. r=birtles
Currently, Gecko converts lengths in stroke-* properties to numbers when
creating animation values and hence the result of animation is always a unitless
value for these properties.

Servo, on the other hand, converts lengths for these properties to numbers
during interpolation and hence sometimes the result of animation is a unitless
value, and other times (such as when skipping interpolation) it is not.

Other browsers produce lengths with px units and ultimately we should align
with that behavior. As a result, this patch updates various SMIL mochitests to:

 * Expect animation values with px unit
 * Compare values by stripping px units as a temporary measure until we
   correctly serialize these values with px (bug 1379908).

MozReview-Commit-ID: IsT26DKkgiP

--HG--
extra : rebase_source : 8d8dee6ad53d29801096d3affe996e4df1a9388c
2017-09-05 13:15:32 +09:00
Mantaroh Yoshinaga
4c7997db68 Bug 1390352 - Make Servo_AnimationValues_ComputeDistance return negative value instead of 0.0 when the function fails to distinguish its failure. r=hiro
We need to check whether the function fails or not in order to check whether
we support the specified paced animation values.

Current servo returns 0.0 when failed computing distance, so servo doesn't
distinguish its failure. This patch makes Servo_AnimationValue_ComputeDistance
return a negative value when the function fails.

MozReview-Commit-ID: 43Q4gu4xwHc

--HG--
extra : rebase_source : fa159b4b03e2e84c0a365455de4c0d2cf5d4f2ce
2017-08-24 10:21:14 +09:00
Andrew McCreight
78807d8776 Bug 1391005 - Eliminate NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED. r=peterv
Replace it with NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION, because it
has been the same for a while.

MozReview-Commit-ID: 5agRGFyUry1

--HG--
extra : rebase_source : 5388c56b2f6905c6ef969150f0c5b77bf247624d
2017-08-29 16:02:48 -07:00
Wes Kocher
4ea67d0e07 Backed out changeset e774700fe070 (bug 1392787) for build bustage a=backout CLOSED TREE
MozReview-Commit-ID: FRRUDa6rIuS
2017-08-24 13:58:52 -07:00
Andrew Halberstadt
cae249f833 Bug 1392787 - Disable manifestparser tests using 'disabled' key instead of comment, r=jmaher
MozReview-Commit-ID: IQL7hWxQX9F

--HG--
extra : rebase_source : d907a5b2192687d86e3291a936c943948ed6793f
2017-08-22 16:56:02 -04:00
Eric Rahm
a33f11e0f5 Bug 1391803 - Use nsStringFwd.h for forward declaring string classes. r=froydnj
We should not be declaring forward declarations for nsString classes directly,
instead we should use nsStringFwd.h. This will make changing the underlying
types easier.

--HG--
extra : rebase_source : b2c7554e8632f078167ff2f609392e63a136c299
2017-08-16 16:48:52 -07:00
Brian Birtles
c3bde11c34 Bug 1390766 - Drop complex handling of shorthand properties when determining if they are discrete or not; r=hiro
MozReview-Commit-ID: 2OzjTXGE7DU

--HG--
extra : rebase_source : 536ddc208ece1f7609e9d05f877ca90b88028601
2017-08-16 16:09:40 +09:00
Mantaroh Yoshinaga
5fa9ec9b19 Bug 1390357 - Switch test result for clamping RGBA on stylo and gecko by using preference. r=birtles
MozReview-Commit-ID: I12SQwmqtr0

--HG--
extra : rebase_source : 63eba3dcdbe6b507047cc97828bdb4afbfda965d
2017-08-16 08:56:59 +09:00
Brian Birtles
46d04e2219 Bug 1390384 - Apply SMIL's calcMode=discrete handling to discretely animatable properties in Stylo; r=hiro
In SMIL if a discrete calcMode is used, the keyTimes attribute may be used to
specify the times at which the various animation values are used, overriding the
regular 50% flip behavior (see nsSMILAnimationFunction::ScaleSimpleProgress).

However, this behavior is only applied when the calcMode is known to be
discrete. If the author specifies calcMode="linear" but
attributeType="stroke-linecap" then SMIL should fall back to discrete calcMode
including applying the special keyTimes behavior.

For the Servo backend, Servo_AnimationValues_Interpolate does not return an
error for discretely animated properties so SMIL does not recognize when we fall
back to discrete calcMode. This patch adds a check before performing
interpolation that tests if the property is a discretely interpolable one and,
if it is, returns an error so that we run SMIL's special discrete calcMode
handling.

MozReview-Commit-ID: FOp8XcNbvdu

--HG--
extra : rebase_source : 57ddb333855de111aa585fe894e99937681e5cd2
2017-08-15 14:40:06 +09:00
Hiroyuki Ikezoe
9bf9d338f9 Bug 1385089 - Set restyle subtree restyle hint if the element animates display style from 'none' to other. r=emilio
When display style is changed from 'none' to other in animation-only restyle
we need to resolve descendant elements' style that were in the display:none
subtree.

Three possible ways to resolve the descendant elements' style;

1) Traversing unstyled elements in animation-only restyle
   We can't simply traverse unstyled elements in the animation-only restyle
   since when we decided to traverse the unstyled elements we don't know yet
   the elements will be initially styled or are in display:none subtree. It
   will result that the new elements are styled in animation-only restyle,
   it's undesirable.

2) Creating a SequentialTask and resolve the descendants' style with
   ServoStyleSet::StyleNewSubtree()
   We can't resolve the descendants' styles with ServoStyleSet::StyleNewSubtree()
   in SequentialTask since at the moment we are still in servo traversal (i.e.
   sInServoTraversal is true). That means AutoSetInServoTraversal fails
   in PrepareAndTraverseSubtree().

3) Creating a SequentialTask and set restyle subtree hint and defer descendants'
   restyle in a subsequent normal traversal
   Note that, when we process throttled animations flush, we don't process
   normal traversal so the descendants will not be traversed until normal
   restyle happens but it will not be a big problem since it's really rare
   that user clicks display animation element just at the right moment when
   display property changes from none to other.  Also, if it will be really
   a problem, we should process *only* transform animations on the compositor,
   it's ideally right thing to do. Display property never runs on the
   compositor.

This patch takes the third approach.

MozReview-Commit-ID: Krxa3kkdIq4

--HG--
extra : rebase_source : 33e9db953f21168c76716329568191625bd15896
2017-08-02 20:01:08 +09:00
Bobby Holley
c7e4963340 Bug 1384769 - Skip two smil tests due to crashes until bug 1385089 is sorted out. r=me
MozReview-Commit-ID: 4Bkav7OzvtU
2017-07-27 17:49:46 -07:00
Bevis Tseng
a7505864a8 Bug 1378930 - Part 2: Remove the aName parameter from SchedulerGroup/DocGroup/DispatcherTrait. r=billm
--HG--
extra : rebase_source : 11319e568a51d16754a6a9990f76c35c86c2bda7
2017-07-26 16:13:35 +08:00
Carsten "Tomcat" Book
679210723b merge mozilla-inbound to mozilla-central a=merge 2017-07-25 14:27:17 +02:00
Xidorn Quan
c4c6fbf75a Bug 1383980 - Enable animation mochitests in mochitest-style task. r=birtles
MozReview-Commit-ID: 38Ir2MG7IMO

--HG--
extra : rebase_source : 0997b7026a24cc271ad977db5ce233c393554dfa
2017-07-25 14:17:04 +10:00
Yoshi Huang
7036b3761f Bug 1382531 - Part 1: rewrite crashtest for data: URI is unique opaque origin. r=smaug 2017-07-25 09:56:02 +08:00
Emilio Cobos Álvarez
2b7de51623 Bug 1381844: Be more explicit about the kind of style context we handle all the time. r=bholley
MozReview-Commit-ID: E0mdkhU3XBz
2017-07-22 18:02:57 +02:00
Brian Birtles
f1f7ad791c Bug 1375596 - Use valueToAdd in AddAccumulateOrValue, not valueToAddWrapper; r=hiro
AddOrAccumulate in nsSMILCSSValueType.cpp sets initializes |valueToAdd| to
either &valueToAddWrapper->mGeckoValue or nullptr. It then asks
FinalizeStyleAnimationValues to fill it in. FinalizeStyleAnimationValues will
return false if it could not fill it in, in which case AddOrAccumulate returns
early. As a result, after the early return we can be assured that |valueToAdd|
is not null. However, valueToAddWrapper may still be null.

Changeset 4d87f2bf4b10369af0dd83a2ef962a23299ee8d9 from bug 1358966 changed this
code such that we pass a member of valueToAddWrapper to StyleAnimationValue::Add
where we used to pass a member of valueToAdd. As a result, we can end up passing
0x20 (since valueToAddWrapper is nullptr) to Add() and then trying to read from
it.

This patch makes us pass, instead, |valueToAdd| since we know that is guaranteed
to be non-null here.

MozReview-Commit-ID: 1YwT1lBHnUe

--HG--
extra : rebase_source : abec6995af68de13eacaccf7eca7b2d121eaedf3
2017-07-18 16:24:28 +09:00
Emilio Cobos Álvarez
dde6942936 Bug 1381764 - style: More ComputedValuesInner cleanup. r=Manishearth on a CLOSED TREE
MozReview-Commit-ID: 8rkAP3pMEpD
2017-07-18 16:22:33 -07:00
Emilio Cobos Álvarez
9a6ef770c1 Bug 1381764: Cleanup the Gecko bits. r=manishearth
MozReview-Commit-ID: dbVDy1u4vp
2017-07-18 16:22:00 -07:00
Josh Matthews
e0c37f0ed3 Bug 1352669 - Hook up Stylo CSS parser to Gecko error reporter. r=emilio
MozReview-Commit-ID: 3r5Z6KiPgRM
2017-07-10 17:52:00 -04:00
Wes Kocher
19d135c982 Merge m-c to autoland, a=merge
MozReview-Commit-ID: 4R4GFHPiij
2017-07-06 16:19:38 -07:00
Nathan Froyd
fa32de6af4 Bug 1378492 - label nsSMILTimedElement's AsyncTimeEventRunner; r=billm
Dispatching it to the associated document should be good enough.
2017-07-06 11:41:48 -04:00
Sylvestre Ledru
4e9cf83ee8 Bug 1378712 - Remove all trailing whitespaces r=Ehsan
MozReview-Commit-ID: Kdz2xtTF9EG

--HG--
extra : rebase_source : 7235b3802f25bab29a8c6ba40a181a722f3df0ce
2017-07-06 14:00:35 +02:00
Wes Kocher
a9eb08898f Backed out changeset f220d8060c14 (bug 1352669) for build bustage CLOSED TREE a=bustage
MozReview-Commit-ID: INYGT4WT1pO
2017-07-06 14:56:06 -07:00
Josh Matthews
723b20d420 Bug 1352669 - Hook up Stylo CSS parser to Gecko error reporter.
MozReview-Commit-ID: 3r5Z6KiPgRM
2017-07-06 13:15:08 -07:00
Robert Longson
57cdb660f1 Bug 1374861 - add const keyword where appropriate. r=birtles 2017-07-01 10:55:27 +01:00
Bill McCloskey
f115503a0b Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-26 14:19:58 -07:00
Carsten "Tomcat" Book
8a1350b5a6 Backed out changeset 4f6302a98ae4 (bug 1372405)
--HG--
extra : rebase_source : 41632f3158e88e692809731394a683d065a73dfb
2017-06-21 13:59:26 +02:00
Bill McCloskey
6b3e84ed5f Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-20 21:44:11 -07:00
Carsten "Tomcat" Book
ea1b86680c Backed out changeset 9846de3bd954 (bug 1372405)
--HG--
extra : rebase_source : 5d4a48e8ec394c329994689d938d2a6e9b2752b0
2017-06-20 08:27:02 +02:00