Closed Bug 1322257 Opened 8 years ago Closed 7 years ago

[non-e10s] The <select> box dropdown list is rendered detached from the <select> element contained in iframe

Categories

(Core :: Layout: Form Controls, defect)

2.0 Branch
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla53
Tracking Status
firefox50 --- wontfix
firefox51 --- wontfix
firefox52 --- wontfix
firefox53 --- verified

People

(Reporter: ajaypal, Assigned: tnikkel)

References

Details

(Keywords: regression, testcase)

Attachments

(7 files, 1 obsolete file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:50.0) Gecko/20100101 Firefox/50.0
Build ID: 20161129173726

Steps to reproduce:

Create two iframes in a page, one a menu other work area
add some CSS to remove borders, spaces, full height/ width for iframes
displaye a page containing a select drop down in each iframe (same page in both frames for simplicity)



Actual results:

On clicking the select element, the select box drop down is rendered detached from the select element. If I choose inspect element by right clicking on the select element, the rendering becomes as expected i.e drop down attached to select element


Expected results:

Select drop down should have appeared adjacent/ attached to the select element
OS: Unspecified → Mac OS X
Hardware: Unspecified → x86_64
Attached file select.html
this html is rendered in an iframe through the index.html
Status: UNCONFIRMED → NEW
Has STR: --- → yes
Component: Untriaged → Layout
Ever confirmed: true
Keywords: testcase
OS: Mac OS X → All
Product: Firefox → Core
Hardware: x86_64 → All
Attachment #8817010 - Attachment description: The html containing the select elements → select.html
Attached file index.html
Attachment #8817009 - Attachment is obsolete: true
It's rendered fine with e10s enabled.
Component: Layout → Layout: Form Controls
Summary: HTML Select Rendering Issue → [non-e10s] The <select> box dropdown list is rendered detached from the <select> element contained in iframe
I see a strange results. In my main profile, it works fine with e10s off, but it does not work if saved as a local files or use firefox safe mode. In a new profile (e10s off), it resembles the result of saving to local files. The above tests are use comment 4 with 51.0b6 (64-bit) on Win10.

In addition, in 53.0a1 (2016-12-07) (32-bit) with e10s on, it is normal location but slightly larger, see screenshot.
Please note that if I right click and choose inspect element the select rendering becomes as expected in non e10s, not only locally but online as well and remains OK till next refresh of page. 

If I remove two lines from css in index.html
/* comment out these two fixes the issue */
   margin: 0px;
   padding: 0px;
/* */

This bug is not triggered

e10s rendering is OK
This file contains same iframes but two CSS properties removed i.e.
   margin: 0px;
   padding: 0px;
It renders <select> correctly in non e10s
Caused by bug 594333. Confirmed by reverting it locally.
Blocks: 594333
Keywords: regression
nsTableCellFrame::Reflow computes the position of its child, then calls nsContainerFrame::ReflowChild with that position. nsContainerFrame::ReflowChild moves the child and positions the view of that child if it has a view (it doesn't have a view in this case, so no views are moved, including views in the frame subtree rooted at the child). Then it calls nsContainerFrame::FinishReflowChild with the same position. FinishReflowChild checks to see if it moved the frame, and if so it positions the view for the child (PositionFrameView) and any descendants (PositionChildViews). But ReflowChild already moved the child to this position, so FinishReflowChild sees no change in position and no views are moved. It seems like there is a bug in ReflowChild, it should be calling PositionChildViews as well as PositionFrameView.

Some users of ReflowChild/FinishReflowChild seem to also do view positioning themselves. Some don't.

nsContainerFrame::ReflowChild is ancient code, so changing it is scary. One possible bad scenario that is possible:
1) child is moved from it's eventually final position to a non-final position
2) ReflowChild is called for the child when it is in this non-final position (views are moved)
3) child is moved back to final position without using/calling FinishReflowChild)
4) the code doesn't do any positioning of views for this final move, so the descendant views are in the wrong place

A less scary patch would be to check the intial and final position in nsTableCellFrame::Reflow, and position views if they are different.


The history of this code goes back to 1999:

http://searchfox.org/mozilla-central/commit/597b5f236b0455bdda4ff91da00fe94a9958e63a

And that commit in nsTableCellFrame specifically at the ReflowChild callsite

http://searchfox.org/mozilla-central/diff/597b5f236b0455bdda4ff91da00fe94a9958e63a/layout/tables/nsTableCellFrame.cpp#668

there is an interesting comment that was added with that commit above the ReflowChild call:

+   // Assume the inner child will stay positioned exactly where it is. Later in
+   // VerticallyAlignChild() we'll move it if it turns out to be wrong. This
+   // avoids excessive movement and is more stable

and the position passed to ReflowChild is the existing position of the child (unless this is the first reflow, in which case it computes it). So the code was expecting the child to not move, and hence to not need to move views.

dbaron's giant reflow refactor from bug 300030 rewrote this code:

http://searchfox.org/mozilla-central/diff/31f1898810f733c40bfe3fd4b25295885feb2e39/layout/tables/nsTableCellFrame.cpp#812

The comment was removed and the position was always computed.
Attached patch patchSplinter Review
Sorry to dump this on you dholbert.
Assignee: nobody → tnikkel
Attachment #8818800 - Flags: review?(dholbert)
Comment on attachment 8818800 [details] [diff] [review]
patch

Review of attachment 8818800 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks -- this seems fine to me.
Attachment #8818800 - Flags: review?(dholbert) → review+
Pushed by tnikkel@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d31212fd22bb
Always position child views in nsContainerFrame::ReflowChild. r=dholbert
https://hg.mozilla.org/mozilla-central/rev/d31212fd22bb
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Please request Aurora/Beta approval on this when you get a chance.
Flags: needinfo?(tnikkel)
Version: 50 Branch → 2.0 Branch
This is an old bug (6 years old) and the fix is a little scary so I'd prefer not to uplift if that's okay. Less and less users will see this as e10s rolls out to more people anyway.
Flags: needinfo?(tnikkel)
Flags: qe-verify+
Reproduced on Fx 52.
Verified fixed Fx 53b1 Win 10, Ubuntu 14.04, OS X 10.11.
Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: