Bug 18080 - wrong layout as style overflow:hidden doesn't affect webkit
Summary: wrong layout as style overflow:hidden doesn't affect webkit
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: Safari 9
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://cn.msn.com/
Keywords: HasReduction
Depends on:
Blocks:
 
Reported: 2008-03-25 14:43 PDT by jasneet
Modified: 2022-07-11 16:19 PDT (History)
4 users (show)

See Also:


Attachments
screenshot (152.28 KB, image/jpeg)
2008-03-25 14:43 PDT, jasneet
no flags Details
reduction (351 bytes, text/html)
2008-03-25 14:44 PDT, jasneet
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description jasneet 2008-03-25 14:43:23 PDT
I Steps:
Go to 
http://cn.msn.com/
Scroll to the end of the page.

II Issue:
The search bar at the bottom of the page has wrong layout. It is shifted upwards

III Conclusion:
On removing div style overflow:hidden, FF/Opera behave same as Safari. 

IV Other browsers:
IE7: ok
FF3: ok
Opera9.24: ok

V Nightly tested: 31238
Comment 1 jasneet 2008-03-25 14:43:43 PDT
Created attachment 20042 [details]
screenshot
Comment 2 jasneet 2008-03-25 14:44:21 PDT
Created attachment 20043 [details]
reduction
Comment 3 Tab Atkins 2011-10-19 21:40:06 PDT
Yup, we're wrong here.  We're allowing margins to collapse through a BFC established with "overflow:hidden", which is a violation of the spec.

Here's a test case:

<!DOCTYPE html>
<div id=error></div>
<div id=a>
  <div id=should-be-bfc></div>
  <div id=b></div>
</div>
<style>
#a {
  height: 40px;
  margin-top: 20px;
}

#b {
  height: 20px;
  margin-top: 20px;
  background: green;
}

#should-be-bfc {
  overflow: hidden;
}

#error {
  height: 20px;
  width: 100%;
  background: red;
  position: absolute;
  top: 40px;
  z-index: -1;
}

body { margin: 0; }
</style>

If you change the "overflow:hidden" to "display:table" (another way to establish a BFC), you see the correct behavior (the red is hidden, because the green block is pushed further down by its margins).
Comment 4 Chris Rebert 2016-02-03 18:36:12 PST
Still reproduces in Safari Version 9.0.3 (11601.4.4) on OS X El Capitan.
Looks like this was fixed in Chrome; it doesn't repro in Chrome 48.
Comment 5 Brent Fulgham 2022-07-11 16:19:06 PDT
Safari, Chrome, and Firefox show the same rendering behavior for this test case. I do not believe any further compatibility issue remains.