Bug 14395 - When a <p> is inside <li> two <BR>s are rendered
Summary: When a <p> is inside <li> two <BR>s are rendered
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 523.x (Safari 3)
Hardware: PC Windows XP
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-25 13:40 PDT by Sridhar Gurivireddy
Modified: 2007-07-13 04:53 PDT (History)
2 users (show)

See Also:


Attachments
<p> inside <li> (929 bytes, text/html)
2007-06-25 13:41 PDT, Sridhar Gurivireddy
no flags Details
Check if the inline really generates line boxes (4.06 KB, patch)
2007-06-26 12:37 PDT, mitz
no flags Details | Formatted Diff | Diff
Check if the inline really generates line boxes (78.97 KB, patch)
2007-06-30 07:01 PDT, mitz
hyatt: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sridhar Gurivireddy 2007-06-25 13:40:42 PDT
When a webpage has a <p> inside a list element, two breaks are rendered. The behaviour deviates from IE and Firefox, though might be conformant with standards.

Repro: Use the attached file to reproduce the bug
Comment 1 Sridhar Gurivireddy 2007-06-25 13:41:16 PDT
Created attachment 15233 [details]
<p> inside <li>
Comment 2 Dave Hyatt 2007-06-25 13:53:28 PDT
This is a bug (and a rather basic one at that).
Comment 3 mitz 2007-06-25 15:39:33 PDT
As Hyatt pointed out, the problem is that the marker gets put before the <a> instead of inside the <p>, because getParentOfFirstLineBox() thinks that the <a> is going to have a line box. I tried to fix it by changing

-        if (currChild->isInline())
+        if (currChild->isInline() && (currChild->firstChild() || !currChild->isInlineFlow()))

But the firstChild() check isn't right, for example if the child contains only skipped whitespace. I don't know how to tell if the child is going to generate lines.
Comment 4 mitz 2007-06-26 12:37:01 PDT
Created attachment 15255 [details]
Check if the inline really generates line boxes

This checks that the inline actually has some non-skipped content before placing the marker outside it. It makes two editing test fail:
editing/pasteboard/4861080.html - I don't know what it's supposed to test once this bug is fixed
editing/pasteboard/paste-4039777-fix.html - I don't understand the old results (they don't seem to be what's described or what I would expect)

It might be better not to call inlineChildGeneratesLineBoxes() in all cases except when curr is an anonymous block with continuation.
Comment 5 mitz 2007-06-30 07:01:44 PDT
Created attachment 15324 [details]
Check if the inline really generates line boxes

Also fixes the <ul><li><div><ul><li>foo</li></ul></div><br></li></ul> case, which was rendered completely wrong in quirks mode, making it match Firefox by not applying the quirk if the list is not a child of the list item.

As far as I can tell, the affected editing test was testing buggy conditions that no longer occur with this patch, but I did not want to remove it.
Comment 6 Dave Hyatt 2007-07-10 13:54:03 PDT
Comment on attachment 15324 [details]
Check if the inline really generates line boxes

r=me
Comment 7 Mark Rowe (bdash) 2007-07-13 04:53:51 PDT
Landed in r24255.