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
Fix #6799: set stacking_context_position correctly on fragment_border_iterator #16317
Conversation
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. |
Heads up! This PR modifies the following files:
|
@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 -->
💔 Test failed - linux-dev |
@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 -->
💔 Test failed - arm64 |
@@ -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; |
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.
It'd be nice to move the purely-stylistic changes to another commit so it's easier to review.
components/layout/sequential.rs
Outdated
let transform = fragment | ||
.fragment | ||
.transform_matrix(&relative_position) | ||
.unwrap_or(Matrix4D::identity()) |
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.
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());
}
}
components/layout/sequential.rs
Outdated
if fragment.fragment.style.get_box().transform.0.is_some() { | ||
let relative_position = fragment | ||
.fragment | ||
.stacking_relative_border_box(&fragment.base.stacking_relative_position, |
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.
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 |
📌 Commit 53197c3 has been approved by |
UGH. @bors-servo r- r? @emilio |
@bors-servo: try |
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.
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> { |
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.
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).
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.
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
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
@bors-servo r+ Thanks a lot! |
📌 Commit 33a4659 has been approved by |
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 -->
💔 Test failed - linux-dev |
@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 -->
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
fragment_border_iterator Upstreamed from servo/servo#16317 [ci skip]
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 -d
does not report any errors./mach test-tidy
does 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