Bug 1572685 - part 13: Get rid of `HTMLEditRules::mReturnInEmptyLIKillsList` r=m_kato

`HTMLEditRules::mReturnInEmptyLIKillsList` stores value of
`editor.html.typing.returnInEmptyListItemClosesList` at construction, and it's
set to true unless the pref value is `"false"`.  However, this pref isn't
registered in anywhere (all.js, firefox.js, etc) nor used in comm-central
and BlueGriffon.

Even if I search the pref in the web, I don't see any information so that
this hidden pref must not be used anybody.  Therefore, this patch just removes
this member.

Differential Revision: https://phabricator.services.mozilla.com/D42262

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Masayuki Nakano 2019-08-20 01:53:35 +00:00
Родитель 47e3467fa6
Коммит eeb6d0434a
2 изменённых файлов: 2 добавлений и 17 удалений

Просмотреть файл

@ -187,17 +187,13 @@ class MOZ_RAII AutoSetTemporaryAncestorLimiter final {
* mozilla::HTMLEditRules * mozilla::HTMLEditRules
********************************************************/ ********************************************************/
HTMLEditRules::HTMLEditRules() HTMLEditRules::HTMLEditRules() : mHTMLEditor(nullptr), mInitialized(false) {
: mHTMLEditor(nullptr),
mInitialized(false),
mReturnInEmptyLIKillsList(false) {
mIsHTMLEditRules = true; mIsHTMLEditRules = true;
InitFields(); InitFields();
} }
void HTMLEditRules::InitFields() { void HTMLEditRules::InitFields() {
mHTMLEditor = nullptr; mHTMLEditor = nullptr;
mReturnInEmptyLIKillsList = true;
} }
nsresult HTMLEditRules::Init(TextEditor* aTextEditor) { nsresult HTMLEditRules::Init(TextEditor* aTextEditor) {
@ -223,16 +219,6 @@ nsresult HTMLEditRules::Init(TextEditor* aTextEditor) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
// cache any prefs we care about
static const char kPrefName[] =
"editor.html.typing.returnInEmptyListItemClosesList";
nsAutoCString returnInEmptyLIKillsList;
Preferences::GetCString(kPrefName, returnInEmptyLIKillsList);
// only when "false", becomes FALSE. Otherwise (including empty), TRUE.
// XXX Why was this pref designed as a string and not bool?
mReturnInEmptyLIKillsList = !returnInEmptyLIKillsList.EqualsLiteral("false");
Element* rootElement = HTMLEditorRef().GetRoot(); Element* rootElement = HTMLEditorRef().GetRoot();
if (NS_WARN_IF(!rootElement && !HTMLEditorRef().GetDocument())) { if (NS_WARN_IF(!rootElement && !HTMLEditorRef().GetDocument())) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@ -8255,7 +8241,7 @@ nsresult HTMLEditRules::ReturnInListItem(Element& aListItem, nsINode& aNode,
// If we are in an empty item, then we want to pop up out of the list, but // If we are in an empty item, then we want to pop up out of the list, but
// only if prefs say it's okay and if the parent isn't the active editing // only if prefs say it's okay and if the parent isn't the active editing
// host. // host.
if (mReturnInEmptyLIKillsList && host != aListItem.GetParentElement() && if (host != aListItem.GetParentElement() &&
IsEmptyBlockElement(aListItem, IgnoreSingleBR::eYes)) { IsEmptyBlockElement(aListItem, IgnoreSingleBR::eYes)) {
nsCOMPtr<nsIContent> leftListNode = aListItem.GetParent(); nsCOMPtr<nsIContent> leftListNode = aListItem.GetParent();
// Are we the last list item in the list? // Are we the last list item in the list?

Просмотреть файл

@ -1321,7 +1321,6 @@ class HTMLEditRules : public TextEditRules {
protected: protected:
HTMLEditor* mHTMLEditor; HTMLEditor* mHTMLEditor;
bool mInitialized; bool mInitialized;
bool mReturnInEmptyLIKillsList;
}; };
} // namespace mozilla } // namespace mozilla