Last Comment Bug 180921 - z-index ignored on hidden IFRAME
: z-index ignored on hidden IFRAME
Status: RESOLVED FIXED
[fix]
:
Product: Core
Classification: Components
Component: Layout: View Rendering (show other bugs)
: Trunk
: All All
: -- normal (vote)
: ---
Assigned To: Robert O'Callahan (:roc) (Exited; email my personal email if necessary)
: Hixie (not reading bugmail)
Mentors:
http://www.zonageek.com/tmp/iframebug...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2002-11-19 09:14 PST by Sebastian Delmont
Modified: 2003-02-22 13:49 PST (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
fix (2.68 KB, patch)
2003-01-19 16:09 PST, Robert O'Callahan (:roc) (Exited; email my personal email if necessary)
john: review+
jst: superreview+
Details | Diff | Splinter Review

Description Sebastian Delmont 2002-11-19 09:14:09 PST
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2b) Gecko/20021105
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2b) Gecko/20021105

The z-index CSS attribute can be used to display some elements on top of an
IFRAME, and that works fine.

But if the IFRAME is initially hidden and displayed afterwards, then it overlaps
any other object, regardless of z-index value.

Reproducible: Always

Steps to Reproduce:
1. Visit http://www.zonageek.com/tmp/iframebug.html
2. Click on "Display Hidden DIV"


Actual Results:  
The "hidden" DIV (that was initially hidden and later displayed when the link
was clicked) contains an IFRAME, and while the DIV is "below" the overlapping
yellow DIV, the IFRAME is displayed above it.

The blue DIV on the left has exactly the same HTML and CSS attributes, and it is
displayed correctly. The only difference is that the one on the left is
displayed initially.

Expected Results:  
Display the IFRAME "under" the yellow DIV, just like the blue DIV on the left.

Mozilla 1.2b on Mac OS X (Gecko/20021015) shows the same incorrect behaviour.
Comment 1 Boris Zbarsky [:bz] 2002-11-19 09:25:38 PST
seeing this on Linux too.  At a guess, the widget and view orders are out of
sync....
Comment 2 Sebastian Delmont 2002-11-19 11:15:20 PST
The problem only happens when the element is hidden using "display: none".

Hiding with "z-index: -1" or with "visibility: hidden" work fine.
Comment 3 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2003-01-19 16:09:40 PST
Created attachment 112004 [details] [diff] [review]
fix

The problem here is just that the new IFRAME wasn't being hooked up to the tree
of view managers. This is because for the new IFRAME, nsDocumentViewer was
using Show() instead of MakeWindow(). Show() seems to contain what was
originally a copy of MakeWindow(), although MakeWindow() got the view manager
tree hookup added and Show() didn't.

I fixed this by making Show just call MakeWindow instead of duplicating most of
its code. My only question is why Show() was duplicating all that code in the
first place...
Comment 4 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2003-01-19 16:11:45 PST
BTW there is one difference in Show() vs MakeWindow(): the former uses
mDeviceContext to initialize the view manager, the latter uses the device
context from the mPresContext. I believe that the latter is always correct.
Comment 5 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2003-01-22 11:03:21 PST
Comment on attachment 112004 [details] [diff] [review]
fix

changing sr request to jst, who knows this code well and who may know why this
code wasn't merged in the first place :-)
Comment 6 Johnny Stenback (:jst, jst@mozilla.com) 2003-01-22 16:49:56 PST
Comment on attachment 112004 [details] [diff] [review]
fix

Heh, well, I don't think there's anyone alive that knows this code well, but
I've made my own mess here, so I guess I kinda know what's going on (oh how I
wish someone had the time to clean this mess up).

Anyways, looks good to me, sr=jst
Comment 7 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2003-02-22 13:49:06 PST
Fix checked in

Note You need to log in before you can comment on or make changes to this bug.