Closed Bug 385354 Opened 17 years ago Closed 17 years ago

Hang with ::before text, text-align: right and white-space: -moz-pre-wrap

Categories

(Core :: Layout, defect)

x86
Windows XP
defect
Not set
critical

Tracking

()

VERIFIED FIXED

People

(Reporter: martijn.martijn, Assigned: roc)

References

Details

(Keywords: hang, regression, testcase)

Attachments

(3 files, 2 obsolete files)

Attached file testcase
I guess this might be similar as bug 385344.
This regressed when the new textframe patch landed.
This is an interesting one. We seem to be building a bad frame tree:

              Block(div)(1)@0x25e2444 next=0x25e295c {0,0,4732,2304} [state=00001000] sc=0x25e2264(i=3,b=0)<
                line 0x25e28ec: count=2 state=inline,dirty,prevmarginclean,not impacted,wrapped,before:nobr,after:nobr[0x40a1] {1440,0,3292,1152} ca={0,0,4732,1152} <
                  Text(0)@0x25e23b8[0,1,T]  next=0x25e25a4 {1440,96,0,960} [state=08200000] [content=0x3d32fb40] sc=0x25e249c pst=:-moz-non-element<
                    "\n"
                  >
                  Inline(object)(1)@0x25e25a4 next=0x25e2c4c next-continuation=0x25e2c4c {1440,96,3292,960} [state=00000400] [content=0x3d0f7510] [sc=0x25e2554]<
                    Inline(object)(1)@0x25e26ac next=0x25e27c8 next-continuation=0x25e2cf0 {0,0,3292,960} [state=00000040] [content=0x3d0f7510] [sc=0x25e2604] pst=:before<
                      Text(-1)@0x25e24ec[0,7,F]  next-continuation=0x25e2cac {0,0,3292,960} [state=00600040] [content=0x3d35a620] sc=0x25e26e4 pst=:-moz-non-element<
                        "before "
                      >
                    >
                    Inline(span)(0)@0x25e27c8 {0,0,0,0} [state=00000402] [content=0x3d331100] [sc=0x25e279c]<
                      Text(0)@0x25e2734[0,1,T]  {0,0,0,0} [state=00000402] [content=0x3d359e50] sc=0x25e285c pst=:-moz-non-element<
                        "\n"
                      >
                    >
                  >
                >
                line 0x25e2c84: count=1 state=inline,dirty,prevmarginclean,not impacted,not wrapped,before:nobr,after:linebr[0x2881] {2692,1152,2040,1152} ca={0,1152,4732,1152} <
                  Inline(object)(1)@0x25e2c4c next=0x25e28ac prev-continuation=0x25e25a4 {2692,1248,2040,960} [state=00000404] [content=0x3d0f7510] [sc=0x25e2554]<
                    Inline(object)(1)@0x25e2cf0 prev-continuation=0x25e26ac {0,0,1440,960} [state=00000044] [content=0x3d0f7510] [sc=0x25e2604] pst=:before<
                      Text(-1)@0x25e2cac[7,4,T]  prev-continuation=0x25e24ec {0,0,1440,960} [state=00200044] [content=0x3d35a620] sc=0x25e26e4 pst=:-moz-non-element<
                        "text"
                      >
                    >
                  >
                >
                line 0x25e2d5c: count=1 state=inline,clean,prevmarginclean,not impacted,not wrapped,before:nobr,after:nobr[0x2180] {4732,2304,0,0} <
                  Text(2)@0x25e28ac[0,1,T]  {4732,2304,0,0} [state=08200000] [content=0x3d359e80] sc=0x25e249c pst=:-moz-non-element<
                    "\n"
                  >
                >
              >

Note that the span's \n is between "before" and "text" ... this definitely should not happen! Probably an existing bug that new-textframe has exposed.
Attached patch fix (obsolete) — Splinter Review
Assignee: nobody → roc
Status: NEW → ASSIGNED
Attached patch fix -w (obsolete) — Splinter Review
The problem here is that when we change the white-space property on the span, its frame is reconstructed in the wrong place. The nsCSSFrameConstructor has code to account for :before frames when inserting the first child of a node, but that code doesn't run when isAppend is true --- in this case, it needs to. The fix is simple.
Attachment #269329 - Flags: superreview?(dbaron)
Attachment #269329 - Flags: review?(dbaron)
Attached patch revised fixSplinter Review
oops, the previous patch set isAppend=PR_FALSE a little more than necessary.
Attached patch revised fix -wSplinter Review
Oops, the previous patch set isAppend to false a little more often than necessary.
Attachment #269328 - Attachment is obsolete: true
Attachment #269329 - Attachment is obsolete: true
Attachment #269331 - Flags: superreview?(dbaron)
Attachment #269331 - Flags: review?(dbaron)
Attachment #269329 - Flags: superreview?(dbaron)
Attachment #269329 - Flags: review?(dbaron)
Flags: in-testsuite?
Comment on attachment 269331 [details] [diff] [review]
revised fix -w

r+sr=dbaron, although I don't see why you need to set isAppend to false at all.  It might be good to add a comment explaining why.
Attachment #269331 - Flags: superreview?(dbaron)
Attachment #269331 - Flags: superreview+
Attachment #269331 - Flags: review?(dbaron)
Attachment #269331 - Flags: review+
I suppose we could set appendAfterFrame instead and take the Append path. But I think it's just as simple, and lower risk, to use the Insert path for all "insert after :before frames" situations. I'll add a comment to mention that.
checked in.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Verified fixed, using:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a7pre) Gecko/2007071905 Minefield/3.0a7pre
Status: RESOLVED → VERIFIED
Crash test:
https://hg.mozilla.org/integration/mozilla-inbound/rev/6f4e6810b9a1
Flags: in-testsuite? → in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: