mirror of https://github.com/linebender/xilem
Rename pass functions from root_xxx to run_xxx_pass (#675)
This means all the pass functions now have the same naming convention, which makes the code more grep-able.
This commit is contained in:
parent
c73beee706
commit
1258a258cd
|
@ -129,7 +129,7 @@ fn to_accesskit_rect(r: Rect, scale_factor: f64) -> accesskit::Rect {
|
|||
}
|
||||
|
||||
// --- MARK: ROOT ---
|
||||
pub(crate) fn root_accessibility(
|
||||
pub(crate) fn run_accessibility_pass(
|
||||
root: &mut RenderRoot,
|
||||
rebuild_all: bool,
|
||||
scale_factor: f64,
|
||||
|
|
|
@ -72,7 +72,7 @@ fn compose_widget(
|
|||
}
|
||||
|
||||
// --- MARK: ROOT ---
|
||||
pub(crate) fn root_compose(root: &mut RenderRoot) {
|
||||
pub(crate) fn run_compose_pass(root: &mut RenderRoot) {
|
||||
let _span = info_span!("compose").entered();
|
||||
|
||||
let (root_widget, root_state) = root.widget_arena.get_pair_mut(root.root.id());
|
||||
|
|
|
@ -79,7 +79,7 @@ fn run_event_pass<E>(
|
|||
// TODO - Send synthetic MouseLeave events
|
||||
|
||||
// --- MARK: POINTER_EVENT ---
|
||||
pub(crate) fn root_on_pointer_event(root: &mut RenderRoot, event: &PointerEvent) -> Handled {
|
||||
pub(crate) fn run_on_pointer_event_pass(root: &mut RenderRoot, event: &PointerEvent) -> Handled {
|
||||
let _span = info_span!("pointer_event").entered();
|
||||
if !event.is_high_density() {
|
||||
debug!("Running ON_POINTER_EVENT pass with {}", event.short_name());
|
||||
|
@ -126,7 +126,7 @@ pub(crate) fn root_on_pointer_event(root: &mut RenderRoot, event: &PointerEvent)
|
|||
// - If a Widget has focus, then none of its parents is hidden
|
||||
|
||||
// --- MARK: TEXT EVENT ---
|
||||
pub(crate) fn root_on_text_event(root: &mut RenderRoot, event: &TextEvent) -> Handled {
|
||||
pub(crate) fn run_on_text_event_pass(root: &mut RenderRoot, event: &TextEvent) -> Handled {
|
||||
let _span = info_span!("text_event").entered();
|
||||
if !event.is_high_density() {
|
||||
debug!("Running ON_TEXT_EVENT pass with {}", event.short_name());
|
||||
|
@ -165,7 +165,7 @@ pub(crate) fn root_on_text_event(root: &mut RenderRoot, event: &TextEvent) -> Ha
|
|||
}
|
||||
|
||||
// --- MARK: ACCESS EVENT ---
|
||||
pub(crate) fn root_on_access_event(
|
||||
pub(crate) fn run_on_access_event_pass(
|
||||
root: &mut RenderRoot,
|
||||
event: &AccessEvent,
|
||||
target: WidgetId,
|
||||
|
|
|
@ -205,7 +205,7 @@ pub(crate) fn run_layout_on<W: Widget>(
|
|||
}
|
||||
|
||||
// --- MARK: ROOT ---
|
||||
pub(crate) fn root_layout(root: &mut RenderRoot) {
|
||||
pub(crate) fn run_layout_pass(root: &mut RenderRoot) {
|
||||
if !root.root_state().needs_layout {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ fn paint_widget(
|
|||
}
|
||||
|
||||
// --- MARK: ROOT ---
|
||||
pub(crate) fn root_paint(root: &mut RenderRoot) -> Scene {
|
||||
pub(crate) fn run_paint_pass(root: &mut RenderRoot) -> Scene {
|
||||
let _span = info_span!("paint").entered();
|
||||
|
||||
let debug_paint = std::env::var("MASONRY_DEBUG_PAINT").is_ok_and(|it| !it.is_empty());
|
||||
|
|
|
@ -6,7 +6,7 @@ use std::collections::HashSet;
|
|||
use cursor_icon::CursorIcon;
|
||||
use tracing::{info_span, trace};
|
||||
|
||||
use crate::passes::event::root_on_pointer_event;
|
||||
use crate::passes::event::run_on_pointer_event_pass;
|
||||
use crate::passes::{merge_state_up, recurse_on_children};
|
||||
use crate::render_root::{RenderRoot, RenderRootSignal, RenderRootState};
|
||||
use crate::tree_arena::ArenaMut;
|
||||
|
@ -85,7 +85,7 @@ pub(crate) fn run_update_pointer_pass(root: &mut RenderRoot) {
|
|||
if let Some(id) = root.state.pointer_capture_target {
|
||||
if !root.is_still_interactive(id) {
|
||||
root.state.pointer_capture_target = None;
|
||||
root_on_pointer_event(root, &PointerEvent::new_pointer_leave());
|
||||
run_on_pointer_event_pass(root, &PointerEvent::new_pointer_leave());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,12 +18,14 @@ use web_time::Instant;
|
|||
use crate::debug_logger::DebugLogger;
|
||||
use crate::dpi::{LogicalPosition, LogicalSize, PhysicalSize};
|
||||
use crate::event::{PointerEvent, TextEvent, WindowEvent};
|
||||
use crate::passes::accessibility::root_accessibility;
|
||||
use crate::passes::compose::root_compose;
|
||||
use crate::passes::event::{root_on_access_event, root_on_pointer_event, root_on_text_event};
|
||||
use crate::passes::layout::root_layout;
|
||||
use crate::passes::accessibility::run_accessibility_pass;
|
||||
use crate::passes::compose::run_compose_pass;
|
||||
use crate::passes::event::{
|
||||
run_on_access_event_pass, run_on_pointer_event_pass, run_on_text_event_pass,
|
||||
};
|
||||
use crate::passes::layout::run_layout_pass;
|
||||
use crate::passes::mutate::{mutate_widget, run_mutate_pass};
|
||||
use crate::passes::paint::root_paint;
|
||||
use crate::passes::paint::run_paint_pass;
|
||||
use crate::passes::recurse_on_children;
|
||||
use crate::passes::update::{
|
||||
run_update_anim_pass, run_update_disabled_pass, run_update_focus_chain_pass,
|
||||
|
@ -385,7 +387,7 @@ impl RenderRoot {
|
|||
|
||||
// --- MARK: POINTER_EVENT ---
|
||||
fn root_on_pointer_event(&mut self, event: PointerEvent) -> Handled {
|
||||
let handled = root_on_pointer_event(self, &event);
|
||||
let handled = run_on_pointer_event_pass(self, &event);
|
||||
run_update_pointer_pass(self);
|
||||
|
||||
self.run_rewrite_passes();
|
||||
|
@ -397,10 +399,10 @@ impl RenderRoot {
|
|||
// --- MARK: TEXT_EVENT ---
|
||||
fn root_on_text_event(&mut self, event: TextEvent) -> Handled {
|
||||
if matches!(event, TextEvent::FocusChange(false)) {
|
||||
root_on_pointer_event(self, &PointerEvent::new_pointer_leave());
|
||||
run_on_pointer_event_pass(self, &PointerEvent::new_pointer_leave());
|
||||
}
|
||||
|
||||
let handled = root_on_text_event(self, &event);
|
||||
let handled = run_on_text_event_pass(self, &event);
|
||||
run_update_focus_pass(self);
|
||||
|
||||
self.run_rewrite_passes();
|
||||
|
@ -420,7 +422,7 @@ impl RenderRoot {
|
|||
data: event.data,
|
||||
};
|
||||
|
||||
root_on_access_event(self, &event, WidgetId(id));
|
||||
run_on_access_event_pass(self, &event, WidgetId(id));
|
||||
|
||||
self.run_rewrite_passes();
|
||||
self.get_root_widget().debug_validate(false);
|
||||
|
@ -428,13 +430,14 @@ impl RenderRoot {
|
|||
|
||||
// --- MARK: PAINT ---
|
||||
fn root_paint(&mut self) -> Scene {
|
||||
root_paint(self)
|
||||
run_paint_pass(self)
|
||||
}
|
||||
|
||||
// --- MARK: ACCESSIBILITY ---
|
||||
// TODO - Integrate in unit tests?
|
||||
fn root_accessibility(&mut self) -> TreeUpdate {
|
||||
let mut tree_update = root_accessibility(self, self.rebuild_access_tree, self.scale_factor);
|
||||
let mut tree_update =
|
||||
run_accessibility_pass(self, self.rebuild_access_tree, self.scale_factor);
|
||||
self.rebuild_access_tree = false;
|
||||
|
||||
tree_update.tree = Some(Tree {
|
||||
|
@ -473,9 +476,9 @@ impl RenderRoot {
|
|||
run_update_stashed_pass(self);
|
||||
run_update_focus_chain_pass(self);
|
||||
run_update_focus_pass(self);
|
||||
root_layout(self);
|
||||
run_layout_pass(self);
|
||||
run_update_scroll_pass(self);
|
||||
root_compose(self);
|
||||
run_compose_pass(self);
|
||||
run_update_pointer_pass(self);
|
||||
|
||||
if self.root_state().needs_anim {
|
||||
|
|
Loading…
Reference in New Issue