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

@ -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;
}