Merge branch 'red/rf-widgets' into area/ribbon-fw

This commit is contained in:
Martin Ball committed 2026-11-18 23:12:13 +00:00
commit 1f7435ae3c
5 files changed
+19 -2

No files matched your search

@@ -328,7 +328,7 @@ pub(crate) fn report(ctx: &Context, own: &Own<'_>) {
description: spec.description.clone(),
unnamed,
inner_stop: None,
focusable: own.focusable,
focusable: own.focusable || crate::runtime::focus::has_reachable_stop(ctx, own.id),
disabled: !own.enabled,
},
);
@@ -166,7 +166,7 @@ pub(crate) struct ScopeNode {
pub unnamed: Option<Finding>,
/// The first focus stop inside a control that has none of its own: where a click on its label moves focus.
pub inner_stop: Option<crate::runtime::focus::FocusTarget>,
/// The node takes key focus itself.
/// The control takes key focus, at its own stop or at a part's (a segmented control's segments).
pub focusable: bool,
/// The control is disabled: a label that names only disabled controls is disabled too.
pub disabled: bool,
+6
View File
@@ -339,6 +339,12 @@ pub(crate) fn targets(ctx: &Context) -> [Option<Id>; 2] {
[focused_stop(ctx).map(|key| key.0), with(ctx, |state| state.revealed.map(|key| key.0))]
}
/// Whether the component `id` registered a stop this pass that Tab or a request can reach, its own or one of its
/// parts': a segmented control's stops are its segments. A press-only stop (the selection of a display text) is not one.
pub(crate) fn has_reachable_stop(ctx: &Context, id: Id) -> bool {
with(ctx, |state| state.stops.iter().any(|rec| rec.stop.id == id && !rec.stop.press_only))
}
/// Where a request for the component `id` goes when it has no stop of its own: the first stop registered since
/// `from` (a `stop_count`), which a component inside it holds.
pub(crate) fn first_stop_inside(ctx: &Context, id: Id, from: usize) -> Option<FocusTarget> {
@@ -165,6 +165,7 @@ fn rtl_from(story: &Story, ltr: &Fixture) -> Result<(), String> {
let rtl = shown_in(story, Direction::Rtl);
let own = (root_target(ltr).rect, root_target(&rtl).rect);
if (own.0.width() - own.1.width()).abs() > 0.5 {
eprintln!("DIAG rf-widgets rtl: {}: ltr rect {:?} rtl rect {:?}", story.name, own.0, own.1);
return Err(format!("{}: the component's width differs between directions", story.name));
}
// Each node is reflected within the component's own rect, then carried to the component's rect in the other
+10
View File
@@ -162,6 +162,16 @@ impl Component for ListRow<'_> {
};
let label = label.max(self.below_width(sizes));
let own = probe.ideal_width - sizes.min_label + label.max(sizes.min_label) + self.indent_full(sizes);
if !self.label_spans.is_empty() {
let spans = cx.layout(&self.label_run(cx.resolved.label).role(cx.style.text.role)).size().x;
let plain = cx.layout(&TextRun::new(cx.resolved.label).role(cx.style.text.role)).size().x;
let pieces: Vec<f32> =
self.label_spans.iter().map(|span| cx.layout(&TextRun::new(span.text.as_ref()).role(cx.style.text.role)).size().x).collect();
eprintln!(
"DIAG rf-widgets list_row_match_highlight: rtl {rtl} proposal {:?} room {:?} spans {spans} plain {plain} pieces {pieces:?} label {label} ideal {} min {} own {own}",
cx.proposal, cx.room, probe.ideal_width, probe.min_width
);
}
if cx.proposal == Proposal::Ideal {
self.report_cell_widths(cx, own);
}