Closed Bug 327532 Opened 18 years ago Closed 18 years ago

Content inserted before an element with a long (multi-line) ":before" text is inserted in the wrong place

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: uriber, Assigned: uriber)

Details

(Keywords: testcase)

Attachments

(2 files)

Smontagu and I came across this when investigating possible calls to nsFrameManager::InstertFrames() with continuation frames:

If an element has a very long (and therefore line-wrapped) "before:" text, then dynamically inserting content immediately before this element results in the content being inserted at the bginning of the last line of the "before:" text, instead of immediately before the element (and after the "before:" text).

This is due to nsLayoutUtils::IsGeneratedContentFor() returning FALSE for the last continuation of the generated content, in http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/layout/base/nsCSSFrameConstructor.cpp&rev=1.1195#9708

Testcase coming up.
Attached file testcase
Hit the button. The span with the red text gets inserted at the beginning of the last line of gray text (the ":before" text). It should be inserted immediately before the black text.
Keywords: testcase
Summary: Content inserted before an element with a long (multi-line) "before:" text is inserted in the wrong place → Content inserted before an element with a long (multi-line) ":before" text is inserted in the wrong place
(In reply to comment #0)
> This is due to nsLayoutUtils::IsGeneratedContentFor() returning FALSE for the
> last continuation of the generated content,

... which is due to the continuation not having the NS_FRAME_GENERATED_CONTENT bit copied over when created. There are probably parallel bugs with other bits from mState.

I have a patch for this, but it's adjacent to code changed in bug 299065, so I'll attach it after that bug lands.
Status: NEW → ASSIGNED
Assignee: dbaron → uriber
Status: ASSIGNED → NEW
Status: NEW → ASSIGNED
Attached patch patchSplinter Review
Attachment #212738 - Flags: superreview?(roc)
Attachment #212738 - Flags: review?(roc)
Attachment #212738 - Flags: superreview?(roc)
Attachment #212738 - Flags: superreview+
Attachment #212738 - Flags: review?(roc)
Attachment #212738 - Flags: review+
Checked in:
Checking in layout/base/nsCSSFrameConstructor.cpp;
/cvsroot/mozilla/layout/base/nsCSSFrameConstructor.cpp,v  <--  nsCSSFrameConstructor.cpp
new revision: 1.1197; previous revision: 1.1196
done
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9alpha
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: