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

VERIFIED FIXED in M1

Status

()

Core
Editor
VERIFIED FIXED
15 years ago
15 years ago

People

(Reporter: Kyle Yuan, Assigned: Joe Francis)

Tracking

({regression, topembed})

Trunk
regression, topembed
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: EDITORBASE+, fixinhand)

Attachments

(1 attachment)

(Reporter)

Description

15 years ago
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.
(Reporter)

Comment 1

15 years ago
brade, kin, any idea?

Comment 2

15 years ago
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
(Assignee)

Comment 3

15 years ago
Created attachment 110976 [details] [diff] [review]
patch to nsHTMLEditRules.cpp

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.
(Assignee)

Updated

15 years ago
Attachment #110976 - Flags: superreview?(kin)
Attachment #110976 - Flags: review?(brade)
(Assignee)

Updated

15 years ago
Whiteboard: EDITORBASE → EDITORBASE, fixinhand
Target Milestone: --- → M1

Comment 4

15 years ago
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 5

15 years ago
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

Comment 7

15 years ago
Composer triage team: nominating for topembed (nsbeta1 is used for composer
application defects).
Component: Editor: Composer → Editor: Core
Keywords: nsbeta1+ → topembed
(Assignee)

Comment 8

15 years ago
This was checked in on tip a week ago.
Status: NEW → RESOLVED
Last Resolved: 15 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.