Closed Bug 25290 Opened 25 years ago Closed 25 years ago

[FLOAT] if floater has a view, view not positioned correctly

Categories

(Core :: Layout: Form Controls, defect, P3)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: chrispetersen, Assigned: troy)

References

()

Details

Attachments

(1 file)

Build: Apprunner Version: 2000012612 Platform: All Expected Results: The input/image element should aligned to the left or right edge of page. What I got: The input/image is "floating" over portions of other elements. Steps to reproduce: 1) Open url in apprunner 2) Notice that the image (which has been aligned left) is floating over some of the text above it.
Buster suggested that I assign this to kipp which he will pickup.
Assignee: karnaze → kipp
floater display problem
Summary: INPUT=IMAGE not properly aligning with left or right value → [FLOAT] INPUT=IMAGE not properly aligning with left or right value
Target Milestone: M16
kipp is very unlikely to fix these, since he's not working ont he project any longer. so I'll take a look.
Assignee: kipp → buster
changed subject to specify general problem. reassigned to troy per email...adding the details below. will attach simple test case using IMG ============================================================================= Hi Troy: First, read the bug report. Basically, floating <input type=image> doesn't work. If you change the <input type=image align=left> to an <img align=left>, the test case works fine. The difference between them is the <input> has a view. The frame tree looks correct, but the view tree looks wrong. 0251EC60 (widget=0251EB34[3] pos={0,0,9150,4125}) {0,0,9150,4125} z=0 vis=1 opc=1.000 tran=0 clientData=011A9038 < 02572F00 {0,0,9150,4125} z=0 vis=1 opc=1.000 tran=0 clientData=011A90B0 < 02572850 (widget=02571854[2] pos={0,4125,9150,240}) {0,4125,9150,240} z=0 vis=0 opc=1.000 tran=0 clientData=00000000 < > 025753F0 (widget=02571A74[2] pos={9150,0,240,4125}) {9150,0,240,4125} z=0 vis=0 opc=1.000 tran=0 clientData=00000000 < > 02571D70 (widget=02577084[2] pos={8910,3885,240,240}) {8910,3885,240,240} z=0 vis=0 opc=1.000 tran=0 clientData=00000000 < > 02571EA0 (widget=02577914[2] pos={0,0,9150,4125}) {0,0,9150,4125} z=0 vis=1opc=0.000 tran=0 clientData=00000000 < 02576F80 {0,0,9150,4125} z=0 vis=1 opc=1.000 tran=0 clientData=011A9074 < 02585D90 {120,120,1560,1560} z=0 vis=1 opc=1.000 tran=1 clientData=011A9258 < The last view (02585D90) corresponds to the <input type=image>. It's y-offset looks much too small given the line containing it is at y-offset 570. I don't know much about view placement other than it's typically done in FinishReflowChild. nsBlockFrame does not call this. Instead, it has this code in ReflowFloater(): nsIView* view; floater->GetView(aState.mPresContext, &view); if (view) { nsContainerFrame::SyncFrameViewAfterReflow(aState.mPresContext, floater, view, &metrics.mOverflowArea, NS_FRAME_NO_MOVE_VIEW); } floater->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED); then later in nsBlockFrame::PlaceFloater(), there's this code: // Position the floater and make sure and views are properly positioned nsIView* view; floater->MoveTo(mPresContext, x, y); floater->GetView(mPresContext, &view); if (view) { nsContainerFrame::PositionFrameView(mPresContext, floater, view); } else { nsContainerFrame::PositionChildViews(mPresContext, floater); } So, my questions are: 1) should the code above work to properly place the view? Or is there newer code in FinishReflowChild() that makes different assumptions than this code? 2) is the view synch code in ReflowFloater() unnecessary, since we will move the view later in PlaceFloater()? 3) other suggestions for tracking this down further? =============================================================================== Steve Clark wrote: could it have something to do with confusion in measuring the frame's offset from parent view? It looks like the offset of the floater is always the same regardless of where the floater really ended up. But the offset of the placeholder frame gives a different answer, closer to the truth. The placeholder frame represents the in-flow position. Roughly where the frame would be if it were in the flow. If you change the <input type=image align=left> to an <img align=left>, the test case works fine. The difference between them is the <input> has a view. What if for <img align=left> you also give it a view? You can do that by specifying "style=opacity:50%" -Troy =============================================================================== as you guessed, the IMG with opacity fails exactly like the <input type=image>. The view gets places in the upper left corner (offset by 120,120 which I guess is the default HTML page margin?) Steve
Assignee: buster → troy
Summary: [FLOAT] INPUT=IMAGE not properly aligning with left or right value → [FLOAT] if floater has a view, view not positioned correctly
Attached file test case, floated <IMG> with a view (deleted) —
It looks like the problem is because the floater is inside of a FORM. The image frame has the wrong "parent" frame pointer and so that's why the y-offset for the view is incorrect. The floater thinks its parent is the BODY and not the FORM frame. I think the problem is in the frame construction code
Fixed the frame construction code to treat the form frame like a floater containing block and now the floated element has the correct parent frame pointer
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Fixed in the May 13th build (2000051320).
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: