зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1169139 Remove all trailing whitespaces in editor (IGNORE IDL) r=ehsan
This commit is contained in:
Родитель
47df1bbfe3
Коммит
274f4c6cb1
|
@ -24,7 +24,7 @@ public:
|
|||
// nsISupports interface...
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsITextServicesFilter
|
||||
// nsITextServicesFilter
|
||||
NS_DECL_NSITEXTSERVICESFILTER
|
||||
|
||||
// Helper - Intializer
|
||||
|
@ -39,12 +39,12 @@ private:
|
|||
#define NS_COMPOSERTXTSRVFILTER_CID \
|
||||
{/* {171E72DB-0F8A-412a-8461-E4C927A3A2AC}*/ \
|
||||
0x171e72db, 0xf8a, 0x412a, \
|
||||
{ 0x84, 0x61, 0xe4, 0xc9, 0x27, 0xa3, 0xa2, 0xac} }
|
||||
{ 0x84, 0x61, 0xe4, 0xc9, 0x27, 0xa3, 0xa2, 0xac} }
|
||||
|
||||
#define NS_COMPOSERTXTSRVFILTERMAIL_CID \
|
||||
{/* {7FBD2146-5FF4-4674-B069-A7BBCE66E773}*/ \
|
||||
0x7fbd2146, 0x5ff4, 0x4674, \
|
||||
{ 0xb0, 0x69, 0xa7, 0xbb, 0xce, 0x66, 0xe7, 0x73} }
|
||||
{ 0xb0, 0x69, 0xa7, 0xbb, 0xce, 0x66, 0xe7, 0x73} }
|
||||
|
||||
// Generic for the editor
|
||||
#define COMPOSER_TXTSRVFILTER_CONTRACTID "@mozilla.org/editor/txtsrvfilter;1"
|
||||
|
|
|
@ -101,7 +101,7 @@ nsBaseStateUpdatingCommand::DoCommandParams(const char *aCommandName,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBaseStateUpdatingCommand::GetCommandStateParams(const char *aCommandName,
|
||||
nsBaseStateUpdatingCommand::GetCommandStateParams(const char *aCommandName,
|
||||
nsICommandParams *aParams,
|
||||
nsISupports *refCon)
|
||||
{
|
||||
|
@ -113,15 +113,15 @@ nsBaseStateUpdatingCommand::GetCommandStateParams(const char *aCommandName,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPasteNoFormattingCommand::IsCommandEnabled(const char * aCommandName,
|
||||
nsISupports *refCon,
|
||||
nsPasteNoFormattingCommand::IsCommandEnabled(const char * aCommandName,
|
||||
nsISupports *refCon,
|
||||
bool *outCmdEnabled)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(outCmdEnabled);
|
||||
*outCmdEnabled = false;
|
||||
|
||||
// This command is only implemented by nsIHTMLEditor, since
|
||||
// pasting in a plaintext editor automatically only supplies
|
||||
// pasting in a plaintext editor automatically only supplies
|
||||
// "unformatted" text
|
||||
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(refCon);
|
||||
NS_ENSURE_TRUE(htmlEditor, NS_ERROR_NOT_IMPLEMENTED);
|
||||
|
@ -145,7 +145,7 @@ nsPasteNoFormattingCommand::DoCommand(const char *aCommandName,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsPasteNoFormattingCommand::DoCommandParams(const char *aCommandName,
|
||||
nsICommandParams *aParams,
|
||||
nsICommandParams *aParams,
|
||||
nsISupports *refCon)
|
||||
{
|
||||
return DoCommand(aCommandName, refCon);
|
||||
|
@ -171,13 +171,13 @@ nsStyleUpdatingCommand::nsStyleUpdatingCommand(nsIAtom* aTagName)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsStyleUpdatingCommand::GetCurrentState(nsIEditor *aEditor,
|
||||
nsStyleUpdatingCommand::GetCurrentState(nsIEditor *aEditor,
|
||||
nsICommandParams *aParams)
|
||||
{
|
||||
NS_ASSERTION(aEditor, "Need editor here");
|
||||
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(aEditor);
|
||||
NS_ENSURE_TRUE(htmlEditor, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
|
||||
bool firstOfSelectionHasProp = false;
|
||||
bool anyOfSelectionHasProp = false;
|
||||
bool allOfSelectionHasProp = false;
|
||||
|
@ -211,7 +211,7 @@ nsStyleUpdatingCommand::ToggleState(nsIEditor *aEditor)
|
|||
if (NS_FAILED(rv) || !params)
|
||||
return rv;
|
||||
|
||||
// tags "href" and "name" are special cases in the core editor
|
||||
// tags "href" and "name" are special cases in the core editor
|
||||
// they are used to remove named anchor/link and shouldn't be used for insertion
|
||||
bool doTagRemoval;
|
||||
if (mTagName == nsGkAtoms::href || mTagName == nsGkAtoms::name) {
|
||||
|
@ -300,11 +300,11 @@ nsListCommand::ToggleState(nsIEditor *aEditor)
|
|||
|
||||
nsDependentAtomString listType(mTagName);
|
||||
if (inList) {
|
||||
rv = editor->RemoveList(listType);
|
||||
rv = editor->RemoveList(listType);
|
||||
} else {
|
||||
rv = editor->MakeOrChangeList(listType, false, EmptyString());
|
||||
}
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -362,13 +362,13 @@ nsListItemCommand::ToggleState(nsIEditor *aEditor)
|
|||
rv = params->GetBooleanValue(STATE_ALL,&inList);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
if (inList) {
|
||||
// To remove a list, first get what kind of list we're in
|
||||
bool bMixed;
|
||||
nsAutoString localName;
|
||||
rv = GetListState(htmlEditor, &bMixed, localName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (localName.IsEmpty() || bMixed) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -424,11 +424,11 @@ nsRemoveListCommand::DoCommand(const char *aCommandName, nsISupports *refCon)
|
|||
rv = editor->RemoveList(EmptyString());
|
||||
}
|
||||
|
||||
return rv;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRemoveListCommand::DoCommandParams(const char *aCommandName,
|
||||
nsRemoveListCommand::DoCommandParams(const char *aCommandName,
|
||||
nsICommandParams *aParams,
|
||||
nsISupports *refCon)
|
||||
{
|
||||
|
@ -437,7 +437,7 @@ nsRemoveListCommand::DoCommandParams(const char *aCommandName,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsRemoveListCommand::GetCommandStateParams(const char *aCommandName,
|
||||
nsICommandParams *aParams,
|
||||
nsICommandParams *aParams,
|
||||
nsISupports *refCon)
|
||||
{
|
||||
bool outCmdEnabled = false;
|
||||
|
@ -468,8 +468,8 @@ nsIndentCommand::DoCommand(const char *aCommandName, nsISupports *refCon)
|
|||
{
|
||||
rv = editor->Indent(NS_LITERAL_STRING("indent"));
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -477,7 +477,7 @@ nsIndentCommand::DoCommandParams(const char *aCommandName,
|
|||
nsICommandParams *aParams,
|
||||
nsISupports *refCon)
|
||||
{
|
||||
return DoCommand(aCommandName, refCon);
|
||||
return DoCommand(aCommandName, refCon);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -516,16 +516,16 @@ nsOutdentCommand::DoCommand(const char *aCommandName, nsISupports *refCon)
|
|||
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(refCon);
|
||||
if (htmlEditor)
|
||||
return htmlEditor->Indent(NS_LITERAL_STRING("outdent"));
|
||||
|
||||
return NS_OK;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOutdentCommand::DoCommandParams(const char *aCommandName,
|
||||
nsICommandParams *aParams,
|
||||
nsICommandParams *aParams,
|
||||
nsISupports *refCon)
|
||||
{
|
||||
return DoCommand(aCommandName, refCon);
|
||||
return DoCommand(aCommandName, refCon);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -560,7 +560,7 @@ nsMultiStateCommand::IsCommandEnabled(const char * aCommandName,
|
|||
return editor->GetIsSelectionEditable(outCmdEnabled);
|
||||
|
||||
*outCmdEnabled = false;
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -571,8 +571,8 @@ nsMultiStateCommand::DoCommand(const char *aCommandName, nsISupports *refCon)
|
|||
printf("who is calling nsMultiStateCommand::DoCommand \
|
||||
(no implementation)? %s\n", aCommandName);
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -598,8 +598,8 @@ nsMultiStateCommand::DoCommandParams(const char *aCommandName,
|
|||
|
||||
rv = SetState(editor, tString);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -626,7 +626,7 @@ nsParagraphStateCommand::GetCurrentState(nsIEditor *aEditor,
|
|||
nsICommandParams *aParams)
|
||||
{
|
||||
NS_ASSERTION(aEditor, "Need an editor here");
|
||||
|
||||
|
||||
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(aEditor);
|
||||
NS_ENSURE_TRUE(htmlEditor, NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -685,7 +685,7 @@ nsFontFaceStateCommand::SetState(nsIEditor *aEditor, nsString& newState)
|
|||
NS_ASSERTION(aEditor, "Need an editor here");
|
||||
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(aEditor);
|
||||
NS_ENSURE_TRUE(htmlEditor, NS_ERROR_FAILURE);
|
||||
|
||||
|
||||
if (newState.EqualsLiteral("tt")) {
|
||||
// The old "teletype" attribute
|
||||
nsresult rv = htmlEditor->SetInlineProperty(nsGkAtoms::tt, EmptyString(),
|
||||
|
@ -788,7 +788,7 @@ nsFontColorStateCommand::GetCurrentState(nsIEditor *aEditor,
|
|||
nsICommandParams *aParams)
|
||||
{
|
||||
NS_ASSERTION(aEditor, "Need an editor here");
|
||||
|
||||
|
||||
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(aEditor);
|
||||
NS_ENSURE_TRUE(htmlEditor, NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -810,12 +810,12 @@ nsFontColorStateCommand::SetState(nsIEditor *aEditor, nsString& newState)
|
|||
NS_ASSERTION(aEditor, "Need an editor here");
|
||||
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(aEditor);
|
||||
NS_ENSURE_TRUE(htmlEditor, NS_ERROR_FAILURE);
|
||||
|
||||
|
||||
if (newState.IsEmpty() || newState.EqualsLiteral("normal")) {
|
||||
return htmlEditor->RemoveInlineProperty(nsGkAtoms::font,
|
||||
NS_LITERAL_STRING("color"));
|
||||
}
|
||||
|
||||
|
||||
return htmlEditor->SetInlineProperty(nsGkAtoms::font,
|
||||
NS_LITERAL_STRING("color"), newState);
|
||||
}
|
||||
|
@ -886,7 +886,7 @@ nsBackgroundColorStateCommand::GetCurrentState(nsIEditor *aEditor,
|
|||
nsICommandParams *aParams)
|
||||
{
|
||||
NS_ASSERTION(aEditor, "Need an editor here");
|
||||
|
||||
|
||||
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(aEditor);
|
||||
NS_ENSURE_TRUE(htmlEditor, NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -906,7 +906,7 @@ nsresult
|
|||
nsBackgroundColorStateCommand::SetState(nsIEditor *aEditor, nsString& newState)
|
||||
{
|
||||
NS_ASSERTION(aEditor, "Need an editor here");
|
||||
|
||||
|
||||
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(aEditor);
|
||||
NS_ENSURE_TRUE(htmlEditor, NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -922,16 +922,16 @@ nsresult
|
|||
nsAlignCommand::GetCurrentState(nsIEditor *aEditor, nsICommandParams *aParams)
|
||||
{
|
||||
NS_ASSERTION(aEditor, "Need an editor here");
|
||||
|
||||
|
||||
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(aEditor);
|
||||
NS_ENSURE_TRUE(htmlEditor, NS_ERROR_FAILURE);
|
||||
|
||||
|
||||
nsIHTMLEditor::EAlignment firstAlign;
|
||||
bool outMixed;
|
||||
nsresult rv = htmlEditor->GetAlignment(&outMixed, &firstAlign);
|
||||
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
nsAutoString outStateString;
|
||||
switch (firstAlign)
|
||||
{
|
||||
|
@ -939,11 +939,11 @@ nsAlignCommand::GetCurrentState(nsIEditor *aEditor, nsICommandParams *aParams)
|
|||
case nsIHTMLEditor::eLeft:
|
||||
outStateString.AssignLiteral("left");
|
||||
break;
|
||||
|
||||
|
||||
case nsIHTMLEditor::eCenter:
|
||||
outStateString.AssignLiteral("center");
|
||||
break;
|
||||
|
||||
|
||||
case nsIHTMLEditor::eRight:
|
||||
outStateString.AssignLiteral("right");
|
||||
break;
|
||||
|
@ -963,7 +963,7 @@ nsresult
|
|||
nsAlignCommand::SetState(nsIEditor *aEditor, nsString& newState)
|
||||
{
|
||||
NS_ASSERTION(aEditor, "Need an editor here");
|
||||
|
||||
|
||||
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(aEditor);
|
||||
NS_ENSURE_TRUE(htmlEditor, NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -999,7 +999,7 @@ nsresult
|
|||
nsAbsolutePositioningCommand::GetCurrentState(nsIEditor *aEditor, nsICommandParams *aParams)
|
||||
{
|
||||
NS_ASSERTION(aEditor, "Need an editor here");
|
||||
|
||||
|
||||
nsCOMPtr<nsIHTMLAbsPosEditor> htmlEditor = do_QueryInterface(aEditor);
|
||||
NS_ENSURE_TRUE(htmlEditor, NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -1028,7 +1028,7 @@ nsresult
|
|||
nsAbsolutePositioningCommand::ToggleState(nsIEditor *aEditor)
|
||||
{
|
||||
NS_ASSERTION(aEditor, "Need an editor here");
|
||||
|
||||
|
||||
nsCOMPtr<nsIHTMLAbsPosEditor> htmlEditor = do_QueryInterface(aEditor);
|
||||
NS_ENSURE_TRUE(htmlEditor, NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -1077,7 +1077,7 @@ nsDecreaseZIndexCommand::DoCommand(const char *aCommandName,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsDecreaseZIndexCommand::DoCommandParams(const char *aCommandName,
|
||||
nsICommandParams *aParams,
|
||||
nsICommandParams *aParams,
|
||||
nsISupports *refCon)
|
||||
{
|
||||
return DoCommand(aCommandName, refCon);
|
||||
|
@ -1127,7 +1127,7 @@ nsIncreaseZIndexCommand::DoCommand(const char *aCommandName,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsIncreaseZIndexCommand::DoCommandParams(const char *aCommandName,
|
||||
nsICommandParams *aParams,
|
||||
nsICommandParams *aParams,
|
||||
nsISupports *refCon)
|
||||
{
|
||||
return DoCommand(aCommandName, refCon);
|
||||
|
@ -1175,8 +1175,8 @@ nsRemoveStylesCommand::DoCommand(const char *aCommandName,
|
|||
{
|
||||
rv = editor->RemoveAllInlineProperties();
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1223,8 +1223,8 @@ nsIncreaseFontSizeCommand::DoCommand(const char *aCommandName,
|
|||
{
|
||||
rv = editor->IncreaseFontSize();
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1271,8 +1271,8 @@ nsDecreaseFontSizeCommand::DoCommand(const char *aCommandName,
|
|||
{
|
||||
rv = editor->DecreaseFontSize();
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1382,7 +1382,7 @@ nsInsertTagCommand::IsCommandEnabled(const char * aCommandName,
|
|||
}
|
||||
|
||||
|
||||
// corresponding STATE_ATTRIBUTE is: src (img) and href (a)
|
||||
// corresponding STATE_ATTRIBUTE is: src (img) and href (a)
|
||||
NS_IMETHODIMP
|
||||
nsInsertTagCommand::DoCommand(const char *aCmdName, nsISupports *refCon)
|
||||
{
|
||||
|
@ -1518,7 +1518,7 @@ RemoveTextProperty(nsIHTMLEditor* aEditor, const nsAString& aProp)
|
|||
if (aProp.LowerCaseEqualsLiteral("all")) {
|
||||
return aEditor->RemoveAllInlineProperties();
|
||||
}
|
||||
|
||||
|
||||
return RemoveOneProperty(aEditor, aProp);
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ protected:
|
|||
|
||||
// get the current state (on or off) for this style or block format
|
||||
virtual nsresult GetCurrentState(nsIEditor* aEditor, nsICommandParams* aParams) = 0;
|
||||
|
||||
|
||||
// add/remove the style
|
||||
virtual nsresult ToggleState(nsIEditor* aEditor) = 0;
|
||||
|
||||
|
@ -81,12 +81,12 @@ class nsStyleUpdatingCommand : public nsBaseStateUpdatingCommand
|
|||
{
|
||||
public:
|
||||
explicit nsStyleUpdatingCommand(nsIAtom* aTagName);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// get the current state (on or off) for this style or block format
|
||||
virtual nsresult GetCurrentState(nsIEditor* aEditor, nsICommandParams* aParams);
|
||||
|
||||
|
||||
// add/remove the style
|
||||
virtual nsresult ToggleState(nsIEditor* aEditor);
|
||||
};
|
||||
|
@ -96,7 +96,7 @@ class nsInsertTagCommand : public nsBaseComposerCommand
|
|||
{
|
||||
public:
|
||||
explicit nsInsertTagCommand(nsIAtom* aTagName);
|
||||
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
NS_DECL_NSICONTROLLERCOMMAND
|
||||
|
@ -117,7 +117,7 @@ protected:
|
|||
|
||||
// get the current state (on or off) for this style or block format
|
||||
virtual nsresult GetCurrentState(nsIEditor* aEditor, nsICommandParams* aParams);
|
||||
|
||||
|
||||
// add/remove the style
|
||||
virtual nsresult ToggleState(nsIEditor* aEditor);
|
||||
};
|
||||
|
@ -131,7 +131,7 @@ protected:
|
|||
|
||||
// get the current state (on or off) for this style or block format
|
||||
virtual nsresult GetCurrentState(nsIEditor* aEditor, nsICommandParams* aParams);
|
||||
|
||||
|
||||
// add/remove the style
|
||||
virtual nsresult ToggleState(nsIEditor* aEditor);
|
||||
};
|
||||
|
@ -140,9 +140,9 @@ protected:
|
|||
class nsMultiStateCommand : public nsBaseComposerCommand
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
nsMultiStateCommand();
|
||||
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSICONTROLLERCOMMAND
|
||||
|
||||
|
@ -151,7 +151,7 @@ protected:
|
|||
|
||||
virtual nsresult GetCurrentState(nsIEditor *aEditor, nsICommandParams* aParams) =0;
|
||||
virtual nsresult SetState(nsIEditor *aEditor, nsString& newState) = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ nsComposerCommandsUpdater::NotifyDocumentWillBeDestroyed()
|
|||
mUpdateTimer->Cancel();
|
||||
mUpdateTimer = nullptr;
|
||||
}
|
||||
|
||||
|
||||
// We can't call this right now; it is too late in some cases and the window
|
||||
// is already partially destructed (e.g. JS objects may be gone).
|
||||
#if 0
|
||||
|
@ -114,11 +114,11 @@ nsComposerCommandsUpdater::DidDo(nsITransactionManager *aManager,
|
|||
UpdateCommandGroup(NS_LITERAL_STRING("undo"));
|
||||
mFirstDoOfFirstUndo = false;
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsComposerCommandsUpdater::WillUndo(nsITransactionManager *aManager,
|
||||
nsITransaction *aTransaction,
|
||||
bool *aInterrupt)
|
||||
|
@ -151,7 +151,7 @@ nsComposerCommandsUpdater::WillRedo(nsITransactionManager *aManager,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComposerCommandsUpdater::DidRedo(nsITransactionManager *aManager,
|
||||
nsComposerCommandsUpdater::DidRedo(nsITransactionManager *aManager,
|
||||
nsITransaction *aTransaction,
|
||||
nsresult aRedoResult)
|
||||
{
|
||||
|
@ -183,7 +183,7 @@ nsComposerCommandsUpdater::WillEndBatch(nsITransactionManager *aManager,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComposerCommandsUpdater::DidEndBatch(nsITransactionManager *aManager,
|
||||
nsComposerCommandsUpdater::DidEndBatch(nsITransactionManager *aManager,
|
||||
nsresult aResult)
|
||||
{
|
||||
return NS_OK;
|
||||
|
@ -277,7 +277,7 @@ nsComposerCommandsUpdater::UpdateCommandGroup(const nsAString& aCommandGroup)
|
|||
nsCOMPtr<nsPICommandUpdater> commandUpdater = GetCommandUpdater();
|
||||
NS_ENSURE_TRUE(commandUpdater, NS_ERROR_FAILURE);
|
||||
|
||||
|
||||
|
||||
// This hardcoded list of commands is temporary.
|
||||
// This code should use nsIControllerCommandGroup.
|
||||
if (aCommandGroup.EqualsLiteral("undo"))
|
||||
|
@ -306,7 +306,7 @@ nsComposerCommandsUpdater::UpdateCommandGroup(const nsAString& aCommandGroup)
|
|||
commandUpdater->CommandStatusChanged("cmd_code");
|
||||
commandUpdater->CommandStatusChanged("cmd_samp");
|
||||
commandUpdater->CommandStatusChanged("cmd_var");
|
||||
|
||||
|
||||
commandUpdater->CommandStatusChanged("cmd_increaseFont");
|
||||
commandUpdater->CommandStatusChanged("cmd_decreaseFont");
|
||||
|
||||
|
@ -315,14 +315,14 @@ nsComposerCommandsUpdater::UpdateCommandGroup(const nsAString& aCommandGroup)
|
|||
commandUpdater->CommandStatusChanged("cmd_fontColor");
|
||||
commandUpdater->CommandStatusChanged("cmd_backgroundColor");
|
||||
commandUpdater->CommandStatusChanged("cmd_highlight");
|
||||
}
|
||||
}
|
||||
else if (aCommandGroup.EqualsLiteral("save"))
|
||||
{
|
||||
// save commands (most are not in C++)
|
||||
commandUpdater->CommandStatusChanged("cmd_setDocumentModified");
|
||||
commandUpdater->CommandStatusChanged("cmd_save");
|
||||
}
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -333,7 +333,7 @@ nsComposerCommandsUpdater::UpdateOneCommand(const char *aCommand)
|
|||
|
||||
commandUpdater->CommandStatusChanged(aCommand);
|
||||
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -35,10 +35,10 @@ public:
|
|||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
||||
// nsISelectionListener
|
||||
NS_DECL_NSISELECTIONLISTENER
|
||||
|
||||
|
||||
// nsIDocumentStateListener
|
||||
NS_DECL_NSIDOCUMENTSTATELISTENER
|
||||
|
||||
|
@ -46,7 +46,7 @@ public:
|
|||
NS_DECL_NSITIMERCALLBACK
|
||||
|
||||
/** nsITransactionListener interfaces
|
||||
*/
|
||||
*/
|
||||
NS_IMETHOD WillDo(nsITransactionManager *aManager, nsITransaction *aTransaction, bool *aInterrupt) override;
|
||||
NS_IMETHOD DidDo(nsITransactionManager *aManager, nsITransaction *aTransaction, nsresult aDoResult) override;
|
||||
NS_IMETHOD WillUndo(nsITransactionManager *aManager, nsITransaction *aTransaction, bool *aInterrupt) override;
|
||||
|
@ -75,24 +75,24 @@ protected:
|
|||
eStateOff = false,
|
||||
eStateOn = true
|
||||
};
|
||||
|
||||
|
||||
bool SelectionIsCollapsed();
|
||||
nsresult UpdateDirtyState(bool aNowDirty);
|
||||
nsresult UpdateDirtyState(bool aNowDirty);
|
||||
nsresult UpdateOneCommand(const char* aCommand);
|
||||
nsresult UpdateCommandGroup(const nsAString& aCommandGroup);
|
||||
|
||||
already_AddRefed<nsPICommandUpdater> GetCommandUpdater();
|
||||
|
||||
|
||||
nsresult PrimeUpdateTimer();
|
||||
void TimerCallback();
|
||||
nsCOMPtr<nsITimer> mUpdateTimer;
|
||||
|
||||
nsWeakPtr mDOMWindow;
|
||||
nsWeakPtr mDocShell;
|
||||
int8_t mDirtyState;
|
||||
int8_t mSelectionCollapsed;
|
||||
int8_t mDirtyState;
|
||||
int8_t mSelectionCollapsed;
|
||||
bool mFirstDoOfFirstUndo;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -40,14 +40,14 @@ class nsIControllerCommand;
|
|||
inCommandTable->RegisterCommand(_cmdName, \
|
||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||
}
|
||||
|
||||
|
||||
#define NS_REGISTER_TAG_COMMAND(_cmdClass, _cmdName, _tagName) \
|
||||
{ \
|
||||
_cmdClass* theCmd = new _cmdClass(_tagName); \
|
||||
inCommandTable->RegisterCommand(_cmdName, \
|
||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||
}
|
||||
|
||||
|
||||
|
||||
// static
|
||||
nsresult
|
||||
|
|
|
@ -14,7 +14,7 @@ class nsIControllerCommandTable;
|
|||
|
||||
// The plaintext editor controller is used for basic text editing and html editing
|
||||
// commands in composer
|
||||
// The refCon that gets passed to its commands is initially nsIEditingSession,
|
||||
// The refCon that gets passed to its commands is initially nsIEditingSession,
|
||||
// and after successfule editor creation it is changed to nsIEditor.
|
||||
#define NS_EDITORDOCSTATECONTROLLER_CID \
|
||||
{ 0x50e95301, 0x17a8, 0x11d4, { 0x9f, 0x7e, 0xdd, 0x53, 0x0d, 0x5f, 0x05, 0x7c } }
|
||||
|
|
|
@ -92,7 +92,7 @@ nsSetDocumentOptionsCommand::DoCommandParams(const char *aCommandName,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
|
||||
|
||||
int32_t animationMode;
|
||||
int32_t animationMode;
|
||||
rv = aParams->GetLongValue("imageAnimation", &animationMode);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ nsSetDocumentOptionsCommand::DoCommandParams(const char *aCommandName,
|
|||
presContext->SetImageAnimationMode(animationMode);
|
||||
}
|
||||
|
||||
bool allowPlugins;
|
||||
bool allowPlugins;
|
||||
rv = aParams->GetBooleanValue("plugins", &allowPlugins);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
|
@ -150,7 +150,7 @@ nsSetDocumentOptionsCommand::GetCommandStateParams(const char *aCommandName,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
bool allowPlugins = false;
|
||||
bool allowPlugins = false;
|
||||
rv = aParams->GetBooleanValue("plugins", &allowPlugins);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
|
@ -205,7 +205,7 @@ nsSetDocumentStateCommand::DoCommandParams(const char *aCommandName,
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aParams);
|
||||
|
||||
bool modified;
|
||||
bool modified;
|
||||
nsresult rv = aParams->GetBooleanValue(STATE_ATTRIBUTE, &modified);
|
||||
|
||||
// Should we fail if this param wasn't set?
|
||||
|
@ -221,7 +221,7 @@ nsSetDocumentStateCommand::DoCommandParams(const char *aCommandName,
|
|||
if (!nsCRT::strcmp(aCommandName, "cmd_setDocumentReadOnly"))
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aParams);
|
||||
bool isReadOnly;
|
||||
bool isReadOnly;
|
||||
nsresult rvRO = aParams->GetBooleanValue(STATE_ATTRIBUTE, &isReadOnly);
|
||||
NS_ENSURE_SUCCESS(rvRO, rvRO);
|
||||
|
||||
|
@ -376,7 +376,7 @@ nsSetDocumentStateCommand::GetCommandStateParams(const char *aCommandName,
|
|||
}
|
||||
|
||||
/**
|
||||
* Commands just for state notification
|
||||
* Commands just for state notification
|
||||
* As of 11/21/02, possible commands are:
|
||||
* "obs_documentCreated"
|
||||
* "obs_documentWillBeDestroyed"
|
||||
|
@ -389,7 +389,7 @@ nsSetDocumentStateCommand::GetCommandStateParams(const char *aCommandName,
|
|||
* 1. Get the nsICommandManager for the current editor
|
||||
* 2. Implement an nsIObserve object, e.g:
|
||||
*
|
||||
* void Observe(
|
||||
* void Observe(
|
||||
* in nsISupports aSubject, // The nsICommandManager calling this Observer
|
||||
* in string aTopic, // command name, e.g.:"obs_documentCreated"
|
||||
* // or "obs_documentWillBeDestroyed"
|
||||
|
@ -397,7 +397,7 @@ nsSetDocumentStateCommand::GetCommandStateParams(const char *aCommandName,
|
|||
*
|
||||
* 3. Add the observer by:
|
||||
* commandManager.addObserver(observeobject, obs_documentCreated);
|
||||
* 4. In the appropriate location in editorSession, editor, or commands code,
|
||||
* 4. In the appropriate location in editorSession, editor, or commands code,
|
||||
* trigger the notification of this observer by something like:
|
||||
*
|
||||
* nsCOMPtr<nsICommandManager> commandManager = do_GetInterface(mDocShell);
|
||||
|
@ -406,8 +406,8 @@ nsSetDocumentStateCommand::GetCommandStateParams(const char *aCommandName,
|
|||
* commandUpdater->CommandStatusChanged(obs_documentCreated);
|
||||
*
|
||||
* 5. Use GetCommandStateParams() to obtain state information
|
||||
* e.g., any creation state codes when creating an editor are
|
||||
* supplied for "obs_documentCreated" command in the
|
||||
* e.g., any creation state codes when creating an editor are
|
||||
* supplied for "obs_documentCreated" command in the
|
||||
* "state_data" param's value
|
||||
*
|
||||
*/
|
||||
|
@ -457,7 +457,7 @@ nsDocumentStateCommand::GetCommandStateParams(const char *aCommandName,
|
|||
// refCon is initially set to nsIEditingSession until editor
|
||||
// is successfully created and source doc is loaded
|
||||
// Embedder gets error status if this fails
|
||||
// If called before startup is finished,
|
||||
// If called before startup is finished,
|
||||
// status = eEditorCreationInProgress
|
||||
rv = editingSession->GetEditorStatus(&editorStatus);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -474,7 +474,7 @@ nsDocumentStateCommand::GetCommandStateParams(const char *aCommandName,
|
|||
// an nsIEditingSession or nsIEditor, we return "eEditorErrorUnknown"
|
||||
aParams->SetLongValue(STATE_DATA, editorStatus);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
else if (!nsCRT::strcmp(aCommandName, "obs_documentLocationChanged"))
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
|
||||
|
@ -491,7 +491,7 @@ nsDocumentStateCommand::GetCommandStateParams(const char *aCommandName,
|
|||
return aParams->SetISupportsValue(STATE_DATA, (nsISupports*)uri);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ static NS_DEFINE_CID(kHTMLEditorDocStateCommandTableCID, NS_HTMLEDITOR_DOCSTATE_
|
|||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsEditingSession)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsEditorSpellCheck)
|
||||
|
||||
// There are no macros that enable us to have 2 constructors
|
||||
// There are no macros that enable us to have 2 constructors
|
||||
// for the same object
|
||||
//
|
||||
// Here we are creating the same object with two different contract IDs
|
||||
|
@ -58,12 +58,12 @@ nsComposeTxtSrvFilterConstructor(nsISupports *aOuter, REFNSIID aIID,
|
|||
void **aResult, bool aIsForMail)
|
||||
{
|
||||
*aResult = nullptr;
|
||||
if (nullptr != aOuter)
|
||||
if (nullptr != aOuter)
|
||||
{
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsComposeTxtSrvFilter * inst = new nsComposeTxtSrvFilter();
|
||||
if (nullptr == inst)
|
||||
if (nullptr == inst)
|
||||
{
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ nsComposeTxtSrvFilterConstructor(nsISupports *aOuter, REFNSIID aIID,
|
|||
}
|
||||
|
||||
static nsresult
|
||||
nsComposeTxtSrvFilterConstructorForComposer(nsISupports *aOuter,
|
||||
nsComposeTxtSrvFilterConstructorForComposer(nsISupports *aOuter,
|
||||
REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
|
@ -83,7 +83,7 @@ nsComposeTxtSrvFilterConstructorForComposer(nsISupports *aOuter,
|
|||
}
|
||||
|
||||
static nsresult
|
||||
nsComposeTxtSrvFilterConstructorForMail(nsISupports *aOuter,
|
||||
nsComposeTxtSrvFilterConstructorForMail(nsISupports *aOuter,
|
||||
REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
|
@ -95,7 +95,7 @@ nsComposeTxtSrvFilterConstructorForMail(nsISupports *aOuter,
|
|||
// by the CID passed in. This function uses do_GetService to get the
|
||||
// command table, so that every controller shares a single command
|
||||
// table, for space-efficiency.
|
||||
//
|
||||
//
|
||||
// The only reason to go via the service manager for the command table
|
||||
// is that it holds onto the singleton for us, avoiding static variables here.
|
||||
static nsresult
|
||||
|
@ -107,16 +107,16 @@ CreateControllerWithSingletonCommandTable(const nsCID& inCommandTableCID, nsICon
|
|||
|
||||
nsCOMPtr<nsIControllerCommandTable> composerCommandTable = do_GetService(inCommandTableCID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
// this guy is a singleton, so make it immutable
|
||||
composerCommandTable->MakeImmutable();
|
||||
|
||||
|
||||
nsCOMPtr<nsIControllerContext> controllerContext = do_QueryInterface(controller, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
rv = controllerContext->Init(composerCommandTable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
*aResult = controller;
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
|
@ -126,7 +126,7 @@ CreateControllerWithSingletonCommandTable(const nsCID& inCommandTableCID, nsICon
|
|||
// Here we make an instance of the controller that holds doc state commands.
|
||||
// We set it up with a singleton command table.
|
||||
static nsresult
|
||||
nsHTMLEditorDocStateControllerConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
nsHTMLEditorDocStateControllerConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsCOMPtr<nsIController> controller;
|
||||
|
@ -150,40 +150,40 @@ nsHTMLEditorControllerConstructor(nsISupports *aOuter, REFNSIID aIID, void **aRe
|
|||
|
||||
// Constructor for a command table that is pref-filled with HTML editor commands
|
||||
static nsresult
|
||||
nsHTMLEditorCommandTableConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
nsHTMLEditorCommandTableConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIControllerCommandTable> commandTable =
|
||||
do_CreateInstance(NS_CONTROLLERCOMMANDTABLE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
rv = nsComposerController::RegisterHTMLEditorCommands(commandTable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
// we don't know here whether we're being created as an instance,
|
||||
// or a service, so we can't become immutable
|
||||
|
||||
|
||||
return commandTable->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
|
||||
// Constructor for a command table that is pref-filled with HTML editor doc state commands
|
||||
static nsresult
|
||||
nsHTMLEditorDocStateCommandTableConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
nsHTMLEditorDocStateCommandTableConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIControllerCommandTable> commandTable =
|
||||
do_CreateInstance(NS_CONTROLLERCOMMANDTABLE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
rv = nsComposerController::RegisterEditorDocStateCommands(commandTable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
// we don't know here whether we're being created as an instance,
|
||||
// or a service, so we can't become immutable
|
||||
|
||||
|
||||
return commandTable->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ nsEditingSession::~nsEditingSession()
|
|||
mLoadBlankDocTimer->Cancel();
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsEditingSession, nsIEditingSession, nsIWebProgressListener,
|
||||
NS_IMPL_ISUPPORTS(nsEditingSession, nsIEditingSession, nsIWebProgressListener,
|
||||
nsISupportsWeakReference)
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
|
@ -95,7 +95,7 @@ NS_IMPL_ISUPPORTS(nsEditingSession, nsIEditingSession, nsIWebProgressListener,
|
|||
MakeWindowEditable
|
||||
|
||||
aEditorType string, "html" "htmlsimple" "text" "textsimple"
|
||||
void makeWindowEditable(in nsIDOMWindow aWindow, in string aEditorType,
|
||||
void makeWindowEditable(in nsIDOMWindow aWindow, in string aEditorType,
|
||||
in boolean aDoAfterUriLoad,
|
||||
in boolean aMakeWholeDocumentEditable,
|
||||
in boolean aInteractive);
|
||||
|
@ -104,7 +104,7 @@ NS_IMPL_ISUPPORTS(nsEditingSession, nsIEditingSession, nsIWebProgressListener,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsEditingSession::MakeWindowEditable(nsIDOMWindow *aWindow,
|
||||
const char *aEditorType,
|
||||
const char *aEditorType,
|
||||
bool aDoAfterUriLoad,
|
||||
bool aMakeWholeDocumentEditable,
|
||||
bool aInteractive)
|
||||
|
@ -128,7 +128,7 @@ nsEditingSession::MakeWindowEditable(nsIDOMWindow *aWindow,
|
|||
|
||||
// Always remove existing editor
|
||||
TearDownEditorOnWindow(aWindow);
|
||||
|
||||
|
||||
// Tells embedder that startup is in progress
|
||||
mEditorStatus = eEditorCreationInProgress;
|
||||
|
||||
|
@ -137,14 +137,14 @@ nsEditingSession::MakeWindowEditable(nsIDOMWindow *aWindow,
|
|||
aEditorType = DEFAULT_EDITOR_TYPE;
|
||||
mEditorType = aEditorType;
|
||||
|
||||
// if all this does is setup listeners and I don't need listeners,
|
||||
// if all this does is setup listeners and I don't need listeners,
|
||||
// can't this step be ignored?? (based on aDoAfterURILoad)
|
||||
rv = PrepareForEditing(aWindow);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// set the flag on the docShell to say that it's editable
|
||||
rv = docShell->MakeEditable(aDoAfterUriLoad);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Setup commands common to plaintext and html editors,
|
||||
// including the document creation observers
|
||||
|
@ -247,7 +247,7 @@ nsEditingSession::WindowIsEditable(nsIDOMWindow *aWindow, bool *outIsEditable)
|
|||
// These are MIME types that are automatically parsed as "text/plain"
|
||||
// and thus we can edit them as plaintext
|
||||
// Note: in older versions, we attempted to convert the mimetype of
|
||||
// the network channel for these and "text/xml" to "text/plain",
|
||||
// the network channel for these and "text/xml" to "text/plain",
|
||||
// but further investigation reveals that strategy doesn't work
|
||||
const char* const gSupportedTextTypes[] = {
|
||||
"text/plain",
|
||||
|
@ -279,7 +279,7 @@ IsSupportedTextType(const char* aMIMEType)
|
|||
|
||||
i ++;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -346,13 +346,13 @@ nsEditingSession::SetupEditorOnWindow(nsIDOMWindow *aWindow)
|
|||
const char *classString = "@mozilla.org/editor/htmleditor;1";
|
||||
if (mEditorType.EqualsLiteral("textmail"))
|
||||
{
|
||||
mEditorFlags = nsIPlaintextEditor::eEditorPlaintextMask |
|
||||
nsIPlaintextEditor::eEditorEnableWrapHackMask |
|
||||
mEditorFlags = nsIPlaintextEditor::eEditorPlaintextMask |
|
||||
nsIPlaintextEditor::eEditorEnableWrapHackMask |
|
||||
nsIPlaintextEditor::eEditorMailMask;
|
||||
}
|
||||
else if (mEditorType.EqualsLiteral("text"))
|
||||
{
|
||||
mEditorFlags = nsIPlaintextEditor::eEditorPlaintextMask |
|
||||
mEditorFlags = nsIPlaintextEditor::eEditorPlaintextMask |
|
||||
nsIPlaintextEditor::eEditorEnableWrapHackMask;
|
||||
}
|
||||
else if (mEditorType.EqualsLiteral("htmlmail"))
|
||||
|
@ -363,7 +363,7 @@ nsEditingSession::SetupEditorOnWindow(nsIDOMWindow *aWindow)
|
|||
mEditorFlags = nsIPlaintextEditor::eEditorMailMask;
|
||||
}
|
||||
else //set the flags back to textplain.
|
||||
mEditorFlags = nsIPlaintextEditor::eEditorPlaintextMask |
|
||||
mEditorFlags = nsIPlaintextEditor::eEditorPlaintextMask |
|
||||
nsIPlaintextEditor::eEditorEnableWrapHackMask;
|
||||
}
|
||||
else // Defaulted to html
|
||||
|
@ -390,10 +390,10 @@ nsEditingSession::SetupEditorOnWindow(nsIDOMWindow *aWindow)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Create editor and do other things
|
||||
// Create editor and do other things
|
||||
// only if we haven't found some error above,
|
||||
nsCOMPtr<nsIDocShell> docShell = GetDocShellFromWindow(aWindow);
|
||||
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
|
||||
|
||||
if (!mInteractive) {
|
||||
// Disable animation of images in this document:
|
||||
|
@ -439,7 +439,7 @@ nsEditingSession::SetupEditorOnWindow(nsIDOMWindow *aWindow)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(contentViewer, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
rv = contentViewer->GetDOMDocument(getter_AddRefs(domDoc));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(domDoc, NS_ERROR_FAILURE);
|
||||
|
@ -521,7 +521,7 @@ nsEditingSession::TearDownEditorOnWindow(nsIDOMWindow *aWindow)
|
|||
NS_ENSURE_TRUE(aWindow, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
|
||||
// Kill any existing reload timer
|
||||
if (mLoadBlankDocTimer)
|
||||
{
|
||||
|
@ -541,7 +541,7 @@ nsEditingSession::TearDownEditorOnWindow(nsIDOMWindow *aWindow)
|
|||
|
||||
nsCOMPtr<nsIDocShell> docShell = GetDocShellFromWindow(aWindow);
|
||||
NS_ENSURE_STATE(docShell);
|
||||
|
||||
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
rv = docShell->GetEditor(getter_AddRefs(editor));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -551,7 +551,7 @@ nsEditingSession::TearDownEditorOnWindow(nsIDOMWindow *aWindow)
|
|||
|
||||
if (mStateMaintainer && editor)
|
||||
{
|
||||
// Null out the editor on the controllers first to prevent their weak
|
||||
// Null out the editor on the controllers first to prevent their weak
|
||||
// references from pointing to a destroyed editor.
|
||||
SetEditorOnControllers(aWindow, nullptr);
|
||||
}
|
||||
|
@ -590,13 +590,13 @@ nsEditingSession::TearDownEditorOnWindow(nsIDOMWindow *aWindow)
|
|||
|
||||
nsIEditor getEditorForFrame (in nsIDOMWindow aWindow);
|
||||
----------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditingSession::GetEditorForWindow(nsIDOMWindow *aWindow,
|
||||
nsIEditor **outEditor)
|
||||
{
|
||||
nsCOMPtr<nsIDocShell> docShell = GetDocShellFromWindow(aWindow);
|
||||
NS_ENSURE_STATE(aWindow);
|
||||
|
||||
|
||||
return docShell->GetEditor(outEditor);
|
||||
}
|
||||
|
||||
|
@ -790,7 +790,7 @@ nsEditingSession::OnProgressChange(nsIWebProgress *aWebProgress,
|
|||
|
||||
----------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP
|
||||
nsEditingSession::OnLocationChange(nsIWebProgress *aWebProgress,
|
||||
nsEditingSession::OnLocationChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest, nsIURI *aURI,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
|
@ -868,8 +868,8 @@ nsEditingSession::IsProgressForTargetDocument(nsIWebProgress *aWebProgress)
|
|||
|
||||
GetEditorStatus
|
||||
|
||||
Called during GetCommandStateParams("obs_documentCreated"...)
|
||||
to determine if editor was created and document
|
||||
Called during GetCommandStateParams("obs_documentCreated"...)
|
||||
to determine if editor was created and document
|
||||
was loaded successfully
|
||||
----------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP
|
||||
|
@ -887,7 +887,7 @@ nsEditingSession::GetEditorStatus(uint32_t *aStatus)
|
|||
Called on start of load in a single frame
|
||||
----------------------------------------------------------------------------*/
|
||||
nsresult
|
||||
nsEditingSession::StartDocumentLoad(nsIWebProgress *aWebProgress,
|
||||
nsEditingSession::StartDocumentLoad(nsIWebProgress *aWebProgress,
|
||||
bool aIsToBeMadeEditable)
|
||||
{
|
||||
#ifdef NOISY_DOC_LOADING
|
||||
|
@ -895,7 +895,7 @@ nsEditingSession::StartDocumentLoad(nsIWebProgress *aWebProgress,
|
|||
#endif
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aWebProgress);
|
||||
|
||||
|
||||
// If we have an editor here, then we got a reload after making the editor.
|
||||
// We need to blow it away and make a new one at the end of the load.
|
||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||
|
@ -906,7 +906,7 @@ nsEditingSession::StartDocumentLoad(nsIWebProgress *aWebProgress,
|
|||
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
|
||||
docShell->DetachEditorFromWindow();
|
||||
}
|
||||
|
||||
|
||||
if (aIsToBeMadeEditable)
|
||||
mEditorStatus = eEditorCreationInProgress;
|
||||
|
||||
|
@ -925,7 +925,7 @@ nsEditingSession::EndDocumentLoad(nsIWebProgress *aWebProgress,
|
|||
bool aIsToBeMadeEditable)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aWebProgress);
|
||||
|
||||
|
||||
#ifdef NOISY_DOC_LOADING
|
||||
printf("======= EndDocumentLoad ========\n");
|
||||
printf("with status %d, ", aStatus);
|
||||
|
@ -940,12 +940,12 @@ nsEditingSession::EndDocumentLoad(nsIWebProgress *aWebProgress,
|
|||
// We want to call the base class EndDocumentLoad,
|
||||
// but avoid some of the stuff
|
||||
// that nsDocShell does (need to refactor).
|
||||
|
||||
|
||||
// OK, time to make an editor on this document
|
||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||
aWebProgress->GetDOMWindow(getter_AddRefs(domWindow));
|
||||
|
||||
// Set the error state -- we will create an editor
|
||||
|
||||
// Set the error state -- we will create an editor
|
||||
// anyway and load empty doc later
|
||||
if (aIsToBeMadeEditable) {
|
||||
if (aStatus == NS_ERROR_FILE_NOT_FOUND)
|
||||
|
@ -969,7 +969,7 @@ nsEditingSession::EndDocumentLoad(nsIWebProgress *aWebProgress,
|
|||
{
|
||||
bool makeEditable;
|
||||
docShell->GetEditable(&makeEditable);
|
||||
|
||||
|
||||
if (makeEditable)
|
||||
{
|
||||
// To keep pre Gecko 1.9 behavior, setup editor always when
|
||||
|
@ -999,7 +999,7 @@ nsEditingSession::EndDocumentLoad(nsIWebProgress *aWebProgress,
|
|||
mLoadBlankDocTimer->Cancel();
|
||||
mLoadBlankDocTimer = nullptr;
|
||||
}
|
||||
|
||||
|
||||
mLoadBlankDocTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -1063,15 +1063,15 @@ nsEditingSession::EndPageLoad(nsIWebProgress *aWebProgress,
|
|||
uri->GetSpec(spec);
|
||||
printf("uri %s\n", spec.get());
|
||||
}
|
||||
|
||||
|
||||
nsAutoCString contentType;
|
||||
aChannel->GetContentType(contentType);
|
||||
if (!contentType.IsEmpty())
|
||||
printf(" flags = %d, status = %d, MIMETYPE = %s\n",
|
||||
printf(" flags = %d, status = %d, MIMETYPE = %s\n",
|
||||
mEditorFlags, mEditorStatus, contentType.get());
|
||||
#endif
|
||||
|
||||
// Set the error state -- we will create an editor anyway
|
||||
// Set the error state -- we will create an editor anyway
|
||||
// and load empty doc later
|
||||
if (aStatus == NS_ERROR_FILE_NOT_FOUND)
|
||||
mEditorStatus = eEditorErrorFileNotFound;
|
||||
|
@ -1123,16 +1123,16 @@ nsEditingSession::PrepareForEditing(nsIDOMWindow *aWindow)
|
|||
{
|
||||
if (mProgressListenerRegistered)
|
||||
return NS_OK;
|
||||
|
||||
|
||||
nsIDocShell *docShell = GetDocShellFromWindow(aWindow);
|
||||
|
||||
|
||||
// register callback
|
||||
nsCOMPtr<nsIWebProgress> webProgress = do_GetInterface(docShell);
|
||||
NS_ENSURE_TRUE(webProgress, NS_ERROR_FAILURE);
|
||||
|
||||
nsresult rv =
|
||||
webProgress->AddProgressListener(this,
|
||||
(nsIWebProgress::NOTIFY_STATE_NETWORK |
|
||||
(nsIWebProgress::NOTIFY_STATE_NETWORK |
|
||||
nsIWebProgress::NOTIFY_STATE_DOCUMENT |
|
||||
nsIWebProgress::NOTIFY_LOCATION));
|
||||
|
||||
|
@ -1159,8 +1159,8 @@ nsEditingSession::SetupEditorCommandController(
|
|||
NS_ENSURE_ARG_POINTER(aWindow);
|
||||
NS_ENSURE_ARG_POINTER(aContext);
|
||||
NS_ENSURE_ARG_POINTER(aControllerId);
|
||||
|
||||
nsCOMPtr<nsIControllers> controllers;
|
||||
|
||||
nsCOMPtr<nsIControllers> controllers;
|
||||
nsresult rv = aWindow->GetControllers(getter_AddRefs(controllers));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -1170,18 +1170,18 @@ nsEditingSession::SetupEditorCommandController(
|
|||
{
|
||||
nsCOMPtr<nsIController> controller;
|
||||
controller = do_CreateInstance(aControllerClassName, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// We must insert at head of the list to be sure our
|
||||
// controller is found before other implementations
|
||||
// (e.g., not-implemented versions by browser)
|
||||
rv = controllers->InsertControllerAt(0, controller);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Remember the ID for the controller
|
||||
rv = controllers->GetControllerId(controller, aControllerId);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
// Set the context
|
||||
return SetContextOnControllerById(controllers, aContext, *aControllerId);
|
||||
|
@ -1198,8 +1198,8 @@ nsEditingSession::SetEditorOnControllers(nsIDOMWindow *aWindow,
|
|||
nsIEditor* aEditor)
|
||||
{
|
||||
NS_ENSURE_TRUE(aWindow, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsCOMPtr<nsIControllers> controllers;
|
||||
|
||||
nsCOMPtr<nsIControllers> controllers;
|
||||
nsresult rv = aWindow->GetControllers(getter_AddRefs(controllers));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -1233,9 +1233,9 @@ nsEditingSession::SetContextOnControllerById(nsIControllers* aControllers,
|
|||
NS_ENSURE_ARG_POINTER(aControllers);
|
||||
|
||||
// aContext can be null (when destroying editor)
|
||||
nsCOMPtr<nsIController> controller;
|
||||
nsCOMPtr<nsIController> controller;
|
||||
aControllers->GetControllerById(aID, getter_AddRefs(controller));
|
||||
|
||||
|
||||
// ok with nil controller
|
||||
nsCOMPtr<nsIControllerContext> editorController =
|
||||
do_QueryInterface(controller);
|
||||
|
@ -1247,7 +1247,7 @@ nsEditingSession::SetContextOnControllerById(nsIControllers* aControllers,
|
|||
void
|
||||
nsEditingSession::RemoveEditorControllers(nsIDOMWindow *aWindow)
|
||||
{
|
||||
// Remove editor controllers from the aWindow, call when we're
|
||||
// Remove editor controllers from the aWindow, call when we're
|
||||
// tearing down/detaching editor.
|
||||
|
||||
nsCOMPtr<nsIControllers> controllers;
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
|
||||
// nsIWebProgressListener
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
|
||||
|
||||
// nsIEditingSession
|
||||
NS_DECL_NSIEDITINGSESSION
|
||||
|
||||
|
@ -64,13 +64,13 @@ protected:
|
|||
virtual ~nsEditingSession();
|
||||
|
||||
nsIDocShell * GetDocShellFromWindow(nsIDOMWindow *aWindow);
|
||||
|
||||
|
||||
nsresult SetupEditorCommandController(const char *aControllerClassName,
|
||||
nsIDOMWindow *aWindow,
|
||||
nsISupports *aContext,
|
||||
uint32_t *aControllerId);
|
||||
|
||||
nsresult SetContextOnControllerById(nsIControllers* aControllers,
|
||||
nsresult SetContextOnControllerById(nsIControllers* aControllers,
|
||||
nsISupports* aContext,
|
||||
uint32_t aID);
|
||||
|
||||
|
@ -78,17 +78,17 @@ protected:
|
|||
|
||||
static void TimerCallback(nsITimer *aTimer, void *aClosure);
|
||||
nsCOMPtr<nsITimer> mLoadBlankDocTimer;
|
||||
|
||||
|
||||
// progress load stuff
|
||||
nsresult StartDocumentLoad(nsIWebProgress *aWebProgress,
|
||||
bool isToBeMadeEditable);
|
||||
nsresult EndDocumentLoad(nsIWebProgress *aWebProgress,
|
||||
nsresult EndDocumentLoad(nsIWebProgress *aWebProgress,
|
||||
nsIChannel* aChannel, nsresult aStatus,
|
||||
bool isToBeMadeEditable);
|
||||
nsresult StartPageLoad(nsIChannel *aChannel);
|
||||
nsresult EndPageLoad(nsIWebProgress *aWebProgress,
|
||||
nsresult EndPageLoad(nsIWebProgress *aWebProgress,
|
||||
nsIChannel* aChannel, nsresult aStatus);
|
||||
|
||||
|
||||
bool IsProgressForTargetDocument(nsIWebProgress *aWebProgress);
|
||||
|
||||
void RemoveEditorControllers(nsIDOMWindow *aWindow);
|
||||
|
@ -102,10 +102,10 @@ protected:
|
|||
bool mDoneSetup; // have we prepared for editing yet?
|
||||
|
||||
// Used to prevent double creation of editor because nsIWebProgressListener
|
||||
// receives a STATE_STOP notification before the STATE_START
|
||||
// for our document, so we wait for the STATE_START, then STATE_STOP
|
||||
// receives a STATE_STOP notification before the STATE_START
|
||||
// for our document, so we wait for the STATE_START, then STATE_STOP
|
||||
// before creating an editor
|
||||
bool mCanCreateEditor;
|
||||
bool mCanCreateEditor;
|
||||
|
||||
bool mInteractive;
|
||||
bool mMakeWholeDocumentEditable;
|
||||
|
@ -128,9 +128,9 @@ protected:
|
|||
// THE REMAINING MEMBER VARIABLES WILL BECOME A SET WHEN WE EDIT
|
||||
// MORE THAN ONE EDITOR PER EDITING SESSION
|
||||
nsRefPtr<nsComposerCommandsUpdater> mStateMaintainer;
|
||||
|
||||
|
||||
// Save the editor type so we can create the editor after loading uri
|
||||
nsCString mEditorType;
|
||||
nsCString mEditorType;
|
||||
uint32_t mEditorFlags;
|
||||
uint32_t mEditorStatus;
|
||||
uint32_t mBaseCommandControllerId;
|
||||
|
|
|
@ -321,7 +321,7 @@ private:
|
|||
nsCOMPtr<nsIEditorSpellCheckCallback> mCallback;
|
||||
};
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditorSpellCheck::InitSpellChecker(nsIEditor* aEditor, bool aEnableSelectionChecking, nsIEditorSpellCheckCallback* aCallback)
|
||||
{
|
||||
NS_ENSURE_TRUE(aEditor, NS_ERROR_NULL_POINTER);
|
||||
|
@ -408,13 +408,13 @@ nsEditorSpellCheck::InitSpellChecker(nsIEditor* aEditor, bool aEnableSelectionCh
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditorSpellCheck::GetNextMisspelledWord(char16_t **aNextMisspelledWord)
|
||||
{
|
||||
NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsAutoString nextMisspelledWord;
|
||||
|
||||
|
||||
DeleteSuggestedWordList();
|
||||
// Beware! This may flush notifications via synchronous
|
||||
// ScrollSelectionIntoView.
|
||||
|
@ -425,7 +425,7 @@ nsEditorSpellCheck::GetNextMisspelledWord(char16_t **aNextMisspelledWord)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditorSpellCheck::GetSuggestedWord(char16_t **aSuggestedWord)
|
||||
{
|
||||
nsAutoString word;
|
||||
|
@ -440,7 +440,7 @@ nsEditorSpellCheck::GetSuggestedWord(char16_t **aSuggestedWord)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditorSpellCheck::CheckCurrentWord(const char16_t *aSuggestedWord,
|
||||
bool *aIsMisspelled)
|
||||
{
|
||||
|
@ -451,7 +451,7 @@ nsEditorSpellCheck::CheckCurrentWord(const char16_t *aSuggestedWord,
|
|||
aIsMisspelled, &mSuggestedWordList);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditorSpellCheck::CheckCurrentWordNoSuggest(const char16_t *aSuggestedWord,
|
||||
bool *aIsMisspelled)
|
||||
{
|
||||
|
@ -461,7 +461,7 @@ nsEditorSpellCheck::CheckCurrentWordNoSuggest(const char16_t *aSuggestedWord,
|
|||
aIsMisspelled, nullptr);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditorSpellCheck::ReplaceWord(const char16_t *aMisspelledWord,
|
||||
const char16_t *aReplaceWord,
|
||||
bool allOccurrences)
|
||||
|
@ -472,7 +472,7 @@ nsEditorSpellCheck::ReplaceWord(const char16_t *aMisspelledWord,
|
|||
nsDependentString(aReplaceWord), allOccurrences);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditorSpellCheck::IgnoreWordAllOccurrences(const char16_t *aWord)
|
||||
{
|
||||
NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED);
|
||||
|
@ -480,7 +480,7 @@ nsEditorSpellCheck::IgnoreWordAllOccurrences(const char16_t *aWord)
|
|||
return mSpellChecker->IgnoreAll(nsDependentString(aWord));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditorSpellCheck::GetPersonalDictionary()
|
||||
{
|
||||
NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED);
|
||||
|
@ -491,7 +491,7 @@ nsEditorSpellCheck::GetPersonalDictionary()
|
|||
return mSpellChecker->GetPersonalDictionary(&mDictionaryList);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditorSpellCheck::GetPersonalDictionaryWord(char16_t **aDictionaryWord)
|
||||
{
|
||||
if ( mDictionaryIndex < int32_t( mDictionaryList.Length()))
|
||||
|
@ -506,7 +506,7 @@ nsEditorSpellCheck::GetPersonalDictionaryWord(char16_t **aDictionaryWord)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditorSpellCheck::AddWordToDictionary(const char16_t *aWord)
|
||||
{
|
||||
NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED);
|
||||
|
@ -514,7 +514,7 @@ nsEditorSpellCheck::AddWordToDictionary(const char16_t *aWord)
|
|||
return mSpellChecker->AddWordToPersonalDictionary(nsDependentString(aWord));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditorSpellCheck::RemoveWordFromDictionary(const char16_t *aWord)
|
||||
{
|
||||
NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED);
|
||||
|
@ -522,7 +522,7 @@ nsEditorSpellCheck::RemoveWordFromDictionary(const char16_t *aWord)
|
|||
return mSpellChecker->RemoveWordFromPersonalDictionary(nsDependentString(aWord));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditorSpellCheck::GetDictionaryList(char16_t ***aDictionaryList, uint32_t *aCount)
|
||||
{
|
||||
NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED);
|
||||
|
@ -573,7 +573,7 @@ nsEditorSpellCheck::GetDictionaryList(char16_t ***aDictionaryList, uint32_t *aCo
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditorSpellCheck::GetCurrentDictionary(nsAString& aDictionary)
|
||||
{
|
||||
NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED);
|
||||
|
@ -581,7 +581,7 @@ nsEditorSpellCheck::GetCurrentDictionary(nsAString& aDictionary)
|
|||
return mSpellChecker->GetCurrentDictionary(aDictionary);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditorSpellCheck::SetCurrentDictionary(const nsAString& aDictionary)
|
||||
{
|
||||
NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED);
|
||||
|
@ -652,7 +652,7 @@ nsEditorSpellCheck::CheckCurrentDictionary()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditorSpellCheck::UninitSpellChecker()
|
||||
{
|
||||
NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED);
|
||||
|
@ -667,14 +667,14 @@ nsEditorSpellCheck::UninitSpellChecker()
|
|||
|
||||
|
||||
/* void setFilter (in nsITextServicesFilter filter); */
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditorSpellCheck::SetFilter(nsITextServicesFilter *filter)
|
||||
{
|
||||
mTxtSrvFilter = filter;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsEditorSpellCheck::DeleteSuggestedWordList()
|
||||
{
|
||||
mSuggestedWordList.Clear();
|
||||
|
@ -798,7 +798,7 @@ nsEditorSpellCheck::DictionaryFetched(DictionaryFetcher* aFetcher)
|
|||
rv = SetCurrentDictionary(dictName);
|
||||
if (NS_FAILED(rv)) {
|
||||
// required dictionary was not available. Try to get a dictionary
|
||||
// matching at least language part of dictName:
|
||||
// matching at least language part of dictName:
|
||||
|
||||
nsAutoString langCode;
|
||||
int32_t dashIdx = dictName.FindChar('-');
|
||||
|
|
|
@ -43,27 +43,27 @@ interface nsIEditingSession : nsISupports
|
|||
in boolean doAfterUriLoad,
|
||||
in boolean aMakeWholeDocumentEditable,
|
||||
in boolean aInteractive);
|
||||
|
||||
|
||||
/**
|
||||
* Test whether a specific window has had its editable flag set; it may have an editor
|
||||
* now, or will get one after the uri load.
|
||||
*
|
||||
*
|
||||
* Use this, passing the content root window, to test if we've set up editing
|
||||
* for this content.
|
||||
*/
|
||||
boolean windowIsEditable(in nsIDOMWindow window);
|
||||
|
||||
|
||||
/**
|
||||
* Get the editor for this window. May return null
|
||||
*/
|
||||
nsIEditor getEditorForWindow(in nsIDOMWindow window);
|
||||
nsIEditor getEditorForWindow(in nsIDOMWindow window);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Setup editor and related support objects
|
||||
*/
|
||||
void setupEditorOnWindow(in nsIDOMWindow window);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Destroy editor and related support objects
|
||||
*/
|
||||
void tearDownEditorOnWindow(in nsIDOMWindow window);
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(InsertTextTxn, EditTxn)
|
||||
|
||||
|
||||
NS_DECL_EDITTXN
|
||||
|
||||
NS_IMETHOD Merge(nsITransaction* aTransaction, bool* aDidMerge) override;
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
PlaceholderTxn::PlaceholderTxn() : EditAggregateTxn(),
|
||||
mAbsorb(true),
|
||||
PlaceholderTxn::PlaceholderTxn() : EditAggregateTxn(),
|
||||
mAbsorb(true),
|
||||
mForwarding(nullptr),
|
||||
mIMETextTxn(nullptr),
|
||||
mCommitted(false),
|
||||
|
@ -72,7 +72,7 @@ NS_IMETHODIMP PlaceholderTxn::UndoTransaction(void)
|
|||
// undo txns
|
||||
nsresult res = EditAggregateTxn::UndoTransaction();
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
|
||||
NS_ENSURE_TRUE(mStartSel, NS_ERROR_NULL_POINTER);
|
||||
|
||||
// now restore selection
|
||||
|
@ -87,7 +87,7 @@ NS_IMETHODIMP PlaceholderTxn::RedoTransaction(void)
|
|||
// redo txns
|
||||
nsresult res = EditAggregateTxn::RedoTransaction();
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
|
||||
// now restore selection
|
||||
nsRefPtr<Selection> selection = mEditor->GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
|
||||
|
@ -101,8 +101,8 @@ NS_IMETHODIMP PlaceholderTxn::Merge(nsITransaction *aTransaction, bool *aDidMerg
|
|||
|
||||
// set out param default value
|
||||
*aDidMerge=false;
|
||||
|
||||
if (mForwarding)
|
||||
|
||||
if (mForwarding)
|
||||
{
|
||||
NS_NOTREACHED("tried to merge into a placeholder that was in forwarding mode!");
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -122,18 +122,18 @@ NS_IMETHODIMP PlaceholderTxn::Merge(nsITransaction *aTransaction, bool *aDidMerg
|
|||
|
||||
// we are absorbing all txn's if mAbsorb is lit.
|
||||
if (mAbsorb)
|
||||
{
|
||||
{
|
||||
nsRefPtr<IMETextTxn> otherTxn = do_QueryObject(aTransaction);
|
||||
if (otherTxn) {
|
||||
// special handling for IMETextTxn's: they need to merge with any previous
|
||||
// IMETextTxn in this placeholder, if possible.
|
||||
if (!mIMETextTxn)
|
||||
if (!mIMETextTxn)
|
||||
{
|
||||
// this is the first IME txn in the placeholder
|
||||
mIMETextTxn =otherTxn;
|
||||
AppendChild(editTxn);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
bool didMerge;
|
||||
mIMETextTxn->Merge(otherTxn, &didMerge);
|
||||
|
@ -153,7 +153,7 @@ NS_IMETHODIMP PlaceholderTxn::Merge(nsITransaction *aTransaction, bool *aDidMerg
|
|||
}
|
||||
*aDidMerge = true;
|
||||
// RememberEndingSelection();
|
||||
// efficiency hack: no need to remember selection here, as we haven't yet
|
||||
// efficiency hack: no need to remember selection here, as we haven't yet
|
||||
// finished the initial batch and we know we will be told when the batch ends.
|
||||
// we can remeber the selection then.
|
||||
}
|
||||
|
@ -161,8 +161,8 @@ NS_IMETHODIMP PlaceholderTxn::Merge(nsITransaction *aTransaction, bool *aDidMerg
|
|||
{ // merge typing or IME or deletion transactions if the selection matches
|
||||
if (((mName.get() == nsGkAtoms::TypingTxnName) ||
|
||||
(mName.get() == nsGkAtoms::IMETxnName) ||
|
||||
(mName.get() == nsGkAtoms::DeleteTxnName))
|
||||
&& !mCommitted )
|
||||
(mName.get() == nsGkAtoms::DeleteTxnName))
|
||||
&& !mCommitted )
|
||||
{
|
||||
nsCOMPtr<nsIAbsorbingTransaction> plcTxn = do_QueryObject(editTxn);
|
||||
if (plcTxn) {
|
||||
|
@ -229,19 +229,19 @@ NS_IMETHODIMP PlaceholderTxn::StartSelectionEquals(nsSelectionState *aSelState,
|
|||
NS_IMETHODIMP PlaceholderTxn::EndPlaceHolderBatch()
|
||||
{
|
||||
mAbsorb = false;
|
||||
|
||||
if (mForwarding)
|
||||
|
||||
if (mForwarding)
|
||||
{
|
||||
nsCOMPtr<nsIAbsorbingTransaction> plcTxn = do_QueryReferent(mForwarding);
|
||||
if (plcTxn) plcTxn->EndPlaceHolderBatch();
|
||||
}
|
||||
|
||||
|
||||
// remember our selection state.
|
||||
return RememberEndingSelection();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP PlaceholderTxn::ForwardEndBatchTo(nsIAbsorbingTransaction *aForwardingAddress)
|
||||
{
|
||||
{
|
||||
mForwarding = do_GetWeakReference(aForwardingAddress);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -27,14 +27,14 @@ class IMETextTxn;
|
|||
* But it absorbs other transactions via merge, and can undo/redo the
|
||||
* transactions it has absorbed.
|
||||
*/
|
||||
|
||||
class PlaceholderTxn : public EditAggregateTxn,
|
||||
public nsIAbsorbingTransaction,
|
||||
|
||||
class PlaceholderTxn : public EditAggregateTxn,
|
||||
public nsIAbsorbingTransaction,
|
||||
public nsSupportsWeakReference
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
PlaceholderTxn();
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PlaceholderTxn, EditAggregateTxn)
|
||||
|
@ -49,9 +49,9 @@ public:
|
|||
|
||||
NS_IMETHOD Init(nsIAtom* aName, nsSelectionState* aSelState,
|
||||
nsEditor* aEditor) override;
|
||||
|
||||
|
||||
NS_IMETHOD GetTxnName(nsIAtom **aName) override;
|
||||
|
||||
|
||||
NS_IMETHOD StartSelectionEquals(nsSelectionState *aSelState, bool *aResult) override;
|
||||
|
||||
NS_IMETHOD EndPlaceHolderBatch() override;
|
||||
|
@ -71,7 +71,7 @@ protected:
|
|||
mozilla::dom::IMETextTxn *mIMETextTxn; // first IME txn in this placeholder - used for IME merging
|
||||
// non-owning for now - can't nsCOMPtr it due to broken transaction interfaces
|
||||
bool mCommitted; // do we stop auto absorbing any matching placeholder txns?
|
||||
// these next two members store the state of the selection in a safe way.
|
||||
// these next two members store the state of the selection in a safe way.
|
||||
// selection at the start of the txn is stored, as is the selection at the end.
|
||||
// This is so that UndoTransaction() and RedoTransaction() can restore the
|
||||
// selection properly.
|
||||
|
|
|
@ -149,8 +149,8 @@ nsresult SetDocTitleTxn::SetDomTitle(const nsAString& aTitle)
|
|||
// Not undoable: We will insert newTitleNode below
|
||||
nsCOMPtr<nsIDOMNode> resultNode;
|
||||
res = titleNode->AppendChild(newNode, getter_AddRefs(resultNode));
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is an undoable transaction
|
||||
res = editor->InsertNode(newNode, titleNode, 0);
|
||||
|
@ -175,7 +175,7 @@ NS_IMETHODIMP SetDocTitleTxn::GetTxnDescription(nsAString& aString)
|
|||
|
||||
NS_IMETHODIMP SetDocTitleTxn::GetIsTransient(bool *aIsTransient)
|
||||
{
|
||||
NS_ENSURE_TRUE(aIsTransient, NS_ERROR_NULL_POINTER);
|
||||
NS_ENSURE_TRUE(aIsTransient, NS_ERROR_NULL_POINTER);
|
||||
*aIsTransient = mIsTransient;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ protected:
|
|||
|
||||
/** the editor that created this transaction */
|
||||
nsIHTMLEditor* mEditor;
|
||||
|
||||
|
||||
/** The new title string */
|
||||
nsString mValue;
|
||||
|
||||
|
|
|
@ -49,23 +49,23 @@ void TextEditorTest::Run(nsIEditor *aEditor, int32_t *outNumTests, int32_t *outN
|
|||
nsresult TextEditorTest::RunUnitTest(int32_t *outNumTests, int32_t *outNumTestsFailed)
|
||||
{
|
||||
nsresult result;
|
||||
|
||||
|
||||
NS_ENSURE_TRUE(outNumTests && outNumTestsFailed, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
*outNumTests = 0;
|
||||
*outNumTestsFailed = 0;
|
||||
|
||||
|
||||
result = InitDoc();
|
||||
TEST_RESULT(result);
|
||||
// shouldn't we just bail on error here?
|
||||
|
||||
|
||||
// insert some simple text
|
||||
result = mTextEditor->InsertText(NS_LITERAL_STRING("1234567890abcdefghij1234567890"));
|
||||
TEST_RESULT(result);
|
||||
(*outNumTests)++;
|
||||
if (NS_FAILED(result))
|
||||
++(*outNumTestsFailed);
|
||||
|
||||
|
||||
// insert some more text
|
||||
result = mTextEditor->InsertText(NS_LITERAL_STRING("Moreover, I am cognizant of the interrelatedness of all communities and states. I cannot sit idly by in Atlanta and not be concerned about what happens in Birmingham. Injustice anywhere is a threat to justice everywhere"));
|
||||
TEST_RESULT(result);
|
||||
|
@ -123,7 +123,7 @@ nsresult TextEditorTest::TestInsertBreak()
|
|||
result = mTextEditor->InsertLineBreak();
|
||||
TEST_RESULT(result);
|
||||
mEditor->DebugDumpContent();
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ using namespace mozilla;
|
|||
using namespace mozilla::dom;
|
||||
|
||||
/********************************************************************
|
||||
* XPCOM cruft
|
||||
* XPCOM cruft
|
||||
*******************************************************************/
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION(TypeInState, mLastSelectionContainer)
|
||||
|
@ -41,7 +41,7 @@ NS_INTERFACE_MAP_END
|
|||
/********************************************************************
|
||||
* public methods
|
||||
*******************************************************************/
|
||||
|
||||
|
||||
TypeInState::TypeInState() :
|
||||
mSetArray()
|
||||
,mClearedArray()
|
||||
|
@ -63,7 +63,7 @@ nsresult
|
|||
TypeInState::UpdateSelState(Selection* aSelection)
|
||||
{
|
||||
NS_ENSURE_TRUE(aSelection, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
if (!aSelection->Collapsed()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ NS_IMETHODIMP TypeInState::NotifySelectionChanged(nsIDOMDocument *, nsISelection
|
|||
}
|
||||
}
|
||||
|
||||
Reset();
|
||||
Reset();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ TypeInState::ClearProp(nsIAtom* aProp, const nsAString& aAttr)
|
|||
/***************************************************************************
|
||||
* TakeClearProperty: hands back next property item on the clear list.
|
||||
* caller assumes ownership of PropItem and must delete it.
|
||||
*/
|
||||
*/
|
||||
PropItem*
|
||||
TypeInState::TakeClearProperty()
|
||||
{
|
||||
|
@ -207,7 +207,7 @@ TypeInState::TakeClearProperty()
|
|||
/***************************************************************************
|
||||
* TakeSetProperty: hands back next poroperty item on the set list.
|
||||
* caller assumes ownership of PropItem and must delete it.
|
||||
*/
|
||||
*/
|
||||
PropItem*
|
||||
TypeInState::TakeSetProperty()
|
||||
{
|
||||
|
@ -266,7 +266,7 @@ TypeInState::GetTypingState(bool &isSet,
|
|||
/********************************************************************
|
||||
* protected methods
|
||||
*******************************************************************/
|
||||
|
||||
|
||||
void
|
||||
TypeInState::RemovePropFromSetList(nsIAtom* aProp, const nsAString& aAttr)
|
||||
{
|
||||
|
@ -354,7 +354,7 @@ bool TypeInState::IsPropCleared(nsIAtom* aProp,
|
|||
return false;
|
||||
}
|
||||
|
||||
bool TypeInState::FindPropInList(nsIAtom *aProp,
|
||||
bool TypeInState::FindPropInList(nsIAtom *aProp,
|
||||
const nsAString &aAttr,
|
||||
nsAString *outValue,
|
||||
nsTArray<PropItem*> &aList,
|
||||
|
@ -366,7 +366,7 @@ bool TypeInState::FindPropInList(nsIAtom *aProp,
|
|||
{
|
||||
PropItem *item = aList[i];
|
||||
if ( (item->tag == aProp) &&
|
||||
(item->attr == aAttr) )
|
||||
(item->attr == aAttr) )
|
||||
{
|
||||
if (outValue) *outValue = item->value;
|
||||
outIndex = i;
|
||||
|
@ -382,7 +382,7 @@ bool TypeInState::FindPropInList(nsIAtom *aProp,
|
|||
* PropItem: helper struct for TypeInState
|
||||
*******************************************************************/
|
||||
|
||||
PropItem::PropItem() :
|
||||
PropItem::PropItem() :
|
||||
tag(nullptr)
|
||||
,attr()
|
||||
,value()
|
||||
|
|
|
@ -27,7 +27,7 @@ struct PropItem
|
|||
nsIAtom *tag;
|
||||
nsString attr;
|
||||
nsString value;
|
||||
|
||||
|
||||
PropItem();
|
||||
PropItem(nsIAtom *aTag, const nsAString &aAttr, const nsAString &aValue);
|
||||
~PropItem();
|
||||
|
@ -52,7 +52,7 @@ public:
|
|||
|
||||
void ClearAllProps();
|
||||
void ClearProp(nsIAtom* aProp, const nsAString& aAttr);
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// TakeClearProperty: hands back next property item on the clear list.
|
||||
// caller assumes ownership of PropItem and must delete it.
|
||||
|
@ -89,7 +89,7 @@ protected:
|
|||
int32_t mRelativeFontSize;
|
||||
nsCOMPtr<nsIDOMNode> mLastSelectionContainer;
|
||||
int32_t mLastSelectionOffset;
|
||||
|
||||
|
||||
friend class nsHTMLEditRules;
|
||||
};
|
||||
|
||||
|
|
|
@ -26,22 +26,22 @@ class Selection;
|
|||
class nsRulesInfo
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
explicit nsRulesInfo(EditAction aAction) : action(aAction) {}
|
||||
virtual ~nsRulesInfo() {}
|
||||
|
||||
|
||||
EditAction action;
|
||||
};
|
||||
|
||||
/***************************************************************************
|
||||
* Interface of editing rules.
|
||||
*
|
||||
*
|
||||
*/
|
||||
class nsIEditRules : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IEDITRULES_IID)
|
||||
|
||||
|
||||
//Interfaces for addref and release and queryinterface
|
||||
//NOTE: Use NS_DECL_ISUPPORTS_INHERITED in any class inherited from nsIEditRules
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIContent *aRoot,
|
|||
}
|
||||
NS_ASSERTION(selCon, "Selection controller should be available at this point");
|
||||
|
||||
//set up root element if we are passed one.
|
||||
//set up root element if we are passed one.
|
||||
if (aRoot)
|
||||
mRootElement = do_QueryInterface(aRoot);
|
||||
|
||||
|
@ -547,7 +547,7 @@ nsEditor::GetDOMDocument()
|
|||
return doc.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditor::GetDocument(nsIDOMDocument **aDoc)
|
||||
{
|
||||
*aDoc = GetDOMDocument().take();
|
||||
|
@ -758,7 +758,7 @@ NS_IMETHODIMP
|
|||
nsEditor::GetTransactionManager(nsITransactionManager* *aTxnManager)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aTxnManager);
|
||||
|
||||
|
||||
*aTxnManager = nullptr;
|
||||
NS_ENSURE_TRUE(mTxnMgr, NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -776,7 +776,7 @@ nsEditor::SetTransactionManager(nsITransactionManager *aTxnManager)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditor::Undo(uint32_t aCount)
|
||||
{
|
||||
ForceCompositionEnd();
|
||||
|
@ -817,7 +817,7 @@ NS_IMETHODIMP nsEditor::CanUndo(bool *aIsEnabled, bool *aCanUndo)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditor::Redo(uint32_t aCount)
|
||||
{
|
||||
bool hasTxnMgr, hasTransaction = false;
|
||||
|
@ -857,7 +857,7 @@ NS_IMETHODIMP nsEditor::CanRedo(bool *aIsEnabled, bool *aCanRedo)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditor::BeginTransaction()
|
||||
{
|
||||
BeginUpdateViewBatch();
|
||||
|
@ -869,7 +869,7 @@ nsEditor::BeginTransaction()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditor::EndTransaction()
|
||||
{
|
||||
if (mTxnMgr) {
|
||||
|
@ -889,7 +889,7 @@ nsEditor::EndTransaction()
|
|||
// placeholder transactions can later merge, if needed. Merging
|
||||
// is unavailable between transaction manager batches.
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditor::BeginPlaceHolderTransaction(nsIAtom *aName)
|
||||
{
|
||||
NS_PRECONDITION(mPlaceHolderBatch >= 0, "negative placeholder batch count!");
|
||||
|
@ -911,7 +911,7 @@ nsEditor::BeginPlaceHolderTransaction(nsIAtom *aName)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditor::EndPlaceHolderTransaction()
|
||||
{
|
||||
NS_PRECONDITION(mPlaceHolderBatch > 0, "zero or negative placeholder batch count when ending batch!");
|
||||
|
@ -954,7 +954,7 @@ nsEditor::EndPlaceHolderTransaction()
|
|||
|
||||
if (mSelState)
|
||||
{
|
||||
// we saved the selection state, but never got to hand it to placeholder
|
||||
// we saved the selection state, but never got to hand it to placeholder
|
||||
// (else we ould have nulled out this pointer), so destroy it to prevent leaks.
|
||||
delete mSelState;
|
||||
mSelState = nullptr;
|
||||
|
@ -962,11 +962,11 @@ nsEditor::EndPlaceHolderTransaction()
|
|||
if (mPlaceHolderTxn) // we might have never made a placeholder if no action took place
|
||||
{
|
||||
nsCOMPtr<nsIAbsorbingTransaction> plcTxn = do_QueryReferent(mPlaceHolderTxn);
|
||||
if (plcTxn)
|
||||
if (plcTxn)
|
||||
{
|
||||
plcTxn->EndPlaceHolderBatch();
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// in the future we will check to make sure undo is off here,
|
||||
// since that is the only known case where the placeholdertxn would disappear on us.
|
||||
|
@ -982,7 +982,7 @@ nsEditor::EndPlaceHolderTransaction()
|
|||
}
|
||||
}
|
||||
mPlaceHolderBatch--;
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -994,7 +994,7 @@ nsEditor::ShouldTxnSetSelection(bool *aResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditor::SetShouldTxnSetSelection(bool aShould)
|
||||
{
|
||||
mShouldTxnSetSelection = aShould;
|
||||
|
@ -1007,7 +1007,7 @@ nsEditor::GetDocumentIsEmpty(bool *aDocumentIsEmpty)
|
|||
*aDocumentIsEmpty = true;
|
||||
|
||||
dom::Element* root = GetRoot();
|
||||
NS_ENSURE_TRUE(root, NS_ERROR_NULL_POINTER);
|
||||
NS_ENSURE_TRUE(root, NS_ERROR_NULL_POINTER);
|
||||
|
||||
*aDocumentIsEmpty = !root->HasChildren();
|
||||
return NS_OK;
|
||||
|
@ -1032,11 +1032,11 @@ NS_IMETHODIMP nsEditor::BeginningOfDocument()
|
|||
// get the selection
|
||||
nsRefPtr<Selection> selection = GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
// get the root element
|
||||
|
||||
// get the root element
|
||||
dom::Element* rootElement = GetRoot();
|
||||
NS_ENSURE_TRUE(rootElement, NS_ERROR_NULL_POINTER);
|
||||
|
||||
NS_ENSURE_TRUE(rootElement, NS_ERROR_NULL_POINTER);
|
||||
|
||||
// find first editable thingy
|
||||
nsCOMPtr<nsINode> firstNode = GetFirstEditableNode(rootElement);
|
||||
if (!firstNode) {
|
||||
|
@ -1061,16 +1061,16 @@ NS_IMETHODIMP nsEditor::BeginningOfDocument()
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::EndOfDocument()
|
||||
{
|
||||
{
|
||||
NS_ENSURE_TRUE(mDocWeak, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
// get selection
|
||||
nsRefPtr<Selection> selection = GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
|
||||
|
||||
// get the root element
|
||||
// get selection
|
||||
nsRefPtr<Selection> selection = GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
|
||||
|
||||
// get the root element
|
||||
nsINode* node = GetRoot();
|
||||
NS_ENSURE_TRUE(node, NS_ERROR_NULL_POINTER);
|
||||
NS_ENSURE_TRUE(node, NS_ERROR_NULL_POINTER);
|
||||
nsINode* child = node->GetLastChild();
|
||||
|
||||
while (child && IsContainer(child->AsDOMNode())) {
|
||||
|
@ -1080,8 +1080,8 @@ nsEditor::EndOfDocument()
|
|||
|
||||
uint32_t length = node->Length();
|
||||
return selection->CollapseNative(node, int32_t(length));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::GetDocumentModified(bool *outDocModified)
|
||||
{
|
||||
|
@ -1117,25 +1117,25 @@ nsEditor::SetDocumentCharacterSet(const nsACString& characterSet)
|
|||
NS_IMETHODIMP
|
||||
nsEditor::Cut()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::CanCut(bool *aCanCut)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::Copy()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::CanCopy(bool *aCanCut)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1147,25 +1147,25 @@ nsEditor::CanDelete(bool *aCanDelete)
|
|||
NS_IMETHODIMP
|
||||
nsEditor::Paste(int32_t aSelectionType)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::PasteTransferable(nsITransferable *aTransferable)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::CanPaste(int32_t aSelectionType, bool *aCanPaste)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::CanPasteTransferable(nsITransferable *aTransferable, bool *aCanPaste)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1181,10 +1181,10 @@ nsEditor::SetAttribute(nsIDOMElement* aElement, const nsAString& aAttribute,
|
|||
return DoTransaction(txn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::GetAttributeValue(nsIDOMElement *aElement,
|
||||
const nsAString & aAttribute,
|
||||
nsAString & aResultValue,
|
||||
NS_IMETHODIMP
|
||||
nsEditor::GetAttributeValue(nsIDOMElement *aElement,
|
||||
const nsAString & aAttribute,
|
||||
nsAString & aResultValue,
|
||||
bool *aResultIsSet)
|
||||
{
|
||||
NS_ENSURE_TRUE(aResultIsSet, NS_ERROR_NULL_POINTER);
|
||||
|
@ -1227,7 +1227,7 @@ nsEditor::OutputsMozDirty()
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::MarkNodeDirty(nsIDOMNode* aNode)
|
||||
{
|
||||
{
|
||||
// Mark the node dirty, but not for webpages (bug 599983)
|
||||
if (!OutputsMozDirty()) {
|
||||
return NS_OK;
|
||||
|
@ -1540,9 +1540,9 @@ nsEditor::DeleteNode(nsINode* aNode)
|
|||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ReplaceContainer: replace inNode with a new node (outNode) which is contructed
|
||||
// ReplaceContainer: replace inNode with a new node (outNode) which is contructed
|
||||
// to be of type aNodeType. Put inNodes children into outNode.
|
||||
// Callers responsibility to make sure inNode's children can
|
||||
// Callers responsibility to make sure inNode's children can
|
||||
// go in outNode.
|
||||
already_AddRefed<Element>
|
||||
nsEditor::ReplaceContainer(Element* aOldContainer,
|
||||
|
@ -1571,7 +1571,7 @@ nsEditor::ReplaceContainer(Element* aOldContainer,
|
|||
if (aCloneAttributes == eCloneAttributes) {
|
||||
CloneAttributes(ret, aOldContainer);
|
||||
}
|
||||
|
||||
|
||||
// notify our internal selection state listener
|
||||
// (Note: A nsAutoSelectionReset object must be created
|
||||
// before calling this to initialize mRangeUpdater)
|
||||
|
@ -1593,7 +1593,7 @@ nsEditor::ReplaceContainer(Element* aOldContainer,
|
|||
// insert new container into tree
|
||||
res = InsertNode(*ret, *parent, offset);
|
||||
NS_ENSURE_SUCCESS(res, nullptr);
|
||||
|
||||
|
||||
// delete old container
|
||||
res = DeleteNode(aOldContainer);
|
||||
NS_ENSURE_SUCCESS(res, nullptr);
|
||||
|
@ -1733,7 +1733,7 @@ nsEditor::AddEditorObserver(nsIEditorObserver *aObserver)
|
|||
{
|
||||
// we don't keep ownership of the observers. They must
|
||||
// remove themselves as observers before they are destroyed.
|
||||
|
||||
|
||||
NS_ENSURE_TRUE(aObserver, NS_ERROR_NULL_POINTER);
|
||||
|
||||
// Make sure the listener isn't already on the list
|
||||
|
@ -1964,7 +1964,7 @@ nsEditor::DebugUnitTests(int32_t *outNumTests, int32_t *outNumTestsFailed)
|
|||
}
|
||||
|
||||
|
||||
bool
|
||||
bool
|
||||
nsEditor::ArePreservingSelection()
|
||||
{
|
||||
return !(mSavedSel.IsEmpty());
|
||||
|
@ -1977,7 +1977,7 @@ nsEditor::PreserveSelectionAcrossActions(Selection* aSel)
|
|||
mRangeUpdater.RegisterSelectionState(mSavedSel);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsEditor::RestorePreservedSelection(Selection* aSel)
|
||||
{
|
||||
if (mSavedSel.IsEmpty()) return NS_ERROR_FAILURE;
|
||||
|
@ -1986,7 +1986,7 @@ nsEditor::RestorePreservedSelection(Selection* aSel)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
nsEditor::StopPreservingSelection()
|
||||
{
|
||||
mRangeUpdater.DropSelectionState(mSavedSel);
|
||||
|
@ -2461,7 +2461,7 @@ nsEditor::NotifyDocumentListeners(TDocumentListenerNotification aNotificationTyp
|
|||
// Maybe there just aren't any.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsTArray<OwningNonNull<nsIDocumentStateListener>>
|
||||
listeners(mDocStateListeners);
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -2475,7 +2475,7 @@ nsEditor::NotifyDocumentListeners(TDocumentListenerNotification aNotificationTyp
|
|||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case eDocumentToBeDestroyed:
|
||||
for (auto& listener : listeners) {
|
||||
rv = listener->NotifyDocumentWillBeDestroyed();
|
||||
|
@ -2502,7 +2502,7 @@ nsEditor::NotifyDocumentListeners(TDocumentListenerNotification aNotificationTyp
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
NS_NOTREACHED("Unknown notification");
|
||||
}
|
||||
|
@ -2932,10 +2932,10 @@ nsEditor::GetNodeLocation(nsINode* aChild, int32_t* aOffset)
|
|||
return parent;
|
||||
}
|
||||
|
||||
// returns the number of things inside aNode.
|
||||
// returns the number of things inside aNode.
|
||||
// If aNode is text, returns number of characters. If not, returns number of children nodes.
|
||||
nsresult
|
||||
nsEditor::GetLengthOfDOMNode(nsIDOMNode *aNode, uint32_t &aCount)
|
||||
nsEditor::GetLengthOfDOMNode(nsIDOMNode *aNode, uint32_t &aCount)
|
||||
{
|
||||
aCount = 0;
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
|
||||
|
@ -3019,7 +3019,7 @@ nsEditor::GetNextNode(nsINode* aParentNode,
|
|||
// restart the search from the non-editable node we just found
|
||||
return GetNextNode(resultNode, aEditableNode, aNoBlockCrossing);
|
||||
}
|
||||
|
||||
|
||||
// unless there isn't one, in which case we are at the end of the node
|
||||
// and want the next one.
|
||||
if (aNoBlockCrossing && IsBlockNode(aParentNode)) {
|
||||
|
@ -3045,7 +3045,7 @@ nsEditor::GetPriorNode(nsINode* aCurrentNode, bool aEditableNode,
|
|||
}
|
||||
|
||||
nsIContent*
|
||||
nsEditor::FindNextLeafNode(nsINode *aCurrentNode,
|
||||
nsEditor::FindNextLeafNode(nsINode *aCurrentNode,
|
||||
bool aGoForward,
|
||||
bool bNoBlockCrossing)
|
||||
{
|
||||
|
@ -3068,7 +3068,7 @@ nsEditor::FindNextLeafNode(nsINode *aCurrentNode,
|
|||
nsIContent *leaf =
|
||||
aGoForward ? GetLeftmostChild(sibling, bNoBlockCrossing) :
|
||||
GetRightmostChild(sibling, bNoBlockCrossing);
|
||||
if (!leaf) {
|
||||
if (!leaf) {
|
||||
return sibling;
|
||||
}
|
||||
|
||||
|
@ -3126,7 +3126,7 @@ nsEditor::FindNode(nsINode *aCurrentNode,
|
|||
|
||||
nsCOMPtr<nsIContent> candidate =
|
||||
FindNextLeafNode(aCurrentNode, aGoForward, bNoBlockCrossing);
|
||||
|
||||
|
||||
if (!candidate) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -3225,7 +3225,7 @@ nsEditor::CanContainTag(nsINode& aParent, nsIAtom& aChildTag)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
nsEditor::TagCanContain(nsIAtom& aParentTag, nsIContent& aChild)
|
||||
{
|
||||
switch (aChild.NodeType()) {
|
||||
|
@ -3237,7 +3237,7 @@ nsEditor::TagCanContain(nsIAtom& aParentTag, nsIContent& aChild)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
nsEditor::TagCanContainTag(nsIAtom& aParentTag, nsIAtom& aChildTag)
|
||||
{
|
||||
return true;
|
||||
|
@ -3253,7 +3253,7 @@ nsEditor::IsRoot(nsIDOMNode* inNode)
|
|||
return inNode == rootNode;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
nsEditor::IsRoot(nsINode* inNode)
|
||||
{
|
||||
NS_ENSURE_TRUE(inNode, false);
|
||||
|
@ -3271,7 +3271,7 @@ nsEditor::IsEditorRoot(nsINode* aNode)
|
|||
return aNode == rootNode;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
nsEditor::IsDescendantOfRoot(nsIDOMNode* inNode)
|
||||
{
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(inNode);
|
||||
|
@ -3375,7 +3375,7 @@ IsElementVisible(dom::Element* aElement)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
nsEditor::IsEditable(nsIDOMNode *aNode)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
||||
|
@ -3480,29 +3480,29 @@ nsEditor::GetTag(nsIDOMNode *aNode)
|
|||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
||||
|
||||
if (!content)
|
||||
if (!content)
|
||||
{
|
||||
NS_ASSERTION(aNode, "null node passed to nsEditor::GetTag()");
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
return content->NodeInfo()->NameAtom();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// GetTagString: digs out string for the tag of this node
|
||||
//
|
||||
nsresult
|
||||
//
|
||||
nsresult
|
||||
nsEditor::GetTagString(nsIDOMNode *aNode, nsAString& outString)
|
||||
{
|
||||
if (!aNode)
|
||||
if (!aNode)
|
||||
{
|
||||
NS_NOTREACHED("null node passed to nsEditor::GetTagString()");
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
|
||||
nsIAtom *atom = GetTag(aNode);
|
||||
if (!atom)
|
||||
{
|
||||
|
@ -3516,8 +3516,8 @@ nsEditor::GetTagString(nsIDOMNode *aNode, nsAString& outString)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// NodesSameType: do these nodes have the same tag?
|
||||
//
|
||||
bool
|
||||
//
|
||||
bool
|
||||
nsEditor::NodesSameType(nsIDOMNode *aNode1, nsIDOMNode *aNode2)
|
||||
{
|
||||
if (!aNode1 || !aNode2) {
|
||||
|
@ -3546,7 +3546,7 @@ nsEditor::AreNodesSameType(nsIContent* aNode1, nsIContent* aNode2)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsTextNode: true if node of dom type text
|
||||
//
|
||||
//
|
||||
bool
|
||||
nsEditor::IsTextNode(nsIDOMNode *aNode)
|
||||
{
|
||||
|
@ -3555,7 +3555,7 @@ nsEditor::IsTextNode(nsIDOMNode *aNode)
|
|||
NS_NOTREACHED("null node passed to IsTextNode()");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
uint16_t nodeType;
|
||||
aNode->GetNodeType(&nodeType);
|
||||
return (nodeType == nsIDOMNode::TEXT_NODE);
|
||||
|
@ -3570,11 +3570,11 @@ nsEditor::IsTextNode(nsINode *aNode)
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// GetChildAt: returns the node at this position index in the parent
|
||||
//
|
||||
nsCOMPtr<nsIDOMNode>
|
||||
nsCOMPtr<nsIDOMNode>
|
||||
nsEditor::GetChildAt(nsIDOMNode *aParent, int32_t aOffset)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> resultNode;
|
||||
|
||||
|
||||
nsCOMPtr<nsIContent> parent = do_QueryInterface(aParent);
|
||||
|
||||
NS_ENSURE_TRUE(parent, resultNode);
|
||||
|
@ -3600,9 +3600,9 @@ nsEditor::GetNodeAtRangeOffsetPoint(nsIDOMNode* aParentOrNode, int32_t aOffset)
|
|||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// GetStartNodeAndOffset: returns whatever the start parent & offset is of
|
||||
// GetStartNodeAndOffset: returns whatever the start parent & offset is of
|
||||
// the first range in the selection.
|
||||
nsresult
|
||||
nsresult
|
||||
nsEditor::GetStartNodeAndOffset(Selection* aSelection,
|
||||
nsIDOMNode **outStartNode,
|
||||
int32_t *outStartOffset)
|
||||
|
@ -3647,9 +3647,9 @@ nsEditor::GetStartNodeAndOffset(Selection* aSelection, nsINode** aStartNode,
|
|||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// GetEndNodeAndOffset: returns whatever the end parent & offset is of
|
||||
// GetEndNodeAndOffset: returns whatever the end parent & offset is of
|
||||
// the first range in the selection.
|
||||
nsresult
|
||||
nsresult
|
||||
nsEditor::GetEndNodeAndOffset(Selection* aSelection,
|
||||
nsIDOMNode **outEndNode,
|
||||
int32_t *outEndOffset)
|
||||
|
@ -3696,13 +3696,13 @@ nsEditor::GetEndNodeAndOffset(Selection* aSelection, nsINode** aEndNode,
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsPreformatted: checks the style info for the node for the preformatted
|
||||
// text style.
|
||||
nsresult
|
||||
nsresult
|
||||
nsEditor::IsPreformatted(nsIDOMNode *aNode, bool *aResult)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
||||
|
||||
|
||||
NS_ENSURE_TRUE(aResult && content, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
NS_ENSURE_TRUE(ps, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
|
@ -3734,18 +3734,18 @@ nsEditor::IsPreformatted(nsIDOMNode *aNode, bool *aResult)
|
|||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// SplitNodeDeep: this splits a node "deeply", splitting children as
|
||||
// SplitNodeDeep: this splits a node "deeply", splitting children as
|
||||
// appropriate. The place to split is represented by
|
||||
// a dom point at {splitPointParent, splitPointOffset}.
|
||||
// That dom point must be inside aNode, which is the node to
|
||||
// That dom point must be inside aNode, which is the node to
|
||||
// split. outOffset is set to the offset in the parent of aNode where
|
||||
// the split terminates - where you would want to insert
|
||||
// a new element, for instance, if that's why you were splitting
|
||||
// the split terminates - where you would want to insert
|
||||
// a new element, for instance, if that's why you were splitting
|
||||
// the node.
|
||||
//
|
||||
nsresult
|
||||
nsEditor::SplitNodeDeep(nsIDOMNode *aNode,
|
||||
nsIDOMNode *aSplitPointParent,
|
||||
nsEditor::SplitNodeDeep(nsIDOMNode *aNode,
|
||||
nsIDOMNode *aSplitPointParent,
|
||||
int32_t aSplitPointOffset,
|
||||
int32_t *outOffset,
|
||||
bool aNoEmptyContainers,
|
||||
|
@ -3766,11 +3766,11 @@ nsEditor::SplitNodeDeep(nsIDOMNode *aNode,
|
|||
// for now we just have some smarts about unneccessarily splitting
|
||||
// textnodes, which should be universal enough to put straight in
|
||||
// this nsEditor routine.
|
||||
|
||||
|
||||
nsCOMPtr<nsIDOMCharacterData> nodeAsText = do_QueryInterface(nodeToSplit);
|
||||
uint32_t len = nodeToSplit->Length();
|
||||
bool bDoSplit = false;
|
||||
|
||||
|
||||
if (!(aNoEmptyContainers || nodeAsText) || (offset && (offset != (int32_t)len)))
|
||||
{
|
||||
bDoSplit = true;
|
||||
|
@ -3901,7 +3901,7 @@ nsEditor::BeginUpdateViewBatch()
|
|||
nsresult nsEditor::EndUpdateViewBatch()
|
||||
{
|
||||
NS_PRECONDITION(mUpdateCount > 0, "bad state");
|
||||
|
||||
|
||||
if (mUpdateCount <= 0)
|
||||
{
|
||||
mUpdateCount = 0;
|
||||
|
@ -3923,14 +3923,14 @@ nsresult nsEditor::EndUpdateViewBatch()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
nsEditor::GetShouldTxnSetSelection()
|
||||
{
|
||||
return mShouldTxnSetSelection;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditor::DeleteSelectionImpl(EDirection aAction,
|
||||
EStripWrappers aStripWrappers)
|
||||
{
|
||||
|
@ -3947,7 +3947,7 @@ nsEditor::DeleteSelectionImpl(EDirection aAction,
|
|||
&deleteCharLength);
|
||||
nsCOMPtr<nsIDOMCharacterData> deleteCharData(do_QueryInterface(deleteNode));
|
||||
|
||||
if (NS_SUCCEEDED(res))
|
||||
if (NS_SUCCEEDED(res))
|
||||
{
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::deleteSelection, aAction);
|
||||
// Notify nsIEditActionListener::WillDelete[Selection|Text|Node]
|
||||
|
@ -3966,7 +3966,7 @@ nsEditor::DeleteSelectionImpl(EDirection aAction,
|
|||
}
|
||||
|
||||
// Delete the specified amount
|
||||
res = DoTransaction(txn);
|
||||
res = DoTransaction(txn);
|
||||
|
||||
// Notify nsIEditActionListener::DidDelete[Selection|Text|Node]
|
||||
if (!deleteNode) {
|
||||
|
@ -4084,7 +4084,7 @@ nsEditor::DoAfterDoTransaction(nsITransaction *aTxn)
|
|||
bool isTransientTransaction;
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
||||
aTxn->GetIsTransient(&isTransientTransaction)));
|
||||
|
||||
|
||||
if (!isTransientTransaction)
|
||||
{
|
||||
// we need to deal here with the case where the user saved after some
|
||||
|
@ -4095,7 +4095,7 @@ nsEditor::DoAfterDoTransaction(nsITransaction *aTxn)
|
|||
GetModificationCount(&modCount);
|
||||
if (modCount < 0)
|
||||
modCount = -modCount;
|
||||
|
||||
|
||||
// don't count transient transactions
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
||||
IncrementModificationCount(1)));
|
||||
|
@ -4189,7 +4189,7 @@ nsEditor::CreateTxnForIMEText(const nsAString& aStringToInsert)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditor::CreateTxnForAddStyleSheet(CSSStyleSheet* aSheet, AddStyleSheetTxn* *aTxn)
|
||||
{
|
||||
nsRefPtr<AddStyleSheetTxn> txn = new AddStyleSheetTxn();
|
||||
|
@ -4205,7 +4205,7 @@ nsEditor::CreateTxnForAddStyleSheet(CSSStyleSheet* aSheet, AddStyleSheetTxn* *aT
|
|||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsEditor::CreateTxnForRemoveStyleSheet(CSSStyleSheet* aSheet, RemoveStyleSheetTxn* *aTxn)
|
||||
{
|
||||
nsRefPtr<RemoveStyleSheetTxn> txn = new RemoveStyleSheetTxn();
|
||||
|
@ -4465,7 +4465,7 @@ nsEditor::CreateTxnForDeleteInsertionPoint(nsRange* aRange,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsEditor::CreateRange(nsIDOMNode *aStartParent, int32_t aStartOffset,
|
||||
nsIDOMNode *aEndParent, int32_t aEndOffset,
|
||||
nsRange** aRange)
|
||||
|
@ -4474,7 +4474,7 @@ nsEditor::CreateRange(nsIDOMNode *aStartParent, int32_t aStartOffset,
|
|||
aEndOffset, aRange);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsEditor::AppendNodeToSelectionAsRange(nsIDOMNode *aNode)
|
||||
{
|
||||
NS_ENSURE_TRUE(aNode, NS_ERROR_NULL_POINTER);
|
||||
|
@ -4485,9 +4485,9 @@ nsEditor::AppendNodeToSelectionAsRange(nsIDOMNode *aNode)
|
|||
nsresult res = aNode->GetParentNode(getter_AddRefs(parentNode));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
NS_ENSURE_TRUE(parentNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
int32_t offset = GetChildOffset(aNode, parentNode);
|
||||
|
||||
|
||||
nsRefPtr<nsRange> range;
|
||||
res = CreateRange(parentNode, offset, parentNode, offset+1, getter_AddRefs(range));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
@ -4500,7 +4500,7 @@ nsresult nsEditor::ClearSelection()
|
|||
{
|
||||
nsRefPtr<Selection> selection = GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_FAILURE);
|
||||
return selection->RemoveAllRanges();
|
||||
return selection->RemoveAllRanges();
|
||||
}
|
||||
|
||||
already_AddRefed<Element>
|
||||
|
@ -4598,7 +4598,7 @@ nsEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
|
|||
}
|
||||
DeleteSelection(nsIEditor::eNext, nsIEditor::eStrip);
|
||||
aKeyEvent->PreventDefault(); // consumed
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -4869,12 +4869,12 @@ nsEditor::DumpNode(nsIDOMNode *aNode, int32_t indent)
|
|||
int32_t i;
|
||||
for (i=0; i<indent; i++)
|
||||
printf(" ");
|
||||
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aNode);
|
||||
nsCOMPtr<nsIDOMDocumentFragment> docfrag = do_QueryInterface(aNode);
|
||||
|
||||
|
||||
if (element || docfrag)
|
||||
{
|
||||
{
|
||||
if (element)
|
||||
{
|
||||
nsAutoString tag;
|
||||
|
|
|
@ -132,9 +132,9 @@ inline bool operator!(const EditAction& aOp)
|
|||
return aOp == EditAction::none;
|
||||
}
|
||||
|
||||
/** implementation of an editor object. it will be the controller/focal point
|
||||
* for the main editor services. i.e. the GUIManager, publishing, transaction
|
||||
* manager, event interfaces. the idea for the event interfaces is to have them
|
||||
/** implementation of an editor object. it will be the controller/focal point
|
||||
* for the main editor services. i.e. the GUIManager, publishing, transaction
|
||||
* manager, event interfaces. the idea for the event interfaces is to have them
|
||||
* delegate the actual commands to the editor independent of the XPFE implementation.
|
||||
*/
|
||||
class nsEditor : public nsIEditor,
|
||||
|
@ -157,7 +157,7 @@ public:
|
|||
nsEditor();
|
||||
|
||||
protected:
|
||||
/** The default destructor. This should suffice. Should this be pure virtual
|
||||
/** The default destructor. This should suffice. Should this be pure virtual
|
||||
* for someone to derive from the nsEditor later? I don't believe so.
|
||||
*/
|
||||
virtual ~nsEditor();
|
||||
|
@ -236,7 +236,7 @@ public:
|
|||
nsresult JoinNodes(nsINode& aLeftNode, nsINode& aRightNode);
|
||||
nsresult MoveNode(nsIContent* aNode, nsINode* aParent, int32_t aOffset);
|
||||
|
||||
/* Method to replace certain CreateElementNS() calls.
|
||||
/* Method to replace certain CreateElementNS() calls.
|
||||
Arguments:
|
||||
nsIAtom* aTag - tag you want
|
||||
*/
|
||||
|
@ -294,8 +294,8 @@ protected:
|
|||
int32_t* aOffset,
|
||||
int32_t* aLength);
|
||||
|
||||
nsresult CreateTxnForDeleteInsertionPoint(nsRange* aRange,
|
||||
EDirection aAction,
|
||||
nsresult CreateTxnForDeleteInsertionPoint(nsRange* aRange,
|
||||
EDirection aAction,
|
||||
EditAggregateTxn* aTxn,
|
||||
nsINode** aNode,
|
||||
int32_t* aOffset,
|
||||
|
@ -322,7 +322,7 @@ protected:
|
|||
*/
|
||||
NS_IMETHOD CreateTxnForRemoveStyleSheet(mozilla::CSSStyleSheet* aSheet,
|
||||
RemoveStyleSheetTxn* *aTxn);
|
||||
|
||||
|
||||
nsresult DeleteText(nsGenericDOMDataNode& aElement,
|
||||
uint32_t aOffset, uint32_t aLength);
|
||||
|
||||
|
@ -335,7 +335,7 @@ protected:
|
|||
already_AddRefed<mozilla::dom::DeleteTextTxn>
|
||||
CreateTxnForDeleteCharacter(nsGenericDOMDataNode& aData, uint32_t aOffset,
|
||||
EDirection aDirection);
|
||||
|
||||
|
||||
already_AddRefed<mozilla::dom::SplitNodeTxn>
|
||||
CreateTxnForSplitNode(nsIContent& aNode, uint32_t aOffset);
|
||||
|
||||
|
@ -364,10 +364,10 @@ protected:
|
|||
eDocumentToBeDestroyed,
|
||||
eDocumentStateChanged
|
||||
} TDocumentListenerNotification;
|
||||
|
||||
|
||||
// tell the doc state listeners that the doc state has changed
|
||||
NS_IMETHOD NotifyDocumentListeners(TDocumentListenerNotification aNotificationType);
|
||||
|
||||
|
||||
/** make the given selection span the entire document */
|
||||
virtual nsresult SelectEntireDocument(mozilla::dom::Selection* aSelection);
|
||||
|
||||
|
@ -385,15 +385,15 @@ protected:
|
|||
|
||||
// Convenience method; forwards to IsBlockNode(nsINode*).
|
||||
bool IsBlockNode(nsIDOMNode* aNode);
|
||||
// stub. see comment in source.
|
||||
// stub. see comment in source.
|
||||
virtual bool IsBlockNode(nsINode* aNode);
|
||||
|
||||
|
||||
// helper for GetPriorNode and GetNextNode
|
||||
nsIContent* FindNextLeafNode(nsINode *aCurrentNode,
|
||||
bool aGoForward,
|
||||
bool bNoBlockCrossing);
|
||||
|
||||
// install the event listeners for the editor
|
||||
// install the event listeners for the editor
|
||||
virtual nsresult InstallEventListeners();
|
||||
|
||||
virtual void CreateEventListeners();
|
||||
|
@ -432,14 +432,14 @@ public:
|
|||
* with a call to EndOperation */
|
||||
NS_IMETHOD EndOperation();
|
||||
|
||||
/** routines for managing the preservation of selection across
|
||||
/** routines for managing the preservation of selection across
|
||||
* various editor actions */
|
||||
bool ArePreservingSelection();
|
||||
void PreserveSelectionAcrossActions(mozilla::dom::Selection* aSel);
|
||||
nsresult RestorePreservedSelection(mozilla::dom::Selection* aSel);
|
||||
void StopPreservingSelection();
|
||||
|
||||
/**
|
||||
/**
|
||||
* SplitNode() creates a new node identical to an existing node, and split
|
||||
* the contents between the two nodes
|
||||
* @param aExistingRightNode The node to split. It will become the new
|
||||
|
@ -453,7 +453,7 @@ public:
|
|||
int32_t aOffset,
|
||||
nsIContent& aNewLeftNode);
|
||||
|
||||
/**
|
||||
/**
|
||||
* JoinNodes() takes 2 nodes and merge their content|children.
|
||||
* @param aNodeToKeep The node that will remain after the join.
|
||||
* @param aNodeToJoin The node that will be joined with aNodeToKeep.
|
||||
|
@ -479,9 +479,9 @@ public:
|
|||
int32_t* outOffset);
|
||||
static nsINode* GetNodeLocation(nsINode* aChild, int32_t* aOffset);
|
||||
|
||||
/** returns the number of things inside aNode in the out-param aCount.
|
||||
* @param aNode is the node to get the length of.
|
||||
* If aNode is text, returns number of characters.
|
||||
/** returns the number of things inside aNode in the out-param aCount.
|
||||
* @param aNode is the node to get the length of.
|
||||
* If aNode is text, returns number of characters.
|
||||
* If not, returns number of children nodes.
|
||||
* @param aCount [OUT] the result of the above calculation.
|
||||
*/
|
||||
|
@ -577,7 +577,7 @@ public:
|
|||
|
||||
/** counts number of editable child nodes */
|
||||
uint32_t CountEditableChildren(nsINode* aNode);
|
||||
|
||||
|
||||
/** Find the deep first and last children. */
|
||||
nsINode* GetFirstEditableNode(nsINode* aRoot);
|
||||
|
||||
|
@ -599,7 +599,7 @@ public:
|
|||
|
||||
static bool IsTextNode(nsIDOMNode *aNode);
|
||||
static bool IsTextNode(nsINode *aNode);
|
||||
|
||||
|
||||
static nsCOMPtr<nsIDOMNode> GetChildAt(nsIDOMNode *aParent, int32_t aOffset);
|
||||
static nsCOMPtr<nsIDOMNode> GetNodeAtRangeOffsetPoint(nsIDOMNode* aParentOrNode, int32_t aOffset);
|
||||
|
||||
|
@ -621,7 +621,7 @@ public:
|
|||
mozilla::dom::Selection* GetSelection(int16_t aSelectionType =
|
||||
nsISelectionController::SELECTION_NORMAL);
|
||||
|
||||
// Helpers to add a node to the selection.
|
||||
// Helpers to add a node to the selection.
|
||||
// Used by table cell selection methods
|
||||
nsresult CreateRange(nsIDOMNode *aStartParent, int32_t aStartOffset,
|
||||
nsIDOMNode *aEndParent, int32_t aEndOffset,
|
||||
|
@ -634,8 +634,8 @@ public:
|
|||
|
||||
nsresult IsPreformatted(nsIDOMNode *aNode, bool *aResult);
|
||||
|
||||
nsresult SplitNodeDeep(nsIDOMNode *aNode,
|
||||
nsIDOMNode *aSplitPointParent,
|
||||
nsresult SplitNodeDeep(nsIDOMNode *aNode,
|
||||
nsIDOMNode *aSplitPointParent,
|
||||
int32_t aSplitPointOffset,
|
||||
int32_t *outOffset,
|
||||
bool aNoEmptyContainers = false,
|
||||
|
@ -734,7 +734,7 @@ public:
|
|||
{
|
||||
return (mFlags & nsIPlaintextEditor::eEditorDontEchoPassword) != 0;
|
||||
}
|
||||
|
||||
|
||||
bool ShouldSkipSpellCheck() const
|
||||
{
|
||||
return (mFlags & nsIPlaintextEditor::eEditorSkipSpellCheck) != 0;
|
||||
|
|
|
@ -20,9 +20,9 @@ class nsBaseEditorCommand : public nsIControllerCommand
|
|||
{
|
||||
public:
|
||||
nsBaseEditorCommand();
|
||||
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
||||
NS_IMETHOD IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval) override = 0;
|
||||
NS_IMETHOD DoCommand(const char *aCommandName, nsISupports *aCommandRefCon) override = 0;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ class nsIControllerCommandTable;
|
|||
// the editor controller is used for both text widgets, and basic text editing
|
||||
// commands in composer. The refCon that gets passed to its commands is an nsIEditor.
|
||||
|
||||
class nsEditorController
|
||||
class nsEditorController
|
||||
{
|
||||
public:
|
||||
static nsresult RegisterEditorCommands(nsIControllerCommandTable* inCommandTable);
|
||||
|
|
|
@ -106,7 +106,7 @@ nsEditorEventListener::nsEditorEventListener()
|
|||
{
|
||||
}
|
||||
|
||||
nsEditorEventListener::~nsEditorEventListener()
|
||||
nsEditorEventListener::~nsEditorEventListener()
|
||||
{
|
||||
if (mEditor) {
|
||||
NS_WARNING("We're not uninstalled");
|
||||
|
@ -685,7 +685,7 @@ nsEditorEventListener::MouseClick(nsIDOMMouseEvent* aMouseEvent)
|
|||
return rv;
|
||||
}
|
||||
|
||||
// If we got a mouse down inside the editing area, we should force the
|
||||
// If we got a mouse down inside the editing area, we should force the
|
||||
// IME to commit before we change the cursor position
|
||||
mEditor->ForceCompositionEnd();
|
||||
|
||||
|
@ -721,7 +721,7 @@ nsEditorEventListener::HandleMiddleClickPaste(nsIDOMMouseEvent* aMouseEvent)
|
|||
}
|
||||
|
||||
// If the ctrl key is pressed, we'll do paste as quotation.
|
||||
// Would've used the alt key, but the kde wmgr treats alt-middle specially.
|
||||
// Would've used the alt key, but the kde wmgr treats alt-middle specially.
|
||||
bool ctrlKey = false;
|
||||
aMouseEvent->GetCtrlKey(&ctrlKey);
|
||||
|
||||
|
@ -923,8 +923,8 @@ nsEditorEventListener::Drop(nsIDOMDragEvent* aDragEvent)
|
|||
if ((mEditor->IsReadonly() || mEditor->IsDisabled()) &&
|
||||
!IsFileControlTextBox()) {
|
||||
// it was decided to "eat" the event as this is the "least surprise"
|
||||
// since someone else handling it might be unintentional and the
|
||||
// user could probably re-drag to be not over the disabled/readonly
|
||||
// since someone else handling it might be unintentional and the
|
||||
// user could probably re-drag to be not over the disabled/readonly
|
||||
// editfields if that is what is desired.
|
||||
return aDragEvent->StopPropagation();
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ using namespace mozilla::dom;
|
|||
|
||||
nsAutoSelectionReset::nsAutoSelectionReset(Selection* aSel, nsEditor* aEd)
|
||||
: mSel(nullptr), mEd(nullptr)
|
||||
{
|
||||
{
|
||||
if (!aSel || !aEd) return; // not much we can do, bail.
|
||||
if (aEd->ArePreservingSelection()) return; // we already have initted mSavedSel, so this must be nested call.
|
||||
mSel = aSel;
|
||||
|
@ -178,7 +178,7 @@ nsEditorHookUtils::GetHookEnumeratorFromDocument(nsIDOMDocument *aDoc,
|
|||
}
|
||||
|
||||
bool
|
||||
nsEditorHookUtils::DoInsertionHook(nsIDOMDocument *aDoc, nsIDOMEvent *aDropEvent,
|
||||
nsEditorHookUtils::DoInsertionHook(nsIDOMDocument *aDoc, nsIDOMEvent *aDropEvent,
|
||||
nsITransferable *aTrans)
|
||||
{
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
|
|
|
@ -27,7 +27,7 @@ class Selection;
|
|||
}
|
||||
|
||||
/***************************************************************************
|
||||
* stack based helper class for batching a collection of txns inside a
|
||||
* stack based helper class for batching a collection of txns inside a
|
||||
* placeholder txn.
|
||||
*/
|
||||
class MOZ_STACK_CLASS nsAutoPlaceHolderBatch
|
||||
|
@ -35,13 +35,13 @@ class MOZ_STACK_CLASS nsAutoPlaceHolderBatch
|
|||
private:
|
||||
nsCOMPtr<nsIEditor> mEd;
|
||||
public:
|
||||
nsAutoPlaceHolderBatch( nsIEditor *aEd, nsIAtom *atom) : mEd(do_QueryInterface(aEd))
|
||||
nsAutoPlaceHolderBatch( nsIEditor *aEd, nsIAtom *atom) : mEd(do_QueryInterface(aEd))
|
||||
{ if (mEd) mEd->BeginPlaceHolderTransaction(atom); }
|
||||
~nsAutoPlaceHolderBatch() { if (mEd) mEd->EndPlaceHolderTransaction(); }
|
||||
};
|
||||
|
||||
/***************************************************************************
|
||||
* stack based helper class for batching a collection of txns.
|
||||
* stack based helper class for batching a collection of txns.
|
||||
* Note: I changed this to use placeholder batching so that we get
|
||||
* proper selection save/restore across undo/redo.
|
||||
*/
|
||||
|
@ -66,7 +66,7 @@ class MOZ_STACK_CLASS nsAutoSelectionReset
|
|||
public:
|
||||
/** constructor responsible for remembering all state needed to restore aSel */
|
||||
nsAutoSelectionReset(mozilla::dom::Selection* aSel, nsEditor* aEd);
|
||||
|
||||
|
||||
/** destructor restores mSel to its former state */
|
||||
~nsAutoSelectionReset();
|
||||
|
||||
|
@ -80,25 +80,25 @@ class MOZ_STACK_CLASS nsAutoSelectionReset
|
|||
class MOZ_STACK_CLASS nsAutoRules
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
nsAutoRules(nsEditor *ed, EditAction action,
|
||||
nsIEditor::EDirection aDirection) :
|
||||
mEd(ed), mDoNothing(false)
|
||||
{
|
||||
{
|
||||
if (mEd && !mEd->mAction) // mAction will already be set if this is nested call
|
||||
{
|
||||
mEd->StartOperation(action, aDirection);
|
||||
}
|
||||
else mDoNothing = true; // nested calls will end up here
|
||||
}
|
||||
~nsAutoRules()
|
||||
~nsAutoRules()
|
||||
{
|
||||
if (mEd && !mDoNothing)
|
||||
if (mEd && !mDoNothing)
|
||||
{
|
||||
mEd->EndOperation();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
nsEditor *mEd;
|
||||
bool mDoNothing;
|
||||
|
@ -112,24 +112,24 @@ class MOZ_STACK_CLASS nsAutoRules
|
|||
class MOZ_STACK_CLASS nsAutoTxnsConserveSelection
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
explicit nsAutoTxnsConserveSelection(nsEditor *ed) : mEd(ed), mOldState(true)
|
||||
{
|
||||
if (mEd)
|
||||
if (mEd)
|
||||
{
|
||||
mOldState = mEd->GetShouldTxnSetSelection();
|
||||
mEd->SetShouldTxnSetSelection(false);
|
||||
}
|
||||
}
|
||||
|
||||
~nsAutoTxnsConserveSelection()
|
||||
|
||||
~nsAutoTxnsConserveSelection()
|
||||
{
|
||||
if (mEd)
|
||||
if (mEd)
|
||||
{
|
||||
mEd->SetShouldTxnSetSelection(mOldState);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
nsEditor *mEd;
|
||||
bool mOldState;
|
||||
|
@ -141,21 +141,21 @@ class MOZ_STACK_CLASS nsAutoTxnsConserveSelection
|
|||
class MOZ_STACK_CLASS nsAutoUpdateViewBatch
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
explicit nsAutoUpdateViewBatch(nsEditor *ed) : mEd(ed)
|
||||
{
|
||||
NS_ASSERTION(mEd, "null mEd pointer!");
|
||||
|
||||
if (mEd)
|
||||
if (mEd)
|
||||
mEd->BeginUpdateViewBatch();
|
||||
}
|
||||
|
||||
~nsAutoUpdateViewBatch()
|
||||
|
||||
~nsAutoUpdateViewBatch()
|
||||
{
|
||||
if (mEd)
|
||||
if (mEd)
|
||||
mEd->EndUpdateViewBatch();
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
nsEditor *mEd;
|
||||
};
|
||||
|
@ -164,7 +164,7 @@ class MOZ_STACK_CLASS nsAutoUpdateViewBatch
|
|||
* some helper classes for iterating the dom tree
|
||||
*****************************************************************************/
|
||||
|
||||
class nsBoolDomIterFunctor
|
||||
class nsBoolDomIterFunctor
|
||||
{
|
||||
public:
|
||||
virtual bool operator()(nsINode* aNode) const = 0;
|
||||
|
|
|
@ -62,7 +62,7 @@ nsHTMLEditor::AbsolutePositionSelection(bool aEnabled)
|
|||
aEnabled ? EditAction::setAbsolutePosition :
|
||||
EditAction::removeAbsolutePosition,
|
||||
nsIEditor::eNext);
|
||||
|
||||
|
||||
// the line below does not match the code; should it be removed?
|
||||
// Find out if the selection is collapsed:
|
||||
nsRefPtr<Selection> selection = GetSelection();
|
||||
|
@ -76,7 +76,7 @@ nsHTMLEditor::AbsolutePositionSelection(bool aEnabled)
|
|||
nsresult res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
|
||||
if (NS_FAILED(res) || cancel)
|
||||
return res;
|
||||
|
||||
|
||||
return mRules->DidDoAction(selection, &ruleInfo, res);
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ nsHTMLEditor::GetAbsolutelyPositionedSelectionContainer(nsIDOMElement **_retval)
|
|||
}
|
||||
}
|
||||
|
||||
element = do_QueryInterface(resultNode );
|
||||
element = do_QueryInterface(resultNode );
|
||||
*_retval = element;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
|
@ -171,7 +171,7 @@ nsHTMLEditor::RelativeChangeZIndex(int32_t aChange)
|
|||
(aChange < 0) ? EditAction::decreaseZIndex :
|
||||
EditAction::increaseZIndex,
|
||||
nsIEditor::eNext);
|
||||
|
||||
|
||||
// brade: can we get rid of this comment?
|
||||
// Find out if the selection is collapsed:
|
||||
nsRefPtr<Selection> selection = GetSelection();
|
||||
|
@ -184,7 +184,7 @@ nsHTMLEditor::RelativeChangeZIndex(int32_t aChange)
|
|||
nsresult res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
|
||||
if (cancel || NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
|
||||
return mRules->DidDoAction(selection, &ruleInfo, res);
|
||||
}
|
||||
|
||||
|
@ -620,7 +620,7 @@ nsHTMLEditor::CheckPositionedElementBGandFG(nsIDOMElement * aElement,
|
|||
NS_ENSURE_STATE(element || !aElement);
|
||||
|
||||
aReturn.Truncate();
|
||||
|
||||
|
||||
nsAutoString bgImageStr;
|
||||
nsresult res =
|
||||
mHTMLCSSUtils->GetComputedProperty(*element, *nsGkAtoms::background_image,
|
||||
|
|
|
@ -150,14 +150,14 @@ void ProcessMarginLeftValue(const nsAString * aInputString, nsAString & aOutputS
|
|||
if (aInputString) {
|
||||
if (aInputString->EqualsLiteral("center") ||
|
||||
aInputString->EqualsLiteral("-moz-center")) {
|
||||
aOutputString.AppendLiteral("auto");
|
||||
aOutputString.AppendLiteral("auto");
|
||||
}
|
||||
else if (aInputString->EqualsLiteral("right") ||
|
||||
aInputString->EqualsLiteral("-moz-right")) {
|
||||
aOutputString.AppendLiteral("auto");
|
||||
aOutputString.AppendLiteral("auto");
|
||||
}
|
||||
else {
|
||||
aOutputString.AppendLiteral("0px");
|
||||
aOutputString.AppendLiteral("0px");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -171,14 +171,14 @@ void ProcessMarginRightValue(const nsAString * aInputString, nsAString & aOutput
|
|||
if (aInputString) {
|
||||
if (aInputString->EqualsLiteral("center") ||
|
||||
aInputString->EqualsLiteral("-moz-center")) {
|
||||
aOutputString.AppendLiteral("auto");
|
||||
aOutputString.AppendLiteral("auto");
|
||||
}
|
||||
else if (aInputString->EqualsLiteral("left") ||
|
||||
aInputString->EqualsLiteral("-moz-left")) {
|
||||
aOutputString.AppendLiteral("auto");
|
||||
aOutputString.AppendLiteral("auto");
|
||||
}
|
||||
else {
|
||||
aOutputString.AppendLiteral("0px");
|
||||
aOutputString.AppendLiteral("0px");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1190,7 +1190,7 @@ nsHTMLCSSUtils::IsCSSPrefChecked()
|
|||
}
|
||||
|
||||
// ElementsSameStyle compares two elements and checks if they have the same
|
||||
// specified CSS declarations in the STYLE attribute
|
||||
// specified CSS declarations in the STYLE attribute
|
||||
// The answer is always negative if at least one of them carries an ID or a class
|
||||
bool
|
||||
nsHTMLCSSUtils::ElementsSameStyle(nsIDOMNode *aFirstNode, nsIDOMNode *aSecondNode)
|
||||
|
|
|
@ -285,7 +285,7 @@ public:
|
|||
bool IsCSSPrefChecked();
|
||||
|
||||
/** ElementsSameStyle compares two elements and checks if they have the same
|
||||
* specified CSS declarations in the STYLE attribute
|
||||
* specified CSS declarations in the STYLE attribute
|
||||
* The answer is always false if at least one of them carries an ID or a class
|
||||
*
|
||||
* @return true if the two elements are considered to have same styles
|
||||
|
@ -404,7 +404,7 @@ private:
|
|||
|
||||
private:
|
||||
nsHTMLEditor *mHTMLEditor;
|
||||
bool mIsCSSPrefChecked;
|
||||
bool mIsCSSPrefChecked;
|
||||
};
|
||||
|
||||
#define NS_EDITOR_INDENT_INCREMENT_IN 0.4134f
|
||||
|
@ -415,6 +415,6 @@ private:
|
|||
#define NS_EDITOR_INDENT_INCREMENT_EM 3
|
||||
#define NS_EDITOR_INDENT_INCREMENT_EX 6
|
||||
#define NS_EDITOR_INDENT_INCREMENT_PX 40
|
||||
#define NS_EDITOR_INDENT_INCREMENT_PERCENT 4
|
||||
#define NS_EDITOR_INDENT_INCREMENT_PERCENT 4
|
||||
|
||||
#endif /* nsHTMLCSSUtils_h__ */
|
||||
|
|
|
@ -96,7 +96,7 @@ using namespace mozilla::dom;
|
|||
#define kInsertCookie "_moz_Insert Here_moz_"
|
||||
|
||||
// some little helpers
|
||||
static bool FindIntegerAfterString(const char *aLeadingString,
|
||||
static bool FindIntegerAfterString(const char *aLeadingString,
|
||||
nsCString &aCStr, int32_t &foundNumber);
|
||||
static nsresult RemoveFragComments(nsCString &theStr);
|
||||
static void RemoveBodyAndHead(nsINode& aNode);
|
||||
|
@ -330,7 +330,7 @@ nsHTMLEditor::DoInsertHTMLWithContext(const nsAString & aInputString,
|
|||
// do we have table content to paste? If so, we want to delete
|
||||
// the selected table cells and replace with new table elements;
|
||||
// but if not we want to delete _contents_ of cells and replace
|
||||
// with non-table elements. Use cellSelectionMode bool to
|
||||
// with non-table elements. Use cellSelectionMode bool to
|
||||
// indicate results.
|
||||
if (!nsHTMLEditUtils::IsTableElement(nodeList[0])) {
|
||||
cellSelectionMode = false;
|
||||
|
@ -423,8 +423,8 @@ nsHTMLEditor::DoInsertHTMLWithContext(const nsAString & aInputString,
|
|||
startListAndTableArray);
|
||||
}
|
||||
|
||||
// if we have pieces of tables or lists to be inserted, let's force the paste
|
||||
// to deal with table elements right away, so that it doesn't orphan some
|
||||
// if we have pieces of tables or lists to be inserted, let's force the paste
|
||||
// to deal with table elements right away, so that it doesn't orphan some
|
||||
// table or list contents outside the table or list.
|
||||
if (highWaterMark >= 0)
|
||||
{
|
||||
|
@ -470,7 +470,7 @@ nsHTMLEditor::DoInsertHTMLWithContext(const nsAString & aInputString,
|
|||
|
||||
if (insertedContextParent)
|
||||
{
|
||||
// if we had to insert something higher up in the paste hierarchy, we want to
|
||||
// if we had to insert something higher up in the paste hierarchy, we want to
|
||||
// skip any further paste nodes that descend from that. Else we will paste twice.
|
||||
if (nsEditorUtils::IsDescendantOf(curNode, insertedContextParent))
|
||||
continue;
|
||||
|
@ -501,7 +501,7 @@ nsHTMLEditor::DoInsertHTMLWithContext(const nsAString & aInputString,
|
|||
// a list on the clipboard, and are trying to insert
|
||||
// into a list or list item, insert the appropriate children instead,
|
||||
// ie, merge the lists instead of pasting in a sublist.
|
||||
else if (nsHTMLEditUtils::IsList(curNode) &&
|
||||
else if (nsHTMLEditUtils::IsList(curNode) &&
|
||||
(nsHTMLEditUtils::IsList(parentNode) || nsHTMLEditUtils::IsListItem(parentNode)) )
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> child, tmp;
|
||||
|
@ -599,7 +599,7 @@ nsHTMLEditor::DoInsertHTMLWithContext(const nsAString & aInputString,
|
|||
}
|
||||
|
||||
// Now collapse the selection to the end of what we just inserted:
|
||||
if (lastInsertNode)
|
||||
if (lastInsertNode)
|
||||
{
|
||||
// set selection to the end of what we just pasted.
|
||||
nsCOMPtr<nsIDOMNode> selNode, tmp, highTable;
|
||||
|
@ -649,7 +649,7 @@ nsHTMLEditor::DoInsertHTMLWithContext(const nsAString & aInputString,
|
|||
wsRunObj.PriorVisibleNode(selNode_, selOffset, address_of(visNode),
|
||||
&outVisOffset, &visType);
|
||||
if (visType == WSType::br) {
|
||||
// we are after a break. Is it visible? Despite the name,
|
||||
// we are after a break. Is it visible? Despite the name,
|
||||
// PriorVisibleNode does not make that determination for breaks.
|
||||
// It also may not return the break in visNode. We have to pull it
|
||||
// out of the nsWSRunObject's state.
|
||||
|
@ -667,7 +667,7 @@ nsHTMLEditor::DoInsertHTMLWithContext(const nsAString & aInputString,
|
|||
selNode = GetAsDOMNode(visNode);
|
||||
selOffset = outVisOffset; // PriorVisibleNode already set offset to _after_ the text or ws
|
||||
} else if (visType == WSType::special) {
|
||||
// prior visible thing is an image or some other non-text thingy.
|
||||
// prior visible thing is an image or some other non-text thingy.
|
||||
// We want to be right after it.
|
||||
selNode = GetNodeLocation(GetAsDOMNode(wsRunObj.mStartReasonNode), &selOffset);
|
||||
++selOffset;
|
||||
|
@ -721,15 +721,15 @@ nsHTMLEditor::RemoveInsertionListener(nsIContentFilter *aListener)
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::DoContentFilterCallback(const nsAString &aFlavor,
|
||||
nsHTMLEditor::DoContentFilterCallback(const nsAString &aFlavor,
|
||||
nsIDOMDocument *sourceDoc,
|
||||
bool aWillDeleteSelection,
|
||||
nsIDOMNode **aFragmentAsNode,
|
||||
nsIDOMNode **aFragStartNode,
|
||||
nsIDOMNode **aFragmentAsNode,
|
||||
nsIDOMNode **aFragStartNode,
|
||||
int32_t *aFragStartOffset,
|
||||
nsIDOMNode **aFragEndNode,
|
||||
nsIDOMNode **aFragEndNode,
|
||||
int32_t *aFragEndOffset,
|
||||
nsIDOMNode **aTargetNode,
|
||||
int32_t *aTargetOffset,
|
||||
|
@ -760,7 +760,7 @@ nsHTMLEditor::IsInLink(nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *outLink)
|
|||
nsCOMPtr<nsIDOMNode> tmp, node = aNode;
|
||||
while (node)
|
||||
{
|
||||
if (nsHTMLEditUtils::IsLink(node))
|
||||
if (nsHTMLEditUtils::IsLink(node))
|
||||
{
|
||||
if (outLink)
|
||||
*outLink = node;
|
||||
|
@ -825,7 +825,7 @@ nsHTMLEditor::PrepareHTMLTransferable(nsITransferable **aTransferable,
|
|||
// This should only happen in html editors, not plaintext
|
||||
if (!IsPlaintextEditor())
|
||||
{
|
||||
if (!aHavePrivFlavor)
|
||||
if (!aHavePrivFlavor)
|
||||
{
|
||||
(*aTransferable)->AddDataFlavor(kNativeHTMLMime);
|
||||
}
|
||||
|
@ -858,12 +858,12 @@ nsHTMLEditor::PrepareHTMLTransferable(nsITransferable **aTransferable,
|
|||
(*aTransferable)->AddDataFlavor(kUnicodeMime);
|
||||
(*aTransferable)->AddDataFlavor(kMozTextInternal);
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
FindIntegerAfterString(const char *aLeadingString,
|
||||
FindIntegerAfterString(const char *aLeadingString,
|
||||
nsCString &aCStr, int32_t &foundNumber)
|
||||
{
|
||||
// first obtain offsets from cfhtml str
|
||||
|
@ -908,16 +908,16 @@ nsHTMLEditor::ParseCFHTML(nsCString & aCfhtml, char16_t **aStuffToPaste, char16_
|
|||
{
|
||||
// First obtain offsets from cfhtml str.
|
||||
int32_t startHTML, endHTML, startFragment, endFragment;
|
||||
if (!FindIntegerAfterString("StartHTML:", aCfhtml, startHTML) ||
|
||||
if (!FindIntegerAfterString("StartHTML:", aCfhtml, startHTML) ||
|
||||
startHTML < -1)
|
||||
return NS_ERROR_FAILURE;
|
||||
if (!FindIntegerAfterString("EndHTML:", aCfhtml, endHTML) ||
|
||||
if (!FindIntegerAfterString("EndHTML:", aCfhtml, endHTML) ||
|
||||
endHTML < -1)
|
||||
return NS_ERROR_FAILURE;
|
||||
if (!FindIntegerAfterString("StartFragment:", aCfhtml, startFragment) ||
|
||||
if (!FindIntegerAfterString("StartFragment:", aCfhtml, startFragment) ||
|
||||
startFragment < 0)
|
||||
return NS_ERROR_FAILURE;
|
||||
if (!FindIntegerAfterString("EndFragment:", aCfhtml, endFragment) ||
|
||||
if (!FindIntegerAfterString("EndFragment:", aCfhtml, endFragment) ||
|
||||
startFragment < 0)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -954,10 +954,10 @@ nsHTMLEditor::ParseCFHTML(nsCString & aCfhtml, char16_t **aStuffToPaste, char16_
|
|||
// so StartFragment is good, so do nothing.
|
||||
break;
|
||||
}
|
||||
else if (aCfhtml[curPos] == '<')
|
||||
else if (aCfhtml[curPos] == '<')
|
||||
{
|
||||
// if we are at the start, then we want to see the '<'
|
||||
if (curPos != startFragment)
|
||||
if (curPos != startFragment)
|
||||
{
|
||||
// working backwards, the first thing we see is the start of a tag
|
||||
// so StartFragment is bad, so we need to update it.
|
||||
|
@ -966,7 +966,7 @@ nsHTMLEditor::ParseCFHTML(nsCString & aCfhtml, char16_t **aStuffToPaste, char16_
|
|||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
curPos--;
|
||||
}
|
||||
|
@ -989,8 +989,8 @@ nsHTMLEditor::ParseCFHTML(nsCString & aCfhtml, char16_t **aStuffToPaste, char16_
|
|||
int32_t oldLengthInChars = fragUcs2Str.Length() + 1; // +1 to include null terminator
|
||||
int32_t newLengthInChars = 0;
|
||||
*aStuffToPaste = nsLinebreakConverter::ConvertUnicharLineBreaks(fragUcs2Str.get(),
|
||||
nsLinebreakConverter::eLinebreakAny,
|
||||
nsLinebreakConverter::eLinebreakContent,
|
||||
nsLinebreakConverter::eLinebreakAny,
|
||||
nsLinebreakConverter::eLinebreakContent,
|
||||
oldLengthInChars, &newLengthInChars);
|
||||
NS_ENSURE_TRUE(*aStuffToPaste, NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -998,8 +998,8 @@ nsHTMLEditor::ParseCFHTML(nsCString & aCfhtml, char16_t **aStuffToPaste, char16_
|
|||
oldLengthInChars = cntxtUcs2Str.Length() + 1; // +1 to include null terminator
|
||||
newLengthInChars = 0;
|
||||
*aCfcontext = nsLinebreakConverter::ConvertUnicharLineBreaks(cntxtUcs2Str.get(),
|
||||
nsLinebreakConverter::eLinebreakAny,
|
||||
nsLinebreakConverter::eLinebreakContent,
|
||||
nsLinebreakConverter::eLinebreakAny,
|
||||
nsLinebreakConverter::eLinebreakContent,
|
||||
oldLengthInChars, &newLengthInChars);
|
||||
// it's ok for context to be empty. frag might be whole doc and contain all its context.
|
||||
|
||||
|
@ -1084,7 +1084,7 @@ nsresult nsHTMLEditor::InsertObject(const char* aType, nsISupports* aObject, boo
|
|||
AppendUTF8toUTF16(data64, stuffToPaste);
|
||||
stuffToPaste.AppendLiteral("\" alt=\"\" >");
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
rv = DoInsertHTMLWithContext(stuffToPaste, EmptyString(), EmptyString(),
|
||||
rv = DoInsertHTMLWithContext(stuffToPaste, EmptyString(), EmptyString(),
|
||||
NS_LITERAL_STRING(kFileMime),
|
||||
aSourceDoc,
|
||||
aDestinationNode, aDestOffset,
|
||||
|
@ -1413,7 +1413,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteTransferable(nsITransferable *aTransferable)
|
|||
nullptr, 0, true);
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// HTML PasteNoFormatting. Ignore any HTML styles and formating in paste source
|
||||
//
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteNoFormatting(int32_t aSelectionType)
|
||||
|
@ -1434,7 +1434,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteNoFormatting(int32_t aSelectionType)
|
|||
rv = nsPlaintextEditor::PrepareTransferable(getter_AddRefs(trans));
|
||||
if (NS_SUCCEEDED(rv) && trans)
|
||||
{
|
||||
// Get the Data from the clipboard
|
||||
// Get the Data from the clipboard
|
||||
if (NS_SUCCEEDED(clipboard->GetData(trans, aSelectionType)) && IsModifiable())
|
||||
{
|
||||
const nsAFlatString& empty = EmptyString();
|
||||
|
@ -2182,7 +2182,7 @@ nsHTMLEditor::DiscoverPartialListsAndTables(nsTArray<OwningNonNull<nsINode>>& aP
|
|||
{
|
||||
int32_t ret = -1;
|
||||
int32_t listAndTableParents = aListsAndTables.Length();
|
||||
|
||||
|
||||
// Scan insertion list for table elements (other than table).
|
||||
for (auto& curNode : aPasteNodes) {
|
||||
if (nsHTMLEditUtils::IsTableElement(curNode) &&
|
||||
|
@ -2230,7 +2230,7 @@ nsHTMLEditor::ScanForListAndTableStructure(StartOrEnd aStartOrEnd,
|
|||
// Look upward from first/last paste node for a piece of this list/table
|
||||
int32_t idx = aStartOrEnd == StartOrEnd::end ? aNodes.Length() - 1 : 0;
|
||||
bool isList = nsHTMLEditUtils::IsList(&aListOrTable);
|
||||
|
||||
|
||||
for (nsCOMPtr<nsINode> node = aNodes[idx]; node;
|
||||
node = node->GetParentNode()) {
|
||||
if ((isList && nsHTMLEditUtils::IsListItem(node)) ||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -41,12 +41,12 @@ struct DOMPoint;
|
|||
struct StyleCache : public PropItem
|
||||
{
|
||||
bool mPresent;
|
||||
|
||||
|
||||
StyleCache() : PropItem(), mPresent(false) {
|
||||
MOZ_COUNT_CTOR(StyleCache);
|
||||
}
|
||||
|
||||
StyleCache(nsIAtom *aTag, const nsAString &aAttr, const nsAString &aValue) :
|
||||
StyleCache(nsIAtom *aTag, const nsAString &aAttr, const nsAString &aValue) :
|
||||
PropItem(aTag, aAttr, aValue), mPresent(false) {
|
||||
MOZ_COUNT_CTOR(StyleCache);
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public:
|
|||
nsresult MakeSureElemStartsOrEndsOnCR(nsIDOMNode *aNode);
|
||||
|
||||
// nsIEditActionListener methods
|
||||
|
||||
|
||||
NS_IMETHOD WillCreateNode(const nsAString& aTag, nsIDOMNode *aParent, int32_t aPosition) override;
|
||||
NS_IMETHOD DidCreateNode(const nsAString& aTag, nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aPosition, nsresult aResult) override;
|
||||
NS_IMETHOD WillInsertNode(nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aPosition) override;
|
||||
|
@ -144,8 +144,8 @@ protected:
|
|||
nsIEditor::EDirection aAction,
|
||||
nsIEditor::EStripWrappers aStripWrappers,
|
||||
bool* aCancel, bool* aHandled);
|
||||
nsresult DidDeleteSelection(mozilla::dom::Selection* aSelection,
|
||||
nsIEditor::EDirection aDir,
|
||||
nsresult DidDeleteSelection(mozilla::dom::Selection* aSelection,
|
||||
nsIEditor::EDirection aDir,
|
||||
nsresult aResult);
|
||||
nsresult InsertBRIfNeeded(mozilla::dom::Selection* aSelection);
|
||||
::DOMPoint GetGoodSelPointForNode(nsINode& aNode,
|
||||
|
@ -210,9 +210,9 @@ protected:
|
|||
nsIDOMNode* aHeader, nsIDOMNode* aTextNode,
|
||||
int32_t aOffset, bool* aCancel, bool* aHandled);
|
||||
nsresult SplitParagraph(nsIDOMNode *aPara,
|
||||
nsIDOMNode *aBRNode,
|
||||
nsIDOMNode *aBRNode,
|
||||
mozilla::dom::Selection* aSelection,
|
||||
nsCOMPtr<nsIDOMNode> *aSelNode,
|
||||
nsCOMPtr<nsIDOMNode> *aSelNode,
|
||||
int32_t *aOffset);
|
||||
nsresult ReturnInListItem(mozilla::dom::Selection* aSelection,
|
||||
nsIDOMNode* aHeader, nsIDOMNode* aTextNode,
|
||||
|
@ -222,14 +222,14 @@ protected:
|
|||
nsresult RemovePartOfBlock(mozilla::dom::Element& aBlock,
|
||||
nsIContent& aStartChild,
|
||||
nsIContent& aEndChild);
|
||||
nsresult SplitBlock(nsIDOMNode *aBlock,
|
||||
nsIDOMNode *aStartChild,
|
||||
nsresult SplitBlock(nsIDOMNode *aBlock,
|
||||
nsIDOMNode *aStartChild,
|
||||
nsIDOMNode *aEndChild,
|
||||
nsCOMPtr<nsIDOMNode> *aLeftNode = 0,
|
||||
nsCOMPtr<nsIDOMNode> *aRightNode = 0,
|
||||
nsCOMPtr<nsIDOMNode> *aMiddleNode = 0);
|
||||
nsresult OutdentPartOfBlock(nsIDOMNode *aBlock,
|
||||
nsIDOMNode *aStartChild,
|
||||
nsresult OutdentPartOfBlock(nsIDOMNode *aBlock,
|
||||
nsIDOMNode *aStartChild,
|
||||
nsIDOMNode *aEndChild,
|
||||
bool aIsBlockIndentedWithCSS,
|
||||
nsCOMPtr<nsIDOMNode> *aLeftNode = 0,
|
||||
|
@ -246,15 +246,15 @@ protected:
|
|||
|
||||
nsresult CreateStyleForInsertText(mozilla::dom::Selection* aSelection,
|
||||
nsIDOMDocument* aDoc);
|
||||
nsresult IsEmptyBlock(nsIDOMNode *aNode,
|
||||
bool *outIsEmptyBlock,
|
||||
nsresult IsEmptyBlock(nsIDOMNode *aNode,
|
||||
bool *outIsEmptyBlock,
|
||||
bool aMozBRDoesntCount = false,
|
||||
bool aListItemsNotEmpty = false);
|
||||
nsresult CheckForEmptyBlock(nsINode* aStartNode,
|
||||
mozilla::dom::Element* aBodyNode,
|
||||
mozilla::dom::Selection* aSelection,
|
||||
bool* aHandled);
|
||||
nsresult CheckForInvisibleBR(nsIDOMNode *aBlock, nsHTMLEditRules::BRLocation aWhere,
|
||||
nsresult CheckForInvisibleBR(nsIDOMNode *aBlock, nsHTMLEditRules::BRLocation aWhere,
|
||||
nsCOMPtr<nsIDOMNode> *outBRNode, int32_t aOffset=0);
|
||||
nsresult ExpandSelectionForDeletion(mozilla::dom::Selection* aSelection);
|
||||
bool IsFirstNode(nsIDOMNode *aNode);
|
||||
|
@ -263,7 +263,7 @@ protected:
|
|||
void GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode* aNode,
|
||||
int32_t aOffset, EditAction actionID,
|
||||
nsCOMPtr<nsIDOMNode>* outNode, int32_t* outOffset);
|
||||
void GetPromotedRanges(mozilla::dom::Selection& aSelection,
|
||||
void GetPromotedRanges(mozilla::dom::Selection& aSelection,
|
||||
nsTArray<nsRefPtr<nsRange>>& outArrayOfRanges,
|
||||
EditAction inOperationType);
|
||||
void PromoteRange(nsRange& aRange, EditAction inOperationType);
|
||||
|
@ -317,8 +317,8 @@ protected:
|
|||
nsresult CheckInterlinePosition(mozilla::dom::Selection* aSelection);
|
||||
nsresult AdjustSelection(mozilla::dom::Selection* aSelection,
|
||||
nsIEditor::EDirection aAction);
|
||||
nsresult FindNearSelectableNode(nsIDOMNode *aSelNode,
|
||||
int32_t aSelOffset,
|
||||
nsresult FindNearSelectableNode(nsIDOMNode *aSelNode,
|
||||
int32_t aSelOffset,
|
||||
nsIEditor::EDirection &aDirection,
|
||||
nsCOMPtr<nsIDOMNode> *outSelectableNode);
|
||||
/**
|
||||
|
|
|
@ -28,8 +28,8 @@ using namespace mozilla;
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsInlineStyle true if node is an inline style
|
||||
//
|
||||
bool
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsInlineStyle(nsIDOMNode* aNode)
|
||||
{
|
||||
NS_PRECONDITION(aNode, "null parent passed to nsHTMLEditUtils::IsInlineStyle");
|
||||
|
@ -56,7 +56,7 @@ nsHTMLEditUtils::IsInlineStyle(nsINode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsFormatNode true if node is a format node
|
||||
//
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsFormatNode(nsIDOMNode* aNode)
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ nsHTMLEditUtils::IsFormatNode(nsINode* aNode)
|
|||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsNodeThatCanOutdent true if node is a list, list item, or blockquote
|
||||
// IsNodeThatCanOutdent true if node is a list, list item, or blockquote
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsNodeThatCanOutdent(nsIDOMNode* aNode)
|
||||
|
@ -100,11 +100,11 @@ nsHTMLEditUtils::IsNodeThatCanOutdent(nsIDOMNode* aNode)
|
|||
/********************************************************
|
||||
* helper methods from nsHTMLEditRules
|
||||
********************************************************/
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsHeader: true if node an html header
|
||||
//
|
||||
bool
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsHeader(nsINode& aNode)
|
||||
{
|
||||
return aNode.IsAnyOfHTMLElements(nsGkAtoms::h1,
|
||||
|
@ -126,8 +126,8 @@ nsHTMLEditUtils::IsHeader(nsIDOMNode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsParagraph: true if node an html paragraph
|
||||
//
|
||||
bool
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsParagraph(nsIDOMNode* aNode)
|
||||
{
|
||||
return nsEditor::NodeIsType(aNode, nsGkAtoms::p);
|
||||
|
@ -136,8 +136,8 @@ nsHTMLEditUtils::IsParagraph(nsIDOMNode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsHR: true if node an horizontal rule
|
||||
//
|
||||
bool
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsHR(nsIDOMNode* aNode)
|
||||
{
|
||||
return nsEditor::NodeIsType(aNode, nsGkAtoms::hr);
|
||||
|
@ -146,8 +146,8 @@ nsHTMLEditUtils::IsHR(nsIDOMNode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsListItem: true if node an html list item
|
||||
//
|
||||
bool
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsListItem(nsIDOMNode* aNode)
|
||||
{
|
||||
NS_PRECONDITION(aNode, "null parent passed to nsHTMLEditUtils::IsListItem");
|
||||
|
@ -167,7 +167,7 @@ nsHTMLEditUtils::IsListItem(nsINode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsTableElement: true if node an html table, td, tr, ...
|
||||
//
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsTableElement(nsIDOMNode* aNode)
|
||||
{
|
||||
|
@ -192,8 +192,8 @@ nsHTMLEditUtils::IsTableElement(nsINode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsTableElementButNotTable: true if node an html td, tr, ... (doesn't include table)
|
||||
//
|
||||
bool
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsTableElementButNotTable(nsIDOMNode* aNode)
|
||||
{
|
||||
NS_PRECONDITION(aNode, "null node passed to nsHTMLEditor::IsTableElementButNotTable");
|
||||
|
@ -216,7 +216,7 @@ nsHTMLEditUtils::IsTableElementButNotTable(nsINode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsTable: true if node an html table
|
||||
//
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsTable(nsIDOMNode* aNode)
|
||||
{
|
||||
|
@ -231,8 +231,8 @@ nsHTMLEditUtils::IsTable(nsINode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsTableRow: true if node an html tr
|
||||
//
|
||||
bool
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsTableRow(nsIDOMNode* aNode)
|
||||
{
|
||||
return nsEditor::NodeIsType(aNode, nsGkAtoms::tr);
|
||||
|
@ -241,8 +241,8 @@ nsHTMLEditUtils::IsTableRow(nsIDOMNode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsTableCell: true if node an html td or th
|
||||
//
|
||||
bool
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsTableCell(nsIDOMNode* aNode)
|
||||
{
|
||||
NS_PRECONDITION(aNode, "null parent passed to nsHTMLEditUtils::IsTableCell");
|
||||
|
@ -260,8 +260,8 @@ nsHTMLEditUtils::IsTableCell(nsINode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsTableCell: true if node an html td or th
|
||||
//
|
||||
bool
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsTableCellOrCaption(nsIDOMNode* aNode)
|
||||
{
|
||||
NS_PRECONDITION(aNode, "null parent passed to nsHTMLEditUtils::IsTableCell");
|
||||
|
@ -274,7 +274,7 @@ nsHTMLEditUtils::IsTableCellOrCaption(nsIDOMNode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsList: true if node an html list
|
||||
//
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsList(nsIDOMNode* aNode)
|
||||
{
|
||||
|
@ -295,8 +295,8 @@ nsHTMLEditUtils::IsList(nsINode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsOrderedList: true if node an html ordered list
|
||||
//
|
||||
bool
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsOrderedList(nsIDOMNode* aNode)
|
||||
{
|
||||
return nsEditor::NodeIsType(aNode, nsGkAtoms::ol);
|
||||
|
@ -305,8 +305,8 @@ nsHTMLEditUtils::IsOrderedList(nsIDOMNode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsUnorderedList: true if node an html unordered list
|
||||
//
|
||||
bool
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsUnorderedList(nsIDOMNode* aNode)
|
||||
{
|
||||
return nsEditor::NodeIsType(aNode, nsGkAtoms::ul);
|
||||
|
@ -315,8 +315,8 @@ nsHTMLEditUtils::IsUnorderedList(nsIDOMNode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsBlockquote: true if node an html blockquote node
|
||||
//
|
||||
bool
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsBlockquote(nsIDOMNode* aNode)
|
||||
{
|
||||
return nsEditor::NodeIsType(aNode, nsGkAtoms::blockquote);
|
||||
|
@ -325,8 +325,8 @@ nsHTMLEditUtils::IsBlockquote(nsIDOMNode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsPre: true if node an html pre node
|
||||
//
|
||||
bool
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsPre(nsIDOMNode* aNode)
|
||||
{
|
||||
return nsEditor::NodeIsType(aNode, nsGkAtoms::pre);
|
||||
|
@ -335,20 +335,20 @@ nsHTMLEditUtils::IsPre(nsIDOMNode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsImage: true if node an html image node
|
||||
//
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsImage(nsINode* aNode)
|
||||
{
|
||||
return aNode && aNode->IsHTMLElement(nsGkAtoms::img);
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
nsHTMLEditUtils::IsImage(nsIDOMNode* aNode)
|
||||
{
|
||||
return nsEditor::NodeIsType(aNode, nsGkAtoms::img);
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
nsHTMLEditUtils::IsLink(nsIDOMNode *aNode)
|
||||
{
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
|
||||
|
@ -371,7 +371,7 @@ nsHTMLEditUtils::IsLink(nsINode* aNode)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
nsHTMLEditUtils::IsNamedAnchor(nsIDOMNode *aNode)
|
||||
{
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
|
||||
|
@ -394,8 +394,8 @@ nsHTMLEditUtils::IsNamedAnchor(nsINode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsDiv: true if node an html div node
|
||||
//
|
||||
bool
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsDiv(nsIDOMNode* aNode)
|
||||
{
|
||||
return nsEditor::NodeIsType(aNode, nsGkAtoms::div);
|
||||
|
@ -404,8 +404,8 @@ nsHTMLEditUtils::IsDiv(nsIDOMNode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsMozDiv: true if node an html div node with type = _moz
|
||||
//
|
||||
bool
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsMozDiv(nsIDOMNode* aNode)
|
||||
{
|
||||
if (IsDiv(aNode) && nsTextEditUtils::HasMozAttr(aNode)) return true;
|
||||
|
@ -423,7 +423,7 @@ nsHTMLEditUtils::IsMozDiv(nsINode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsMailCite: true if node an html blockquote with type=cite
|
||||
//
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsMailCite(nsIDOMNode* aNode)
|
||||
{
|
||||
|
@ -459,7 +459,7 @@ nsHTMLEditUtils::IsMailCite(nsINode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsFormWidget: true if node is a form widget of some kind
|
||||
//
|
||||
//
|
||||
bool
|
||||
nsHTMLEditUtils::IsFormWidget(nsIDOMNode* aNode)
|
||||
{
|
||||
|
@ -847,7 +847,7 @@ nsHTMLEditUtils::CanContain(int32_t aParent, int32_t aChild)
|
|||
|
||||
const nsElementInfo& child = kElements[aChild - 1];
|
||||
return (parent.mCanContainGroups & child.mGroup) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
nsHTMLEditUtils::IsContainer(int32_t aTag)
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMAttr.h"
|
||||
#include "nsIDocumentInlines.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIDOMHTMLAnchorElement.h"
|
||||
|
@ -109,7 +109,7 @@ nsHTMLEditor::nsHTMLEditor()
|
|||
, mInfoYIncrement(20)
|
||||
, mGridSize(0)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
nsHTMLEditor::~nsHTMLEditor()
|
||||
{
|
||||
|
@ -119,7 +119,7 @@ nsHTMLEditor::~nsHTMLEditor()
|
|||
nsCOMPtr<nsIEditActionListener> mListener = do_QueryInterface(mRules);
|
||||
RemoveEditActionListener(mListener);
|
||||
|
||||
//the autopointers will clear themselves up.
|
||||
//the autopointers will clear themselves up.
|
||||
//but we need to also remove the listeners or we have a leak
|
||||
nsRefPtr<Selection> selection = GetSelection();
|
||||
// if we don't get the selection, just skip this
|
||||
|
@ -128,12 +128,12 @@ nsHTMLEditor::~nsHTMLEditor()
|
|||
listener = do_QueryInterface(mTypeInState);
|
||||
if (listener)
|
||||
{
|
||||
selection->RemoveSelectionListener(listener);
|
||||
selection->RemoveSelectionListener(listener);
|
||||
}
|
||||
listener = do_QueryInterface(mSelectionListenerP);
|
||||
if (listener)
|
||||
{
|
||||
selection->RemoveSelectionListener(listener);
|
||||
selection->RemoveSelectionListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ nsHTMLEditor::Init(nsIDOMDocument *aDoc,
|
|||
MOZ_ASSERT(aInitialValue.IsEmpty(), "Non-empty initial values not supported");
|
||||
|
||||
nsresult result = NS_OK, rulesRes = NS_OK;
|
||||
|
||||
|
||||
if (1)
|
||||
{
|
||||
// block to scope nsAutoEditInitRulesTrigger
|
||||
|
@ -284,16 +284,16 @@ nsHTMLEditor::Init(nsIDOMDocument *aDoc,
|
|||
}
|
||||
|
||||
nsRefPtr<Selection> selection = GetSelection();
|
||||
if (selection)
|
||||
if (selection)
|
||||
{
|
||||
nsCOMPtr<nsISelectionListener>listener;
|
||||
listener = do_QueryInterface(mTypeInState);
|
||||
if (listener) {
|
||||
selection->AddSelectionListener(listener);
|
||||
selection->AddSelectionListener(listener);
|
||||
}
|
||||
listener = do_QueryInterface(mSelectionListenerP);
|
||||
if (listener) {
|
||||
selection->AddSelectionListener(listener);
|
||||
selection->AddSelectionListener(listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -340,8 +340,8 @@ nsHTMLEditor::GetRootElement(nsIDOMElement **aRootElement)
|
|||
// Use the HTML documents body element as the editor root if we didn't
|
||||
// get a root element during initialization.
|
||||
|
||||
nsCOMPtr<nsIDOMElement> rootElement;
|
||||
nsCOMPtr<nsIDOMHTMLElement> bodyElement;
|
||||
nsCOMPtr<nsIDOMElement> rootElement;
|
||||
nsCOMPtr<nsIDOMHTMLElement> bodyElement;
|
||||
nsresult rv = GetBodyElement(getter_AddRefs(bodyElement));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -477,7 +477,7 @@ nsHTMLEditor::RemoveEventListeners()
|
|||
nsPlaintextEditor::RemoveEventListeners();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SetFlags(uint32_t aFlags)
|
||||
{
|
||||
nsresult rv = nsPlaintextEditor::SetFlags(aFlags);
|
||||
|
@ -799,7 +799,7 @@ nsHTMLEditor::IsBlockNode(nsINode *aNode)
|
|||
}
|
||||
|
||||
// Non-static version for the nsIEditor interface and JavaScript
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SetDocumentTitle(const nsAString &aTitle)
|
||||
{
|
||||
nsRefPtr<SetDocTitleTxn> txn = new SetDocTitleTxn();
|
||||
|
@ -810,7 +810,7 @@ nsHTMLEditor::SetDocumentTitle(const nsAString &aTitle)
|
|||
|
||||
//Don't let Rules System change the selection
|
||||
nsAutoTxnsConserveSelection dontChangeSelection(this);
|
||||
return nsEditor::DoTransaction(txn);
|
||||
return nsEditor::DoTransaction(txn);
|
||||
}
|
||||
|
||||
/* ------------ Block methods moved from nsEditor -------------- */
|
||||
|
@ -937,7 +937,7 @@ nsHTMLEditor::IsVisBreak(nsINode* aNode)
|
|||
if (nextNode && nsTextEditUtils::IsBreak(nextNode)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// If we are right before block boundary, then br not visible
|
||||
if (!nextNode) {
|
||||
// This break is trailer in block, it's not visible
|
||||
|
@ -947,8 +947,8 @@ nsHTMLEditor::IsVisBreak(nsINode* aNode)
|
|||
// Break is right before a block, it's not visible
|
||||
return false;
|
||||
}
|
||||
|
||||
// Sigh. We have to use expensive whitespace calculation code to
|
||||
|
||||
// Sigh. We have to use expensive whitespace calculation code to
|
||||
// determine what is going on
|
||||
int32_t selOffset;
|
||||
nsCOMPtr<nsINode> selNode = GetNodeLocation(aNode, &selOffset);
|
||||
|
@ -963,7 +963,7 @@ nsHTMLEditor::IsVisBreak(nsINode* aNode)
|
|||
if (visType & WSType::block) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1071,7 +1071,7 @@ nsHTMLEditor::TabInTable(bool inIsShift, bool* outHandled)
|
|||
return NS_OK;
|
||||
}
|
||||
} while (!iter->IsDone());
|
||||
|
||||
|
||||
if (!(*outHandled) && !inIsShift) {
|
||||
// If we haven't handled it yet, then we must have run off the end of the
|
||||
// table. Insert a new row.
|
||||
|
@ -1083,9 +1083,9 @@ nsHTMLEditor::TabInTable(bool inIsShift, bool* outHandled)
|
|||
nsRefPtr<Selection> selection;
|
||||
nsCOMPtr<nsIDOMElement> tblElement, cell;
|
||||
int32_t row;
|
||||
res = GetCellContext(getter_AddRefs(selection),
|
||||
res = GetCellContext(getter_AddRefs(selection),
|
||||
getter_AddRefs(tblElement),
|
||||
getter_AddRefs(cell),
|
||||
getter_AddRefs(cell),
|
||||
nullptr, nullptr,
|
||||
&row, nullptr);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
@ -1099,7 +1099,7 @@ nsHTMLEditor::TabInTable(bool inIsShift, bool* outHandled)
|
|||
selection->Collapse(cell, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1184,11 +1184,11 @@ nsHTMLEditor::ReplaceHeadContentsWithHTML(const nsAString& aSourceToInsert)
|
|||
// happen if you insert returns (instead of dom newlines, \n) into an editor
|
||||
// document.
|
||||
nsAutoString inputString (aSourceToInsert); // hope this does copy-on-write
|
||||
|
||||
|
||||
// Windows linebreaks: Map CRLF to LF:
|
||||
inputString.ReplaceSubstring(MOZ_UTF16("\r\n"),
|
||||
MOZ_UTF16("\n"));
|
||||
|
||||
|
||||
// Mac linebreaks: Map any remaining CR to LF:
|
||||
inputString.ReplaceSubstring(MOZ_UTF16("\r"),
|
||||
MOZ_UTF16("\n"));
|
||||
|
@ -1279,7 +1279,7 @@ nsHTMLEditor::RebuildDocumentFromSource(const nsAString& aSourceString)
|
|||
if (foundbody && beginclosehead.get() > beginbody.get()) {
|
||||
foundclosehead = false;
|
||||
}
|
||||
|
||||
|
||||
// Time to change the document
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
|
||||
|
@ -1351,7 +1351,7 @@ nsHTMLEditor::RebuildDocumentFromSource(const nsAString& aSourceString)
|
|||
// Now we must copy attributes user might have edited on the <body> tag
|
||||
// because InsertHTML (actually, CreateContextualFragment()) will never
|
||||
// return a body node in the DOM fragment
|
||||
|
||||
|
||||
// We already know where "<body" begins
|
||||
nsReadingIterator<char16_t> beginclosebody = beginbody;
|
||||
nsReadingIterator<char16_t> endclosebody;
|
||||
|
@ -1377,10 +1377,10 @@ nsHTMLEditor::RebuildDocumentFromSource(const nsAString& aSourceString)
|
|||
|
||||
nsCOMPtr<nsIContent> child = docfrag->GetFirstChild();
|
||||
NS_ENSURE_TRUE(child && child->IsElement(), NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
// Copy all attributes from the div child to current body element
|
||||
CloneAttributes(bodyElement, child->AsElement());
|
||||
|
||||
|
||||
// place selection at first editable content
|
||||
return BeginningOfDocument();
|
||||
}
|
||||
|
@ -1394,9 +1394,9 @@ nsHTMLEditor::NormalizeEOLInsertPosition(nsIDOMNode *firstNodeToInsert,
|
|||
This function will either correct the position passed in,
|
||||
or leave the position unchanged.
|
||||
|
||||
When the (first) item to insert is a block level element,
|
||||
and our insertion position is after the last visible item in a line,
|
||||
i.e. the insertion position is just before a visible line break <br>,
|
||||
When the (first) item to insert is a block level element,
|
||||
and our insertion position is after the last visible item in a line,
|
||||
i.e. the insertion position is just before a visible line break <br>,
|
||||
we want to skip to the position just after the line break (see bug 68767)
|
||||
|
||||
However, our logic to detect whether we should skip or not
|
||||
|
@ -1404,18 +1404,18 @@ nsHTMLEditor::NormalizeEOLInsertPosition(nsIDOMNode *firstNodeToInsert,
|
|||
We must not skip when the caret appears to be positioned at the beginning
|
||||
of a block, in that case skipping the <br> would not insert the <br>
|
||||
at the caret position, but after the current empty line.
|
||||
|
||||
|
||||
So we have several cases to test:
|
||||
|
||||
|
||||
1) We only ever want to skip, if the next visible thing after the current position is a break
|
||||
|
||||
|
||||
2) We do not want to skip if there is no previous visible thing at all
|
||||
That is detected if the call to PriorVisibleNode gives us an offset of zero.
|
||||
Because PriorVisibleNode always positions after the prior node, we would
|
||||
see an offset > 0, if there were a prior node.
|
||||
|
||||
|
||||
3) We do not want to skip, if both the next and the previous visible things are breaks.
|
||||
|
||||
|
||||
4) We do not want to skip if the previous visible thing is in a different block
|
||||
than the insertion position.
|
||||
*/
|
||||
|
@ -1465,11 +1465,11 @@ nsHTMLEditor::InsertElementAtSelection(nsIDOMElement* aElement, bool aDeleteSele
|
|||
nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
|
||||
|
||||
nsresult res = NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
|
||||
NS_ENSURE_TRUE(aElement, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aElement);
|
||||
|
||||
|
||||
ForceCompositionEnd();
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::insertElement, nsIEditor::eNext);
|
||||
|
@ -1529,7 +1529,7 @@ nsHTMLEditor::InsertElementAtSelection(nsIDOMElement* aElement, bool aDeleteSele
|
|||
|
||||
res = InsertNodeAtPoint(node, address_of(parentSelectedNode), &offsetForInsert, false);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
// Set caret after element, but check for special case
|
||||
// Set caret after element, but check for special case
|
||||
// of inserting table-related elements: set in first cell instead
|
||||
if (!SetCaretInTableCell(aElement))
|
||||
{
|
||||
|
@ -1557,8 +1557,8 @@ nsHTMLEditor::InsertElementAtSelection(nsIDOMElement* aElement, bool aDeleteSele
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
InsertNodeAtPoint: attempts to insert aNode into the document, at a point specified by
|
||||
/*
|
||||
InsertNodeAtPoint: attempts to insert aNode into the document, at a point specified by
|
||||
{*ioParent,*ioOffset}. Checks with strict dtd to see if containment is allowed. If not
|
||||
allowed, will attempt to find a parent in the parent hierarchy of *ioParent that will
|
||||
accept aNode as a child. If such a parent is found, will split the document tree from
|
||||
|
@ -1571,9 +1571,9 @@ nsHTMLEditor::InsertElementAtSelection(nsIDOMElement* aElement, bool aDeleteSele
|
|||
bool aNoEmptyNodes splitting can result in empty nodes?
|
||||
*/
|
||||
nsresult
|
||||
nsHTMLEditor::InsertNodeAtPoint(nsIDOMNode *aNode,
|
||||
nsCOMPtr<nsIDOMNode> *ioParent,
|
||||
int32_t *ioOffset,
|
||||
nsHTMLEditor::InsertNodeAtPoint(nsIDOMNode *aNode,
|
||||
nsCOMPtr<nsIDOMNode> *ioParent,
|
||||
int32_t *ioOffset,
|
||||
bool aNoEmptyNodes)
|
||||
{
|
||||
nsCOMPtr<nsIContent> node = do_QueryInterface(aNode);
|
||||
|
@ -1581,14 +1581,14 @@ nsHTMLEditor::InsertNodeAtPoint(nsIDOMNode *aNode,
|
|||
NS_ENSURE_TRUE(ioParent, NS_ERROR_NULL_POINTER);
|
||||
NS_ENSURE_TRUE(*ioParent, NS_ERROR_NULL_POINTER);
|
||||
NS_ENSURE_TRUE(ioOffset, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
nsresult res = NS_OK;
|
||||
nsCOMPtr<nsINode> parent = do_QueryInterface(*ioParent);
|
||||
NS_ENSURE_TRUE(parent, NS_ERROR_NULL_POINTER);
|
||||
nsCOMPtr<nsINode> topChild = parent;
|
||||
int32_t offsetOfInsert = *ioOffset;
|
||||
|
||||
// Search up the parent chain to find a suitable container
|
||||
|
||||
// Search up the parent chain to find a suitable container
|
||||
while (!CanContain(*parent, *node)) {
|
||||
// If the current parent is a root (body or table element)
|
||||
// then go no further - we can't insert
|
||||
|
@ -1669,7 +1669,7 @@ nsHTMLEditor::SetCaretAfterElement(nsIDOMElement* aElement)
|
|||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SetParagraphFormat(const nsAString& aParagraphFormat)
|
||||
{
|
||||
nsAutoString tag; tag.Assign(aParagraphFormat);
|
||||
|
@ -1680,13 +1680,13 @@ nsHTMLEditor::SetParagraphFormat(const nsAString& aParagraphFormat)
|
|||
return InsertBasicBlock(tag);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetParagraphState(bool *aMixed, nsAString &outFormat)
|
||||
{
|
||||
if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
|
||||
NS_ENSURE_TRUE(aMixed, NS_ERROR_NULL_POINTER);
|
||||
nsRefPtr<nsHTMLEditRules> htmlRules = static_cast<nsHTMLEditRules*>(mRules.get());
|
||||
|
||||
|
||||
return htmlRules->GetParagraphState(aMixed, outFormat);
|
||||
}
|
||||
|
||||
|
@ -1728,7 +1728,7 @@ nsHTMLEditor::GetCSSBackgroundColorState(bool *aMixed, nsAString &aOutColor, boo
|
|||
*aMixed = false;
|
||||
// the default background color is transparent
|
||||
aOutColor.AssignLiteral("transparent");
|
||||
|
||||
|
||||
// get selection
|
||||
nsRefPtr<Selection> selection = GetSelection();
|
||||
NS_ENSURE_STATE(selection && selection->GetRangeAt(0));
|
||||
|
@ -1749,7 +1749,7 @@ nsHTMLEditor::GetCSSBackgroundColorState(bool *aMixed, nsAString &aOutColor, boo
|
|||
nodeToExamine = parent->GetChildAt(offset);
|
||||
//GetNextNode(parent, offset, true, address_of(nodeToExamine));
|
||||
}
|
||||
|
||||
|
||||
NS_ENSURE_TRUE(nodeToExamine, NS_ERROR_NULL_POINTER);
|
||||
|
||||
if (aBlockLevel) {
|
||||
|
@ -1809,14 +1809,14 @@ nsHTMLEditor::GetCSSBackgroundColorState(bool *aMixed, nsAString &aOutColor, boo
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetHTMLBackgroundColorState(bool *aMixed, nsAString &aOutColor)
|
||||
{
|
||||
//TODO: We don't handle "mixed" correctly!
|
||||
NS_ENSURE_TRUE(aMixed, NS_ERROR_NULL_POINTER);
|
||||
*aMixed = false;
|
||||
aOutColor.Truncate();
|
||||
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElement;
|
||||
int32_t selectedCount;
|
||||
nsAutoString tagName;
|
||||
|
@ -1841,7 +1841,7 @@ nsHTMLEditor::GetHTMLBackgroundColorState(bool *aMixed, nsAString &aOutColor)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// No color is set, but we need to report visible color inherited
|
||||
// No color is set, but we need to report visible color inherited
|
||||
// from nested cells/tables, so search up parent chain
|
||||
element = element->GetParentElement();
|
||||
}
|
||||
|
@ -1854,24 +1854,24 @@ nsHTMLEditor::GetHTMLBackgroundColorState(bool *aMixed, nsAString &aOutColor)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetListState(bool *aMixed, bool *aOL, bool *aUL, bool *aDL)
|
||||
{
|
||||
if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
|
||||
NS_ENSURE_TRUE(aMixed && aOL && aUL && aDL, NS_ERROR_NULL_POINTER);
|
||||
nsRefPtr<nsHTMLEditRules> htmlRules = static_cast<nsHTMLEditRules*>(mRules.get());
|
||||
|
||||
|
||||
return htmlRules->GetListState(aMixed, aOL, aUL, aDL);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetListItemState(bool *aMixed, bool *aLI, bool *aDT, bool *aDD)
|
||||
{
|
||||
if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
|
||||
NS_ENSURE_TRUE(aMixed && aLI && aDT && aDD, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsRefPtr<nsHTMLEditRules> htmlRules = static_cast<nsHTMLEditRules*>(mRules.get());
|
||||
|
||||
|
||||
return htmlRules->GetListItemState(aMixed, aLI, aDT, aDD);
|
||||
}
|
||||
|
||||
|
@ -1881,19 +1881,19 @@ nsHTMLEditor::GetAlignment(bool *aMixed, nsIHTMLEditor::EAlignment *aAlign)
|
|||
if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
|
||||
NS_ENSURE_TRUE(aMixed && aAlign, NS_ERROR_NULL_POINTER);
|
||||
nsRefPtr<nsHTMLEditRules> htmlRules = static_cast<nsHTMLEditRules*>(mRules.get());
|
||||
|
||||
|
||||
return htmlRules->GetAlignment(aMixed, aAlign);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetIndentState(bool *aCanIndent, bool *aCanOutdent)
|
||||
{
|
||||
if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
|
||||
NS_ENSURE_TRUE(aCanIndent && aCanOutdent, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsRefPtr<nsHTMLEditRules> htmlRules = static_cast<nsHTMLEditRules*>(mRules.get());
|
||||
|
||||
|
||||
return htmlRules->GetIndentState(aCanIndent, aCanOutdent);
|
||||
}
|
||||
|
||||
|
@ -1910,7 +1910,7 @@ nsHTMLEditor::MakeOrChangeList(const nsAString& aListType, bool entireList, cons
|
|||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::makeList, nsIEditor::eNext);
|
||||
|
||||
|
||||
// pre-process
|
||||
nsRefPtr<Selection> selection = GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
|
||||
|
@ -1932,19 +1932,19 @@ nsHTMLEditor::MakeOrChangeList(const nsAString& aListType, bool entireList, cons
|
|||
res = GetStartNodeAndOffset(selection, getter_AddRefs(node), &offset);
|
||||
if (!node) res = NS_ERROR_FAILURE;
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
|
||||
if (isCollapsed)
|
||||
{
|
||||
// have to find a place to put the list
|
||||
nsCOMPtr<nsINode> parent = node;
|
||||
nsCOMPtr<nsINode> topChild = node;
|
||||
|
||||
|
||||
nsCOMPtr<nsIAtom> listAtom = do_GetAtom(aListType);
|
||||
while (!CanContainTag(*parent, *listAtom)) {
|
||||
topChild = parent;
|
||||
parent = parent->GetParentNode();
|
||||
}
|
||||
|
||||
|
||||
if (parent != node)
|
||||
{
|
||||
// we need to split up to the child of parent
|
||||
|
@ -1963,7 +1963,7 @@ nsHTMLEditor::MakeOrChangeList(const nsAString& aListType, bool entireList, cons
|
|||
NS_ENSURE_SUCCESS(res, res);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
res = mRules->DidDoAction(selection, &ruleInfo, res);
|
||||
return res;
|
||||
}
|
||||
|
@ -1982,7 +1982,7 @@ nsHTMLEditor::RemoveList(const nsAString& aListType)
|
|||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::removeList, nsIEditor::eNext);
|
||||
|
||||
|
||||
// pre-process
|
||||
nsRefPtr<Selection> selection = GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
|
||||
|
@ -2013,7 +2013,7 @@ nsHTMLEditor::MakeDefinitionItem(const nsAString& aItemType)
|
|||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::makeDefListItem, nsIEditor::eNext);
|
||||
|
||||
|
||||
// pre-process
|
||||
nsRefPtr<Selection> selection = GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
|
||||
|
@ -2044,7 +2044,7 @@ nsHTMLEditor::InsertBasicBlock(const nsAString& aBlockType)
|
|||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::makeBasicBlock, nsIEditor::eNext);
|
||||
|
||||
|
||||
// pre-process
|
||||
nsRefPtr<Selection> selection = GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
|
||||
|
@ -2063,20 +2063,20 @@ nsHTMLEditor::InsertBasicBlock(const nsAString& aBlockType)
|
|||
res = GetStartNodeAndOffset(selection, getter_AddRefs(node), &offset);
|
||||
if (!node) res = NS_ERROR_FAILURE;
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
|
||||
if (isCollapsed)
|
||||
{
|
||||
// have to find a place to put the block
|
||||
nsCOMPtr<nsINode> parent = node;
|
||||
nsCOMPtr<nsINode> topChild = node;
|
||||
|
||||
|
||||
nsCOMPtr<nsIAtom> blockAtom = do_GetAtom(aBlockType);
|
||||
while (!CanContainTag(*parent, *blockAtom)) {
|
||||
NS_ENSURE_TRUE(parent->GetParentNode(), NS_ERROR_FAILURE);
|
||||
topChild = parent;
|
||||
parent = parent->GetParentNode();
|
||||
}
|
||||
|
||||
|
||||
if (parent != node)
|
||||
{
|
||||
// we need to split up to the child of parent
|
||||
|
@ -2088,10 +2088,10 @@ nsHTMLEditor::InsertBasicBlock(const nsAString& aBlockType)
|
|||
// make a block
|
||||
nsCOMPtr<Element> newBlock = CreateNode(blockAtom, parent, offset);
|
||||
NS_ENSURE_STATE(newBlock);
|
||||
|
||||
|
||||
// reposition selection to inside the block
|
||||
res = selection->Collapse(newBlock,0);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2116,7 +2116,7 @@ nsHTMLEditor::Indent(const nsAString& aIndent)
|
|||
}
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, opID, nsIEditor::eNext);
|
||||
|
||||
|
||||
// pre-process
|
||||
nsRefPtr<Selection> selection = GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
|
||||
|
@ -2124,7 +2124,7 @@ nsHTMLEditor::Indent(const nsAString& aIndent)
|
|||
nsTextRulesInfo ruleInfo(opID);
|
||||
res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
|
||||
if (cancel || (NS_FAILED(res))) return res;
|
||||
|
||||
|
||||
if (!handled)
|
||||
{
|
||||
// Do default - insert a blockquote node if selection collapsed
|
||||
|
@ -2135,7 +2135,7 @@ nsHTMLEditor::Indent(const nsAString& aIndent)
|
|||
res = GetStartNodeAndOffset(selection, getter_AddRefs(node), &offset);
|
||||
if (!node) res = NS_ERROR_FAILURE;
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
|
||||
if (aIndent.EqualsLiteral("indent"))
|
||||
{
|
||||
if (isCollapsed)
|
||||
|
@ -2148,7 +2148,7 @@ nsHTMLEditor::Indent(const nsAString& aIndent)
|
|||
topChild = parent;
|
||||
parent = parent->GetParentNode();
|
||||
}
|
||||
|
||||
|
||||
if (parent != node)
|
||||
{
|
||||
// we need to split up to the child of parent
|
||||
|
@ -2190,7 +2190,7 @@ nsHTMLEditor::Align(const nsAString& aAlignType)
|
|||
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
bool cancel, handled;
|
||||
|
||||
|
||||
// Find out if the selection is collapsed:
|
||||
nsRefPtr<Selection> selection = GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
|
||||
|
@ -2199,7 +2199,7 @@ nsHTMLEditor::Align(const nsAString& aAlignType)
|
|||
nsresult res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
|
||||
if (cancel || NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
|
||||
res = mRules->DidDoAction(selection, &ruleInfo, res);
|
||||
return res;
|
||||
}
|
||||
|
@ -2309,10 +2309,10 @@ NS_IMETHODIMP
|
|||
nsHTMLEditor::GetSelectedElement(const nsAString& aTagName, nsIDOMElement** aReturn)
|
||||
{
|
||||
NS_ENSURE_TRUE(aReturn , NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
// default is null - no element found
|
||||
*aReturn = nullptr;
|
||||
|
||||
|
||||
// First look for a single element in selection
|
||||
nsRefPtr<Selection> selection = GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
|
||||
|
@ -2327,7 +2327,7 @@ nsHTMLEditor::GetSelectedElement(const nsAString& aTagName, nsIDOMElement** aRet
|
|||
bool anyTag = (TagName.IsEmpty());
|
||||
bool isLinkTag = IsLinkTag(TagName);
|
||||
bool isNamedAnchorTag = IsNamedAnchorTag(TagName);
|
||||
|
||||
|
||||
nsCOMPtr<nsIDOMElement> selectedElement;
|
||||
nsRefPtr<nsRange> range = selection->GetRangeAt(0);
|
||||
NS_ENSURE_STATE(range);
|
||||
|
@ -2399,7 +2399,7 @@ nsHTMLEditor::GetSelectedElement(const nsAString& aTagName, nsIDOMElement** aRet
|
|||
{
|
||||
// We have just a caret in the link
|
||||
bNodeFound = true;
|
||||
} else if(focusNode)
|
||||
} else if(focusNode)
|
||||
{ // Link node must be the same for both ends of selection
|
||||
nsCOMPtr<nsIDOMElement> parentLinkOfFocus;
|
||||
res = GetElementOrParentByTagName(NS_LITERAL_STRING("href"), focusNode, getter_AddRefs(parentLinkOfFocus));
|
||||
|
@ -2419,7 +2419,7 @@ nsHTMLEditor::GetSelectedElement(const nsAString& aTagName, nsIDOMElement** aRet
|
|||
{
|
||||
nsCOMPtr<nsIDOMNode> anchorChild;
|
||||
anchorChild = GetChildAt(anchorNode,anchorOffset);
|
||||
if (anchorChild && nsHTMLEditUtils::IsLink(anchorChild) &&
|
||||
if (anchorChild && nsHTMLEditUtils::IsLink(anchorChild) &&
|
||||
(anchorNode == focusNode) && focusOffset == (anchorOffset+1))
|
||||
{
|
||||
selectedElement = do_QueryInterface(anchorChild);
|
||||
|
@ -2427,7 +2427,7 @@ nsHTMLEditor::GetSelectedElement(const nsAString& aTagName, nsIDOMElement** aRet
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCollapsed) // Don't bother to examine selection if it is collapsed
|
||||
{
|
||||
|
@ -2493,14 +2493,14 @@ nsHTMLEditor::GetSelectedElement(const nsAString& aTagName, nsIDOMElement** aRet
|
|||
}
|
||||
if (bNodeFound)
|
||||
{
|
||||
|
||||
|
||||
*aReturn = selectedElement;
|
||||
if (selectedElement)
|
||||
{
|
||||
{
|
||||
// Getters must addref
|
||||
NS_ADDREF(*aReturn);
|
||||
}
|
||||
}
|
||||
}
|
||||
else res = NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
||||
return res;
|
||||
|
@ -2645,7 +2645,7 @@ nsresult
|
|||
nsHTMLEditor::SetHTMLBackgroundColor(const nsAString& aColor)
|
||||
{
|
||||
NS_PRECONDITION(mDocWeak, "Missing Editor DOM Document");
|
||||
|
||||
|
||||
// Find a selected or enclosing table element to set background on
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
int32_t selectedCount;
|
||||
|
@ -2699,7 +2699,7 @@ NS_IMETHODIMP nsHTMLEditor::SetBodyAttribute(const nsAString& aAttribute, const
|
|||
// TODO: Check selection for Cell, Row, Column or table and do color on appropriate level
|
||||
|
||||
NS_ASSERTION(mDocWeak, "Missing Editor DOM Document");
|
||||
|
||||
|
||||
// Set the background color attribute on the body tag
|
||||
nsCOMPtr<nsIDOMElement> bodyElement = do_QueryInterface(GetRoot());
|
||||
NS_ENSURE_TRUE(bodyElement, NS_ERROR_NULL_POINTER);
|
||||
|
@ -2814,7 +2814,7 @@ nsHTMLEditor::RemoveStyleSheet(const nsAString &aURL)
|
|||
// Remove it from our internal list
|
||||
rv = RemoveStyleSheetFromList(aURL);
|
||||
}
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -3355,7 +3355,7 @@ nsHTMLEditor::DebugUnitTests(int32_t *outNumTests, int32_t *outNumTestsFailed)
|
|||
|
||||
TextEditorTest *tester = new TextEditorTest();
|
||||
NS_ENSURE_TRUE(tester, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
|
||||
tester->Run(this, outNumTests, outNumTestsFailed);
|
||||
delete tester;
|
||||
return NS_OK;
|
||||
|
@ -3365,7 +3365,7 @@ nsHTMLEditor::DebugUnitTests(int32_t *outNumTests, int32_t *outNumTestsFailed)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::StyleSheetLoaded(CSSStyleSheet* aSheet, bool aWasAlternate,
|
||||
nsresult aStatus)
|
||||
{
|
||||
|
@ -3430,9 +3430,9 @@ nsHTMLEditor::EndOperation()
|
|||
if (mRules) res = mRules->AfterEdit(mAction, mDirection);
|
||||
nsEditor::EndOperation(); // will clear mAction, mDirection
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
nsHTMLEditor::TagCanContainTag(nsIAtom& aParentTag, nsIAtom& aChildTag)
|
||||
{
|
||||
nsIParserService* parserService = nsContentUtils::GetParserService();
|
||||
|
@ -3480,18 +3480,18 @@ nsresult
|
|||
nsHTMLEditor::SelectEntireDocument(Selection* aSelection)
|
||||
{
|
||||
if (!aSelection || !mRules) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
|
||||
// Protect the edit rules object from dying
|
||||
nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
|
||||
|
||||
// get editor root node
|
||||
nsCOMPtr<nsIDOMElement> rootElement = do_QueryInterface(GetRoot());
|
||||
|
||||
|
||||
// is doc empty?
|
||||
bool bDocIsEmpty;
|
||||
nsresult res = mRules->DocumentIsEmpty(&bDocIsEmpty);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
|
||||
if (bDocIsEmpty)
|
||||
{
|
||||
// if its empty dont select entire doc - that would select the bogus node
|
||||
|
@ -3555,9 +3555,9 @@ bool nsHTMLEditor::IsTextPropertySetByContent(nsINode* aNode,
|
|||
}
|
||||
|
||||
void nsHTMLEditor::IsTextPropertySetByContent(nsIDOMNode *aNode,
|
||||
nsIAtom *aProperty,
|
||||
const nsAString *aAttribute,
|
||||
const nsAString *aValue,
|
||||
nsIAtom *aProperty,
|
||||
const nsAString *aAttribute,
|
||||
const nsAString *aValue,
|
||||
bool &aIsSet,
|
||||
nsAString *outValue)
|
||||
{
|
||||
|
@ -3599,7 +3599,7 @@ void nsHTMLEditor::IsTextPropertySetByContent(nsIDOMNode *aNode,
|
|||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
else {
|
||||
found = true;
|
||||
}
|
||||
if (found)
|
||||
|
@ -3648,7 +3648,7 @@ nsHTMLEditor::SetCaretInTableCell(nsIDOMElement* aElement)
|
|||
NS_ENSURE_TRUE(selection, false);
|
||||
|
||||
return NS_SUCCEEDED(selection->CollapseNative(node, 0));
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// GetEnclosingTable: find ancestor who is a table, if any
|
||||
|
@ -3683,7 +3683,7 @@ nsHTMLEditor::GetEnclosingTable(nsIDOMNode *aNode)
|
|||
/* this method scans the selection for adjacent text nodes
|
||||
* and collapses them into a single text node.
|
||||
* "adjacent" means literally adjacent siblings of the same parent.
|
||||
* Uses nsEditor::JoinNodes so action is undoable.
|
||||
* Uses nsEditor::JoinNodes so action is undoable.
|
||||
* Should be called within the context of a batch transaction.
|
||||
*/
|
||||
nsresult
|
||||
|
@ -3693,7 +3693,7 @@ nsHTMLEditor::CollapseAdjacentTextNodes(nsRange* aInRange)
|
|||
nsAutoTxnsConserveSelection dontSpazMySelection(this);
|
||||
nsTArray<nsCOMPtr<nsIDOMNode> > textNodes;
|
||||
// we can't actually do anything during iteration, so store the text nodes in an array
|
||||
// don't bother ref counting them because we know we can hold them for the
|
||||
// don't bother ref counting them because we know we can hold them for the
|
||||
// lifetime of this method
|
||||
|
||||
|
||||
|
@ -3769,7 +3769,7 @@ nsHTMLEditor::RemoveBlockContainer(nsIDOMNode *inNode)
|
|||
NS_ENSURE_TRUE(node, NS_ERROR_NULL_POINTER);
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIDOMNode> sibling, child, unused;
|
||||
|
||||
|
||||
// Two possibilities: the container cold be empty of editable content.
|
||||
// If that is the case, we need to compare what is before and after inNode
|
||||
// to determine if we need a br.
|
||||
|
@ -3777,9 +3777,9 @@ nsHTMLEditor::RemoveBlockContainer(nsIDOMNode *inNode)
|
|||
// sibling and first child to determine if we need a leading br,
|
||||
// and compare following sibling and last child to determine if we need a
|
||||
// trailing br.
|
||||
|
||||
|
||||
child = GetAsDOMNode(GetFirstEditableChild(*node));
|
||||
|
||||
|
||||
if (child) // the case of inNode not being empty
|
||||
{
|
||||
// we need a br at start unless:
|
||||
|
@ -3787,7 +3787,7 @@ nsHTMLEditor::RemoveBlockContainer(nsIDOMNode *inNode)
|
|||
// 2) previous sibling of inNode is a br, OR
|
||||
// 3) first child of inNode is a block OR
|
||||
// 4) either is null
|
||||
|
||||
|
||||
res = GetPriorHTMLSibling(inNode, address_of(sibling));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
if (sibling && !IsBlockNode(sibling) && !nsTextEditUtils::IsBreak(sibling))
|
||||
|
@ -3798,7 +3798,7 @@ nsHTMLEditor::RemoveBlockContainer(nsIDOMNode *inNode)
|
|||
NS_ENSURE_SUCCESS(res, res);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// we need a br at end unless:
|
||||
// 1) following sibling of inNode is a block, OR
|
||||
// 2) last child of inNode is a block, OR
|
||||
|
@ -3843,7 +3843,7 @@ nsHTMLEditor::RemoveBlockContainer(nsIDOMNode *inNode)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// now remove container
|
||||
return RemoveContainer(node);
|
||||
}
|
||||
|
@ -3852,7 +3852,7 @@ nsHTMLEditor::RemoveBlockContainer(nsIDOMNode *inNode)
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// GetPriorHTMLSibling: returns the previous editable sibling, if there is
|
||||
// one within the parent
|
||||
//
|
||||
//
|
||||
nsIContent*
|
||||
nsHTMLEditor::GetPriorHTMLSibling(nsINode* aNode)
|
||||
{
|
||||
|
@ -3885,7 +3885,7 @@ nsHTMLEditor::GetPriorHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outN
|
|||
// GetPriorHTMLSibling: returns the previous editable sibling, if there is
|
||||
// one within the parent. just like above routine but
|
||||
// takes a parent/offset instead of a node.
|
||||
//
|
||||
//
|
||||
nsIContent*
|
||||
nsHTMLEditor::GetPriorHTMLSibling(nsINode* aParent, int32_t aOffset)
|
||||
{
|
||||
|
@ -3917,7 +3917,7 @@ nsHTMLEditor::GetPriorHTMLSibling(nsIDOMNode *inParent, int32_t inOffset, nsCOMP
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// GetNextHTMLSibling: returns the next editable sibling, if there is
|
||||
// one within the parent
|
||||
//
|
||||
//
|
||||
nsIContent*
|
||||
nsHTMLEditor::GetNextHTMLSibling(nsINode* aNode)
|
||||
{
|
||||
|
@ -3939,7 +3939,7 @@ nsHTMLEditor::GetNextHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNo
|
|||
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(inNode);
|
||||
NS_ENSURE_TRUE(node, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
*outNode = do_QueryInterface(GetNextHTMLSibling(node));
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -4044,7 +4044,7 @@ nsHTMLEditor::GetPriorHTMLNode(nsIDOMNode* aNode, int32_t aOffset,
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// GetNextHTMLNode: returns the next editable leaf node, if there is
|
||||
// one within the <body>
|
||||
//
|
||||
//
|
||||
nsIContent*
|
||||
nsHTMLEditor::GetNextHTMLNode(nsINode* aNode, bool aNoBlockCrossing)
|
||||
{
|
||||
|
@ -4076,7 +4076,7 @@ nsHTMLEditor::GetNextHTMLNode(nsIDOMNode* aNode,
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// GetNextHTMLNode: same as above but takes {parent,offset} instead of node
|
||||
//
|
||||
//
|
||||
nsIContent*
|
||||
nsHTMLEditor::GetNextHTMLNode(nsINode* aParent, int32_t aOffset,
|
||||
bool aNoBlockCrossing)
|
||||
|
@ -4104,37 +4104,37 @@ nsHTMLEditor::GetNextHTMLNode(nsIDOMNode* aNode, int32_t aOffset,
|
|||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsHTMLEditor::IsFirstEditableChild( nsIDOMNode *aNode, bool *aOutIsFirst)
|
||||
{
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
|
||||
NS_ENSURE_TRUE(aOutIsFirst && node, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
// init out parms
|
||||
*aOutIsFirst = false;
|
||||
|
||||
|
||||
// find first editable child and compare it to aNode
|
||||
nsCOMPtr<nsINode> parent = node->GetParentNode();
|
||||
NS_ENSURE_TRUE(parent, NS_ERROR_FAILURE);
|
||||
|
||||
|
||||
*aOutIsFirst = (GetFirstEditableChild(*parent) == node);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsHTMLEditor::IsLastEditableChild( nsIDOMNode *aNode, bool *aOutIsLast)
|
||||
{
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
|
||||
NS_ENSURE_TRUE(aOutIsLast && node, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
// init out parms
|
||||
*aOutIsLast = false;
|
||||
|
||||
|
||||
// find last editable child and compare it to aNode
|
||||
nsCOMPtr<nsINode> parent = node->GetParentNode();
|
||||
NS_ENSURE_TRUE(parent, NS_ERROR_FAILURE);
|
||||
|
||||
|
||||
*aOutIsLast = (GetLastEditableChild(*parent) == node);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -4201,7 +4201,7 @@ nsHTMLEditor::GetLastEditableLeaf(nsINode& aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsVisTextNode: figure out if textnode aTextNode has any visible content.
|
||||
//
|
||||
//
|
||||
nsresult
|
||||
nsHTMLEditor::IsVisTextNode(nsIContent* aNode,
|
||||
bool* outIsEmptyNode,
|
||||
|
@ -4229,7 +4229,7 @@ nsHTMLEditor::IsVisTextNode(nsIContent* aNode,
|
|||
// partial fix for bug 46209)
|
||||
res = selCon->CheckVisibilityContent(aNode, 0, length, &isVisible);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
if (isVisible)
|
||||
if (isVisible)
|
||||
{
|
||||
*outIsEmptyNode = false;
|
||||
}
|
||||
|
@ -4253,18 +4253,18 @@ nsHTMLEditor::IsVisTextNode(nsIContent* aNode,
|
|||
*outIsEmptyNode = false;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsEmptyNode: figure out if aNode is an empty node.
|
||||
// A block can have children and still be considered empty,
|
||||
// if the children are empty or non-editable.
|
||||
//
|
||||
//
|
||||
nsresult
|
||||
nsHTMLEditor::IsEmptyNode( nsIDOMNode *aNode,
|
||||
bool *outIsEmptyNode,
|
||||
nsHTMLEditor::IsEmptyNode( nsIDOMNode *aNode,
|
||||
bool *outIsEmptyNode,
|
||||
bool aSingleBRDoesntCount,
|
||||
bool aListOrCellNotEmpty,
|
||||
bool aSafeToAskFrames)
|
||||
|
@ -4290,7 +4290,7 @@ nsHTMLEditor::IsEmptyNode(nsINode* aNode,
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsEmptyNodeImpl: workhorse for IsEmptyNode.
|
||||
//
|
||||
//
|
||||
nsresult
|
||||
nsHTMLEditor::IsEmptyNodeImpl(nsINode* aNode,
|
||||
bool *outIsEmptyNode,
|
||||
|
@ -4320,12 +4320,12 @@ nsHTMLEditor::IsEmptyNodeImpl(nsINode* aNode,
|
|||
*outIsEmptyNode = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// need this for later
|
||||
bool isListItemOrCell = nsHTMLEditUtils::IsListItem(aNode) ||
|
||||
nsHTMLEditUtils::IsTableCell(aNode);
|
||||
|
||||
// loop over children of node. if no children, or all children are either
|
||||
|
||||
// loop over children of node. if no children, or all children are either
|
||||
// empty text nodes or non-editable, then node qualifies as empty
|
||||
for (nsCOMPtr<nsIContent> child = aNode->GetFirstChild();
|
||||
child;
|
||||
|
@ -4384,7 +4384,7 @@ nsHTMLEditor::IsEmptyNodeImpl(nsINode* aNode,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -4451,7 +4451,7 @@ nsHTMLEditor::SetAttributeOrEquivalent(nsIDOMElement * aElement,
|
|||
res = aElement->SetAttribute(aAttribute, aValue);
|
||||
else
|
||||
res = SetAttribute(aElement, aAttribute, aValue);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -4681,7 +4681,7 @@ nsHTMLEditor::SetBackgroundColor(const nsAString& aColor)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// NodesSameType: do these nodes have the same tag?
|
||||
//
|
||||
//
|
||||
/* virtual */
|
||||
bool
|
||||
nsHTMLEditor::AreNodesSameType(nsIContent* aNode1, nsIContent* aNode2)
|
||||
|
|
|
@ -64,7 +64,7 @@ struct IMEState;
|
|||
|
||||
/**
|
||||
* The HTML editor implementation.<br>
|
||||
* Use to edit HTML document represented as a DOM tree.
|
||||
* Use to edit HTML document represented as a DOM tree.
|
||||
*/
|
||||
class nsHTMLEditor final : public nsPlaintextEditor,
|
||||
public nsIHTMLEditor,
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
// see nsIHTMLEditor for documentation
|
||||
|
||||
//Interfaces for addref and release and queryinterface
|
||||
//NOTE macro used is for classes that inherit from
|
||||
//NOTE macro used is for classes that inherit from
|
||||
// another class. Only the base class should use NS_DECL_ISUPPORTS
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLEditor, nsPlaintextEditor)
|
||||
|
@ -195,14 +195,14 @@ public:
|
|||
int32_t aRowIndex, int32_t aColIndex,
|
||||
nsIDOMElement **aCell,
|
||||
int32_t* aStartRowIndex, int32_t* aStartColIndex,
|
||||
int32_t* aRowSpan, int32_t* aColSpan,
|
||||
int32_t* aActualRowSpan, int32_t* aActualColSpan,
|
||||
int32_t* aRowSpan, int32_t* aColSpan,
|
||||
int32_t* aActualRowSpan, int32_t* aActualColSpan,
|
||||
bool* aIsSelected) override;
|
||||
NS_IMETHOD GetFirstRow(nsIDOMElement* aTableElement, nsIDOMNode** aRowNode) override;
|
||||
NS_IMETHOD GetNextRow(nsIDOMNode* aCurrentRowNode, nsIDOMNode** aRowNode) override;
|
||||
nsresult GetLastCellInRow(nsIDOMNode* aRowNode, nsIDOMNode** aCellNode);
|
||||
|
||||
NS_IMETHOD SetSelectionAfterTableEdit(nsIDOMElement* aTable, int32_t aRow, int32_t aCol,
|
||||
NS_IMETHOD SetSelectionAfterTableEdit(nsIDOMElement* aTable, int32_t aRow, int32_t aCol,
|
||||
int32_t aDirection, bool aSelected) override;
|
||||
NS_IMETHOD GetSelectedOrParentTableElement(nsAString& aTagName,
|
||||
int32_t *aSelectedCount,
|
||||
|
@ -213,7 +213,7 @@ public:
|
|||
|
||||
// Finds the first selected cell in first range of selection
|
||||
// This is in the *order of selection*, not order in the table
|
||||
// (i.e., each cell added to selection is added in another range
|
||||
// (i.e., each cell added to selection is added in another range
|
||||
// in the selection's rangelist, independent of location in table)
|
||||
// aRange is optional: returns the range around the cell
|
||||
NS_IMETHOD GetFirstSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell) override;
|
||||
|
@ -223,7 +223,7 @@ public:
|
|||
|
||||
// Upper-left-most selected cell in table
|
||||
NS_IMETHOD GetFirstSelectedCellInTable(int32_t *aRowIndex, int32_t *aColIndex, nsIDOMElement **aCell) override;
|
||||
|
||||
|
||||
/* miscellaneous */
|
||||
// This sets background on the appropriate container element (table, cell,)
|
||||
// or calls into nsTextEditor to set the page background
|
||||
|
@ -290,7 +290,7 @@ public:
|
|||
/** returns true if aParentTag can contain a child of type aChildTag */
|
||||
virtual bool TagCanContainTag(nsIAtom& aParentTag, nsIAtom& aChildTag)
|
||||
override;
|
||||
|
||||
|
||||
/** returns true if aNode is a container */
|
||||
virtual bool IsContainer(nsINode* aNode) override;
|
||||
virtual bool IsContainer(nsIDOMNode* aNode) override;
|
||||
|
@ -337,12 +337,12 @@ public:
|
|||
|
||||
/* ------------ Utility Routines, not part of public API -------------- */
|
||||
NS_IMETHOD TypedText(const nsAString& aString, ETypingAction aAction) override;
|
||||
nsresult InsertNodeAtPoint( nsIDOMNode *aNode,
|
||||
nsCOMPtr<nsIDOMNode> *ioParent,
|
||||
int32_t *ioOffset,
|
||||
nsresult InsertNodeAtPoint( nsIDOMNode *aNode,
|
||||
nsCOMPtr<nsIDOMNode> *ioParent,
|
||||
int32_t *ioOffset,
|
||||
bool aNoEmptyNodes);
|
||||
|
||||
// Use this to assure that selection is set after attribute nodes when
|
||||
// Use this to assure that selection is set after attribute nodes when
|
||||
// trying to collapse selection at begining of a block node
|
||||
// e.g., when setting at beginning of a table cell
|
||||
// This will stop at a table, however, since we don't want to
|
||||
|
@ -358,7 +358,7 @@ public:
|
|||
nsresult IsVisTextNode(nsIContent* aNode,
|
||||
bool* outIsEmptyNode,
|
||||
bool aSafeToAskFrames);
|
||||
nsresult IsEmptyNode(nsIDOMNode *aNode, bool *outIsEmptyBlock,
|
||||
nsresult IsEmptyNode(nsIDOMNode *aNode, bool *outIsEmptyBlock,
|
||||
bool aMozBRDoesntCount = false,
|
||||
bool aListOrCellNotEmpty = false,
|
||||
bool aSafeToAskFrames = false);
|
||||
|
@ -367,7 +367,7 @@ public:
|
|||
bool aListOrCellNotEmpty = false,
|
||||
bool aSafeToAskFrames = false);
|
||||
nsresult IsEmptyNodeImpl(nsINode* aNode,
|
||||
bool *outIsEmptyBlock,
|
||||
bool *outIsEmptyBlock,
|
||||
bool aMozBRDoesntCount,
|
||||
bool aListOrCellNotEmpty,
|
||||
bool aSafeToAskFrames,
|
||||
|
@ -427,14 +427,14 @@ protected:
|
|||
NS_IMETHOD TabInTable(bool inIsShift, bool *outHandled);
|
||||
already_AddRefed<mozilla::dom::Element> CreateBR(nsINode* aNode,
|
||||
int32_t aOffset, EDirection aSelect = eNone);
|
||||
NS_IMETHOD CreateBR(nsIDOMNode *aNode, int32_t aOffset,
|
||||
NS_IMETHOD CreateBR(nsIDOMNode *aNode, int32_t aOffset,
|
||||
nsCOMPtr<nsIDOMNode> *outBRNode, nsIEditor::EDirection aSelect = nsIEditor::eNone) override;
|
||||
|
||||
// Table Editing (implemented in nsTableEditor.cpp)
|
||||
|
||||
// Table utilities
|
||||
|
||||
// Insert a new cell after or before supplied aCell.
|
||||
// Insert a new cell after or before supplied aCell.
|
||||
// Optional: If aNewCell supplied, returns the newly-created cell (addref'd, of course)
|
||||
// This doesn't change or use the current selection
|
||||
NS_IMETHOD InsertCell(nsIDOMElement *aCell, int32_t aRowSpan, int32_t aColSpan,
|
||||
|
@ -474,7 +474,7 @@ protected:
|
|||
nsIDOMNode** aCellParent, int32_t* aCellOffset,
|
||||
int32_t* aRowIndex, int32_t* aColIndex);
|
||||
|
||||
NS_IMETHOD GetCellSpansAt(nsIDOMElement* aTable, int32_t aRowIndex, int32_t aColIndex,
|
||||
NS_IMETHOD GetCellSpansAt(nsIDOMElement* aTable, int32_t aRowIndex, int32_t aColIndex,
|
||||
int32_t& aActualRowSpan, int32_t& aActualColSpan);
|
||||
|
||||
NS_IMETHOD SplitCellIntoColumns(nsIDOMElement *aTable, int32_t aRowIndex, int32_t aColIndex,
|
||||
|
@ -494,13 +494,13 @@ protected:
|
|||
nsresult SetSelectionAtDocumentStart(mozilla::dom::Selection* aSelection);
|
||||
|
||||
// End of Table Editing utilities
|
||||
|
||||
|
||||
static already_AddRefed<mozilla::dom::Element>
|
||||
GetEnclosingTable(nsINode* aNode);
|
||||
static nsCOMPtr<nsIDOMNode> GetEnclosingTable(nsIDOMNode *aNode);
|
||||
|
||||
/** content-based query returns true if <aProperty aAttribute=aValue> effects aNode
|
||||
* If <aProperty aAttribute=aValue> contains aNode,
|
||||
* If <aProperty aAttribute=aValue> contains aNode,
|
||||
* but <aProperty aAttribute=SomeOtherValue> also contains aNode and the second is
|
||||
* more deeply nested than the first, then the first does not effect aNode.
|
||||
*
|
||||
|
@ -553,7 +553,7 @@ protected:
|
|||
// factored methods for handling insertion of data from transferables (drag&drop or clipboard)
|
||||
NS_IMETHOD PrepareTransferable(nsITransferable **transferable) override;
|
||||
nsresult PrepareHTMLTransferable(nsITransferable **transferable, bool havePrivFlavor);
|
||||
nsresult InsertFromTransferable(nsITransferable *transferable,
|
||||
nsresult InsertFromTransferable(nsITransferable *transferable,
|
||||
nsIDOMDocument *aSourceDoc,
|
||||
const nsAString & aContextStr,
|
||||
const nsAString & aInfoStr,
|
||||
|
@ -571,13 +571,13 @@ protected:
|
|||
nsresult DoContentFilterCallback(const nsAString &aFlavor,
|
||||
nsIDOMDocument *aSourceDoc,
|
||||
bool aWillDeleteSelection,
|
||||
nsIDOMNode **aFragmentAsNode,
|
||||
nsIDOMNode **aFragmentAsNode,
|
||||
nsIDOMNode **aFragStartNode,
|
||||
int32_t *aFragStartOffset,
|
||||
nsIDOMNode **aFragEndNode,
|
||||
int32_t *aFragEndOffset,
|
||||
nsIDOMNode **aTargetNode,
|
||||
int32_t *aTargetOffset,
|
||||
nsIDOMNode **aTargetNode,
|
||||
int32_t *aTargetOffset,
|
||||
bool *aDoContinue);
|
||||
|
||||
bool IsInLink(nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *outLink = nullptr);
|
||||
|
@ -621,7 +621,7 @@ protected:
|
|||
bool IsVisBreak(nsINode* aNode);
|
||||
bool IsVisBreak(nsIDOMNode *aNode);
|
||||
|
||||
/* utility routine to possibly adjust the insertion position when
|
||||
/* utility routine to possibly adjust the insertion position when
|
||||
inserting a block level element */
|
||||
void NormalizeEOLInsertPosition(nsIDOMNode *firstNodeToInsert,
|
||||
nsCOMPtr<nsIDOMNode> *insertParentNode,
|
||||
|
@ -633,14 +633,14 @@ protected:
|
|||
/* helpers for block transformations */
|
||||
nsresult MakeDefinitionItem(const nsAString & aItemType);
|
||||
nsresult InsertBasicBlock(const nsAString & aBlockType);
|
||||
|
||||
|
||||
/* increase/decrease the font size of selection */
|
||||
enum class FontSize { incr, decr };
|
||||
nsresult RelativeFontChange(FontSize aDir);
|
||||
|
||||
|
||||
/* helper routines for font size changing */
|
||||
nsresult RelativeFontChangeOnTextNode( int32_t aSizeChange,
|
||||
nsIDOMCharacterData *aTextNode,
|
||||
nsresult RelativeFontChangeOnTextNode( int32_t aSizeChange,
|
||||
nsIDOMCharacterData *aTextNode,
|
||||
int32_t aStartOffset,
|
||||
int32_t aEndOffset);
|
||||
nsresult RelativeFontChangeOnNode(int32_t aSizeChange, nsIContent* aNode);
|
||||
|
@ -661,18 +661,18 @@ protected:
|
|||
nsresult PromoteInlineRange(nsRange* aRange);
|
||||
nsresult PromoteRangeIfStartsOrEndsInNamedAnchor(nsRange* aRange);
|
||||
nsresult SplitStyleAboveRange(nsRange* aRange,
|
||||
nsIAtom *aProperty,
|
||||
nsIAtom *aProperty,
|
||||
const nsAString *aAttribute);
|
||||
nsresult SplitStyleAbovePoint(nsCOMPtr<nsIDOMNode> *aNode,
|
||||
int32_t *aOffset,
|
||||
nsIAtom *aProperty,
|
||||
nsIAtom *aProperty,
|
||||
const nsAString *aAttribute,
|
||||
nsCOMPtr<nsIDOMNode> *outLeftNode = nullptr,
|
||||
nsCOMPtr<nsIDOMNode> *outRightNode = nullptr);
|
||||
nsresult ApplyDefaultProperties();
|
||||
nsresult RemoveStyleInside(nsIDOMNode *aNode,
|
||||
nsIAtom *aProperty,
|
||||
const nsAString *aAttribute,
|
||||
nsresult RemoveStyleInside(nsIDOMNode *aNode,
|
||||
nsIAtom *aProperty,
|
||||
const nsAString *aAttribute,
|
||||
const bool aChildrenOnly = false);
|
||||
nsresult RemoveStyleInside(nsIContent& aNode,
|
||||
nsIAtom* aProperty,
|
||||
|
@ -782,7 +782,7 @@ protected:
|
|||
// Maintain a list of associated style sheets and their urls.
|
||||
nsTArray<nsString> mStyleSheetURLs;
|
||||
nsTArray<nsRefPtr<mozilla::CSSStyleSheet>> mStyleSheets;
|
||||
|
||||
|
||||
// an array for holding default style settings
|
||||
nsTArray<PropItem*> mDefaultStyles;
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ nsHTMLEditorEventListener::MouseDown(nsIDOMMouseEvent* aMouseEvent)
|
|||
// the event; so we need to check resizing state ourselves
|
||||
htmlEditor->CheckSelectionStateForAnonymousButtons(selection);
|
||||
|
||||
// Prevent bubbling if we changed selection or
|
||||
// Prevent bubbling if we changed selection or
|
||||
// for all context clicks
|
||||
if (element || isContextClick) {
|
||||
aMouseEvent->PreventDefault();
|
||||
|
|
|
@ -59,8 +59,8 @@ IsEmptyTextNode(nsHTMLEditor* aThis, nsINode* aNode)
|
|||
isEmptyTextNode;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::AddDefaultProperty(nsIAtom *aProperty,
|
||||
const nsAString & aAttribute,
|
||||
NS_IMETHODIMP nsHTMLEditor::AddDefaultProperty(nsIAtom *aProperty,
|
||||
const nsAString & aAttribute,
|
||||
const nsAString & aValue)
|
||||
{
|
||||
nsString outValue;
|
||||
|
@ -80,8 +80,8 @@ NS_IMETHODIMP nsHTMLEditor::AddDefaultProperty(nsIAtom *aProperty,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::RemoveDefaultProperty(nsIAtom *aProperty,
|
||||
const nsAString & aAttribute,
|
||||
NS_IMETHODIMP nsHTMLEditor::RemoveDefaultProperty(nsIAtom *aProperty,
|
||||
const nsAString & aAttribute,
|
||||
const nsAString & aValue)
|
||||
{
|
||||
nsString outValue;
|
||||
|
@ -715,7 +715,7 @@ nsresult nsHTMLEditor::ApplyDefaultProperties()
|
|||
return res;
|
||||
}
|
||||
|
||||
nsresult nsHTMLEditor::RemoveStyleInside(nsIDOMNode *aNode,
|
||||
nsresult nsHTMLEditor::RemoveStyleInside(nsIDOMNode *aNode,
|
||||
// null here means remove all properties
|
||||
nsIAtom *aProperty,
|
||||
const nsAString *aAttribute,
|
||||
|
@ -762,7 +762,7 @@ nsHTMLEditor::RemoveStyleInside(nsIContent& aNode,
|
|||
)
|
||||
) {
|
||||
nsresult res;
|
||||
// if we weren't passed an attribute, then we want to
|
||||
// if we weren't passed an attribute, then we want to
|
||||
// remove any matching inlinestyles entirely
|
||||
if (!aAttribute || aAttribute->IsEmpty()) {
|
||||
NS_NAMED_LITERAL_STRING(styleAttr, "style");
|
||||
|
@ -839,7 +839,7 @@ nsHTMLEditor::RemoveStyleInside(nsIContent& aNode,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool nsHTMLEditor::IsOnlyAttribute(nsIDOMNode *aNode,
|
||||
bool nsHTMLEditor::IsOnlyAttribute(nsIDOMNode *aNode,
|
||||
const nsAString *aAttribute)
|
||||
{
|
||||
NS_ENSURE_TRUE(aNode && aAttribute, false); // ooops
|
||||
|
@ -904,7 +904,7 @@ nsHTMLEditor::PromoteRangeIfStartsOrEndsInNamedAnchor(nsRange* inRange)
|
|||
nsresult res;
|
||||
nsCOMPtr<nsIDOMNode> startNode, endNode, parent, tmp;
|
||||
int32_t startOffset, endOffset, tmpOffset;
|
||||
|
||||
|
||||
res = inRange->GetStartContainer(getter_AddRefs(startNode));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
res = inRange->GetStartOffset(&startOffset);
|
||||
|
@ -915,7 +915,7 @@ nsHTMLEditor::PromoteRangeIfStartsOrEndsInNamedAnchor(nsRange* inRange)
|
|||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
tmp = startNode;
|
||||
while ( tmp &&
|
||||
while ( tmp &&
|
||||
!nsTextEditUtils::IsBody(tmp) &&
|
||||
!nsHTMLEditUtils::IsNamedAnchor(tmp))
|
||||
{
|
||||
|
@ -931,7 +931,7 @@ nsHTMLEditor::PromoteRangeIfStartsOrEndsInNamedAnchor(nsRange* inRange)
|
|||
}
|
||||
|
||||
tmp = endNode;
|
||||
while ( tmp &&
|
||||
while ( tmp &&
|
||||
!nsTextEditUtils::IsBody(tmp) &&
|
||||
!nsHTMLEditUtils::IsNamedAnchor(tmp))
|
||||
{
|
||||
|
@ -959,7 +959,7 @@ nsHTMLEditor::PromoteInlineRange(nsRange* inRange)
|
|||
nsresult res;
|
||||
nsCOMPtr<nsIDOMNode> startNode, endNode, parent;
|
||||
int32_t startOffset, endOffset;
|
||||
|
||||
|
||||
res = inRange->GetStartContainer(getter_AddRefs(startNode));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
res = inRange->GetStartOffset(&startOffset);
|
||||
|
@ -968,9 +968,9 @@ nsHTMLEditor::PromoteInlineRange(nsRange* inRange)
|
|||
NS_ENSURE_SUCCESS(res, res);
|
||||
res = inRange->GetEndOffset(&endOffset);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
while ( startNode &&
|
||||
!nsTextEditUtils::IsBody(startNode) &&
|
||||
|
||||
while ( startNode &&
|
||||
!nsTextEditUtils::IsBody(startNode) &&
|
||||
IsEditable(startNode) &&
|
||||
IsAtFrontOfNode(startNode, startOffset) )
|
||||
{
|
||||
|
@ -978,9 +978,9 @@ nsHTMLEditor::PromoteInlineRange(nsRange* inRange)
|
|||
startNode = parent;
|
||||
}
|
||||
NS_ENSURE_TRUE(startNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
while ( endNode &&
|
||||
!nsTextEditUtils::IsBody(endNode) &&
|
||||
|
||||
while ( endNode &&
|
||||
!nsTextEditUtils::IsBody(endNode) &&
|
||||
IsEditable(endNode) &&
|
||||
IsAtEndOfNode(endNode, endOffset) )
|
||||
{
|
||||
|
@ -989,7 +989,7 @@ nsHTMLEditor::PromoteInlineRange(nsRange* inRange)
|
|||
endOffset++; // we are AFTER this node
|
||||
}
|
||||
NS_ENSURE_TRUE(endNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
res = inRange->SetStart(startNode, startOffset);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
res = inRange->SetEnd(endNode, endOffset);
|
||||
|
@ -1011,7 +1011,7 @@ bool nsHTMLEditor::IsAtFrontOfNode(nsIDOMNode *aNode, int32_t aOffset)
|
|||
else
|
||||
{
|
||||
nsCOMPtr<nsIContent> firstNode = GetFirstEditableChild(*node);
|
||||
NS_ENSURE_TRUE(firstNode, true);
|
||||
NS_ENSURE_TRUE(firstNode, true);
|
||||
int32_t offset = node->IndexOf(firstNode);
|
||||
if (offset < aOffset) return false;
|
||||
return true;
|
||||
|
@ -1024,7 +1024,7 @@ bool nsHTMLEditor::IsAtEndOfNode(nsIDOMNode *aNode, int32_t aOffset)
|
|||
NS_ENSURE_TRUE(node, false);
|
||||
uint32_t len = node->Length();
|
||||
if (aOffset == (int32_t)len) return true;
|
||||
|
||||
|
||||
if (IsTextNode(aNode))
|
||||
{
|
||||
return false;
|
||||
|
@ -1032,7 +1032,7 @@ bool nsHTMLEditor::IsAtEndOfNode(nsIDOMNode *aNode, int32_t aOffset)
|
|||
else
|
||||
{
|
||||
nsCOMPtr<nsIContent> lastNode = GetLastEditableChild(*node);
|
||||
NS_ENSURE_TRUE(lastNode, true);
|
||||
NS_ENSURE_TRUE(lastNode, true);
|
||||
int32_t offset = node->IndexOf(lastNode);
|
||||
if (offset < aOffset) return true;
|
||||
return false;
|
||||
|
@ -1215,11 +1215,11 @@ nsHTMLEditor::GetInlinePropertyBase(nsIAtom& aProperty,
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::GetInlineProperty(nsIAtom *aProperty,
|
||||
const nsAString &aAttribute,
|
||||
NS_IMETHODIMP nsHTMLEditor::GetInlineProperty(nsIAtom *aProperty,
|
||||
const nsAString &aAttribute,
|
||||
const nsAString &aValue,
|
||||
bool *aFirst,
|
||||
bool *aAny,
|
||||
bool *aFirst,
|
||||
bool *aAny,
|
||||
bool *aAll)
|
||||
{
|
||||
NS_ENSURE_TRUE(aProperty && aFirst && aAny && aAll, NS_ERROR_NULL_POINTER);
|
||||
|
@ -1233,11 +1233,11 @@ NS_IMETHODIMP nsHTMLEditor::GetInlineProperty(nsIAtom *aProperty,
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty,
|
||||
const nsAString &aAttribute,
|
||||
NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty,
|
||||
const nsAString &aAttribute,
|
||||
const nsAString &aValue,
|
||||
bool *aFirst,
|
||||
bool *aAny,
|
||||
bool *aFirst,
|
||||
bool *aAny,
|
||||
bool *aAll,
|
||||
nsAString &outValue)
|
||||
{
|
||||
|
@ -1524,8 +1524,8 @@ nsHTMLEditor::RelativeFontChange(FontSize aDir)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::RelativeFontChangeOnTextNode( int32_t aSizeChange,
|
||||
nsIDOMCharacterData *aTextNode,
|
||||
nsHTMLEditor::RelativeFontChangeOnTextNode( int32_t aSizeChange,
|
||||
nsIDOMCharacterData *aTextNode,
|
||||
int32_t aStartOffset,
|
||||
int32_t aEndOffset)
|
||||
{
|
||||
|
@ -1534,10 +1534,10 @@ nsHTMLEditor::RelativeFontChangeOnTextNode( int32_t aSizeChange,
|
|||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
nsCOMPtr<nsIContent> textNode = do_QueryInterface(aTextNode);
|
||||
NS_ENSURE_TRUE(textNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
// don't need to do anything if no characters actually selected
|
||||
if (aStartOffset == aEndOffset) return NS_OK;
|
||||
|
||||
|
||||
if (!textNode->GetParentNode() ||
|
||||
!CanContainTag(*textNode->GetParentNode(), *nsGkAtoms::big)) {
|
||||
return NS_OK;
|
||||
|
@ -1550,10 +1550,10 @@ nsHTMLEditor::RelativeFontChangeOnTextNode( int32_t aSizeChange,
|
|||
// do we need to split the text node?
|
||||
uint32_t textLen;
|
||||
aTextNode->GetLength(&textLen);
|
||||
|
||||
|
||||
// -1 is a magic value meaning to the end of node
|
||||
if (aEndOffset == -1) aEndOffset = textLen;
|
||||
|
||||
|
||||
nsresult res = NS_OK;
|
||||
if ( (uint32_t)aEndOffset != textLen )
|
||||
{
|
||||
|
@ -1584,7 +1584,7 @@ nsHTMLEditor::RelativeFontChangeOnTextNode( int32_t aSizeChange,
|
|||
res = MoveNode(node, sibling, 0);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
// else reparent the node inside font node with appropriate relative size
|
||||
nsCOMPtr<Element> newElement = InsertContainerAbove(node, nodeType);
|
||||
NS_ENSURE_STATE(newElement);
|
||||
|
@ -1603,7 +1603,7 @@ nsHTMLEditor::RelativeFontChangeHelper(int32_t aSizeChange, nsINode* aNode)
|
|||
set. Any such nodes need to have big or small put inside them, since
|
||||
they override any big/small that are above them.
|
||||
*/
|
||||
|
||||
|
||||
// Can only change font size by + or - 1
|
||||
if (aSizeChange != 1 && aSizeChange != -1) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -1648,7 +1648,7 @@ nsHTMLEditor::RelativeFontChangeOnNode(int32_t aSizeChange, nsIContent* aNode)
|
|||
} else {
|
||||
atom = nsGkAtoms::small;
|
||||
}
|
||||
|
||||
|
||||
// Is it the opposite of what we want?
|
||||
if ((aSizeChange == 1 && aNode->IsHTMLElement(nsGkAtoms::small)) ||
|
||||
(aSizeChange == -1 && aNode->IsHTMLElement(nsGkAtoms::big))) {
|
||||
|
@ -1690,7 +1690,7 @@ nsHTMLEditor::RelativeFontChangeOnNode(int32_t aSizeChange, nsIContent* aNode)
|
|||
// none of the above? then cycle through the children.
|
||||
// MOOSE: we should group the children together if possible
|
||||
// into a single "big" or "small". For the moment they are
|
||||
// each getting their own.
|
||||
// each getting their own.
|
||||
for (uint32_t i = aNode->GetChildCount(); i--; ) {
|
||||
nsresult rv = RelativeFontChangeOnNode(aSizeChange, aNode->GetChildAt(i));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -1699,7 +1699,7 @@ nsHTMLEditor::RelativeFontChangeOnNode(int32_t aSizeChange, nsIContent* aNode)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetFontFaceState(bool *aMixed, nsAString &outFace)
|
||||
{
|
||||
NS_ENSURE_TRUE(aMixed, NS_ERROR_FAILURE);
|
||||
|
@ -1708,7 +1708,7 @@ nsHTMLEditor::GetFontFaceState(bool *aMixed, nsAString &outFace)
|
|||
|
||||
nsresult res;
|
||||
bool first, any, all;
|
||||
|
||||
|
||||
NS_NAMED_LITERAL_STRING(attr, "face");
|
||||
res = GetInlinePropertyBase(*nsGkAtoms::font, &attr, nullptr, &first, &any,
|
||||
&all, &outFace);
|
||||
|
@ -1719,7 +1719,7 @@ nsHTMLEditor::GetFontFaceState(bool *aMixed, nsAString &outFace)
|
|||
*aMixed = false;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
// if there is no font face, check for tt
|
||||
res = GetInlinePropertyBase(*nsGkAtoms::tt, nullptr, nullptr, &first, &any,
|
||||
&all,nullptr);
|
||||
|
@ -1730,7 +1730,7 @@ nsHTMLEditor::GetFontFaceState(bool *aMixed, nsAString &outFace)
|
|||
*aMixed = false;
|
||||
outFace.AssignLiteral("tt");
|
||||
}
|
||||
|
||||
|
||||
if (!any)
|
||||
{
|
||||
// there was no font face attrs of any kind. We are in normal font.
|
||||
|
@ -1740,17 +1740,17 @@ nsHTMLEditor::GetFontFaceState(bool *aMixed, nsAString &outFace)
|
|||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetFontColorState(bool *aMixed, nsAString &aOutColor)
|
||||
{
|
||||
NS_ENSURE_TRUE(aMixed, NS_ERROR_NULL_POINTER);
|
||||
*aMixed = true;
|
||||
aOutColor.Truncate();
|
||||
|
||||
|
||||
nsresult res;
|
||||
NS_NAMED_LITERAL_STRING(colorStr, "color");
|
||||
bool first, any, all;
|
||||
|
||||
|
||||
res = GetInlinePropertyBase(*nsGkAtoms::font, &colorStr, nullptr, &first,
|
||||
&any, &all, &aOutColor);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
@ -1760,7 +1760,7 @@ nsHTMLEditor::GetFontColorState(bool *aMixed, nsAString &aOutColor)
|
|||
*aMixed = false;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
if (!any)
|
||||
{
|
||||
// there was no font color attrs of any kind..
|
||||
|
|
|
@ -58,7 +58,7 @@ class nsHTMLEditUtils;
|
|||
// ==================================================================
|
||||
NS_IMPL_ISUPPORTS(DocumentResizeEventListener, nsIDOMEventListener)
|
||||
|
||||
DocumentResizeEventListener::DocumentResizeEventListener(nsIHTMLEditor * aEditor)
|
||||
DocumentResizeEventListener::DocumentResizeEventListener(nsIHTMLEditor * aEditor)
|
||||
{
|
||||
mEditor = do_GetWeakReference(aEditor);
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ ResizerSelectionListener::NotifySelectionChanged(nsIDOMDocument *, nsISelection
|
|||
{
|
||||
if ((aReason & (nsISelectionListener::MOUSEDOWN_REASON |
|
||||
nsISelectionListener::KEYPRESS_REASON |
|
||||
nsISelectionListener::SELECTALL_REASON)) && aSelection)
|
||||
nsISelectionListener::SELECTALL_REASON)) && aSelection)
|
||||
{
|
||||
// the selection changed and we need to check if we have to
|
||||
// hide and/or redisplay resizing handles
|
||||
|
@ -119,7 +119,7 @@ ResizerMouseMotionListener::ResizerMouseMotionListener(nsIHTMLEditor * aEditor)
|
|||
mEditor = do_GetWeakReference(aEditor);
|
||||
}
|
||||
|
||||
ResizerMouseMotionListener::~ResizerMouseMotionListener()
|
||||
ResizerMouseMotionListener::~ResizerMouseMotionListener()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ nsHTMLEditor::RefreshResizers()
|
|||
mResizedObjectX, mResizedObjectY);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::ShowResizers(nsIDOMElement *aResizedElement)
|
||||
{
|
||||
nsresult res = ShowResizersInner(aResizedElement);
|
||||
|
@ -308,7 +308,7 @@ nsHTMLEditor::ShowResizers(nsIDOMElement *aResizedElement)
|
|||
return res;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsHTMLEditor::ShowResizersInner(nsIDOMElement *aResizedElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResizedElement);
|
||||
|
@ -388,7 +388,7 @@ nsHTMLEditor::ShowResizersInner(nsIDOMElement *aResizedElement)
|
|||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::HideResizers(void)
|
||||
{
|
||||
NS_ENSURE_TRUE(mResizedObject, NS_OK);
|
||||
|
@ -570,7 +570,7 @@ nsHTMLEditor::StartResizing(nsIDOMElement *aHandle)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::MouseDown(int32_t aClientX, int32_t aClientY,
|
||||
nsIDOMElement *aTarget, nsIDOMEvent* aEvent)
|
||||
{
|
||||
|
@ -599,7 +599,7 @@ nsHTMLEditor::MouseDown(int32_t aClientX, int32_t aClientY,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::MouseUp(int32_t aClientX, int32_t aClientY,
|
||||
nsIDOMElement *aTarget)
|
||||
{
|
||||
|
@ -755,7 +755,7 @@ nsHTMLEditor::GetNewResizingIncrement(int32_t aX, int32_t aY, int32_t aID)
|
|||
|
||||
int32_t xi = (aX - mOriginalX) * mWidthIncrementFactor;
|
||||
int32_t yi = (aY - mOriginalY) * mHeightIncrementFactor;
|
||||
float objectSizeRatio =
|
||||
float objectSizeRatio =
|
||||
((float)mResizedObjectWidth) / ((float)mResizedObjectHeight);
|
||||
result = (xi > yi) ? xi : yi;
|
||||
switch (aID) {
|
||||
|
@ -901,7 +901,7 @@ nsHTMLEditor::SetFinalSize(int32_t aX, int32_t aY)
|
|||
int32_t height = GetNewResizingHeight(aX, aY);
|
||||
bool setWidth = !mResizedObjectIsAbsolutelyPositioned || (width != mResizedObjectWidth);
|
||||
bool setHeight = !mResizedObjectIsAbsolutelyPositioned || (height != mResizedObjectHeight);
|
||||
|
||||
|
||||
int32_t x, y;
|
||||
x = left - ((mResizedObjectIsAbsolutelyPositioned) ? mResizedObjectBorderLeft+mResizedObjectMarginLeft : 0);
|
||||
y = top - ((mResizedObjectIsAbsolutelyPositioned) ? mResizedObjectBorderTop+mResizedObjectMarginTop : 0);
|
||||
|
@ -911,7 +911,7 @@ nsHTMLEditor::SetFinalSize(int32_t aX, int32_t aY)
|
|||
|
||||
NS_NAMED_LITERAL_STRING(widthStr, "width");
|
||||
NS_NAMED_LITERAL_STRING(heightStr, "height");
|
||||
|
||||
|
||||
nsCOMPtr<Element> resizedObject = do_QueryInterface(mResizedObject);
|
||||
NS_ENSURE_TRUE(resizedObject, );
|
||||
if (mResizedObjectIsAbsolutelyPositioned) {
|
||||
|
|
|
@ -23,8 +23,8 @@ class nsSelectionState;
|
|||
class nsIAtom;
|
||||
|
||||
/**
|
||||
* A transaction interface mixin - for transactions that can support.
|
||||
* the placeholder absorbtion idiom.
|
||||
* A transaction interface mixin - for transactions that can support.
|
||||
* the placeholder absorbtion idiom.
|
||||
*/
|
||||
class nsIAbsorbingTransaction : public nsISupports{
|
||||
public:
|
||||
|
@ -33,15 +33,15 @@ public:
|
|||
|
||||
NS_IMETHOD Init(nsIAtom* aName, nsSelectionState* aSelState,
|
||||
nsEditor* aEditor) = 0;
|
||||
|
||||
|
||||
NS_IMETHOD EndPlaceHolderBatch()=0;
|
||||
|
||||
|
||||
NS_IMETHOD GetTxnName(nsIAtom **aName)=0;
|
||||
|
||||
NS_IMETHOD StartSelectionEquals(nsSelectionState *aSelState, bool *aResult)=0;
|
||||
|
||||
NS_IMETHOD ForwardEndBatchTo(nsIAbsorbingTransaction *aForwardingAddress)=0;
|
||||
|
||||
|
||||
NS_IMETHOD Commit()=0;
|
||||
};
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ NS_IMETHODIMP nsPlaintextEditor::InsertTextFromTransferable(nsITransferable *aTr
|
|||
}
|
||||
}
|
||||
free(bestFlavor);
|
||||
|
||||
|
||||
// Try to scroll the selection into view if the paste/drop succeeded
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
|
@ -278,7 +278,7 @@ nsresult nsPlaintextEditor::InsertFromDrop(nsIDOMEvent* aDropEvent)
|
|||
// note that 4.x does replace if dropped on
|
||||
//deleteSelection = true;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// We are NOT over the selection
|
||||
if (srcdomdoc == destdomdoc)
|
||||
|
@ -336,7 +336,7 @@ NS_IMETHODIMP nsPlaintextEditor::Paste(int32_t aSelectionType)
|
|||
rv = PrepareTransferable(getter_AddRefs(trans));
|
||||
if (NS_SUCCEEDED(rv) && trans)
|
||||
{
|
||||
// Get the Data from the clipboard
|
||||
// Get the Data from the clipboard
|
||||
if (NS_SUCCEEDED(clipboard->GetData(trans, aSelectionType)) && IsModifiable())
|
||||
{
|
||||
// handle transferable hooks
|
||||
|
@ -381,7 +381,7 @@ NS_IMETHODIMP nsPlaintextEditor::CanPaste(int32_t aSelectionType, bool *aCanPast
|
|||
nsresult rv;
|
||||
nsCOMPtr<nsIClipboard> clipboard(do_GetService("@mozilla.org/widget/clipboard;1", &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
// the flavors that we can deal with
|
||||
const char* textEditorFlavors[] = { kUnicodeMime };
|
||||
|
||||
|
@ -390,7 +390,7 @@ NS_IMETHODIMP nsPlaintextEditor::CanPaste(int32_t aSelectionType, bool *aCanPast
|
|||
ArrayLength(textEditorFlavors),
|
||||
aSelectionType, &haveFlavors);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
*aCanPaste = haveFlavors;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ NS_IMETHODIMP nsPlaintextEditor::CanPasteTransferable(nsITransferable *aTransfer
|
|||
*aCanPaste = true;
|
||||
else
|
||||
*aCanPaste = false;
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "nsIDOMCharacterData.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
|
@ -114,7 +114,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsPlaintextEditor)
|
|||
NS_INTERFACE_MAP_END_INHERITING(nsEditor)
|
||||
|
||||
|
||||
NS_IMETHODIMP nsPlaintextEditor::Init(nsIDOMDocument *aDoc,
|
||||
NS_IMETHODIMP nsPlaintextEditor::Init(nsIDOMDocument *aDoc,
|
||||
nsIContent *aRoot,
|
||||
nsISelectionController *aSelCon,
|
||||
uint32_t aFlags,
|
||||
|
@ -122,16 +122,16 @@ NS_IMETHODIMP nsPlaintextEditor::Init(nsIDOMDocument *aDoc,
|
|||
{
|
||||
NS_PRECONDITION(aDoc, "bad arg");
|
||||
NS_ENSURE_TRUE(aDoc, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
nsresult res = NS_OK, rulesRes = NS_OK;
|
||||
if (mRules) {
|
||||
mRules->DetachEditor();
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
// block to scope nsAutoEditInitRulesTrigger
|
||||
nsAutoEditInitRulesTrigger rulesTrigger(this, rulesRes);
|
||||
|
||||
|
||||
// Init the base editor
|
||||
res = nsEditor::Init(aDoc, aRoot, aSelCon, aFlags, aInitialValue);
|
||||
}
|
||||
|
@ -187,13 +187,13 @@ nsPlaintextEditor::GetDefaultEditorPrefs(int32_t &aNewlineHandling,
|
|||
aCaretStyle = sCaretStylePref;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
nsPlaintextEditor::BeginEditorInit()
|
||||
{
|
||||
mInitTriggerCounter++;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsPlaintextEditor::EndEditorInit()
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
@ -458,14 +458,14 @@ nsPlaintextEditor::CreateBRImpl(nsCOMPtr<nsIDOMNode>* aInOutParent,
|
|||
NS_ENSURE_TRUE(aInOutParent && *aInOutParent && aInOutOffset && outBRNode, NS_ERROR_NULL_POINTER);
|
||||
*outBRNode = nullptr;
|
||||
nsresult res;
|
||||
|
||||
|
||||
// we need to insert a br. unfortunately, we may have to split a text node to do it.
|
||||
nsCOMPtr<nsIDOMNode> node = *aInOutParent;
|
||||
int32_t theOffset = *aInOutOffset;
|
||||
nsCOMPtr<nsIDOMCharacterData> nodeAsText = do_QueryInterface(node);
|
||||
NS_NAMED_LITERAL_STRING(brType, "br");
|
||||
nsCOMPtr<nsIDOMNode> brNode;
|
||||
if (nodeAsText)
|
||||
if (nodeAsText)
|
||||
{
|
||||
int32_t offset;
|
||||
uint32_t len;
|
||||
|
@ -555,10 +555,10 @@ nsPlaintextEditor::InsertBR(nsCOMPtr<nsIDOMNode>* outBRNode)
|
|||
int32_t selOffset;
|
||||
res = GetStartNodeAndOffset(selection, getter_AddRefs(selNode), &selOffset);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
|
||||
res = CreateBR(selNode, selOffset, outBRNode);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
|
||||
// position selection after br
|
||||
selNode = GetNodeLocation(*outBRNode, &selOffset);
|
||||
selection->SetInterlinePosition(true);
|
||||
|
@ -678,7 +678,7 @@ nsPlaintextEditor::DeleteSelection(EDirection aAction,
|
|||
NS_ENSURE_SUCCESS(result, result);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
aAction = eNone;
|
||||
}
|
||||
}
|
||||
|
@ -695,7 +695,7 @@ nsPlaintextEditor::DeleteSelection(EDirection aAction,
|
|||
}
|
||||
if (!cancel)
|
||||
{
|
||||
// post-process
|
||||
// post-process
|
||||
result = mRules->DidDoAction(selection, &ruleInfo, result);
|
||||
}
|
||||
|
||||
|
@ -713,7 +713,7 @@ NS_IMETHODIMP nsPlaintextEditor::InsertText(const nsAString &aStringToInsert)
|
|||
if (mComposition) {
|
||||
opID = EditAction::insertIMEText;
|
||||
}
|
||||
nsAutoPlaceHolderBatch batch(this, nullptr);
|
||||
nsAutoPlaceHolderBatch batch(this, nullptr);
|
||||
nsAutoRules beginRulesSniffing(this, opID, nsIEditor::eNext);
|
||||
|
||||
// pre-process
|
||||
|
@ -737,7 +737,7 @@ NS_IMETHODIMP nsPlaintextEditor::InsertText(const nsAString &aStringToInsert)
|
|||
}
|
||||
if (!cancel)
|
||||
{
|
||||
// post-process
|
||||
// post-process
|
||||
res = mRules->DidDoAction(selection, &ruleInfo, res);
|
||||
}
|
||||
return res;
|
||||
|
@ -906,12 +906,12 @@ NS_IMETHODIMP
|
|||
nsPlaintextEditor::GetDocumentIsEmpty(bool *aDocumentIsEmpty)
|
||||
{
|
||||
NS_ENSURE_TRUE(aDocumentIsEmpty, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
NS_ENSURE_TRUE(mRules, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
// Protect the edit rules object from dying
|
||||
nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
|
||||
|
||||
|
||||
return mRules->DocumentIsEmpty(aDocumentIsEmpty);
|
||||
}
|
||||
|
||||
|
@ -922,7 +922,7 @@ nsPlaintextEditor::GetTextLength(int32_t *aCount)
|
|||
|
||||
// initialize out params
|
||||
*aCount = 0;
|
||||
|
||||
|
||||
// special-case for empty document, to account for the bogus node
|
||||
bool docEmpty;
|
||||
nsresult rv = GetDocumentIsEmpty(&docEmpty);
|
||||
|
@ -971,7 +971,7 @@ nsPlaintextEditor::GetMaxTextLength(int32_t* aMaxTextLength)
|
|||
//
|
||||
// Get the wrap width
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsPlaintextEditor::GetWrapWidth(int32_t *aWrapColumn)
|
||||
{
|
||||
NS_ENSURE_TRUE( aWrapColumn, NS_ERROR_NULL_POINTER);
|
||||
|
@ -1000,8 +1000,8 @@ static void CutStyle(const char* stylename, nsString& styleValue)
|
|||
|
||||
//
|
||||
// Change the wrap width on the root of this document.
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsPlaintextEditor::SetWrapWidth(int32_t aWrapColumn)
|
||||
{
|
||||
SetWrapColumn(aWrapColumn);
|
||||
|
@ -1064,7 +1064,7 @@ nsPlaintextEditor::SetWrapWidth(int32_t aWrapColumn)
|
|||
return rootElement->SetAttr(kNameSpaceID_None, nsGkAtoms::style, styleValue, true);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsPlaintextEditor::SetWrapColumn(int32_t aWrapColumn)
|
||||
{
|
||||
mWrapColumn = aWrapColumn;
|
||||
|
@ -1074,7 +1074,7 @@ nsPlaintextEditor::SetWrapColumn(int32_t aWrapColumn)
|
|||
//
|
||||
// Get the newline handling for this editor
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsPlaintextEditor::GetNewlineHandling(int32_t *aNewlineHandling)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNewlineHandling);
|
||||
|
@ -1085,16 +1085,16 @@ nsPlaintextEditor::GetNewlineHandling(int32_t *aNewlineHandling)
|
|||
|
||||
//
|
||||
// Change the newline handling for this editor
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsPlaintextEditor::SetNewlineHandling(int32_t aNewlineHandling)
|
||||
{
|
||||
mNewlineHandling = aNewlineHandling;
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsPlaintextEditor::Undo(uint32_t aCount)
|
||||
{
|
||||
// Protect the edit rules object from dying
|
||||
|
@ -1112,18 +1112,18 @@ nsPlaintextEditor::Undo(uint32_t aCount)
|
|||
nsRefPtr<Selection> selection = GetSelection();
|
||||
bool cancel, handled;
|
||||
nsresult result = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
|
||||
|
||||
|
||||
if (!cancel && NS_SUCCEEDED(result))
|
||||
{
|
||||
result = nsEditor::Undo(aCount);
|
||||
result = mRules->DidDoAction(selection, &ruleInfo, result);
|
||||
}
|
||||
}
|
||||
|
||||
NotifyEditorObservers(eNotifyEditorObserversOfEnd);
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsPlaintextEditor::Redo(uint32_t aCount)
|
||||
{
|
||||
// Protect the edit rules object from dying
|
||||
|
@ -1141,12 +1141,12 @@ nsPlaintextEditor::Redo(uint32_t aCount)
|
|||
nsRefPtr<Selection> selection = GetSelection();
|
||||
bool cancel, handled;
|
||||
nsresult result = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
|
||||
|
||||
|
||||
if (!cancel && NS_SUCCEEDED(result))
|
||||
{
|
||||
result = nsEditor::Redo(aCount);
|
||||
result = mRules->DidDoAction(selection, &ruleInfo, result);
|
||||
}
|
||||
}
|
||||
|
||||
NotifyEditorObservers(eNotifyEditorObserversOfEnd);
|
||||
return result;
|
||||
|
@ -1283,7 +1283,7 @@ nsPlaintextEditor::GetAndInitDocEncoder(const nsAString& aFormatType,
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsPlaintextEditor::OutputToString(const nsAString& aFormatType,
|
||||
uint32_t aFlags,
|
||||
nsAString& aOutputString)
|
||||
|
@ -1333,7 +1333,7 @@ nsPlaintextEditor::OutputToStream(nsIOutputStream* aOutputStream,
|
|||
bool docEmpty;
|
||||
rv = GetDocumentIsEmpty(&docEmpty);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
if (docEmpty)
|
||||
return NS_OK; // output nothing
|
||||
}
|
||||
|
@ -1507,7 +1507,7 @@ nsPlaintextEditor::Rewrap(bool aRespectNewlines)
|
|||
return InsertTextWithQuotations(wrapped);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsPlaintextEditor::StripCites()
|
||||
{
|
||||
nsAutoString current;
|
||||
|
@ -1565,7 +1565,7 @@ nsPlaintextEditor::EndOperation()
|
|||
if (mRules) res = mRules->AfterEdit(mAction, mDirection);
|
||||
nsEditor::EndOperation(); // will clear mAction, mDirection
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -35,7 +35,7 @@ class Selection;
|
|||
|
||||
/**
|
||||
* The text editor implementation.
|
||||
* Use to edit text document represented as a DOM tree.
|
||||
* Use to edit text document represented as a DOM tree.
|
||||
*/
|
||||
class nsPlaintextEditor : public nsEditor,
|
||||
public nsIPlaintextEditor,
|
||||
|
@ -45,7 +45,7 @@ class nsPlaintextEditor : public nsEditor,
|
|||
public:
|
||||
|
||||
// Interfaces for addref and release and queryinterface
|
||||
// NOTE macro used is for classes that inherit from
|
||||
// NOTE macro used is for classes that inherit from
|
||||
// another class. Only the base class should use NS_DECL_ISUPPORTS
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsPlaintextEditor, nsEditor)
|
||||
|
@ -78,7 +78,7 @@ public:
|
|||
NS_IMETHOD Init(nsIDOMDocument *aDoc, nsIContent *aRoot,
|
||||
nsISelectionController *aSelCon, uint32_t aFlags,
|
||||
const nsAString& aValue) override;
|
||||
|
||||
|
||||
NS_IMETHOD GetDocumentIsEmpty(bool *aDocumentIsEmpty) override;
|
||||
NS_IMETHOD GetIsDocumentEditable(bool *aIsDocumentEditable) override;
|
||||
|
||||
|
@ -103,7 +103,7 @@ public:
|
|||
NS_IMETHOD OutputToString(const nsAString& aFormatType,
|
||||
uint32_t aFlags,
|
||||
nsAString& aOutputString) override;
|
||||
|
||||
|
||||
NS_IMETHOD OutputToStream(nsIOutputStream* aOutputStream,
|
||||
const nsAString& aFormatType,
|
||||
const nsACString& aCharsetOverride,
|
||||
|
@ -178,7 +178,7 @@ protected:
|
|||
nsIDocumentEncoder** encoder);
|
||||
|
||||
// key event helpers
|
||||
NS_IMETHOD CreateBR(nsIDOMNode *aNode, int32_t aOffset,
|
||||
NS_IMETHOD CreateBR(nsIDOMNode *aNode, int32_t aOffset,
|
||||
nsCOMPtr<nsIDOMNode> *outBRNode, EDirection aSelect = eNone);
|
||||
already_AddRefed<mozilla::dom::Element>
|
||||
CreateBRImpl(nsCOMPtr<nsINode>* aInOutParent, int32_t* aInOutOffset,
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace mozilla::dom;
|
|||
*/
|
||||
nsSelectionState::nsSelectionState() : mArray(){}
|
||||
|
||||
nsSelectionState::~nsSelectionState()
|
||||
nsSelectionState::~nsSelectionState()
|
||||
{
|
||||
MakeEmpty();
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ nsSelectionState::SaveSelection(Selection* aSel)
|
|||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsSelectionState::RestoreSelection(Selection* aSel)
|
||||
{
|
||||
NS_ENSURE_TRUE(aSel, NS_ERROR_NULL_POINTER);
|
||||
|
@ -85,13 +85,13 @@ nsSelectionState::RestoreSelection(Selection* aSel)
|
|||
|
||||
// clear out selection
|
||||
aSel->RemoveAllRanges();
|
||||
|
||||
|
||||
// set the selection ranges anew
|
||||
for (i=0; i<arrayCount; i++)
|
||||
{
|
||||
nsRefPtr<nsRange> range = mArray[i]->GetRange();
|
||||
NS_ENSURE_TRUE(range, NS_ERROR_UNEXPECTED);
|
||||
|
||||
|
||||
res = aSel->AddRange(range);
|
||||
if(NS_FAILED(res)) return res;
|
||||
|
||||
|
@ -123,7 +123,7 @@ nsSelectionState::IsEqual(nsSelectionState *aSelState)
|
|||
nsRefPtr<nsRange> myRange = mArray[i]->GetRange();
|
||||
nsRefPtr<nsRange> itsRange = aSelState->mArray[i]->GetRange();
|
||||
NS_ENSURE_TRUE(myRange && itsRange, false);
|
||||
|
||||
|
||||
int16_t compResult;
|
||||
nsresult rv;
|
||||
rv = myRange->CompareBoundaryPoints(nsIDOMRange::START_TO_START, itsRange, &compResult);
|
||||
|
@ -135,14 +135,14 @@ nsSelectionState::IsEqual(nsSelectionState *aSelState)
|
|||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
nsSelectionState::MakeEmpty()
|
||||
{
|
||||
// free any items in the array
|
||||
mArray.Clear();
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
nsSelectionState::IsEmpty()
|
||||
{
|
||||
return mArray.IsEmpty();
|
||||
|
@ -158,8 +158,8 @@ nsRangeUpdater::~nsRangeUpdater()
|
|||
{
|
||||
// nothing to do, we don't own the items in our array.
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
void
|
||||
nsRangeUpdater::RegisterRangeItem(nsRangeStore *aRangeItem)
|
||||
{
|
||||
if (!aRangeItem) return;
|
||||
|
@ -171,14 +171,14 @@ nsRangeUpdater::RegisterRangeItem(nsRangeStore *aRangeItem)
|
|||
mArray.AppendElement(aRangeItem);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
nsRangeUpdater::DropRangeItem(nsRangeStore *aRangeItem)
|
||||
{
|
||||
if (!aRangeItem) return;
|
||||
mArray.RemoveElement(aRangeItem);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsRangeUpdater::RegisterSelectionState(nsSelectionState &aSelState)
|
||||
{
|
||||
uint32_t i, theCount = aSelState.mArray.Length();
|
||||
|
@ -192,7 +192,7 @@ nsRangeUpdater::RegisterSelectionState(nsSelectionState &aSelState)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsRangeUpdater::DropSelectionState(nsSelectionState &aSelState)
|
||||
{
|
||||
uint32_t i, theCount = aSelState.mArray.Length();
|
||||
|
@ -497,7 +497,7 @@ nsRangeUpdater::SelAdjDeleteText(nsIDOMCharacterData* aTextNode,
|
|||
nsresult
|
||||
nsRangeUpdater::WillReplaceContainer()
|
||||
{
|
||||
if (mLock) return NS_ERROR_UNEXPECTED;
|
||||
if (mLock) return NS_ERROR_UNEXPECTED;
|
||||
mLock = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ nsRangeUpdater::DidReplaceContainer(Element* aOriginalNode, Element* aNewNode)
|
|||
for (uint32_t i = 0; i < count; i++) {
|
||||
nsRangeStore* item = mArray[i];
|
||||
NS_ENSURE_TRUE(item, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
if (item->startNode == aOriginalNode) {
|
||||
item->startNode = aNewNode;
|
||||
}
|
||||
|
@ -533,7 +533,7 @@ nsRangeUpdater::DidReplaceContainer(Element* aOriginalNode, Element* aNewNode)
|
|||
nsresult
|
||||
nsRangeUpdater::WillRemoveContainer()
|
||||
{
|
||||
if (mLock) return NS_ERROR_UNEXPECTED;
|
||||
if (mLock) return NS_ERROR_UNEXPECTED;
|
||||
mLock = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -555,14 +555,14 @@ nsRangeUpdater::DidRemoveContainer(nsINode* aNode, nsINode* aParent,
|
|||
for (uint32_t i = 0; i < count; i++) {
|
||||
nsRangeStore* item = mArray[i];
|
||||
NS_ENSURE_TRUE(item, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
if (item->startNode == aNode) {
|
||||
item->startNode = aParent;
|
||||
item->startOffset += aOffset;
|
||||
} else if (item->startNode == aParent && item->startOffset > aOffset) {
|
||||
item->startOffset += (int32_t)aNodeOrigLen - 1;
|
||||
}
|
||||
|
||||
|
||||
if (item->endNode == aNode) {
|
||||
item->endNode = aParent;
|
||||
item->endOffset += aOffset;
|
||||
|
@ -586,7 +586,7 @@ nsRangeUpdater::DidRemoveContainer(nsIDOMNode* aNode, nsIDOMNode* aParent,
|
|||
nsresult
|
||||
nsRangeUpdater::WillInsertContainer()
|
||||
{
|
||||
if (mLock) return NS_ERROR_UNEXPECTED;
|
||||
if (mLock) return NS_ERROR_UNEXPECTED;
|
||||
mLock = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -595,7 +595,7 @@ nsRangeUpdater::WillInsertContainer()
|
|||
nsresult
|
||||
nsRangeUpdater::DidInsertContainer()
|
||||
{
|
||||
NS_ENSURE_TRUE(mLock, NS_ERROR_UNEXPECTED);
|
||||
NS_ENSURE_TRUE(mLock, NS_ERROR_UNEXPECTED);
|
||||
mLock = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -620,7 +620,7 @@ nsRangeUpdater::DidMoveNode(nsINode* aOldParent, int32_t aOldOffset,
|
|||
for (uint32_t i = 0, count = mArray.Length(); i < count; ++i) {
|
||||
nsRangeStore* item = mArray[i];
|
||||
NS_ENSURE_TRUE_VOID(item);
|
||||
|
||||
|
||||
// like a delete in aOldParent
|
||||
if (item->startNode == aOldParent && item->startOffset > aOldOffset) {
|
||||
item->startOffset--;
|
||||
|
@ -628,7 +628,7 @@ nsRangeUpdater::DidMoveNode(nsINode* aOldParent, int32_t aOldOffset,
|
|||
if (item->endNode == aOldParent && item->endOffset > aOldOffset) {
|
||||
item->endOffset--;
|
||||
}
|
||||
|
||||
|
||||
// and like an insert in aNewParent
|
||||
if (item->startNode == aNewParent && item->startOffset > aNewOffset) {
|
||||
item->startOffset++;
|
||||
|
@ -645,8 +645,8 @@ nsRangeUpdater::DidMoveNode(nsINode* aOldParent, int32_t aOldOffset,
|
|||
* helper class for nsSelectionState. nsRangeStore stores range endpoints.
|
||||
*/
|
||||
|
||||
nsRangeStore::nsRangeStore()
|
||||
{
|
||||
nsRangeStore::nsRangeStore()
|
||||
{
|
||||
}
|
||||
nsRangeStore::~nsRangeStore()
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
already_AddRefed<nsRange> GetRange();
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(nsRangeStore)
|
||||
|
||||
|
||||
nsCOMPtr<nsINode> startNode;
|
||||
int32_t startOffset;
|
||||
nsCOMPtr<nsINode> endNode;
|
||||
|
@ -52,37 +52,37 @@ public:
|
|||
class nsSelectionState
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
nsSelectionState();
|
||||
~nsSelectionState();
|
||||
|
||||
void DoTraverse(nsCycleCollectionTraversalCallback &cb);
|
||||
void DoUnlink() { MakeEmpty(); }
|
||||
|
||||
|
||||
void SaveSelection(mozilla::dom::Selection *aSel);
|
||||
nsresult RestoreSelection(mozilla::dom::Selection* aSel);
|
||||
bool IsCollapsed();
|
||||
bool IsEqual(nsSelectionState *aSelState);
|
||||
void MakeEmpty();
|
||||
bool IsEmpty();
|
||||
protected:
|
||||
protected:
|
||||
nsTArray<nsRefPtr<nsRangeStore> > mArray;
|
||||
|
||||
|
||||
friend class nsRangeUpdater;
|
||||
};
|
||||
|
||||
class nsRangeUpdater
|
||||
{
|
||||
public:
|
||||
|
||||
public:
|
||||
|
||||
nsRangeUpdater();
|
||||
~nsRangeUpdater();
|
||||
|
||||
|
||||
void RegisterRangeItem(nsRangeStore *aRangeItem);
|
||||
void DropRangeItem(nsRangeStore *aRangeItem);
|
||||
nsresult RegisterSelectionState(nsSelectionState &aSelState);
|
||||
nsresult DropSelectionState(nsSelectionState &aSelState);
|
||||
|
||||
|
||||
// editor selection gravity routines. Note that we can't always depend on
|
||||
// DOM Range gravity to do what we want to the "real" selection. For instance,
|
||||
// if you move a node, that corresponds to deleting it and reinserting it.
|
||||
|
@ -120,7 +120,7 @@ class nsRangeUpdater
|
|||
void WillMoveNode();
|
||||
void DidMoveNode(nsINode* aOldParent, int32_t aOldOffset,
|
||||
nsINode* aNewParent, int32_t aNewOffset);
|
||||
protected:
|
||||
protected:
|
||||
nsTArray<nsRefPtr<nsRangeStore> > mArray;
|
||||
bool mLock;
|
||||
};
|
||||
|
@ -247,7 +247,7 @@ class MOZ_STACK_CLASS nsAutoRemoveContainerSelNotify
|
|||
{
|
||||
mRU.WillRemoveContainer();
|
||||
}
|
||||
|
||||
|
||||
~nsAutoRemoveContainerSelNotify()
|
||||
{
|
||||
mRU.DidRemoveContainer(mNode, mParent, mOffset, mNodeOrigLen);
|
||||
|
@ -270,7 +270,7 @@ class MOZ_STACK_CLASS nsAutoInsertContainerSelNotify
|
|||
{
|
||||
mRU.WillInsertContainer();
|
||||
}
|
||||
|
||||
|
||||
~nsAutoInsertContainerSelNotify()
|
||||
{
|
||||
mRU.DidInsertContainer();
|
||||
|
@ -293,9 +293,9 @@ class MOZ_STACK_CLASS nsAutoMoveNodeSelNotify
|
|||
int32_t mNewOffset;
|
||||
|
||||
public:
|
||||
nsAutoMoveNodeSelNotify(nsRangeUpdater &aRangeUpdater,
|
||||
nsAutoMoveNodeSelNotify(nsRangeUpdater &aRangeUpdater,
|
||||
nsINode* aOldParent,
|
||||
int32_t aOldOffset,
|
||||
int32_t aOldOffset,
|
||||
nsINode* aNewParent,
|
||||
int32_t aNewOffset)
|
||||
: mRU(aRangeUpdater)
|
||||
|
@ -308,7 +308,7 @@ class MOZ_STACK_CLASS nsAutoMoveNodeSelNotify
|
|||
MOZ_ASSERT(aNewParent);
|
||||
mRU.WillMoveNode();
|
||||
}
|
||||
|
||||
|
||||
~nsAutoMoveNodeSelNotify()
|
||||
{
|
||||
mRU.DidMoveNode(mOldParent, mOldOffset, mNewParent, mNewOffset);
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -53,7 +53,7 @@ using namespace mozilla::dom;
|
|||
|
||||
|
||||
/********************************************************
|
||||
* Constructor/Destructor
|
||||
* Constructor/Destructor
|
||||
********************************************************/
|
||||
|
||||
nsTextEditRules::nsTextEditRules()
|
||||
|
@ -105,7 +105,7 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(nsTextEditRules)
|
|||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsTextEditRules)
|
||||
|
||||
/********************************************************
|
||||
* Public methods
|
||||
* Public methods
|
||||
********************************************************/
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -171,7 +171,7 @@ nsTextEditRules::BeforeEdit(EditAction action,
|
|||
nsIEditor::EDirection aDirection)
|
||||
{
|
||||
if (mLockRulesSniffing) return NS_OK;
|
||||
|
||||
|
||||
nsAutoLockRulesSniffing lockIt(this);
|
||||
mDidExplicitlySetInterline = false;
|
||||
if (!mActionNesting)
|
||||
|
@ -180,7 +180,7 @@ nsTextEditRules::BeforeEdit(EditAction action,
|
|||
mTheAction = action;
|
||||
}
|
||||
mActionNesting++;
|
||||
|
||||
|
||||
// get the selection and cache the position before editing
|
||||
NS_ENSURE_STATE(mEditor);
|
||||
nsRefPtr<Selection> selection = mEditor->GetSelection();
|
||||
|
@ -198,9 +198,9 @@ nsTextEditRules::AfterEdit(EditAction action,
|
|||
nsIEditor::EDirection aDirection)
|
||||
{
|
||||
if (mLockRulesSniffing) return NS_OK;
|
||||
|
||||
|
||||
nsAutoLockRulesSniffing lockIt(this);
|
||||
|
||||
|
||||
NS_PRECONDITION(mActionNesting>0, "bad action nesting!");
|
||||
nsresult res = NS_OK;
|
||||
if (!--mActionNesting)
|
||||
|
@ -208,7 +208,7 @@ nsTextEditRules::AfterEdit(EditAction action,
|
|||
NS_ENSURE_STATE(mEditor);
|
||||
nsRefPtr<Selection> selection = mEditor->GetSelection();
|
||||
NS_ENSURE_STATE(selection);
|
||||
|
||||
|
||||
NS_ENSURE_STATE(mEditor);
|
||||
res = mEditor->HandleInlineSpellCheck(action, selection,
|
||||
mCachedSelectionNode, mCachedSelectionOffset,
|
||||
|
@ -223,7 +223,7 @@ nsTextEditRules::AfterEdit(EditAction action,
|
|||
// detect empty doc
|
||||
res = CreateBogusNodeIfNeeded(selection);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
|
||||
// ensure trailing br node
|
||||
res = CreateTrailingBRIfNeeded();
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
@ -280,7 +280,7 @@ nsTextEditRules::WillDoAction(Selection* aSelection,
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsTextEditRules::DidDoAction(Selection* aSelection,
|
||||
nsRulesInfo *aInfo, nsresult aResult)
|
||||
{
|
||||
|
@ -290,7 +290,7 @@ nsTextEditRules::DidDoAction(Selection* aSelection,
|
|||
nsAutoTxnsConserveSelection dontSpazMySelection(mEditor);
|
||||
|
||||
NS_ENSURE_TRUE(aSelection && aInfo, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
// my kingdom for dynamic cast
|
||||
nsTextRulesInfo *info = static_cast<nsTextRulesInfo*>(aInfo);
|
||||
|
||||
|
@ -324,13 +324,13 @@ NS_IMETHODIMP
|
|||
nsTextEditRules::DocumentIsEmpty(bool *aDocumentIsEmpty)
|
||||
{
|
||||
NS_ENSURE_TRUE(aDocumentIsEmpty, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
*aDocumentIsEmpty = (mBogusNode != nullptr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/********************************************************
|
||||
* Protected methods
|
||||
* Protected methods
|
||||
********************************************************/
|
||||
|
||||
|
||||
|
@ -338,12 +338,12 @@ nsresult
|
|||
nsTextEditRules::WillInsert(Selection* aSelection, bool* aCancel)
|
||||
{
|
||||
NS_ENSURE_TRUE(aSelection && aCancel, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
CANCEL_OPERATION_IF_READONLY_OR_DISABLED
|
||||
|
||||
// initialize out param
|
||||
*aCancel = false;
|
||||
|
||||
|
||||
// check for the magic content node and delete it if it exists
|
||||
if (mBogusNode)
|
||||
{
|
||||
|
@ -373,7 +373,7 @@ nsTextEditRules::WillInsertBreak(Selection* aSelection,
|
|||
if (IsSingleLineEditor()) {
|
||||
*aCancel = true;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// handle docs with a max length
|
||||
// NOTE, this function copies inString into outString for us.
|
||||
|
@ -406,7 +406,7 @@ nsTextEditRules::WillInsertBreak(Selection* aSelection,
|
|||
// initialize out param
|
||||
// we want to ignore result of WillInsert()
|
||||
*aCancel = false;
|
||||
|
||||
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -422,7 +422,7 @@ nsTextEditRules::CollapseSelectionToTrailingBRIfNeeded(Selection* aSelection)
|
|||
{
|
||||
// we only need to execute the stuff below if we are a plaintext editor.
|
||||
// html editors have a different mechanism for putting in mozBR's
|
||||
// (because there are a bunch more places you have to worry about it in html)
|
||||
// (because there are a bunch more places you have to worry about it in html)
|
||||
if (!IsPlaintextEditor()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -587,20 +587,20 @@ nsTextEditRules::WillInsertText(EditAction aAction,
|
|||
const nsAString *inString,
|
||||
nsAString *outString,
|
||||
int32_t aMaxLength)
|
||||
{
|
||||
{
|
||||
if (!aSelection || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
if (inString->IsEmpty() && aAction != EditAction::insertIMEText) {
|
||||
// HACK: this is a fix for bug 19395
|
||||
// I can't outlaw all empty insertions
|
||||
// because IME transaction depend on them
|
||||
// There is more work to do to make the
|
||||
// There is more work to do to make the
|
||||
// world safe for IME.
|
||||
*aCancel = true;
|
||||
*aHandled = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// initialize out param
|
||||
*aCancel = false;
|
||||
*aHandled = true;
|
||||
|
@ -618,7 +618,7 @@ nsTextEditRules::WillInsertText(EditAction aAction,
|
|||
*aCancel = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
int32_t start = 0;
|
||||
int32_t end = 0;
|
||||
|
||||
|
@ -645,7 +645,7 @@ nsTextEditRules::WillInsertText(EditAction aAction,
|
|||
// initialize out param
|
||||
// we want to ignore result of WillInsert()
|
||||
*aCancel = false;
|
||||
|
||||
|
||||
// handle password field data
|
||||
// this has the side effect of changing all the characters in aOutString
|
||||
// to the replacement character
|
||||
|
@ -696,8 +696,8 @@ nsTextEditRules::WillInsertText(EditAction aAction,
|
|||
}
|
||||
mTimer->InitWithCallback(this, LookAndFeel::GetPasswordMaskDelay(),
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
FillBufWithPWChars(outString, outString->Length());
|
||||
}
|
||||
|
@ -720,7 +720,7 @@ nsTextEditRules::WillInsertText(EditAction aAction,
|
|||
NS_ENSURE_STATE(mEditor);
|
||||
nsCOMPtr<nsIDocument> doc = mEditor->GetDocument();
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
|
||||
if (aAction == EditAction::insertIMEText) {
|
||||
NS_ENSURE_STATE(mEditor);
|
||||
res = mEditor->InsertTextImpl(*outString, address_of(selNode), &selOffset, doc);
|
||||
|
@ -738,9 +738,9 @@ nsTextEditRules::WillInsertText(EditAction aAction,
|
|||
&curOffset, doc);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
if (curNode)
|
||||
if (curNode)
|
||||
{
|
||||
// Make the caret attach to the inserted text, unless this text ends with a LF,
|
||||
// Make the caret attach to the inserted text, unless this text ends with a LF,
|
||||
// in which case make the caret attach to the next line.
|
||||
bool endsWithLF =
|
||||
!outString->IsEmpty() && outString->Last() == nsCRT::LF;
|
||||
|
@ -765,7 +765,7 @@ nsresult
|
|||
nsTextEditRules::WillSetTextProperty(Selection* aSelection, bool* aCancel,
|
||||
bool* aHandled)
|
||||
{
|
||||
if (!aSelection || !aCancel || !aHandled)
|
||||
if (!aSelection || !aCancel || !aHandled)
|
||||
{ return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
// XXX: should probably return a success value other than NS_OK that means "not allowed"
|
||||
|
@ -785,7 +785,7 @@ nsresult
|
|||
nsTextEditRules::WillRemoveTextProperty(Selection* aSelection, bool* aCancel,
|
||||
bool* aHandled)
|
||||
{
|
||||
if (!aSelection || !aCancel || !aHandled)
|
||||
if (!aSelection || !aCancel || !aHandled)
|
||||
{ return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
// XXX: should probably return a success value other than NS_OK that means "not allowed"
|
||||
|
@ -803,7 +803,7 @@ nsTextEditRules::DidRemoveTextProperty(Selection* aSelection, nsresult aResult)
|
|||
|
||||
nsresult
|
||||
nsTextEditRules::WillDeleteSelection(Selection* aSelection,
|
||||
nsIEditor::EDirection aCollapsedAction,
|
||||
nsIEditor::EDirection aCollapsedAction,
|
||||
bool *aCancel,
|
||||
bool *aHandled)
|
||||
{
|
||||
|
@ -813,7 +813,7 @@ nsTextEditRules::WillDeleteSelection(Selection* aSelection,
|
|||
// initialize out param
|
||||
*aCancel = false;
|
||||
*aHandled = false;
|
||||
|
||||
|
||||
// if there is only bogus content, cancel the operation
|
||||
if (mBogusNode) {
|
||||
*aCancel = true;
|
||||
|
@ -866,11 +866,11 @@ nsTextEditRules::WillDeleteSelection(Selection* aSelection,
|
|||
res = mEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(startNode), &startOffset);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
NS_ENSURE_TRUE(startNode, NS_ERROR_FAILURE);
|
||||
|
||||
|
||||
bool bCollapsed;
|
||||
res = aSelection->GetIsCollapsed(&bCollapsed);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
|
||||
if (!bCollapsed)
|
||||
return NS_OK;
|
||||
|
||||
|
@ -894,8 +894,8 @@ nsTextEditRules::WillDeleteSelection(Selection* aSelection,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsTextEditRules::DidDeleteSelection(Selection* aSelection,
|
||||
nsIEditor::EDirection aCollapsedAction,
|
||||
nsTextEditRules::DidDeleteSelection(Selection* aSelection,
|
||||
nsIEditor::EDirection aCollapsedAction,
|
||||
nsresult aResult)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> startNode;
|
||||
|
@ -904,7 +904,7 @@ nsTextEditRules::DidDeleteSelection(Selection* aSelection,
|
|||
nsresult res = mEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(startNode), &startOffset);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
NS_ENSURE_TRUE(startNode, NS_ERROR_FAILURE);
|
||||
|
||||
|
||||
// delete empty text nodes at selection
|
||||
if (mEditor->IsTextNode(startNode))
|
||||
{
|
||||
|
@ -912,7 +912,7 @@ nsTextEditRules::DidDeleteSelection(Selection* aSelection,
|
|||
uint32_t strLength;
|
||||
res = textNode->GetLength(&strLength);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
|
||||
// are we in an empty text node?
|
||||
if (!strLength)
|
||||
{
|
||||
|
@ -980,12 +980,12 @@ nsTextEditRules::DidRedo(Selection* aSelection, nsresult aResult)
|
|||
{
|
||||
nsresult res = aResult; // if aResult is an error, we return it.
|
||||
if (!aSelection) { return NS_ERROR_NULL_POINTER; }
|
||||
if (NS_SUCCEEDED(res))
|
||||
if (NS_SUCCEEDED(res))
|
||||
{
|
||||
NS_ENSURE_STATE(mEditor);
|
||||
nsCOMPtr<nsIDOMElement> theRoot = do_QueryInterface(mEditor->GetRoot());
|
||||
NS_ENSURE_TRUE(theRoot, NS_ERROR_FAILURE);
|
||||
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLCollection> nodeList;
|
||||
res = theRoot->GetElementsByTagName(NS_LITERAL_STRING("br"),
|
||||
getter_AddRefs(nodeList));
|
||||
|
@ -994,11 +994,11 @@ nsTextEditRules::DidRedo(Selection* aSelection, nsresult aResult)
|
|||
{
|
||||
uint32_t len;
|
||||
nodeList->GetLength(&len);
|
||||
|
||||
|
||||
if (len != 1) {
|
||||
// only in the case of one br could there be the bogus node
|
||||
mBogusNode = nullptr;
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
|
@ -1018,12 +1018,12 @@ nsTextEditRules::DidRedo(Selection* aSelection, nsresult aResult)
|
|||
nsresult
|
||||
nsTextEditRules::WillOutputText(Selection* aSelection,
|
||||
const nsAString *aOutputFormat,
|
||||
nsAString *aOutString,
|
||||
nsAString *aOutString,
|
||||
bool *aCancel,
|
||||
bool *aHandled)
|
||||
{
|
||||
// null selection ok
|
||||
if (!aOutString || !aOutputFormat || !aCancel || !aHandled)
|
||||
if (!aOutString || !aOutputFormat || !aCancel || !aHandled)
|
||||
{ return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
// initialize out param
|
||||
|
@ -1204,7 +1204,7 @@ nsTextEditRules::TruncateInsertionIfNeeded(Selection* aSelection,
|
|||
bool *aTruncated)
|
||||
{
|
||||
if (!aSelection || !aInString || !aOutString) {return NS_ERROR_NULL_POINTER;}
|
||||
|
||||
|
||||
nsresult res = NS_OK;
|
||||
if (!aOutString->Assign(*aInString, mozilla::fallible)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -1212,7 +1212,7 @@ nsTextEditRules::TruncateInsertionIfNeeded(Selection* aSelection,
|
|||
if (aTruncated) {
|
||||
*aTruncated = false;
|
||||
}
|
||||
|
||||
|
||||
NS_ENSURE_STATE(mEditor);
|
||||
if ((-1 != aMaxLength) && IsPlaintextEditor() && !mEditor->IsIMEComposing() )
|
||||
{
|
||||
|
@ -1220,13 +1220,13 @@ nsTextEditRules::TruncateInsertionIfNeeded(Selection* aSelection,
|
|||
// Get the length of inString.
|
||||
// Get the length of the selection.
|
||||
// If selection is collapsed, it is length 0.
|
||||
// Subtract the length of the selection from the len(doc)
|
||||
// Subtract the length of the selection from the len(doc)
|
||||
// since we'll delete the selection on insert.
|
||||
// This is resultingDocLength.
|
||||
// Get old length of IME composing string
|
||||
// which will be replaced by new one.
|
||||
// If (resultingDocLength) is at or over max, cancel the insert
|
||||
// If (resultingDocLength) + (length of input) > max,
|
||||
// If (resultingDocLength) + (length of input) > max,
|
||||
// set aOutString to subset of inString so length = max
|
||||
int32_t docLength;
|
||||
res = mEditor->GetTextLength(&docLength);
|
||||
|
@ -1331,10 +1331,10 @@ nsresult nsTextEditRules::HideLastPWInput() {
|
|||
|
||||
nsCOMPtr<nsIDOMNode> selNode = GetTextNode(selection, mEditor);
|
||||
NS_ENSURE_TRUE(selNode, NS_OK);
|
||||
|
||||
|
||||
nsCOMPtr<nsIDOMCharacterData> nodeAsText(do_QueryInterface(selNode));
|
||||
NS_ENSURE_TRUE(nodeAsText, NS_OK);
|
||||
|
||||
|
||||
nodeAsText->ReplaceData(mLastStart, mLastLength, hiddenText);
|
||||
selection->Collapse(selNode, start);
|
||||
if (start != end)
|
||||
|
@ -1360,8 +1360,8 @@ nsTextEditRules::FillBufWithPWChars(nsAString *aOutString, int32_t aLength)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// CreateMozBR: put a BR node with moz attribute at {aNode, aOffset}
|
||||
//
|
||||
nsresult
|
||||
//
|
||||
nsresult
|
||||
nsTextEditRules::CreateMozBR(nsIDOMNode* inParent, int32_t inOffset,
|
||||
nsIDOMNode** outBRNode)
|
||||
{
|
||||
|
|
|
@ -26,14 +26,14 @@ class Selection;
|
|||
} // namespace mozilla
|
||||
|
||||
/** Object that encapsulates HTML text-specific editing rules.
|
||||
*
|
||||
*
|
||||
* To be a good citizen, edit rules must live by these restrictions:
|
||||
* 1. All data manipulation is through the editor.
|
||||
* 1. All data manipulation is through the editor.
|
||||
* Content nodes in the document tree must <B>not</B> be manipulated directly.
|
||||
* Content nodes in document fragments that are not part of the document itself
|
||||
* may be manipulated at will. Operations on document fragments must <B>not</B>
|
||||
* go through the editor.
|
||||
* 2. Selection must not be explicitly set by the rule method.
|
||||
* 2. Selection must not be explicitly set by the rule method.
|
||||
* Any manipulation of Selection must be done by the editor.
|
||||
*/
|
||||
class nsTextEditRules : public nsIEditRules, public nsITimerCallback
|
||||
|
@ -127,11 +127,11 @@ protected:
|
|||
nsresult DidInsert(mozilla::dom::Selection* aSelection, nsresult aResult);
|
||||
|
||||
nsresult WillDeleteSelection(mozilla::dom::Selection* aSelection,
|
||||
nsIEditor::EDirection aCollapsedAction,
|
||||
nsIEditor::EDirection aCollapsedAction,
|
||||
bool *aCancel,
|
||||
bool *aHandled);
|
||||
nsresult DidDeleteSelection(mozilla::dom::Selection* aSelection,
|
||||
nsIEditor::EDirection aCollapsedAction,
|
||||
nsIEditor::EDirection aCollapsedAction,
|
||||
nsresult aResult);
|
||||
|
||||
nsresult WillSetTextProperty(mozilla::dom::Selection* aSelection,
|
||||
|
@ -161,8 +161,8 @@ protected:
|
|||
*/
|
||||
nsresult WillOutputText(mozilla::dom::Selection* aSelection,
|
||||
const nsAString *aInFormat,
|
||||
nsAString *aOutText,
|
||||
bool *aOutCancel,
|
||||
nsAString *aOutText,
|
||||
bool *aOutCancel,
|
||||
bool *aHandled);
|
||||
|
||||
nsresult DidOutputText(mozilla::dom::Selection* aSelection, nsresult aResult);
|
||||
|
@ -172,10 +172,10 @@ protected:
|
|||
|
||||
/** check for and replace a redundant trailing break */
|
||||
nsresult RemoveRedundantTrailingBR();
|
||||
|
||||
|
||||
/** creates a trailing break in the text doc if there is not one already */
|
||||
nsresult CreateTrailingBRIfNeeded();
|
||||
|
||||
|
||||
/** creates a bogus text node if the document has no editable content */
|
||||
nsresult CreateBogusNodeIfNeeded(mozilla::dom::Selection* aSelection);
|
||||
|
||||
|
@ -194,8 +194,8 @@ protected:
|
|||
nsIDOMNode** outBRNode = nullptr);
|
||||
|
||||
nsresult CheckBidiLevelForDeletion(mozilla::dom::Selection* aSelection,
|
||||
nsIDOMNode *aSelNode,
|
||||
int32_t aSelOffset,
|
||||
nsIDOMNode *aSelNode,
|
||||
int32_t aSelOffset,
|
||||
nsIEditor::EDirection aAction,
|
||||
bool *aCancel);
|
||||
|
||||
|
@ -244,7 +244,7 @@ protected:
|
|||
bool mLockRulesSniffing;
|
||||
bool mDidExplicitlySetInterline;
|
||||
bool mDeleteBidiImmediately; // in bidirectional text, delete
|
||||
// characters not visually
|
||||
// characters not visually
|
||||
// adjacent to the caret without
|
||||
// moving the caret first.
|
||||
EditAction mTheAction; // the top level editor action
|
||||
|
@ -261,7 +261,7 @@ protected:
|
|||
class nsTextRulesInfo : public nsRulesInfo
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
explicit nsTextRulesInfo(EditAction aAction) :
|
||||
nsRulesInfo(aAction),
|
||||
inString(0),
|
||||
|
@ -279,17 +279,17 @@ class nsTextRulesInfo : public nsRulesInfo
|
|||
{}
|
||||
|
||||
virtual ~nsTextRulesInfo() {}
|
||||
|
||||
|
||||
// kInsertText
|
||||
const nsAString *inString;
|
||||
nsAString *outString;
|
||||
const nsAString *outputFormat;
|
||||
int32_t maxLength;
|
||||
|
||||
|
||||
// kDeleteSelection
|
||||
nsIEditor::EDirection collapsedAction;
|
||||
nsIEditor::EStripWrappers stripWrappers;
|
||||
|
||||
|
||||
// kMakeList
|
||||
bool bOrdered;
|
||||
bool entireList;
|
||||
|
@ -297,10 +297,10 @@ class nsTextRulesInfo : public nsRulesInfo
|
|||
|
||||
// kAlign
|
||||
const nsAString *alignType;
|
||||
|
||||
|
||||
// kMakeBasicBlock
|
||||
const nsAString *blockType;
|
||||
|
||||
|
||||
// kInsertElement
|
||||
const nsIDOMElement* insertElement;
|
||||
};
|
||||
|
@ -309,17 +309,17 @@ class nsTextRulesInfo : public nsRulesInfo
|
|||
/***************************************************************************
|
||||
* stack based helper class for StartOperation()/EndOperation() sandwich.
|
||||
* this class sets a bool letting us know to ignore any rules sniffing
|
||||
* that tries to occur reentrantly.
|
||||
* that tries to occur reentrantly.
|
||||
*/
|
||||
class nsAutoLockRulesSniffing
|
||||
{
|
||||
public:
|
||||
|
||||
explicit nsAutoLockRulesSniffing(nsTextEditRules *rules) : mRules(rules)
|
||||
|
||||
explicit nsAutoLockRulesSniffing(nsTextEditRules *rules) : mRules(rules)
|
||||
{if (mRules) mRules->mLockRulesSniffing = true;}
|
||||
~nsAutoLockRulesSniffing()
|
||||
~nsAutoLockRulesSniffing()
|
||||
{if (mRules) mRules->mLockRulesSniffing = false;}
|
||||
|
||||
|
||||
protected:
|
||||
nsTextEditRules *mRules;
|
||||
};
|
||||
|
@ -332,12 +332,12 @@ class nsAutoLockRulesSniffing
|
|||
class nsAutoLockListener
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
explicit nsAutoLockListener(bool *enabled) : mEnabled(enabled)
|
||||
{if (mEnabled) { mOldState=*mEnabled; *mEnabled = false;}}
|
||||
~nsAutoLockListener()
|
||||
~nsAutoLockListener()
|
||||
{if (mEnabled) *mEnabled = mOldState;}
|
||||
|
||||
|
||||
protected:
|
||||
bool *mEnabled;
|
||||
bool mOldState;
|
||||
|
|
|
@ -25,8 +25,8 @@ using namespace mozilla::dom;
|
|||
// Test for distance between caret and text that will be deleted
|
||||
nsresult
|
||||
nsTextEditRules::CheckBidiLevelForDeletion(Selection* aSelection,
|
||||
nsIDOMNode *aSelNode,
|
||||
int32_t aSelOffset,
|
||||
nsIDOMNode *aSelNode,
|
||||
int32_t aSelOffset,
|
||||
nsIEditor::EDirection aAction,
|
||||
bool *aCancel)
|
||||
{
|
||||
|
@ -35,13 +35,13 @@ nsTextEditRules::CheckBidiLevelForDeletion(Selection* aSelection,
|
|||
|
||||
nsCOMPtr<nsIPresShell> shell = mEditor->GetPresShell();
|
||||
NS_ENSURE_TRUE(shell, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
|
||||
nsPresContext *context = shell->GetPresContext();
|
||||
NS_ENSURE_TRUE(context, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
if (!context->BidiEnabled())
|
||||
return NS_OK;
|
||||
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aSelNode);
|
||||
NS_ENSURE_TRUE(content, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
@ -50,10 +50,10 @@ nsTextEditRules::CheckBidiLevelForDeletion(Selection* aSelection,
|
|||
nsRefPtr<nsFrameSelection> frameSelection =
|
||||
static_cast<Selection*>(aSelection)->GetFrameSelection();
|
||||
NS_ENSURE_TRUE(frameSelection, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
||||
nsPrevNextBidiLevels levels = frameSelection->
|
||||
GetPrevNextBidiLevels(content, aSelOffset, true);
|
||||
|
||||
|
||||
levelBefore = levels.mLevelBefore;
|
||||
levelAfter = levels.mLevelAfter;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ using namespace mozilla;
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsBody: true if node an html body node
|
||||
bool
|
||||
bool
|
||||
nsTextEditUtils::IsBody(nsIDOMNode *node)
|
||||
{
|
||||
return nsEditor::NodeIsType(node, nsGkAtoms::body);
|
||||
|
@ -34,13 +34,13 @@ nsTextEditUtils::IsBody(nsIDOMNode *node)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsBreak: true if node an html break node
|
||||
bool
|
||||
bool
|
||||
nsTextEditUtils::IsBreak(nsIDOMNode *node)
|
||||
{
|
||||
return nsEditor::NodeIsType(node, nsGkAtoms::br);
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
bool
|
||||
nsTextEditUtils::IsBreak(nsINode* aNode)
|
||||
{
|
||||
MOZ_ASSERT(aNode);
|
||||
|
@ -50,8 +50,8 @@ nsTextEditUtils::IsBreak(nsINode* aNode)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsMozBR: true if node an html br node with type = _moz
|
||||
//
|
||||
bool
|
||||
//
|
||||
bool
|
||||
nsTextEditUtils::IsMozBR(nsIDOMNode *node)
|
||||
{
|
||||
NS_PRECONDITION(node, "null node passed to nsHTMLEditUtils::IsMozBR");
|
||||
|
@ -73,8 +73,8 @@ nsTextEditUtils::IsMozBR(nsINode* aNode)
|
|||
// HasMozAttr: true if node has type attribute = _moz
|
||||
// (used to indicate the div's and br's we use in
|
||||
// mail compose rules)
|
||||
//
|
||||
bool
|
||||
//
|
||||
bool
|
||||
nsTextEditUtils::HasMozAttr(nsIDOMNode *node)
|
||||
{
|
||||
NS_PRECONDITION(node, "null parent passed to nsHTMLEditUtils::HasMozAttr");
|
||||
|
|
|
@ -120,7 +120,7 @@ nsWSRunObject::ScrubBlockBoundary(nsHTMLEditor* aHTMLEd,
|
|||
NS_ENSURE_STATE(aOffset >= 0);
|
||||
offset = aOffset;
|
||||
}
|
||||
|
||||
|
||||
nsWSRunObject theWSObj(aHTMLEd, aBlock, offset);
|
||||
return theWSObj.Scrub();
|
||||
}
|
||||
|
@ -573,7 +573,7 @@ nsWSRunObject::NextVisibleNode(nsINode* aNode,
|
|||
*outType = mEndReason;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsWSRunObject::AdjustWhitespace()
|
||||
{
|
||||
// this routine examines a run of ws and tries to get rid of some unneeded nbsp's,
|
||||
|
@ -621,7 +621,7 @@ nsresult
|
|||
nsWSRunObject::GetWSNodes()
|
||||
{
|
||||
// collect up an array of nodes that are contiguous with the insertion point
|
||||
// and which contain only whitespace. Stop if you reach non-ws text or a new
|
||||
// and which contain only whitespace. Stop if you reach non-ws text or a new
|
||||
// block boundary.
|
||||
::DOMPoint start(mNode, mOffset), end(mNode, mOffset);
|
||||
nsCOMPtr<nsINode> wsBoundingParent = GetWSBoundingParent();
|
||||
|
@ -629,7 +629,7 @@ nsWSRunObject::GetWSNodes()
|
|||
// first look backwards to find preceding ws nodes
|
||||
if (nsRefPtr<Text> textNode = mNode->GetAsText()) {
|
||||
const nsTextFragment* textFrag = textNode->GetText();
|
||||
|
||||
|
||||
mNodeArray.InsertElementAt(0, textNode);
|
||||
if (mOffset) {
|
||||
for (int32_t pos = mOffset - 1; pos >= 0; pos--) {
|
||||
|
@ -729,9 +729,9 @@ nsWSRunObject::GetWSNodes()
|
|||
mStartOffset = start.offset;
|
||||
mStartReason = WSType::thisBlock;
|
||||
mStartReasonNode = wsBoundingParent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// then look ahead to find following ws nodes
|
||||
if (nsRefPtr<Text> textNode = mNode->GetAsText()) {
|
||||
// don't need to put it on list. it already is from code above
|
||||
|
@ -819,8 +819,8 @@ nsWSRunObject::GetWSNodes()
|
|||
}
|
||||
}
|
||||
} else {
|
||||
// we encountered a break or a special node, like <img>,
|
||||
// that is not a block and not a break but still
|
||||
// we encountered a break or a special node, like <img>,
|
||||
// that is not a block and not a break but still
|
||||
// serves as a terminator to ws runs.
|
||||
mEndNode = end.node;
|
||||
mEndOffset = end.offset;
|
||||
|
@ -837,7 +837,7 @@ nsWSRunObject::GetWSNodes()
|
|||
mEndOffset = end.offset;
|
||||
mEndReason = WSType::thisBlock;
|
||||
mEndReasonNode = wsBoundingParent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -847,7 +847,7 @@ void
|
|||
nsWSRunObject::GetRuns()
|
||||
{
|
||||
ClearRuns();
|
||||
|
||||
|
||||
// handle some easy cases first
|
||||
mHTMLEditor->IsPreformatted(GetAsDOMNode(mNode), &mPRE);
|
||||
// if it's preformatedd, or if we are surrounded by text or special, it's all one
|
||||
|
@ -875,12 +875,12 @@ nsWSRunObject::GetRuns()
|
|||
MakeSingleWSRun(wstype);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// otherwise a little trickier. shucks.
|
||||
mStartRun = new WSFragment();
|
||||
mStartRun->mStartNode = mStartNode;
|
||||
mStartRun->mStartOffset = mStartOffset;
|
||||
|
||||
|
||||
if (mStartReason & WSType::block || mStartReason == WSType::br) {
|
||||
// set up mStartRun
|
||||
mStartRun->mType = WSType::leadingWS;
|
||||
|
@ -888,7 +888,7 @@ nsWSRunObject::GetRuns()
|
|||
mStartRun->mEndOffset = mFirstNBSPOffset;
|
||||
mStartRun->mLeftType = mStartReason;
|
||||
mStartRun->mRightType = WSType::normalWS;
|
||||
|
||||
|
||||
// set up next run
|
||||
WSFragment *normalRun = new WSFragment();
|
||||
mStartRun->mRight = normalRun;
|
||||
|
@ -923,7 +923,7 @@ nsWSRunObject::GetRuns()
|
|||
normalRun->mEndNode = mLastNBSPNode;
|
||||
normalRun->mEndOffset = mLastNBSPOffset+1;
|
||||
normalRun->mRightType = WSType::trailingWS;
|
||||
|
||||
|
||||
// set up next run
|
||||
WSFragment *lastRun = new WSFragment();
|
||||
lastRun->mType = WSType::trailingWS;
|
||||
|
@ -1000,7 +1000,7 @@ nsWSRunObject::MakeSingleWSRun(WSType aType)
|
|||
mStartRun->mEndOffset = mEndOffset;
|
||||
mStartRun->mLeftType = mStartReason;
|
||||
mStartRun->mRightType = mEndReason;
|
||||
|
||||
|
||||
mEndRun = mStartRun;
|
||||
}
|
||||
|
||||
|
@ -1171,24 +1171,24 @@ nsWSRunObject::GetNextWSNode(::DOMPoint aPoint, nsINode* aBlockParent)
|
|||
return nextNode;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsWSRunObject::PrepareToDeleteRangePriv(nsWSRunObject* aEndObject)
|
||||
{
|
||||
// this routine adjust whitespace before *this* and after aEndObject
|
||||
// in preperation for the two areas to become adjacent after the
|
||||
// in preperation for the two areas to become adjacent after the
|
||||
// intervening content is deleted. It's overly agressive right
|
||||
// now. There might be a block boundary remaining between them after
|
||||
// the deletion, in which case these adjstments are unneeded (though
|
||||
// I don't think they can ever be harmful?)
|
||||
|
||||
|
||||
NS_ENSURE_TRUE(aEndObject, NS_ERROR_NULL_POINTER);
|
||||
nsresult res = NS_OK;
|
||||
|
||||
|
||||
// get the runs before and after selection
|
||||
WSFragment *beforeRun, *afterRun;
|
||||
FindRun(mNode, mOffset, &beforeRun, false);
|
||||
aEndObject->FindRun(aEndObject->mNode, aEndObject->mOffset, &afterRun, true);
|
||||
|
||||
|
||||
// trim after run of any leading ws
|
||||
if (afterRun && (afterRun->mType & WSType::leadingWS)) {
|
||||
res = aEndObject->DeleteChars(aEndObject->mNode, aEndObject->mOffset,
|
||||
|
@ -1239,19 +1239,19 @@ nsWSRunObject::PrepareToDeleteRangePriv(nsWSRunObject* aEndObject)
|
|||
return res;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsWSRunObject::PrepareToSplitAcrossBlocksPriv()
|
||||
{
|
||||
// used to prepare ws to be split across two blocks. The main issue
|
||||
// used to prepare ws to be split across two blocks. The main issue
|
||||
// here is make sure normalWS doesn't end up becoming non-significant
|
||||
// leading or trailing ws after the split.
|
||||
nsresult res = NS_OK;
|
||||
|
||||
|
||||
// get the runs before and after selection
|
||||
WSFragment *beforeRun, *afterRun;
|
||||
FindRun(mNode, mOffset, &beforeRun, false);
|
||||
FindRun(mNode, mOffset, &afterRun, true);
|
||||
|
||||
|
||||
// adjust normal ws in afterRun if needed
|
||||
if (afterRun && afterRun->mType == WSType::normalWS) {
|
||||
// make sure leading char of following ws is an nbsp, so that it will show up
|
||||
|
@ -1609,7 +1609,7 @@ nsWSRunObject::FindRun(nsINode* aNode, int32_t aOffset, WSFragment** outRun,
|
|||
}
|
||||
}
|
||||
|
||||
char16_t
|
||||
char16_t
|
||||
nsWSRunObject::GetCharAt(Text* aTextNode, int32_t aOffset)
|
||||
{
|
||||
// return 0 if we can't get a char, for whatever reason
|
||||
|
@ -1618,7 +1618,7 @@ nsWSRunObject::GetCharAt(Text* aTextNode, int32_t aOffset)
|
|||
int32_t len = int32_t(aTextNode->TextLength());
|
||||
if (aOffset < 0 || aOffset >= len)
|
||||
return 0;
|
||||
|
||||
|
||||
return aTextNode->GetText()->CharAt(aOffset);
|
||||
}
|
||||
|
||||
|
|
|
@ -154,16 +154,16 @@ class MOZ_STACK_CLASS nsWSRunObject
|
|||
nsWSRunObject(nsHTMLEditor* aEd, nsINode* aNode, int32_t aOffset);
|
||||
nsWSRunObject(nsHTMLEditor *aEd, nsIDOMNode *aNode, int32_t aOffset);
|
||||
~nsWSRunObject();
|
||||
|
||||
|
||||
// public methods ---------------------------------------------------------
|
||||
|
||||
// ScrubBlockBoundary removes any non-visible whitespace at the specified
|
||||
// location relative to a block node.
|
||||
// location relative to a block node.
|
||||
static nsresult ScrubBlockBoundary(nsHTMLEditor* aHTMLEd,
|
||||
BlockBoundary aBoundary,
|
||||
nsINode* aBlock,
|
||||
int32_t aOffset = -1);
|
||||
|
||||
|
||||
// PrepareToJoinBlocks fixes up ws at the end of aLeftBlock and the
|
||||
// beginning of aRightBlock in preperation for them to be joined. Example
|
||||
// of fixup: trailingws in aLeftBlock needs to be removed.
|
||||
|
@ -174,7 +174,7 @@ class MOZ_STACK_CLASS nsWSRunObject
|
|||
// PrepareToDeleteRange fixes up ws before {aStartNode,aStartOffset}
|
||||
// and after {aEndNode,aEndOffset} in preperation for content
|
||||
// in that range to be deleted. Note that the nodes and offsets
|
||||
// are adjusted in response to any dom changes we make while
|
||||
// are adjusted in response to any dom changes we make while
|
||||
// adjusting ws.
|
||||
// example of fixup: trailingws before {aStartNode,aStartOffset}
|
||||
// needs to be removed.
|
||||
|
@ -251,7 +251,7 @@ class MOZ_STACK_CLASS nsWSRunObject
|
|||
nsresult AdjustWhitespace();
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
// WSFragment struct ---------------------------------------------------------
|
||||
// WSFragment represents a single run of ws (all leadingws, or all normalws,
|
||||
// or all trailingws, or all leading+trailingws). Note that this single run may
|
||||
|
@ -274,11 +274,11 @@ class MOZ_STACK_CLASS nsWSRunObject
|
|||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// WSPoint struct ------------------------------------------------------------
|
||||
// A WSPoint struct represents a unique location within the ws run. It is
|
||||
// A WSPoint struct represents a unique location within the ws run. It is
|
||||
// always within a textnode that is one of the nodes stored in the list
|
||||
// in the wsRunObject. For convenience, the character at that point is also
|
||||
// in the wsRunObject. For convenience, the character at that point is also
|
||||
// stored in the struct.
|
||||
struct MOZ_STACK_CLASS WSPoint
|
||||
{
|
||||
|
@ -289,15 +289,15 @@ class MOZ_STACK_CLASS nsWSRunObject
|
|||
WSPoint() : mTextNode(0),mOffset(0),mChar(0) {}
|
||||
WSPoint(mozilla::dom::Text* aTextNode, int32_t aOffset, char16_t aChar) :
|
||||
mTextNode(aTextNode),mOffset(aOffset),mChar(aChar) {}
|
||||
};
|
||||
};
|
||||
|
||||
enum AreaRestriction
|
||||
{
|
||||
eAnywhere, eOutsideUserSelectAll
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
// protected methods ---------------------------------------------------------
|
||||
// tons of utility methods.
|
||||
// tons of utility methods.
|
||||
|
||||
/**
|
||||
* Return the node which we will handle white-space under. This is the
|
||||
|
@ -341,40 +341,40 @@ class MOZ_STACK_CLASS nsWSRunObject
|
|||
int32_t aOffset);
|
||||
nsresult CheckLeadingNBSP(WSFragment* aRun, nsINode* aNode,
|
||||
int32_t aOffset);
|
||||
|
||||
|
||||
nsresult Scrub();
|
||||
|
||||
|
||||
// member variables ---------------------------------------------------------
|
||||
|
||||
|
||||
nsCOMPtr<nsINode> mNode; // the node passed to our constructor
|
||||
int32_t mOffset; // the offset passed to our contructor
|
||||
// together, the above represent the point at which we are building up ws info.
|
||||
|
||||
|
||||
bool mPRE; // true if we are in preformatted whitespace context
|
||||
nsCOMPtr<nsINode> mStartNode; // node/offset where ws starts
|
||||
int32_t mStartOffset; // ...
|
||||
WSType mStartReason; // reason why ws starts (eText, eOtherBlock, etc)
|
||||
nsCOMPtr<nsINode> mStartReasonNode;// the node that implicated by start reason
|
||||
|
||||
|
||||
nsCOMPtr<nsINode> mEndNode; // node/offset where ws ends
|
||||
int32_t mEndOffset; // ...
|
||||
WSType mEndReason; // reason why ws ends (eText, eOtherBlock, etc)
|
||||
nsCOMPtr<nsINode> mEndReasonNode; // the node that implicated by end reason
|
||||
|
||||
|
||||
nsRefPtr<mozilla::dom::Text> mFirstNBSPNode; // location of first nbsp in ws run, if any
|
||||
int32_t mFirstNBSPOffset; // ...
|
||||
|
||||
|
||||
nsRefPtr<mozilla::dom::Text> mLastNBSPNode; // location of last nbsp in ws run, if any
|
||||
int32_t mLastNBSPOffset; // ...
|
||||
|
||||
|
||||
// the list of nodes containing ws in this run
|
||||
nsTArray<nsRefPtr<mozilla::dom::Text>> mNodeArray;
|
||||
|
||||
|
||||
WSFragment *mStartRun; // the first WSFragment in the run
|
||||
WSFragment *mEndRun; // the last WSFragment in the run, may be same as first
|
||||
|
||||
|
||||
nsHTMLEditor *mHTMLEditor; // non-owning.
|
||||
|
||||
|
||||
friend class nsHTMLEditRules; // opening this class up for pillaging
|
||||
friend class nsHTMLEditor; // opening this class up for more pillaging
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "domstubs.idl"
|
||||
|
||||
|
@ -34,10 +34,10 @@ interface nsIContentFilter : nsISupports
|
|||
* Callers who want to allow insertion of the data with no changes
|
||||
* can simply set continueWithInsertion to PR_TRUE and return.
|
||||
*
|
||||
* Callers who want to modify the content (docFragment) being inserted are
|
||||
* responsible for updating contentStartNode, contentStartOffset,
|
||||
* contentEndNode, and contentEndOffset (if necessary).
|
||||
* Callers are responsible for freeing and addref'ing if they want to
|
||||
* Callers who want to modify the content (docFragment) being inserted are
|
||||
* responsible for updating contentStartNode, contentStartOffset,
|
||||
* contentEndNode, and contentEndOffset (if necessary).
|
||||
* Callers are responsible for freeing and addref'ing if they want to
|
||||
* completely replace any of the DOM nodes passed in.
|
||||
*
|
||||
* The location where insertion will occur should be considered an
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(050cdc00-3b8e-11d3-9ce4-a458f454fcbc)]
|
||||
|
|
|
@ -15,7 +15,7 @@ Editor Action Listener interface to outside world
|
|||
|
||||
|
||||
/**
|
||||
* A generic editor action listener interface.
|
||||
* A generic editor action listener interface.
|
||||
* <P>
|
||||
* nsIEditActionListener is the interface used by applications wishing to be notified
|
||||
* when the editor modifies the DOM tree.
|
||||
|
@ -28,7 +28,7 @@ Editor Action Listener interface to outside world
|
|||
|
||||
interface nsIEditActionListener : nsISupports{
|
||||
|
||||
/**
|
||||
/**
|
||||
* Called before the editor creates a node.
|
||||
* @param aTag The tag name of the DOM Node to create.
|
||||
* @param aParent The node to insert the new object into
|
||||
|
@ -40,7 +40,7 @@ interface nsIEditActionListener : nsISupports{
|
|||
in nsIDOMNode aParent,
|
||||
in long aPosition);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Called after the editor creates a node.
|
||||
* @param aTag The tag name of the DOM Node to create.
|
||||
* @param aNode The DOM Node that was created.
|
||||
|
@ -56,7 +56,7 @@ interface nsIEditActionListener : nsISupports{
|
|||
in long aPosition,
|
||||
in nsresult aResult);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Called before the editor inserts a node.
|
||||
* @param aNode The DOM Node to insert.
|
||||
* @param aParent The node to insert the new object into
|
||||
|
@ -68,7 +68,7 @@ interface nsIEditActionListener : nsISupports{
|
|||
in nsIDOMNode aParent,
|
||||
in long aPosition);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Called after the editor inserts a node.
|
||||
* @param aNode The DOM Node to insert.
|
||||
* @param aParent The node to insert the new object into
|
||||
|
@ -82,20 +82,20 @@ interface nsIEditActionListener : nsISupports{
|
|||
in long aPosition,
|
||||
in nsresult aResult);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Called before the editor deletes a node.
|
||||
* @param aChild The node to delete
|
||||
*/
|
||||
void WillDeleteNode(in nsIDOMNode aChild);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Called after the editor deletes a node.
|
||||
* @param aChild The node to delete
|
||||
* @param aResult The result of the delete node operation.
|
||||
*/
|
||||
void DidDeleteNode(in nsIDOMNode aChild, in nsresult aResult);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Called before the editor splits a node.
|
||||
* @param aExistingRightNode the node to split. It will become the new node's next sibling.
|
||||
* @param aOffset the offset of aExistingRightNode's content|children to do the split at
|
||||
|
@ -104,7 +104,7 @@ interface nsIEditActionListener : nsISupports{
|
|||
void WillSplitNode(in nsIDOMNode aExistingRightNode,
|
||||
in long aOffset);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Called after the editor splits a node.
|
||||
* @param aExistingRightNode the node to split. It will become the new node's next sibling.
|
||||
* @param aOffset the offset of aExistingRightNode's content|children to do the split at
|
||||
|
@ -115,7 +115,7 @@ interface nsIEditActionListener : nsISupports{
|
|||
in nsIDOMNode aNewLeftNode,
|
||||
in nsresult aResult);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Called before the editor joins 2 nodes.
|
||||
* @param aLeftNode This node will be merged into the right node
|
||||
* @param aRightNode The node that will be merged into.
|
||||
|
@ -127,7 +127,7 @@ interface nsIEditActionListener : nsISupports{
|
|||
in nsIDOMNode aRightNode,
|
||||
in nsIDOMNode aParent);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Called after the editor joins 2 nodes.
|
||||
* @param aLeftNode This node will be merged into the right node
|
||||
* @param aRightNode The node that will be merged into.
|
||||
|
@ -141,7 +141,7 @@ interface nsIEditActionListener : nsISupports{
|
|||
in nsIDOMNode aParent,
|
||||
in nsresult aResult);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Called before the editor inserts text.
|
||||
* @param aTextNode This node getting inserted text
|
||||
* @param aOffset The offset in aTextNode to insert at.
|
||||
|
@ -151,7 +151,7 @@ interface nsIEditActionListener : nsISupports{
|
|||
in long aOffset,
|
||||
in DOMString aString);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Called after the editor inserts text.
|
||||
* @param aTextNode This node getting inserted text
|
||||
* @param aOffset The offset in aTextNode to insert at.
|
||||
|
@ -163,7 +163,7 @@ interface nsIEditActionListener : nsISupports{
|
|||
in DOMString aString,
|
||||
in nsresult aResult);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Called before the editor deletes text.
|
||||
* @param aTextNode This node getting text deleted
|
||||
* @param aOffset The offset in aTextNode to delete at.
|
||||
|
@ -173,7 +173,7 @@ interface nsIEditActionListener : nsISupports{
|
|||
in long aOffset,
|
||||
in long aLength);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Called before the editor deletes text.
|
||||
* @param aTextNode This node getting text deleted
|
||||
* @param aOffset The offset in aTextNode to delete at.
|
||||
|
@ -185,13 +185,13 @@ interface nsIEditActionListener : nsISupports{
|
|||
in long aLength,
|
||||
in nsresult aResult);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Called before the editor deletes the selection.
|
||||
* @param aSelection The selection to be deleted
|
||||
*/
|
||||
void WillDeleteSelection(in nsISelection aSelection);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Called after the editor deletes the selection.
|
||||
* @param aSelection The selection, after deletion
|
||||
*/
|
||||
|
|
|
@ -117,7 +117,7 @@ interface nsIEditor : nsISupports
|
|||
|
||||
/* ------------ Selected content removal -------------- */
|
||||
|
||||
/**
|
||||
/**
|
||||
* DeleteSelection removes all nodes in the current selection.
|
||||
* @param aDir if eNext, delete to the right (for example, the DEL key)
|
||||
* if ePrevious, delete to the left (for example, the BACKSPACE key)
|
||||
|
@ -130,10 +130,10 @@ interface nsIEditor : nsISupports
|
|||
|
||||
|
||||
/* ------------ Document info and file methods -------------- */
|
||||
|
||||
|
||||
/** Returns true if the document has no *meaningful* content */
|
||||
readonly attribute boolean documentIsEmpty;
|
||||
|
||||
|
||||
/** Returns true if the document is modifed and needs saving */
|
||||
readonly attribute boolean documentModified;
|
||||
|
||||
|
@ -157,7 +157,7 @@ interface nsIEditor : nsISupports
|
|||
* to increase or decrease the count
|
||||
*/
|
||||
void incrementModificationCount(in long aModCount);
|
||||
|
||||
|
||||
/* ------------ Transaction methods -------------- */
|
||||
|
||||
/** transactionManager Get the transaction manager the editor is using.
|
||||
|
@ -166,7 +166,7 @@ interface nsIEditor : nsISupports
|
|||
|
||||
/** doTransaction() fires a transaction.
|
||||
* It is provided here so clients can create their own transactions.
|
||||
* If a transaction manager is present, it is used.
|
||||
* If a transaction manager is present, it is used.
|
||||
* Otherwise, the transaction is just executed directly.
|
||||
*
|
||||
* @param aTxn the transaction to execute
|
||||
|
@ -199,7 +199,7 @@ interface nsIEditor : nsISupports
|
|||
* It is provided here so clients need no knowledge of whether
|
||||
* the editor has a transaction manager or not.
|
||||
* If a transaction manager is present, it is told to undo,
|
||||
* and the result of that undo is returned.
|
||||
* and the result of that undo is returned.
|
||||
* Otherwise, the Undo request is ignored and an
|
||||
* error NS_ERROR_NOT_AVAILABLE is returned.
|
||||
*
|
||||
|
@ -377,8 +377,8 @@ interface nsIEditor : nsISupports
|
|||
* @return PR_TRUE if aAttribute is set on the current node,
|
||||
* PR_FALSE if it is not.
|
||||
*/
|
||||
boolean getAttributeValue(in nsIDOMElement aElement,
|
||||
in AString attributestr,
|
||||
boolean getAttributeValue(in nsIDOMElement aElement,
|
||||
in AString attributestr,
|
||||
out AString resultValue);
|
||||
|
||||
/**
|
||||
|
@ -388,7 +388,7 @@ interface nsIEditor : nsISupports
|
|||
* @param aElement the content element to operate on
|
||||
* @param aAttribute the string representation of the attribute to get
|
||||
*/
|
||||
void removeAttribute(in nsIDOMElement aElement,
|
||||
void removeAttribute(in nsIDOMElement aElement,
|
||||
in AString aAttribute);
|
||||
|
||||
/**
|
||||
|
@ -419,7 +419,7 @@ interface nsIEditor : nsISupports
|
|||
*/
|
||||
void cloneAttributes(in nsIDOMNode destNode, in nsIDOMNode sourceNode);
|
||||
|
||||
/**
|
||||
/**
|
||||
* createNode instantiates a new element of type aTag and inserts it
|
||||
* into aParent at aPosition.
|
||||
* @param aTag The type of object to create
|
||||
|
@ -431,7 +431,7 @@ interface nsIEditor : nsISupports
|
|||
in nsIDOMNode parent,
|
||||
in long position);
|
||||
|
||||
/**
|
||||
/**
|
||||
* insertNode inserts aNode into aParent at aPosition.
|
||||
* No checking is done to verify the legality of the insertion.
|
||||
* That is the responsibility of the caller.
|
||||
|
@ -446,7 +446,7 @@ interface nsIEditor : nsISupports
|
|||
in long aPosition);
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* splitNode() creates a new node identical to an existing node,
|
||||
* and split the contents between the two nodes
|
||||
* @param aExistingRightNode the node to split.
|
||||
|
@ -460,7 +460,7 @@ interface nsIEditor : nsISupports
|
|||
in long offset,
|
||||
out nsIDOMNode newLeftNode);
|
||||
|
||||
/**
|
||||
/**
|
||||
* joinNodes() takes 2 nodes and merge their content|children.
|
||||
* @param aLeftNode The left node. It will be deleted.
|
||||
* @param aRightNode The right node. It will remain after the join.
|
||||
|
@ -474,7 +474,7 @@ interface nsIEditor : nsISupports
|
|||
in nsIDOMNode rightNode,
|
||||
in nsIDOMNode parent);
|
||||
|
||||
/**
|
||||
/**
|
||||
* deleteNode removes aChild from aParent.
|
||||
* @param aChild The node to delete
|
||||
*/
|
||||
|
@ -486,7 +486,7 @@ interface nsIEditor : nsISupports
|
|||
*/
|
||||
[notxpcom] boolean outputsMozDirty();
|
||||
|
||||
/**
|
||||
/**
|
||||
* markNodeDirty() sets a special dirty attribute on the node.
|
||||
* Usually this will be called immediately after creating a new node.
|
||||
* @param aNode The node for which to insert formatting.
|
||||
|
@ -495,7 +495,7 @@ interface nsIEditor : nsISupports
|
|||
|
||||
/* ---------- direction controller ---------- */
|
||||
|
||||
/**
|
||||
/**
|
||||
* Switches the editor element direction; from "Left-to-Right" to
|
||||
* "Right-to-Left", and vice versa.
|
||||
*/
|
||||
|
|
|
@ -12,14 +12,14 @@ Editor Observer interface to outside world
|
|||
[scriptable, uuid(f3ee57a6-890c-4ce0-a584-8a84bba0292e)]
|
||||
|
||||
/**
|
||||
* A generic editor observer interface.
|
||||
* A generic editor observer interface.
|
||||
* <P>
|
||||
* nsIEditorObserver is the interface used by applications wishing to be notified
|
||||
* when the editor has completed a user action.
|
||||
* when the editor has completed a user action.
|
||||
*
|
||||
*/
|
||||
interface nsIEditorObserver : nsISupports {
|
||||
/**
|
||||
/**
|
||||
* Called after the editor completes a user action.
|
||||
*/
|
||||
void EditAction();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIEditor;
|
||||
|
|
|
@ -20,7 +20,7 @@ interface nsIEditorStyleSheets : nsISupports
|
|||
/** Load and apply the style sheet, specified by aURL, to the
|
||||
* editor's document, replacing the last style sheet added (if any).
|
||||
* This is always asynchronous, and may cause network I/O.
|
||||
*
|
||||
*
|
||||
* @param aURL The style sheet to be loaded and applied.
|
||||
*/
|
||||
void replaceStyleSheet(in AString aURL);
|
||||
|
@ -41,7 +41,7 @@ interface nsIEditorStyleSheets : nsISupports
|
|||
* display behavior for editing (like showing special cursors) that will
|
||||
* not be affected by loading "document" style sheets with addStyleSheet or
|
||||
* especially replaceStyleSheet.
|
||||
*
|
||||
*
|
||||
* @param aURL The style sheet to be loaded and applied.
|
||||
*/
|
||||
void replaceOverrideStyleSheet(in AString aURL);
|
||||
|
|
|
@ -34,8 +34,8 @@ interface nsIHTMLEditor : nsISupports
|
|||
const short eCenter = 1;
|
||||
const short eRight = 2;
|
||||
const short eJustify = 3;
|
||||
|
||||
|
||||
|
||||
|
||||
/* ------------ Inline property methods -------------- */
|
||||
|
||||
|
||||
|
@ -50,8 +50,8 @@ interface nsIHTMLEditor : nsISupports
|
|||
* Example: aProperty="font", aAttribute="color",
|
||||
* aValue="0x00FFFF"
|
||||
*/
|
||||
void addDefaultProperty(in nsIAtom aProperty,
|
||||
in AString aAttribute,
|
||||
void addDefaultProperty(in nsIAtom aProperty,
|
||||
in AString aAttribute,
|
||||
in AString aValue);
|
||||
|
||||
/**
|
||||
|
@ -65,8 +65,8 @@ interface nsIHTMLEditor : nsISupports
|
|||
* Example: aProperty="font", aAttribute="color",
|
||||
* aValue="0x00FFFF"
|
||||
*/
|
||||
void removeDefaultProperty(in nsIAtom aProperty,
|
||||
in AString aAttribute,
|
||||
void removeDefaultProperty(in nsIAtom aProperty,
|
||||
in AString aAttribute,
|
||||
in AString aValue);
|
||||
|
||||
/**
|
||||
|
@ -78,7 +78,7 @@ interface nsIHTMLEditor : nsISupports
|
|||
/**
|
||||
* SetInlineProperty() sets the aggregate properties on the current selection
|
||||
*
|
||||
* @param aProperty the property to set on the selection
|
||||
* @param aProperty the property to set on the selection
|
||||
* @param aAttribute the attribute of the property, if applicable.
|
||||
* May be null.
|
||||
* Example: aProperty="font", aAttribute="color"
|
||||
|
@ -87,7 +87,7 @@ interface nsIHTMLEditor : nsISupports
|
|||
* Example: aProperty="font", aAttribute="color",
|
||||
* aValue="0x00FFFF"
|
||||
*/
|
||||
void setInlineProperty(in nsIAtom aProperty,
|
||||
void setInlineProperty(in nsIAtom aProperty,
|
||||
in AString aAttribute,
|
||||
in AString aValue);
|
||||
|
||||
|
@ -96,7 +96,7 @@ interface nsIHTMLEditor : nsISupports
|
|||
* All object in the current selection are scanned and their attributes are
|
||||
* represented in a list of Property object.
|
||||
*
|
||||
* @param aProperty the property to get on the selection
|
||||
* @param aProperty the property to get on the selection
|
||||
* @param aAttribute the attribute of the property, if applicable.
|
||||
* May be null.
|
||||
* Example: aProperty="font", aAttribute="color"
|
||||
|
@ -111,22 +111,22 @@ interface nsIHTMLEditor : nsISupports
|
|||
* @param aAll [OUT] PR_TRUE if all of the text nodes in the
|
||||
* selection have the property
|
||||
*/
|
||||
void getInlineProperty(in nsIAtom aProperty,
|
||||
void getInlineProperty(in nsIAtom aProperty,
|
||||
in AString aAttribute,
|
||||
in AString aValue,
|
||||
out boolean aFirst,
|
||||
out boolean aAny,
|
||||
out boolean aAll);
|
||||
|
||||
AString getInlinePropertyWithAttrValue(in nsIAtom aProperty,
|
||||
AString getInlinePropertyWithAttrValue(in nsIAtom aProperty,
|
||||
in AString aAttribute,
|
||||
in AString aValue,
|
||||
out boolean aFirst,
|
||||
out boolean aAny,
|
||||
out boolean aAll);
|
||||
|
||||
|
||||
/**
|
||||
* removeAllInlineProperties() deletes all the inline properties from all
|
||||
* removeAllInlineProperties() deletes all the inline properties from all
|
||||
* text in the current selection.
|
||||
*/
|
||||
void removeAllInlineProperties();
|
||||
|
@ -136,7 +136,7 @@ interface nsIHTMLEditor : nsISupports
|
|||
* removeInlineProperty() deletes the properties from all text in the current
|
||||
* selection. If aProperty is not set on the selection, nothing is done.
|
||||
*
|
||||
* @param aProperty the property to remove from the selection
|
||||
* @param aProperty the property to remove from the selection
|
||||
* All atoms are for normal HTML tags (e.g.:
|
||||
* nsIEditorProperty::font) except when you want to
|
||||
* remove just links and not named anchors.
|
||||
|
@ -183,13 +183,13 @@ interface nsIHTMLEditor : nsISupports
|
|||
void insertHTML(in AString aInputString);
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Paste the text in the OS clipboard at the cursor position, replacing
|
||||
* the selected text (if any), but strip out any HTML styles and formatting
|
||||
*/
|
||||
void pasteNoFormatting(in long aSelectionType);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Rebuild the entire document from source HTML
|
||||
* Needed to be able to edit HEAD and other outside-of-BODY content
|
||||
*
|
||||
|
@ -203,12 +203,12 @@ interface nsIHTMLEditor : nsISupports
|
|||
*
|
||||
* @param aInputString the string to be inserted
|
||||
* @param aContextStr Context of insertion
|
||||
* @param aInfoStr Related info to aInputString
|
||||
* @param aInfoStr Related info to aInputString
|
||||
* @param aFlavor Transferable flavor, can be ""
|
||||
* @param aSourceDoc document where input was dragged from (may be null)
|
||||
* @param aDestinationNode location for insertion (such as when dropped)
|
||||
* @param aDestinationOffset used with aDestNode to determine insert location
|
||||
* @param aDeleteSelection used with aDestNode during drag&drop
|
||||
* @param aDeleteSelection used with aDestNode during drag&drop
|
||||
* @param aCollapseSelection used with aDestNode during drag&drop
|
||||
*/
|
||||
void insertHTMLWithContext(in AString aInputString,
|
||||
|
@ -221,7 +221,7 @@ interface nsIHTMLEditor : nsISupports
|
|||
in boolean aDeleteSelection);
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Insert an element, which may have child nodes, at the selection
|
||||
* Used primarily to insert a new element for various insert element dialogs,
|
||||
* but it enforces the HTML 4.0 DTD "CanContain" rules, so it should
|
||||
|
@ -229,19 +229,19 @@ interface nsIHTMLEditor : nsISupports
|
|||
*
|
||||
* @param aElement The element to insert
|
||||
* @param aDeleteSelection Delete the selection before inserting
|
||||
* If aDeleteSelection is PR_FALSE, then the element is inserted
|
||||
* If aDeleteSelection is PR_FALSE, then the element is inserted
|
||||
* after the end of the selection for all element except
|
||||
* Named Anchors, which insert before the selection
|
||||
*/
|
||||
*/
|
||||
void insertElementAtSelection(in nsIDOMElement aElement,
|
||||
in boolean aDeleteSelection);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set the documents title.
|
||||
*/
|
||||
void setDocumentTitle(in AString aTitle);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set the BaseURL for the document to the current URL
|
||||
* but only if the page doesn't have a <base> tag
|
||||
* This should be done after the document URL has changed,
|
||||
|
@ -253,17 +253,17 @@ interface nsIHTMLEditor : nsISupports
|
|||
|
||||
/* ------------ Selection manipulation -------------- */
|
||||
/* Should these be moved to nsISelection? */
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Set the selection at the suppled element
|
||||
*
|
||||
* @param aElement An element in the document
|
||||
*/
|
||||
void selectElement(in nsIDOMElement aElement);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Create a collapsed selection just after aElement
|
||||
*
|
||||
*
|
||||
* XXX could we parameterize SelectElement(before/select/after>?
|
||||
*
|
||||
* The selection is set to parent-of-aElement with an
|
||||
|
@ -289,48 +289,48 @@ interface nsIHTMLEditor : nsISupports
|
|||
*/
|
||||
AString getParagraphState(out boolean aMixed);
|
||||
|
||||
/**
|
||||
/**
|
||||
* getFontFaceState returns what font face is in the selection.
|
||||
* @param aMixed True if there is more than one font face
|
||||
* @return Name of face. Note: "tt" is returned for
|
||||
* tt tag. "" is returned for none.
|
||||
*/
|
||||
AString getFontFaceState(out boolean aMixed);
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* getFontColorState returns what font face is in the selection.
|
||||
* @param aMixed True if there is more than one font color
|
||||
* @return Color string. "" is returned for none.
|
||||
*/
|
||||
AString getFontColorState(out boolean aMixed);
|
||||
|
||||
/**
|
||||
/**
|
||||
* getFontColorState returns what font face is in the selection.
|
||||
* @param aMixed True if there is more than one font color
|
||||
* @return Color string. "" is returned for none.
|
||||
*/
|
||||
AString getBackgroundColorState(out boolean aMixed);
|
||||
|
||||
/**
|
||||
/**
|
||||
* getHighlightColorState returns what the highlight color of the selection.
|
||||
* @param aMixed True if there is more than one font color
|
||||
* @return Color string. "" is returned for none.
|
||||
*/
|
||||
AString getHighlightColorState(out boolean aMixed);
|
||||
|
||||
/**
|
||||
/**
|
||||
* getListState returns what list type is in the selection.
|
||||
* @param aMixed True if there is more than one type of list, or
|
||||
* if there is some list and non-list
|
||||
* @param aOL The company that employs me. No, really, it's
|
||||
* @param aOL The company that employs me. No, really, it's
|
||||
* true if an "ol" list is selected.
|
||||
* @param aUL true if an "ul" list is selected.
|
||||
* @param aDL true if a "dl" list is selected.
|
||||
*/
|
||||
void getListState(out boolean aMixed, out boolean aOL, out boolean aUL,
|
||||
out boolean aDL);
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* getListItemState returns what list item type is in the selection.
|
||||
* @param aMixed True if there is more than one type of list item, or
|
||||
* if there is some list and non-list
|
||||
|
@ -340,8 +340,8 @@ interface nsIHTMLEditor : nsISupports
|
|||
*/
|
||||
void getListItemState(out boolean aMixed, out boolean aLI,
|
||||
out boolean aDT, out boolean aDD);
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* getAlignment returns what alignment is in the selection.
|
||||
* @param aMixed True if there is more than one type of list item, or
|
||||
* if there is some list and non-list
|
||||
|
@ -349,39 +349,39 @@ interface nsIHTMLEditor : nsISupports
|
|||
* (left/center/right)
|
||||
*/
|
||||
void getAlignment(out boolean aMixed, out short aAlign);
|
||||
|
||||
|
||||
/**
|
||||
* Document me!
|
||||
*
|
||||
*
|
||||
*/
|
||||
void getIndentState(out boolean aCanIndent, out boolean aCanOutdent);
|
||||
|
||||
/**
|
||||
* Document me!
|
||||
*
|
||||
*
|
||||
*/
|
||||
void makeOrChangeList(in AString aListType, in boolean entireList,
|
||||
in AString aBulletType);
|
||||
|
||||
/**
|
||||
* Document me!
|
||||
*
|
||||
*
|
||||
*/
|
||||
void removeList(in AString aListType);
|
||||
|
||||
/**
|
||||
* Document me!
|
||||
*
|
||||
*
|
||||
*/
|
||||
void indent(in AString aIndent);
|
||||
|
||||
/**
|
||||
* Document me!
|
||||
*
|
||||
*
|
||||
*/
|
||||
void align(in AString aAlign);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Return the input node or a parent matching the given aTagName,
|
||||
* starting the search at the supplied node.
|
||||
* An example of use is for testing if a node is in a table cell
|
||||
|
@ -389,7 +389,7 @@ interface nsIHTMLEditor : nsISupports
|
|||
*
|
||||
* @param aTagName The HTML tagname
|
||||
* Special input values:
|
||||
* Use "href" to get a link node
|
||||
* Use "href" to get a link node
|
||||
* (an "A" tag with the "href" attribute set)
|
||||
* Use "anchor" or "namedanchor" to get a named anchor node
|
||||
* (an "A" tag with the "name" attribute set)
|
||||
|
@ -404,7 +404,7 @@ interface nsIHTMLEditor : nsISupports
|
|||
nsIDOMElement getElementOrParentByTagName(in AString aTagName,
|
||||
in nsIDOMNode aNode);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Return an element only if it is the only node selected,
|
||||
* such as an image, horizontal rule, etc.
|
||||
* The exception is a link, which is more like a text attribute:
|
||||
|
@ -413,7 +413,7 @@ interface nsIHTMLEditor : nsISupports
|
|||
* This could be a collapsed selection, i.e., a caret
|
||||
* within the link text.
|
||||
*
|
||||
* @param aTagName The HTML tagname or and empty string
|
||||
* @param aTagName The HTML tagname or and empty string
|
||||
* to get any element (but only if it is the only element selected)
|
||||
* Special input values for Links and Named anchors:
|
||||
* Use "href" to get a link node
|
||||
|
@ -425,23 +425,23 @@ interface nsIHTMLEditor : nsISupports
|
|||
*/
|
||||
nsIDOMElement getSelectedElement(in AString aTagName);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Output the contents of the <HEAD> section as text/HTML format
|
||||
*/
|
||||
AString getHeadContentsAsHTML();
|
||||
|
||||
/**
|
||||
/**
|
||||
* Replace all children of <HEAD> with string of HTML source
|
||||
*/
|
||||
void replaceHeadContentsWithHTML(in AString aSourceToInsert);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Return a new element with default attribute values
|
||||
*
|
||||
*
|
||||
* This does not rely on the selection, and is not sensitive to context.
|
||||
*
|
||||
*
|
||||
* Used primarily to supply new element for various insert element dialogs
|
||||
* (Image, Link, NamedAnchor, Table, and HorizontalRule
|
||||
* (Image, Link, NamedAnchor, Table, and HorizontalRule
|
||||
* are the only returned elements as of 7/25/99)
|
||||
*
|
||||
* @param aTagName The HTML tagname
|
||||
|
@ -454,14 +454,14 @@ interface nsIHTMLEditor : nsISupports
|
|||
*/
|
||||
nsIDOMElement createElementWithDefaults(in AString aTagName);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Insert an link element as the parent of the current selection
|
||||
*
|
||||
* @param aElement An "A" element with a non-empty "href" attribute
|
||||
*/
|
||||
void insertLinkAroundSelection(in nsIDOMElement aAnchorElement);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set the value of the "bgcolor" attribute on the document's <body> element
|
||||
*
|
||||
* @param aColor The HTML color string, such as "#ffccff" or "yellow"
|
||||
|
@ -469,7 +469,7 @@ interface nsIHTMLEditor : nsISupports
|
|||
void setBackgroundColor(in AString aColor);
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set an attribute on the document's <body> element
|
||||
* such as text, link, background colors
|
||||
*
|
||||
|
@ -479,7 +479,7 @@ interface nsIHTMLEditor : nsISupports
|
|||
* @param aValue The value of the attribute
|
||||
*/
|
||||
void setBodyAttribute(in AString aAttr, in AString aValue);
|
||||
|
||||
|
||||
/**
|
||||
* Find all the nodes in the document which contain references
|
||||
* to outside URIs (e.g. a href, img src, script src, etc.)
|
||||
|
@ -489,7 +489,7 @@ interface nsIHTMLEditor : nsISupports
|
|||
*/
|
||||
nsISupportsArray getLinkedObjects();
|
||||
|
||||
/**
|
||||
/**
|
||||
* A boolean which is true is the HTMLEditor has been instantiated
|
||||
* with CSS knowledge and if the CSS pref is currently checked
|
||||
*
|
||||
|
|
|
@ -29,5 +29,5 @@ interface nsIHTMLObjectResizeListener : nsISupports
|
|||
void onEndResizing(in nsIDOMElement aElement,
|
||||
in long aOldWidth, in long aOldHeight,
|
||||
in long aNewWidth, in long aNewHeight);
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(b74fb158-1265-4102-91eb-edd0136b49f8)]
|
||||
|
@ -71,7 +71,7 @@ interface nsIPlaintextEditor : nsISupports
|
|||
attribute long maxTextLength;
|
||||
|
||||
/** Get and set the body wrap width.
|
||||
*
|
||||
*
|
||||
* Special values:
|
||||
* 0 = wrap to window width
|
||||
* -1 = no wrap at all
|
||||
|
@ -101,7 +101,7 @@ interface nsIPlaintextEditor : nsISupports
|
|||
* @param aString the string to be inserted
|
||||
*/
|
||||
void insertText(in DOMString aStringToInsert);
|
||||
|
||||
|
||||
/**
|
||||
* Insert a line break into the content model.
|
||||
* The interpretation of a break is up to the implementation:
|
||||
|
|
|
@ -21,7 +21,7 @@ interface nsITableEditor : nsISupports
|
|||
/* ------------ Table editing Methods -------------- */
|
||||
|
||||
/** Insert table methods
|
||||
* Insert relative to the selected cell or the
|
||||
* Insert relative to the selected cell or the
|
||||
* cell enclosing the selection anchor
|
||||
* The selection is collapsed and is left in the new cell
|
||||
* at the same row,col location as the original anchor cell
|
||||
|
@ -35,9 +35,9 @@ interface nsITableEditor : nsISupports
|
|||
void insertTableRow(in long aNumber, in boolean aAfter);
|
||||
|
||||
/** Delete table methods
|
||||
* Delete starting at the selected cell or the
|
||||
* Delete starting at the selected cell or the
|
||||
* cell (or table) enclosing the selection anchor
|
||||
* The selection is collapsed and is left in the
|
||||
* The selection is collapsed and is left in the
|
||||
* cell at the same row,col location as
|
||||
* the previous selection anchor, if possible,
|
||||
* else in the closest neigboring cell
|
||||
|
@ -56,7 +56,7 @@ interface nsITableEditor : nsISupports
|
|||
* @param aNumber Number of contiguous cells, rows, or columns
|
||||
*
|
||||
* When there are more than 1 selected cells, aNumber is ignored.
|
||||
* For Delete Rows or Columns, the complete columns or rows are
|
||||
* For Delete Rows or Columns, the complete columns or rows are
|
||||
* determined by the selected cells. E.g., to delete 2 complete rows,
|
||||
* user simply selects a cell in each, and they don't
|
||||
* have to be contiguous.
|
||||
|
@ -99,35 +99,35 @@ interface nsITableEditor : nsISupports
|
|||
|
||||
/** Merges contents of all selected cells
|
||||
* for selected cells that are adjacent,
|
||||
* this will result in a larger cell with appropriate
|
||||
* this will result in a larger cell with appropriate
|
||||
* rowspan and colspan, and original cells are deleted
|
||||
* The resulting cell is in the location of the
|
||||
* The resulting cell is in the location of the
|
||||
* cell at the upper-left corner of the adjacent
|
||||
* block of selected cells
|
||||
*
|
||||
* @param aMergeNonContiguousContents:
|
||||
* If true:
|
||||
* @param aMergeNonContiguousContents:
|
||||
* If true:
|
||||
* Non-contiguous cells are not deleted,
|
||||
* but their contents are still moved
|
||||
* but their contents are still moved
|
||||
* to the upper-left cell
|
||||
* If false: contiguous cells are ignored
|
||||
*
|
||||
* If there are no selected cells,
|
||||
* and selection or caret is in a cell,
|
||||
* that cell and the one to the right
|
||||
* that cell and the one to the right
|
||||
* are merged
|
||||
*/
|
||||
void joinTableCells(in boolean aMergeNonContiguousContents);
|
||||
|
||||
/** Split a cell that has rowspan and/or colspan > 0
|
||||
* into cells such that all new cells have
|
||||
* into cells such that all new cells have
|
||||
* rowspan = 1 and colspan = 1
|
||||
* All of the contents are not touched --
|
||||
* they will appear to be in the upper-left cell
|
||||
* they will appear to be in the upper-left cell
|
||||
*/
|
||||
void splitTableCell();
|
||||
|
||||
/** Scan through all rows and add cells as needed so
|
||||
/** Scan through all rows and add cells as needed so
|
||||
* all locations in the cellmap are occupied.
|
||||
* Used after inserting single cells or pasting
|
||||
* a collection of cells that extend past the
|
||||
|
@ -141,14 +141,14 @@ interface nsITableEditor : nsISupports
|
|||
|
||||
/** Get the row an column index from the layout's cellmap
|
||||
* If aCell is null, it will try to find enclosing table of selection anchor
|
||||
*
|
||||
*
|
||||
*/
|
||||
void getCellIndexes(in nsIDOMElement aCell,
|
||||
out long aRowIndex, out long aColIndex);
|
||||
|
||||
/** Get the number of rows and columns in a table from the layout's cellmap
|
||||
* If aTable is null, it will try to find enclosing table of selection ancho
|
||||
* Note that all rows in table will not have this many because of
|
||||
* Note that all rows in table will not have this many because of
|
||||
* ROWSPAN effects or if table is not "rectangular" (has short rows)
|
||||
*/
|
||||
void getTableSize(in nsIDOMElement aTable,
|
||||
|
@ -174,12 +174,12 @@ interface nsITableEditor : nsISupports
|
|||
/** Get a cell at cellmap grid coordinates and associated data
|
||||
* A cell that spans across multiple cellmap locations will
|
||||
* be returned multiple times, once for each location it occupies
|
||||
* Examine the returned aStartRowIndex and aStartColIndex to see
|
||||
* Examine the returned aStartRowIndex and aStartColIndex to see
|
||||
* if it is in the same layout column or layout row:
|
||||
* A "layout row" is all cells sharing the same top edge
|
||||
* A "layout column" is all cells sharing the same left edge
|
||||
* This is important to determine what to do when inserting or deleting a column or row
|
||||
*
|
||||
*
|
||||
* @param aTable A table in the document
|
||||
* @param aRowIndex, aColIndex The 0-based cellmap indexes
|
||||
* returns values:
|
||||
|
@ -191,7 +191,7 @@ interface nsITableEditor : nsISupports
|
|||
* @param aActualRowSpan The actual number of cellmap locations (rows) spanned by the cell
|
||||
* @param aActualColSpan The actual number of cellmap locations (columns) spanned by the cell
|
||||
* @param aIsSelected
|
||||
* @param
|
||||
* @param
|
||||
*
|
||||
* (in C++ returns: NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found
|
||||
* passes NS_SUCCEEDED macro)
|
||||
|
@ -200,8 +200,8 @@ interface nsITableEditor : nsISupports
|
|||
in long aRowIndex, in long aColIndex,
|
||||
out nsIDOMElement aCell,
|
||||
out long aStartRowIndex, out long aStartColIndex,
|
||||
out long aRowSpan, out long aColSpan,
|
||||
out long aActualRowSpan, out long aActualColSpan,
|
||||
out long aRowSpan, out long aColSpan,
|
||||
out long aActualRowSpan, out long aActualColSpan,
|
||||
out boolean aIsSelected);
|
||||
|
||||
/** Get the first row element in a table
|
||||
|
@ -224,10 +224,10 @@ interface nsITableEditor : nsISupports
|
|||
* passes NS_SUCCEEDED macro)
|
||||
*/
|
||||
nsIDOMNode getNextRow(in nsIDOMNode aTableElement);
|
||||
|
||||
|
||||
/** Preferred direction to search for neighboring cell
|
||||
* when trying to locate a cell to place caret in after
|
||||
* a table editing action.
|
||||
* a table editing action.
|
||||
* Used for aDirection param in SetSelectionAfterTableEdit
|
||||
*/
|
||||
|
||||
|
@ -245,11 +245,11 @@ interface nsITableEditor : nsISupports
|
|||
* If no cell is found, caret is place just before table;
|
||||
* and if that fails, at beginning of document.
|
||||
* Thus we generally don't worry about the return value
|
||||
* and can use the nsSetSelectionAfterTableEdit stack-based
|
||||
* and can use the nsSetSelectionAfterTableEdit stack-based
|
||||
* object to insure we reset the caret in a table-editing method.
|
||||
*/
|
||||
void setSelectionAfterTableEdit(in nsIDOMElement aTable,
|
||||
in long aRow, in long aCol,
|
||||
in long aRow, in long aCol,
|
||||
in long aDirection, in boolean aSelected);
|
||||
|
||||
/** Examine the current selection and find
|
||||
|
@ -270,12 +270,12 @@ interface nsITableEditor : nsISupports
|
|||
|
||||
/** Generally used after GetSelectedOrParentTableElement
|
||||
* to test if selected cells are complete rows or columns
|
||||
*
|
||||
*
|
||||
* @param aElement Any table or cell element or any element
|
||||
* inside a table
|
||||
* Used to get enclosing table.
|
||||
* Used to get enclosing table.
|
||||
* If null, selection's anchorNode is used
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* 0 aCellElement was not a cell
|
||||
* (returned result = NS_ERROR_FAILURE)
|
||||
|
@ -296,14 +296,14 @@ interface nsITableEditor : nsISupports
|
|||
* is in a separate range (selection parent node is table row)
|
||||
* @param aCell [OUT] Selected cell or null if ranges don't contain
|
||||
* cell selections
|
||||
* @param aRange [OUT] Optional: if not null, return the selection range
|
||||
* @param aRange [OUT] Optional: if not null, return the selection range
|
||||
* associated with the cell
|
||||
* Returns the DOM cell element
|
||||
* (in C++: returns NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found
|
||||
* passes NS_SUCCEEDED macro)
|
||||
*/
|
||||
nsIDOMElement getFirstSelectedCell(out nsIDOMRange aRange);
|
||||
|
||||
|
||||
/** Get first selected element in the table
|
||||
* This is the upper-left-most selected cell in table,
|
||||
* ignoring the order that the user selected them (order in the selection ranges)
|
||||
|
@ -326,7 +326,7 @@ interface nsITableEditor : nsISupports
|
|||
* Always call GetFirstSelectedCell() to initialize stored index of "next" cell
|
||||
* @param aCell Selected cell or null if no more selected cells
|
||||
* or ranges don't contain cell selections
|
||||
* @param aRange Optional: if not null, return the selection range
|
||||
* @param aRange Optional: if not null, return the selection range
|
||||
* associated with the cell
|
||||
*
|
||||
* Returns the DOM cell element
|
||||
|
|
|
@ -238,7 +238,7 @@ nsTransactionManager::BeginBatch(nsISupports* aData)
|
|||
}
|
||||
|
||||
result = BeginTransaction(0, aData);
|
||||
|
||||
|
||||
nsresult result2 = DidBeginBatchNotify(result);
|
||||
|
||||
if (NS_SUCCEEDED(result))
|
||||
|
@ -540,7 +540,7 @@ nsTransactionManager::WillDoNotify(nsITransaction *aTransaction, bool *aInterrup
|
|||
NS_ENSURE_TRUE(listener, NS_ERROR_FAILURE);
|
||||
|
||||
result = listener->WillDo(this, aTransaction, aInterrupt);
|
||||
|
||||
|
||||
if (NS_FAILED(result) || *aInterrupt)
|
||||
break;
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ nsTransactionManager::DidDoNotify(nsITransaction *aTransaction, nsresult aDoResu
|
|||
NS_ENSURE_TRUE(listener, NS_ERROR_FAILURE);
|
||||
|
||||
result = listener->DidDo(this, aTransaction, aDoResult);
|
||||
|
||||
|
||||
if (NS_FAILED(result))
|
||||
break;
|
||||
}
|
||||
|
@ -578,7 +578,7 @@ nsTransactionManager::WillUndoNotify(nsITransaction *aTransaction, bool *aInterr
|
|||
NS_ENSURE_TRUE(listener, NS_ERROR_FAILURE);
|
||||
|
||||
result = listener->WillUndo(this, aTransaction, aInterrupt);
|
||||
|
||||
|
||||
if (NS_FAILED(result) || *aInterrupt)
|
||||
break;
|
||||
}
|
||||
|
@ -597,7 +597,7 @@ nsTransactionManager::DidUndoNotify(nsITransaction *aTransaction, nsresult aUndo
|
|||
NS_ENSURE_TRUE(listener, NS_ERROR_FAILURE);
|
||||
|
||||
result = listener->DidUndo(this, aTransaction, aUndoResult);
|
||||
|
||||
|
||||
if (NS_FAILED(result))
|
||||
break;
|
||||
}
|
||||
|
@ -616,7 +616,7 @@ nsTransactionManager::WillRedoNotify(nsITransaction *aTransaction, bool *aInterr
|
|||
NS_ENSURE_TRUE(listener, NS_ERROR_FAILURE);
|
||||
|
||||
result = listener->WillRedo(this, aTransaction, aInterrupt);
|
||||
|
||||
|
||||
if (NS_FAILED(result) || *aInterrupt)
|
||||
break;
|
||||
}
|
||||
|
@ -635,7 +635,7 @@ nsTransactionManager::DidRedoNotify(nsITransaction *aTransaction, nsresult aRedo
|
|||
NS_ENSURE_TRUE(listener, NS_ERROR_FAILURE);
|
||||
|
||||
result = listener->DidRedo(this, aTransaction, aRedoResult);
|
||||
|
||||
|
||||
if (NS_FAILED(result))
|
||||
break;
|
||||
}
|
||||
|
@ -654,7 +654,7 @@ nsTransactionManager::WillBeginBatchNotify(bool *aInterrupt)
|
|||
NS_ENSURE_TRUE(listener, NS_ERROR_FAILURE);
|
||||
|
||||
result = listener->WillBeginBatch(this, aInterrupt);
|
||||
|
||||
|
||||
if (NS_FAILED(result) || *aInterrupt)
|
||||
break;
|
||||
}
|
||||
|
@ -673,7 +673,7 @@ nsTransactionManager::DidBeginBatchNotify(nsresult aResult)
|
|||
NS_ENSURE_TRUE(listener, NS_ERROR_FAILURE);
|
||||
|
||||
result = listener->DidBeginBatch(this, aResult);
|
||||
|
||||
|
||||
if (NS_FAILED(result))
|
||||
break;
|
||||
}
|
||||
|
@ -692,7 +692,7 @@ nsTransactionManager::WillEndBatchNotify(bool *aInterrupt)
|
|||
NS_ENSURE_TRUE(listener, NS_ERROR_FAILURE);
|
||||
|
||||
result = listener->WillEndBatch(this, aInterrupt);
|
||||
|
||||
|
||||
if (NS_FAILED(result) || *aInterrupt)
|
||||
break;
|
||||
}
|
||||
|
@ -711,7 +711,7 @@ nsTransactionManager::DidEndBatchNotify(nsresult aResult)
|
|||
NS_ENSURE_TRUE(listener, NS_ERROR_FAILURE);
|
||||
|
||||
result = listener->DidEndBatch(this, aResult);
|
||||
|
||||
|
||||
if (NS_FAILED(result))
|
||||
break;
|
||||
}
|
||||
|
@ -730,7 +730,7 @@ nsTransactionManager::WillMergeNotify(nsITransaction *aTop, nsITransaction *aTra
|
|||
NS_ENSURE_TRUE(listener, NS_ERROR_FAILURE);
|
||||
|
||||
result = listener->WillMerge(this, aTop, aTransaction, aInterrupt);
|
||||
|
||||
|
||||
if (NS_FAILED(result) || *aInterrupt)
|
||||
break;
|
||||
}
|
||||
|
@ -752,7 +752,7 @@ nsTransactionManager::DidMergeNotify(nsITransaction *aTop,
|
|||
NS_ENSURE_TRUE(listener, NS_ERROR_FAILURE);
|
||||
|
||||
result = listener->DidMerge(this, aTop, aTransaction, aDidMerge, aMergeResult);
|
||||
|
||||
|
||||
if (NS_FAILED(result))
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ nsFilteredContentIterator::Init(nsIDOMRange* aRange)
|
|||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
nsresult
|
||||
nsresult
|
||||
nsFilteredContentIterator::SwitchDirections(bool aChangeToForward)
|
||||
{
|
||||
nsINode *node = mCurrentIterator->GetCurrentNode();
|
||||
|
@ -251,7 +251,7 @@ ContentIsInTraversalRange(nsRange* aRange, nsIDOMNode* aNextNode, bool aIsPreMod
|
|||
|
||||
//------------------------------------------------------------
|
||||
// Helper function to advance to the next or previous node
|
||||
nsresult
|
||||
nsresult
|
||||
nsFilteredContentIterator::AdvanceNode(nsIDOMNode* aNode, nsIDOMNode*& aNewNode, eDirectionType aDir)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> nextNode;
|
||||
|
@ -287,7 +287,7 @@ nsFilteredContentIterator::AdvanceNode(nsIDOMNode* aNode, nsIDOMNode*& aNewNode,
|
|||
}
|
||||
}
|
||||
|
||||
// if we get here it pretty much means
|
||||
// if we get here it pretty much means
|
||||
// we went out of the DOM Range
|
||||
mIsOutOfRange = true;
|
||||
|
||||
|
@ -309,7 +309,7 @@ nsFilteredContentIterator::CheckAdvNode(nsIDOMNode* aNode, bool& aDidSkip, eDire
|
|||
nsresult rv = mFilter->Skip(aNode, &skipIt);
|
||||
if (NS_SUCCEEDED(rv) && skipIt) {
|
||||
aDidSkip = true;
|
||||
// Get the next/prev node and then
|
||||
// Get the next/prev node and then
|
||||
// see if we should skip that
|
||||
nsCOMPtr<nsIDOMNode> advNode;
|
||||
rv = AdvanceNode(aNode, *getter_AddRefs(advNode), aDir);
|
||||
|
@ -353,7 +353,7 @@ nsFilteredContentIterator::Next()
|
|||
return;
|
||||
}
|
||||
|
||||
// If we can't get the current node then
|
||||
// If we can't get the current node then
|
||||
// don't check to see if we can skip it
|
||||
nsINode *currentNode = mCurrentIterator->GetCurrentNode();
|
||||
|
||||
|
@ -385,7 +385,7 @@ nsFilteredContentIterator::Prev()
|
|||
return;
|
||||
}
|
||||
|
||||
// If we can't get the current node then
|
||||
// If we can't get the current node then
|
||||
// don't check to see if we can skip it
|
||||
nsINode *currentNode = mCurrentIterator->GetCurrentNode();
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ interface nsIInlineSpellChecker : nsISupports
|
|||
void replaceWord(in nsIDOMNode aNode, in long aOffset, in AString aNewword);
|
||||
void addWordToDictionary(in AString aWord);
|
||||
void removeWordFromDictionary(in AString aWord);
|
||||
|
||||
|
||||
void ignoreWord(in AString aWord);
|
||||
void ignoreWords([array, size_is(aCount)] in wstring aWordsToIgnore, in unsigned long aCount);
|
||||
void updateCurrentDictionary();
|
||||
|
|
|
@ -110,7 +110,7 @@ public:
|
|||
/**
|
||||
* Tells the spellchecker to use a specific dictionary.
|
||||
* @param aDictionary a string that is in the list returned
|
||||
* by GetDictionaryList() or an empty string. If aDictionary is
|
||||
* by GetDictionaryList() or an empty string. If aDictionary is
|
||||
* empty string, spellchecker will be disabled.
|
||||
*/
|
||||
NS_IMETHOD SetCurrentDictionary(const nsAString &aDictionary) = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/******
|
||||
|
||||
This file contains the list of all text services nsIAtoms and their values
|
||||
|
||||
|
||||
It is designed to be used as inline input to nsTextServicesDocument.cpp *only*
|
||||
through the magic of C preprocessing.
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ nsTextServicesDocument::InitWithEditor(nsIEditor *aEditor)
|
|||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsTextServicesDocument::GetDocument(nsIDOMDocument **aDoc)
|
||||
{
|
||||
NS_ENSURE_TRUE(aDoc, NS_ERROR_NULL_POINTER);
|
||||
|
@ -1158,8 +1158,8 @@ nsTextServicesDocument::DeleteSelection()
|
|||
|
||||
// We don't allow deletion during a collapsed selection!
|
||||
nsCOMPtr<nsIEditor> editor (do_QueryReferent(mEditor));
|
||||
NS_ASSERTION(editor, "DeleteSelection called without an editor present!");
|
||||
NS_ASSERTION(SelectionIsValid(), "DeleteSelection called without a valid selection!");
|
||||
NS_ASSERTION(editor, "DeleteSelection called without an editor present!");
|
||||
NS_ASSERTION(SelectionIsValid(), "DeleteSelection called without a valid selection!");
|
||||
|
||||
if (!editor || !SelectionIsValid())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -1459,7 +1459,7 @@ nsTextServicesDocument::InsertText(const nsString *aText)
|
|||
nsresult result = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIEditor> editor (do_QueryReferent(mEditor));
|
||||
NS_ASSERTION(editor, "InsertText called without an editor present!");
|
||||
NS_ASSERTION(editor, "InsertText called without an editor present!");
|
||||
|
||||
if (!editor || !SelectionIsValid())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -1618,7 +1618,7 @@ nsTextServicesDocument::InsertText(const nsString *aText)
|
|||
itEntry->mLength += strLength;
|
||||
|
||||
mSelStartIndex = mSelEndIndex = i;
|
||||
|
||||
|
||||
result = mSelCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(selection));
|
||||
|
||||
if (NS_FAILED(result))
|
||||
|
@ -1629,7 +1629,7 @@ nsTextServicesDocument::InsertText(const nsString *aText)
|
|||
}
|
||||
|
||||
result = selection->Collapse(itEntry->mNode, itEntry->mNodeOffset + itEntry->mLength);
|
||||
|
||||
|
||||
if (NS_FAILED(result))
|
||||
{
|
||||
editor->EndTransaction();
|
||||
|
@ -1711,7 +1711,7 @@ nsTextServicesDocument::InsertText(const nsString *aText)
|
|||
}
|
||||
|
||||
result = DeleteSelection();
|
||||
|
||||
|
||||
if (NS_FAILED(result))
|
||||
{
|
||||
editor->EndTransaction();
|
||||
|
@ -1782,7 +1782,7 @@ nsTextServicesDocument::DidDeleteNode(nsIDOMNode *aChild, nsresult aResult)
|
|||
// next valid text node in the offset table, and if there
|
||||
// wasn't a next, it would've set mIteratorStatus to eIsDone.
|
||||
|
||||
NS_ERROR("DeleteNode called for current iterator node.");
|
||||
NS_ERROR("DeleteNode called for current iterator node.");
|
||||
}
|
||||
|
||||
int32_t tcount = mOffsetTable.Length();
|
||||
|
@ -2055,7 +2055,7 @@ nsTextServicesDocument::CreateDocumentContentRootToNodeOffsetRange(
|
|||
if (aOffset < 0)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> bodyNode;
|
||||
nsCOMPtr<nsIDOMNode> bodyNode;
|
||||
nsresult rv = GetDocumentContentRootNode(getter_AddRefs(bodyNode));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(bodyNode, NS_ERROR_NULL_POINTER);
|
||||
|
@ -2217,9 +2217,9 @@ bool
|
|||
nsTextServicesDocument::DidSkip(nsIContentIterator* aFilteredIter)
|
||||
{
|
||||
// We can assume here that the Iterator is a nsFilteredContentIterator because
|
||||
// all the iterator are created in CreateContentIterator which create a
|
||||
// all the iterator are created in CreateContentIterator which create a
|
||||
// nsFilteredContentIterator
|
||||
// So if the iterator bailed on one of the "filtered" content nodes then we
|
||||
// So if the iterator bailed on one of the "filtered" content nodes then we
|
||||
// consider that to be a block and bail with true
|
||||
if (aFilteredIter) {
|
||||
nsFilteredContentIterator* filter = static_cast<nsFilteredContentIterator *>(aFilteredIter);
|
||||
|
@ -2431,7 +2431,7 @@ nsTextServicesDocument::SetSelectionInternal(int32_t aOffset, int32_t aLength, b
|
|||
for (i = mOffsetTable.Length() - 1; !eNode && i >= 0; i--)
|
||||
{
|
||||
entry = mOffsetTable[i];
|
||||
|
||||
|
||||
if (entry->mIsValid)
|
||||
{
|
||||
if (entry->mIsInsertedText)
|
||||
|
@ -2896,7 +2896,7 @@ nsTextServicesDocument::GetUncollapsedSelection(nsITextServicesDocument::TSDBloc
|
|||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
||||
// Find the first text node in the range.
|
||||
|
||||
|
||||
bool found;
|
||||
nsCOMPtr<nsIContent> content;
|
||||
|
||||
|
@ -3156,7 +3156,7 @@ nsTextServicesDocument::FirstTextNodeInCurrentBlock(nsIContentIterator *iter)
|
|||
if (DidSkip(iter))
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (last)
|
||||
iter->PositionAt(last);
|
||||
|
||||
|
@ -3324,7 +3324,7 @@ nsTextServicesDocument::CreateOffsetTable(nsTArray<OffsetEntry*> *aOffsetTable,
|
|||
// If we have an aIterRange, retrieve the endpoints so
|
||||
// they can be used in the while loop below to trim entries
|
||||
// for text nodes that are partially selected by aIterRange.
|
||||
|
||||
|
||||
nsCOMPtr<nsIDOMNode> rngStartNode, rngEndNode;
|
||||
int32_t rngStartOffset = 0, rngEndOffset = 0;
|
||||
|
||||
|
@ -3612,14 +3612,14 @@ nsTextServicesDocument::FindWordBounds(nsTArray<OffsetEntry*> *aOffsetTable,
|
|||
}
|
||||
|
||||
// Strip out the NBSPs at the ends
|
||||
while ((res.mBegin <= res.mEnd) && (IS_NBSP_CHAR(str[res.mBegin])))
|
||||
while ((res.mBegin <= res.mEnd) && (IS_NBSP_CHAR(str[res.mBegin])))
|
||||
res.mBegin++;
|
||||
if (str[res.mEnd] == (unsigned char)0x20)
|
||||
{
|
||||
uint32_t realEndWord = res.mEnd - 1;
|
||||
while ((realEndWord > res.mBegin) && (IS_NBSP_CHAR(str[realEndWord])))
|
||||
while ((realEndWord > res.mBegin) && (IS_NBSP_CHAR(str[realEndWord])))
|
||||
realEndWord--;
|
||||
if (realEndWord < res.mEnd - 1)
|
||||
if (realEndWord < res.mEnd - 1)
|
||||
res.mEnd = realEndWord + 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ private:
|
|||
static nsIAtom *sSampAtom;
|
||||
static nsIAtom *sSmallAtom;
|
||||
static nsIAtom *sSpacerAtom;
|
||||
static nsIAtom *sSpanAtom;
|
||||
static nsIAtom *sSpanAtom;
|
||||
static nsIAtom *sStrikeAtom;
|
||||
static nsIAtom *sStrongAtom;
|
||||
static nsIAtom *sSubAtom;
|
||||
|
|
Загрузка…
Ссылка в новой задаче