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

Add support for overflow:scroll and overflow:hidden to layout_2020 #25645

Merged
merged 1 commit into from Feb 1, 2020

Conversation

@mrobinson
Copy link
Member

mrobinson commented Jan 30, 2020

This adds clipping and interactive scrolling support, but scrolling from
script is still not functional.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #___ (GitHub issue number if applicable)
  • There are tests for these changes OR
  • These changes do not require tests because ___
@mrobinson mrobinson requested a review from SimonSapin Jan 30, 2020
@highfive
Copy link

highfive commented Jan 30, 2020

Heads up! This PR modifies the following files:

  • @emilio: components/style/properties/longhands/box.mako.rs, components/style/properties/shorthands/box.mako.rs
@jdm
Copy link
Member

jdm commented Jan 30, 2020

@highfive highfive assigned SimonSapin and unassigned jdm Jan 30, 2020
@@ -180,10 +178,33 @@ impl BoxFragment {
border,
margin,
block_margins_collapsed_with_children,
scrollable_overflow,
scrollable_overflow: PhysicalRect::zero(),

This comment has been minimized.

Copy link
@SimonSapin

SimonSapin Jan 30, 2020

Member

I’m not a fan of initializing here with known-incorrect data and rely on calculate_scrollable_overflow being called later at some point for its side effect. Why is that computation delayed? If it needs to be, what do you think of making this an Option and calling unwrap when the data is used, so we don’t accidentally use a non-initialized zero?

This comment has been minimized.

Copy link
@mrobinson

mrobinson Jan 30, 2020

Author Member

The issue is that the BoxFragment is created and then positioned later. Does it make sense to modify layout_block_level_children to create and place BoxFragments at the same time?

This comment has been minimized.

Copy link
@SimonSapin

SimonSapin Jan 30, 2020

Member

Creation is separated from placement in layout_block_level_children so that the former (including recursion in a subtree) can be parallelized across siblings, while the latter needs to be sequential.

What if we defined BoxFragment::scrollable_overflow to be in a coordinate system where self.content_rect.start_corner is the origin, and the parent is responsible for doing the translation?

This comment has been minimized.

Copy link
@mrobinson

mrobinson Jan 31, 2020

Author Member

I have done something like this in the latest branch. Now the final position of the scrollable overflow is calculated when it is used. This shouldn't have a large overhead. I've kept the calculation inside of the child since it knows about its position when the calculation is done.

let overflow_x = self.fragment.style.get_box().overflow_x;
let overflow_y = self.fragment.style.get_box().overflow_y;
let original_scroll_and_clip_info = builder.current_space_and_clip;
if overflow_x != ComputedOverflow::Visible || overflow_y != ComputedOverflow::Visible {

This comment has been minimized.

Copy link
@SimonSapin

SimonSapin Jan 30, 2020

Member

This seems to treat all values other than visible the same. Landing things incrementally is fine, but what’s the plan for fixing that later?

This comment has been minimized.

Copy link
@mrobinson

mrobinson Jan 30, 2020

Author Member

The only difference here, I think, is with Overflow::Auto. As far as correctness goes, I think the unnecessary creation of the scroll frame doesn't affect it. Overflow::Hidden is handled below.

@mrobinson mrobinson force-pushed the mrobinson:scrollable-overflow-v2 branch from 8f76b4f to d8cdd90 Jan 31, 2020
@SimonSapin
Copy link
Member

SimonSapin commented Jan 31, 2020

Looks like this needs some code formatting changes, see "Details" near "checks have failed to find the CI log. You can check the same locally by running ./mach test-tidy, and in the case of Rust code formatting fix it automatically with rustfmt by running ./mach fmt.

(I have ./mach test-tidy --no-wpt in .git/hooks/pre-push because otherwise I keep forgetting.)

Feel free to r=SimonSapin with that fixed.

@mrobinson mrobinson force-pushed the mrobinson:scrollable-overflow-v2 branch from d8cdd90 to e1027cd Jan 31, 2020
@mrobinson
Copy link
Member Author

mrobinson commented Jan 31, 2020

@bors-servo r=SimonSapin

@bors-servo
Copy link
Contributor

bors-servo commented Jan 31, 2020

📌 Commit e1027cd has been approved by SimonSapin

@bors-servo
Copy link
Contributor

bors-servo commented Jan 31, 2020

Testing commit e1027cd with merge 25b526f...

bors-servo added a commit that referenced this pull request Jan 31, 2020
Add support for overflow:scroll and overflow:hidden to layout_2020

This adds clipping and interactive scrolling support, but scrolling from
script is still not functional.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@bors-servo
Copy link
Contributor

bors-servo commented Jan 31, 2020

💔 Test failed - status-taskcluster

@jdm
Copy link
Member

jdm commented Jan 31, 2020

  ▶ PASS [expected FAIL] /css/css-backgrounds/background-size/background-size-contain.xht
  ▶ PASS [expected FAIL] /css/css-backgrounds/background-size/background-size-cover.xht
  ▶ PASS [expected FAIL] /css/css-backgrounds/background-repeat/background-repeat-repeat-y.xht
  ▶ PASS [expected FAIL] /css/css-backgrounds/background-repeat/background-repeat-repeat-x.xht
  ▶ PASS [expected FAIL] /_mozilla/css/acid2_ref.html
This adds clipping and interactive scrolling support, but scrolling from
script is still not functional.
@mrobinson mrobinson force-pushed the mrobinson:scrollable-overflow-v2 branch from e1027cd to 7a5a320 Jan 31, 2020
bors-servo added a commit that referenced this pull request Feb 1, 2020
Add support for overflow:scroll and overflow:hidden to layout_2020

This adds clipping and interactive scrolling support, but scrolling from
script is still not functional.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@bors-servo
Copy link
Contributor

bors-servo commented Feb 1, 2020

💔 Test failed - status-taskcluster

@jdm
Copy link
Member

jdm commented Feb 1, 2020

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Feb 1, 2020

Testing commit 7a5a320 with merge 840605d...

bors-servo added a commit that referenced this pull request Feb 1, 2020
Add support for overflow:scroll and overflow:hidden to layout_2020

This adds clipping and interactive scrolling support, but scrolling from
script is still not functional.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@bors-servo
Copy link
Contributor

bors-servo commented Feb 1, 2020

💔 Test failed - status-taskcluster

@jdm
Copy link
Member

jdm commented Feb 1, 2020

@bors-servo
Copy link
Contributor

bors-servo commented Feb 1, 2020

Testing commit 7a5a320 with merge fddeee8...

bors-servo added a commit that referenced this pull request Feb 1, 2020
Add support for overflow:scroll and overflow:hidden to layout_2020

This adds clipping and interactive scrolling support, but scrolling from
script is still not functional.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@bors-servo
Copy link
Contributor

bors-servo commented Feb 1, 2020

💔 Test failed - status-taskcluster

@CYBAI
Copy link
Collaborator

CYBAI commented Feb 1, 2020

@bors-servo
Copy link
Contributor

bors-servo commented Feb 1, 2020

Testing commit 7a5a320 with merge c4785e3...

bors-servo added a commit that referenced this pull request Feb 1, 2020
Add support for overflow:scroll and overflow:hidden to layout_2020

This adds clipping and interactive scrolling support, but scrolling from
script is still not functional.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@bors-servo
Copy link
Contributor

bors-servo commented Feb 1, 2020

☀️ Test successful - status-taskcluster
Approved by: SimonSapin
Pushing c4785e3 to master...

@bors-servo bors-servo merged commit 7a5a320 into servo:master Feb 1, 2020
2 checks passed
2 checks passed
Community-TC (pull_request) TaskGroup: success
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.