Compare commits

...

4 Commits

Author SHA1 Message Date
mr. m
6475f8de0e gh-13844: Part 3 - Fixed text inputs not being filtered through boosts (gh-13893) 2026-05-27 13:40:00 +02:00
mr. m
0639dbaef7 no-bug: New Crowdin updates (gh-13886) 2026-05-27 11:29:31 +02:00
mr. m
2546d95909 no-bug: Add a New Boost urlbar action (gh-13884)
Signed-off-by: mr. m <91018726+mr-cheffy@users.noreply.github.com>
2026-05-27 08:45:44 +02:00
mr. m
680893cb85 no-bug: Remove transparency patch 2026-05-26 23:39:08 +02:00
20 changed files with 347 additions and 216 deletions

View File

@@ -281,7 +281,7 @@ zen-workspace-shortcut-switch-9 = Canvia a l'espai de treball 9
zen-workspace-shortcut-switch-10 = Canvia a l'espai de treball 10
zen-workspace-shortcut-forward = Espai de treball següent
zen-workspace-shortcut-backward = Espai de treball anterior
zen-workspace-shortcut-create = Create New Workspace
zen-workspace-shortcut-create = Crea un nou espai de treball
zen-sidebar-shortcut-toggle = Commuta l'amplada de la barra lateral
zen-pinned-tab-shortcut-reset = Restableix la pestanya fixada a l'URL fixat
zen-split-view-shortcut-grid = Commuta la quadrícula de la vista dividida
@@ -319,4 +319,4 @@ zen-devtools-toggle-accessibility-shortcut = Commuta l'accessibilitat
zen-close-all-unpinned-tabs-shortcut = Tanca totes les pestanyes no fixades
zen-new-unsynced-window-shortcut = Nova finestra en blanc
zen-duplicate-tab-shortcut = Duplica la pestanya
zen-key-find-selection = Find Selection
zen-key-find-selection = Cerca la selecció

View File

@@ -11,7 +11,7 @@ zen-boost-edit-reset =
zen-boost-edit-delete =
.label = Suprimeix la millora
zen-boost-size = Mida
zen-boost-case = Case
zen-boost-case = Cas
zen-boost-zap = Amaga
zen-boost-code = Codi
zen-boost-back = Enrere
@@ -48,9 +48,9 @@ zen-unzap-tooltip =
*[other] { $elementCount } elements amagats
}
zen-boost-save =
.label = Export Boost
.label = Exporta la millora
zen-boost-load =
.label = Import Boost
.label = Importa la millora
zen-panel-ui-boosts-exported-message = S'ha exportat la millora!
zen-site-data-boosts = Millores
zen-site-data-create-boost =

View File

@@ -281,7 +281,7 @@ zen-workspace-shortcut-switch-9 = Přepnout na pracovní prostor 9
zen-workspace-shortcut-switch-10 = Přepnout do pracovního prostoru 10
zen-workspace-shortcut-forward = Přeposlat pracovní prostor
zen-workspace-shortcut-backward = Zpětný pracovní prostor
zen-workspace-shortcut-create = Create New Workspace
zen-workspace-shortcut-create = Nový Workspace
zen-sidebar-shortcut-toggle = Přepnout šířku postranního panelu
zen-pinned-tab-shortcut-reset = Obnovit připnuté záložky na připnuté URL
zen-split-view-shortcut-grid = Přepnout rozdělený pohled v mřížce
@@ -319,4 +319,4 @@ zen-devtools-toggle-accessibility-shortcut = Přepnout přístupnost
zen-close-all-unpinned-tabs-shortcut = Zavřít všechny nepřipnuté panely
zen-new-unsynced-window-shortcut = Nové nesynchronizované okno
zen-duplicate-tab-shortcut = Duplikovat panel
zen-key-find-selection = Find Selection
zen-key-find-selection = Najít Část

View File

