Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFix #6799: set stacking_context_position correctly on fragment_border_iterator #16317
Conversation
highfive
commented
Apr 9, 2017
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @nox (or someone else) soon. |
highfive
commented
Apr 9, 2017
|
Heads up! This PR modifies the following files:
|
highfive
commented
Apr 9, 2017
|
@bors-servo try |
Fix #6799: set stacking_context_position correctly on fragment_border_iterator Hey, First of all, this is my first PR to Servo project and I'm learning Rust, so sorry if you see something that it's not correct. I did that as best as I know. This PR fix the issue #6799; I tried all the corner cases that I can think about it and always get the right result and the same as other browsers. Related to the build: - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #6799 In the other hand, I added the test in the cssom folder, is where getBoundingClientRect is defined, so I think that is the best place. I'm sure that the line 122 can be better, but I didn't find a way to transform a Point2D from f32 to px in a easy way. I'm here to listen to your recommendations and fix any issue. Thanks! <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16317) <!-- Reviewable:end -->
|
|
|
@glennw Is this something you could look at? |
|
@bors-servo try |
Fix #6799: set stacking_context_position correctly on fragment_border_iterator Hey, First of all, this is my first PR to Servo project and I'm learning Rust, so sorry if you see something that it's not correct. I did that as best as I know. This PR fix the issue #6799; I tried all the corner cases that I can think about it and always get the right result and the same as other browsers. Related to the build: - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #6799 In the other hand, I added the test in the cssom folder, is where getBoundingClientRect is defined, so I think that is the best place. I'm sure that the line 122 can be better, but I didn't find a way to transform a Point2D from f32 to px in a easy way. I'm here to listen to your recommendations and fix any issue. Thanks! <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16317) <!-- Reviewable:end -->
|
|
| @@ -23,7 +24,7 @@ pub use style::sequential::traverse_dom; | |||
| pub fn resolve_generated_content(root: &mut Flow, layout_context: &LayoutContext) { | |||
| fn doit(flow: &mut Flow, level: u32, traversal: &mut ResolveGeneratedContent) { | |||
| if !traversal.should_process(flow) { | |||
| return | |||
| return; | |||
This comment has been minimized.
This comment has been minimized.
emilio
Apr 10, 2017
Member
It'd be nice to move the purely-stylistic changes to another commit so it's easier to review.
| let transform = fragment | ||
| .fragment | ||
| .transform_matrix(&relative_position) | ||
| .unwrap_or(Matrix4D::identity()) |
This comment has been minimized.
This comment has been minimized.
emilio
Apr 10, 2017
Member
This can't be hit, right? (we check for transform.is_some).
What about organizing this as follows?
let mut stacking_context_position = *stacking_context_position;
if kid.is_block_flow() && kid.as_block().fragment.establishes_stacking_context() {
stacking_context_position += flow::base(kid).stacking_context_position();
stacking_context_position += Point2D::new(kid.as_block().fragment.margin.inline_start, Au(0));
let relative_position = kid.as_block().stacking_relative_position(CoordinateSystem::Own);
if let Some(matrix) = kid.as_block().transform_matrix(&relative_position) {
stacking_context_position += matrix.transform_point(&Point2D::zero());
}
}| if fragment.fragment.style.get_box().transform.0.is_some() { | ||
| let relative_position = fragment | ||
| .fragment | ||
| .stacking_relative_border_box(&fragment.base.stacking_relative_position, |
This comment has been minimized.
This comment has been minimized.
emilio
Apr 10, 2017
Member
Let's factor this into a helper that takes a CoordinateSystem argument, since it's called from multiple places of layout with the same arguments.
|
You need to update the manifest with |
|
Hey @emilio I'll try to make the changes this night and I'll come back to you tomorrow. Regards and thanks! |
|
@bors-servo r=emilio |
|
|
|
UGH. @bors-servo r- r? @emilio |
|
@bors-servo: try |
|
Looks fine to me, modulo that. Thanks a lot for working on this! :) |
| @@ -647,6 +647,14 @@ impl BlockFlow { | |||
| &mut self.fragment | |||
| } | |||
|
|
|||
| pub fn stacking_relative_position(&self, coor: CoordinateSystem) -> Rect<Au> { | |||
This comment has been minimized.
This comment has been minimized.
emilio
May 28, 2017
Member
We should be able to reuse this function in block.rs, and also in inline.rs (InlineFlow::compute_absolute_position). Also in BlockFlow::transform_clip_to_coordinate_space in display_list_builder.rs, and I may have missed others.
It's fine for me if you don't want to do that (is fine to file a followup for that).
This comment has been minimized.
This comment has been minimized.
eloycoto
May 30, 2017
Author
Contributor
Blockflow is fixed. The inline one is a bit harder, I need to learn a bit more.
Regards.
|
@bors-servo try |
Fix #6799: set stacking_context_position correctly on fragment_border_iterator Hey, First of all, this is my first PR to Servo project and I'm learning Rust, so sorry if you see something that it's not correct. I did that as best as I know. This PR fix the issue #6799; I tried all the corner cases that I can think about it and always get the right result and the same as other browsers. Related to the build: - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #6799 In the other hand, I added the test in the cssom folder, is where getBoundingClientRect is defined, so I think that is the best place. I'm sure that the line 122 can be better, but I didn't find a way to transform a Point2D from f32 to px in a easy way. I'm here to listen to your recommendations and fix any issue. Thanks! <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16317) <!-- Reviewable:end -->
fragment_border_iterator
|
|
|
@bors-servo r+ Thanks a lot! |
|
|
Fix #6799: set stacking_context_position correctly on fragment_border_iterator Hey, First of all, this is my first PR to Servo project and I'm learning Rust, so sorry if you see something that it's not correct. I did that as best as I know. This PR fix the issue #6799; I tried all the corner cases that I can think about it and always get the right result and the same as other browsers. Related to the build: - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #6799 In the other hand, I added the test in the cssom folder, is where getBoundingClientRect is defined, so I think that is the best place. I'm sure that the line 122 can be better, but I didn't find a way to transform a Point2D from f32 to px in a easy way. I'm here to listen to your recommendations and fix any issue. Thanks! <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16317) <!-- Reviewable:end -->
|
|
|
@bors-servo retry
|
Fix #6799: set stacking_context_position correctly on fragment_border_iterator Hey, First of all, this is my first PR to Servo project and I'm learning Rust, so sorry if you see something that it's not correct. I did that as best as I know. This PR fix the issue #6799; I tried all the corner cases that I can think about it and always get the right result and the same as other browsers. Related to the build: - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #6799 In the other hand, I added the test in the cssom folder, is where getBoundingClientRect is defined, so I think that is the best place. I'm sure that the line 122 can be better, but I didn't find a way to transform a Point2D from f32 to px in a easy way. I'm here to listen to your recommendations and fix any issue. Thanks! <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16317) <!-- Reviewable:end -->
|
|
fragment_border_iterator Upstreamed from servo/servo#16317 [ci skip]
eloycoto commentedApr 9, 2017
•
edited by larsbergstrom
Hey,
First of all, this is my first PR to Servo project and I'm learning Rust, so sorry if you see something that it's not correct. I did that as best as I know.
This PR fix the issue #6799; I tried all the corner cases that I can think about it and always get the right result and the same as other browsers.
Related to the build:
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsIn the other hand, I added the test in the cssom folder, is where getBoundingClientRect is defined, so I think that is the best place.
I'm sure that the line 122 can be better, but I didn't find a way to transform a Point2D from f32 to px in a easy way.
I'm here to listen to your recommendations and fix any issue.
Thanks!
This change is