diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 05:43:18 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 05:43:18 -0400 |
commit | 516fd67d506b8dd3c2721dfd1aa1bbef4a2eda6f (patch) | |
tree | aea649009c0ef563041ded0cb0c5d397568eab07 /editor/libeditor/HTMLEditRules.cpp | |
parent | 17f7e1c8c6fca351174bdbd73981aa8e44d0f9da (diff) | |
download | UXP-516fd67d506b8dd3c2721dfd1aa1bbef4a2eda6f.tar UXP-516fd67d506b8dd3c2721dfd1aa1bbef4a2eda6f.tar.gz UXP-516fd67d506b8dd3c2721dfd1aa1bbef4a2eda6f.tar.lz UXP-516fd67d506b8dd3c2721dfd1aa1bbef4a2eda6f.tar.xz UXP-516fd67d506b8dd3c2721dfd1aa1bbef4a2eda6f.zip |
Bug 1337698 - Use UniquePtr instead of nsAutoPtr in editor
* PlaceholderTransaction should use UniquePtr
* HTMLEditor should use UniquePtr
* TypeInState should use UniquePtr
Tag #1375
Diffstat (limited to 'editor/libeditor/HTMLEditRules.cpp')
-rw-r--r-- | editor/libeditor/HTMLEditRules.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/editor/libeditor/HTMLEditRules.cpp b/editor/libeditor/HTMLEditRules.cpp index 0aa2bde8c..c97ebf27f 100644 --- a/editor/libeditor/HTMLEditRules.cpp +++ b/editor/libeditor/HTMLEditRules.cpp @@ -16,12 +16,13 @@ #include "mozilla/EditorUtils.h" #include "mozilla/HTMLEditor.h" #include "mozilla/MathAlgorithms.h" +#include "mozilla/Move.h" #include "mozilla/Preferences.h" +#include "mozilla/UniquePtr.h" #include "mozilla/dom/Selection.h" #include "mozilla/dom/Element.h" #include "mozilla/OwningNonNull.h" #include "mozilla/mozalloc.h" -#include "nsAutoPtr.h" #include "nsAString.h" #include "nsAlgorithm.h" #include "nsCRT.h" @@ -4410,20 +4411,21 @@ HTMLEditRules::CreateStyleForInsertText(Selection& aSelection, NS_ENSURE_STATE(rootElement); // process clearing any styles first - nsAutoPtr<PropItem> item(mHTMLEditor->mTypeInState->TakeClearProperty()); + UniquePtr<PropItem> item = + Move(mHTMLEditor->mTypeInState->TakeClearProperty()); while (item && node != rootElement) { NS_ENSURE_STATE(mHTMLEditor); nsresult rv = mHTMLEditor->ClearStyle(address_of(node), &offset, item->tag, &item->attr); NS_ENSURE_SUCCESS(rv, rv); - item = mHTMLEditor->mTypeInState->TakeClearProperty(); + item = Move(mHTMLEditor->mTypeInState->TakeClearProperty()); weDidSomething = true; } // then process setting any styles int32_t relFontSize = mHTMLEditor->mTypeInState->TakeRelativeFontSize(); - item = mHTMLEditor->mTypeInState->TakeSetProperty(); + item = Move(mHTMLEditor->mTypeInState->TakeSetProperty()); if (item || relFontSize) { // we have at least one style to add; make a new text node to insert style |