@@ -281,7 +281,7 @@ zen-workspace-shortcut-switch-9 = Cambiar a espacio de trabajo 9
zen-workspace-shortcut-switch-10 = Cambiar a espacio de trabajo 10
zen-workspace-shortcut-forward = Espacio de trabajo siguiente
zen-workspace-shortcut-backward = Espacio de trabajo anterior
zen-workspace-shortcut-create = Create New Workspace
zen-workspace-shortcut-create = Crear nuevo espacio de trabajo
zen-sidebar-shortcut-toggle = Cambiar el ancho de la barra lateral
zen-pinned-tab-shortcut-reset = Restablecer pestaña fijada a la URL fijada
zen-split-view-shortcut-grid = Cambiar a vista dividida en cuadrícula
@@ -319,4 +319,4 @@ zen-devtools-toggle-accessibility-shortcut = Alternar accesibilidad
zen-close-all-unpinned-tabs-shortcut = Cerrar todas las pestañas sin fijar
zen-new-unsynced-window-shortcut = Nueva ventana no sincronizada
zen-duplicate-tab-shortcut = Duplicar pestaña
zen-key-find-selection = Find Selection
zen-key-find-selection = Encontrar selección

View File

@@ -11,7 +11,7 @@ zen-boost-edit-reset =
zen-boost-edit-delete =
.label = Borrar Boost
zen-boost-size = Tamaño
zen-boost-case = Case
zen-boost-case = Formato
zen-boost-zap = Borrar
zen-boost-code = Código
zen-boost-back = Atrás
@@ -48,9 +48,9 @@ zen-unzap-tooltip =
*[other] { $elementCount } elementos borrados
}
zen-boost-save =
.label = Export Boost
.label = Exportar Boost
zen-boost-load =
.label = Import Boost
.label = Importar Boost
zen-panel-ui-boosts-exported-message = ¡Boost exportado!
zen-site-data-boosts = Boosts
zen-site-data-create-boost =

View File

@@ -281,7 +281,7 @@ zen-workspace-shortcut-switch-9 = Athraigh go Spás Oibre 9
zen-workspace-shortcut-switch-10 = Athraigh go Spás Oibre 10
zen-workspace-shortcut-forward = Spás Oibre Ar Aghaidh
zen-workspace-shortcut-backward = Spás Oibre Ar Ais
zen-workspace-shortcut-create = Create New Workspace
zen-workspace-shortcut-create = Cruthaigh Spás Oibre Nua
zen-sidebar-shortcut-toggle = Leithead an Bharra Taoibh a Scoránaigh
zen-pinned-tab-shortcut-reset = Athshocraigh an Cluaisín Prionáilte go dtí an URL Prionáilte
zen-split-view-shortcut-grid = Eangach Radharc Scoilte a Athsholáthar
@@ -319,4 +319,4 @@ zen-devtools-toggle-accessibility-shortcut = Scoránaigh Inrochtaineacht
zen-close-all-unpinned-tabs-shortcut = Dún Gach Cluaisín Gan Phionáil
zen-new-unsynced-window-shortcut = Fuinneog Nua Neamhshioncrónaithe
zen-duplicate-tab-shortcut = Cluaisín Dúblach
zen-key-find-selection = Find Selection
zen-key-find-selection = Aimsigh Rogha

View File

@@ -11,7 +11,7 @@ zen-boost-edit-reset =
zen-boost-edit-delete =
.label = Scrios an Treisiú
zen-boost-size = Méid
zen-boost-case = Case
zen-boost-case = Cás
zen-boost-zap = Zapáil
zen-boost-code = Cód
zen-boost-back = Ar ais
@@ -48,9 +48,9 @@ zen-unzap-tooltip =
*[other] { $elementCount } eilimintí Zapáilte
}
zen-boost-save =
.label = Export Boost
.label = Borradh Easpórtála
zen-boost-load =
.label = Import Boost
.label = Borradh Iompórtála
zen-panel-ui-boosts-exported-message = Borradh easpórtáilte!
zen-site-data-boosts = Borradh
zen-site-data-create-boost =

View File

@@ -48,9 +48,9 @@ zen-unzap-tooltip =
*[other] { $elementCount } elements zapped
}
zen-boost-save =
.label = Export Boost
.label = Boost exportálása
zen-boost-load =
.label = Import Boost
.label = Boost importálása
zen-panel-ui-boosts-exported-message = Boostok exportálva!
zen-site-data-boosts = Boostok
zen-site-data-create-boost =

View File

