Bug 1578850 [wpt PR 18846] - Restore SVGSMILElement::Elapsed(), a=testonly

Automatic update from web-platform-tests
Restore SVGSMILElement::Elapsed()

When sampling/adding instance times from within the animation engine we
want to use SMILTimeContainer::CurrentDocumentTime() rather than
SMILTimeContainer::Elapsed(). However the latter should still be used
for all event bases and similar. Since most users of
SVGSMILElement::Elapsed() still fall into the "event base" category,
restore it to its original guise and open-code usage of
CurrentDocumentTime() where it's needed.

Bug: 1000290
Change-Id: Ie91ae8d5c9c63d03476ba11921777d064b264066
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1783153
Reviewed-by: Philip Rogers <pdr@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#693589}

--

wpt-commits: 1ef7f92af6712133d89d663f612f4637e74e7cb0
wpt-pr: 18846
This commit is contained in:
Fredrik Söderquist 2019-09-05 15:05:55 +00:00 коммит произвёл James Graham
Родитель 4b2b0d405e
Коммит ce825c7a73
1 изменённых файлов: 28 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,28 @@
<!DOCTYPE html>
<title>beginElement() timing</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<svg width="100" height="20" style="border: grey 1px solid">
<rect width="1" height="20">
<animateMotion path="M0,0h100" dur="100ms"/>
</rect>
</svg>
<script>
async_test(t => {
const svg = document.querySelector('svg');
const motion = document.querySelector('animateMotion');
motion.addEventListener('endEvent', t.step_func(() => {
t.step_timeout(t.step_func(() => {
motion.beginElement();
let start = svg.getCurrentTime();
requestAnimationFrame(t.step_func_done(() => {
svg.pauseAnimations();
let elapsed = svg.getCurrentTime() - start;
let expected_pos = Math.min(elapsed * 1000, 100);
let actual_pos = motion.parentElement.getCTM().e;
assert_approx_equals(actual_pos, expected_pos, 2, `position after ${elapsed}`);
}));
}), 50);
}), { once: true });
});
</script>