shuffled around the responsibilities of core editing objects.

The key listener is now mostly a mapper of key events to editor actions.  Soon, this should be 100% true.
The editor builds transactions that are themselves intelligent. The editor makes very few DOM calls itself.
It relies on the transactions to do most of the actual editing.


git-svn-id: svn://10.0.0.236/trunk@17518 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
buster%netscape.com
1999-01-11 22:47:23 +00:00
parent 19f97e42a1
commit 8a19fb26be
24 changed files with 470 additions and 472 deletions

View File

@@ -18,6 +18,7 @@
#include "ChangeAttributeTxn.h"
#include "editor.h"
#include "nsIDOMElement.h"
// note that aEditor is not refcounted
ChangeAttributeTxn::ChangeAttributeTxn(nsEditor *aEditor,
@@ -54,9 +55,9 @@ nsresult ChangeAttributeTxn::Do(void)
// now set the attribute to the new value
if (PR_FALSE==mRemoveAttribute)
result = mEditor->SetAttribute(mElement, mAttribute, mValue);
result = mElement->SetDOMAttribute(mAttribute, mValue);
else
result = mEditor->RemoveAttribute(mElement, mAttribute);
result = mElement->RemoveAttribute(mAttribute);
return result;
}
@@ -65,13 +66,9 @@ nsresult ChangeAttributeTxn::Undo(void)
{
nsresult result=NS_OK;
if (PR_TRUE==mAttributeWasSet)
{
result = mEditor->SetAttribute(mElement, mAttribute, mUndoValue);
}
result = mElement->SetDOMAttribute(mAttribute, mUndoValue);
else
{
result = mEditor->RemoveAttribute(mElement, mAttribute);
}
result = mElement->RemoveAttribute(mAttribute);
return result;
}
@@ -81,9 +78,9 @@ nsresult ChangeAttributeTxn::Redo(void)
nsresult result;
if (PR_FALSE==mRemoveAttribute)
result = mEditor->SetAttribute(mElement, mAttribute, mValue);
result = mElement->SetDOMAttribute(mAttribute, mValue);
else
result = mEditor->RemoveAttribute(mElement, mAttribute);
result = mElement->RemoveAttribute(mAttribute);
return result;
}