Closed Bug 11389 Opened 25 years ago Closed 25 years ago

floating image doesn't show alt text until resize

Categories

(Core :: Layout, defect, P3)

x86
Windows NT
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: karnaze, Assigned: buster)

References

()

Details

The alt text of the floating image doesn't show up until the window is resized
smaller than the table width.

<TABLE border>
 <tr>
  <TD width="500">
   <IMG SRC="dont_find_me.gif" WIDTH=85 HEIGHT=120 BORDER=0
    ALIGN="right" ALT="XXX">
    foo</td>
 </tr>
</table>

Upon dumping frames, I noticed the following:

 Floater-list<
  Block(img)(1)@09B07140 {0,0,0,0} [state=00000406] sc=09B02D40<
   line 09B051B0: count=1 state=dirty,inline[0x9] {0,0,0,0} ca={0,0,0,0} <
    Text(-1)@09B070C0[0,-1,F][0]  {0,0,0,0} [state=00000406] sc=09B05220<
     ""

whereas when the image could be found, the corresponding floater list looked
like:

 Floater-list<
  Frame(img)(1)@09FA34E0 {6150,0,1275,1800} [state=000001a4]
Assignee: kipp → troy
Assignee: troy → kipp
Kipp, this is a block issue. The frame construction code is creating the new
frame, removing the old frame, and inserting the new frame, and _re-using_ the
old placeholder frame and just re-binding it to the new out-of-flow frame

I thought it was on your list of things to-do to change the block code's floater
handling so it uses its floater child list rather than having the reflow of the
placeholder trigger the reflow of the floater.
Status: NEW → ASSIGNED
Target Milestone: M12
As agreed with Beth, assigning myself as QA contact for all 'alt text' bugs...
Target Milestone: M12 → M15
Assignee: kipp → troy
Status: ASSIGNED → NEW
Something else is wrong; I dumped the frame tree and I see that the placeholder
frame's out-of-flow frame hasn't been changed, hence troy's comments are either
wrong or out of date...back to you troy...

webshell=0x80fdce8
Viewport(-1)@0x82aa0a8 [view=0x82a3360] {0,0,6192,4032} [state=00000416]
sc=0x82ae878<
  Scroll(-1)@0x82aec58 [view=0x82af100] {0,0,6192,4032} [state=00000004]
sc=0x82aecc8<
    Root(-1)@0x82b00b0 [view=0x82b0500] {0,0,6192,4032} sc=0x82b0120<
      Area(html)(-1)@0x82b09f8 {0,0,6192,4032} [state=00000014] [flags=c]
sc=0x82b0618(i=0,b=1)<
        line 0x82b1460: count=1 state=clean,block[0x12] {115,115,6077,1870}
ca={115,115,5962,1870} <
          Block(body)(1)@0x82b0f08 {115,115,5962,1870} [state=00000014]
sc=0x82b0b08(i=0,b=1)<
            line 0x82bad58: count=1 state=clean,block[0x12] {0,0,5962,1870}
ca={0,0,5962,1870} <
              TableOuter(table)(0)@0x81e9e40 {0,0,5962,1870} [state=00000004]
sc=0x82b7bd8<
                Table(table)(0)@0x82b7ea8 {0,0,5962,1870} [state=00000014]
sc=0x82b7bd8<
                  TableRowGroup(tbody)(0)@0x82b8580 {14,14,5934,1842}
[state=00000014] sc=0x82b81a0<
                    TableRow(tr)(0)@0x82b8a00 {0,0,5905,1842} [state=00000014]
sc=0x82b85f8<
                      TableCell(td)(0)@0x82b8ee0 {29,29,5876,1784}
[state=00000014] sc=0x82b8aa0<
                        Area(td)(0)@0x82b8fc8 {28,28,5820,1728} [state=0000001c]
[flags=20] sc=0x82b9040(i=1,b=0)<
                          line 0x82ba388: count=3 state=clean,inline[0x10]
mew=1282 {0,0,259,215} ca={0,0,5820,1728} <
                            Text(0)@0x82b9868[0,4,T]  next=0x82b9e50 {0,172,0,0}
[state=41000024] sc=0x82b9488<
                              "\n   "
                            >
                            Placeholder(img)(1)@0x82b9e50 {0,172,0,0}
[state=00000004] outOfFlowFrame=Frame(img)(1)@0x82b9c90
                            Text(2)@0x82ba340[0,8,T]  {0,0,259,215}
[state=41000024] sc=0x82b9488<
                              "\n    foo"
                            >
                          > floaters <
                            placeholder@0x82b9e50 Frame(img)(1) cl
region={4538,0,1282,1728} combinedArea={0,0,1224,1728}
                          >
                          Floater-list<
                            Frame(img)(1)@0x82b9c90 {4596,0,1224,1728}
[state=000001b4]
                          >
                        >
                      >
                    >
                  >
                >
                ColGroup-list<
                  TableColGroup(table)(0)@0x82ba868 {14,14,5934,1842}
[state=00000004] sc=0x82ba488<
                    TableCol(table)(0)@0x82bacc0 {0,0,5934,1842}
[state=00000004]
                  >
                >
              >
            >
          >
        >
      >
    >
  >
>
Looking at Chris's original bug report you can see that the dump of the frame
tree shows Block(img). That's consistent with my account as well, and if you're
not seeing that in a recent dump of the tree that would suggest something has
changed rather than than my comments being wrong.

