Skip to content

Commit

Permalink
Bug 1636978 [wpt PR 23508] - Attribute animations should not be refle…
Browse files Browse the repository at this point in the history
…cted by getAttribute(...), a=testonly

Automatic update from web-platform-tests
Attribute animations should not be reflected by getAttribute(...)

According to SMIL [1], when an attribute is animated, the actual DOM
attribute should not change. So only synchronize attributes after a base
value change has taken place.
Rename related flags and methods to not include "animated", since that
seems a bit misleading.
Add SVGElement::CollectStyleForAnimatedPresentationAttributes() to
handle animations of attributes that are presentation attributes but are
not actually specified on the target element.

[1] https://www.w3.org/TR/2001/REC-smil-animation-20010904/#BasicAnim

Bug: 735820
Change-Id: I2a0858dd383a1a96e7b96451a6fca07084983d57
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2173184
Reviewed-by: Philip Rogers <[email protected]>
Reviewed-by: Rune Lillesveen <[email protected]>
Commit-Queue: Fredrik Söderquist <[email protected]>
Cr-Commit-Position: refs/heads/master@{#767696}

--

wpt-commits: 31e27f4e968a8e5167889a1a5a3c477a26297455
wpt-pr: 23508
  • Loading branch information
Fredrik Söderqvist authored and moz-wptsync-bot committed May 20, 2020
1 parent a1a2038 commit 92dbf60
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!doctype html>
<title>An animation of an attribute does not change the DOM attribute value</title>
<link rel="help" href="https://www.w3.org/TR/2001/REC-smil-animation-20010904/#BasicAnim">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
.animated {
fill: blue;
}
</style>
<svg>
<rect class="base">
<set attributeName="class" to="animated"/>
</rect>
<rect>
<set attributeName="class" to="animated"/>
</rect>
</svg>
<script>
async_test(t => {
onload = t.step_func(() => {
requestAnimationFrame(t.step_func_done(() => {
let rects = document.getElementsByTagName('rect');
assert_true(rects[0].hasAttribute('class'));
assert_equals(rects[0].getAttribute('class'), 'base');
assert_equals(getComputedStyle(rects[0]).getPropertyValue('fill'), 'rgb(0, 0, 255)');

assert_false(rects[1].hasAttribute('class'));
assert_equals(rects[1].getAttribute('class'), null);
assert_equals(getComputedStyle(rects[0]).getPropertyValue('fill'), 'rgb(0, 0, 255)');
}));
});
});
</script>

0 comments on commit 92dbf60

Please sign in to comment.