From e109f40aa7c008ee4878b9bfd00dad636dffbfd4 Mon Sep 17 00:00:00 2001 From: "jfrancis%netscape.com" Date: Tue, 2 Nov 1999 21:35:21 +0000 Subject: [PATCH] changed bogus node type to br to get rid of annoying space in empty editors; r=kin git-svn-id: svn://10.0.0.236/trunk@52583 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/editor/base/nsTextEditRules.cpp | 26 +++---------------- .../editor/libeditor/text/nsTextEditRules.cpp | 26 +++---------------- 2 files changed, 8 insertions(+), 44 deletions(-) diff --git a/mozilla/editor/base/nsTextEditRules.cpp b/mozilla/editor/base/nsTextEditRules.cpp index 6467866e13f..17b517ce887 100644 --- a/mozilla/editor/base/nsTextEditRules.cpp +++ b/mozilla/editor/base/nsTextEditRules.cpp @@ -1052,31 +1052,13 @@ nsTextEditRules::CreateBogusNodeIfNeeded(nsIDOMSelection *aSelection) } if (PR_TRUE==needsBogusContent) { - // set mBogusNode to be the newly created
- res = mEditor->CreateNode(nsAutoString("div"), bodyNode, 0, + // set mBogusNode to be the newly created
+ res = mEditor->CreateNode(nsAutoString("br"), bodyNode, 0, getter_AddRefs(mBogusNode)); - if (NS_FAILED(res)) return res; - if (!mBogusNode) return NS_ERROR_NULL_POINTER; - - nsCOMPtrnewTNode; - nsAutoString textNodeTag; - res = nsEditor::GetTextNodeTag(textNodeTag); - if (NS_FAILED(res)) { return res; } - res = mEditor->CreateNode(textNodeTag, mBogusNode, 0, - getter_AddRefs(newTNode)); if (NS_FAILED(res)) return res; - if (!newTNode) return NS_ERROR_NULL_POINTER; + if (!mBogusNode) return NS_ERROR_NULL_POINTER; - nsCOMPtrnewNodeAsText; - newNodeAsText = do_QueryInterface(newTNode); - if (newNodeAsText) - { - nsAutoString data; - data += 160; - newNodeAsText->SetData(data); - aSelection->Collapse(newTNode, 0); - } - // make sure we know the PNode is bogus + // give it a special attribute nsCOMPtrnewPElement; newPElement = do_QueryInterface(mBogusNode); if (newPElement) diff --git a/mozilla/editor/libeditor/text/nsTextEditRules.cpp b/mozilla/editor/libeditor/text/nsTextEditRules.cpp index 6467866e13f..17b517ce887 100644 --- a/mozilla/editor/libeditor/text/nsTextEditRules.cpp +++ b/mozilla/editor/libeditor/text/nsTextEditRules.cpp @@ -1052,31 +1052,13 @@ nsTextEditRules::CreateBogusNodeIfNeeded(nsIDOMSelection *aSelection) } if (PR_TRUE==needsBogusContent) { - // set mBogusNode to be the newly created
- res = mEditor->CreateNode(nsAutoString("div"), bodyNode, 0, + // set mBogusNode to be the newly created
+ res = mEditor->CreateNode(nsAutoString("br"), bodyNode, 0, getter_AddRefs(mBogusNode)); - if (NS_FAILED(res)) return res; - if (!mBogusNode) return NS_ERROR_NULL_POINTER; - - nsCOMPtrnewTNode; - nsAutoString textNodeTag; - res = nsEditor::GetTextNodeTag(textNodeTag); - if (NS_FAILED(res)) { return res; } - res = mEditor->CreateNode(textNodeTag, mBogusNode, 0, - getter_AddRefs(newTNode)); if (NS_FAILED(res)) return res; - if (!newTNode) return NS_ERROR_NULL_POINTER; + if (!mBogusNode) return NS_ERROR_NULL_POINTER; - nsCOMPtrnewNodeAsText; - newNodeAsText = do_QueryInterface(newTNode); - if (newNodeAsText) - { - nsAutoString data; - data += 160; - newNodeAsText->SetData(data); - aSelection->Collapse(newTNode, 0); - } - // make sure we know the PNode is bogus + // give it a special attribute nsCOMPtrnewPElement; newPElement = do_QueryInterface(mBogusNode); if (newPElement)