Dequalify WindowContext and ViewContext references (#22477)

Release Notes:

- N/A
This commit is contained in:
Michael Sloan 2024-12-28 16:09:55 -07:00 committed by GitHub
parent 016b5d60e1
commit a15360bcc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 43 additions and 51 deletions

View file

@ -1,6 +1,6 @@
use std::time::{Duration, Instant};
use crate::{AnyElement, Element, ElementId, GlobalElementId, IntoElement};
use crate::{AnyElement, Element, ElementId, GlobalElementId, IntoElement, WindowContext};
pub use easing::*;
@ -104,7 +104,7 @@ impl<E: IntoElement + 'static> Element for AnimationElement<E> {
fn request_layout(
&mut self,
global_id: Option<&GlobalElementId>,
cx: &mut crate::WindowContext,
cx: &mut WindowContext,
) -> (crate::LayoutId, Self::RequestLayoutState) {
cx.with_element_state(global_id.unwrap(), |state, cx| {
let state = state.unwrap_or_else(|| AnimationState {
@ -145,7 +145,7 @@ impl<E: IntoElement + 'static> Element for AnimationElement<E> {
_id: Option<&GlobalElementId>,
_bounds: crate::Bounds<crate::Pixels>,
element: &mut Self::RequestLayoutState,
cx: &mut crate::WindowContext,
cx: &mut WindowContext,
) -> Self::PrepaintState {
element.prepaint(cx);
}
@ -156,7 +156,7 @@ impl<E: IntoElement + 'static> Element for AnimationElement<E> {
_bounds: crate::Bounds<crate::Pixels>,
element: &mut Self::RequestLayoutState,
_: &mut Self::PrepaintState,
cx: &mut crate::WindowContext,
cx: &mut WindowContext,
) {
element.paint(cx);
}

View file

@ -716,7 +716,7 @@ impl Element for List {
fn request_layout(
&mut self,
_id: Option<&GlobalElementId>,
cx: &mut crate::WindowContext,
cx: &mut WindowContext,
) -> (crate::LayoutId, Self::RequestLayoutState) {
let layout_id = match self.sizing_behavior {
ListSizingBehavior::Infer => {
@ -827,7 +827,7 @@ impl Element for List {
bounds: Bounds<crate::Pixels>,
_: &mut Self::RequestLayoutState,
prepaint: &mut Self::PrepaintState,
cx: &mut crate::WindowContext,
cx: &mut WindowContext,
) {
cx.with_content_mask(Some(ContentMask { bounds }), |cx| {
for item in &mut prepaint.layout.item_layouts {

View file

@ -468,7 +468,7 @@ mod test {
use crate::{
self as gpui, div, FocusHandle, InteractiveElement, IntoElement, KeyBinding, Keystroke,
ParentElement, Render, TestAppContext, VisualContext,
ParentElement, Render, TestAppContext, ViewContext, VisualContext,
};
struct TestView {
@ -480,7 +480,7 @@ mod test {
actions!(test, [TestAction]);
impl Render for TestView {
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> impl IntoElement {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
div().id("testview").child(
div()
.key_context("parent")