From 7dd48d87603c179cced3ad67fc07083e1be77e66 Mon Sep 17 00:00:00 2001 From: Cosmin Sabou Date: Wed, 17 Jan 2024 03:17:31 +0200 Subject: [PATCH] Backed out changeset 28c56a4f3af6 (bug 1874810) for causing Moz2DImageRenderer related failures. CLOSED TREE --- dom/media/test/reftest/color_quads/reftest.list | 2 +- gfx/2d/DrawTargetRecording.cpp | 31 +----- gfx/2d/DrawTargetRecording.h | 13 --- gfx/2d/RecordedEvent.cpp | 2 - gfx/2d/RecordedEvent.h | 1 - gfx/2d/RecordedEventImpl.h | 121 +++++------------------- layout/reftests/bugs/reftest.list | 2 +- layout/reftests/text-stroke/reftest.list | 18 ++-- 8 files changed, 41 insertions(+), 149 deletions(-) rewrite layout/reftests/text-stroke/reftest.list (76%) diff --git a/dom/media/test/reftest/color_quads/reftest.list b/dom/media/test/reftest/color_quads/reftest.list index 6071733f7674..a5ad475b879b 100644 --- a/dom/media/test/reftest/color_quads/reftest.list +++ b/dom/media/test/reftest/color_quads/reftest.list @@ -17,7 +17,7 @@ defaults pref(media.av1.enabled,true) fuzzy(16-51,5234-5622) fuzzy-if(swgl,32-38,1600-91746) fuzzy-if(useDrawSnapshot,16-16,11600-11600) fuzzy-if(OSX,16-73,5212-5622) == ../reftest_video.html?src=color_quads/720p.png.bt709.bt709.tv.yuv420p.av1.webm ../reftest_img.html?src=color_quads/720p.png fuzzy-if(winWidget&&swgl,0-20,0-5620) fuzzy-if(winWidget&&!swgl,0-1,0-78) fuzzy-if(Android,254-255,273680-273807) fuzzy-if(OSX,0-35,0-1947) fuzzy-if(OSX&&swgl,0-67,0-5451) fuzzy-if(appleSilicon,30-48,1760-187409) == ../reftest_video.html?src=color_quads/720p.png.bt709.bt709.tv.yuv420p.vp9.webm ../reftest_video.html?src=color_quads/720p.png.bt709.bt709.tv.yuv420p.av1.webm fuzzy-if(winWidget,0-1,0-78) == ../reftest_video.html?src=color_quads/720p.png.bt709.bt709.tv.yuv420p.av1.mp4 ../reftest_video.html?src=color_quads/720p.png.bt709.bt709.tv.yuv420p.av1.webm -skip-if(winWidget&&isCoverageBuild) fuzzy(0-16,75-1941) fuzzy-if(Android,28-255,273680-359920) fuzzy-if(OSX,30-32,187326-187407) fuzzy-if(appleSilicon,30-48,1835-187409) == ../reftest_video.html?src=color_quads/720p.png.bt709.bt709.tv.yuv420p.h264.mp4 ../reftest_video.html?src=color_quads/720p.png.bt709.bt709.tv.yuv420p.av1.webm +skip-if(winWidget&&isCoverageBuild) fuzzy(0-16,75-1941) fuzzy-if(Android,254-255,273680-273807) fuzzy-if(OSX,30-32,187326-187407) fuzzy-if(appleSilicon,30-48,1835-187409) == ../reftest_video.html?src=color_quads/720p.png.bt709.bt709.tv.yuv420p.h264.mp4 ../reftest_video.html?src=color_quads/720p.png.bt709.bt709.tv.yuv420p.av1.webm fuzzy-if(winWidget&&swgl,0-20,0-5620) fuzzy-if(winWidget&&!swgl,0-1,0-78) fuzzy-if(Android,254-255,273680-273807) fuzzy-if(OSX,0-35,0-1947) fuzzy-if(OSX&&swgl,0-67,0-5451) fuzzy-if(appleSilicon,30-48,1760-187409) == ../reftest_video.html?src=color_quads/720p.png.bt709.bt709.tv.yuv420p.vp9.mp4 ../reftest_video.html?src=color_quads/720p.png.bt709.bt709.tv.yuv420p.av1.webm skip-if(Android) fuzzy(16-48,8107-8818) fuzzy-if(winWidget&&swgl,31-38,8240-184080) fuzzy-if(appleSilicon,33-38,8819-11705) fuzzy-if(useDrawSnapshot,20-20,187200-187200) == ../reftest_video.html?src=color_quads/720p.png.bt709.bt709.pc.yuv420p.av1.webm ../reftest_img.html?src=color_quads/720p.png diff --git a/gfx/2d/DrawTargetRecording.cpp b/gfx/2d/DrawTargetRecording.cpp index 60a86a786f86..6e7a3dc54b68 100644 --- a/gfx/2d/DrawTargetRecording.cpp +++ b/gfx/2d/DrawTargetRecording.cpp @@ -303,11 +303,10 @@ static void RecordingFontUserDataDestroyFunc(void* aUserData) { delete userData; } -void DrawTargetRecording::DrawGlyphs(ScaledFont* aFont, +void DrawTargetRecording::FillGlyphs(ScaledFont* aFont, const GlyphBuffer& aBuffer, const Pattern& aPattern, - const DrawOptions& aOptions, - const StrokeOptions* aStrokeOptions) { + const DrawOptions& aOptions) { if (!aFont) { return; } @@ -355,29 +354,9 @@ void DrawTargetRecording::DrawGlyphs(ScaledFont* aFont, userData->recorder->AddScaledFont(aFont); } - if (aStrokeOptions) { - mRecorder->RecordEvent( - this, RecordedStrokeGlyphs(aFont, aPattern, *aStrokeOptions, aOptions, - aBuffer.mGlyphs, aBuffer.mNumGlyphs)); - } else { - mRecorder->RecordEvent(RecordedFillGlyphs( - aFont, aPattern, aOptions, aBuffer.mGlyphs, aBuffer.mNumGlyphs)); - } -} - -void DrawTargetRecording::FillGlyphs(ScaledFont* aFont, - const GlyphBuffer& aBuffer, - const Pattern& aPattern, - const DrawOptions& aOptions) { - DrawGlyphs(aFont, aBuffer, aPattern, aOptions); -} - -void DrawTargetRecording::StrokeGlyphs(ScaledFont* aFont, - const GlyphBuffer& aBuffer, - const Pattern& aPattern, - const StrokeOptions& aStrokeOptions, - const DrawOptions& aOptions) { - DrawGlyphs(aFont, aBuffer, aPattern, aOptions, &aStrokeOptions); + mRecorder->RecordEvent( + this, RecordedFillGlyphs(aFont, aPattern, aOptions, aBuffer.mGlyphs, + aBuffer.mNumGlyphs)); } void DrawTargetRecording::Mask(const Pattern& aSource, const Pattern& aMask, diff --git a/gfx/2d/DrawTargetRecording.h b/gfx/2d/DrawTargetRecording.h index 0bae330ed5d6..1062b183f0f7 100644 --- a/gfx/2d/DrawTargetRecording.h +++ b/gfx/2d/DrawTargetRecording.h @@ -170,14 +170,6 @@ class DrawTargetRecording : public DrawTarget { const Pattern& aPattern, const DrawOptions& aOptions = DrawOptions()) override; - /** - * Stroke a series of glyphs on the draw target with a certain source pattern. - */ - virtual void StrokeGlyphs( - ScaledFont* aFont, const GlyphBuffer& aBuffer, const Pattern& aPattern, - const StrokeOptions& aStrokeOptions = StrokeOptions(), - const DrawOptions& aOptions = DrawOptions()) override; - /* * This takes a source pattern and a mask, and composites the source pattern * onto the destination surface using the alpha channel of the mask pattern @@ -378,11 +370,6 @@ class DrawTargetRecording : public DrawTarget { already_AddRefed EnsurePathStored(const Path* aPath); void EnsurePatternDependenciesStored(const Pattern& aPattern); - void DrawGlyphs(ScaledFont* aFont, const GlyphBuffer& aBuffer, - const Pattern& aPattern, - const DrawOptions& aOptions = DrawOptions(), - const StrokeOptions* aStrokeOptions = nullptr); - RefPtr mRecorder; RefPtr mFinalDT; IntRect mRect; diff --git a/gfx/2d/RecordedEvent.cpp b/gfx/2d/RecordedEvent.cpp index 5cd3595ee53e..fa2150dd0897 100644 --- a/gfx/2d/RecordedEvent.cpp +++ b/gfx/2d/RecordedEvent.cpp @@ -60,8 +60,6 @@ std::string RecordedEvent::GetEventName(EventType aType) { return "Fill"; case FILLGLYPHS: return "FillGlyphs"; - case STROKEGLYPHS: - return "StrokeGlyphs"; case MASK: return "Mask"; case STROKE: diff --git a/gfx/2d/RecordedEvent.h b/gfx/2d/RecordedEvent.h index 6ecb4229a55f..f8ebc94cdc83 100644 --- a/gfx/2d/RecordedEvent.h +++ b/gfx/2d/RecordedEvent.h @@ -384,7 +384,6 @@ class RecordedEvent { FILL, FILLCIRCLE, FILLGLYPHS, - STROKEGLYPHS, MASK, STROKE, DRAWSURFACE, diff --git a/gfx/2d/RecordedEventImpl.h b/gfx/2d/RecordedEventImpl.h index 73a522f9c040..6e39fccb8bd5 100644 --- a/gfx/2d/RecordedEventImpl.h +++ b/gfx/2d/RecordedEventImpl.h @@ -404,22 +404,21 @@ class RecordedFillCircle : public RecordedEventDerived { DrawOptions mOptions; }; -template -class RecordedDrawGlyphs : public RecordedEventDerived { +class RecordedFillGlyphs : public RecordedEventDerived { public: - RecordedDrawGlyphs(RecordedEvent::EventType aType, ReferencePtr aScaledFont, - const Pattern& aPattern, const DrawOptions& aOptions, - const Glyph* aGlyphs, uint32_t aNumGlyphs) - : RecordedEventDerived(aType), + RecordedFillGlyphs(ReferencePtr aScaledFont, const Pattern& aPattern, + const DrawOptions& aOptions, const Glyph* aGlyphs, + uint32_t aNumGlyphs) + : RecordedEventDerived(FILLGLYPHS), mScaledFont(aScaledFont), mPattern(), mOptions(aOptions) { - RecordedEventDerived::StorePattern(mPattern, aPattern); + StorePattern(mPattern, aPattern); mNumGlyphs = aNumGlyphs; mGlyphs = new Glyph[aNumGlyphs]; memcpy(mGlyphs, aGlyphs, sizeof(Glyph) * aNumGlyphs); } - virtual ~RecordedDrawGlyphs(); + virtual ~RecordedFillGlyphs(); bool PlayEvent(Translator* aTranslator) const override; @@ -427,15 +426,13 @@ class RecordedDrawGlyphs : public RecordedEventDerived { void Record(S& aStream) const; void OutputSimpleEventInfo(std::stringstream& aStringStream) const override; - protected: + std::string GetName() const override { return "FillGlyphs"; } + + private: friend class RecordedEvent; template - RecordedDrawGlyphs(RecordedEvent::EventType aType, S& aStream); - - virtual void DrawGlyphs(DrawTarget* aDT, ScaledFont* aScaledFont, - const GlyphBuffer& aBuffer, - const Pattern& aPattern) const = 0; + MOZ_IMPLICIT RecordedFillGlyphs(S& aStream); ReferencePtr mScaledFont; PatternStorage mPattern; @@ -444,66 +441,6 @@ class RecordedDrawGlyphs : public RecordedEventDerived { uint32_t mNumGlyphs = 0; }; -class RecordedFillGlyphs : public RecordedDrawGlyphs { - public: - RecordedFillGlyphs(ReferencePtr aScaledFont, const Pattern& aPattern, - const DrawOptions& aOptions, const Glyph* aGlyphs, - uint32_t aNumGlyphs) - : RecordedDrawGlyphs(FILLGLYPHS, aScaledFont, aPattern, aOptions, aGlyphs, - aNumGlyphs) {} - - std::string GetName() const override { return "FillGlyphs"; } - - private: - friend class RecordedEvent; - - template - MOZ_IMPLICIT RecordedFillGlyphs(S& aStream) - : RecordedDrawGlyphs(FILLGLYPHS, aStream) {} - - void DrawGlyphs(DrawTarget* aDT, ScaledFont* aScaledFont, - const GlyphBuffer& aBuffer, - const Pattern& aPattern) const override { - aDT->FillGlyphs(aScaledFont, aBuffer, aPattern, mOptions); - } -}; - -class RecordedStrokeGlyphs : public RecordedDrawGlyphs { - public: - RecordedStrokeGlyphs(ReferencePtr aScaledFont, const Pattern& aPattern, - const StrokeOptions& aStrokeOptions, - const DrawOptions& aOptions, const Glyph* aGlyphs, - uint32_t aNumGlyphs) - : RecordedDrawGlyphs(STROKEGLYPHS, aScaledFont, aPattern, aOptions, - aGlyphs, aNumGlyphs), - mStrokeOptions(aStrokeOptions) {} - - std::string GetName() const override { return "StrokeGlyphs"; } - - template - void Record(S& aStream) const { - RecordedDrawGlyphs::Record(aStream); - RecordStrokeOptions(aStream, mStrokeOptions); - } - - private: - friend class RecordedEvent; - - template - MOZ_IMPLICIT RecordedStrokeGlyphs(S& aStream) - : RecordedDrawGlyphs(STROKEGLYPHS, aStream) { - ReadStrokeOptions(aStream, mStrokeOptions); - } - - void DrawGlyphs(DrawTarget* aDT, ScaledFont* aScaledFont, - const GlyphBuffer& aBuffer, - const Pattern& aPattern) const override { - aDT->StrokeGlyphs(aScaledFont, aBuffer, aPattern, mStrokeOptions, mOptions); - } - - StrokeOptions mStrokeOptions; -}; - class RecordedMask : public RecordedEventDerived { public: RecordedMask(const Pattern& aSource, const Pattern& aMask, @@ -2592,18 +2529,14 @@ RecordedFillCircle::RecordedFillCircle(S& aStream) inline void RecordedFillCircle::OutputSimpleEventInfo( std::stringstream& aStringStream) const { - aStringStream << "FillCircle (" << mCircle.origin.x << ", " + aStringStream << "StrokeCircle (" << mCircle.origin.x << ", " << mCircle.origin.y << " - " << mCircle.radius << ")"; OutputSimplePatternInfo(mPattern, aStringStream); } -template -inline RecordedDrawGlyphs::~RecordedDrawGlyphs() { - delete[] mGlyphs; -} +inline RecordedFillGlyphs::~RecordedFillGlyphs() { delete[] mGlyphs; } -template -inline bool RecordedDrawGlyphs::PlayEvent(Translator* aTranslator) const { +inline bool RecordedFillGlyphs::PlayEvent(Translator* aTranslator) const { if (mNumGlyphs > 0 && !mGlyphs) { // Glyph allocation failed return false; @@ -2622,18 +2555,17 @@ inline bool RecordedDrawGlyphs::PlayEvent(Translator* aTranslator) const { GlyphBuffer buffer; buffer.mGlyphs = mGlyphs; buffer.mNumGlyphs = mNumGlyphs; - DrawGlyphs(dt, scaledFont, buffer, *GenericPattern(mPattern, aTranslator)); + dt->FillGlyphs(scaledFont, buffer, *GenericPattern(mPattern, aTranslator), + mOptions); return true; } -template template -RecordedDrawGlyphs::RecordedDrawGlyphs(RecordedEvent::EventType aType, - S& aStream) - : RecordedEventDerived(aType) { +RecordedFillGlyphs::RecordedFillGlyphs(S& aStream) + : RecordedEventDerived(FILLGLYPHS) { ReadElement(aStream, mScaledFont); ReadDrawOptions(aStream, mOptions); - this->ReadPatternData(aStream, mPattern); + ReadPatternData(aStream, mPattern); ReadElement(aStream, mNumGlyphs); if (!aStream.good() || mNumGlyphs <= 0) { return; @@ -2641,7 +2573,7 @@ RecordedDrawGlyphs::RecordedDrawGlyphs(RecordedEvent::EventType aType, mGlyphs = new (fallible) Glyph[mNumGlyphs]; if (!mGlyphs) { - gfxCriticalNote << "RecordedDrawGlyphs failed to allocate glyphs of size " + gfxCriticalNote << "RecordedFillGlyphs failed to allocate glyphs of size " << mNumGlyphs; aStream.SetIsBad(); } else { @@ -2649,21 +2581,19 @@ RecordedDrawGlyphs::RecordedDrawGlyphs(RecordedEvent::EventType aType, } } -template template -void RecordedDrawGlyphs::Record(S& aStream) const { +void RecordedFillGlyphs::Record(S& aStream) const { WriteElement(aStream, mScaledFont); WriteElement(aStream, mOptions); - this->RecordPatternData(aStream, mPattern); + RecordPatternData(aStream, mPattern); WriteElement(aStream, mNumGlyphs); aStream.write((char*)mGlyphs, sizeof(Glyph) * mNumGlyphs); } -template -inline void RecordedDrawGlyphs::OutputSimpleEventInfo( +inline void RecordedFillGlyphs::OutputSimpleEventInfo( std::stringstream& aStringStream) const { - aStringStream << this->GetName() << " (" << mScaledFont << ") "; - this->OutputSimplePatternInfo(mPattern, aStringStream); + aStringStream << "FillGlyphs (" << mScaledFont << ") "; + OutputSimplePatternInfo(mPattern, aStringStream); } inline bool RecordedMask::PlayEvent(Translator* aTranslator) const { @@ -4250,7 +4180,6 @@ inline void RecordedDestination::OutputSimpleEventInfo( f(FILL, RecordedFill); \ f(FILLCIRCLE, RecordedFillCircle); \ f(FILLGLYPHS, RecordedFillGlyphs); \ - f(STROKEGLYPHS, RecordedStrokeGlyphs); \ f(MASK, RecordedMask); \ f(STROKE, RecordedStroke); \ f(DRAWSURFACE, RecordedDrawSurface); \ diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 7630cb9d6d93..572500840c23 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -2096,7 +2096,7 @@ skip-if(Android) == 1727172-1.xhtml 1727172-1-ref.html == 1726663-1.html 1726663-1-ref.html == 1727016-1.html 1727016-1-ref.html != 1730314-1.html 1730314-1-ref.html -fuzzy(0-3,0-19) fuzzy-if(Android,0-3,0-1901) fuzzy-if(winWidget,0-154,0-118) == 1738700-1.html 1738700-1-ref.html +fuzzy(0-3,0-3) fuzzy-if(Android,0-3,0-1901) fuzzy-if(winWidget,0-154,0-118) == 1738700-1.html 1738700-1-ref.html # Have to skip android because it doesn't set up example.org as a local host, # so the test crashes there. diff --git a/layout/reftests/text-stroke/reftest.list b/layout/reftests/text-stroke/reftest.list dissimilarity index 76% index 13e1e08d1265..356e49e35c59 100644 --- a/layout/reftests/text-stroke/reftest.list +++ b/layout/reftests/text-stroke/reftest.list @@ -1,9 +1,9 @@ -# basic tests for webkit-text-stroke -# fuzzy is needed here for platform dependent backends -# These fail on Linux without webrender due to lack of antialiasing of the HTML text stroke -fuzzy(0-255,0-4100) == webkit-text-stroke-property-001.html webkit-text-stroke-property-001-ref.html -fuzzy(0-255,0-4400) == webkit-text-stroke-property-002.html webkit-text-stroke-property-002-ref.html -fuzzy(0-255,0-4100) == webkit-text-stroke-property-003.html webkit-text-stroke-property-003-ref.html -fuzzy(0-255,0-3000) == webkit-text-stroke-property-004.html webkit-text-stroke-property-004-ref.html -fuzzy(0-255,0-4100) == webkit-text-stroke-property-005.html webkit-text-stroke-property-005-ref.html -fuzzy(0-255,0-400) == webkit-text-stroke-property-006.html webkit-text-stroke-property-006-ref.html +# basic tests for webkit-text-stroke +# fuzzy is needed here for platform dependent backends +# These fail on Linux without webrender due to lack of antialiasing of the HTML text stroke +fuzzy(0-64,0-776) fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)&&(/^aarch64-msvc/.test(xulRuntime.XPCOMABI)||(winWidget&&!layersGPUAccelerated)),0-80,0-2822) == webkit-text-stroke-property-001.html webkit-text-stroke-property-001-ref.html +fuzzy(0-4,0-27) fuzzy-if(geckoview,0-4,0-1476) fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)&&(/^aarch64-msvc/.test(xulRuntime.XPCOMABI)||(winWidget&&!layersGPUAccelerated)),0-125,0-3725) == webkit-text-stroke-property-002.html webkit-text-stroke-property-002-ref.html +fuzzy(0-64,0-528) fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)&&(/^aarch64-msvc/.test(xulRuntime.XPCOMABI)||(winWidget&&!layersGPUAccelerated)),0-74,0-2596) == webkit-text-stroke-property-003.html webkit-text-stroke-property-003-ref.html +fuzzy(0-64,0-575) fuzzy-if(geckoview&&device,0-64,0-599) fuzzy-if(geckoview&&emulator,96-96,58-58) fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)&&(/^aarch64-msvc/.test(xulRuntime.XPCOMABI)||(winWidget&&!layersGPUAccelerated)),0-85,0-2147) == webkit-text-stroke-property-004.html webkit-text-stroke-property-004-ref.html +fuzzy(0-64,0-860) fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)&&(/^aarch64-msvc/.test(xulRuntime.XPCOMABI)||(winWidget&&!layersGPUAccelerated)),0-80,0-2822) == webkit-text-stroke-property-005.html webkit-text-stroke-property-005-ref.html +fuzzy(0-71,0-10) fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)&&(/^aarch64-msvc/.test(xulRuntime.XPCOMABI)||(winWidget&&!layersGPUAccelerated)),0-48,0-351) == webkit-text-stroke-property-006.html webkit-text-stroke-property-006-ref.html -- 2.11.4.GIT