Bug 1394649 - Use nsGkAtoms on nsTextServiceDocument. r=masayuki

It is no reason to use custom atom instead of nsGkAtoms now, so we should
use nsGkAtoms instead.

MozReview-Commit-ID: 9slsZtLDNKH

--HG--
extra : histedit_source : 8ad70ff1adfa145bc0e8da3c6f43f3dba9b558f1
This commit is contained in:
Makoto Kato 2017-10-23 13:09:49 +09:00
parent e5ecd5213c
commit 4324707ac3
4 changed files with 26 additions and 113 deletions

View File

@ -1,51 +0,0 @@
/* 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/. */
/******
This file contains the list of all text services nsAtoms and their values
It is designed to be used as inline input to nsTextServicesDocument.cpp *only*
through the magic of C preprocessing.
All entries must be enclosed in the macro TS_ATOM which will have cruel
and unusual things done to it
It is recommended (but not strictly necessary) to keep all entries
in alphabetical order
The first argument to TS_ATOM is the C++ identifier of the atom
The second argument is the string value of the atom
******/
// OUTPUT_CLASS=nsTextServicesDocument
// MACRO_NAME=TS_ATOM
TS_ATOM(sAAtom, "a")
TS_ATOM(sAddressAtom, "address")
TS_ATOM(sBigAtom, "big")
TS_ATOM(sBAtom, "b")
TS_ATOM(sCiteAtom, "cite")
TS_ATOM(sCodeAtom, "code")
TS_ATOM(sDfnAtom, "dfn")
TS_ATOM(sEmAtom, "em")
TS_ATOM(sFontAtom, "font")
TS_ATOM(sIAtom, "i")
TS_ATOM(sKbdAtom, "kbd")
TS_ATOM(sKeygenAtom, "keygen")
TS_ATOM(sNobrAtom, "nobr")
TS_ATOM(sSAtom, "s")
TS_ATOM(sSampAtom, "samp")
TS_ATOM(sSmallAtom, "small")
TS_ATOM(sSpacerAtom, "spacer")
TS_ATOM(sSpanAtom, "span")
TS_ATOM(sStrikeAtom, "strike")
TS_ATOM(sStrongAtom, "strong")
TS_ATOM(sSubAtom, "sub")
TS_ATOM(sSupAtom, "sup")
TS_ATOM(sTtAtom, "tt")
TS_ATOM(sUAtom, "u")
TS_ATOM(sVarAtom, "var")
TS_ATOM(sWbrAtom, "wbr")

View File

@ -91,34 +91,6 @@ nsTextServicesDocument::~nsTextServicesDocument()
ClearOffsetTable(&mOffsetTable);
}
class TSAtoms
{
public:
#define TS_ATOM(name_, value_) NS_STATIC_ATOM_DECL(name_)
#include "nsTSAtomList.h" // IWYU pragma: keep
#undef TS_ATOM
};
#define TS_ATOM(name_, value_) NS_STATIC_ATOM_DEFN(TSAtoms, name_)
#include "nsTSAtomList.h" // IWYU pragma: keep
#undef TS_ATOM
#define TS_ATOM(name_, value_) NS_STATIC_ATOM_BUFFER(name_, value_)
#include "nsTSAtomList.h" // IWYU pragma: keep
#undef TS_ATOM
static const nsStaticAtomSetup sTSAtomSetup[] = {
#define TS_ATOM(name_, value_) NS_STATIC_ATOM_SETUP(TSAtoms, name_)
#include "nsTSAtomList.h" // IWYU pragma: keep
#undef TS_ATOM
};
/* static */ void
nsTextServicesDocument::RegisterAtoms()
{
NS_RegisterStaticAtoms(sTSAtomSetup);
}
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsTextServicesDocument)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsTextServicesDocument)
@ -2047,32 +2019,32 @@ nsTextServicesDocument::IsBlockNode(nsIContent *aContent)
nsAtom *atom = aContent->NodeInfo()->NameAtom();
return (TSAtoms::sAAtom != atom &&
TSAtoms::sAddressAtom != atom &&
TSAtoms::sBigAtom != atom &&
TSAtoms::sBAtom != atom &&
TSAtoms::sCiteAtom != atom &&
TSAtoms::sCodeAtom != atom &&
TSAtoms::sDfnAtom != atom &&
TSAtoms::sEmAtom != atom &&
TSAtoms::sFontAtom != atom &&
TSAtoms::sIAtom != atom &&
TSAtoms::sKbdAtom != atom &&
TSAtoms::sKeygenAtom != atom &&
TSAtoms::sNobrAtom != atom &&
TSAtoms::sSAtom != atom &&
TSAtoms::sSampAtom != atom &&
TSAtoms::sSmallAtom != atom &&
TSAtoms::sSpacerAtom != atom &&
TSAtoms::sSpanAtom != atom &&
TSAtoms::sStrikeAtom != atom &&
TSAtoms::sStrongAtom != atom &&
TSAtoms::sSubAtom != atom &&
TSAtoms::sSupAtom != atom &&
TSAtoms::sTtAtom != atom &&
TSAtoms::sUAtom != atom &&
TSAtoms::sVarAtom != atom &&
TSAtoms::sWbrAtom != atom);
return (nsGkAtoms::a != atom &&
nsGkAtoms::address != atom &&
nsGkAtoms::big != atom &&
nsGkAtoms::b != atom &&
nsGkAtoms::cite != atom &&
nsGkAtoms::code != atom &&
nsGkAtoms::dfn != atom &&
nsGkAtoms::em != atom &&
nsGkAtoms::font != atom &&
nsGkAtoms::i != atom &&
nsGkAtoms::kbd != atom &&
nsGkAtoms::keygen != atom &&
nsGkAtoms::nobr != atom &&
nsGkAtoms::s != atom &&
nsGkAtoms::samp != atom &&
nsGkAtoms::small != atom &&
nsGkAtoms::spacer != atom &&
nsGkAtoms::span != atom &&
nsGkAtoms::strike != atom &&
nsGkAtoms::strong != atom &&
nsGkAtoms::sub != atom &&
nsGkAtoms::sup != atom &&
nsGkAtoms::tt != atom &&
nsGkAtoms::u != atom &&
nsGkAtoms::var != atom &&
nsGkAtoms::wbr != atom);
}
bool

View File

@ -17,7 +17,6 @@
#include "nscore.h"
class OffsetEntry;
class nsAtom;
class nsIContent;
class nsIContentIterator;
class nsIDOMCharacterData;
@ -71,10 +70,6 @@ public:
*/
nsTextServicesDocument();
/** To be called at module init
*/
static void RegisterAtoms();
/* Macro for AddRef(), Release(), and QueryInterface() */
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTextServicesDocument, nsITextServicesDocument)

View File

@ -86,8 +86,6 @@
#include "nsMenuBarListener.h"
#endif
#include "nsTextServicesDocument.h"
#ifdef MOZ_WEBSPEECH
#include "nsSynthVoiceRegistry.h"
#endif
@ -154,7 +152,6 @@ nsLayoutStatics::Initialize()
nsCSSProps::AddRefTable();
nsColorNames::AddRefTable();
nsGkAtoms::AddRefAtoms();
nsTextServicesDocument::RegisterAtoms();
nsHTMLTags::RegisterAtoms();
nsRDFAtoms::RegisterAtoms();