Closed Bug 187662 Opened 22 years ago Closed 22 years ago

unable to insert <br> in an empty document at the first time

Categories

(Core :: DOM: Editor, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: yuanyi21, Assigned: mozeditor)

Details

(Keywords: regression, topembed, Whiteboard: EDITORBASE+, fixinhand)

Attachments

(1 file)

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3b) Gecko/20030103

steps:
1. open composer;
2. press <Enter>.

result:
nothing happen. press <Enter> again will insert <br> correctly.
brade, kin, any idea?
I think the changes for bug 174017 may have caused this regression.

When I hit return, the bogus br node is removed, so we have a selection that is
inside an empty body. The changes made for 174017 in
|nsHTMLEditRules::StandardBreakImpl()| then cause  both |bAfterBlock| and
|bBeforeBlock| to be set to  true so we never add the needed 2nd br.

jfrancis, for both ws calls the node passed in is the body, and the returned
visNode is also the body. Perhaps we need to special case for that situation?
Keywords: regression
Whiteboard: EDITORBASE
when inserting a break, check for an empty block after doing any deletion and
bogus node removal.  If block is empty populate it with a br before continueing
on with break insertion code.
Attachment #110976 - Flags: superreview?(kin)
Attachment #110976 - Flags: review?(brade)
Whiteboard: EDITORBASE → EDITORBASE, fixinhand
Target Milestone: --- → M1
Comment on attachment 110976 [details] [diff] [review]
patch to nsHTMLEditRules.cpp

in this block in nsHTMLEditRules.cpp (around line 1515):
+  if (isEmpty)
+  {
+    nsCOMPtr<nsIDOMNode> brNode;
+    PRUint32 blockLen;
+    res = mHTMLEditor->GetLengthOfDOMNode(blockParent, blockLen);

move the nsCOMPtr declaration down until after you call GetLengthOfDOMNode

r=brade with that
Attachment #110976 - Flags: review?(brade) → review+
Comment on attachment 110976 [details] [diff] [review]
patch to nsHTMLEditRules.cpp

sr=kin@netscape.com
Attachment #110976 - Flags: superreview?(kin) → superreview+
EDITORBASE+, nsbeta1+
Keywords: nsbeta1+
Whiteboard: EDITORBASE, fixinhand → EDITORBASE+, fixinhand
Composer triage team: nominating for topembed (nsbeta1 is used for composer
application defects).
Component: Editor: Composer → Editor: Core
Keywords: nsbeta1+topembed
This was checked in on tip a week ago.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
QA Contact: sujay → sairuh
vrfy'd fixed on all platforms with recent trunk bits.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: