Skip to content

unexpected overflow #9306

Closed
Closed

Description

@paulrouget

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>

Activity

  1. added
    I-wrong
    on Jan 16, 2016
  2. glennw commented on Jan 18, 2016

    @glennw
    Member

    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?

  3. paulrouget commented on Jan 19, 2016

    @paulrouget
    ContributorAuthor

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

  4. pcwalton commented on Jan 22, 2016

    @pcwalton
    Contributor

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

  5. pcwalton commented on Jan 23, 2016

    @pcwalton
    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.

  6. pcwalton commented on Jan 23, 2016

    @pcwalton
    Contributor

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

  7. added a commit that references this issue on Jan 23, 2016
    d81d1df
  8. added a commit that references this issue on Jan 23, 2016
    3061d50
  9. added a commit that references this issue on Jan 25, 2016
    9c7b9fa
  10. added a commit that references this issue on Jan 25, 2016
    4755cc5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-layout/uncategorizedI-wrong

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions