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

Child layers do not scroll with their parent #283

Closed
SimonSapin opened this issue Jun 2, 2016 · 3 comments
Closed

Child layers do not scroll with their parent #283

SimonSapin opened this issue Jun 2, 2016 · 3 comments

Comments

@SimonSapin
Copy link
Member

@SimonSapin SimonSapin commented Jun 2, 2016

Test case:

<body style="margin-top: 100px">
<iframe src="data:,in iframe"></iframe>
<div style="overflow: auto; border: solid">in 'overflow: auto'</div>

Extra content to make the viewport scroll:
<p style="margin-top: 100px">1
<p style="margin-top: 100px">2
<p style="margin-top: 100px">3
<p style="margin-top: 100px">4
<p style="margin-top: 100px">5
@SimonSapin
Copy link
Member Author

@SimonSapin SimonSapin commented Jun 2, 2016

With the patch below (I have no idea what I’m doing) the content of child layers moves correctly but its clipping rectangle doesn’t.

diff --git a/src/frame.rs b/src/frame.rs
index f53b62b..8391a1d 100644
--- a/src/frame.rs
+++ b/src/frame.rs
@@ -1242,35 +1242,35 @@ impl Frame {
     fn update_layer_transform(&mut self,
                               layer_id: ScrollLayerId,
                               parent_transform: &Matrix4D<f32>) {
         // TODO(gw): This is an ugly borrow check workaround to clone these.
         //           Restructure this to avoid the clones!
         let (layer_transform_for_children, layer_children) = {
             match self.layers.get_mut(&layer_id) {
                 Some(layer) => {
                     let layer_transform_for_children =
                         parent_transform.mul(&layer.local_transform);
                     layer.world_transform =
                         layer_transform_for_children.translate(layer.world_origin.x,
                                                                layer.world_origin.y,
                                                                0.0)
                                                     .translate(layer.scrolling.offset.x,
                                                                layer.scrolling.offset.y,
                                                                0.0);
-                    (layer_transform_for_children, layer.children.clone())
+                    (layer.world_transform, layer.children.clone())
                 }
                 None => {
                     return;
                 }
             }
         };

         for child_layer_id in layer_children {
             self.update_layer_transform(child_layer_id, &layer_transform_for_children);
         }
     }
@SimonSapin
Copy link
Member Author

@SimonSapin SimonSapin commented Jun 16, 2016

This seems fixed now. @pcwalton could it be by #282?

@glennw
Copy link
Member

@glennw glennw commented Aug 28, 2016

This is no longer occurring.

@glennw glennw closed this Aug 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.