Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More fmt changes #839

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions masonry/src/passes/accessibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ use tracing::{debug, info_span, trace};
use tree_arena::ArenaMut;
use vello::kurbo::Rect;

use crate::passes::recurse_on_children;
use crate::passes::{enter_span_if, recurse_on_children};
use crate::render_root::{RenderRoot, RenderRootState};
use crate::{AccessCtx, Widget, WidgetState};

use super::enter_span_if;

// --- MARK: BUILD TREE ---
fn build_accessibility_tree(
global_state: &mut RenderRootState,
Expand Down
4 changes: 1 addition & 3 deletions masonry/src/widget/progress_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ use vello::Scene;
use crate::kurbo::Size;
use crate::paint_scene_helpers::{fill_lin_gradient, stroke, UnitPoint};
use crate::text::ArcStr;
use crate::widget::WidgetMut;
use crate::widget::{Label, LineBreaking, WidgetMut, WidgetPod};
use crate::{
theme, AccessCtx, AccessEvent, BoxConstraints, EventCtx, LayoutCtx, PaintCtx, Point,
PointerEvent, QueryCtx, RegisterCtx, TextEvent, Update, UpdateCtx, Widget, WidgetId,
};

use super::{Label, LineBreaking, WidgetPod};

/// A progress bar.
pub struct ProgressBar {
/// A value in the range `[0, 1]` inclusive, where 0 is 0% and 1 is 100% complete.
Expand Down
15 changes: 6 additions & 9 deletions masonry/src/widget/prose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ use tracing::{trace_span, Span};
use vello::kurbo::{Point, Rect, Size};
use vello::Scene;

use crate::widget::WidgetMut;
use crate::widget::{Padding, TextArea, WidgetMut, WidgetPod};
use crate::{
AccessCtx, AccessEvent, BoxConstraints, EventCtx, LayoutCtx, PaintCtx, PointerEvent, QueryCtx,
RegisterCtx, TextEvent, Update, UpdateCtx, Widget, WidgetId,
};

use super::{Padding, TextArea, WidgetPod};

/// Added padding between each horizontal edge of the widget
/// and the text in logical pixels.
///
Expand Down Expand Up @@ -161,15 +159,14 @@ impl Widget for Prose {
// TODO - Add more tests
#[cfg(test)]
mod tests {
use parley::{layout::Alignment, StyleProperty};
use parley::layout::Alignment;
use parley::StyleProperty;
use vello::kurbo::Size;

use super::*;
use crate::{
assert_render_snapshot,
testing::TestHarness,
widget::{CrossAxisAlignment, Flex, SizedBox, TextArea},
};
use crate::assert_render_snapshot;
use crate::testing::TestHarness;
use crate::widget::{CrossAxisAlignment, Flex, SizedBox, TextArea};

#[test]
/// A wrapping prose's alignment should be respected, regardless of
Expand Down
6 changes: 2 additions & 4 deletions masonry/src/widget/text_area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,18 @@
use std::mem::Discriminant;
use std::time::Instant;

use crate::kurbo::{Affine, Point, Size};
use crate::text::{default_styles, render_text};
use accesskit::{Node, NodeId, Role};
use parley::editor::{Generation, SplitString};
use parley::layout::Alignment;
use parley::PlainEditor;
use smallvec::SmallVec;
use tracing::{trace_span, Span};
use vello::kurbo::{Rect, Vec2};
use vello::kurbo::{Affine, Point, Rect, Size, Vec2};
use vello::peniko::{Brush, Fill};
use vello::Scene;
use winit::keyboard::{Key, NamedKey};

use crate::text::{BrushIndex, StyleProperty};
use crate::text::{default_styles, render_text, BrushIndex, StyleProperty};
use crate::widget::{Padding, WidgetMut};
use crate::{
palette, theme, AccessCtx, AccessEvent, BoxConstraints, CursorIcon, EventCtx, LayoutCtx,
Expand Down
11 changes: 5 additions & 6 deletions masonry/src/widget/textbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ use tracing::{trace_span, Span};
use vello::kurbo::{Affine, Insets, Point, Rect, Size, Stroke};
use vello::Scene;

use crate::widget::WidgetMut;
use crate::widget::{Padding, TextArea, WidgetMut, WidgetPod};
use crate::{
AccessCtx, AccessEvent, BoxConstraints, Color, EventCtx, LayoutCtx, PaintCtx, PointerEvent,
QueryCtx, RegisterCtx, TextEvent, Update, UpdateCtx, Widget, WidgetId,
};

use super::{Padding, TextArea, WidgetPod};

/// Added padding between each horizontal edge of the widget
/// and the text in logical pixels.
///
Expand Down Expand Up @@ -180,9 +178,10 @@ mod tests {
use vello::kurbo::Size;

use super::*;
use crate::{
assert_render_snapshot, testing::TestHarness, text::StyleProperty, widget::TextArea,
};
use crate::assert_render_snapshot;
use crate::testing::TestHarness;
use crate::text::StyleProperty;
use crate::widget::TextArea;

#[test]
fn textbox_outline() {
Expand Down
4 changes: 1 addition & 3 deletions masonry/src/widget/variable_label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ use vello::kurbo::{Point, Size};
use vello::Scene;

use crate::text::{ArcStr, StyleProperty};
use crate::widget::WidgetMut;
use crate::widget::{Label, WidgetMut, WidgetPod};
use crate::{
AccessCtx, AccessEvent, BoxConstraints, EventCtx, FontWeight, LayoutCtx, PaintCtx,
PointerEvent, QueryCtx, RegisterCtx, TextEvent, Update, UpdateCtx, Widget, WidgetId,
};

use super::{Label, WidgetPod};

/// An `f32` value which can move towards a target value at a linear rate over time.
#[derive(Clone, Debug)]
pub struct AnimatedF32 {
Expand Down
11 changes: 7 additions & 4 deletions masonry/src/widget/zstack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@

#![warn(missing_docs)]

use crate::{
vello::Scene, widget::WidgetMut, AccessCtx, BoxConstraints, LayoutCtx, PaintCtx, Point,
QueryCtx, RegisterCtx, Size, Widget, WidgetId, WidgetPod,
};
use accesskit::{Node, Role};
use smallvec::SmallVec;
use tracing::trace_span;

use crate::vello::Scene;
use crate::widget::WidgetMut;
use crate::{
AccessCtx, BoxConstraints, LayoutCtx, PaintCtx, Point, QueryCtx, RegisterCtx, Size, Widget,
WidgetId, WidgetPod,
};

struct Child {
widget: WidgetPod<dyn Widget>,
alignment: ChildAlignment,
Expand Down
3 changes: 2 additions & 1 deletion xilem_web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
#![expect(clippy::allow_attributes, reason = "Deferred: Noisy")]
#![expect(clippy::allow_attributes_without_reason, reason = "Deferred: Noisy")]

use std::{any::Any, ops::Deref as _};
use std::any::Any;
use std::ops::Deref as _;

use web_sys::wasm_bindgen::JsCast;

Expand Down
Loading