зеркало из https://github.com/mozilla/gecko-dev.git
merge mozilla-inbound to mozilla-central a=merge
This commit is contained in:
Коммит
99758da759
|
@ -1,7 +1,6 @@
|
|||
[DEFAULT]
|
||||
tags = devtools
|
||||
subsuite = devtools
|
||||
skip-if = e10s && debug # bug 1252283
|
||||
support-files =
|
||||
doc_body_animation.html
|
||||
doc_end_delay.html
|
||||
|
|
|
@ -154,6 +154,7 @@ skip-if = e10s # Bug 1067145 - e10s responsiveview
|
|||
[browser_telemetry_toolboxtabs_webconsole.js]
|
||||
[browser_templater_basic.js]
|
||||
[browser_toolbar_basic.js]
|
||||
skip-if = (e10s && debug) # Bug 1253035
|
||||
[browser_toolbar_tooltip.js]
|
||||
[browser_toolbar_webconsole_errors_count.js]
|
||||
skip-if = e10s # The developertoolbar error count isn't correct with e10s
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
||||
#endif
|
||||
|
||||
void AddValue(nsCSSProperty aProperty, StyleAnimationValue &aStartValue)
|
||||
void AddValue(nsCSSProperty aProperty, const StyleAnimationValue &aStartValue)
|
||||
{
|
||||
PropertyValuePair v = { aProperty, aStartValue };
|
||||
mPropertyValuePairs.AppendElement(v);
|
||||
|
@ -44,14 +44,13 @@ public:
|
|||
nsCachedStyleData::GetBitForSID(nsCSSProps::kSIDTable[aProperty]);
|
||||
}
|
||||
|
||||
// Caller must fill in returned value.
|
||||
StyleAnimationValue* AddEmptyValue(nsCSSProperty aProperty)
|
||||
void AddValue(nsCSSProperty aProperty, StyleAnimationValue&& aStartValue)
|
||||
{
|
||||
PropertyValuePair *p = mPropertyValuePairs.AppendElement();
|
||||
p->mProperty = aProperty;
|
||||
p->mValue = Move(aStartValue);
|
||||
mStyleBits |=
|
||||
nsCachedStyleData::GetBitForSID(nsCSSProps::kSIDTable[aProperty]);
|
||||
return &p->mValue;
|
||||
}
|
||||
|
||||
struct PropertyValuePair {
|
||||
|
|
|
@ -598,14 +598,12 @@ KeyframeEffectReadOnly::ComposeStyle(RefPtr<AnimValuesStyleRule>& aStyleRule,
|
|||
aStyleRule = new AnimValuesStyleRule();
|
||||
}
|
||||
|
||||
StyleAnimationValue* val = aStyleRule->AddEmptyValue(prop.mProperty);
|
||||
|
||||
// Special handling for zero-length segments
|
||||
if (segment->mToKey == segment->mFromKey) {
|
||||
if (computedTiming.mProgress.Value() < 0) {
|
||||
*val = segment->mFromValue;
|
||||
aStyleRule->AddValue(prop.mProperty, segment->mFromValue);
|
||||
} else {
|
||||
*val = segment->mToValue;
|
||||
aStyleRule->AddValue(prop.mProperty, segment->mToValue);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -618,14 +616,17 @@ KeyframeEffectReadOnly::ComposeStyle(RefPtr<AnimValuesStyleRule>& aStyleRule,
|
|||
positionInSegment,
|
||||
computedTiming.mBeforeFlag);
|
||||
|
||||
#ifdef DEBUG
|
||||
bool result =
|
||||
#endif
|
||||
StyleAnimationValue::Interpolate(prop.mProperty,
|
||||
segment->mFromValue,
|
||||
segment->mToValue,
|
||||
valuePosition, *val);
|
||||
MOZ_ASSERT(result, "interpolate must succeed now");
|
||||
StyleAnimationValue val;
|
||||
if (StyleAnimationValue::Interpolate(prop.mProperty,
|
||||
segment->mFromValue,
|
||||
segment->mToValue,
|
||||
valuePosition, val)) {
|
||||
aStyleRule->AddValue(prop.mProperty, Move(val));
|
||||
} else if (valuePosition < 0.5) {
|
||||
aStyleRule->AddValue(prop.mProperty, segment->mFromValue);
|
||||
} else {
|
||||
aStyleRule->AddValue(prop.mProperty, segment->mToValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[DEFAULT]
|
||||
skip-if = e10s && debug && (os == 'win' || os == 'mac') # Bug 1252677 for Windows, Bug 1252348 for Mac
|
||||
skip-if = (e10s && debug && os == 'win') # Bug 1252677
|
||||
support-files =
|
||||
android.json
|
||||
file_drawImage_document_domain.html
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
var canvas = document.getElementById('canvas');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.filter = 'drop-shadow(0 10px black)';
|
||||
ctx.filter = 'drop-shadow(0 10px #000)';
|
||||
ctx.globalAlpha = 0.5;
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(25, 25, 50, 40);
|
||||
|
|
|
@ -3,7 +3,7 @@ default-preferences pref(canvas.filters.enabled,true)
|
|||
== default-color.html ref.html
|
||||
== drop-shadow.html ref.html
|
||||
== drop-shadow-transformed.html ref.html
|
||||
== global-alpha.html global-alpha-ref.html
|
||||
fuzzy-if(azureSkia,1,1500) == global-alpha.html global-alpha-ref.html
|
||||
== global-composite-operation.html global-composite-operation-ref.html
|
||||
== liveness.html ref.html
|
||||
== multiple-drop-shadows.html shadow-ref.html
|
||||
|
|
|
@ -10,8 +10,12 @@ var ctx = canvas.getContext('2d');
|
|||
ctx.font = '20px sans-serif';
|
||||
ctx.filter = 'drop-shadow(0 .5em black)';
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(25, 25, 25, 40);
|
||||
ctx.fillRect(25, 25, 50, 40);
|
||||
|
||||
canvas.style.fontSize = '5px';
|
||||
ctx.font = '4em sans-serif';
|
||||
ctx.filter = 'drop-shadow(0 .5em black)';
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -159,3 +159,6 @@ pref(canvas.customfocusring.enabled,true) skip-if(B2G) skip-if(cocoaWidget) skip
|
|||
== capturestream.html wrapper.html?green.png
|
||||
|
||||
fuzzy-if(azureSkiaGL,1,2) fuzzy-if(Android,3,40) fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu),1,1) == 1177726-text-stroke-bounds.html 1177726-text-stroke-bounds-ref.html
|
||||
|
||||
# Canvas Filter Reftests
|
||||
include filters/reftest.list
|
||||
|
|
|
@ -4112,14 +4112,32 @@ bool HTMLMediaElement::CanActivateAutoplay()
|
|||
// being paused. We also activate autopaly when playing a media source since
|
||||
// the data download is controlled by the script and there is no way to
|
||||
// evaluate MediaDecoder::CanPlayThrough().
|
||||
return !mPausedForInactiveDocumentOrChannel &&
|
||||
mAutoplaying &&
|
||||
mPaused &&
|
||||
((mDecoder && mReadyState >= nsIDOMHTMLMediaElement::HAVE_ENOUGH_DATA) ||
|
||||
mSrcStream || mMediaSource) &&
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::autoplay) &&
|
||||
mAutoplayEnabled &&
|
||||
!IsEditable();
|
||||
|
||||
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::autoplay) || !mAutoplayEnabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mAutoplaying) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsEditable()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mPaused) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mPausedForInactiveDocumentOrChannel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool hasData =
|
||||
(mDecoder && mReadyState >= nsIDOMHTMLMediaElement::HAVE_ENOUGH_DATA) ||
|
||||
mSrcStream || mMediaSource;
|
||||
|
||||
return hasData;
|
||||
}
|
||||
|
||||
void HTMLMediaElement::CheckAutoplayDataReady()
|
||||
|
|
|
@ -814,6 +814,7 @@ WebMTrackDemuxer::WebMTrackDemuxer(WebMDemuxer* aParent,
|
|||
uint32_t aTrackNumber)
|
||||
: mParent(aParent)
|
||||
, mType(aType)
|
||||
, mNeedKeyframe(true)
|
||||
{
|
||||
mInfo = mParent->GetTrackInfo(aType, aTrackNumber);
|
||||
MOZ_ASSERT(mInfo);
|
||||
|
@ -840,6 +841,7 @@ WebMTrackDemuxer::Seek(media::TimeUnit aTime)
|
|||
mSamples.Reset();
|
||||
mParent->SeekInternal(aTime);
|
||||
mParent->GetNextPacket(mType, &mSamples);
|
||||
mNeedKeyframe = true;
|
||||
|
||||
// Check what time we actually seeked to.
|
||||
if (mSamples.GetSize() > 0) {
|
||||
|
@ -875,6 +877,10 @@ WebMTrackDemuxer::GetSamples(int32_t aNumSamples)
|
|||
if (!sample) {
|
||||
break;
|
||||
}
|
||||
if (mNeedKeyframe && !sample->mKeyframe) {
|
||||
continue;
|
||||
}
|
||||
mNeedKeyframe = false;
|
||||
samples->mSamples.AppendElement(sample);
|
||||
aNumSamples--;
|
||||
}
|
||||
|
@ -951,6 +957,7 @@ WebMTrackDemuxer::Reset()
|
|||
{
|
||||
mSamples.Reset();
|
||||
media::TimeIntervals buffered = GetBuffered();
|
||||
mNeedKeyframe = true;
|
||||
if (buffered.Length()) {
|
||||
WEBM_DEBUG("Seek to start point: %f", buffered.Start(0).ToSeconds());
|
||||
mParent->SeekInternal(buffered.Start(0));
|
||||
|
|
|
@ -242,6 +242,7 @@ private:
|
|||
TrackInfo::TrackType mType;
|
||||
UniquePtr<TrackInfo> mInfo;
|
||||
Maybe<media::TimeUnit> mNextKeyframeTime;
|
||||
bool mNeedKeyframe;
|
||||
|
||||
// Queued samples extracted by the demuxer, but not yet returned.
|
||||
MediaRawDataQueue mSamples;
|
||||
|
|
|
@ -1931,7 +1931,7 @@ Layer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
|
|||
if (1.0 != mOpacity) {
|
||||
aStream << nsPrintfCString(" [opacity=%g]", mOpacity).get();
|
||||
}
|
||||
if (GetContentFlags() & CONTENT_OPAQUE) {
|
||||
if (IsOpaque()) {
|
||||
aStream << " [opaqueContent]";
|
||||
}
|
||||
if (GetContentFlags() & CONTENT_COMPONENT_ALPHA) {
|
||||
|
|
|
@ -1501,6 +1501,12 @@ public:
|
|||
return !GetLocalVisibleRegion().IsEmpty() || Extend3DContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if current layer content is opaque.
|
||||
* It does not guarantee that layer content is always opaque.
|
||||
*/
|
||||
virtual bool IsOpaque() { return GetContentFlags() & CONTENT_OPAQUE; }
|
||||
|
||||
/**
|
||||
* Returns the product of the opacities of this layer and all ancestors up
|
||||
* to and excluding the nearest ancestor that has UseIntermediateSurface() set.
|
||||
|
|
|
@ -581,6 +581,27 @@ ImageHost::GetImageSize() const
|
|||
return IntSize();
|
||||
}
|
||||
|
||||
bool
|
||||
ImageHost::IsOpaque()
|
||||
{
|
||||
const TimedImage* img = ChooseImage();
|
||||
if (!img) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (img->mPictureRect.width == 0 ||
|
||||
img->mPictureRect.height == 0 ||
|
||||
!img->mTextureHost) {
|
||||
return false;
|
||||
}
|
||||
|
||||
gfx::SurfaceFormat format = img->mTextureHost->GetFormat();
|
||||
if (gfx::IsOpaque(format)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
already_AddRefed<TexturedEffect>
|
||||
ImageHost::GenEffect(const gfx::Filter& aFilter)
|
||||
{
|
||||
|
|
|
@ -115,6 +115,8 @@ public:
|
|||
BIAS_POSITIVE,
|
||||
};
|
||||
|
||||
bool IsOpaque();
|
||||
|
||||
protected:
|
||||
struct TimedImage {
|
||||
RefPtr<TextureHost> mTextureHost;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "mozilla/gfx/Rect.h" // for Rect
|
||||
#include "mozilla/layers/Compositor.h" // for Compositor
|
||||
#include "mozilla/layers/Effects.h" // for EffectChain
|
||||
#include "mozilla/layers/ImageHost.h" // for ImageHost
|
||||
#include "mozilla/layers/TextureHost.h" // for TextureHost, etc
|
||||
#include "mozilla/mozalloc.h" // for operator delete
|
||||
#include "nsAString.h"
|
||||
|
@ -50,7 +51,7 @@ ImageLayerComposite::SetCompositableHost(CompositableHost* aHost)
|
|||
{
|
||||
switch (aHost->GetType()) {
|
||||
case CompositableType::IMAGE:
|
||||
mImageHost = aHost;
|
||||
mImageHost = static_cast<ImageHost*>(aHost);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
@ -78,6 +79,16 @@ ImageLayerComposite::GetLayer()
|
|||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
ImageLayerComposite::SetLayerManager(LayerManagerComposite* aManager)
|
||||
{
|
||||
LayerComposite::SetLayerManager(aManager);
|
||||
mManager = aManager;
|
||||
if (mImageHost) {
|
||||
mImageHost->SetCompositor(mCompositor);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ImageLayerComposite::RenderLayer(const IntRect& aClipRect)
|
||||
{
|
||||
|
@ -143,6 +154,20 @@ ImageLayerComposite::ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransform
|
|||
ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
|
||||
}
|
||||
|
||||
bool
|
||||
ImageLayerComposite::IsOpaque()
|
||||
{
|
||||
if (!mImageHost ||
|
||||
!mImageHost->IsAttached()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mScaleMode == ScaleMode::STRETCH) {
|
||||
return mImageHost->IsOpaque();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CompositableHost*
|
||||
ImageLayerComposite::GetCompositableHost()
|
||||
{
|
||||
|
|
|
@ -43,14 +43,7 @@ public:
|
|||
|
||||
virtual Layer* GetLayer() override;
|
||||
|
||||
virtual void SetLayerManager(LayerManagerComposite* aManager) override
|
||||
{
|
||||
LayerComposite::SetLayerManager(aManager);
|
||||
mManager = aManager;
|
||||
if (mImageHost) {
|
||||
mImageHost->SetCompositor(mCompositor);
|
||||
}
|
||||
}
|
||||
virtual void SetLayerManager(LayerManagerComposite* aManager) override;
|
||||
|
||||
virtual void RenderLayer(const gfx::IntRect& aClipRect) override;
|
||||
|
||||
|
@ -66,6 +59,8 @@ public:
|
|||
|
||||
virtual const char* Name() const override { return "ImageLayerComposite"; }
|
||||
|
||||
virtual bool IsOpaque() override;
|
||||
|
||||
protected:
|
||||
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
|
||||
|
||||
|
@ -73,7 +68,7 @@ private:
|
|||
gfx::Filter GetEffectFilter();
|
||||
|
||||
private:
|
||||
RefPtr<CompositableHost> mImageHost;
|
||||
RefPtr<ImageHost> mImageHost;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
|
|
|
@ -362,7 +362,7 @@ LayerManagerComposite::PostProcessLayers(Layer* aLayer,
|
|||
if (integerTranslation &&
|
||||
!aLayer->HasMaskLayers() &&
|
||||
aLayer->IsOpaqueForVisibility()) {
|
||||
if (aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE) {
|
||||
if (aLayer->IsOpaque()) {
|
||||
localOpaque.OrWith(composite->GetFullyRenderedRegion());
|
||||
}
|
||||
localOpaque.MoveBy(*integerTranslation);
|
||||
|
|
|
@ -531,7 +531,6 @@ SurfaceTextureHost::SetCompositor(Compositor* aCompositor)
|
|||
gfx::SurfaceFormat
|
||||
SurfaceTextureHost::GetFormat() const
|
||||
{
|
||||
MOZ_ASSERT(mTextureSource);
|
||||
return mTextureSource ? mTextureSource->GetFormat() : gfx::SurfaceFormat::UNKNOWN;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,17 +2,15 @@
|
|||
skip-if = buildapp == 'b2g' || os == 'android'
|
||||
support-files =
|
||||
animationPolling.js
|
||||
animated-gif.gif
|
||||
iframe.html
|
||||
imgutils.js
|
||||
ref-iframe.html
|
||||
|
||||
[test_animation.html]
|
||||
disabled = bug 1100497
|
||||
[test_animation2.html]
|
||||
disabled = bug 1101415
|
||||
[test_bug415761.html]
|
||||
skip-if = os != "win" || os_version == "6.2"
|
||||
support-files =
|
||||
bug415761.ico
|
||||
[test_undisplayed_iframe.html]
|
||||
disabled = bug 1060869
|
||||
|
|
|
@ -50,4 +50,4 @@ skip == test_bug641198.html animation2a-finalframe.gif # Disabled; see bug 1120
|
|||
# won't be in the text of the contents themselves. --$(boundary)\r\n means
|
||||
# "Here is the beginning of a boundary," and --$(boundary)-- means "All done
|
||||
# sending you parts.")
|
||||
skip-if(B2G||browserIsRemote) HTTP == webcam.html blue.gif # bug 773482
|
||||
skip-if(B2G) HTTP == webcam.html blue.gif # bug 773482
|
||||
|
|
|
@ -373,6 +373,12 @@ public:
|
|||
}
|
||||
StyleAnimationValue(const StyleAnimationValue& aOther)
|
||||
: mUnit(eUnit_Null) { *this = aOther; }
|
||||
StyleAnimationValue(StyleAnimationValue&& aOther)
|
||||
: mUnit(aOther.mUnit)
|
||||
, mValue(aOther.mValue)
|
||||
{
|
||||
aOther.mUnit = eUnit_Null;
|
||||
}
|
||||
enum IntegerConstructorType { IntegerConstructor };
|
||||
StyleAnimationValue(int32_t aInt, Unit aUnit, IntegerConstructorType);
|
||||
enum CoordConstructorType { CoordConstructor };
|
||||
|
|
|
@ -100,6 +100,9 @@ class Taskcluster(LogMixin):
|
|||
content_length = os.path.getsize(filename)
|
||||
self.info("Uploading to S3: filename=%s mimetype=%s length=%s" % (
|
||||
filename, mime_type, content_length))
|
||||
# reclaim the task to avoid "claim-expired" errors
|
||||
self.taskcluster_queue.reclaimTask(
|
||||
task['status']['taskId'], task['status']['runs'][-1]['runId'])
|
||||
artifact = self.taskcluster_queue.createArtifact(
|
||||
task['status']['taskId'],
|
||||
task['status']['runs'][-1]['runId'],
|
||||
|
|
|
@ -28389,10 +28389,6 @@
|
|||
"path": "web-animations/animatable/animate.html",
|
||||
"url": "/web-animations/animatable/animate.html"
|
||||
},
|
||||
{
|
||||
"path": "web-animations/animation-effect-timing/delay.html",
|
||||
"url": "/web-animations/animation-effect-timing/delay.html"
|
||||
},
|
||||
{
|
||||
"path": "web-animations/animation-effect-timing/direction.html",
|
||||
"url": "/web-animations/animation-effect-timing/direction.html"
|
||||
|
@ -28421,6 +28417,10 @@
|
|||
"path": "web-animations/animation-effect-timing/iterations.html",
|
||||
"url": "/web-animations/animation-effect-timing/iterations.html"
|
||||
},
|
||||
{
|
||||
"path": "web-animations/animation-model/animation-types/discrete-animation.html",
|
||||
"url": "/web-animations/animation-model/animation-types/discrete-animation.html"
|
||||
},
|
||||
{
|
||||
"path": "web-animations/animation-timeline/document-timeline.html",
|
||||
"url": "/web-animations/animation-timeline/document-timeline.html"
|
||||
|
|
|
@ -1,15 +1,7 @@
|
|||
[event-progress.htm]
|
||||
type: testharness
|
||||
expected:
|
||||
if debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): OK
|
||||
if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): OK
|
||||
if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): OK
|
||||
if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): OK
|
||||
if debug and (os == "mac") and (version == "OS X 10.10.2") and (processor == "x86_64") and (bits == 64): OK
|
||||
if debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): OK
|
||||
if debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): OK
|
||||
if debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): OK
|
||||
if debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): OK
|
||||
if debug and not e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): OK
|
||||
if debug and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): OK
|
||||
if (asan or debug) and (os == "linux"): OK
|
||||
if debug and (os == "mac"): OK
|
||||
if debug and (os == "win"): OK
|
||||
TIMEOUT
|
||||
|
|
|
@ -0,0 +1,136 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>Tests for discrete animation</title>
|
||||
<link rel="help" href="http://w3c.github.io/web-animations/#animatable-as-string-section">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../../testcommon.js"></script>
|
||||
<link rel="stylesheet" href="/resources/testharness.css">
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
test(function(t) {
|
||||
var div = createDiv(t);
|
||||
|
||||
var anim = div.animate({ fontStyle: [ 'normal', 'italic' ] },
|
||||
{ duration: 1000, fill: 'forwards' });
|
||||
|
||||
assert_equals(getComputedStyle(div).fontStyle, 'normal',
|
||||
'Animation produces \'from\' value at start of interval');
|
||||
anim.currentTime = anim.effect.getComputedTiming().duration / 2 - 1;
|
||||
assert_equals(getComputedStyle(div).fontStyle, 'normal',
|
||||
'Animation produces \'from\' value just before the middle of'
|
||||
+ ' the interval');
|
||||
anim.currentTime++;
|
||||
assert_equals(getComputedStyle(div).fontStyle, 'italic',
|
||||
'Animation produces \'to\' value at exact middle of'
|
||||
+ ' the interval');
|
||||
anim.finish();
|
||||
assert_equals(getComputedStyle(div).fontStyle, 'italic',
|
||||
'Animation produces \'to\' value during forwards fill');
|
||||
}, 'Test animating discrete values');
|
||||
|
||||
test(function(t) {
|
||||
var div = createDiv(t);
|
||||
var originalHeight = getComputedStyle(div).height;
|
||||
|
||||
var anim = div.animate({ height: [ 'auto', '200px' ] },
|
||||
{ duration: 1000, fill: 'forwards' });
|
||||
|
||||
assert_equals(getComputedStyle(div).height, originalHeight,
|
||||
'Animation produces \'from\' value at start of interval');
|
||||
anim.currentTime = anim.effect.getComputedTiming().duration / 2 - 1;
|
||||
assert_equals(getComputedStyle(div).height, originalHeight,
|
||||
'Animation produces \'from\' value just before the middle of'
|
||||
+ ' the interval');
|
||||
anim.currentTime++;
|
||||
assert_equals(getComputedStyle(div).height, '200px',
|
||||
'Animation produces \'to\' value at exact middle of'
|
||||
+ ' the interval');
|
||||
anim.finish();
|
||||
assert_equals(getComputedStyle(div).height, '200px',
|
||||
'Animation produces \'to\' value during forwards fill');
|
||||
}, 'Test discrete animation is used when interpolation fails');
|
||||
|
||||
test(function(t) {
|
||||
var div = createDiv(t);
|
||||
var originalHeight = getComputedStyle(div).height;
|
||||
|
||||
var anim = div.animate({ height: [ 'auto',
|
||||
'200px',
|
||||
'300px',
|
||||
'auto',
|
||||
'400px' ] },
|
||||
{ duration: 1000, fill: 'forwards' });
|
||||
|
||||
// There are five values, so there are four pairs to try to interpolate.
|
||||
// We test at the middle of each pair.
|
||||
assert_equals(getComputedStyle(div).height, originalHeight,
|
||||
'Animation produces \'from\' value at start of interval');
|
||||
anim.currentTime = 125;
|
||||
assert_equals(getComputedStyle(div).height, '200px',
|
||||
'First non-interpolable pair uses discrete interpolation');
|
||||
anim.currentTime += 250;
|
||||
assert_equals(getComputedStyle(div).height, '250px',
|
||||
'Second interpolable pair uses linear interpolation');
|
||||
anim.currentTime += 250;
|
||||
assert_equals(getComputedStyle(div).height, originalHeight,
|
||||
'Third non-interpolable pair uses discrete interpolation');
|
||||
anim.currentTime += 250;
|
||||
assert_equals(getComputedStyle(div).height, '400px',
|
||||
'Fourth non-interpolable pair uses discrete interpolation');
|
||||
}, 'Test discrete animation is used only for pairs of values that cannot'
|
||||
+ ' be interpolated');
|
||||
|
||||
test(function(t) {
|
||||
var div = createDiv(t);
|
||||
var originalHeight = getComputedStyle(div).height;
|
||||
|
||||
// Easing: http://cubic-bezier.com/#.68,0,1,.01
|
||||
// With this curve, we don't reach the 50% point until about 95% of
|
||||
// the time has expired.
|
||||
var anim = div.animate({ fontStyle: [ 'italic', 'oblique' ] },
|
||||
{ duration: 1000, fill: 'forwards',
|
||||
easing: 'cubic-bezier(0.68,0,1,0.01)' });
|
||||
|
||||
assert_equals(getComputedStyle(div).fontStyle, 'italic',
|
||||
'Animation produces \'from\' value at start of interval');
|
||||
anim.currentTime = 940;
|
||||
assert_equals(getComputedStyle(div).fontStyle, 'italic',
|
||||
'Animation produces \'from\' value at 94% of the iteration'
|
||||
+ ' time');
|
||||
anim.currentTime = 960;
|
||||
assert_equals(getComputedStyle(div).fontStyle, 'oblique',
|
||||
'Animation produces \'to\' value at 96% of the iteration'
|
||||
+ ' time');
|
||||
}, 'Test the 50% switch point for discrete animation is based on the'
|
||||
+ ' effect easing');
|
||||
|
||||
test(function(t) {
|
||||
var div = createDiv(t);
|
||||
var originalHeight = getComputedStyle(div).height;
|
||||
|
||||
// Easing: http://cubic-bezier.com/#.68,0,1,.01
|
||||
// With this curve, we don't reach the 50% point until about 95% of
|
||||
// the time has expired.
|
||||
var anim = div.animate([ { fontStyle: 'italic',
|
||||
easing: 'cubic-bezier(0.68,0,1,0.01)' },
|
||||
{ fontStyle: 'oblique' } ],
|
||||
{ duration: 1000, fill: 'forwards' });
|
||||
|
||||
assert_equals(getComputedStyle(div).fontStyle, 'italic',
|
||||
'Animation produces \'from\' value at start of interval');
|
||||
anim.currentTime = 940;
|
||||
assert_equals(getComputedStyle(div).fontStyle, 'italic',
|
||||
'Animation produces \'from\' value at 94% of the iteration'
|
||||
+ ' time');
|
||||
anim.currentTime = 960;
|
||||
assert_equals(getComputedStyle(div).fontStyle, 'oblique',
|
||||
'Animation produces \'to\' value at 96% of the iteration'
|
||||
+ ' time');
|
||||
}, 'Test the 50% switch point for discrete animation is based on the'
|
||||
+ ' keyframe easing');
|
||||
|
||||
</script>
|
Загрузка…
Ссылка в новой задаче