@@ -281,7 +281,7 @@ zen-workspace-shortcut-switch-9 = Växla till arbetsyta 9
zen-workspace-shortcut-switch-10 = Växla till arbetsyta 10
zen-workspace-shortcut-forward = Vidarebefordra arbetsyta
zen-workspace-shortcut-backward = Bakåt arbetsyta
zen-workspace-shortcut-create = Create New Workspace
zen-workspace-shortcut-create = Skapa ny arbetsyta
zen-sidebar-shortcut-toggle = Växla sidofältets bredd
zen-pinned-tab-shortcut-reset = Återställ Fäst flik till Pinned URL
zen-split-view-shortcut-grid = Växla delad vy rutnät
@@ -319,4 +319,4 @@ zen-devtools-toggle-accessibility-shortcut = Växla tillgänglighetsinställning
zen-close-all-unpinned-tabs-shortcut = Stäng alla flikar som inte är fästa
zen-new-unsynced-window-shortcut = Nytt tomt fönster
zen-duplicate-tab-shortcut = Duplicera flik
zen-key-find-selection = Find Selection
zen-key-find-selection = Hitta val

View File

@@ -11,7 +11,7 @@ zen-boost-edit-reset =
zen-boost-edit-delete =
.label = Ta bort förändring
zen-boost-size = Storlek
zen-boost-case = Case
zen-boost-case = Fall
zen-boost-zap = Zappa
zen-boost-code = Kod
zen-boost-back = Tillbaka
@@ -48,9 +48,9 @@ zen-unzap-tooltip =
*[other] { $elementCount } flera element zappade
}
zen-boost-save =
.label = Export Boost
.label = Exportera förändring
zen-boost-load =
.label = Import Boost
.label = Importera förändring
zen-panel-ui-boosts-exported-message = Förändring exporterad!
zen-site-data-boosts = Förändringar
zen-site-data-create-boost =

View File