Looking at a dump of the frame tree isn't rocket science...
Status: NEW → ASSIGNED
The bug has nothing to do with tables (no surprise there). This smaller sample
demonstrates the problem as well.

<p><IMG SRC="dont_find_me.gif" WIDTH=85 HEIGHT=120 BORDER=0
    ALIGN="right" ALT="XXX">foo
</p>
Here's a dump of the frame tree using the reduced test case that doesn't include
tables. It shows that the image frame is gone and replaced with a block/text
frame for the ALT attribute

webshell=00BD0DD0
Viewport(-1)@01B88710 [view=01B8B0F0] {0,0,10440,8310} [state=00000416] sc=01B88
3E0<
  Scroll(-1)@01B88210 [view=01B89C60] {0,0,10440,8310} [state=00000004] sc=01B89
D40<
    Root(-1)@01B97450 [view=01B97EE0] {0,0,10440,8310} sc=01B97120<
      Area(html)(-1)@01B97960 {0,0,10440,8310} [state=0000001c] [flags=c] sc=01B
97B60(i=0,b=1)<
        line 01B96CC0: count=1 state=clean,block[0x12] bm=240 {120,120,10320,285
} ca={120,120,10200,1800} <
          Block(body)(1)@01B96DE0 {120,120,10200,285} [state=0000000c] sc=01B975
80(i=1,b=1)<
            line 01B94500: count=1 state=clean,block[0x12] {0,0,10200,285} ca={0
,0,10200,1800} <
              Block(p)(0)@01B95B50 next=01B94230 {0,0,10200,285} [state=4000001c
] sc=01B95D40(i=1,b=0)<
                line 01B94570: count=2 state=clean,inline[0x10] {0,0,360,285} ca
={0,0,10200,1800} <
                  Placeholder(img)(0)@01B95470 {0,225,0,0} [state=00000004] outO
fFlowFrame=Block(img)(0)@01B91090
                  Text(1)@01B94630[0,3,T]  {0,0,360,285} [state=40000024] sc=01B
94810<
                    "foo\n"
                  >
                > floaters <
                  placeholder@01B95470 Block(img)(0) cl region={8865,0,1335,1800
}
                >
                Floater-list<
                  Block(img)(0)@01B91090 {0,0,0,0} [state=00000406] sc=01B95870(
i=1,b=0)<
                    line 01B91200: count=1 state=dirty,inline[0x1] {0,0,0,0} ca=
{0,0,0,0} <
                      Text(-1)@01B91270[0,-1,F]  {0,0,0,0} [state=00000406] sc=0
1B93190<
                        ""
                      >
                    >
                  >
                >
              >
            >
            line 01B926A0: count=1 state=clean,inline[0x14] {0,285,0,0} ca={0,28
5,0,0} <
              Text(1)@01B94230[0,5,T]  {0,525,0,0} [state=41000024] sc=01B92710<

                "    \n\n"
              >
            >
          >
        >
      >
    >
  >
>
Here's what is happening
- the CantRenderReplacedElement() code creates the new block and text frames
- it then reuses the existing placeholder frame. That involves calling the
placeholder frame and resetting its out-of-flow frame to be the block frame and
not the image frame
- it then calls the ReplaceFrame() function on the image frame's parent

We eventually call nsBlockFrame::RemoveFrame(). It sees the removed frame is a
floater and it removed it from the mFloaters list.

Then it searches each line looking for the floater. The trouble is it the line's
floater list is a list of placeholder frames, and Find() works by looking at the
placeholder frame's out-of-flow frame

That's already been reset by the frame construction code to point to the new
block frame...
I changed the frame construction code to reset the placeholder frame's
out-of-flow frame to the new block frame AFTER replacing the image frame with
the block frame, but that doesn't fix the problem either.

Now we're finding the image frame in the line's list of floaters, but since the
block frame code doesn't generate a reflow command either when removing the
floated image frame or when inserting the floated block frame we still don't
reflow...
Summary: floating image inside table doesn't show alt text until resize → floating image doesn't show alt text until resize
I have a fix which is to change the frame construction code. I put a #if 0
around the old code and instead made it so we always create a new placeholder
frame rather than reuse the old placeholder frame

This is less efficient and I think it's kind of crummy that the frame
construction has to have knowledge of the internal quirks of the block frame
code
I'll be glad to fix the block frame code after your other fix, but before you
made that fix I couldn't even see anything wrong...just reassign the bug to me
instead of putting the hack into the frame construction code.
I haven't checked any fixes in yet. You should be seeing the same frame tree I'm
seeing?

Maybe there's different behavior between Linux and Windows?
Okay, when the tree opens I'll check in my change that sets the placeholder
frame's out-of-flow frame to the new frame _after_ calling ReplaceFrame() and
replacing the image frame with the new frame.

If it's going to require a bunch of effort on your part to make sure the reflow
happens, then let me know and I'll put in the code that replaces the placeholder
frame we well
Assignee: troy → kipp
Status: ASSIGNED → NEW
Okay, I changed CantRenderReplacedElement() to reset the placeholder frame's
out-of-flow after calling ReplaceFrame() to replace the primary frame.

Let me know if you see any more problems
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
We now queue up a reflow command whenever RemoveFrame is called.
Status: RESOLVED → VERIFIED
This works perfectly using Win32 1999-10-04.
You need to log in before you can comment on or make changes to this bug.