refactor(core): use `in_clip` in marquee
What changed, and why it matters
This is a small internal code cleanup in the Trezor firmware's user-interface code. It changes how a scrolling text effect (marquee) clips its drawing to the screen, removing a manual vertical offset workaround. There is no indication this change fixes a security vulnerability or affects device security.
No security action required. Review as normal UI refactor if validating the change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors the Marquee component to use in_clip instead of in_window for clipping the rendered text, and removes the y_offset field and set_y_offset method that was previously used to work around clipping mismatches with the vertical menu. The button layout code is updated to stop setting the now-removed offset. This is a UI rendering refactor with no security-relevant behavior change evident from the diff.
Changed components
core/embed/rust/src/ui/component/marquee.rscore/embed/rust/src/ui/layout_eckhart/component/button.rsInspect captured patch +2 / −9
diff --git a/core/embed/rust/src/ui/component/marquee.rs b/core/embed/rust/src/ui/component/marquee.rs
index f69b54055..d4c9f8c27 100644
--- a/core/embed/rust/src/ui/component/marquee.rs
+++ b/core/embed/rust/src/ui/component/marquee.rs
@@ -24,7 +24,6 @@ enum State {
pub struct Marquee {
area: Rect,
- y_offset: i16,
pause_timer: Timer,
min_offset: i16,
max_offset: i16,
@@ -41,7 +40,6 @@ impl Marquee {
pub const fn new(text: TString<'static>, font: Font, fg: Color, bg: Color) -> Self {
Self {
area: Rect::zero(),
- y_offset: 0,
pause_timer: Timer::new(),
min_offset: 0,
max_offset: 0,
@@ -55,10 +53,6 @@ impl Marquee {
}
}
- pub fn set_y_offset(&mut self, y_offset: i16) {
- self.y_offset = y_offset;
- }
-
pub fn set_text(&mut self, text: TString<'static>) {
self.text = text;
}
@@ -126,9 +120,9 @@ impl Marquee {
}
pub fn render_anim<'s>(&'s self, target: &mut impl Renderer<'s>, offset: i16) {
- target.in_window(self.area, &|target| {
+ target.in_clip(self.area, &|target| {
let text_height = self.font.text_height();
- let pos = self.area.top_left() + Offset::new(offset, text_height - 1 + self.y_offset);
+ let pos = self.area.top_left() + Offset::new(offset, text_height - 1);
self.text.map(|t| {
shape::Text::new(pos, t, self.font)
.with_fg(self.fg)
diff --git a/core/embed/rust/src/ui/layout_eckhart/component/button.rs b/core/embed/rust/src/ui/layout_eckhart/component/button.rs
index 81d072587..880643105 100644
--- a/core/embed/rust/src/ui/layout_eckhart/component/button.rs
+++ b/core/embed/rust/src/ui/layout_eckhart/component/button.rs
@@ -648,7 +648,6 @@ impl Component for Button {
let subtext_start =
self.baseline_text_height() * 2 + constant::LINE_SPACE + self.baseline_subtext_height();
if let Some(m) = &mut self.subtext_marquee {
- m.set_y_offset(subtext_start);
m.place(
self.area
.inset(Insets::top(subtext_start))
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.