@@ -1,172 +0,0 @@
diff --git a/gfx/webrender_bindings/WebRenderAPI.cpp b/gfx/webrender_bindings/WebRenderAPI.cpp
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -298,11 +298,13 @@
panic_on_gl_error, picTileWidth, picTileHeight,
gfx::gfxVars::WebRenderRequiresHardwareDriver(),
StaticPrefs::gfx_webrender_low_quality_pinch_zoom_AtStartup(),
StaticPrefs::gfx_webrender_max_shared_surface_size_AtStartup(),
StaticPrefs::gfx_webrender_enable_subpixel_aa_AtStartup(),
- compositor->ShouldUseLayerCompositor())) {
+ compositor->ShouldUseLayerCompositor(),
+ StaticPrefs::
+ gfx_webrender_opaque_backdrop_fallback_AtStartup())) {
// wr_window_new puts a message into gfxCriticalNote if it returns
// false
MOZ_ASSERT(errorMessage);
error.AssignASCII(errorMessage);
wr_api_free_error_msg(errorMessage);
diff --git a/gfx/webrender_bindings/src/bindings.rs b/gfx/webrender_bindings/src/bindings.rs
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -1998,10 +1998,11 @@
reject_software_rasterizer: bool,
low_quality_pinch_zoom: bool,
max_shared_surface_size: i32,
enable_subpixel_aa: bool,
use_layer_compositor: bool,
+ opaque_backdrop_fallback: bool,
) -> bool {
assert!(unsafe { is_in_render_thread() });
// Ensure the WR profiler callbacks are hooked up to the Gecko profiler.
set_profiler_hooks(Some(&PROFILER_HOOKS));
@@ -2164,10 +2165,11 @@
texture_cache_config,
reject_software_rasterizer,
low_quality_pinch_zoom,
max_shared_surface_size,
enable_dithering,
+ opaque_backdrop_fallback,
..Default::default()
};
let window_size = DeviceIntSize::new(window_width, window_height);
let notifier = Box::new(CppNotifier { window_id });
diff --git a/gfx/wr/webrender/src/device/gl.rs b/gfx/wr/webrender/src/device/gl.rs
--- a/gfx/wr/webrender/src/device/gl.rs
+++ b/gfx/wr/webrender/src/device/gl.rs
@@ -3982,10 +3982,14 @@
pub fn disable_color_write(&self) {
self.gl.color_mask(false, false, false, false);
}
+ pub fn set_color_mask(&self, r: bool, g: bool, b: bool, a: bool) {
+ self.gl.color_mask(r, g, b, a);
+ }
+
pub fn set_blend(&mut self, enable: bool) {
if enable {
self.gl.enable(gl::BLEND);
} else {
self.gl.disable(gl::BLEND);
diff --git a/gfx/wr/webrender/src/renderer/init.rs b/gfx/wr/webrender/src/renderer/init.rs
--- a/gfx/wr/webrender/src/renderer/init.rs
+++ b/gfx/wr/webrender/src/renderer/init.rs
@@ -204,10 +204,12 @@
pub low_quality_pinch_zoom: bool,
pub max_shared_surface_size: i32,
/// If true, open a debug socket to listen for remote debugger.
/// Relies on `debugger` cargo feature being enabled.
pub enable_debugger: bool,
+ /// See explanation of `gfx.webrender.opaque-backdrop-fallback`.
+ pub opaque_backdrop_fallback: bool,
/// Use the new quad primitive path for box-shadow blur rendering.
pub use_quad_box_shadow: bool,
}
@@ -277,10 +279,11 @@
enable_instancing: true,
reject_software_rasterizer: false,
low_quality_pinch_zoom: false,
max_shared_surface_size: 2048,
enable_debugger: true,
+ opaque_backdrop_fallback: false,
use_quad_box_shadow: true,
}
}
}
@@ -802,10 +805,11 @@
allocated_native_surfaces: FastHashSet::default(),
debug_overlay_state: DebugOverlayState::new(),
buffer_damage_tracker: BufferDamageTracker::default(),
max_primitive_instance_count,
enable_instancing: options.enable_instancing,
+ opaque_backdrop_fallback: options.opaque_backdrop_fallback,
consecutive_oom_frames: 0,
target_frame_publish_id: None,
pending_result_msg: None,
layer_compositor_frame_state_in_prev_frame: None,
external_composite_debug_items: Vec::new(),
diff --git a/gfx/wr/webrender/src/renderer/mod.rs b/gfx/wr/webrender/src/renderer/mod.rs
--- a/gfx/wr/webrender/src/renderer/mod.rs
+++ b/gfx/wr/webrender/src/renderer/mod.rs
@@ -867,10 +867,12 @@
buffer_damage_tracker: BufferDamageTracker,
max_primitive_instance_count: usize,
enable_instancing: bool,
+ opaque_backdrop_fallback: bool,
+
/// Count consecutive oom frames to detectif we are stuck unable to render
/// in a loop.
consecutive_oom_frames: u32,
/// update() defers processing of ResultMsg, if frame_publish_id of
@@ -2787,18 +2789,29 @@
let read_target = ReadTarget::from_texture(cache_texture);
// Should always be drawing to picture cache tiles or off-screen surface!
debug_assert!(!draw_target.is_default());
let device_to_framebuffer = Scale::new(1i32);
+ let dest_fb_rect = dest * device_to_framebuffer;
self.device.blit_render_target(
read_target,
src * device_to_framebuffer,
draw_target,
- dest * device_to_framebuffer,
+ dest_fb_rect,
TextureFilter::Linear,
);
+
+ if self.opaque_backdrop_fallback {
+ self.device.set_color_mask(false, false, false, true);
+ self.device.clear_target(
+ Some([0.0, 0.0, 0.0, 1.0]),
+ None,
+ Some(dest_fb_rect),
+ );
+ self.device.set_color_mask(true, true, true, true);
+ }
}
}
}
fn draw_picture_cache_target(
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -8439,10 +8439,17 @@
#else
value: false
#endif
mirror: once
+# Make backdrop-filter treat its captured backdrop as if it had been
+# composited over an opaque-black background. (See bug 2036640)
+- name: gfx.webrender.opaque-backdrop-fallback
+ type: bool
+ value: true
+ mirror: once
+
# Disable wait of GPU execution completion
- name: gfx.webrender.wait-gpu-finished.disabled
type: bool
value: false
mirror: once

View File

@@ -0,0 +1,14 @@
diff --git a/image/AutoRestoreSVGState.h b/image/AutoRestoreSVGState.h
index be639a7b78c13c2d56be49a9690bf711ccaf0a8f..28bea58034ead1206d77521934e92d3a69bfd84b 100644
--- a/image/AutoRestoreSVGState.h
+++ b/image/AutoRestoreSVGState.h
@@ -47,6 +47,9 @@ class MOZ_STACK_CLASS AutoRestoreSVGState final {
}
return dom::PrefersColorSchemeOverride::None;
}());
+ pc->SetZenBoostsOverride(aSVGContext.GetZenBoostsAccent(),
+ aSVGContext.GetZenBoostsComplementaryRotation(),
+ aSVGContext.GetZenBoostsInverted());
}
aSVGDocumentWrapper->mIsDrawing = true;

View File

