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

Scroll via HitTester #2736

Merged
merged 1 commit into from May 8, 2018
Merged

Conversation

mrobinson
Copy link
Member

@mrobinson mrobinson commented May 7, 2018

This change uses the HitTester to do scrolling, which allows us to
remove some redundant code. It also will help us to remove bounds for
reference frames, which will be useful when we separate the concept of
reference frames and stacking contexts.


This change is Reviewable

@mrobinson
Copy link
Member Author

r? anyone

Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! A few concerns (minor) from me

let mut should_render = true;
let node_index = match doc.hit_tester {
Some(ref hit_tester) => {
let test = HitTest::new(None, cursor, HitTestFlags::empty());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is where we have the node index and this is where checking for scroll_nearest_scrolling_ancestor is really needed, can we rewrite this part as:

let should_render = match doc.hit_tester {
...
};

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit of ugliness is necessary to avoid a double-borrow of doc, unfortunately. I can leave a comment about that.

_ => {}
}

return self.find_nearest_scrolling_ancestor(node.parent)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: let's move this into _ => arm and remove return calls

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing.

*/

// Assumes rect is in the z=0 plane!
pub fn ray_intersects_rect(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh god, so nice to see the cleanup here!

}

let clip_chain_index = clip_and_scroll.clip_chain_index;
clipped_in |=
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably avoid calling this method if clipped_in is already true

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes! Thanks for pointing out this bug. This should really be

clipped_in = clipped_in || 
    self.is_point_clipped_in_for_clip_chain(point, clip_chain_index, &mut test);

so that we can rely on short-circuit logic. If it's okay with you, I'll do this in another PR since the change is unrelated to this one.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A fix for this has landed here: #2739

This change uses the HitTester to do scrolling, which allows us to
remove some redundant code. It also will help us to remove bounds for
reference frames, which will be useful when we separate the concept of
reference frames and stacking contexts.
@kvark
Copy link
Member

kvark commented May 8, 2018

Cool, thanks!
@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit f5d899e has been approved by kvark

@bors-servo
Copy link
Contributor

⌛ Testing commit f5d899e with merge f3d34e4...

bors-servo pushed a commit that referenced this pull request May 8, 2018
Scroll via HitTester

This change uses the HitTester to do scrolling, which allows us to
remove some redundant code. It also will help us to remove bounds for
reference frames, which will be useful when we separate the concept of
reference frames and stacking contexts.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/2736)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

💔 Test failed - status-taskcluster

@mrobinson
Copy link
Member Author

Interesting. Looks like a rawtest failure, but I'm not sure how this change could affect it:

thread 'main' panicked at 'assertion failed: called.load(Ordering::SeqCst) == 1', wrench/src/rawtest.rs:175:9

@kvark
Copy link
Member

kvark commented May 8, 2018

@mrobinson I'm tempted to say let's disable the raw tests for now. They were enabled recently and we can re-enable them without disrupting the other changes, hopefully.
@jrmuizel are you ok with this?

@Gankra
Copy link
Contributor

Gankra commented May 8, 2018 via email

@kvark
Copy link
Member

kvark commented May 8, 2018

@bors-servo retry

bors-servo pushed a commit that referenced this pull request May 8, 2018
Scroll via HitTester

This change uses the HitTester to do scrolling, which allows us to
remove some redundant code. It also will help us to remove bounds for
reference frames, which will be useful when we separate the concept of
reference frames and stacking contexts.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/2736)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

⌛ Testing commit f5d899e with merge 8d895b3...

@bors-servo
Copy link
Contributor

☀️ Test successful - status-appveyor, status-taskcluster
Approved by: kvark
Pushing 8d895b3 to master...

@bors-servo bors-servo merged commit f5d899e into servo:master May 8, 2018
@mrobinson mrobinson deleted the hit-testing-scroll-node branch May 9, 2018 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants