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

Projects
None yet
7 participants
@eloycoto
Copy link
Contributor

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:

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • 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!


This change is Reviewable

@highfive

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

commented Apr 9, 2017

Heads up! This PR modifies the following files:

  • @emilio: components/layout/sequential.rs
@highfive

This comment has been minimized.

Copy link

commented Apr 9, 2017

warning Warning warning

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

This comment has been minimized.

Copy link
Contributor

commented Apr 9, 2017

@bors-servo

This comment has been minimized.

Copy link
Contributor

commented Apr 9, 2017

⌛️ Trying commit d993266 with merge a5b8da8...

bors-servo added a commit that referenced this pull request Apr 9, 2017

Auto merge of #16317 - eloycoto:issue6799, r=<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 -->
@bors-servo

This comment has been minimized.

Copy link
Contributor

commented Apr 9, 2017

💔 Test failed - linux-dev

@jdm

This comment has been minimized.

Copy link
Member

commented Apr 9, 2017

@glennw Is this something you could look at?

@emilio

This comment has been minimized.

Copy link
Member

commented Apr 10, 2017

@bors-servo

This comment has been minimized.

Copy link
Contributor

commented Apr 10, 2017

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

bors-servo added a commit that referenced this pull request Apr 10, 2017

Auto merge of #16317 - eloycoto:issue6799, r=<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 -->
@bors-servo

This comment has been minimized.

Copy link
Contributor

commented Apr 10, 2017

💔 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;

This comment has been minimized.

Copy link
@emilio

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.

Copy link
@emilio

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.

Copy link
@emilio

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.

@emilio

This comment has been minimized.

Copy link
Member

commented Apr 10, 2017

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

@eloycoto

This comment has been minimized.

Copy link
Contributor Author

commented Apr 10, 2017

Hey @emilio

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

Regards and thanks!

@nox

This comment has been minimized.

Copy link
Member

commented Apr 11, 2017

@bors-servo r=emilio

@bors-servo

This comment has been minimized.

Copy link
Contributor

commented Apr 11, 2017

📌 Commit 53197c3 has been approved by emilio

@nox

This comment has been minimized.

Copy link
Member

commented Apr 11, 2017

UGH.

@bors-servo r-

r? @emilio

@jdm

This comment has been minimized.

Copy link
Member

commented May 28, 2017

@emilio
Copy link
Member

left a comment

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.

Copy link
@emilio

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.

Copy link
@eloycoto

eloycoto May 30, 2017

Author Contributor

Blockflow is fixed. The inline one is a bit harder, I need to learn a bit more.

Regards.

@eloycoto eloycoto force-pushed the eloycoto:issue6799 branch from f5c011f to 33a4659 May 30, 2017

@stshine

This comment has been minimized.

Copy link
Contributor

commented May 30, 2017

@bors-servo

This comment has been minimized.

Copy link
Contributor

commented May 30, 2017

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

bors-servo added a commit that referenced this pull request May 30, 2017

Auto merge of #16317 - eloycoto:issue6799, r=<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 -->
@bors-servo

This comment has been minimized.

Copy link
Contributor

commented May 30, 2017

@emilio

This comment has been minimized.

Copy link
Member

commented May 30, 2017

@bors-servo r+

Thanks a lot!

@bors-servo

This comment has been minimized.

Copy link
Contributor

commented May 30, 2017

📌 Commit 33a4659 has been approved by emilio

@bors-servo

This comment has been minimized.

Copy link
Contributor

commented May 30, 2017

⌛️ Testing commit 33a4659 with merge af159be...

bors-servo added a commit that referenced this pull request May 30, 2017

Auto merge of #16317 - eloycoto:issue6799, r=emilio
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

This comment has been minimized.

Copy link
Contributor

commented May 30, 2017

💔 Test failed - linux-dev

@stshine

This comment has been minimized.

Copy link
Contributor

commented May 30, 2017

@bors-servo retry

  • infra
@bors-servo

This comment has been minimized.

Copy link
Contributor

commented May 30, 2017

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

bors-servo added a commit that referenced this pull request May 30, 2017

Auto merge of #16317 - eloycoto:issue6799, r=emilio
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

This comment has been minimized.

Copy link
Contributor

commented May 30, 2017

@bors-servo bors-servo merged commit 33a4659 into servo:master May 30, 2017

2 of 3 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
homu Test successful
Details

jdm added a commit to web-platform-tests/wpt that referenced this pull request Jun 19, 2017

Fix #6799: set stacking_context_position correctly on
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
You can’t perform that action at this time.