@@ -0,0 +1,39 @@
diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h
index 13aa7141c8e5297d0dd6aa9bd78fd32f050e8123..149a89e928d354f116c54f71605830f5ec6b7f8a 100644
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -594,6 +594,22 @@ class nsPresContext : public nsISupports,
*/
void SetColorSchemeOverride(mozilla::dom::PrefersColorSchemeOverride);
+ // Zen boosts override. SVG images render in their own document, which has no
+ // BrowsingContext to carry the page's boost, so the host propagates it here.
+ void SetZenBoostsOverride(nscolor aAccent, float aComplementaryRotation,
+ bool aInverted) {
+ mZenBoostsOverrideAccent = aAccent;
+ mZenBoostsOverrideComplementaryRotation = aComplementaryRotation;
+ mZenBoostsOverrideInverted = aInverted;
+ mHasZenBoostsOverride = true;
+ }
+ bool HasZenBoostsOverride() const { return mHasZenBoostsOverride; }
+ nscolor ZenBoostsOverrideAccent() const { return mZenBoostsOverrideAccent; }
+ float ZenBoostsOverrideComplementaryRotation() const {
+ return mZenBoostsOverrideComplementaryRotation;
+ }
+ bool ZenBoostsOverrideInverted() const { return mZenBoostsOverrideInverted; }
+
/**
* Return the device's screen size in inches, for font size
* inflation.
@@ -1441,6 +1457,11 @@ class nsPresContext : public nsISupports,
mozilla::dom::PrefersColorSchemeOverride mOverriddenOrEmbedderColorScheme;
mozilla::StyleForcedColors mForcedColors;
+ nscolor mZenBoostsOverrideAccent = 0;
+ float mZenBoostsOverrideComplementaryRotation = 0.0f;
+ bool mZenBoostsOverrideInverted = false;
+ bool mHasZenBoostsOverride = false;
+
protected:
virtual ~nsPresContext();

View File

@@ -1,5 +1,5 @@
diff --git a/layout/painting/nsImageRenderer.cpp b/layout/painting/nsImageRenderer.cpp
index 4acb7670e971024f9c63e48ff711bbdd1dc02301..9ac1ae1b66eb6fb10195cd3709e0e29d8d53b574 100644
index 4acb7670e971024f9c63e48ff711bbdd1dc02301..518543f29f396d819a71edb984879de22f8434a8 100644
--- a/layout/painting/nsImageRenderer.cpp
+++ b/layout/painting/nsImageRenderer.cpp
@@ -90,7 +90,7 @@ static already_AddRefed<imgIContainer> GetSymbolicIconImage(nsAtom* aName,
@@ -29,7 +29,16 @@ index 4acb7670e971024f9c63e48ff711bbdd1dc02301..9ac1ae1b66eb6fb10195cd3709e0e29d
renderer.BuildWebRenderDisplayItems(aBuilder, aSc, aDest, aFill,
aRepeatSize, aSrc,
@@ -1076,7 +1076,7 @@ ImgDrawResult nsImageRenderer::DrawShapeImage(nsPresContext* aPresContext,
@@ -670,6 +670,8 @@ ImgDrawResult nsImageRenderer::BuildWebRenderDisplayItems(
nsPresContext::AppUnitsToIntCSSPixels(aDest.height)};
SVGImageContext svgContext(Some(destCSSSize));
+ SVGImageContext::MaybeStoreZenBoosts(svgContext,
+ *mForFrame->PresContext());
Maybe<ImageIntRegion> region;
const int32_t appUnitsPerDevPixel =
@@ -1076,7 +1078,7 @@ ImgDrawResult nsImageRenderer::DrawShapeImage(nsPresContext* aPresContext,
if (mImage->IsGradient()) {
nsCSSGradientRenderer renderer = nsCSSGradientRenderer::Create(

View File

@@ -1,8 +1,45 @@
diff --git a/layout/svg/SVGImageContext.cpp b/layout/svg/SVGImageContext.cpp
index ecbda963b75fb70b62885a0c8f7a517011a8d5dc..1200a51aee7db4ee1a014308581ada1002c0d05f 100644
index ecbda963b75fb70b62885a0c8f7a517011a8d5dc..5f55f0a4174db830656d434b5295835ab18e6619 100644
--- a/layout/svg/SVGImageContext.cpp
+++ b/layout/svg/SVGImageContext.cpp
@@ -57,12 +57,14 @@ void SVGImageContext::MaybeStoreContextPaint(SVGImageContext& aContext,
@@ -10,6 +10,7 @@
#include "mozilla/LookAndFeel.h"
#include "mozilla/ServoCSSParser.h"
#include "mozilla/StaticPrefs_svg.h"
+#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/dom/Document.h"
#include "nsIFrame.h"
#include "nsISVGPaintContext.h"
@@ -18,6 +19,19 @@
namespace mozilla {
+/* static */
+void SVGImageContext::MaybeStoreZenBoosts(SVGImageContext& aContext,
+ const nsPresContext& aPresContext) {
+ if (dom::Document* doc = aPresContext.Document()) {
+ if (dom::BrowsingContext* bc = doc->GetBrowsingContext()) {
+ bc = bc->Top();
+ aContext.SetZenBoosts(bc->ZenBoostsData(),
+ bc->ZenBoostsComplementaryRotation(),
+ bc->IsZenBoostsInverted());
+ }
+ }
+}
+
/* static */
void SVGImageContext::MaybeStoreContextPaint(SVGImageContext& aContext,
nsIFrame* aFromFrame,
@@ -43,6 +57,8 @@ void SVGImageContext::MaybeStoreContextPaint(SVGImageContext& aContext,
aContext.SetColorScheme(Some(scheme));
}
+ MaybeStoreZenBoosts(aContext, aPresContext);
+
const nsStyleSVG* style = aStyle.StyleSVG();
if (!style->ExposesContextProperties()) {
// Content must have '-moz-context-properties' set to the names of the
@@ -57,12 +73,14 @@ void SVGImageContext::MaybeStoreContextPaint(SVGImageContext& aContext,
if ((style->mMozContextProperties.bits & StyleContextPropertyBits::FILL) &&
style->mFill.kind.IsColor()) {
haveContextPaint = true;

View File

@@ -0,0 +1,80 @@
diff --git a/layout/svg/SVGImageContext.h b/layout/svg/SVGImageContext.h
index 159d9cbbd0711076ee6c2a71a3da04bd92a0102c..daefc40590c4d7d7fac9db25c6ec4ba2424dded5 100644
--- a/layout/svg/SVGImageContext.h
+++ b/layout/svg/SVGImageContext.h
@@ -6,6 +6,7 @@
#define LAYOUT_SVG_SVGIMAGECONTEXT_H_
#include "Units.h"
+#include "nsColor.h"
#include "mozilla/Maybe.h"
#include "mozilla/SVGContextPaint.h"
#include "mozilla/SVGPreserveAspectRatio.h"
@@ -63,6 +64,11 @@ class SVGImageContext {
nsISVGPaintContext* aPaintContext,
imgIContainer* aImgContainer);
+ // Carry the host document's Zen boost into the image context so the image
+ // renders with the same accent/inversion as the page.
+ static void MaybeStoreZenBoosts(SVGImageContext& aContext,
+ const nsPresContext& aPresContext);
+
const Maybe<CSSIntSize>& GetViewportSize() const { return mViewportSize; }
void SetViewportSize(const Maybe<CSSIntSize>& aSize) {
@@ -75,6 +81,21 @@ class SVGImageContext {
mColorScheme = aScheme;
}
+ // Zen boosts state carried from the host document so the image renders with
+ // the same boost. Part of the cache key below so boosted and unboosted
+ // renderings don't collide.
+ void SetZenBoosts(nscolor aAccent, float aComplementaryRotation,
+ bool aInverted) {
+ mZenBoostsAccent = aAccent;
+ mZenBoostsComplementaryRotation = aComplementaryRotation;
+ mZenBoostsInverted = aInverted;
+ }
+ nscolor GetZenBoostsAccent() const { return mZenBoostsAccent; }
+ float GetZenBoostsComplementaryRotation() const {
+ return mZenBoostsComplementaryRotation;
+ }
+ bool GetZenBoostsInverted() const { return mZenBoostsInverted; }
+
const Maybe<SVGPreserveAspectRatio>& GetPreserveAspectRatio() const {
return mPreserveAspectRatio;
}
@@ -107,7 +128,11 @@ class SVGImageContext {
return contextPaintIsEqual && mViewportSize == aOther.mViewportSize &&
mPreserveAspectRatio == aOther.mPreserveAspectRatio &&
- mColorScheme == aOther.mColorScheme;
+ mColorScheme == aOther.mColorScheme &&
+ mZenBoostsAccent == aOther.mZenBoostsAccent &&
+ mZenBoostsComplementaryRotation ==
+ aOther.mZenBoostsComplementaryRotation &&
+ mZenBoostsInverted == aOther.mZenBoostsInverted;
}
bool operator!=(const SVGImageContext&) const = default;
@@ -119,7 +144,9 @@ class SVGImageContext {
}
return HashGeneric(hash, mViewportSize.map(HashSize).valueOr(0),
mPreserveAspectRatio.map(HashPAR).valueOr(0),
- mColorScheme.map(HashColorScheme).valueOr(0));
+ mColorScheme.map(HashColorScheme).valueOr(0),
+ mZenBoostsAccent, mZenBoostsComplementaryRotation,
+ mZenBoostsInverted);
}
private:
@@ -138,6 +165,9 @@ class SVGImageContext {
Maybe<CSSIntSize> mViewportSize;
Maybe<SVGPreserveAspectRatio> mPreserveAspectRatio;
Maybe<ColorScheme> mColorScheme;
+ nscolor mZenBoostsAccent = 0;
+ float mZenBoostsComplementaryRotation = 0.0f;
+ bool mZenBoostsInverted = false;
};
} // namespace mozilla

View File

@@ -0,0 +1,56 @@
diff --git a/widget/Theme.cpp b/widget/Theme.cpp
index 766a8ca4bc6fcc98f719ad4f472b20bc1d198ac9..be4419cfafb55e5cac8f5de741185ee3cabc4722 100644
--- a/widget/Theme.cpp
+++ b/widget/Theme.cpp
@@ -18,6 +18,7 @@
#include "mozilla/RelativeLuminanceUtils.h"
#include "mozilla/ScrollContainerFrame.h"
#include "mozilla/StaticPrefs_widget.h"
+#include "mozilla/nsZenBoostsBackend.h"
#include "mozilla/webrender/WebRenderAPI.h"
#include "nsCSSColorUtils.h"
#include "nsCSSRendering.h"
@@ -670,10 +671,15 @@ template <typename PaintBackendData>
void Theme::PaintTextField(PaintBackendData& aPaintData,
const LayoutDeviceRect& aRect,
const ElementState& aState, const Colors& aColors,
- DPIRatio aDpiRatio) {
+ DPIRatio aDpiRatio, const nsIFrame* aFrame) {
auto [backgroundColor, borderColor] =
ComputeTextfieldColors(aState, aColors, OutlineCoversBorder::Yes);
+ // The default field background comes from a theme/system color rather than a
+ // resolved style color, so apply Zen boosts here to match boosted content.
+ backgroundColor = sRGBColor::FromABGR(zen::nsZenBoostsBackend::ResolveStyleColor(
+ backgroundColor.ToABGR(), aFrame));
+
const CSSCoord radius = 2.0f;
ThemeDrawing::PaintRoundedRectWithRadius(aPaintData, aRect, backgroundColor,
@@ -690,9 +696,9 @@ template <typename PaintBackendData>
void Theme::PaintListbox(PaintBackendData& aPaintData,
const LayoutDeviceRect& aRect,
const ElementState& aState, const Colors& aColors,
- DPIRatio aDpiRatio) {
+ DPIRatio aDpiRatio, const nsIFrame* aFrame) {
// We happen to share style between text fields and list boxes.
- return PaintTextField(aPaintData, aRect, aState, aColors, aDpiRatio);
+ return PaintTextField(aPaintData, aRect, aState, aColors, aDpiRatio, aFrame);
}
template <typename PaintBackendData>
@@ -1158,10 +1164,12 @@ bool Theme::DoDrawWidgetBackground(PaintBackendData& aPaintData,
case StyleAppearance::Textfield:
case StyleAppearance::NumberInput:
case StyleAppearance::PasswordInput:
- PaintTextField(aPaintData, devPxRect, elementState, colors, dpiRatio);
+ PaintTextField(aPaintData, devPxRect, elementState, colors, dpiRatio,
+ aFrame);
break;
case StyleAppearance::Listbox:
- PaintListbox(aPaintData, devPxRect, elementState, colors, dpiRatio);
+ PaintListbox(aPaintData, devPxRect, elementState, colors, dpiRatio,
+ aFrame);
break;
case StyleAppearance::Menulist:
PaintMenulist(aPaintData, devPxRect, elementState, colors, dpiRatio);

19
src/widget/Theme-h.patch Normal file
View File

@@ -0,0 +1,19 @@
diff --git a/widget/Theme.h b/widget/Theme.h
index 4e0acbb25b9e39b712a2d96d8dee366dfdce4a01..9aa377ca9f0d7f96d938339d198b797ceebbc602 100644
--- a/widget/Theme.h
+++ b/widget/Theme.h
@@ -161,10 +161,12 @@ class Theme : protected nsNativeTheme, public nsITheme {
const ElementState&, DPIRatio);
template <typename PaintBackendData>
void PaintTextField(PaintBackendData&, const LayoutDeviceRect&,
- const ElementState&, const Colors&, DPIRatio);
+ const ElementState&, const Colors&, DPIRatio,
+ const nsIFrame*);
template <typename PaintBackendData>
void PaintListbox(PaintBackendData&, const LayoutDeviceRect&,
- const ElementState&, const Colors&, DPIRatio);
+ const ElementState&, const Colors&, DPIRatio,
+ const nsIFrame*);
template <typename PaintBackendData>
void PaintMenulist(PaintBackendData&, const LayoutDeviceRect&,
const ElementState&, const Colors&, DPIRatio);

View File

@@ -386,8 +386,9 @@ 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.
* Author-facing content that happens to be native-anonymous is not exempt:
* UA-widget form-control internals (including the text the user types into an
* input), and pseudo-elements such as ::before/::after/::marker/::placeholder.
*/
ZEN_HOT_FUNCTION
inline static bool IsBoostExemptFrame(const nsIFrame* aFrame) {
@@ -398,21 +399,17 @@ inline static bool IsBoostExemptFrame(const nsIFrame* aFrame) {
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;
}
}
// Form-control internals (and media controls) live in UA-widget shadow
// trees; the text typed into an input is author content and should be
// boosted. Classic native-anonymous UI (scrollbars, devtools) has no
// containing shadow and falls through to the pseudo-element check below.
if (content->GetContainingShadow()) {
return false;
}
return true;
const nsIContent* root = content->GetClosestNativeAnonymousSubtreeRoot();
return !root || !root->IsElement() ||
!mozilla::PseudoStyle::IsPseudoElement(
root->AsElement()->GetPseudoElementType());
}
/**
@@ -429,6 +426,15 @@ inline static void GetZenBoostsDataForFrame(const nsIFrame* aFrame,
if (!presContext) {
return;
}
// SVG images render in their own document with no BrowsingContext; the host
// propagates its boost onto the image document's PresContext instead.
if (presContext->HasZenBoostsOverride()) {
*aData = presContext->ZenBoostsOverrideAccent();
*aComplementaryRotation =
presContext->ZenBoostsOverrideComplementaryRotation();
*aIsInverted = presContext->ZenBoostsOverrideInverted();
return;
}
const mozilla::dom::BrowsingContext* browsingContext = nullptr;
if (auto document = presContext->Document()) {
browsingContext = document->GetBrowsingContext();

View File

@@ -81,6 +81,49 @@ const globalActionsTemplate = [
return !tab.hasAttribute("zen-empty-tab") && tab.pinned;
},
},
{
label: "New Boost",
icon: "chrome://browser/skin/zen-icons/boost.svg",
isAvailable: window => {
if (!isNotEmptyTab(window)) {
return false;
}
// Keep this action consistent with the rest of the Boosts UI.
if (!Services.prefs.getBoolPref("zen.boosts.enabled", false)) {
return false;
}
const uri = window.gBrowser.currentURI;
return !!uri?.schemeIs && (uri.schemeIs("http") || uri.schemeIs("https"));
},
command: window => {
const uri = window.gBrowser.currentURI;
if (!uri?.schemeIs || !(uri.schemeIs("http") || uri.schemeIs("https"))) {
return;
}
let domain = "";
try {
domain = uri.host;
} catch {
return;
}
if (!domain) {
return;
}
const { gZenBoostsManager } = ChromeUtils.importESModule(
"resource:///modules/zen/boosts/ZenBoostsManager.sys.mjs"
);
const boost = gZenBoostsManager.createNewBoost(domain);
if (!boost) {
return;
}
gZenBoostsManager.openBoostWindow(window, boost, uri);
},
},
{
label: "Next Space",
command: "cmd_zenWorkspaceForward",