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

unexpected overflow #9306

Closed
paulrouget opened this issue Jan 14, 2016 · 5 comments · Fixed by #9405
Closed

unexpected overflow #9306

paulrouget opened this issue Jan 14, 2016 · 5 comments · Fixed by #9405
Labels
A-layout/uncategorized I-wrong An incorrect behaviour is observed.

Comments

@paulrouget
Copy link
Contributor

The following example makes the body element scrollable. The extra area is apparently directly related to the horizontal padding.

v0qqmez3jc

<style>
  body {
    margin: 0;
  }

  .green {
    background: #0F0;
    height: 40px;
    width: 400px;
    top: 40px;
    left: 50%;
    margin-left: -300px;
    position: absolute;
    padding: 0px 100px;
  }

  .red {
    background: #F00;
    position: absolute;
    right: 0;
  }

</style>

<div class="green">
  <span class="red">x</span>
</div>
@glennw
Copy link
Member

glennw commented Jan 18, 2016

I can reproduce this bug with the following smaller code:

<style>
  body {
    margin: 0;
  }

  .green {
    background: #0F0;
    height: 40px;
    width: 600px;
    margin-left: -300px;
  }
</style>

<div class="green">
</div>

I think the problem is that negative margins are accumulated into the overflow rectangle, which is then used to determine whether a region is scrollable or not. I think Patrick mentioned something a while ago about Gecko having separate concepts for visual overflow vs. scrollable overflow - would that be relevant here? @pcwalton How should we handle this case in layout?

@paulrouget
Copy link
Contributor Author

@glennw do you think this is related to #9308 and #9309?

@pcwalton
Copy link
Contributor

If negative margins are accumulated into the overflow rect, then that should be easily fixable.

@pcwalton
Copy link
Contributor

There are actually two bugs here. One, which @glennw's test case displays, is that overflow: scroll should not allow you to scroll past the top left corner of the scrollable element (including the body). Fixing this issue fixes that test case. However, the original bug remains for an unknown reason.

@pcwalton
Copy link
Contributor

It looks like the second bug is an incremental reflow bug relating to inline absolute hypothetical fragments.

pcwalton added a commit to pcwalton/servo that referenced this issue Jan 23, 2016
absolutely-positioned flows separately when storing overflow.

This code dates back to the time when absolutely positioned flows were
ignored by all of their ancestors up to the containing block. This
hasn't been true for at least a year.

Closes servo#9306.
Closes servo#9309.
Is a partial fix for servo#9308.
bors-servo pushed a commit that referenced this issue Jan 23, 2016
layout: Remove some bogus code that tried to handle absolutely-positioned flows separately when storing overflow.

This code dates back to the time when absolutely positioned flows were
ignored by all of their ancestors up to the containing block. This
hasn't been true for at least a year.

Closes #9306.
Closes #9309.
Is a partial fix for #9308.

r? @glennw

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9405)
<!-- Reviewable:end -->
pcwalton added a commit to pcwalton/servo that referenced this issue Jan 25, 2016
absolutely-positioned flows separately when storing overflow.

This code dates back to the time when absolutely positioned flows were
ignored by all of their ancestors up to the containing block. This
hasn't been true for at least a year.

Closes servo#9306.
Closes servo#9309.
Is a partial fix for servo#9308.
bors-servo pushed a commit that referenced this issue Jan 25, 2016
layout: Remove some bogus code that tried to handle absolutely-positioned flows separately when storing overflow.

This code dates back to the time when absolutely positioned flows were
ignored by all of their ancestors up to the containing block. This
hasn't been true for at least a year.

Closes #9306.
Closes #9309.
Is a partial fix for #9308.

r? @glennw

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9405)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-layout/uncategorized I-wrong An incorrect behaviour is observed.
Projects
None yet
4 participants