-
Notifications
You must be signed in to change notification settings - Fork 531
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
Add a new children/descendants api as well as deeper element queries to ElementHandle #5433
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should visit_element be removed. It is a bit redundent since you can do HasElementHandle::root_element(component).visit_descendants
(the only difference is that it visits the root)
@@ -312,21 +313,30 @@ impl ItemRc { | |||
r.upgrade()?.parent_item() | |||
} | |||
|
|||
// FIXME: This should be nicer/done elsewhere? | |||
/// Returns true if this item is visible from the root of the item tree. Note that this will return | |||
/// false for `Clip` elements, even if they are "visible". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it? All Clip elements? Why is that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'm missing something (I tried to cover that also in the test I added in search_api.rs), but the old code did this:
pub fn is_visible(&self) -> bool {
let item = self.borrow();
let is_clipping = crate::item_rendering::is_clipping_item(item);
let geometry = self.geometry();
if is_clipping && (geometry.width() <= 0.01 as _ || geometry.height() <= 0.01 as _) {
return false;
}
if let Some(parent) = self.parent_item() {
parent.is_visible()
} else {
true
}
}
That suggests to me that is_clipping_item()
returns true for Clip
elements that are enabled for clipping (clip true) and the visible pass gives them the null width/height. So I think that'll return false.
The new code should return an empty clip rectangle from the call to absolute_clip_rect_and_geometry
because of this:
if crate::item_rendering::is_clipping_item(item) {
clip = geometry.intersection(&clip).unwrap_or_default();
}
And then the intersection of itself should be empty.
Should I add a direct unit test in here perhaps?
Use core::pin instead of std::pin
Yes, I'm in favor of that - if you're okay with the rest of this API. I'd make that a separate change though. |
No description provided.