From 7f08cf437abbacaf7b381af64c5ea6ffd8c503b6 Mon Sep 17 00:00:00 2001 From: "mr. m" <91018726+mr-cheffy@users.noreply.github.com> Date: Tue, 26 May 2026 22:27:54 +0200 Subject: [PATCH] gh-13844: Part 2 - Fixed boosts not working for linear gradients (gh-13882) Signed-off-by: mr. m <91018726+mr-cheffy@users.noreply.github.com> --- src/accessible/base/TextAttrs-cpp.patch | 18 +++++ .../ia2/ia2AccessibleComponent-cpp.patch | 13 ++++ .../canvas/CanvasRenderingContext2D-cpp.patch | 14 ++++ src/dom/html/HTMLInputElement-cpp.patch | 13 ++++ .../libeditor/HTMLAbsPositionEditor-cpp.patch | 13 ++++ src/gfx/thebes/gfxUtils-cpp.patch | 16 ++++ src/gfx/thebes/gfxUtils-h.patch | 23 ++++++ .../painting/nsCSSRenderingBorders-cpp.patch | 14 ++++ .../nsCSSRenderingGradients-cpp.patch | 78 +++++++++++++++++++ .../painting/nsCSSRenderingGradients-h.patch | 59 ++++++++++++++ src/layout/painting/nsImageRenderer-cpp.patch | 40 ++++++++++ src/layout/style/GeckoBindings-cpp.patch | 13 ++++ src/layout/style/StyleColor-cpp.patch | 16 +++- src/layout/style/nsStyleStruct-cpp.patch | 13 ++++ src/layout/svg/SVGContextPaint-cpp.patch | 13 ++++ src/layout/svg/SVGGradientFrame-cpp.patch | 42 ++++++++++ src/layout/svg/SVGImageContext-cpp.patch | 21 +++++ src/layout/svg/SVGUtils-cpp.patch | 60 ++++++++++++++ src/layout/svg/SVGUtils-h.patch | 13 ++++ src/layout/xul/tree/nsTreeBodyFrame-cpp.patch | 11 ++- src/servo/ports/geckolib/cbindgen-toml.patch | 6 +- src/widget/ScrollbarDrawing-cpp.patch | 23 ++++++ src/widget/ScrollbarDrawingCocoa-cpp.patch | 15 ++++ src/widget/ScrollbarDrawingWin11-cpp.patch | 22 ++++++ src/widget/ThemeColors-cpp.patch | 13 ++++ src/zen/boosts/nsZenBoostsBackend.cpp | 23 +++++- src/zen/common/styles/zen-popup.css | 19 +---- 27 files changed, 599 insertions(+), 25 deletions(-) create mode 100644 src/accessible/base/TextAttrs-cpp.patch create mode 100644 src/accessible/windows/ia2/ia2AccessibleComponent-cpp.patch create mode 100644 src/dom/canvas/CanvasRenderingContext2D-cpp.patch create mode 100644 src/dom/html/HTMLInputElement-cpp.patch create mode 100644 src/editor/libeditor/HTMLAbsPositionEditor-cpp.patch create mode 100644 src/gfx/thebes/gfxUtils-cpp.patch create mode 100644 src/gfx/thebes/gfxUtils-h.patch create mode 100644 src/layout/painting/nsCSSRenderingBorders-cpp.patch create mode 100644 src/layout/painting/nsCSSRenderingGradients-cpp.patch create mode 100644 src/layout/painting/nsCSSRenderingGradients-h.patch create mode 100644 src/layout/painting/nsImageRenderer-cpp.patch create mode 100644 src/layout/style/GeckoBindings-cpp.patch create mode 100644 src/layout/style/nsStyleStruct-cpp.patch create mode 100644 src/layout/svg/SVGContextPaint-cpp.patch create mode 100644 src/layout/svg/SVGGradientFrame-cpp.patch create mode 100644 src/layout/svg/SVGImageContext-cpp.patch create mode 100644 src/layout/svg/SVGUtils-cpp.patch create mode 100644 src/layout/svg/SVGUtils-h.patch create mode 100644 src/widget/ScrollbarDrawing-cpp.patch create mode 100644 src/widget/ScrollbarDrawingCocoa-cpp.patch create mode 100644 src/widget/ScrollbarDrawingWin11-cpp.patch create mode 100644 src/widget/ThemeColors-cpp.patch diff --git a/src/accessible/base/TextAttrs-cpp.patch b/src/accessible/base/TextAttrs-cpp.patch new file mode 100644 index 000000000..b88ca20d4 --- /dev/null +++ b/src/accessible/base/TextAttrs-cpp.patch @@ -0,0 +1,18 @@ +diff --git a/accessible/base/TextAttrs.cpp b/accessible/base/TextAttrs.cpp +index d2ce06bef67ecb6d6ccb798a62d7f2759dd9da18..fb4952df9aa54d4085a282dc269a48ad72979b8b 100644 +--- a/accessible/base/TextAttrs.cpp ++++ b/accessible/base/TextAttrs.cpp +@@ -237,11 +237,11 @@ bool TextAttrsMgr::BGColorTextAttr::GetColor(nsIFrame* aFrame, + TextAttrsMgr::ColorTextAttr::ColorTextAttr(nsIFrame* aRootFrame, + nsIFrame* aFrame) + : TTextAttr(!aFrame) { +- mRootNativeValue = aRootFrame->StyleText()->mColor.ToColor(); ++ mRootNativeValue = aRootFrame->StyleText()->mColor.ToColor(aRootFrame); + mIsRootDefined = true; + + if (aFrame) { +- mNativeValue = aFrame->StyleText()->mColor.ToColor(); ++ mNativeValue = aFrame->StyleText()->mColor.ToColor(aFrame); + mIsDefined = true; + } + } diff --git a/src/accessible/windows/ia2/ia2AccessibleComponent-cpp.patch b/src/accessible/windows/ia2/ia2AccessibleComponent-cpp.patch new file mode 100644 index 000000000..d751fa9b8 --- /dev/null +++ b/src/accessible/windows/ia2/ia2AccessibleComponent-cpp.patch @@ -0,0 +1,13 @@ +diff --git a/accessible/windows/ia2/ia2AccessibleComponent.cpp b/accessible/windows/ia2/ia2AccessibleComponent.cpp +index 7837fdee3db339543f8b3d95dcb23ebe99aed8dc..207adf3ded9848b84ec89e94f80e8e02f161923c 100644 +--- a/accessible/windows/ia2/ia2AccessibleComponent.cpp ++++ b/accessible/windows/ia2/ia2AccessibleComponent.cpp +@@ -81,7 +81,7 @@ ia2AccessibleComponent::get_foreground(IA2Color* aForeground) { + if (!acc) return CO_E_OBJNOTCONNECTED; + + nsIFrame* frame = acc->GetFrame(); +- if (frame) *aForeground = frame->StyleText()->mColor.ToColor(); ++ if (frame) *aForeground = frame->StyleText()->mColor.ToColor(frame); + + return S_OK; + } diff --git a/src/dom/canvas/CanvasRenderingContext2D-cpp.patch b/src/dom/canvas/CanvasRenderingContext2D-cpp.patch new file mode 100644 index 000000000..5a4821efc --- /dev/null +++ b/src/dom/canvas/CanvasRenderingContext2D-cpp.patch @@ -0,0 +1,14 @@ +diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp +index ca400d3aed179ebef8e005206f29b419ae56afc4..4d4e56f4a222bd61dea82638f3e0b30fbe56a176 100644 +--- a/dom/canvas/CanvasRenderingContext2D.cpp ++++ b/dom/canvas/CanvasRenderingContext2D.cpp +@@ -1326,7 +1326,8 @@ Maybe CanvasRenderingContext2D::ParseColor( + RefPtr canvasStyle = + nsComputedDOMStyle::GetComputedStyle(mCanvasElement); + if (canvasStyle) { +- return Some(canvasStyle->StyleText()->mColor.ToColor()); ++ return Some(canvasStyle->StyleText()->mColor.ToColor( ++ mCanvasElement->GetPrimaryFrame())); + } + } + return data.mColor; diff --git a/src/dom/html/HTMLInputElement-cpp.patch b/src/dom/html/HTMLInputElement-cpp.patch new file mode 100644 index 000000000..cae2a6ce0 --- /dev/null +++ b/src/dom/html/HTMLInputElement-cpp.patch @@ -0,0 +1,13 @@ +diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp +index 3374a88b9335de1659df548fe8c18610f675b336..540f22697e7b85bca2fd6d3fe952ed3944216e17 100644 +--- a/dom/html/HTMLInputElement.cpp ++++ b/dom/html/HTMLInputElement.cpp +@@ -768,7 +768,7 @@ static void SerializeColorForHTMLCompatibility(const StyleAbsoluteColor& aColor, + // Raw StyleAbsoluteColor can have floats outside of 0-1 range e.g. when + // display-p3 color is converted to srgb, and ToColor guarantees to fit the + // values within the range. +- nscolor color = aColor.ToColor(); ++ nscolor color = aColor.ToColor(nullptr); + aResult.Truncate(); + aResult.AppendPrintf("#%02x%02x%02x", NS_GET_R(color), NS_GET_G(color), + NS_GET_B(color)); diff --git a/src/editor/libeditor/HTMLAbsPositionEditor-cpp.patch b/src/editor/libeditor/HTMLAbsPositionEditor-cpp.patch new file mode 100644 index 000000000..919f7a30c --- /dev/null +++ b/src/editor/libeditor/HTMLAbsPositionEditor-cpp.patch @@ -0,0 +1,13 @@ +diff --git a/editor/libeditor/HTMLAbsPositionEditor.cpp b/editor/libeditor/HTMLAbsPositionEditor.cpp +index 44bd8ba90e9828423742d768e64ad6204b3cf134..49d5c9512137ce28ac463223098515f6912452b1 100644 +--- a/editor/libeditor/HTMLAbsPositionEditor.cpp ++++ b/editor/libeditor/HTMLAbsPositionEditor.cpp +@@ -1001,7 +1001,7 @@ nsresult HTMLEditor::GetTemporaryStyleForFocusedPositionedElement( + + static const uint8_t kBlackBgTrigger = 0xd0; + +- auto color = style->StyleText()->mColor.ToColor(); ++ auto color = style->StyleText()->mColor.ToColor(aElement.GetPrimaryFrame()); + if (NS_GET_R(color) >= kBlackBgTrigger && + NS_GET_G(color) >= kBlackBgTrigger && + NS_GET_B(color) >= kBlackBgTrigger) { diff --git a/src/gfx/thebes/gfxUtils-cpp.patch b/src/gfx/thebes/gfxUtils-cpp.patch new file mode 100644 index 000000000..4227df26d --- /dev/null +++ b/src/gfx/thebes/gfxUtils-cpp.patch @@ -0,0 +1,16 @@ +diff --git a/gfx/thebes/gfxUtils.cpp b/gfx/thebes/gfxUtils.cpp +index 6c19c572f06e8c4c97ce3f9dd390a32832e2f527..d11cbad2ee32a1507316809893e9c42a883e6c12 100644 +--- a/gfx/thebes/gfxUtils.cpp ++++ b/gfx/thebes/gfxUtils.cpp +@@ -1743,8 +1743,9 @@ DeviceColor ToDeviceColor(nscolor aColor) { + return ToDeviceColor(sRGBColor::FromABGR(aColor)); + } + +-DeviceColor ToDeviceColor(const StyleAbsoluteColor& aColor) { +- return ToDeviceColor(aColor.ToColor()); ++DeviceColor ToDeviceColor(const StyleAbsoluteColor& aColor, ++ const nsIFrame* aFrame) { ++ return ToDeviceColor(aColor.ToColor(aFrame)); + } + + sRGBColor ToSRGBColor(const StyleAbsoluteColor& aColor) { diff --git a/src/gfx/thebes/gfxUtils-h.patch b/src/gfx/thebes/gfxUtils-h.patch new file mode 100644 index 000000000..548a9875a --- /dev/null +++ b/src/gfx/thebes/gfxUtils-h.patch @@ -0,0 +1,23 @@ +diff --git a/gfx/thebes/gfxUtils.h b/gfx/thebes/gfxUtils.h +index 55f874429fd8cbb7a0a469eba33f6c777a5bc5f7..8cf0567d81fcae7413cee6df9471d1fa1738fc4a 100644 +--- a/gfx/thebes/gfxUtils.h ++++ b/gfx/thebes/gfxUtils.h +@@ -598,6 +598,9 @@ class ElementOrArray { + }; + + struct StyleAbsoluteColor; ++} // namespace mozilla ++class nsIFrame; ++namespace mozilla { + + namespace gfx { + +@@ -609,7 +612,7 @@ namespace gfx { + * applicable). + */ + DeviceColor ToDeviceColor(const sRGBColor&); +-DeviceColor ToDeviceColor(const StyleAbsoluteColor&); ++DeviceColor ToDeviceColor(const StyleAbsoluteColor&, const nsIFrame*); + DeviceColor ToDeviceColor(nscolor); + + sRGBColor ToSRGBColor(const StyleAbsoluteColor&); diff --git a/src/layout/painting/nsCSSRenderingBorders-cpp.patch b/src/layout/painting/nsCSSRenderingBorders-cpp.patch new file mode 100644 index 000000000..8837c1382 --- /dev/null +++ b/src/layout/painting/nsCSSRenderingBorders-cpp.patch @@ -0,0 +1,14 @@ +diff --git a/layout/painting/nsCSSRenderingBorders.cpp b/layout/painting/nsCSSRenderingBorders.cpp +index fd2524fd78b1709363afda35e4b0d4320913d9ec..c5b90bc789cdd7f8b0b661ca99b8c7f4d01e6d68 100644 +--- a/layout/painting/nsCSSRenderingBorders.cpp ++++ b/layout/painting/nsCSSRenderingBorders.cpp +@@ -3624,7 +3624,8 @@ ImgDrawResult nsCSSBorderImageRenderer::CreateWebRenderCommands( + case StyleImage::Tag::Gradient: { + const StyleGradient& gradient = *mImageRenderer.GetGradientData(); + nsCSSGradientRenderer renderer = nsCSSGradientRenderer::Create( +- aForFrame->PresContext(), aForFrame->Style(), gradient, mImageSize); ++ aForFrame->PresContext(), aForFrame->Style(), aForFrame, gradient, ++ mImageSize); + + wr::ExtendMode extendMode; + nsTArray stops; diff --git a/src/layout/painting/nsCSSRenderingGradients-cpp.patch b/src/layout/painting/nsCSSRenderingGradients-cpp.patch new file mode 100644 index 000000000..e41ca7dc7 --- /dev/null +++ b/src/layout/painting/nsCSSRenderingGradients-cpp.patch @@ -0,0 +1,78 @@ +diff --git a/layout/painting/nsCSSRenderingGradients.cpp b/layout/painting/nsCSSRenderingGradients.cpp +index 80a9d36ca865bbcd090d7aa556270a698447b016..2b1e0a70ed7e6f975c51a0912598c7903552ab20 100644 +--- a/layout/painting/nsCSSRenderingGradients.cpp ++++ b/layout/painting/nsCSSRenderingGradients.cpp +@@ -667,7 +667,8 @@ static nsTArray ComputeColorStops(ComputedStyle* aComputedStyle, + + nsCSSGradientRenderer nsCSSGradientRenderer::Create( + nsPresContext* aPresContext, ComputedStyle* aComputedStyle, +- const StyleGradient& aGradient, const nsSize& aIntrinsicSize) { ++ const nsIFrame* aFrame, const StyleGradient& aGradient, ++ const nsSize& aIntrinsicSize) { + auto srcSize = CSSSize::FromAppUnits(aIntrinsicSize); + + // Compute "gradient line" start and end relative to the intrinsic size of +@@ -704,6 +705,7 @@ nsCSSGradientRenderer nsCSSGradientRenderer::Create( + + nsCSSGradientRenderer renderer; + renderer.mPresContext = aPresContext; ++ renderer.mFrame = aFrame; + renderer.mGradient = &aGradient; + renderer.mStops = std::move(stops); + renderer.mLineStart = { +@@ -992,9 +994,10 @@ void nsCSSGradientRenderer::Paint(gfxContext& aContext, const nsRect& aDest, + GradientStopInterpolator( + const nsTArray& aStops, + const StyleColorInterpolationMethod& aStyleColorInterpolationMethod, +- bool aExtend, nsTArray& aResult) ++ bool aExtend, nsTArray& aResult, ++ const nsIFrame* aFrame) + : ColorStopInterpolator(aStops, aStyleColorInterpolationMethod, +- aExtend), ++ aExtend, aFrame), + mStops(aResult) {} + void CreateStop(float aPosition, gfx::DeviceColor aColor) { + mStops.AppendElement(gfx::GradientStop{aPosition, aColor}); +@@ -1007,12 +1010,12 @@ void nsCSSGradientRenderer::Paint(gfxContext& aContext, const nsRect& aDest, + bool extend = !isRepeat && styleColorInterpolationMethod.hue == + StyleHueInterpolationMethod::Longer; + GradientStopInterpolator interpolator(mStops, styleColorInterpolationMethod, +- extend, rawStops); ++ extend, rawStops, mFrame); + interpolator.CreateStops(); + } else { + rawStops.SetLength(mStops.Length()); + for (uint32_t i = 0; i < mStops.Length(); i++) { +- rawStops[i].color = ToDeviceColor(mStops[i].mColor); ++ rawStops[i].color = ToDeviceColor(mStops[i].mColor, mFrame); + rawStops[i].color.a *= aOpacity; + rawStops[i].offset = stopScale * (mStops[i].mPosition - stopOrigin); + } +@@ -1203,8 +1206,10 @@ class MOZ_STACK_CLASS WrColorStopInterpolator + WrColorStopInterpolator( + const nsTArray& aStops, + const StyleColorInterpolationMethod& aStyleColorInterpolationMethod, +- float aOpacity, nsTArray& aResult, bool aExtend) +- : ColorStopInterpolator(aStops, aStyleColorInterpolationMethod, aExtend), ++ float aOpacity, nsTArray& aResult, bool aExtend, ++ const nsIFrame* aFrame) ++ : ColorStopInterpolator(aStops, aStyleColorInterpolationMethod, aExtend, ++ aFrame), + mResult(aResult), + mOpacity(aOpacity), + mOutputStop(0) {} +@@ -1284,12 +1289,12 @@ void nsCSSGradientRenderer::BuildWebRenderParameters( + styleColorInterpolationMethod.hue == + StyleHueInterpolationMethod::Longer; + WrColorStopInterpolator interpolator(mStops, styleColorInterpolationMethod, +- aOpacity, aStops, extend); ++ aOpacity, aStops, extend, mFrame); + interpolator.CreateStops(); + } else { + aStops.SetLength(mStops.Length()); + for (uint32_t i = 0; i < mStops.Length(); i++) { +- aStops[i].color = wr::ToColorF(ToDeviceColor(mStops[i].mColor)); ++ aStops[i].color = wr::ToColorF(ToDeviceColor(mStops[i].mColor, mFrame)); + aStops[i].color.a *= aOpacity; + aStops[i].offset = (float)mStops[i].mPosition; + } diff --git a/src/layout/painting/nsCSSRenderingGradients-h.patch b/src/layout/painting/nsCSSRenderingGradients-h.patch new file mode 100644 index 000000000..661e7785f --- /dev/null +++ b/src/layout/painting/nsCSSRenderingGradients-h.patch @@ -0,0 +1,59 @@ +diff --git a/layout/painting/nsCSSRenderingGradients.h b/layout/painting/nsCSSRenderingGradients.h +index 30f665f7cacabb15fb6a1656385c5936d42be48b..8c4c4147ee8ec6812e9418f95b7b7c0358dcb735 100644 +--- a/layout/painting/nsCSSRenderingGradients.h ++++ b/layout/painting/nsCSSRenderingGradients.h +@@ -42,10 +42,11 @@ class MOZ_STACK_CLASS ColorStopInterpolator { + ColorStopInterpolator( + const nsTArray& aStops, + const StyleColorInterpolationMethod& aStyleColorInterpolationMethod, +- bool aExtend) ++ bool aExtend, const nsIFrame* aFrame) + : mStyleColorInterpolationMethod(aStyleColorInterpolationMethod), + mStops(aStops), +- mExtend(aExtend) {} ++ mExtend(aExtend), ++ mFrame(aFrame) {} + + void CreateStops() { + // This loop intentionally iterates extra stops at the beginning and end +@@ -96,7 +97,7 @@ class MOZ_STACK_CLASS ColorStopInterpolator { + Servo_InterpolateColor(mStyleColorInterpolationMethod, + &start.mColor, &end.mColor, progress); + static_cast(this)->CreateStop(float(position), +- gfx::ToDeviceColor(color)); ++ gfx::ToDeviceColor(color, mFrame)); + } + } + } +@@ -108,6 +109,7 @@ class MOZ_STACK_CLASS ColorStopInterpolator { + // which only matters if this is a CSS non-repeating gradient with + // StyleHueInterpolationMethod::Longer (only valid for hsl/hwb/lch/oklch). + bool mExtend; ++ const nsIFrame* mFrame; + + // This could be made tunable, but at 1.0/128 the error is largely + // irrelevant, as WebRender re-encodes it to 128 pairs of stops. +@@ -126,6 +128,7 @@ class nsCSSGradientRenderer final { + */ + static nsCSSGradientRenderer Create(nsPresContext* aPresContext, + ComputedStyle* aComputedStyle, ++ const nsIFrame* aFrame, + const StyleGradient& aGradient, + const nsSize& aIntrinsiceSize); + +@@ -173,6 +176,7 @@ class nsCSSGradientRenderer final { + private: + nsCSSGradientRenderer() + : mPresContext(nullptr), ++ mFrame(nullptr), + mGradient(nullptr), + mRadiusX(0.0), + mRadiusY(0.0), +@@ -192,6 +196,7 @@ class nsCSSGradientRenderer final { + const nsSize& aRepeatSize, bool aForceRepeatToCoverTiles); + + nsPresContext* mPresContext; ++ const nsIFrame* mFrame; + const StyleGradient* mGradient; + nsTArray mStops; + gfxPoint mLineStart, mLineEnd; // only for linear/radial gradients diff --git a/src/layout/painting/nsImageRenderer-cpp.patch b/src/layout/painting/nsImageRenderer-cpp.patch new file mode 100644 index 000000000..574f1c0f6 --- /dev/null +++ b/src/layout/painting/nsImageRenderer-cpp.patch @@ -0,0 +1,40 @@ +diff --git a/layout/painting/nsImageRenderer.cpp b/layout/painting/nsImageRenderer.cpp +index 4acb7670e971024f9c63e48ff711bbdd1dc02301..9ac1ae1b66eb6fb10195cd3709e0e29d8d53b574 100644 +--- a/layout/painting/nsImageRenderer.cpp ++++ b/layout/painting/nsImageRenderer.cpp +@@ -90,7 +90,7 @@ static already_AddRefed GetSymbolicIconImage(nsAtom* aName, + if (NS_WARN_IF(!XRE_IsParentProcess())) { + return nullptr; + } +- const auto fg = aFrame->StyleText()->mColor.ToColor(); ++ const auto fg = aFrame->StyleText()->mColor.ToColor(aFrame); + auto key = std::make_tuple(aName, aScale, fg); + auto* cache = aFrame->GetProperty(SymbolicImageCacheProp()); + if (!cache) { +@@ -567,7 +567,7 @@ ImgDrawResult nsImageRenderer::Draw(nsPresContext* aPresContext, + } + case StyleImage::Tag::Gradient: { + nsCSSGradientRenderer renderer = nsCSSGradientRenderer::Create( +- aPresContext, mForFrame->Style(), *mGradientData, mSize); ++ aPresContext, mForFrame->Style(), mForFrame, *mGradientData, mSize); + + renderer.Paint(*ctx, aDest, aFill, aRepeatSize, aSrc, aDirtyRect, + aOpacity); +@@ -644,7 +644,7 @@ ImgDrawResult nsImageRenderer::BuildWebRenderDisplayItems( + switch (mType) { + case StyleImage::Tag::Gradient: { + nsCSSGradientRenderer renderer = nsCSSGradientRenderer::Create( +- aPresContext, mForFrame->Style(), *mGradientData, mSize); ++ aPresContext, mForFrame->Style(), mForFrame, *mGradientData, mSize); + + renderer.BuildWebRenderDisplayItems(aBuilder, aSc, aDest, aFill, + aRepeatSize, aSrc, +@@ -1076,7 +1076,7 @@ ImgDrawResult nsImageRenderer::DrawShapeImage(nsPresContext* aPresContext, + + if (mImage->IsGradient()) { + nsCSSGradientRenderer renderer = nsCSSGradientRenderer::Create( +- aPresContext, mForFrame->Style(), *mGradientData, mSize); ++ aPresContext, mForFrame->Style(), mForFrame, *mGradientData, mSize); + nsRect dest(nsPoint(0, 0), mSize); + renderer.Paint(aRenderingContext, dest, dest, mSize, + CSSIntRect::FromAppUnitsRounded(dest), dest, 1.0); diff --git a/src/layout/style/GeckoBindings-cpp.patch b/src/layout/style/GeckoBindings-cpp.patch new file mode 100644 index 000000000..0c9df23d6 --- /dev/null +++ b/src/layout/style/GeckoBindings-cpp.patch @@ -0,0 +1,13 @@ +diff --git a/layout/style/GeckoBindings.cpp b/layout/style/GeckoBindings.cpp +index 56a16d313a5d30d12edf1f94459db1027af87002..3722f2d6ce6c0864956fed2b00c71a3286edc674 100644 +--- a/layout/style/GeckoBindings.cpp ++++ b/layout/style/GeckoBindings.cpp +@@ -1068,7 +1068,7 @@ void Gecko_SetFontPaletteOverride( + return; + } + aValues->mOverrides.AppendElement(gfx::FontPaletteValueSet::OverrideColor{ +- uint32_t(aIndex), gfx::sRGBColor::FromABGR(aColor->ToColor())}); ++ uint32_t(aIndex), gfx::sRGBColor::FromABGR(aColor->ToColor(nullptr))}); + } + + void Gecko_EnsureImageLayersLength(nsStyleImageLayers* aLayers, size_t aLen, diff --git a/src/layout/style/StyleColor-cpp.patch b/src/layout/style/StyleColor-cpp.patch index 7f0e9423b..f5aa44115 100644 --- a/src/layout/style/StyleColor-cpp.patch +++ b/src/layout/style/StyleColor-cpp.patch @@ -1,5 +1,5 @@ diff --git a/layout/style/StyleColor.cpp b/layout/style/StyleColor.cpp -index 95c7ae6abea5032bef0466e8d59d212374d7a4d0..234a5fc3d94c341d6f8aea8f619661054d2f6a49 100644 +index 95c7ae6abea5032bef0466e8d59d212374d7a4d0..85a48f27251756c72db8ed03a673a18e96cf76f9 100644 --- a/layout/style/StyleColor.cpp +++ b/layout/style/StyleColor.cpp @@ -8,6 +8,7 @@ @@ -10,7 +10,19 @@ index 95c7ae6abea5032bef0466e8d59d212374d7a4d0..234a5fc3d94c341d6f8aea8f61966105 namespace mozilla { -@@ -44,13 +45,14 @@ nscolor StyleColor::CalcColor( +@@ -34,23 +35,24 @@ StyleAbsoluteColor StyleColor::ResolveColor( + + template <> + nscolor StyleColor::CalcColor(nscolor aColor) const { +- return ResolveColor(StyleAbsoluteColor::FromColor(aColor)).ToColor(); ++ return ResolveColor(StyleAbsoluteColor::FromColor(aColor)).ToColor(nullptr); + } + + template <> + nscolor StyleColor::CalcColor( + const StyleAbsoluteColor& aForegroundColor) const { +- return ResolveColor(aForegroundColor).ToColor(); ++ return ResolveColor(aForegroundColor).ToColor(nullptr); } template <> diff --git a/src/layout/style/nsStyleStruct-cpp.patch b/src/layout/style/nsStyleStruct-cpp.patch new file mode 100644 index 000000000..b4617b093 --- /dev/null +++ b/src/layout/style/nsStyleStruct-cpp.patch @@ -0,0 +1,13 @@ +diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp +index 80ca0cc08bc675359fbb09100eca43c8e3b9d413..d3ea525f6d84568c4e997a142bbfef6435d21034 100644 +--- a/layout/style/nsStyleStruct.cpp ++++ b/layout/style/nsStyleStruct.cpp +@@ -2208,7 +2208,7 @@ nscolor nsStyleBackground::BackgroundColor(const nsIFrame* aFrame) const { + } + + nscolor nsStyleBackground::BackgroundColor(const ComputedStyle* aStyle) const { +- return mBackgroundColor.CalcColor(*aStyle); ++ return mBackgroundColor.CalcColor(*aStyle, nullptr); + } + + bool nsStyleBackground::IsTransparent(const nsIFrame* aFrame) const { diff --git a/src/layout/svg/SVGContextPaint-cpp.patch b/src/layout/svg/SVGContextPaint-cpp.patch new file mode 100644 index 000000000..38110341c --- /dev/null +++ b/src/layout/svg/SVGContextPaint-cpp.patch @@ -0,0 +1,13 @@ +diff --git a/layout/svg/SVGContextPaint.cpp b/layout/svg/SVGContextPaint.cpp +index 3df8728978c1b48ca326c852feb0553091a99673..9f9096205c3dd3551c41c547a1aee667c0a51238 100644 +--- a/layout/svg/SVGContextPaint.cpp ++++ b/layout/svg/SVGContextPaint.cpp +@@ -143,7 +143,7 @@ static void SetupInheritablePaint(const DrawTarget* aDrawTarget, + } + + nscolor color = SVGUtils::GetFallbackOrPaintColor( +- *aFrame->Style(), aFillOrStroke, aDefaultFallbackColor); ++ *aFrame->Style(), aFillOrStroke, aDefaultFallbackColor, aFrame); + aTargetPaint.SetColor(color); + } + diff --git a/src/layout/svg/SVGGradientFrame-cpp.patch b/src/layout/svg/SVGGradientFrame-cpp.patch new file mode 100644 index 000000000..f79ff277b --- /dev/null +++ b/src/layout/svg/SVGGradientFrame-cpp.patch @@ -0,0 +1,42 @@ +diff --git a/layout/svg/SVGGradientFrame.cpp b/layout/svg/SVGGradientFrame.cpp +index 9c66d90fc0292abcab30c912968d3f84c0e181ff..aec0b2e48965729ccff19d632ac5e8fd04fd09eb 100644 +--- a/layout/svg/SVGGradientFrame.cpp ++++ b/layout/svg/SVGGradientFrame.cpp +@@ -229,8 +229,9 @@ class MOZ_STACK_CLASS SVGColorStopInterpolator + SVGColorStopInterpolator( + gfxPattern* aGradient, const nsTArray& aStops, + const StyleColorInterpolationMethod& aStyleColorInterpolationMethod, +- bool aExtend) +- : ColorStopInterpolator(aStops, aStyleColorInterpolationMethod, aExtend), ++ bool aExtend, const nsIFrame* aFrame) ++ : ColorStopInterpolator(aStops, aStyleColorInterpolationMethod, aExtend, ++ aFrame), + mGradient(aGradient) {} + + void CreateStop(float aPosition, DeviceColor aColor) { +@@ -270,7 +271,8 @@ already_AddRefed SVGGradientFrame::GetPaintServerPattern( + if (nStops == 1 || GradientVectorLengthIsZero()) { + // The gradient paints a single colour, using the stop-color of the last + // gradient step if there are more than one. +- return do_AddRef(new gfxPattern(ToDeviceColor(stops.LastElement().mColor))); ++ return do_AddRef( ++ new gfxPattern(ToDeviceColor(stops.LastElement().mColor, aSource))); + } + + // Get the transform list (if there is one). We do this after the returns +@@ -313,12 +315,13 @@ already_AddRefed SVGGradientFrame::GetPaintServerPattern( + static constexpr auto interpolationMethod = StyleColorInterpolationMethod{ + StyleColorSpace::SrgbLinear, StyleHueInterpolationMethod::Shorter}; + SVGColorStopInterpolator interpolator(gradient, stops, interpolationMethod, +- false); ++ false, aSource); + interpolator.CreateStops(); + } else { + // setup standard sRGB stops + for (const auto& stop : stops) { +- gradient->AddColorStop(stop.mPosition, ToDeviceColor(stop.mColor)); ++ gradient->AddColorStop(stop.mPosition, ++ ToDeviceColor(stop.mColor, aSource)); + } + } + diff --git a/src/layout/svg/SVGImageContext-cpp.patch b/src/layout/svg/SVGImageContext-cpp.patch new file mode 100644 index 000000000..e14b964cd --- /dev/null +++ b/src/layout/svg/SVGImageContext-cpp.patch @@ -0,0 +1,21 @@ +diff --git a/layout/svg/SVGImageContext.cpp b/layout/svg/SVGImageContext.cpp +index ecbda963b75fb70b62885a0c8f7a517011a8d5dc..1200a51aee7db4ee1a014308581ada1002c0d05f 100644 +--- a/layout/svg/SVGImageContext.cpp ++++ b/layout/svg/SVGImageContext.cpp +@@ -57,12 +57,14 @@ void SVGImageContext::MaybeStoreContextPaint(SVGImageContext& aContext, + if ((style->mMozContextProperties.bits & StyleContextPropertyBits::FILL) && + style->mFill.kind.IsColor()) { + haveContextPaint = true; +- contextPaint->SetFill(style->mFill.kind.AsColor().CalcColor(aStyle)); ++ contextPaint->SetFill( ++ style->mFill.kind.AsColor().CalcColor(aStyle, nullptr)); + } + if ((style->mMozContextProperties.bits & StyleContextPropertyBits::STROKE) && + style->mStroke.kind.IsColor()) { + haveContextPaint = true; +- contextPaint->SetStroke(style->mStroke.kind.AsColor().CalcColor(aStyle)); ++ contextPaint->SetStroke( ++ style->mStroke.kind.AsColor().CalcColor(aStyle, nullptr)); + } + if (style->mMozContextProperties.bits & + StyleContextPropertyBits::FILL_OPACITY) { diff --git a/src/layout/svg/SVGUtils-cpp.patch b/src/layout/svg/SVGUtils-cpp.patch new file mode 100644 index 000000000..577ca64ba --- /dev/null +++ b/src/layout/svg/SVGUtils-cpp.patch @@ -0,0 +1,60 @@ +diff --git a/layout/svg/SVGUtils.cpp b/layout/svg/SVGUtils.cpp +index 93b73e1c665ea8e011af7026810db6cd23c8049b..004d1d0637d62fcde25a924df5392a7dc64f75dc 100644 +--- a/layout/svg/SVGUtils.cpp ++++ b/layout/svg/SVGUtils.cpp +@@ -1154,23 +1154,23 @@ gfxRect SVGUtils::PathExtentsToMaxStrokeExtents(const gfxRect& aPathExtents, + /* static */ + nscolor SVGUtils::GetFallbackOrPaintColor( + const ComputedStyle& aStyle, StyleSVGPaint nsStyleSVG::* aFillOrStroke, +- nscolor aDefaultContextFallbackColor) { ++ nscolor aDefaultContextFallbackColor, const nsIFrame* aFrame) { + const auto& paint = aStyle.StyleSVG()->*aFillOrStroke; + nscolor color; + switch (paint.kind.tag) { + case StyleSVGPaintKind::Tag::PaintServer: + color = paint.fallback.IsColor() +- ? paint.fallback.AsColor().CalcColor(aStyle) ++ ? paint.fallback.AsColor().CalcColor(aStyle, aFrame) + : NS_RGBA(0, 0, 0, 0); + break; + case StyleSVGPaintKind::Tag::ContextStroke: + case StyleSVGPaintKind::Tag::ContextFill: + color = paint.fallback.IsColor() +- ? paint.fallback.AsColor().CalcColor(aStyle) ++ ? paint.fallback.AsColor().CalcColor(aStyle, aFrame) + : aDefaultContextFallbackColor; + break; + default: +- color = paint.kind.AsColor().CalcColor(aStyle); ++ color = paint.kind.AsColor().CalcColor(aStyle, aFrame); + break; + } + if (const auto* styleIfVisited = aStyle.GetStyleIfVisited()) { +@@ -1184,7 +1184,8 @@ nscolor SVGUtils::GetFallbackOrPaintColor( + // another simple color. + if (paintIfVisited.kind.IsColor() && paint.kind.IsColor()) { + nscolor colors[2] = { +- color, paintIfVisited.kind.AsColor().CalcColor(*styleIfVisited)}; ++ color, ++ paintIfVisited.kind.AsColor().CalcColor(*styleIfVisited, aFrame)}; + return ComputedStyle::CombineVisitedColors(colors, + aStyle.RelevantLinkVisited()); + } +@@ -1254,7 +1255,7 @@ void SVGUtils::MakeFillPatternFor(nsIFrame* aFrame, gfxContext* aContext, + // objectBoundingBox where the width or height of the object is zero. + // See http://www.w3.org/TR/SVG11/coords.html#ObjectBoundingBox + sRGBColor color(sRGBColor::FromABGR(GetFallbackOrPaintColor( +- *aFrame->Style(), &nsStyleSVG::mFill, NS_RGB(0, 0, 0)))); ++ *aFrame->Style(), &nsStyleSVG::mFill, NS_RGB(0, 0, 0), aFrame))); + color.a *= fillOpacity; + aOutPattern->InitColorPattern(ToDeviceColor(color)); + } +@@ -1321,7 +1322,7 @@ void SVGUtils::MakeStrokePatternFor(nsIFrame* aFrame, gfxContext* aContext, + // objectBoundingBox where the width or height of the object is zero. + // See http://www.w3.org/TR/SVG11/coords.html#ObjectBoundingBox + sRGBColor color(sRGBColor::FromABGR(GetFallbackOrPaintColor( +- *aFrame->Style(), &nsStyleSVG::mStroke, NS_RGBA(0, 0, 0, 0)))); ++ *aFrame->Style(), &nsStyleSVG::mStroke, NS_RGBA(0, 0, 0, 0), aFrame))); + color.a *= strokeOpacity; + aOutPattern->InitColorPattern(ToDeviceColor(color)); + } diff --git a/src/layout/svg/SVGUtils-h.patch b/src/layout/svg/SVGUtils-h.patch new file mode 100644 index 000000000..6adbbff91 --- /dev/null +++ b/src/layout/svg/SVGUtils-h.patch @@ -0,0 +1,13 @@ +diff --git a/layout/svg/SVGUtils.h b/layout/svg/SVGUtils.h +index 1f1f7ad6b78e5c411651fee30bbbfeb784257e0a..28c7332aae411c4220bd00af08b491d31d2eb090 100644 +--- a/layout/svg/SVGUtils.h ++++ b/layout/svg/SVGUtils.h +@@ -428,7 +428,7 @@ class SVGUtils final { + + static nscolor GetFallbackOrPaintColor( + const ComputedStyle&, StyleSVGPaint nsStyleSVG::* aFillOrStroke, +- nscolor aDefaultContextFallbackColor); ++ nscolor aDefaultContextFallbackColor, const nsIFrame* aFrame); + + static void MakeFillPatternFor(nsIFrame* aFrame, gfxContext* aContext, + GeneralPattern* aOutPattern, diff --git a/src/layout/xul/tree/nsTreeBodyFrame-cpp.patch b/src/layout/xul/tree/nsTreeBodyFrame-cpp.patch index 30fc951a7..2b834bb1d 100644 --- a/src/layout/xul/tree/nsTreeBodyFrame-cpp.patch +++ b/src/layout/xul/tree/nsTreeBodyFrame-cpp.patch @@ -1,5 +1,5 @@ diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp -index b6aa10336e7994c830e0326298820c3a534f8094..b3ddb7b9b3ceb8b868e7e48e02fdb70a876c9019 100644 +index b6aa10336e7994c830e0326298820c3a534f8094..7747c52e5c5d227894d8f7fb377c65861dc51c4c 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -2865,7 +2865,8 @@ ImgDrawResult nsTreeBodyFrame::PaintCell( @@ -12,6 +12,15 @@ index b6aa10336e7994c830e0326298820c3a534f8094..b3ddb7b9b3ceb8b868e7e48e02fdb70a ColorPattern colorPatt(ToDeviceColor(color)); StyleBorderStyle style = borderStyle->GetBorderStyle(eSideLeft); +@@ -3300,7 +3301,7 @@ ImgDrawResult nsTreeBodyFrame::PaintText( + textRect.Deflate(bp); + + // Set our color. +- ColorPattern color(ToDeviceColor(textContext->StyleText()->mColor)); ++ ColorPattern color(ToDeviceColor(textContext->StyleText()->mColor, this)); + + // Draw decorations. + StyleTextDecorationLine decorations = @@ -3340,7 +3341,7 @@ ImgDrawResult nsTreeBodyFrame::PaintText( } diff --git a/src/servo/ports/geckolib/cbindgen-toml.patch b/src/servo/ports/geckolib/cbindgen-toml.patch index 0bf358476..24433b060 100644 --- a/src/servo/ports/geckolib/cbindgen-toml.patch +++ b/src/servo/ports/geckolib/cbindgen-toml.patch @@ -1,5 +1,5 @@ diff --git a/servo/ports/geckolib/cbindgen.toml b/servo/ports/geckolib/cbindgen.toml -index e9ae0149e80a241b2a32ce445deb923af2fac445..464f4e8b853d26bd2da327de8bf8bb50e5ab8599 100644 +index e9ae0149e80a241b2a32ce445deb923af2fac445..0dc5768ab8bf89f7d6c31ff4c7bd4bb805d64509 100644 --- a/servo/ports/geckolib/cbindgen.toml +++ b/servo/ports/geckolib/cbindgen.toml @@ -679,9 +679,9 @@ renaming_overrides_prefixing = true @@ -10,7 +10,7 @@ index e9ae0149e80a241b2a32ce445deb923af2fac445..464f4e8b853d26bd2da327de8bf8bb50 + * style. The frame, when supplied, is used to resolve Zen boosts. */ - nscolor CalcColor(const ComputedStyle&) const; -+ nscolor CalcColor(const ComputedStyle&, const nsIFrame* = nullptr) const; ++ nscolor CalcColor(const ComputedStyle&, const nsIFrame*) const; /** * Compute the final color, making the argument the foreground color. */ @@ -24,7 +24,7 @@ index e9ae0149e80a241b2a32ce445deb923af2fac445..464f4e8b853d26bd2da327de8bf8bb50 + * document, or null to skip boost resolution. */ - nscolor ToColor() const; -+ nscolor ToColor(const nsIFrame* = nullptr) const; ++ nscolor ToColor(const nsIFrame*) const; """ "OwnedSlice" = """ diff --git a/src/widget/ScrollbarDrawing-cpp.patch b/src/widget/ScrollbarDrawing-cpp.patch new file mode 100644 index 000000000..43e784ca0 --- /dev/null +++ b/src/widget/ScrollbarDrawing-cpp.patch @@ -0,0 +1,23 @@ +diff --git a/widget/ScrollbarDrawing.cpp b/widget/ScrollbarDrawing.cpp +index fec73f8a8cbfbf952f1d14f1a4eb2b20f9b5aad4..375ef5654cf61e4dea102588679d2ac2060d299a 100644 +--- a/widget/ScrollbarDrawing.cpp ++++ b/widget/ScrollbarDrawing.cpp +@@ -121,7 +121,7 @@ sRGBColor ScrollbarDrawing::ComputeScrollbarTrackColor( + const nsStyleUI* ui = aStyle.StyleUI(); + if (ui->mScrollbarColor.IsColors()) { + return sRGBColor::FromABGR( +- ui->mScrollbarColor.AsColors().track.CalcColor(aStyle)); ++ ui->mScrollbarColor.AsColors().track.CalcColor(aStyle, aFrame)); + } + static constexpr sRGBColor sDefaultDarkTrackColor = + sRGBColor::FromU8(20, 20, 25, 77); +@@ -143,7 +143,8 @@ sRGBColor ScrollbarDrawing::ComputeScrollbarThumbColor( + const nsStyleUI* ui = aStyle.StyleUI(); + if (ui->mScrollbarColor.IsColors()) { + return sRGBColor::FromABGR(ThemeColors::AdjustUnthemedScrollbarThumbColor( +- ui->mScrollbarColor.AsColors().thumb.CalcColor(aStyle), aElementState)); ++ ui->mScrollbarColor.AsColors().thumb.CalcColor(aStyle, aFrame), ++ aElementState)); + } + + auto systemColor = [&] { diff --git a/src/widget/ScrollbarDrawingCocoa-cpp.patch b/src/widget/ScrollbarDrawingCocoa-cpp.patch new file mode 100644 index 000000000..a1df0b9a7 --- /dev/null +++ b/src/widget/ScrollbarDrawingCocoa-cpp.patch @@ -0,0 +1,15 @@ +diff --git a/widget/ScrollbarDrawingCocoa.cpp b/widget/ScrollbarDrawingCocoa.cpp +index f0dff9276f9880034c800413c4afc2400136b35a..1dd5b53bfda64e1d3b4c1870680fa1a43de0e6fb 100644 +--- a/widget/ScrollbarDrawingCocoa.cpp ++++ b/widget/ScrollbarDrawingCocoa.cpp +@@ -61,8 +61,8 @@ static ScrollbarParams ComputeScrollbarParams(nsIFrame* aFrame, + if (ui->HasCustomScrollbars()) { + const auto& colors = ui->mScrollbarColor.AsColors(); + params.isCustom = true; +- params.trackColor = colors.track.CalcColor(aStyle); +- params.faceColor = colors.thumb.CalcColor(aStyle); ++ params.trackColor = colors.track.CalcColor(aStyle, aFrame); ++ params.faceColor = colors.thumb.CalcColor(aStyle, aFrame); + } + + return params; diff --git a/src/widget/ScrollbarDrawingWin11-cpp.patch b/src/widget/ScrollbarDrawingWin11-cpp.patch new file mode 100644 index 000000000..aa707014d --- /dev/null +++ b/src/widget/ScrollbarDrawingWin11-cpp.patch @@ -0,0 +1,22 @@ +diff --git a/widget/ScrollbarDrawingWin11.cpp b/widget/ScrollbarDrawingWin11.cpp +index be059ca615d1e0281af64984cfc8121be2f6e305..6326c98b369d948052c3cb1df13c8cfaaa472f5c 100644 +--- a/widget/ScrollbarDrawingWin11.cpp ++++ b/widget/ScrollbarDrawingWin11.cpp +@@ -78,7 +78,7 @@ sRGBColor ScrollbarDrawingWin11::ComputeScrollbarTrackColor( + const nsStyleUI* ui = aStyle.StyleUI(); + if (ui->mScrollbarColor.IsColors()) { + return sRGBColor::FromABGR( +- ui->mScrollbarColor.AsColors().track.CalcColor(aStyle)); ++ ui->mScrollbarColor.AsColors().track.CalcColor(aStyle, aFrame)); + } + return aColors.IsDark() ? sRGBColor::FromU8(23, 23, 23, 255) + : sRGBColor::FromU8(240, 240, 240, 255); +@@ -94,7 +94,7 @@ sRGBColor ScrollbarDrawingWin11::ComputeScrollbarThumbColor( + const nscolor baseColor = [&] { + const nsStyleUI* ui = aStyle.StyleUI(); + if (ui->mScrollbarColor.IsColors()) { +- return ui->mScrollbarColor.AsColors().thumb.CalcColor(aStyle); ++ return ui->mScrollbarColor.AsColors().thumb.CalcColor(aStyle, aFrame); + } + return aColors.IsDark() ? NS_RGBA(149, 149, 149, 255) + : NS_RGBA(133, 133, 133, 255); diff --git a/src/widget/ThemeColors-cpp.patch b/src/widget/ThemeColors-cpp.patch new file mode 100644 index 000000000..c4f7c6167 --- /dev/null +++ b/src/widget/ThemeColors-cpp.patch @@ -0,0 +1,13 @@ +diff --git a/widget/ThemeColors.cpp b/widget/ThemeColors.cpp +index 0ac3a8cbb04258312cba20a89a23700c6fd1b49f..dfd5203c1a795fc14befa88a474f241dd16e9c8f 100644 +--- a/widget/ThemeColors.cpp ++++ b/widget/ThemeColors.cpp +@@ -113,7 +113,7 @@ ThemeAccentColor::ThemeAccentColor(const ComputedStyle& aStyle, + } + MOZ_ASSERT(color.IsColor()); + nscolor accentColor = +- ColorPalette::EnsureOpaque(color.AsColor().CalcColor(aStyle)); ++ ColorPalette::EnsureOpaque(color.AsColor().CalcColor(aStyle, nullptr)); + if (sRGBColor::FromABGR(accentColor) == mDefaultPalette->mAccent) { + return; + } diff --git a/src/zen/boosts/nsZenBoostsBackend.cpp b/src/zen/boosts/nsZenBoostsBackend.cpp index 3c12f3e15..f9eaf6461 100644 --- a/src/zen/boosts/nsZenBoostsBackend.cpp +++ b/src/zen/boosts/nsZenBoostsBackend.cpp @@ -25,6 +25,8 @@ #include "mozilla/dom/Document.h" #include "mozilla/dom/DocumentInlines.h" #include "mozilla/dom/BrowsingContext.h" +#include "mozilla/dom/Element.h" +#include "mozilla/PseudoStyleType.h" #include "mozilla/StaticPrefs_zen.h" @@ -384,6 +386,8 @@ inline static nscolor zenInvertColorChannel(nscolor aColor) { * not touch (devtools highlighters, screenshots, the boosts overlays * themselves, and other native-anonymous UI such as scrollbars). A null frame * gives no document to anchor the boost on, so it is treated the same way. + * CSS generated content (::before/::after/::marker/::backdrop) is + * native-anonymous too but is author content, so it is not exempt. */ ZEN_HOT_FUNCTION inline static bool IsBoostExemptFrame(const nsIFrame* aFrame) { @@ -391,7 +395,24 @@ inline static bool IsBoostExemptFrame(const nsIFrame* aFrame) { return true; } const nsIContent* content = aFrame->GetContent(); - return content && content->IsInNativeAnonymousSubtree(); + if (!content || !content->IsInNativeAnonymousSubtree()) { + return false; + } + if (const nsIContent* root = + content->GetClosestNativeAnonymousSubtreeRoot()) { + if (root->IsElement()) { + switch (root->AsElement()->GetPseudoElementType()) { + case mozilla::PseudoStyleType::Before: + case mozilla::PseudoStyleType::After: + case mozilla::PseudoStyleType::Marker: + case mozilla::PseudoStyleType::Backdrop: + return false; + default: + break; + } + } + } + return true; } /** diff --git a/src/zen/common/styles/zen-popup.css b/src/zen/common/styles/zen-popup.css index 8c29733b0..68c64b713 100644 --- a/src/zen/common/styles/zen-popup.css +++ b/src/zen/common/styles/zen-popup.css @@ -8,7 +8,6 @@ @import url("chrome://browser/content/zen-styles/zen-panels/dialog.css"); :root { - --panel-subview-body-padding: 2px 0; --arrowpanel-menuitem-border-radius: 5px; --arrowpanel-menuitem-margin: var(--uc-arrowpanel-menuitem-margin-block) var(--uc-arrowpanel-menuitem-margin-inline); --arrowpanel-menuitem-padding-block: 8px; @@ -68,8 +67,7 @@ panel { } .widget-overflow-list .toolbarbutton-1:not(.toolbarbutton-combined) > .toolbarbutton-text, -.subviewbutton:not(#appMenu-zoom-controls > .subviewbutton) > .toolbarbutton-icon + .toolbarbutton-text, -#appMenu-fxa-label2 > vbox { +.subviewbutton:not(#appMenu-zoom-controls > .subviewbutton) > .toolbarbutton-icon + .toolbarbutton-text { padding-inline-start: var(--uc-arrowpanel-menuicon-margin-inline); } @@ -88,17 +86,6 @@ panel { white-space: nowrap; } -/* Firefox profile avatar in appmenu */ -#appMenu-fxa-label2::before { - content: ""; - display: -moz-box; - height: var(--size-item-small); - width: var(--size-item-small); - background: var(--avatar-image-url) 0/16px; - scale: 1.25; - border-radius: 99px; -} - /* disable proton account separator */ #appMenu-fxa-separator { border-image: none; @@ -108,10 +95,6 @@ panel { padding-block: 0; } -#appMenu-fxa-status2:not([fxastatus]) > #appMenu-fxa-label2 { - margin-inline-end: calc(var(--arrowpanel-menuitem-padding-inline) * -1); -} - /* zoom controls */ #appMenu-zoom-controls { border-top: 1px solid var(--panel-separator-color);