Closed Bug 102860 Opened 24 years ago Closed 24 years ago

insertBefore inserts after

Categories

(Core :: Layout, defect, P4)

defect

Tracking

()

RESOLVED FIXED
mozilla0.9.9

People

(Reporter: vva, Assigned: waterson)

Details

Attachments

(6 files)

Nodes inserted w. the insertBefore() -method are mostly appended and placed inconsistently. Applies to mozillas up to the current milestone. See attached source and compare w. Internet Explorer 5.5+.
I don't see the problem, please attach a simplified testcase and explain what the difference is between how Mozilla and IE 5.5+ handle it.
Ok, sorry. That's a simplified testcase from something rather more complex I've been doing w. IE. From the interface point of view: When you click on "section" in the "Insert [ section ]" -link, a new section should be created just above and a new "Insert [ section ]" -link above that so sections always have one "Insert" -link between them. The sections are numbered for illustation putposes. The section w. the next number should appear above the "Insert [ section ]" -link you click. Looks like below as it pushes the others down, but it is above. The problem on my 0.9.4 and before that on 0.9.3 is that while IE does just that, mozilla appends the section to the end (or right next to another one near the end) and the "Insert" -link in different places depending a bit on which one I click. I'll upload a gif (clipboard.gif) to illustate what approximately (can't really figure out which is which after a while) the same sequence of clicks produces on the two browsers... If this is due to abug in my code, I apologise for the bother. I've tried this with cloning HTML-nodes before I went to creating DOM-nodes. Trying to move the sections up and down is even more of a mess...
The problem here seems to be that Mozilla is not accurately displaying the content model. Forcing a refresh of the display (setting .style.display to 'none' then back to 'block') causes it to be correctly drawn. I've seen this in some of my own work before; I'll try to hack up a simple testcase that reproduces the bug. Confirming on win2K build 2001100203.
Status: UNCONFIRMED → NEW
Ever confirmed: true
The problem lies in the "position: relative", as far as I can tell. Attaching a testcase that's much simpler. (commenting out the position = "relative" part in the original testcase makes it work, by the way). Seeing this on current linux trunk. Is this layout, perhaps?
OS: Windows 2000 → All
Hardware: PC → All
Over to layout per Jason's comments.
Assignee: jst → attinasi
Component: DOM Core → Layout
QA Contact: stummala → petersen
Nice call on the position:relative, Boris. Nice testcase too. Attaching another one that shows that this problem is not dependent on the elements being created from script.
The content model is correct, but we are not adding the frames correctly (checked in Viewer). Assigning to Waterson since he is far more adept in the FrameConstructor than I am (and less swamped too).
Assignee: attinasi → waterson
Status: NEW → ASSIGNED
Priority: -- → P4
Target Milestone: --- → mozilla0.9.6
Target Milestone: mozilla0.9.6 → mozilla0.9.7
Target Milestone: mozilla0.9.7 → mozilla0.9.8
Target Milestone: mozilla0.9.8 → mozilla0.9.9
Attached patch fixSplinter Review
This bug was in the code that looked around for prev-in-flow and next-in-flow: a relatively positioned frame _doesn't_ have a placeholder frame (since it impacts the normal flow).
Keywords: review
Since placeholder frames are created for both IsAbsolutelyPositioned() and IsFixePositioned(), is it necessarty to test both too in your changes?
nsStyleDisplay::IsAbsolutelyPositioned actually checks for either absolute of fixed positioning. :-/ <http://lxr.mozilla.org/mozilla/source/content/shared/public/nsStyleStruct.h#788>
sr=hyatt
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: