Call the record's boxes what they are
The offer names are from the protocol before this one, where a widget was drawn twice and the record had to say which drawing was the question. It is asked once now, so offer_part is the part it was asked in, offer_place the place it was asked at, and place where its drawing was put: part, asked and placed. LayoutHolds::frame is a range on the window since the frame became a length of one, and the frame's own entry is the frame_len pin beside it, so it is window; Painter::frame_own goes with it. answers_at had one caller and said less than the line that replaces it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
adbedaf264
commit
a30971e4c5
6 files changed
+67
-71
No files matched your search
+12
-10
@@ -42,7 +42,7 @@ pub struct Painter<'a> {
|
||||
pub(super) size_deps: Vec<WidgetId>,
|
||||
/// What this draw itself read of the window in pixels, per axis: every
|
||||
/// window until it reads one, then that one, unless it says otherwise.
|
||||
pub(super) frame_own: [Holds; 2],
|
||||
pub(super) window_own: [Holds; 2],
|
||||
/// Its frame's symbolic length where this draw read it, which makes the
|
||||
/// drawing one that holds for that frame alone.
|
||||
pub(super) frame_own_len: [Option<Len>; 2],
|
||||
@@ -192,8 +192,8 @@ impl<'a> Painter<'a> {
|
||||
mask: self.mask,
|
||||
frame,
|
||||
part: extent,
|
||||
place,
|
||||
offer_place: place,
|
||||
placed: place,
|
||||
asked: place,
|
||||
narrow,
|
||||
re_asked,
|
||||
px,
|
||||
@@ -429,7 +429,7 @@ impl<'a> Painter<'a> {
|
||||
pub fn to_px(&mut self, len: Len, axis: Axis) -> Px {
|
||||
let window = self.window.axis(axis);
|
||||
if len.rel != Rel::ZERO {
|
||||
let own = &mut self.frame_own[axis as usize];
|
||||
let own = &mut self.window_own[axis as usize];
|
||||
if *own == Holds::ANY {
|
||||
*own = Holds::at(window);
|
||||
}
|
||||
@@ -437,8 +437,10 @@ impl<'a> Painter<'a> {
|
||||
len.to_px(window)
|
||||
}
|
||||
|
||||
/// A validity range already stated about the window. Containers use
|
||||
/// this after branching on a window-unit length.
|
||||
/// The windows this drawing holds for, stated rather than taken: a
|
||||
/// container that branched on a length in pixels says which side of the
|
||||
/// boundary it was on, which is wider than the one window reading that
|
||||
/// length pins, and replaces it.
|
||||
pub fn window_holds(&mut self, axis: Axis, holds: impl Into<Holds>) {
|
||||
let holds = holds.into();
|
||||
debug_assert!(
|
||||
@@ -447,7 +449,7 @@ impl<'a> Painter<'a> {
|
||||
self.label(),
|
||||
self.id
|
||||
);
|
||||
self.frame_own[axis as usize] = holds;
|
||||
self.window_own[axis as usize] = holds;
|
||||
}
|
||||
|
||||
pub fn text_data(&mut self) -> &mut TextData {
|
||||
@@ -563,7 +565,7 @@ impl Painter<'_> {
|
||||
let n = axis as usize;
|
||||
// Every frame range is already a range on the window: the
|
||||
// widget's own read converted through its frame exactly once.
|
||||
result.frame[n] = holds.frame[n];
|
||||
result.window[n] = holds.window[n];
|
||||
let reaches = narrow[n].is_none()
|
||||
&& !matches!(place[n].part(), Part::Sized(_))
|
||||
&& declared[n].is_none_or(|len| len.rel != Rel::ZERO);
|
||||
@@ -599,8 +601,8 @@ impl Painter<'_> {
|
||||
// it, so what it holds for is a range on the frame and none
|
||||
// of it on this widget's own box.
|
||||
_ => {
|
||||
result.frame[n] =
|
||||
result.frame[n].and(holds.extent[n].through(extent.axis(axis).len()));
|
||||
result.window[n] =
|
||||
result.window[n].and(holds.extent[n].through(extent.axis(axis).len()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user