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

Fix #6799: set stacking_context_position correctly on fragment_border_iterator #16317

Merged
merged 2 commits into from May 30, 2017

Conversation

eloycoto
Copy link
Contributor

@eloycoto eloycoto commented Apr 9, 2017

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:

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!


This change is Reviewable

@highfive
Copy link

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
Copy link

highfive commented Apr 9, 2017

Heads up! This PR modifies the following files:

  • @emilio: components/layout/sequential.rs

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Apr 9, 2017
@highfive
Copy link

highfive commented Apr 9, 2017

warning Warning warning

  • These commits include an empty title element (<title></title>). Consider adding appropriate metadata.

@stshine
Copy link
Contributor

stshine commented Apr 9, 2017

@bors-servo try

@bors-servo
Copy link
Contributor

⌛ Trying commit d993266 with merge a5b8da8...

bors-servo pushed a commit that referenced this pull request Apr 9, 2017
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
Copy link
Contributor

💔 Test failed - linux-dev

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-tests-failed The changes caused existing tests to fail. labels Apr 9, 2017
@jdm
Copy link
Member

jdm commented Apr 9, 2017

@glennw Is this something you could look at?

@emilio
Copy link
Member

emilio commented Apr 10, 2017

@bors-servo try

@bors-servo
Copy link
Contributor

⌛ Trying commit 53197c3 with merge 7453bd0...

bors-servo pushed a commit that referenced this pull request Apr 10, 2017
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
Copy link
Contributor

💔 Test failed - arm64

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Apr 10, 2017
@@ -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;
Copy link
Member

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.

let transform = fragment
.fragment
.transform_matrix(&relative_position)
.unwrap_or(Matrix4D::identity())
Copy link
Member

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());
    }
}

if fragment.fragment.style.get_box().transform.0.is_some() {
let relative_position = fragment
.fragment
.stacking_relative_border_box(&fragment.base.stacking_relative_position,
Copy link
Member

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.

@emilio
Copy link
Member

emilio commented Apr 10, 2017

You need to update the manifest with ./mach update-manifest

@eloycoto
Copy link
Contributor Author

Hey @emilio

I'll try to make the changes this night and I'll come back to you tomorrow.

Regards and thanks!

@nox
Copy link
Contributor

nox commented Apr 11, 2017

@bors-servo r=emilio

@bors-servo
Copy link
Contributor

📌 Commit 53197c3 has been approved by emilio

@highfive highfive assigned emilio and unassigned nox Apr 11, 2017
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. S-tests-failed The changes caused existing tests to fail. labels Apr 11, 2017
@nox
Copy link
Contributor

nox commented Apr 11, 2017

UGH.

@bors-servo r-

r? @emilio

@nox nox added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Apr 11, 2017
@jdm
Copy link
Member

jdm commented May 28, 2017

@bors-servo: try

Copy link
Member

@emilio emilio left a 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> {
Copy link
Member

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).

Copy link
Contributor Author

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.

@highfive highfive removed the S-tests-failed The changes caused existing tests to fail. label May 30, 2017
@stshine
Copy link
Contributor

stshine commented May 30, 2017

@bors-servo try

@bors-servo
Copy link
Contributor

⌛ Trying commit 33a4659 with merge 89b68c2...

bors-servo pushed a commit that referenced this pull request May 30, 2017
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
Copy link
Contributor

@emilio
Copy link
Member

emilio commented May 30, 2017

@bors-servo r+

Thanks a lot!

@bors-servo
Copy link
Contributor

📌 Commit 33a4659 has been approved by emilio

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors. labels May 30, 2017
@bors-servo
Copy link
Contributor

⌛ Testing commit 33a4659 with merge af159be...

bors-servo pushed a commit that referenced this pull request May 30, 2017
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
Copy link
Contributor

💔 Test failed - linux-dev

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels May 30, 2017
@stshine
Copy link
Contributor

stshine commented May 30, 2017

@bors-servo retry

  • infra

@bors-servo
Copy link
Contributor

⌛ Testing commit 33a4659 with merge 9d32b9c...

bors-servo pushed a commit that referenced this pull request May 30, 2017
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 -->
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels May 30, 2017
@bors-servo
Copy link
Contributor

☀️ 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
Approved by: emilio
Pushing 9d32b9c to master...

@bors-servo bors-servo merged commit 33a4659 into servo:master May 30, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label May 30, 2017
jdm pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 19, 2017
fragment_border_iterator

Upstreamed from servo/servo#16317 [ci skip]
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.

getBoundingClientRect does not account for transform or margin
7 participants