Closed Bug 223737 Opened 21 years ago Closed 19 years ago

{inc}display several extra newlines for <img>text<br clear="all">

Categories

(Core :: Layout: Floats, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: hsaito54, Assigned: roc)

References

Details

(Keywords: testcase)

Attachments

(6 files, 4 obsolete files)

Several extra newlines are displaied, if an attribute of the position of an IMG
is specified and the text includes tags of <br> and <br clear="all">.

This problem may be solved with the patch to append.
Attached file testcase
Attached patch patch (obsolete) — Splinter Review
Attached image screenshot
.
Assignee: table → float
Component: Layout: Tables → Layout: Floats
QA Contact: ian
Summary: display several extra newlines for <img>text<br clear="all"> → {inc}display several extra newlines for <img>text<br clear="all">
OS: Windows XP → All
Hardware: PC → All
I've tried the patch, seems to work fine for the testcase. 
Hideo, why don't you ask review for the patch?
Blocks: 291757
Keywords: testcase
Attached patch patch (obsolete) — Splinter Review
The testcase shows following two problems.
1. several extra newlines are displaied, if the window is narrow
2. 'bbbbbbbbbb' does not go back to the right side, if the window is wide

In order to mark the next line dirty, the changes make delay to clear the dirty
of the current line including BRFrame.
Attachment #134179 - Attachment is obsolete: true
Attachment #183645 - Flags: review?(roc)
+      if (NS_FRAME_IS_NOT_COMPLETE(frameReflowStatus) || aLine->IsDirty()) {

Won't aLine always be dirty, since we're currently reflowing it? So you might as
well just remove this 'if' condition. That seems OK to me.
Attachment #183645 - Attachment is obsolete: true
Attachment #183645 - Flags: review?(roc)
Attached patch patchSplinter Review
Attachment #185937 - Flags: superreview?(roc)
Attachment #185937 - Flags: review?(roc)
Attachment #185937 - Flags: superreview?(roc)
Attachment #185937 - Flags: superreview+
Attachment #185937 - Flags: review?(roc)
Attachment #185937 - Flags: review+
Comment on attachment 185937 [details] [diff] [review]
patch

I think that this patch is low-risk and floated lines split by <br> are done
the layout correctly.
Attachment #185937 - Flags: approval1.8b3?
Attachment #185937 - Flags: approval1.8b3? → approval1.8b3+
Whiteboard: [checkin needed]
roc, could you check in to the trunk?
masayuki, this patch was approved for 1.8b3. Could you check in to the trunk?
and please check Bug 291757.
Hardware: All → PC
Hardware: PC → All
checked in. Thanks Hideo!!!
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
I backed out this fix (with a=roc) because it caused severe performance issues
when typing at the beginning of a textarea with lots of text -- due to this
patch we reflowed every single line on every single keystroke...
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Whiteboard: [checkin needed]
I think that textarea frame does not have block frame. Should I give up this
approach?
Attachment #190116 - Flags: review?(bzbarsky)
Comment on attachment 190116 [details] [diff] [review]
patch for skip to reflow lines of a textarea

> I think that textarea frame does not have block frame.

It sure does.  In any case, textarea is not the only case this patch made way
too slow; just the most obvious one.

Also, you may want to request reviews from roc; he knows this code much better
than I do...
Attachment #190116 - Flags: review?(bzbarsky) → review-
Assignee: layout.floats → saito
Status: REOPENED → NEW
Roc:

Do you have better idea?
Mozilla Japan hopes that this bug should be fixed before Firefox 1.5.
Because bug 291757 is reproduced on "Amazon.co.jp" that is major site in Japan.
In order to skip to reflow lines of a text control frame, a bit of
NS_FRAME_INDEPENDENT_SELECTION is checked.
Attachment #190116 - Attachment is obsolete: true
Attachment #190229 - Flags: superreview?(roc)
Attachment #190229 - Flags: review?(roc)
I don't think that's right. There is no logical connection between frames having
independent selection and incremental reflow of lines with BRs.

There must be a fix that fixes the actual bug here and doesn't force us to
reflow every line with a BR before it.
Attachment #190229 - Flags: superreview?(roc)
Attachment #190229 - Flags: superreview-
Attachment #190229 - Flags: review?(roc)
Attachment #190229 - Flags: review-
(In reply to comment #19)
> I don't think that's right. There is no logical connection between frames having
> independent selection and incremental reflow of lines with BRs.

A mState bit of NS_FRAME_INDEPENDENT_SELECTIONA is set for text control frame at
nsTextControlFrame::CreateAnonymousContent and SELECTION_ON is also set for
selection controller. I think that these conditions are distinguishable from
other selected frames as follows changes. Is this idea wrong?

+      PRBool needsDirty = NS_FRAME_IS_NOT_COMPLETE(frameReflowStatus);
+      if (!needsDirty) {
+        needsDirty = PR_TRUE;
+        if (aFrame->GetStateBits() & NS_FRAME_INDEPENDENT_SELECTION) {
+          nsCOMPtr<nsISelectionController> selCon;
+          rv = GetSelectionController(aState.mPresContext, getter_AddRefs(selCon));
+          //get the selection controller
+          if (NS_SUCCEEDED(rv) && selCon) 
+          {
+            PRInt16 displayresult;
+            selCon->GetDisplaySelection(&displayresult);
+            if (displayresult == nsISelectionController::SELECTION_ON)
+              needsDirty = PR_FALSE;
+          }
+        }
+      }
+      if (needsDirty) {
+        nsLineList_iterator next = aLine.next();
+        if (next != end_lines() && !next->IsBlock()) {
+          next->MarkDirty();
+        }
There is nothing special about text frames that should require them to be
reflowed differently from normal.
The newlines in the testcase are correct, by the way. align="left" floats the
image to the left, and <br clear="all"> forces that line break to happen below
the float.
http://www.w3.org/TR/1998/REC-html40-19980424/present/graphics.html#floating

The only bug is that the line bbbbbbbbb doesn't correctly move back up when the
window gets wider.
Attached file simplified testcase
This simplifies the testcase a bit more.
Attached patch fixSplinter Review
The basic problem is that with a narrow width, resize reflow decides it is not
necessary to reflow line bbbbbbb because it is not "impacted by a float". It's
not impacted by a float because we've moved it below the float. Really we
should say it is impacted by float because we tried to reflow it at least once
next to a float. This patch does that.
Assignee: saito → roc
Status: NEW → ASSIGNED
Attachment #190374 - Flags: superreview?(dbaron)
Attachment #190374 - Flags: review?(dbaron)
The patch does not fix bug 291757. That bug shows another issue which I will fix
there.
Attached patch test patch (obsolete) — Splinter Review
This patch fixes this bug and bug 291757.
I think that we are not marking to dirty the next line after clearance when it
is necessary.
But I don't know when we should marking to dirty it.
Comment on attachment 190374 [details] [diff] [review]
fix

r+sr=dbaron
Attachment #190374 - Flags: superreview?(dbaron)
Attachment #190374 - Flags: superreview+
Attachment #190374 - Flags: review?(dbaron)
Attachment #190374 - Flags: review+
Comment on attachment 190374 [details] [diff] [review]
fix

Fixes one problem with amazon.co.jp
Attachment #190374 - Flags: approval1.8b4?
Comment on attachment 190429 [details] [diff] [review]
test patch

This is basically the same as Hideo's original patch, which caused some
performance problems.
Attachment #190429 - Attachment is obsolete: true
Comment on attachment 190374 [details] [diff] [review]
fix

BTW this patch is very low risk because it just does a bit of extra dirtying,
so it should only be able to cause performance problems if any.
Attachment #190374 - Flags: approval1.8b4? → approval1.8b4+
checked in
Status: ASSIGNED → RESOLVED
Closed: 19 years ago19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: