From 239fba218630efda9e33ef5aa41c75744171f4bb Mon Sep 17 00:00:00 2001 From: Charles Collicutt Date: Sat, 9 Apr 2016 13:40:00 -0400 Subject: [PATCH 01/18] Bug 1261392 - Define gettid for all Linux builds. r=BenWa --- tools/profiler/core/platform.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/profiler/core/platform.h b/tools/profiler/core/platform.h index 5d2e25c8e32b..09ca1eab42ce 100644 --- a/tools/profiler/core/platform.h +++ b/tools/profiler/core/platform.h @@ -59,9 +59,9 @@ #include #include "StackTop.h" -// We need a definition of gettid(), but glibc doesn't provide a -// wrapper for it. -#if defined(__GLIBC__) +// We need a definition of gettid(), but Linux libc implementations don't +// provide a wrapper for it. +#if defined(__linux__) #include #include static inline pid_t gettid() From 6e99e0d3f520d32522b3d7f9de70b18cf24aaa8e Mon Sep 17 00:00:00 2001 From: Tobias Schneider Date: Thu, 7 Apr 2016 11:16:00 -0400 Subject: [PATCH 02/18] Bug 1262745 - Fix tests for Canvas CSS/SVG Filters. r=mstange --- dom/canvas/test/reftest/filters/global-alpha.html | 2 +- dom/canvas/test/reftest/filters/reftest.list | 2 +- dom/canvas/test/reftest/filters/units-em.html | 6 +++++- dom/canvas/test/reftest/reftest.list | 3 +++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/dom/canvas/test/reftest/filters/global-alpha.html b/dom/canvas/test/reftest/filters/global-alpha.html index 4676e00605e0..8b6eb9752081 100644 --- a/dom/canvas/test/reftest/filters/global-alpha.html +++ b/dom/canvas/test/reftest/filters/global-alpha.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); diff --git a/dom/canvas/test/reftest/filters/reftest.list b/dom/canvas/test/reftest/filters/reftest.list index 9dd1d8c47608..aba390d4b107 100644 --- a/dom/canvas/test/reftest/filters/reftest.list +++ b/dom/canvas/test/reftest/filters/reftest.list @@ -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 diff --git a/dom/canvas/test/reftest/filters/units-em.html b/dom/canvas/test/reftest/filters/units-em.html index 1f280c1b5b8f..44f76dc4b40e 100644 --- a/dom/canvas/test/reftest/filters/units-em.html +++ b/dom/canvas/test/reftest/filters/units-em.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)'; + + + + diff --git a/dom/canvas/test/reftest/reftest.list b/dom/canvas/test/reftest/reftest.list index 4f2aa7917364..9c900fdb69f4 100644 --- a/dom/canvas/test/reftest/reftest.list +++ b/dom/canvas/test/reftest/reftest.list @@ -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 From b10f463dc4e76b6861e42d5afa670f6c6ab9b0fb Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Wed, 23 Sep 2015 01:29:37 -0500 Subject: [PATCH 03/18] Bug 1199023. Remove 'scrolling="no"' from iframe in which mochitest-chrome tests are run. r=ted This makes the iframe more like the iframe that houses the root content document, and more like almost every other iframe. This does cause real differences in practice when testing, eg https://bugzilla.mozilla.org/show_bug.cgi?id=1177018#c3 --- testing/mochitest/harness.xul | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/mochitest/harness.xul b/testing/mochitest/harness.xul index e0356abac7e5..3ad3d692f896 100644 --- a/testing/mochitest/harness.xul +++ b/testing/mochitest/harness.xul @@ -84,7 +84,7 @@ function linkAndHookup(links) {
- +
From 139ecf837b5a85aea6fb7cfbe0a8b425ae66da33 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Sun, 10 Apr 2016 16:57:26 -0400 Subject: [PATCH 04/18] Backed out changeset 14eb89c4134d (bug 1261392) for Android bustage. --HG-- extra : rebase_source : 02b744b942c4d14b43435f8762a4f56a8d5b550f --- tools/profiler/core/platform.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/profiler/core/platform.h b/tools/profiler/core/platform.h index 09ca1eab42ce..5d2e25c8e32b 100644 --- a/tools/profiler/core/platform.h +++ b/tools/profiler/core/platform.h @@ -59,9 +59,9 @@ #include #include "StackTop.h" -// We need a definition of gettid(), but Linux libc implementations don't -// provide a wrapper for it. -#if defined(__linux__) +// We need a definition of gettid(), but glibc doesn't provide a +// wrapper for it. +#if defined(__GLIBC__) #include #include static inline pid_t gettid() From 27d85a817197e76872e193c0337d1df02fd31081 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Sun, 10 Apr 2016 16:57:41 -0400 Subject: [PATCH 05/18] Bug 1252283 - Re-enable the devtools animationinspector tests on e10s debug. --HG-- extra : rebase_source : 05804990198cbf4923e17d4c7bef1aaf7c24258b --- devtools/client/animationinspector/test/browser.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/devtools/client/animationinspector/test/browser.ini b/devtools/client/animationinspector/test/browser.ini index 7b70fdfed5af..1fa5d130d336 100644 --- a/devtools/client/animationinspector/test/browser.ini +++ b/devtools/client/animationinspector/test/browser.ini @@ -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 From eedb7f6dc67b96b6d2d3bcec7415e36b3c68e3a6 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Sun, 10 Apr 2016 16:57:41 -0400 Subject: [PATCH 06/18] Bug 1252348 - Re-enable the dom/canvas tests on OSX debug e10s. --HG-- extra : rebase_source : d21ccf3faa0754638fbbe14c4e7f490e37ce964c --- dom/canvas/test/mochitest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/canvas/test/mochitest.ini b/dom/canvas/test/mochitest.ini index 115bec8cf50d..4172755c37d3 100644 --- a/dom/canvas/test/mochitest.ini +++ b/dom/canvas/test/mochitest.ini @@ -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 From 7815c726470ed821e8df37b7206a5a2362128d89 Mon Sep 17 00:00:00 2001 From: Rail Aliiev Date: Sat, 9 Apr 2016 22:39:59 -0400 Subject: [PATCH 07/18] Bug 1250458 - Reclaim task before file uploads r=nthomas MozReview-Commit-ID: 55Tf1kIJu96 --HG-- extra : rebase_source : be6b59454a97a9733286652d3b3ff4b3dbef927c --- testing/mozharness/mozharness/mozilla/taskcluster_helper.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/testing/mozharness/mozharness/mozilla/taskcluster_helper.py b/testing/mozharness/mozharness/mozilla/taskcluster_helper.py index 6192f9ec3d20..a4adfb8a3fd8 100644 --- a/testing/mozharness/mozharness/mozilla/taskcluster_helper.py +++ b/testing/mozharness/mozharness/mozilla/taskcluster_helper.py @@ -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'], From 39de1dcd998d370928c1a6e257bcf6cae18bb800 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Sun, 10 Apr 2016 17:54:11 -0500 Subject: [PATCH 08/18] Backed out changeset d7d0413af62b (bug 1199023) for test failures. --- testing/mochitest/harness.xul | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/mochitest/harness.xul b/testing/mochitest/harness.xul index 3ad3d692f896..e0356abac7e5 100644 --- a/testing/mochitest/harness.xul +++ b/testing/mochitest/harness.xul @@ -84,7 +84,7 @@ function linkAndHookup(links) {
- +
From 7bd583a54c5f2cdf21f78b0dd68f704ef34ae2a6 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Sun, 10 Apr 2016 19:21:48 -0500 Subject: [PATCH 09/18] Bug 1262269. Re-enable some imagelib tests that are passing. --- image/test/mochitest/chrome.ini | 3 --- image/test/reftest/gif/reftest.list | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/image/test/mochitest/chrome.ini b/image/test/mochitest/chrome.ini index 1601c9ff51cd..25f454dca7f0 100644 --- a/image/test/mochitest/chrome.ini +++ b/image/test/mochitest/chrome.ini @@ -7,12 +7,9 @@ support-files = 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 diff --git a/image/test/reftest/gif/reftest.list b/image/test/reftest/gif/reftest.list index 10eed05c5154..1b160a07d84a 100644 --- a/image/test/reftest/gif/reftest.list +++ b/image/test/reftest/gif/reftest.list @@ -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 From 778f74db594a327ea878476b7560e2bef8883382 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Thu, 7 Apr 2016 17:40:16 +1000 Subject: [PATCH 10/18] Bug 1262727: [webm] Ensure first frame returned after seek is a keyframe. r=kinetik Same after a reset or the first frame ever returned by the demuxer. MozReview-Commit-ID: 6b7XlIk5GE4 --HG-- extra : rebase_source : 7e7b92c2ed7ea6973ad3869477b3110925a64525 --- dom/media/webm/WebMDemuxer.cpp | 7 +++++++ dom/media/webm/WebMDemuxer.h | 1 + 2 files changed, 8 insertions(+) diff --git a/dom/media/webm/WebMDemuxer.cpp b/dom/media/webm/WebMDemuxer.cpp index fc649d05d522..fb935c287499 100644 --- a/dom/media/webm/WebMDemuxer.cpp +++ b/dom/media/webm/WebMDemuxer.cpp @@ -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)); diff --git a/dom/media/webm/WebMDemuxer.h b/dom/media/webm/WebMDemuxer.h index 6f51a210e97f..d54043bc964e 100644 --- a/dom/media/webm/WebMDemuxer.h +++ b/dom/media/webm/WebMDemuxer.h @@ -242,6 +242,7 @@ private: TrackInfo::TrackType mType; UniquePtr mInfo; Maybe mNextKeyframeTime; + bool mNeedKeyframe; // Queued samples extracted by the demuxer, but not yet returned. MediaRawDataQueue mSamples; From 0e71bf2851092ee6840e6f1e8b080ac8843d609b Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Sun, 10 Apr 2016 20:53:45 -0400 Subject: [PATCH 11/18] No bug - Clean up some wpt annotation metadata. --- .../meta/XMLHttpRequest/event-progress.htm.ini | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/testing/web-platform/meta/XMLHttpRequest/event-progress.htm.ini b/testing/web-platform/meta/XMLHttpRequest/event-progress.htm.ini index b6ceb08b70c3..b7116d62602a 100644 --- a/testing/web-platform/meta/XMLHttpRequest/event-progress.htm.ini +++ b/testing/web-platform/meta/XMLHttpRequest/event-progress.htm.ini @@ -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 From f2ae6bedc66fa6a5d1edb4e161265250b9832a71 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Sun, 10 Apr 2016 21:52:07 -0400 Subject: [PATCH 12/18] Backed out changeset 98aa2df1a69f (bug 1262269) for frequent Linux failures in the re-enabled tests. --- image/test/mochitest/chrome.ini | 3 +++ image/test/reftest/gif/reftest.list | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/image/test/mochitest/chrome.ini b/image/test/mochitest/chrome.ini index 25f454dca7f0..1601c9ff51cd 100644 --- a/image/test/mochitest/chrome.ini +++ b/image/test/mochitest/chrome.ini @@ -7,9 +7,12 @@ support-files = 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 diff --git a/image/test/reftest/gif/reftest.list b/image/test/reftest/gif/reftest.list index 1b160a07d84a..10eed05c5154 100644 --- a/image/test/reftest/gif/reftest.list +++ b/image/test/reftest/gif/reftest.list @@ -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) HTTP == webcam.html blue.gif # bug 773482 +skip-if(B2G||browserIsRemote) HTTP == webcam.html blue.gif # bug 773482 From ca3431da81fe1619dacb00f81c65b3b054b701f4 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Sun, 10 Apr 2016 21:54:38 -0400 Subject: [PATCH 13/18] Bug 1253035 - Skip browser_toolbar_basic.js on e10s debug for frequent docShell leaks. --- devtools/client/shared/test/browser.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/devtools/client/shared/test/browser.ini b/devtools/client/shared/test/browser.ini index 825da0189e4d..dd9f2ca9a491 100644 --- a/devtools/client/shared/test/browser.ini +++ b/devtools/client/shared/test/browser.ini @@ -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 From bdceaeb4478070895446824e84aeef7b80852dff Mon Sep 17 00:00:00 2001 From: Dan Glastonbury Date: Wed, 6 Apr 2016 17:30:06 +1000 Subject: [PATCH 14/18] Bug 1262358 - Part 1: Split autoplay condition into statements. r=cpearce MozReview-Commit-ID: 19f4XOa4Kzw --HG-- extra : rebase_source : c6d8f6c96e1c519e43eff6144289a8fc6eea4827 --- dom/html/HTMLMediaElement.cpp | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index d35c9f9973f4..bb79e78b87ca 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -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() From 28a90df677644818650c9d6ded050982264a8560 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Sun, 10 Apr 2016 19:21:48 -0500 Subject: [PATCH 15/18] Bug 1262269. Re-enable some imagelib tests that are passing. --- image/test/mochitest/chrome.ini | 4 +--- image/test/reftest/gif/reftest.list | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/image/test/mochitest/chrome.ini b/image/test/mochitest/chrome.ini index 1601c9ff51cd..7bd7bea6ea23 100644 --- a/image/test/mochitest/chrome.ini +++ b/image/test/mochitest/chrome.ini @@ -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 diff --git a/image/test/reftest/gif/reftest.list b/image/test/reftest/gif/reftest.list index 10eed05c5154..1b160a07d84a 100644 --- a/image/test/reftest/gif/reftest.list +++ b/image/test/reftest/gif/reftest.list @@ -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 From 0c6a8d0ef69b855992ab0dbe9ff531ded3ae93b9 Mon Sep 17 00:00:00 2001 From: Sotaro Ikeda Date: Sun, 10 Apr 2016 19:51:21 -0700 Subject: [PATCH 16/18] Bug 1262601 - Handle video content as opaque in PostProcessLayers() r=mattwoodrow --- gfx/layers/Layers.cpp | 2 +- gfx/layers/Layers.h | 6 +++++ gfx/layers/composite/ImageHost.cpp | 21 +++++++++++++++ gfx/layers/composite/ImageHost.h | 2 ++ gfx/layers/composite/ImageLayerComposite.cpp | 27 ++++++++++++++++++- gfx/layers/composite/ImageLayerComposite.h | 13 +++------ .../composite/LayerManagerComposite.cpp | 2 +- gfx/layers/opengl/TextureHostOGL.cpp | 1 - 8 files changed, 61 insertions(+), 13 deletions(-) diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index 1134a9694ffd..b95938ec626e 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -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) { diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index c837d06d36f3..cf3146c690cb 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -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. diff --git a/gfx/layers/composite/ImageHost.cpp b/gfx/layers/composite/ImageHost.cpp index 74bfb1759ca0..e72e0663b7cb 100644 --- a/gfx/layers/composite/ImageHost.cpp +++ b/gfx/layers/composite/ImageHost.cpp @@ -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 ImageHost::GenEffect(const gfx::Filter& aFilter) { diff --git a/gfx/layers/composite/ImageHost.h b/gfx/layers/composite/ImageHost.h index 3860c33ff2fd..a0566d1a0bee 100644 --- a/gfx/layers/composite/ImageHost.h +++ b/gfx/layers/composite/ImageHost.h @@ -115,6 +115,8 @@ public: BIAS_POSITIVE, }; + bool IsOpaque(); + protected: struct TimedImage { RefPtr mTextureHost; diff --git a/gfx/layers/composite/ImageLayerComposite.cpp b/gfx/layers/composite/ImageLayerComposite.cpp index 337b053adebb..162c24a4319c 100644 --- a/gfx/layers/composite/ImageLayerComposite.cpp +++ b/gfx/layers/composite/ImageLayerComposite.cpp @@ -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(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() { diff --git a/gfx/layers/composite/ImageLayerComposite.h b/gfx/layers/composite/ImageLayerComposite.h index d6b8c31e6ab5..9aa226d57ad8 100644 --- a/gfx/layers/composite/ImageLayerComposite.h +++ b/gfx/layers/composite/ImageLayerComposite.h @@ -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 mImageHost; + RefPtr mImageHost; }; } // namespace layers diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 874be04cb6c4..0ff4eeca1cce 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -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); diff --git a/gfx/layers/opengl/TextureHostOGL.cpp b/gfx/layers/opengl/TextureHostOGL.cpp index d884ed07043a..c10694391447 100644 --- a/gfx/layers/opengl/TextureHostOGL.cpp +++ b/gfx/layers/opengl/TextureHostOGL.cpp @@ -531,7 +531,6 @@ SurfaceTextureHost::SetCompositor(Compositor* aCompositor) gfx::SurfaceFormat SurfaceTextureHost::GetFormat() const { - MOZ_ASSERT(mTextureSource); return mTextureSource ? mTextureSource->GetFormat() : gfx::SurfaceFormat::UNKNOWN; } From a9d4b99d8de000e240d2786b461d4c2c9eab52f2 Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Wed, 30 Mar 2016 08:59:01 +0900 Subject: [PATCH 17/18] Bug 1260572 - Replace AnimValuesStyleRule::AddEmptyValue with an overload of AddValue that takes an rvalue reference; r=heycam In the next patch in this series, we would like to update the error handling of the call to StyleAnimationValue::Interpolate in KeyframeEffectReadOnly::ComposeStyle. Using AnimValuesStyleRule::AddEmptyValue there, however, makes handling the error case difficult because we need a means of clearing the allocated StyleAnimationValue. However, simply using AnimationValuesStyleRule::AddValue means we will end up doing needless allocations for StyleAnimationValue objects (the copy constructor for which can result in performing potentially expensive heap allocations, such as when lists are deep-copied). Instead, we add a Move constructor to StyleAnimationValue and add an overload of AnimValuesStyleRule::AddValue that takes an rvalue reference. This provides a more consistent interface to AnimValuesStyleRule and avoids the unnecessary allocations from copying StyleAnimationValue objects. MozReview-Commit-ID: CaP1uPAgNnm --- dom/animation/AnimValuesStyleRule.h | 7 +++---- dom/animation/KeyframeEffect.cpp | 11 ++++++----- layout/style/StyleAnimationValue.h | 6 ++++++ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/dom/animation/AnimValuesStyleRule.h b/dom/animation/AnimValuesStyleRule.h index db8851326d9f..e2ff8cce1b54 100644 --- a/dom/animation/AnimValuesStyleRule.h +++ b/dom/animation/AnimValuesStyleRule.h @@ -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 { diff --git a/dom/animation/KeyframeEffect.cpp b/dom/animation/KeyframeEffect.cpp index 1739cd58eb5b..9c1bee5d3594 100644 --- a/dom/animation/KeyframeEffect.cpp +++ b/dom/animation/KeyframeEffect.cpp @@ -598,14 +598,12 @@ KeyframeEffectReadOnly::ComposeStyle(RefPtr& 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& aStyleRule, positionInSegment, computedTiming.mBeforeFlag); + StyleAnimationValue val; #ifdef DEBUG bool result = #endif StyleAnimationValue::Interpolate(prop.mProperty, segment->mFromValue, segment->mToValue, - valuePosition, *val); + valuePosition, val); MOZ_ASSERT(result, "interpolate must succeed now"); + + aStyleRule->AddValue(prop.mProperty, Move(val)); } } diff --git a/layout/style/StyleAnimationValue.h b/layout/style/StyleAnimationValue.h index f512b33905b3..d50dc4edd99f 100644 --- a/layout/style/StyleAnimationValue.h +++ b/layout/style/StyleAnimationValue.h @@ -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 }; From 99a1a632e392955ece6e9629814ea7431aafd471 Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Wed, 30 Mar 2016 08:59:08 +0900 Subject: [PATCH 18/18] Bug 1260572 - Use 50% switch behavior if StyleAnimationValue::Interpolate fails; r=heycam In KeyframeEffectReadOnly::ComposeStyle we call StyleAnimationValue::Interpolate but assume that it always passes. That was true when that code was only used for CSS animations and CSS transitions since they check that their animation values can be interpolated before setting up segments. However, when we set up animations using the Web Animations API we don't perform that check so it is possible for this call to fail. In that case, we could just bail, but, according to CSS Transitions we should apply a 50% switch in this case: https://drafts.csswg.org/css-transitions/#step-types (In Web Animations, specifying this is an open issue. See: https://w3c.github.io/web-animations/#specific-animation-behaviors). Bug 1064937 tracks doing this in general (we'll likely need to mark various properties as being no longer unanimatable but instead as supporting discrete animation) but we can start to introduce it now. Later in bug 1245748, CSS animations and transitions will likely start using the same code path as the Web Animations API for setting up keyframes. As a result, unless we take care to add checks that the values we set are interpolable, the 50% switch behavior will begin to apply to CSS animations and transitions too at that point. Some concerns have been raised about possible web compatibility issues around the 50% switch behavior (see [1] and [2]). For CSS animations, Chrome already supports this behavior so it should be ok at least for CSS animations. When we switch CSS transitions over to the same code path, however, we will need to be careful to add checks that the transition endpoints are interpolable (we can investigate introducing this behavior to transitions as a separate bug that can be easily backed out / preffed off). Regarding the naming of the test added here, going forward we would like to restructure the tests under web-platform-tests to better match the structure of the Web Animations since that seems to be the convention there. However, this doesn't *quite* match the structure of the spec since there are upcoming changes to the spec in this area (e.g. renaming animation behaviors to animation types). However, it should be close enough that we don't have to move it around too much in future. [1] https://drafts.csswg.org/css-transitions/#step-types [2] https://bugzilla.mozilla.org/show_bug.cgi?id=1064937#c0 MozReview-Commit-ID: KcxILrckJg9 --- dom/animation/KeyframeEffect.cpp | 20 +-- testing/web-platform/meta/MANIFEST.json | 8 +- .../animation-types/discrete-animation.html | 136 ++++++++++++++++++ 3 files changed, 150 insertions(+), 14 deletions(-) create mode 100644 testing/web-platform/tests/web-animations/animation-model/animation-types/discrete-animation.html diff --git a/dom/animation/KeyframeEffect.cpp b/dom/animation/KeyframeEffect.cpp index 9c1bee5d3594..63e7c9f68412 100644 --- a/dom/animation/KeyframeEffect.cpp +++ b/dom/animation/KeyframeEffect.cpp @@ -617,16 +617,16 @@ KeyframeEffectReadOnly::ComposeStyle(RefPtr& aStyleRule, computedTiming.mBeforeFlag); StyleAnimationValue val; -#ifdef DEBUG - bool result = -#endif - StyleAnimationValue::Interpolate(prop.mProperty, - segment->mFromValue, - segment->mToValue, - valuePosition, val); - MOZ_ASSERT(result, "interpolate must succeed now"); - - aStyleRule->AddValue(prop.mProperty, Move(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); + } } } diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index b77881be3152..6a82b626b542 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -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" diff --git a/testing/web-platform/tests/web-animations/animation-model/animation-types/discrete-animation.html b/testing/web-platform/tests/web-animations/animation-model/animation-types/discrete-animation.html new file mode 100644 index 000000000000..864a9e2845b5 --- /dev/null +++ b/testing/web-platform/tests/web-animations/animation-model/animation-types/discrete-animation.html @@ -0,0 +1,136 @@ + + +Tests for discrete animation + + + + + + +
+