Issue #1375 - Stop largely using the parser service

This is based on Bug 1395828

* Add nsHTMLElement::IsBlock()
* Rename nsHTMLTags methods
* Remove AssertParserServiceIsCorrect()
* Remove most uses of nsIParserService/nsParserService
This commit is contained in:
Matt A. Tobin 2020-04-17 06:24:43 -04:00 committed by Roy Tam
commit 9928baf912
18 changed files with 77 additions and 193 deletions

View file

@ -11,7 +11,7 @@
#include "mozilla/dom/HTMLElementBinding.h"
#include "mozilla/dom/WebComponentsBinding.h"
#include "mozilla/dom/DocGroup.h"
#include "nsIParserService.h"
#include "nsHTMLTags.h"
#include "jsapi.h"
namespace mozilla {
@ -588,14 +588,8 @@ CustomElementRegistry::Define(const nsAString& aName,
return;
}
nsIParserService* ps = nsContentUtils::GetParserService();
if (!ps) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return;
}
// bgsound and multicol are unknown html element.
int32_t tag = ps->HTMLCaseSensitiveAtomTagToId(extendsAtom);
int32_t tag = nsHTMLTags::CaseSensitiveAtomTagToId(extendsAtom);
if (tag == eHTMLTag_userdefined ||
tag == eHTMLTag_bgsound ||
tag == eHTMLTag_multicol) {

View file

@ -102,6 +102,7 @@
#include "nsHostObjectProtocolHandler.h"
#include "nsHtml5Module.h"
#include "nsHtml5StringParser.h"
#include "nsHTMLTags.h"
#include "nsIAddonPolicyService.h"
#include "nsIAnonymousContentCreator.h"
#include "nsIAsyncVerifyRedirectCallback.h"
@ -501,6 +502,8 @@ nsContentUtils::Init()
return NS_OK;
}
nsHTMLTags::AddRefTable();
sNameSpaceManager = nsNameSpaceManager::GetInstance();
NS_ENSURE_TRUE(sNameSpaceManager, NS_ERROR_OUT_OF_MEMORY);
@ -1927,6 +1930,8 @@ nsContentUtils::Shutdown()
{
sInitialized = false;
nsHTMLTags::ReleaseTable();
NS_IF_RELEASE(sContentPolicyService);
sTriedToGetContentPolicy = false;
uint32_t i;

View file

@ -116,7 +116,6 @@
#include "nsBidiUtils.h"
#include "nsIParserService.h"
#include "nsContentCreatorFunctions.h"
#include "nsIScriptContext.h"

View file

@ -32,7 +32,6 @@
#include "nsIDOMDocument.h"
#include "nsGkAtoms.h"
#include "nsIContent.h"
#include "nsIParserService.h"
#include "nsIScriptContext.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptSecurityManager.h"
@ -40,6 +39,7 @@
#include "nsISelectionPrivate.h"
#include "nsITransferable.h" // for kUnicodeMime
#include "nsContentUtils.h"
#include "nsElementTable.h"
#include "nsNodeUtils.h"
#include "nsUnicharUtils.h"
#include "nsReadableUtils.h"
@ -1741,9 +1741,6 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t
rv = GetNodeLocation(node, address_of(parent), &offset);
NS_ENSURE_SUCCESS(rv, rv);
if (offset == -1) return NS_OK; // we hit generated content; STOP
nsIParserService *parserService = nsContentUtils::GetParserService();
if (!parserService)
return NS_ERROR_OUT_OF_MEMORY;
while ((IsFirstNode(node)) && (!IsRoot(parent)) && (parent != common))
{
if (bResetPromotion)
@ -1751,11 +1748,8 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t
nsCOMPtr<nsIContent> content = do_QueryInterface(parent);
if (content && content->IsHTMLElement())
{
bool isBlock = false;
parserService->IsBlock(parserService->HTMLAtomTagToId(
content->NodeInfo()->NameAtom()), isBlock);
if (isBlock)
{
if (nsHTMLElement::IsBlock(nsHTMLTags::AtomTagToId(
content->NodeInfo()->NameAtom()))) {
bResetPromotion = false;
}
}
@ -1824,9 +1818,6 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t
rv = GetNodeLocation(node, address_of(parent), &offset);
NS_ENSURE_SUCCESS(rv, rv);
if (offset == -1) return NS_OK; // we hit generated content; STOP
nsIParserService *parserService = nsContentUtils::GetParserService();
if (!parserService)
return NS_ERROR_OUT_OF_MEMORY;
while ((IsLastNode(node)) && (!IsRoot(parent)) && (parent != common))
{
if (bResetPromotion)
@ -1834,11 +1825,8 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t
nsCOMPtr<nsIContent> content = do_QueryInterface(parent);
if (content && content->IsHTMLElement())
{
bool isBlock = false;
parserService->IsBlock(parserService->HTMLAtomTagToId(
content->NodeInfo()->NameAtom()), isBlock);
if (isBlock)
{
if (nsHTMLElement::IsBlock(nsHTMLTags::AtomTagToId(
content->NodeInfo()->NameAtom()))) {
bResetPromotion = false;
}
}

View file

@ -15,6 +15,7 @@
#include "nsIDOMElement.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsElementTable.h"
#include "nsNameSpaceManager.h"
#include "nsString.h"
#include "nsUnicharUtils.h"
@ -347,20 +348,13 @@ nsHTMLContentSerializer::AppendElementEnd(Element* aElement,
}
if (ns == kNameSpaceID_XHTML) {
nsIParserService* parserService = nsContentUtils::GetParserService();
if (parserService) {
bool isContainer;
parserService->
IsContainer(parserService->HTMLCaseSensitiveAtomTagToId(name),
isContainer);
if (!isContainer) {
// Keep this in sync with the cleanup at the end of this method.
MOZ_ASSERT(name != nsGkAtoms::body);
MaybeLeaveFromPreContent(content);
return NS_OK;
}
bool isContainer =
nsHTMLElement::IsContainer(nsHTMLTags::CaseSensitiveAtomTagToId(name));
if (!isContainer) {
// Keep this in sync with the cleanup at the end of this method.
MOZ_ASSERT(name != nsGkAtoms::body);
MaybeLeaveFromPreContent(content);
return NS_OK;
}
}

View file

@ -15,6 +15,7 @@
#include "nsIDOMElement.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsElementTable.h"
#include "nsNameSpaceManager.h"
#include "nsString.h"
#include "nsUnicharUtils.h"
@ -27,7 +28,6 @@
#include "nsEscape.h"
#include "nsITextToSubURI.h"
#include "nsCRT.h"
#include "nsIParserService.h"
#include "nsContentUtils.h"
#include "nsLWBrkCIID.h"
#include "nsIScriptElement.h"
@ -667,18 +667,7 @@ nsXHTMLContentSerializer::LineBreakBeforeOpen(int32_t aNamespaceID, nsIAtom* aNa
aName == nsGkAtoms::html) {
return true;
}
else {
nsIParserService* parserService = nsContentUtils::GetParserService();
if (parserService) {
bool res;
parserService->
IsBlock(parserService->HTMLCaseSensitiveAtomTagToId(aName), res);
return res;
}
}
return mAddSpace;
return nsHTMLElement::IsBlock(nsHTMLTags::CaseSensitiveAtomTagToId(aName));
}
bool
@ -761,18 +750,7 @@ nsXHTMLContentSerializer::LineBreakAfterClose(int32_t aNamespaceID, nsIAtom* aNa
(aName == nsGkAtoms::div)) {
return true;
}
else {
nsIParserService* parserService = nsContentUtils::GetParserService();
if (parserService) {
bool res;
parserService->
IsBlock(parserService->HTMLCaseSensitiveAtomTagToId(aName), res);
return res;
}
}
return false;
return nsHTMLElement::IsBlock(nsHTMLTags::CaseSensitiveAtomTagToId(aName));
}

View file

@ -19,7 +19,7 @@
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIDocumentEncoder.h"
#include "nsIParserService.h"
#include "nsElementTable.h"
#include "nsNameSpaceManager.h"
#include "nsTextFragment.h"
#include "nsString.h"
@ -994,14 +994,9 @@ ElementNeedsSeparateEndTag(Element* aElement, Element* aOriginalElement)
// HTML container tags should have a separate end tag even if empty, per spec.
// See
// https://w3c.github.io/DOM-Parsing/#dfn-concept-xml-serialization-algorithm
bool isHTMLContainer = true; // Default in case we get no parser service.
nsIParserService* parserService = nsContentUtils::GetParserService();
if (parserService) {
nsIAtom* localName = aElement->NodeInfo()->NameAtom();
parserService->IsContainer(
parserService->HTMLCaseSensitiveAtomTagToId(localName),
isHTMLContainer);
}
nsIAtom* localName = aElement->NodeInfo()->NameAtom();
bool isHTMLContainer =
nsHTMLElement::IsContainer(nsHTMLTags::CaseSensitiveAtomTagToId(localName));
return isHTMLContainer;
}

View file

@ -23,9 +23,9 @@
#include "nsContentCreatorFunctions.h"
#include "nsContentUtils.h"
#include "nsGlobalWindow.h"
#include "nsHTMLTags.h"
#include "nsIDocShell.h"
#include "nsIDOMGlobalPropertyInitializer.h"
#include "nsIParserService.h"
#include "nsIPermissionManager.h"
#include "nsIPrincipal.h"
#include "nsIXPConnect.h"
@ -3493,13 +3493,7 @@ CreateHTMLElement(const GlobalObject& aGlobal, const JS::CallArgs& aCallArgs,
// Step 5.
// If the definition is for a customized built-in element, the localName
// should be defined in the specification.
nsIParserService* parserService = nsContentUtils::GetParserService();
if (!parserService) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}
tag = parserService->HTMLCaseSensitiveAtomTagToId(definition->mLocalName);
tag = nsHTMLTags::CaseSensitiveAtomTagToId(definition->mLocalName);
if (tag == eHTMLTag_userdefined) {
aRv.ThrowTypeError<MSG_ILLEGAL_CONSTRUCTOR>();
return nullptr;

View file

@ -14,6 +14,7 @@
#include "nsContentSink.h"
#include "nsCOMPtr.h"
#include "nsHTMLTags.h"
#include "nsReadableUtils.h"
#include "nsUnicharUtils.h"
#include "nsIHTMLContentSink.h"
@ -59,8 +60,6 @@
#include "nsIScriptGlobalObject.h"
#include "nsNameSpaceManager.h"
#include "nsIParserService.h"
#include "nsIStyleSheetLinkingElement.h"
#include "nsITimer.h"
#include "nsError.h"
@ -262,10 +261,6 @@ NS_NewHTMLElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&&
RefPtr<mozilla::dom::NodeInfo> nodeInfo = aNodeInfo;
nsIParserService* parserService = nsContentUtils::GetParserService();
if (!parserService)
return NS_ERROR_OUT_OF_MEMORY;
nsIAtom *name = nodeInfo->NameAtom();
RefPtr<nsIAtom> tagAtom = nodeInfo->NameAtom();
RefPtr<nsIAtom> typeAtom = aIs ? NS_Atomize(*aIs) : tagAtom;
@ -273,7 +268,7 @@ NS_NewHTMLElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&&
NS_ASSERTION(nodeInfo->NamespaceEquals(kNameSpaceID_XHTML),
"Trying to HTML elements that don't have the XHTML namespace");
int32_t tag = parserService->HTMLCaseSensitiveAtomTagToId(name);
int32_t tag = nsHTMLTags::CaseSensitiveAtomTagToId(name);
bool isCustomElementName = (tag == eHTMLTag_userdefined &&
nsContentUtils::IsCustomElementName(name));

View file

@ -66,7 +66,6 @@
#include "nsContentUtils.h"
#include "nsIParser.h"
#include "nsCharsetSource.h"
#include "nsIParserService.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/css/Loader.h"
#include "nsIScriptError.h"

View file

@ -107,16 +107,12 @@
#include "prtime.h" // for PR_Now
class nsIOutputStream;
class nsIParserService;
class nsITransferable;
#ifdef DEBUG
#include "nsIDOMHTMLDocument.h" // for nsIDOMHTMLDocument
#endif
// Defined in nsEditorRegistration.cpp
extern nsIParserService *sParserService;
namespace mozilla {
using namespace dom;

View file

@ -63,13 +63,13 @@
#include "nsIWidget.h"
#include "nsIFrame.h"
#include "nsIParserService.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/dom/DocumentFragment.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/EventTarget.h"
#include "mozilla/dom/HTMLBodyElement.h"
#include "nsElementTable.h"
#include "nsTextFragment.h"
#include "nsContentList.h"
#include "mozilla/StyleSheet.h"
@ -690,49 +690,6 @@ HTMLEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
return TypedText(str, eTypedText);
}
static void
AssertParserServiceIsCorrect(nsIAtom* aTag, bool aIsBlock)
{
#ifdef DEBUG
// Check this against what we would have said with the old code:
if (aTag == nsGkAtoms::p ||
aTag == nsGkAtoms::div ||
aTag == nsGkAtoms::blockquote ||
aTag == nsGkAtoms::h1 ||
aTag == nsGkAtoms::h2 ||
aTag == nsGkAtoms::h3 ||
aTag == nsGkAtoms::h4 ||
aTag == nsGkAtoms::h5 ||
aTag == nsGkAtoms::h6 ||
aTag == nsGkAtoms::ul ||
aTag == nsGkAtoms::ol ||
aTag == nsGkAtoms::dl ||
aTag == nsGkAtoms::noscript ||
aTag == nsGkAtoms::form ||
aTag == nsGkAtoms::hr ||
aTag == nsGkAtoms::table ||
aTag == nsGkAtoms::fieldset ||
aTag == nsGkAtoms::address ||
aTag == nsGkAtoms::col ||
aTag == nsGkAtoms::colgroup ||
aTag == nsGkAtoms::li ||
aTag == nsGkAtoms::dt ||
aTag == nsGkAtoms::dd ||
aTag == nsGkAtoms::legend) {
if (!aIsBlock) {
nsAutoString assertmsg (NS_LITERAL_STRING("Parser and editor disagree on blockness: "));
nsAutoString tagName;
aTag->ToString(tagName);
assertmsg.Append(tagName);
char* assertstr = ToNewCString(assertmsg);
NS_ASSERTION(aIsBlock, assertstr);
free(assertstr);
}
}
#endif // DEBUG
}
/**
* Returns true if the id represents an element of block type.
* Can be used to determine if a new paragraph should be started.
@ -742,8 +699,8 @@ HTMLEditor::NodeIsBlockStatic(const nsINode* aElement)
{
MOZ_ASSERT(aElement);
// Nodes we know we want to treat as block
// even though the parser says they're not:
// We want to treat these as block nodes even though nsHTMLElement says
// they're not.
if (aElement->IsAnyOfHTMLElements(nsGkAtoms::body,
nsGkAtoms::head,
nsGkAtoms::tbody,
@ -752,27 +709,13 @@ HTMLEditor::NodeIsBlockStatic(const nsINode* aElement)
nsGkAtoms::tr,
nsGkAtoms::th,
nsGkAtoms::td,
nsGkAtoms::li,
nsGkAtoms::dt,
nsGkAtoms::dd,
nsGkAtoms::pre)) {
nsGkAtoms::dd)) {
return true;
}
bool isBlock;
#ifdef DEBUG
// XXX we can't use DebugOnly here because VC++ is stupid (bug 802884)
nsresult rv =
#endif
nsContentUtils::GetParserService()->
IsBlock(nsContentUtils::GetParserService()->HTMLAtomTagToId(
aElement->NodeInfo()->NameAtom()),
isBlock);
MOZ_ASSERT(rv == NS_OK);
AssertParserServiceIsCorrect(aElement->NodeInfo()->NameAtom(), isBlock);
return isBlock;
return nsHTMLElement::IsBlock(
nsHTMLTags::AtomTagToId(aElement->NodeInfo()->NameAtom()));
}
nsresult
@ -3538,17 +3481,15 @@ bool
HTMLEditor::TagCanContainTag(nsIAtom& aParentTag,
nsIAtom& aChildTag)
{
nsIParserService* parserService = nsContentUtils::GetParserService();
int32_t childTagEnum;
// XXX Should this handle #cdata-section too?
if (&aChildTag == nsGkAtoms::textTagName) {
childTagEnum = eHTMLTag_text;
} else {
childTagEnum = parserService->HTMLAtomTagToId(&aChildTag);
childTagEnum = nsHTMLTags::AtomTagToId(&aChildTag);
}
int32_t parentTagEnum = parserService->HTMLAtomTagToId(&aParentTag);
int32_t parentTagEnum = nsHTMLTags::AtomTagToId(&aParentTag);
return HTMLEditUtils::CanContain(parentTagEnum, childTagEnum);
}
@ -3562,8 +3503,7 @@ HTMLEditor::IsContainer(nsINode* aNode)
if (aNode->IsNodeOfType(nsINode::eTEXT)) {
tagEnum = eHTMLTag_text;
} else {
tagEnum =
nsContentUtils::GetParserService()->HTMLStringTagToId(aNode->NodeName());
tagEnum = nsHTMLTags::StringTagToId(aNode->NodeName());
}
return HTMLEditUtils::IsContainer(tagEnum);

View file

@ -15,6 +15,7 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'htmlparser'
EXPORTS += [
'nsElementTable.h',
'nsHTMLTagList.h',
'nsHTMLTags.h',
'nsIContentSink.h',

View file

@ -174,14 +174,23 @@ const nsHTMLElement gHTMLElements[] = {
/*********************************************************************************************/
bool nsHTMLElement::IsContainer(eHTMLTags aChild)
{
return !gHTMLElements[aChild].mLeaf;
}
bool nsHTMLElement::IsMemberOf(int32_t aSet) const
{
return TestBits(aSet,mParentBits);
return TestBits(aSet, mParentBits);
}
bool nsHTMLElement::IsContainer(eHTMLTags aId)
{
return !gHTMLElements[aId].mLeaf;
}
bool nsHTMLElement::IsBlock(eHTMLTags aId)
{
return gHTMLElements[aId].IsMemberOf(kBlock) ||
gHTMLElements[aId].IsMemberOf(kBlockEntity) ||
gHTMLElements[aId].IsMemberOf(kHeading) ||
gHTMLElements[aId].IsMemberOf(kPreformatted)||
gHTMLElements[aId].IsMemberOf(kList);
}
#ifdef DEBUG

View file

@ -87,6 +87,7 @@ struct nsHTMLElement {
bool mLeaf;
static bool IsContainer(eHTMLTags aTag);
static bool IsBlock(eHTMLTags aTag);
};
extern const nsHTMLElement gHTMLElements[];

View file

@ -161,7 +161,7 @@ nsHTMLTags::ReleaseTable(void)
// static
nsHTMLTag
nsHTMLTags::LookupTag(const nsAString& aTagName)
nsHTMLTags::StringTagToId(const nsAString& aTagName)
{
uint32_t length = aTagName.Length();
@ -195,7 +195,7 @@ nsHTMLTags::LookupTag(const nsAString& aTagName)
buf[i] = 0;
return CaseSensitiveLookupTag(buf);
return CaseSensitiveStringTagToId(buf);
}
#ifdef DEBUG
@ -210,33 +210,33 @@ nsHTMLTags::TestTagTable()
// Make sure we can find everything we are supposed to
for (int i = 0; i < NS_HTML_TAG_MAX; ++i) {
tag = sTagUnicodeTable[i];
id = LookupTag(nsDependentString(tag));
id = StringTagToId(nsDependentString(tag));
NS_ASSERTION(id != eHTMLTag_userdefined, "can't find tag id");
const char16_t* check = GetStringValue(id);
NS_ASSERTION(0 == nsCRT::strcmp(check, tag), "can't map id back to tag");
nsAutoString uname(tag);
ToUpperCase(uname);
NS_ASSERTION(id == LookupTag(uname), "wrong id");
NS_ASSERTION(id == StringTagToId(uname), "wrong id");
NS_ASSERTION(id == CaseSensitiveLookupTag(tag), "wrong id");
NS_ASSERTION(id == CaseSensitiveStringTagToId(tag), "wrong id");
atom = NS_Atomize(tag);
NS_ASSERTION(id == CaseSensitiveLookupTag(atom), "wrong id");
NS_ASSERTION(id == CaseSensitiveAtomTagToId(atom), "wrong id");
NS_ASSERTION(atom == GetAtom(id), "can't map id back to atom");
}
// Make sure we don't find things that aren't there
id = LookupTag(NS_LITERAL_STRING("@"));
id = StringTagToId(NS_LITERAL_STRING("@"));
NS_ASSERTION(id == eHTMLTag_userdefined, "found @");
id = LookupTag(NS_LITERAL_STRING("zzzzz"));
id = StringTagToId(NS_LITERAL_STRING("zzzzz"));
NS_ASSERTION(id == eHTMLTag_userdefined, "found zzzzz");
atom = NS_Atomize("@");
id = CaseSensitiveLookupTag(atom);
id = CaseSensitiveAtomTagToId(atom);
NS_ASSERTION(id == eHTMLTag_userdefined, "found @");
atom = NS_Atomize("zzzzz");
id = CaseSensitiveLookupTag(atom);
id = CaseSensitiveAtomTagToId(atom);
NS_ASSERTION(id == eHTMLTag_userdefined, "found zzzzz");
tag = GetStringValue((nsHTMLTag) 0);

View file

@ -46,8 +46,13 @@ public:
static void ReleaseTable(void);
// Functions for converting string or atom to id
static nsHTMLTag LookupTag(const nsAString& aTagName);
static nsHTMLTag CaseSensitiveLookupTag(const char16_t* aTagName)
static nsHTMLTag StringTagToId(const nsAString& aTagName);
static nsHTMLTag AtomTagToId(nsIAtom* aTagName)
{
return StringTagToId(nsDependentAtomString(aTagName));
}
static nsHTMLTag CaseSensitiveStringTagToId(const char16_t* aTagName)
{
NS_ASSERTION(gTagTable, "no lookup table, needs addref");
NS_ASSERTION(aTagName, "null tagname!");
@ -56,7 +61,7 @@ public:
return tag ? (nsHTMLTag)NS_PTR_TO_INT32(tag) : eHTMLTag_userdefined;
}
static nsHTMLTag CaseSensitiveLookupTag(nsIAtom* aTagName)
static nsHTMLTag CaseSensitiveAtomTagToId(nsIAtom* aTagName)
{
NS_ASSERTION(gTagAtomTable, "no lookup table, needs addref");
NS_ASSERTION(aTagName, "null tagname!");

View file

@ -25,19 +25,19 @@ NS_IMPL_ISUPPORTS(nsParserService, nsIParserService)
int32_t
nsParserService::HTMLAtomTagToId(nsIAtom* aAtom) const
{
return nsHTMLTags::LookupTag(nsDependentAtomString(aAtom));
return nsHTMLTags::StringTagToId(nsDependentAtomString(aAtom));
}
int32_t
nsParserService::HTMLCaseSensitiveAtomTagToId(nsIAtom* aAtom) const
{
return nsHTMLTags::CaseSensitiveLookupTag(aAtom);
return nsHTMLTags::CaseSensitiveAtomTagToId(aAtom);
}
int32_t
nsParserService::HTMLStringTagToId(const nsAString& aTag) const
{
return nsHTMLTags::LookupTag(aTag);
return nsHTMLTags::StringTagToId(aTag);
}
const char16_t*
@ -84,16 +84,7 @@ nsParserService::IsContainer(int32_t aId, bool& aIsContainer) const
NS_IMETHODIMP
nsParserService::IsBlock(int32_t aId, bool& aIsBlock) const
{
if((aId>eHTMLTag_unknown) && (aId<eHTMLTag_userdefined)) {
aIsBlock=((gHTMLElements[aId].IsMemberOf(kBlock)) ||
(gHTMLElements[aId].IsMemberOf(kBlockEntity)) ||
(gHTMLElements[aId].IsMemberOf(kHeading)) ||
(gHTMLElements[aId].IsMemberOf(kPreformatted))||
(gHTMLElements[aId].IsMemberOf(kList)));
}
else {
aIsBlock = false;
}
aIsBlock = nsHTMLElement::IsBlock((eHTMLTags)aId);
return NS_OK;
}