Open Bug 159403 Opened 22 years ago Updated 2 years ago

text-indent and :first-letter don't work with a img before the first letter

Categories

(Core :: Layout: Block and Inline, defect)

defect

Tracking

()

People

(Reporter: ch.ey, Unassigned)

References

()

Details

(Keywords: css1, testcase)

Attachments

(2 files)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; de-DE; rv:1.1b) Gecko/2002072104
BuildID:    2002072104

Code like
<p style="text-indent"><img ...>Text
won't produce indentation of the line.
Even definitions in p:first-letter won't take effect if a img-tag lays between
the p and the Text.

I can't see anything in the CSS-Spec forbidding them in this case.
Opera 6.x and IE render it the way I'd call correct.

See my test page to reproduce.
Confirmed on WinXP trunk build 2002072408.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Confirmed on WinXP trunk build 2002072514.
Priority: -- → P3
Target Milestone: --- → Future
How should floats affect text-indent?
Assignee: attinasi → block-and-inline
Component: Layout → Layout: Block & Inline
Keywords: qawanted
Priority: P3 → --
QA Contact: cpetersen0953 → ian
Target Milestone: Future → ---
The indent should also be moved by the float. (The indent is from the start of
the line box, and the whole line box is moved by the float.) IIRC.
OK.  Well, the easy part is first-letter.  See
http://lxr.mozilla.org/seamonkey/source/layout/html/style/src/nsCSSFrameConstructor.cpp#12943.

Should we be skipping over placeholder frames when looking for the first letter?
 For that matter, what would the correct layout be if the image were _not_ floated?
Hardware: PC → All
I've created a testcase looking at 'text-indent', where text in a containing
block is preceeded by either a block element or a floated element.

It appears that the text-indent is lost even when it is preceeded by a simple
block level element (- though any text in that element seems to inherit the
text-indent OK).

This may explain the problem with floated elements preceeding the text, since
floats become 'display:block', or it might be yet another bug on top if this.

However, the testcase shows that the problem reported here, where text is
preceeded simply by an image, appears to have been fixed.
Depends on: 294306
Assignee: layout.block-and-inline → nobody
QA Contact: ian → layout.block-and-inline
This bug is still present (at least the part concerning :first-letter, I haven't tested text-indent). When an image or float is present, :first-letter isn't applied.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
I confirm the :first-letter bug on Firefox 4 b7
Mozilla/5.0 (Windows NT 5.1; rv:2.0b7) Gecko/20100101 Firefox/4.0b7
Confirmed the part regarding :first-letter on Mozilla/5.0 (Windows NT 5.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0

I only still see the first-letter issue in some cases in the attached test case. It does work the same on IE and Chrome though.
Keywords: helpwanted, qawanted
On this page: https://www.w3.org/wiki/CSS/Selectors/pseudo-elements/:first-letter

It says:
> The ::first-letter pseudo-element represents the first letter of an element,
> if it is not preceded by any other content (such >as images or inline tables) on its line.

So I guess we could see this behavior as "works as designed", and close this ticket?
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: