mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Merge trunk into HTML5 repo
This commit is contained in:
commit
612191c82d
@ -45,7 +45,7 @@ function openContextMenuFor(element) {
|
||||
|
||||
// This seems to work, as long as we explicitly set the popupNode first.
|
||||
// For frames, the popupNode needs to be set to inside the frame.
|
||||
if (element.localName == "IFRAME")
|
||||
if (element.localName == "iframe")
|
||||
chromeWin.document.popupNode = element.contentDocument.body;
|
||||
else
|
||||
chromeWin.document.popupNode = element;
|
||||
|
@ -84,6 +84,7 @@ REQUIRES = xpcom \
|
||||
shistory \
|
||||
editor \
|
||||
windowwatcher \
|
||||
html5 \
|
||||
$(NULL)
|
||||
|
||||
ifdef ACCESSIBILITY
|
||||
|
@ -794,7 +794,7 @@ nsContentSink::ProcessStyleLink(nsIContent* aElement,
|
||||
nsresult
|
||||
nsContentSink::ProcessMETATag(nsIContent* aContent)
|
||||
{
|
||||
NS_ASSERTION(aContent, "missing base-element");
|
||||
NS_ASSERTION(aContent, "missing meta-element");
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
@ -810,6 +810,16 @@ nsContentSink::ProcessMETATag(nsIContent* aContent)
|
||||
rv = ProcessHeaderData(fieldAtom, result, aContent);
|
||||
}
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
/* Look for the viewport meta tag. If we find it, process it and put the
|
||||
* data into the document header. */
|
||||
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
|
||||
nsGkAtoms::viewport, eIgnoreCase)) {
|
||||
nsAutoString value;
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::content, value);
|
||||
rv = nsContentUtils::ProcessViewportInfo(mDocument, value);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -146,6 +146,8 @@ class nsContentSink : public nsICSSLoaderObserver,
|
||||
|
||||
virtual void UpdateChildCounts() = 0;
|
||||
|
||||
PRBool IsTimeToNotify();
|
||||
|
||||
protected:
|
||||
nsContentSink();
|
||||
virtual ~nsContentSink();
|
||||
@ -241,12 +243,14 @@ protected:
|
||||
nsIURI **aManifestURI,
|
||||
CacheSelectionAction *aAction);
|
||||
|
||||
public:
|
||||
// Searches for the offline cache manifest attribute and calls one
|
||||
// of the above defined methods to select the document's application
|
||||
// cache, let it be associated with the document and eventually
|
||||
// schedule the cache update process.
|
||||
void ProcessOfflineManifest(nsIContent *aElement);
|
||||
|
||||
protected:
|
||||
// Tries to scroll to the URI's named anchor. Once we've successfully
|
||||
// done that, further calls to this method will be ignored.
|
||||
void ScrollToRef();
|
||||
@ -255,10 +259,9 @@ protected:
|
||||
// Start layout. If aIgnorePendingSheets is true, this will happen even if
|
||||
// we still have stylesheet loads pending. Otherwise, we'll wait until the
|
||||
// stylesheets are all done loading.
|
||||
public:
|
||||
void StartLayout(PRBool aIgnorePendingSheets);
|
||||
|
||||
PRBool IsTimeToNotify();
|
||||
|
||||
protected:
|
||||
void
|
||||
FavorPerformanceHint(PRBool perfOverStarvation, PRUint32 starvationDelay);
|
||||
|
||||
|
@ -162,6 +162,7 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
|
||||
#include "nsCPrefetchService.h"
|
||||
#include "nsIChromeRegistry.h"
|
||||
#include "nsIMIMEHeaderParam.h"
|
||||
#include "nsHtml5Module.h"
|
||||
|
||||
#ifdef IBMBIDI
|
||||
#include "nsIBidiKeyboard.h"
|
||||
@ -3584,6 +3585,44 @@ nsContentUtils::CreateContextualFragment(nsIDOMNode* aContextNode,
|
||||
// for compiling event handlers... so just bail out.
|
||||
nsCOMPtr<nsIDocument> document = node->GetOwnerDoc();
|
||||
NS_ENSURE_TRUE(document, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
PRBool bCaseSensitive = document->IsCaseSensitive();
|
||||
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc(do_QueryInterface(document));
|
||||
PRBool bHTML = htmlDoc && !bCaseSensitive;
|
||||
|
||||
if (bHTML && nsContentUtils::GetBoolPref("html5.enable", PR_TRUE)) {
|
||||
// See if the document has a cached fragment parser. nsHTMLDocument is the
|
||||
// only one that should really have one at the moment.
|
||||
nsCOMPtr<nsIParser> parser = document->GetFragmentParser();
|
||||
if (parser) {
|
||||
// Get the parser ready to use.
|
||||
parser->Reset();
|
||||
}
|
||||
else {
|
||||
// Create a new parser for this operation.
|
||||
parser = nsHtml5Module::NewHtml5Parser();
|
||||
if (!parser) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
document->SetFragmentParser(parser);
|
||||
}
|
||||
nsCOMPtr<nsIDOMDocumentFragment> frag;
|
||||
rv = NS_NewDocumentFragment(getter_AddRefs(frag), document->NodeInfoManager());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIContent> contextAsContent = do_QueryInterface(aContextNode);
|
||||
NS_ASSERTION(contextAsContent, "Context node did not QI to nsIContent");
|
||||
|
||||
parser->ParseFragment(aFragment,
|
||||
frag,
|
||||
contextAsContent->Tag(),
|
||||
contextAsContent->GetNameSpaceID(),
|
||||
(document->GetCompatibilityMode() == eCompatibility_NavQuirks));
|
||||
|
||||
NS_ADDREF(*aReturn = frag);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAutoTArray<nsString, 32> tagStack;
|
||||
nsAutoString uriStr, nameStr;
|
||||
@ -3641,14 +3680,9 @@ nsContentUtils::CreateContextualFragment(nsIDOMNode* aContextNode,
|
||||
}
|
||||
|
||||
nsCAutoString contentType;
|
||||
PRBool bCaseSensitive = PR_TRUE;
|
||||
nsAutoString buf;
|
||||
document->GetContentType(buf);
|
||||
LossyCopyUTF16toASCII(buf, contentType);
|
||||
bCaseSensitive = document->IsCaseSensitive();
|
||||
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc(do_QueryInterface(document));
|
||||
PRBool bHTML = htmlDoc && !bCaseSensitive;
|
||||
|
||||
// See if the document has a cached fragment parser. nsHTMLDocument is the
|
||||
// only one that should really have one at the moment.
|
||||
|
@ -817,7 +817,9 @@ nsFrameLoader::EnsureDocShell()
|
||||
nsAutoString frameName;
|
||||
|
||||
PRInt32 namespaceID = mOwnerContent->GetNameSpaceID();
|
||||
if (namespaceID == kNameSpaceID_XHTML) {
|
||||
if (namespaceID == kNameSpaceID_XHTML
|
||||
&& mOwnerContent->GetOwnerDoc() // clean up after bug 335998
|
||||
&& mOwnerContent->GetOwnerDoc()->IsCaseSensitive()) {
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::id, frameName);
|
||||
} else {
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::name, frameName);
|
||||
|
@ -491,8 +491,7 @@ nsXHTMLContentSerializer::AfterElementStart(nsIContent * aContent,
|
||||
nsAString& aStr)
|
||||
{
|
||||
nsIAtom *name = aContent->Tag();
|
||||
if (((mIsHTMLSerializer && aContent->GetNameSpaceID() == kNameSpaceID_None) ||
|
||||
(!mIsHTMLSerializer && aContent->GetNameSpaceID() == kNameSpaceID_XHTML)) &&
|
||||
if (aContent->GetNameSpaceID() == kNameSpaceID_XHTML &&
|
||||
mIsWholeDocument &&
|
||||
name == nsGkAtoms::head) {
|
||||
|
||||
@ -574,8 +573,7 @@ nsXHTMLContentSerializer::CheckElementStart(nsIContent * aContent,
|
||||
nsIAtom *name = aContent->Tag();
|
||||
PRInt32 namespaceID = aContent->GetNameSpaceID();
|
||||
|
||||
if ((mIsHTMLSerializer && namespaceID == kNameSpaceID_None) ||
|
||||
(!mIsHTMLSerializer && namespaceID == kNameSpaceID_XHTML)) {
|
||||
if (namespaceID == kNameSpaceID_XHTML) {
|
||||
if (name == nsGkAtoms::br && mPreLevel > 0 &&
|
||||
(mFlags & nsIDocumentEncoder::OutputNoFormattingInPre)) {
|
||||
AppendNewLineToString(aStr);
|
||||
@ -941,8 +939,7 @@ PRBool
|
||||
nsXHTMLContentSerializer::LineBreakBeforeOpen(PRInt32 aNamespaceID, nsIAtom* aName)
|
||||
{
|
||||
|
||||
if ((mIsHTMLSerializer && aNamespaceID != kNameSpaceID_None) ||
|
||||
(!mIsHTMLSerializer && aNamespaceID != kNameSpaceID_XHTML)) {
|
||||
if (aNamespaceID != kNameSpaceID_XHTML) {
|
||||
return mAddSpace;
|
||||
}
|
||||
|
||||
@ -973,8 +970,7 @@ PRBool
|
||||
nsXHTMLContentSerializer::LineBreakAfterOpen(PRInt32 aNamespaceID, nsIAtom* aName)
|
||||
{
|
||||
|
||||
if ((mIsHTMLSerializer && aNamespaceID != kNameSpaceID_None) ||
|
||||
(!mIsHTMLSerializer && aNamespaceID != kNameSpaceID_XHTML)) {
|
||||
if (aNamespaceID != kNameSpaceID_XHTML) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
@ -1005,8 +1001,7 @@ PRBool
|
||||
nsXHTMLContentSerializer::LineBreakBeforeClose(PRInt32 aNamespaceID, nsIAtom* aName)
|
||||
{
|
||||
|
||||
if ((mIsHTMLSerializer && aNamespaceID != kNameSpaceID_None) ||
|
||||
(!mIsHTMLSerializer && aNamespaceID != kNameSpaceID_XHTML)) {
|
||||
if (aNamespaceID != kNameSpaceID_XHTML) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
@ -1028,8 +1023,7 @@ PRBool
|
||||
nsXHTMLContentSerializer::LineBreakAfterClose(PRInt32 aNamespaceID, nsIAtom* aName)
|
||||
{
|
||||
|
||||
if ((mIsHTMLSerializer && aNamespaceID != kNameSpaceID_None) ||
|
||||
(!mIsHTMLSerializer && aNamespaceID != kNameSpaceID_XHTML)) {
|
||||
if (aNamespaceID != kNameSpaceID_XHTML) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
@ -1070,8 +1064,7 @@ void
|
||||
nsXHTMLContentSerializer::MaybeEnterInPreContent(nsIContent* aNode)
|
||||
{
|
||||
|
||||
if ((mIsHTMLSerializer && aNode->GetNameSpaceID() != kNameSpaceID_None) ||
|
||||
(!mIsHTMLSerializer && aNode->GetNameSpaceID() != kNameSpaceID_XHTML)) {
|
||||
if (aNode->GetNameSpaceID() != kNameSpaceID_XHTML) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1090,8 +1083,7 @@ nsXHTMLContentSerializer::MaybeEnterInPreContent(nsIContent* aNode)
|
||||
void
|
||||
nsXHTMLContentSerializer::MaybeLeaveFromPreContent(nsIContent* aNode)
|
||||
{
|
||||
if ((mIsHTMLSerializer && aNode->GetNameSpaceID() != kNameSpaceID_None) ||
|
||||
(!mIsHTMLSerializer && aNode->GetNameSpaceID() != kNameSpaceID_XHTML)) {
|
||||
if (aNode->GetNameSpaceID() != kNameSpaceID_XHTML) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -18,42 +18,42 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=276037
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
/** Test for Bug 276037 **/
|
||||
function countElements (node, namespaceURI, tagName) {
|
||||
function countElements (node, namespaceURI, localName) {
|
||||
var count = 0;
|
||||
for (var i = 0; i < node.childNodes.length; i++) {
|
||||
var child = node.childNodes[i];
|
||||
if (child.nodeType == Node.ELEMENT_NODE && child.tagName == tagName &&
|
||||
if (child.nodeType == Node.ELEMENT_NODE && child.localName == localName &&
|
||||
child.namespaceURI == namespaceURI) {
|
||||
count++;
|
||||
}
|
||||
if (child.hasChildNodes()) {
|
||||
count += countElements(child, namespaceURI, tagName);
|
||||
count += countElements(child, namespaceURI, localName);
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
function checkElements(namespaceURI, tagName) {
|
||||
var elementsNS = document.getElementsByTagNameNS(namespaceURI, tagName);
|
||||
var elements = document.getElementsByTagName(tagName);
|
||||
var elementCount = countElements(document, namespaceURI, tagName);
|
||||
const gEBTN = 'document.getElementsByTagName(\'' + tagName + '\').length: ' + elements.length;
|
||||
const gEBTNNS = '; document.getElementsByTagNameNS(\'' + namespaceURI + '\', \'' + tagName + '\').length: ' + elementsNS.length;
|
||||
function checkElements(namespaceURI, localName) {
|
||||
var elementsNS = document.getElementsByTagNameNS(namespaceURI, localName);
|
||||
var elements = document.getElementsByTagName(localName);
|
||||
var elementCount = countElements(document, namespaceURI, localName);
|
||||
const gEBTN = 'document.getElementsByTagName(\'' + localName + '\').length: ' + elements.length;
|
||||
const gEBTNNS = '; document.getElementsByTagNameNS(\'' + namespaceURI + '\', \'' + localName + '\').length: ' + elementsNS.length;
|
||||
|
||||
text1 = gEBTN + '; element count: ' + elementCount;
|
||||
text2 = gEBTNNS + '; element count: ' + elementCount;
|
||||
|
||||
is(elements.length, elementCount, text1);
|
||||
is(elementsNS.length, elementCount, text2);
|
||||
is(global.gEBTN[namespaceURI][tagName].length, elementCount, text1);
|
||||
is(global.gEBTNNS[namespaceURI][tagName].length, elementCount, text2);
|
||||
is(global.gEBTN[namespaceURI][localName].length, elementCount, text1);
|
||||
is(global.gEBTNNS[namespaceURI][localName].length, elementCount, text2);
|
||||
}
|
||||
|
||||
const xhtmlNS = null;
|
||||
const xhtmlNS = 'http://www.w3.org/1999/xhtml';
|
||||
|
||||
function checkSpansAndScripts () {
|
||||
checkElements(xhtmlNS, 'SPAN');
|
||||
checkElements(xhtmlNS, 'SCRIPT');
|
||||
checkElements(xhtmlNS, 'span');
|
||||
checkElements(xhtmlNS, 'script');
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
@ -67,10 +67,10 @@ global.gEBTN[xhtmlNS] = {};
|
||||
global.gEBTNNS = {};
|
||||
global.gEBTNNS[xhtmlNS] = {};
|
||||
|
||||
global.gEBTN[xhtmlNS].SPAN = document.getElementsByTagName("span");
|
||||
global.gEBTNNS[xhtmlNS].SPAN = document.getElementsByTagNameNS(xhtmlNS, "span");
|
||||
global.gEBTN[xhtmlNS].SCRIPT = document.getElementsByTagName("script");
|
||||
global.gEBTNNS[xhtmlNS].SCRIPT = document.getElementsByTagNameNS(xhtmlNS, "script");
|
||||
global.gEBTN[xhtmlNS].span = document.getElementsByTagName("span");
|
||||
global.gEBTNNS[xhtmlNS].span = document.getElementsByTagNameNS(xhtmlNS, "span");
|
||||
global.gEBTN[xhtmlNS].script = document.getElementsByTagName("script");
|
||||
global.gEBTNNS[xhtmlNS].script = document.getElementsByTagNameNS(xhtmlNS, "script");
|
||||
</script>
|
||||
<p><span>Static text in span.</span></p>
|
||||
<script type="text/javascript">
|
||||
|
@ -42,6 +42,6 @@ VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
PARALLEL_DIRS = content document
|
||||
PARALLEL_DIRS = content document parser
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -305,7 +305,8 @@ nsGenericHTMLElement::SetAttribute(const nsAString& aName,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAtom> nameAtom;
|
||||
if (mNodeInfo->NamespaceEquals(kNameSpaceID_None)) {
|
||||
if (GetOwnerDoc() // XXX clean up after bug 335998 lands
|
||||
&& !(GetOwnerDoc()->IsCaseSensitive())) {
|
||||
nsAutoString lower;
|
||||
ToLowerCase(aName, lower);
|
||||
nameAtom = do_GetAtom(lower);
|
||||
@ -327,58 +328,27 @@ nsGenericHTMLElement::GetNodeName(nsAString& aNodeName)
|
||||
{
|
||||
mNodeInfo->GetQualifiedName(aNodeName);
|
||||
|
||||
if (mNodeInfo->NamespaceEquals(kNameSpaceID_None))
|
||||
if (GetOwnerDoc() // XXX clean up after bug 335998 lands
|
||||
&& !(GetOwnerDoc()->IsCaseSensitive()))
|
||||
ToUpperCase(aNodeName);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetLocalName(nsAString& aLocalName)
|
||||
{
|
||||
mNodeInfo->GetLocalName(aLocalName);
|
||||
|
||||
if (mNodeInfo->NamespaceEquals(kNameSpaceID_None)) {
|
||||
// No namespace, this means we're dealing with a good ol' HTML
|
||||
// element, so uppercase the local name.
|
||||
|
||||
ToUpperCase(aLocalName);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetElementsByTagName(const nsAString& aTagname,
|
||||
nsIDOMNodeList** aReturn)
|
||||
{
|
||||
nsAutoString tagName(aTagname);
|
||||
|
||||
// Only lowercase the name if this element has no namespace (i.e.
|
||||
// it's a HTML element, not an XHTML element).
|
||||
if (mNodeInfo && mNodeInfo->NamespaceEquals(kNameSpaceID_None))
|
||||
// Only lowercase the name if this is an HTML document.
|
||||
if (GetOwnerDoc() // XXX clean up after bug 335998 lands
|
||||
&& !(GetOwnerDoc()->IsCaseSensitive()))
|
||||
ToLowerCase(tagName);
|
||||
|
||||
return nsGenericHTMLElementBase::GetElementsByTagName(tagName, aReturn);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName,
|
||||
nsIDOMNodeList** aReturn)
|
||||
{
|
||||
nsAutoString localName(aLocalName);
|
||||
|
||||
// Only lowercase the name if this element has no namespace (i.e.
|
||||
// it's a HTML element, not an XHTML element).
|
||||
if (mNodeInfo && mNodeInfo->NamespaceEquals(kNameSpaceID_None))
|
||||
ToLowerCase(localName);
|
||||
|
||||
return nsGenericHTMLElementBase::GetElementsByTagNameNS(aNamespaceURI,
|
||||
localName,
|
||||
aReturn);
|
||||
}
|
||||
|
||||
// Implementation for nsIDOMHTMLElement
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetId(nsAString& aId)
|
||||
@ -1200,7 +1170,7 @@ nsGenericHTMLElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||
already_AddRefed<nsIURI>
|
||||
nsGenericHTMLElement::GetBaseURI() const
|
||||
{
|
||||
nsIDocument* doc = GetOwnerDoc();
|
||||
nsIDocument* doc = GetOwnerDoc(); // XXX clean up after bug 335998 lands
|
||||
|
||||
void* prop;
|
||||
if (HasFlag(NODE_HAS_PROPERTIES) && (prop = GetProperty(nsGkAtoms::htmlBaseHref))) {
|
||||
@ -1212,15 +1182,11 @@ nsGenericHTMLElement::GetBaseURI() const
|
||||
|
||||
// If we are a plain old HTML element (not XHTML), don't bother asking the
|
||||
// base class -- our base URI is determined solely by the document base.
|
||||
if (mNodeInfo->NamespaceEquals(kNameSpaceID_None)) {
|
||||
if (doc) {
|
||||
nsIURI *uri = doc->GetBaseURI();
|
||||
NS_IF_ADDREF(uri);
|
||||
if (doc && !(doc->IsCaseSensitive())) {
|
||||
nsIURI *uri = doc->GetBaseURI();
|
||||
NS_IF_ADDREF(uri);
|
||||
|
||||
return uri;
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
return uri;
|
||||
}
|
||||
|
||||
return nsGenericHTMLElementBase::GetBaseURI();
|
||||
@ -3461,7 +3427,8 @@ nsGenericHTMLElement::GetHashFromHrefURI(nsAString& aHash)
|
||||
const nsAttrName*
|
||||
nsGenericHTMLElement::InternalGetExistingAttrNameFromQName(const nsAString& aStr) const
|
||||
{
|
||||
if (mNodeInfo->NamespaceEquals(kNameSpaceID_None)) {
|
||||
if (GetOwnerDoc() // XXX clean up after bug 335998 lands
|
||||
&& !(GetOwnerDoc()->IsCaseSensitive())) {
|
||||
nsAutoString lower;
|
||||
ToLowerCase(aStr, lower);
|
||||
return mAttrsAndChildren.GetExistingAttrNameFromQName(
|
||||
|
@ -103,7 +103,6 @@ public:
|
||||
|
||||
// Implementation for nsIDOMNode
|
||||
NS_METHOD GetNodeName(nsAString& aNodeName);
|
||||
NS_METHOD GetLocalName(nsAString& aLocalName);
|
||||
|
||||
// Implementation for nsIDOMElement
|
||||
NS_METHOD SetAttribute(const nsAString& aName,
|
||||
@ -111,9 +110,6 @@ public:
|
||||
NS_METHOD GetTagName(nsAString& aTagName);
|
||||
NS_METHOD GetElementsByTagName(const nsAString& aTagname,
|
||||
nsIDOMNodeList** aReturn);
|
||||
NS_METHOD GetElementsByTagNameNS(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName,
|
||||
nsIDOMNodeList** aReturn);
|
||||
|
||||
// nsIDOMHTMLElement methods. Note that these are non-virtual
|
||||
// methods, implementations are expected to forward calls to these
|
||||
|
@ -152,7 +152,7 @@ NS_NewHTMLOptionElement(nsINodeInfo *aNodeInfo, PRBool aFromParser)
|
||||
NS_ENSURE_TRUE(doc, nsnull);
|
||||
|
||||
nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::option, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, nsnull);
|
||||
}
|
||||
|
||||
|
@ -321,7 +321,8 @@ nsHTMLStyleElement::GetStyleSheetURL(PRBool* aIsInline,
|
||||
if (*aIsInline) {
|
||||
return;
|
||||
}
|
||||
if (mNodeInfo->NamespaceEquals(kNameSpaceID_XHTML)) {
|
||||
if (GetOwnerDoc() && // XXX clean up after bug 335998 lands
|
||||
!(GetOwnerDoc()->IsCaseSensitive())) {
|
||||
// We stopped supporting <style src="..."> for XHTML as it is
|
||||
// non-standard.
|
||||
*aIsInline = PR_TRUE;
|
||||
|
@ -250,7 +250,7 @@ nsHTMLTableRowElement::GetCells(nsIDOMHTMLCollection** aValue)
|
||||
nsnull, // closure data
|
||||
PR_FALSE,
|
||||
nsnull,
|
||||
kNameSpaceID_None,
|
||||
kNameSpaceID_XHTML,
|
||||
PR_FALSE);
|
||||
|
||||
NS_ENSURE_TRUE(mCells, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
@ -6,9 +6,6 @@
|
||||
</s>
|
||||
<form></form>
|
||||
<form>
|
||||
<select>
|
||||
<optgroup></optgroup>
|
||||
</select>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,8 +1,3 @@
|
||||
<form>
|
||||
<select>
|
||||
<optgroup></optgroup>
|
||||
</select>
|
||||
</form>
|
||||
<table>
|
||||
<th>head</th>
|
||||
</table>
|
||||
|
@ -6,9 +6,6 @@
|
||||
</head>
|
||||
<body>
|
||||
<form>
|
||||
<select>
|
||||
<optgroup></optgroup>
|
||||
</select>
|
||||
<table></table>
|
||||
<input type="button" value="button"></input>
|
||||
</form>
|
||||
|
@ -76,6 +76,7 @@ REQUIRES = xpcom \
|
||||
plugin \
|
||||
txtsvc \
|
||||
uriloader \
|
||||
html5 \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
|
@ -211,8 +211,6 @@ public:
|
||||
NS_IMETHOD IsEnabled(PRInt32 aTag, PRBool* aReturn);
|
||||
NS_IMETHOD_(PRBool) IsFormOnStack();
|
||||
|
||||
virtual nsresult ProcessMETATag(nsIContent* aContent);
|
||||
|
||||
#ifdef DEBUG
|
||||
// nsIDebugDumpContent
|
||||
NS_IMETHOD DumpContentModel();
|
||||
@ -548,7 +546,7 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode,
|
||||
ToLowerCase(tmp);
|
||||
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(tmp);
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_None);
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_XHTML);
|
||||
}
|
||||
else if (mNodeInfoCache[aNodeType]) {
|
||||
nodeInfo = mNodeInfoCache[aNodeType];
|
||||
@ -561,7 +559,7 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode,
|
||||
nsIAtom *name = parserService->HTMLIdToAtomTag(aNodeType);
|
||||
NS_ASSERTION(name, "What? Reverse mapping of id to string broken!!!");
|
||||
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_None);
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_XHTML);
|
||||
NS_IF_ADDREF(mNodeInfoCache[aNodeType] = nodeInfo);
|
||||
}
|
||||
|
||||
@ -583,15 +581,7 @@ NS_NewHTMLElement(nsIContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
|
||||
nsIAtom *name = aNodeInfo->NameAtom();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (aNodeInfo->NamespaceEquals(kNameSpaceID_None)) {
|
||||
nsAutoString nameStr, lname;
|
||||
name->ToString(nameStr);
|
||||
ToLowerCase(nameStr, lname);
|
||||
NS_ASSERTION(nameStr.Equals(lname), "name should be lowercase by now");
|
||||
NS_ASSERTION(!aNodeInfo->GetPrefixAtom(), "should not have a prefix");
|
||||
}
|
||||
#endif
|
||||
NS_ASSERTION(aNodeInfo->NamespaceEquals(kNameSpaceID_XHTML), "Someone is still trying to create HTML elements is no namespace!");
|
||||
|
||||
*aResult = CreateHTMLElement(parserService->
|
||||
HTMLCaseSensitiveAtomTagToId(name),
|
||||
@ -1682,7 +1672,7 @@ HTMLContentSink::Init(nsIDocument* aDoc,
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::html, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
// Make root part
|
||||
@ -1710,7 +1700,7 @@ HTMLContentSink::Init(nsIDocument* aDoc,
|
||||
|
||||
// Make head part
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::head,
|
||||
nsnull, kNameSpaceID_None);
|
||||
nsnull, kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
mHead = NS_NewHTMLHeadElement(nodeInfo);
|
||||
@ -2903,7 +2893,7 @@ HTMLContentSink::ProcessLINKTag(const nsIParserNode& aNode)
|
||||
// Create content object
|
||||
nsCOMPtr<nsIContent> element;
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::link, nsnull, kNameSpaceID_None);
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::link, nsnull, kNameSpaceID_XHTML);
|
||||
|
||||
result = NS_NewHTMLElement(getter_AddRefs(element), nodeInfo, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
@ -2969,33 +2959,6 @@ HTMLContentSink::ProcessLINKTag(const nsIParserNode& aNode)
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Extends nsContentSink::ProcessMETATag to grab the 'viewport' meta tag. This
|
||||
* information is ignored by the generic content sink because it only stores
|
||||
* http-equiv meta tags.
|
||||
*
|
||||
* Initially implemented for bug #436083
|
||||
*/
|
||||
nsresult
|
||||
HTMLContentSink::ProcessMETATag(nsIContent *aContent) {
|
||||
|
||||
/* Call the superclass method. */
|
||||
nsContentSink::ProcessMETATag(aContent);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
/* Look for the viewport meta tag. If we find it, process it and put the
|
||||
* data into the document header. */
|
||||
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
|
||||
nsGkAtoms::viewport, eIgnoreCase)) {
|
||||
nsAutoString value;
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::content, value);
|
||||
rv = nsContentUtils::ProcessViewportInfo(mDocument, value);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
HTMLContentSink::ForceReflow()
|
||||
|
@ -142,6 +142,7 @@
|
||||
#include "nsRange.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "nsCCUncollectableMarker.h"
|
||||
#include "nsHtml5Module.h"
|
||||
#include "prprf.h"
|
||||
|
||||
#define NS_MAX_DOCUMENT_WRITE_DEPTH 20
|
||||
@ -655,6 +656,11 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
||||
PRBool aReset,
|
||||
nsIContentSink* aSink)
|
||||
{
|
||||
PRBool loadAsHtml5 = nsContentUtils::GetBoolPref("html5.enable", PR_TRUE);
|
||||
if (aSink) {
|
||||
loadAsHtml5 = PR_FALSE;
|
||||
}
|
||||
|
||||
nsCAutoString contentType;
|
||||
aChannel->GetContentType(contentType);
|
||||
|
||||
@ -664,6 +670,11 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
||||
|
||||
mIsRegularHTML = PR_FALSE;
|
||||
mCompatMode = eCompatibility_FullStandards;
|
||||
loadAsHtml5 = PR_FALSE;
|
||||
}
|
||||
|
||||
if (!(contentType.Equals("text/html") && aCommand && !nsCRT::strcmp(aCommand, "view"))) {
|
||||
loadAsHtml5 = PR_FALSE;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else {
|
||||
@ -710,8 +721,12 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
||||
}
|
||||
|
||||
if (needsParser) {
|
||||
mParser = do_CreateInstance(kCParserCID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (loadAsHtml5) {
|
||||
mParser = nsHtml5Module::NewHtml5Parser();
|
||||
} else {
|
||||
mParser = do_CreateInstance(kCParserCID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
|
||||
PRInt32 textType = GET_BIDI_OPTION_TEXTTYPE(GetBidiOptions());
|
||||
@ -926,9 +941,10 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
||||
// create the content sink
|
||||
nsCOMPtr<nsIContentSink> sink;
|
||||
|
||||
if (aSink)
|
||||
if (aSink) {
|
||||
NS_ASSERTION((!loadAsHtml5), "Panic: We are loading as HTML5 and someone tries to set an external sink!");
|
||||
sink = aSink;
|
||||
else {
|
||||
} else {
|
||||
if (IsXHTML()) {
|
||||
nsCOMPtr<nsIXMLContentSink> xmlsink;
|
||||
rv = NS_NewXMLContentSink(getter_AddRefs(xmlsink), this, uri,
|
||||
@ -936,12 +952,17 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
||||
|
||||
sink = xmlsink;
|
||||
} else {
|
||||
nsCOMPtr<nsIHTMLContentSink> htmlsink;
|
||||
if (loadAsHtml5) {
|
||||
nsHtml5Module::Initialize(mParser, this, uri, docShell, aChannel);
|
||||
sink = mParser->GetContentSink();
|
||||
} else {
|
||||
nsCOMPtr<nsIHTMLContentSink> htmlsink;
|
||||
|
||||
rv = NS_NewHTMLContentSink(getter_AddRefs(htmlsink), this, uri,
|
||||
docShell, aChannel);
|
||||
rv = NS_NewHTMLContentSink(getter_AddRefs(htmlsink), this, uri,
|
||||
docShell, aChannel);
|
||||
|
||||
sink = htmlsink;
|
||||
sink = htmlsink;
|
||||
}
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -1788,6 +1809,8 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace)
|
||||
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||
}
|
||||
|
||||
PRBool loadAsHtml5 = nsContentUtils::GetBoolPref("html5.enable", PR_TRUE);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// If we already have a parser we ignore the document.open call.
|
||||
@ -1919,6 +1942,56 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace)
|
||||
}
|
||||
}
|
||||
|
||||
if (loadAsHtml5) {
|
||||
// Really zap all children (copied from nsDocument.cpp -- maybe factor into a method)
|
||||
PRUint32 count = mChildren.ChildCount();
|
||||
{ // Scope for update
|
||||
MOZ_AUTO_DOC_UPDATE(this, UPDATE_CONTENT_MODEL, PR_TRUE);
|
||||
for (PRInt32 i = PRInt32(count) - 1; i >= 0; i--) {
|
||||
nsCOMPtr<nsIContent> content = mChildren.ChildAt(i);
|
||||
// XXXbz this is backwards from how ContentRemoved normally works. That
|
||||
// is, usually it's dispatched after the content has been removed from
|
||||
// the tree.
|
||||
nsNodeUtils::ContentRemoved(this, content, i);
|
||||
content->UnbindFromTree();
|
||||
mChildren.RemoveChildAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// XXX This is a nasty workaround for a scrollbar code bug
|
||||
// (http://bugzilla.mozilla.org/show_bug.cgi?id=55334).
|
||||
|
||||
// Hold on to our root element
|
||||
nsCOMPtr<nsIContent> root = GetRootContent();
|
||||
|
||||
if (root) {
|
||||
PRInt32 rootIndex = mChildren.IndexOfChild(root);
|
||||
NS_ASSERTION(rootIndex >= 0, "Root must be in list!");
|
||||
|
||||
PRUint32 count = root->GetChildCount();
|
||||
|
||||
// Remove all the children from the root.
|
||||
while (count-- > 0) {
|
||||
root->RemoveChildAt(count, PR_TRUE);
|
||||
}
|
||||
|
||||
count = root->GetAttrCount();
|
||||
|
||||
// Remove all attributes from the root element
|
||||
while (count-- > 0) {
|
||||
const nsAttrName* name = root->GetAttrNameAt(count);
|
||||
// Hold a strong reference here so that the atom doesn't go away during
|
||||
// UnsetAttr.
|
||||
nsCOMPtr<nsIAtom> localName = name->LocalName();
|
||||
root->UnsetAttr(name->NamespaceID(), localName, PR_FALSE);
|
||||
}
|
||||
|
||||
// Remove the root from the childlist
|
||||
mChildren.RemoveChildAt(rootIndex);
|
||||
mCachedRootContent = nsnull;
|
||||
}
|
||||
|
||||
// Call Reset(), this will now do the full reset
|
||||
Reset(channel, group);
|
||||
if (baseURI) {
|
||||
@ -1939,7 +2012,12 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace)
|
||||
// resetting the document.
|
||||
mSecurityInfo = securityInfo;
|
||||
|
||||
mParser = do_CreateInstance(kCParserCID, &rv);
|
||||
if (loadAsHtml5) {
|
||||
mParser = nsHtml5Module::NewHtml5Parser();
|
||||
rv = NS_OK;
|
||||
} else {
|
||||
mParser = do_CreateInstance(kCParserCID, &rv);
|
||||
}
|
||||
|
||||
// This will be propagated to the parser when someone actually calls write()
|
||||
mContentType = aContentType;
|
||||
@ -1947,18 +2025,22 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace)
|
||||
mWriteState = eDocumentOpened;
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIHTMLContentSink> sink;
|
||||
if (loadAsHtml5) {
|
||||
nsHtml5Module::Initialize(mParser, this, uri, shell, channel);
|
||||
} else {
|
||||
nsCOMPtr<nsIHTMLContentSink> sink;
|
||||
|
||||
rv = NS_NewHTMLContentSink(getter_AddRefs(sink), this, uri, shell,
|
||||
channel);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Don't use a parser without a content sink.
|
||||
mParser = nsnull;
|
||||
mWriteState = eNotWriting;
|
||||
return rv;
|
||||
rv = NS_NewHTMLContentSink(getter_AddRefs(sink), this, uri, shell,
|
||||
channel);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Don't use a parser without a content sink.
|
||||
mParser = nsnull;
|
||||
mWriteState = eNotWriting;
|
||||
return rv;
|
||||
}
|
||||
|
||||
mParser->SetContentSink(sink);
|
||||
}
|
||||
|
||||
mParser->SetContentSink(sink);
|
||||
}
|
||||
|
||||
// Prepare the docshell and the document viewer for the impending
|
||||
@ -2255,13 +2337,7 @@ nsHTMLDocument::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName,
|
||||
nsIDOMNodeList** aReturn)
|
||||
{
|
||||
nsAutoString tmp(aLocalName);
|
||||
|
||||
if (!IsXHTML()) {
|
||||
ToLowerCase(tmp); // HTML elements are lower case internally.
|
||||
}
|
||||
|
||||
return nsDocument::GetElementsByTagNameNS(aNamespaceURI, tmp, aReturn);
|
||||
return nsDocument::GetElementsByTagNameNS(aNamespaceURI, aLocalName, aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -4057,31 +4133,6 @@ nsHTMLDocument::QueryCommandValue(const nsAString & commandID,
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
nsresult
|
||||
nsHTMLDocument::CreateElem(nsIAtom *aName, nsIAtom *aPrefix,
|
||||
PRInt32 aNamespaceID, PRBool aDocumentDefaultType,
|
||||
nsIContent** aResult)
|
||||
{
|
||||
NS_ASSERTION(!aDocumentDefaultType || IsXHTML() ||
|
||||
aNamespaceID == kNameSpaceID_None,
|
||||
"HTML elements in an HTML document should have "
|
||||
"kNamespaceID_None as their namespace ID.");
|
||||
|
||||
if (IsXHTML() &&
|
||||
(aDocumentDefaultType || aNamespaceID == kNameSpaceID_XHTML)) {
|
||||
nsCAutoString name, lcName;
|
||||
aName->ToUTF8String(name);
|
||||
ToLowerCase(name, lcName);
|
||||
NS_ASSERTION(lcName.Equals(name),
|
||||
"aName should be lowercase, fix caller.");
|
||||
}
|
||||
|
||||
return nsDocument::CreateElem(aName, aPrefix, aNamespaceID,
|
||||
aDocumentDefaultType, aResult);
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsHTMLDocument::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
|
||||
{
|
||||
|
@ -184,13 +184,6 @@ public:
|
||||
return !mIsRegularHTML;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
virtual nsresult CreateElem(nsIAtom *aName, nsIAtom *aPrefix,
|
||||
PRInt32 aNamespaceID,
|
||||
PRBool aDocumentDefaultType,
|
||||
nsIContent** aResult);
|
||||
#endif
|
||||
|
||||
nsresult ChangeContentEditableCount(nsIContent *aElement, PRInt32 aChange);
|
||||
|
||||
virtual EditingState GetEditingState()
|
||||
@ -274,7 +267,7 @@ protected:
|
||||
|
||||
virtual PRInt32 GetDefaultNamespaceID() const
|
||||
{
|
||||
return mIsRegularHTML ? kNameSpaceID_None : kNameSpaceID_XHTML;
|
||||
return kNameSpaceID_XHTML;
|
||||
}
|
||||
|
||||
nsCOMArray<nsIDOMHTMLMapElement> mImageMaps;
|
||||
|
@ -419,7 +419,7 @@ nsHTMLFragmentContentSink::OpenContainer(const nsIParserNode& aNode)
|
||||
ToLowerCase(tmp);
|
||||
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(tmp);
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_None);
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
else if (mNodeInfoCache[nodeType]) {
|
||||
@ -433,7 +433,7 @@ nsHTMLFragmentContentSink::OpenContainer(const nsIParserNode& aNode)
|
||||
nsIAtom *name = parserService->HTMLIdToAtomTag(nodeType);
|
||||
NS_ASSERTION(name, "This should not happen!");
|
||||
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_None);
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(mNodeInfoCache[nodeType] = nodeInfo);
|
||||
@ -521,7 +521,7 @@ nsHTMLFragmentContentSink::AddLeaf(const nsIParserNode& aNode)
|
||||
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(tmp);
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
else if (mNodeInfoCache[nodeType]) {
|
||||
@ -532,7 +532,7 @@ nsHTMLFragmentContentSink::AddLeaf(const nsIParserNode& aNode)
|
||||
NS_ASSERTION(name, "This should not happen!");
|
||||
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ADDREF(mNodeInfoCache[nodeType] = nodeInfo);
|
||||
}
|
||||
@ -1011,7 +1011,7 @@ nsHTMLParanoidFragmentSink::NameFromNode(const nsIParserNode& aNode,
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
rv =
|
||||
mNodeInfoManager->GetNodeInfo(aNode.GetText(), nsnull,
|
||||
kNameSpaceID_None,
|
||||
kNameSpaceID_XHTML,
|
||||
getter_AddRefs(nodeInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_IF_ADDREF(*aResult = nodeInfo->NameAtom());
|
||||
@ -1175,7 +1175,7 @@ nsHTMLParanoidFragmentSink::AddLeaf(const nsIParserNode& aNode)
|
||||
if (!parserService)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
rv = NS_NewHTMLElement(getter_AddRefs(content), nodeInfo, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -627,7 +627,7 @@ nsImageDocument::CreateSyntheticDocument()
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::img, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
mImageContent = NS_NewHTMLImageElement(nodeInfo);
|
||||
|
@ -234,7 +234,7 @@ nsMediaDocument::CreateSyntheticDocument()
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::html, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsRefPtr<nsGenericHTMLElement> root = NS_NewHTMLHtmlElement(nodeInfo);
|
||||
@ -247,7 +247,7 @@ nsMediaDocument::CreateSyntheticDocument()
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::head, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
// Create a <head> so our title has somewhere to live
|
||||
@ -259,7 +259,7 @@ nsMediaDocument::CreateSyntheticDocument()
|
||||
root->AppendChildTo(head, PR_FALSE);
|
||||
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::body, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsRefPtr<nsGenericHTMLElement> body = NS_NewHTMLBodyElement(nodeInfo);
|
||||
|
@ -281,7 +281,7 @@ nsPluginDocument::CreateSyntheticPluginDocument()
|
||||
// make plugin content
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::embed, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
rv = NS_NewHTMLElement(getter_AddRefs(mPluginContent), nodeInfo, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -109,7 +109,7 @@ nsVideoDocument::CreateSyntheticVideoDocument(nsIChannel* aChannel,
|
||||
// make content
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::video, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
|
||||
|
||||
nsRefPtr<nsHTMLMediaElement> element =
|
||||
|
52
content/html/parser/Makefile.in
Normal file
52
content/html/parser/Makefile.in
Normal file
@ -0,0 +1,52 @@
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src
|
||||
|
||||
# ifdef ENABLE_TESTS
|
||||
# DIRS += test
|
||||
# endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
51
content/html/parser/public/Makefile.in
Normal file
51
content/html/parser/public/Makefile.in
Normal file
@ -0,0 +1,51 @@
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = html5
|
||||
|
||||
EXPORTS = \
|
||||
nsHtml5Module.h \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
56
content/html/parser/public/nsHtml5Module.h
Normal file
56
content/html/parser/public/nsHtml5Module.h
Normal file
@ -0,0 +1,56 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is HTML Parser C++ Translator code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsHtml5Module_h__
|
||||
#define nsHtml5Module_h__
|
||||
|
||||
#include "nsIParser.h"
|
||||
|
||||
class nsHtml5Module
|
||||
{
|
||||
public:
|
||||
static void InitializeStatics();
|
||||
static void ReleaseStatics();
|
||||
static already_AddRefed<nsIParser> NewHtml5Parser();
|
||||
static nsresult Initialize(nsIParser* aParser, nsIDocument* aDoc, nsIURI* aURI, nsISupports* aContainer, nsIChannel* aChannel);
|
||||
#ifdef DEBUG
|
||||
private:
|
||||
static PRBool sNsHtml5ModuleInitialized;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // nsHtml5Module_h__
|
96
content/html/parser/src/Makefile.in
Normal file
96
content/html/parser/src/Makefile.in
Normal file
@ -0,0 +1,96 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = html5
|
||||
LIBRARY_NAME = html5p
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
REQUIRES = \
|
||||
gfx \
|
||||
thebes \
|
||||
locale \
|
||||
js \
|
||||
pref \
|
||||
necko \
|
||||
xpcom \
|
||||
string \
|
||||
htmlparser \
|
||||
content \
|
||||
layout \
|
||||
widget \
|
||||
dom \
|
||||
uconv \
|
||||
xpconnect \
|
||||
util \
|
||||
webshell \
|
||||
docshell \
|
||||
chardet \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
nsHtml5Atoms.cpp \
|
||||
nsHtml5Parser.cpp \
|
||||
nsHtml5AttributeName.cpp \
|
||||
nsHtml5ElementName.cpp \
|
||||
nsHtml5HtmlAttributes.cpp \
|
||||
nsHtml5StackNode.cpp \
|
||||
nsHtml5UTF16Buffer.cpp \
|
||||
nsHtml5NamedCharacters.cpp \
|
||||
nsHtml5Tokenizer.cpp \
|
||||
nsHtml5TreeBuilder.cpp \
|
||||
nsHtml5Portability.cpp \
|
||||
nsHtml5Module.cpp \
|
||||
nsHtml5ReleasableAttributeName.cpp \
|
||||
nsHtml5ReleasableElementName.cpp \
|
||||
nsHtml5MetaScanner.cpp \
|
||||
nsHtml5TreeOperation.cpp \
|
||||
nsHtml5StateSnapshot.cpp \
|
||||
$(NULL)
|
||||
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
INCLUDES += \
|
||||
-I$(srcdir)/../../../base/src \
|
||||
$(NULL)
|
103
content/html/parser/src/jArray.h
Normal file
103
content/html/parser/src/jArray.h
Normal file
@ -0,0 +1,103 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is HTML Parser C++ Translator code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef jArray_h__
|
||||
#define jArray_h__
|
||||
|
||||
#define J_ARRAY_STATIC(T, L, arr) \
|
||||
jArray<T,L>( (arr), (sizeof(arr)/sizeof(arr[0])) )
|
||||
|
||||
template<class T, class L>
|
||||
class jArray {
|
||||
private:
|
||||
T* arr;
|
||||
public:
|
||||
L length;
|
||||
jArray(T* const a, L const len);
|
||||
jArray(L const len);
|
||||
jArray(const jArray<T,L>& other);
|
||||
jArray();
|
||||
operator T*() { return arr; }
|
||||
T& operator[] (L const index) { return arr[index]; }
|
||||
void release() { delete[] arr; }
|
||||
L binarySearch(T const elem);
|
||||
};
|
||||
|
||||
template<class T, class L>
|
||||
jArray<T,L>::jArray(T* const a, L const len)
|
||||
: arr(a), length(len)
|
||||
{
|
||||
}
|
||||
|
||||
template<class T, class L>
|
||||
jArray<T,L>::jArray(L const len)
|
||||
: arr(new T[len]), length(len)
|
||||
{
|
||||
}
|
||||
|
||||
template<class T, class L>
|
||||
jArray<T,L>::jArray(const jArray<T,L>& other)
|
||||
: arr(other.arr), length(other.length)
|
||||
{
|
||||
}
|
||||
|
||||
template<class T, class L>
|
||||
jArray<T,L>::jArray()
|
||||
: arr(0), length(0)
|
||||
{
|
||||
}
|
||||
|
||||
template<class T, class L>
|
||||
L
|
||||
jArray<T,L>::binarySearch(T const elem)
|
||||
{
|
||||
L lo = 0;
|
||||
L hi = length - 1;
|
||||
while (lo <= hi) {
|
||||
L mid = (lo + hi) / 2;
|
||||
if (arr[mid] > elem) {
|
||||
hi = mid - 1;
|
||||
} else if (arr[mid] < elem) {
|
||||
lo = mid + 1;
|
||||
} else {
|
||||
return mid;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif // jArray_h__
|
102
content/html/parser/src/nsHtml5ArrayCopy.h
Normal file
102
content/html/parser/src/nsHtml5ArrayCopy.h
Normal file
@ -0,0 +1,102 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is HTML Parser C++ Translator code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsHtml5ArrayCopy_h__
|
||||
#define nsHtml5ArrayCopy_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
|
||||
class nsString;
|
||||
class nsHtml5StackNode;
|
||||
class nsHtml5AttributeName;
|
||||
|
||||
// Unfortunately, these don't work as template functions because the arguments
|
||||
// would need coercion from a template class, which complicates things.
|
||||
|
||||
class nsHtml5ArrayCopy {
|
||||
public:
|
||||
static
|
||||
inline
|
||||
void
|
||||
arraycopy(PRUnichar* source, PRInt32 sourceOffset, PRUnichar* target, PRInt32 targetOffset, PRInt32 length)
|
||||
{
|
||||
memcpy(&(target[targetOffset]), &(source[sourceOffset]), length * sizeof(PRUnichar));
|
||||
}
|
||||
|
||||
static
|
||||
inline
|
||||
void
|
||||
arraycopy(PRUnichar* source, PRUnichar* target, PRInt32 length)
|
||||
{
|
||||
memcpy(target, source, length * sizeof(PRUnichar));
|
||||
}
|
||||
|
||||
static
|
||||
inline
|
||||
void
|
||||
arraycopy(nsString** source, nsString** target, PRInt32 length)
|
||||
{
|
||||
memcpy(target, source, length * sizeof(nsString*));
|
||||
}
|
||||
|
||||
static
|
||||
inline
|
||||
void
|
||||
arraycopy(nsHtml5AttributeName** source, nsHtml5AttributeName** target, PRInt32 length)
|
||||
{
|
||||
memcpy(target, source, length * sizeof(nsHtml5AttributeName*));
|
||||
}
|
||||
|
||||
static
|
||||
inline
|
||||
void
|
||||
arraycopy(nsHtml5StackNode** source, nsHtml5StackNode** target, PRInt32 length)
|
||||
{
|
||||
memcpy(target, source, length * sizeof(nsHtml5StackNode*));
|
||||
}
|
||||
|
||||
static
|
||||
inline
|
||||
void
|
||||
arraycopy(nsHtml5StackNode** arr, PRInt32 sourceOffset, PRInt32 targetOffset, PRInt32 length)
|
||||
{
|
||||
memmove(&(arr[targetOffset]), &(arr[sourceOffset]), length * sizeof(nsHtml5StackNode*));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // nsHtml5ArrayCopy_h__
|
1049
content/html/parser/src/nsHtml5AtomList.h
Normal file
1049
content/html/parser/src/nsHtml5AtomList.h
Normal file
File diff suppressed because it is too large
Load Diff
63
content/html/parser/src/nsHtml5Atoms.cpp
Executable file
63
content/html/parser/src/nsHtml5Atoms.cpp
Executable file
@ -0,0 +1,63 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* This class wraps up the creation (and destruction) of the standard
|
||||
* set of atoms used by the HTML5 parser; the atoms are created when
|
||||
* nsHtml5Module is loaded and they are destroyed when nsHtml5Module is
|
||||
* unloaded.
|
||||
*/
|
||||
|
||||
#include "nsHtml5Atoms.h"
|
||||
#include "nsStaticAtom.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define HTML5_ATOM(_name, _value) nsIAtom* nsHtml5Atoms::_name;
|
||||
#include "nsHtml5AtomList.h"
|
||||
#undef HTML5_ATOM
|
||||
|
||||
static const nsStaticAtom Html5Atoms_info[] = {
|
||||
#define HTML5_ATOM(name_, value_) { value_, &nsHtml5Atoms::name_ },
|
||||
#include "nsHtml5AtomList.h"
|
||||
#undef HTML5_ATOM
|
||||
};
|
||||
|
||||
void nsHtml5Atoms::AddRefAtoms()
|
||||
{
|
||||
NS_RegisterStaticAtoms(Html5Atoms_info, NS_ARRAY_LENGTH(Html5Atoms_info));
|
||||
}
|
||||
|
66
content/html/parser/src/nsHtml5Atoms.h
Executable file
66
content/html/parser/src/nsHtml5Atoms.h
Executable file
@ -0,0 +1,66 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* This class wraps up the creation (and destruction) of the standard
|
||||
* set of atoms used by gklayout; the atoms are created when gklayout
|
||||
* is loaded and they are destroyed when gklayout is unloaded.
|
||||
*/
|
||||
|
||||
#ifndef nsHtml5Atoms_h___
|
||||
#define nsHtml5Atoms_h___
|
||||
|
||||
#include "nsIAtom.h"
|
||||
|
||||
class nsHtml5Atoms {
|
||||
public:
|
||||
|
||||
static void AddRefAtoms();
|
||||
|
||||
/* Declare all atoms
|
||||
|
||||
The atom names and values are stored in nsGkAtomList.h and
|
||||
are brought to you by the magic of C preprocessing
|
||||
|
||||
Add new atoms to nsGkAtomList and all support logic will be auto-generated
|
||||
*/
|
||||
#define HTML5_ATOM(_name, _value) static nsIAtom* _name;
|
||||
#include "nsHtml5AtomList.h"
|
||||
#undef HTML5_ATOM
|
||||
};
|
||||
|
||||
#endif /* nsHtml5Atoms_h___ */
|
1980
content/html/parser/src/nsHtml5AttributeName.cpp
Normal file
1980
content/html/parser/src/nsHtml5AttributeName.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1284
content/html/parser/src/nsHtml5AttributeName.h
Normal file
1284
content/html/parser/src/nsHtml5AttributeName.h
Normal file
File diff suppressed because one or more lines are too long
66
content/html/parser/src/nsHtml5ByteReadable.h
Normal file
66
content/html/parser/src/nsHtml5ByteReadable.h
Normal file
@ -0,0 +1,66 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is HTML Parser C++ Translator code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsHtml5ByteReadable_h__
|
||||
#define nsHtml5ByteReadable_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
|
||||
/**
|
||||
* A weak reference wrapper around a byte array.
|
||||
*/
|
||||
class nsHtml5ByteReadable
|
||||
{
|
||||
public:
|
||||
nsHtml5ByteReadable(const PRUint8* current, const PRUint8* end)
|
||||
: current(current),
|
||||
end(end)
|
||||
{
|
||||
}
|
||||
inline PRInt32 read() {
|
||||
if (current < end) {
|
||||
return *(current++);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
private:
|
||||
const PRUint8* current;
|
||||
const PRUint8* end;
|
||||
};
|
||||
|
||||
#endif
|
47
content/html/parser/src/nsHtml5DocumentMode.h
Normal file
47
content/html/parser/src/nsHtml5DocumentMode.h
Normal file
@ -0,0 +1,47 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is HTML Parser C++ Translator code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsHtml5DocumentMode_h__
|
||||
#define nsHtml5DocumentMode_h__
|
||||
|
||||
enum nsHtml5DocumentMode {
|
||||
STANDARDS_MODE,
|
||||
ALMOST_STANDARDS_MODE,
|
||||
QUIRKS_MODE
|
||||
};
|
||||
|
||||
#endif // nsHtml5DocumentMode_h__
|
1313
content/html/parser/src/nsHtml5ElementName.cpp
Normal file
1313
content/html/parser/src/nsHtml5ElementName.cpp
Normal file
File diff suppressed because it is too large
Load Diff
880
content/html/parser/src/nsHtml5ElementName.h
Normal file
880
content/html/parser/src/nsHtml5ElementName.h
Normal file
@ -0,0 +1,880 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Mozilla Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Please edit ElementName.java instead and regenerate.
|
||||
*/
|
||||
|
||||
#ifndef nsHtml5ElementName_h__
|
||||
#define nsHtml5ElementName_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsString.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "jArray.h"
|
||||
#include "nsHtml5DocumentMode.h"
|
||||
#include "nsHtml5ArrayCopy.h"
|
||||
#include "nsHtml5NamedCharacters.h"
|
||||
#include "nsHtml5Parser.h"
|
||||
#include "nsHtml5Atoms.h"
|
||||
#include "nsHtml5ByteReadable.h"
|
||||
|
||||
class nsHtml5Parser;
|
||||
|
||||
class nsHtml5Tokenizer;
|
||||
class nsHtml5TreeBuilder;
|
||||
class nsHtml5MetaScanner;
|
||||
class nsHtml5AttributeName;
|
||||
class nsHtml5HtmlAttributes;
|
||||
class nsHtml5UTF16Buffer;
|
||||
class nsHtml5StateSnapshot;
|
||||
class nsHtml5Portability;
|
||||
|
||||
|
||||
class nsHtml5ElementName
|
||||
{
|
||||
public:
|
||||
static nsHtml5ElementName* NULL_ELEMENT_NAME;
|
||||
nsIAtom* name;
|
||||
nsIAtom* camelCaseName;
|
||||
PRInt32 group;
|
||||
PRBool special;
|
||||
PRBool scoping;
|
||||
PRBool fosterParenting;
|
||||
static nsHtml5ElementName* elementNameByBuffer(jArray<PRUnichar,PRInt32> buf, PRInt32 offset, PRInt32 length);
|
||||
private:
|
||||
static PRInt32 bufToHash(jArray<PRUnichar,PRInt32> buf, PRInt32 len);
|
||||
nsHtml5ElementName(nsIAtom* name, nsIAtom* camelCaseName, PRInt32 group, PRBool special, PRBool scoping, PRBool fosterParenting);
|
||||
protected:
|
||||
nsHtml5ElementName(nsIAtom* name);
|
||||
public:
|
||||
virtual void release();
|
||||
~nsHtml5ElementName();
|
||||
static nsHtml5ElementName* A;
|
||||
static nsHtml5ElementName* B;
|
||||
static nsHtml5ElementName* G;
|
||||
static nsHtml5ElementName* I;
|
||||
static nsHtml5ElementName* P;
|
||||
static nsHtml5ElementName* Q;
|
||||
static nsHtml5ElementName* S;
|
||||
static nsHtml5ElementName* U;
|
||||
static nsHtml5ElementName* BR;
|
||||
static nsHtml5ElementName* CI;
|
||||
static nsHtml5ElementName* CN;
|
||||
static nsHtml5ElementName* DD;
|
||||
static nsHtml5ElementName* DL;
|
||||
static nsHtml5ElementName* DT;
|
||||
static nsHtml5ElementName* EM;
|
||||
static nsHtml5ElementName* EQ;
|
||||
static nsHtml5ElementName* FN;
|
||||
static nsHtml5ElementName* H1;
|
||||
static nsHtml5ElementName* H2;
|
||||
static nsHtml5ElementName* H3;
|
||||
static nsHtml5ElementName* H4;
|
||||
static nsHtml5ElementName* H5;
|
||||
static nsHtml5ElementName* H6;
|
||||
static nsHtml5ElementName* GT;
|
||||
static nsHtml5ElementName* HR;
|
||||
static nsHtml5ElementName* IN;
|
||||
static nsHtml5ElementName* LI;
|
||||
static nsHtml5ElementName* LN;
|
||||
static nsHtml5ElementName* LT;
|
||||
static nsHtml5ElementName* MI;
|
||||
static nsHtml5ElementName* MN;
|
||||
static nsHtml5ElementName* MO;
|
||||
static nsHtml5ElementName* MS;
|
||||
static nsHtml5ElementName* OL;
|
||||
static nsHtml5ElementName* OR;
|
||||
static nsHtml5ElementName* PI;
|
||||
static nsHtml5ElementName* RP;
|
||||
static nsHtml5ElementName* RT;
|
||||
static nsHtml5ElementName* TD;
|
||||
static nsHtml5ElementName* TH;
|
||||
static nsHtml5ElementName* TR;
|
||||
static nsHtml5ElementName* TT;
|
||||
static nsHtml5ElementName* UL;
|
||||
static nsHtml5ElementName* AND;
|
||||
static nsHtml5ElementName* ARG;
|
||||
static nsHtml5ElementName* ABS;
|
||||
static nsHtml5ElementName* BIG;
|
||||
static nsHtml5ElementName* BDO;
|
||||
static nsHtml5ElementName* CSC;
|
||||
static nsHtml5ElementName* COL;
|
||||
static nsHtml5ElementName* COS;
|
||||
static nsHtml5ElementName* COT;
|
||||
static nsHtml5ElementName* DEL;
|
||||
static nsHtml5ElementName* DFN;
|
||||
static nsHtml5ElementName* DIR;
|
||||
static nsHtml5ElementName* DIV;
|
||||
static nsHtml5ElementName* EXP;
|
||||
static nsHtml5ElementName* GCD;
|
||||
static nsHtml5ElementName* GEQ;
|
||||
static nsHtml5ElementName* IMG;
|
||||
static nsHtml5ElementName* INS;
|
||||
static nsHtml5ElementName* INT;
|
||||
static nsHtml5ElementName* KBD;
|
||||
static nsHtml5ElementName* LOG;
|
||||
static nsHtml5ElementName* LCM;
|
||||
static nsHtml5ElementName* LEQ;
|
||||
static nsHtml5ElementName* MTD;
|
||||
static nsHtml5ElementName* MIN;
|
||||
static nsHtml5ElementName* MAP;
|
||||
static nsHtml5ElementName* MTR;
|
||||
static nsHtml5ElementName* MAX;
|
||||
static nsHtml5ElementName* NEQ;
|
||||
static nsHtml5ElementName* NOT;
|
||||
static nsHtml5ElementName* NAV;
|
||||
static nsHtml5ElementName* PRE;
|
||||
static nsHtml5ElementName* REM;
|
||||
static nsHtml5ElementName* SUB;
|
||||
static nsHtml5ElementName* SEC;
|
||||
static nsHtml5ElementName* SVG;
|
||||
static nsHtml5ElementName* SUM;
|
||||
static nsHtml5ElementName* SIN;
|
||||
static nsHtml5ElementName* SEP;
|
||||
static nsHtml5ElementName* SUP;
|
||||
static nsHtml5ElementName* SET;
|
||||
static nsHtml5ElementName* TAN;
|
||||
static nsHtml5ElementName* USE;
|
||||
static nsHtml5ElementName* VAR;
|
||||
static nsHtml5ElementName* WBR;
|
||||
static nsHtml5ElementName* XMP;
|
||||
static nsHtml5ElementName* XOR;
|
||||
static nsHtml5ElementName* AREA;
|
||||
static nsHtml5ElementName* ABBR;
|
||||
static nsHtml5ElementName* BASE;
|
||||
static nsHtml5ElementName* BVAR;
|
||||
static nsHtml5ElementName* BODY;
|
||||
static nsHtml5ElementName* CARD;
|
||||
static nsHtml5ElementName* CODE;
|
||||
static nsHtml5ElementName* CITE;
|
||||
static nsHtml5ElementName* CSCH;
|
||||
static nsHtml5ElementName* COSH;
|
||||
static nsHtml5ElementName* COTH;
|
||||
static nsHtml5ElementName* CURL;
|
||||
static nsHtml5ElementName* DESC;
|
||||
static nsHtml5ElementName* DIFF;
|
||||
static nsHtml5ElementName* DEFS;
|
||||
static nsHtml5ElementName* FORM;
|
||||
static nsHtml5ElementName* FONT;
|
||||
static nsHtml5ElementName* GRAD;
|
||||
static nsHtml5ElementName* HEAD;
|
||||
static nsHtml5ElementName* HTML;
|
||||
static nsHtml5ElementName* LINE;
|
||||
static nsHtml5ElementName* LINK;
|
||||
static nsHtml5ElementName* LIST;
|
||||
static nsHtml5ElementName* META;
|
||||
static nsHtml5ElementName* MSUB;
|
||||
static nsHtml5ElementName* MODE;
|
||||
static nsHtml5ElementName* MATH;
|
||||
static nsHtml5ElementName* MARK;
|
||||
static nsHtml5ElementName* MASK;
|
||||
static nsHtml5ElementName* MEAN;
|
||||
static nsHtml5ElementName* MSUP;
|
||||
static nsHtml5ElementName* MENU;
|
||||
static nsHtml5ElementName* MROW;
|
||||
static nsHtml5ElementName* NONE;
|
||||
static nsHtml5ElementName* NOBR;
|
||||
static nsHtml5ElementName* NEST;
|
||||
static nsHtml5ElementName* PATH;
|
||||
static nsHtml5ElementName* PLUS;
|
||||
static nsHtml5ElementName* RULE;
|
||||
static nsHtml5ElementName* REAL;
|
||||
static nsHtml5ElementName* RELN;
|
||||
static nsHtml5ElementName* RECT;
|
||||
static nsHtml5ElementName* ROOT;
|
||||
static nsHtml5ElementName* RUBY;
|
||||
static nsHtml5ElementName* SECH;
|
||||
static nsHtml5ElementName* SINH;
|
||||
static nsHtml5ElementName* SPAN;
|
||||
static nsHtml5ElementName* SAMP;
|
||||
static nsHtml5ElementName* STOP;
|
||||
static nsHtml5ElementName* SDEV;
|
||||
static nsHtml5ElementName* TIME;
|
||||
static nsHtml5ElementName* TRUE;
|
||||
static nsHtml5ElementName* TREF;
|
||||
static nsHtml5ElementName* TANH;
|
||||
static nsHtml5ElementName* TEXT;
|
||||
static nsHtml5ElementName* VIEW;
|
||||
static nsHtml5ElementName* ASIDE;
|
||||
static nsHtml5ElementName* AUDIO;
|
||||
static nsHtml5ElementName* APPLY;
|
||||
static nsHtml5ElementName* EMBED;
|
||||
static nsHtml5ElementName* FRAME;
|
||||
static nsHtml5ElementName* FALSE;
|
||||
static nsHtml5ElementName* FLOOR;
|
||||
static nsHtml5ElementName* GLYPH;
|
||||
static nsHtml5ElementName* HKERN;
|
||||
static nsHtml5ElementName* IMAGE;
|
||||
static nsHtml5ElementName* IDENT;
|
||||
static nsHtml5ElementName* INPUT;
|
||||
static nsHtml5ElementName* LABEL;
|
||||
static nsHtml5ElementName* LIMIT;
|
||||
static nsHtml5ElementName* MFRAC;
|
||||
static nsHtml5ElementName* MPATH;
|
||||
static nsHtml5ElementName* METER;
|
||||
static nsHtml5ElementName* MOVER;
|
||||
static nsHtml5ElementName* MINUS;
|
||||
static nsHtml5ElementName* MROOT;
|
||||
static nsHtml5ElementName* MSQRT;
|
||||
static nsHtml5ElementName* MTEXT;
|
||||
static nsHtml5ElementName* NOTIN;
|
||||
static nsHtml5ElementName* PIECE;
|
||||
static nsHtml5ElementName* PARAM;
|
||||
static nsHtml5ElementName* POWER;
|
||||
static nsHtml5ElementName* REALS;
|
||||
static nsHtml5ElementName* STYLE;
|
||||
static nsHtml5ElementName* SMALL;
|
||||
static nsHtml5ElementName* THEAD;
|
||||
static nsHtml5ElementName* TABLE;
|
||||
static nsHtml5ElementName* TITLE;
|
||||
static nsHtml5ElementName* TSPAN;
|
||||
static nsHtml5ElementName* TIMES;
|
||||
static nsHtml5ElementName* TFOOT;
|
||||
static nsHtml5ElementName* TBODY;
|
||||
static nsHtml5ElementName* UNION;
|
||||
static nsHtml5ElementName* VKERN;
|
||||
static nsHtml5ElementName* VIDEO;
|
||||
static nsHtml5ElementName* ARCSEC;
|
||||
static nsHtml5ElementName* ARCCSC;
|
||||
static nsHtml5ElementName* ARCTAN;
|
||||
static nsHtml5ElementName* ARCSIN;
|
||||
static nsHtml5ElementName* ARCCOS;
|
||||
static nsHtml5ElementName* APPLET;
|
||||
static nsHtml5ElementName* ARCCOT;
|
||||
static nsHtml5ElementName* APPROX;
|
||||
static nsHtml5ElementName* BUTTON;
|
||||
static nsHtml5ElementName* CIRCLE;
|
||||
static nsHtml5ElementName* CENTER;
|
||||
static nsHtml5ElementName* CURSOR;
|
||||
static nsHtml5ElementName* CANVAS;
|
||||
static nsHtml5ElementName* DIVIDE;
|
||||
static nsHtml5ElementName* DEGREE;
|
||||
static nsHtml5ElementName* DIALOG;
|
||||
static nsHtml5ElementName* DOMAIN;
|
||||
static nsHtml5ElementName* EXISTS;
|
||||
static nsHtml5ElementName* FETILE;
|
||||
static nsHtml5ElementName* FIGURE;
|
||||
static nsHtml5ElementName* FORALL;
|
||||
static nsHtml5ElementName* FILTER;
|
||||
static nsHtml5ElementName* FOOTER;
|
||||
static nsHtml5ElementName* HEADER;
|
||||
static nsHtml5ElementName* IFRAME;
|
||||
static nsHtml5ElementName* KEYGEN;
|
||||
static nsHtml5ElementName* LAMBDA;
|
||||
static nsHtml5ElementName* LEGEND;
|
||||
static nsHtml5ElementName* MSPACE;
|
||||
static nsHtml5ElementName* MTABLE;
|
||||
static nsHtml5ElementName* MSTYLE;
|
||||
static nsHtml5ElementName* MGLYPH;
|
||||
static nsHtml5ElementName* MEDIAN;
|
||||
static nsHtml5ElementName* MUNDER;
|
||||
static nsHtml5ElementName* MARKER;
|
||||
static nsHtml5ElementName* MERROR;
|
||||
static nsHtml5ElementName* MOMENT;
|
||||
static nsHtml5ElementName* MATRIX;
|
||||
static nsHtml5ElementName* OPTION;
|
||||
static nsHtml5ElementName* OBJECT;
|
||||
static nsHtml5ElementName* OUTPUT;
|
||||
static nsHtml5ElementName* PRIMES;
|
||||
static nsHtml5ElementName* SOURCE;
|
||||
static nsHtml5ElementName* STRIKE;
|
||||
static nsHtml5ElementName* STRONG;
|
||||
static nsHtml5ElementName* SWITCH;
|
||||
static nsHtml5ElementName* SYMBOL;
|
||||
static nsHtml5ElementName* SPACER;
|
||||
static nsHtml5ElementName* SELECT;
|
||||
static nsHtml5ElementName* SUBSET;
|
||||
static nsHtml5ElementName* SCRIPT;
|
||||
static nsHtml5ElementName* TBREAK;
|
||||
static nsHtml5ElementName* VECTOR;
|
||||
static nsHtml5ElementName* ARTICLE;
|
||||
static nsHtml5ElementName* ANIMATE;
|
||||
static nsHtml5ElementName* ARCSECH;
|
||||
static nsHtml5ElementName* ARCCSCH;
|
||||
static nsHtml5ElementName* ARCTANH;
|
||||
static nsHtml5ElementName* ARCSINH;
|
||||
static nsHtml5ElementName* ARCCOSH;
|
||||
static nsHtml5ElementName* ARCCOTH;
|
||||
static nsHtml5ElementName* ACRONYM;
|
||||
static nsHtml5ElementName* ADDRESS;
|
||||
static nsHtml5ElementName* BGSOUND;
|
||||
static nsHtml5ElementName* COMMAND;
|
||||
static nsHtml5ElementName* COMPOSE;
|
||||
static nsHtml5ElementName* CEILING;
|
||||
static nsHtml5ElementName* CSYMBOL;
|
||||
static nsHtml5ElementName* CAPTION;
|
||||
static nsHtml5ElementName* DISCARD;
|
||||
static nsHtml5ElementName* DECLARE;
|
||||
static nsHtml5ElementName* DETAILS;
|
||||
static nsHtml5ElementName* ELLIPSE;
|
||||
static nsHtml5ElementName* FEFUNCA;
|
||||
static nsHtml5ElementName* FEFUNCB;
|
||||
static nsHtml5ElementName* FEBLEND;
|
||||
static nsHtml5ElementName* FEFLOOD;
|
||||
static nsHtml5ElementName* FEIMAGE;
|
||||
static nsHtml5ElementName* FEMERGE;
|
||||
static nsHtml5ElementName* FEFUNCG;
|
||||
static nsHtml5ElementName* FEFUNCR;
|
||||
static nsHtml5ElementName* HANDLER;
|
||||
static nsHtml5ElementName* INVERSE;
|
||||
static nsHtml5ElementName* IMPLIES;
|
||||
static nsHtml5ElementName* ISINDEX;
|
||||
static nsHtml5ElementName* LOGBASE;
|
||||
static nsHtml5ElementName* LISTING;
|
||||
static nsHtml5ElementName* MFENCED;
|
||||
static nsHtml5ElementName* MPADDED;
|
||||
static nsHtml5ElementName* MARQUEE;
|
||||
static nsHtml5ElementName* MACTION;
|
||||
static nsHtml5ElementName* MSUBSUP;
|
||||
static nsHtml5ElementName* NOEMBED;
|
||||
static nsHtml5ElementName* POLYGON;
|
||||
static nsHtml5ElementName* PATTERN;
|
||||
static nsHtml5ElementName* PRODUCT;
|
||||
static nsHtml5ElementName* SETDIFF;
|
||||
static nsHtml5ElementName* SECTION;
|
||||
static nsHtml5ElementName* TENDSTO;
|
||||
static nsHtml5ElementName* UPLIMIT;
|
||||
static nsHtml5ElementName* ALTGLYPH;
|
||||
static nsHtml5ElementName* BASEFONT;
|
||||
static nsHtml5ElementName* CLIPPATH;
|
||||
static nsHtml5ElementName* CODOMAIN;
|
||||
static nsHtml5ElementName* COLGROUP;
|
||||
static nsHtml5ElementName* DATAGRID;
|
||||
static nsHtml5ElementName* EMPTYSET;
|
||||
static nsHtml5ElementName* FACTOROF;
|
||||
static nsHtml5ElementName* FIELDSET;
|
||||
static nsHtml5ElementName* FRAMESET;
|
||||
static nsHtml5ElementName* FEOFFSET;
|
||||
static nsHtml5ElementName* GLYPHREF;
|
||||
static nsHtml5ElementName* INTERVAL;
|
||||
static nsHtml5ElementName* INTEGERS;
|
||||
static nsHtml5ElementName* INFINITY;
|
||||
static nsHtml5ElementName* LISTENER;
|
||||
static nsHtml5ElementName* LOWLIMIT;
|
||||
static nsHtml5ElementName* METADATA;
|
||||
static nsHtml5ElementName* MENCLOSE;
|
||||
static nsHtml5ElementName* MPHANTOM;
|
||||
static nsHtml5ElementName* NOFRAMES;
|
||||
static nsHtml5ElementName* NOSCRIPT;
|
||||
static nsHtml5ElementName* OPTGROUP;
|
||||
static nsHtml5ElementName* POLYLINE;
|
||||
static nsHtml5ElementName* PREFETCH;
|
||||
static nsHtml5ElementName* PROGRESS;
|
||||
static nsHtml5ElementName* PRSUBSET;
|
||||
static nsHtml5ElementName* QUOTIENT;
|
||||
static nsHtml5ElementName* SELECTOR;
|
||||
static nsHtml5ElementName* TEXTAREA;
|
||||
static nsHtml5ElementName* TEXTPATH;
|
||||
static nsHtml5ElementName* VARIANCE;
|
||||
static nsHtml5ElementName* ANIMATION;
|
||||
static nsHtml5ElementName* CONJUGATE;
|
||||
static nsHtml5ElementName* CONDITION;
|
||||
static nsHtml5ElementName* COMPLEXES;
|
||||
static nsHtml5ElementName* FONT_FACE;
|
||||
static nsHtml5ElementName* FACTORIAL;
|
||||
static nsHtml5ElementName* INTERSECT;
|
||||
static nsHtml5ElementName* IMAGINARY;
|
||||
static nsHtml5ElementName* LAPLACIAN;
|
||||
static nsHtml5ElementName* MATRIXROW;
|
||||
static nsHtml5ElementName* NOTSUBSET;
|
||||
static nsHtml5ElementName* OTHERWISE;
|
||||
static nsHtml5ElementName* PIECEWISE;
|
||||
static nsHtml5ElementName* PLAINTEXT;
|
||||
static nsHtml5ElementName* RATIONALS;
|
||||
static nsHtml5ElementName* SEMANTICS;
|
||||
static nsHtml5ElementName* TRANSPOSE;
|
||||
static nsHtml5ElementName* ANNOTATION;
|
||||
static nsHtml5ElementName* BLOCKQUOTE;
|
||||
static nsHtml5ElementName* DIVERGENCE;
|
||||
static nsHtml5ElementName* EULERGAMMA;
|
||||
static nsHtml5ElementName* EQUIVALENT;
|
||||
static nsHtml5ElementName* IMAGINARYI;
|
||||
static nsHtml5ElementName* MALIGNMARK;
|
||||
static nsHtml5ElementName* MUNDEROVER;
|
||||
static nsHtml5ElementName* MLABELEDTR;
|
||||
static nsHtml5ElementName* NOTANUMBER;
|
||||
static nsHtml5ElementName* SOLIDCOLOR;
|
||||
static nsHtml5ElementName* ALTGLYPHDEF;
|
||||
static nsHtml5ElementName* DETERMINANT;
|
||||
static nsHtml5ElementName* EVENTSOURCE;
|
||||
static nsHtml5ElementName* FEMERGENODE;
|
||||
static nsHtml5ElementName* FECOMPOSITE;
|
||||
static nsHtml5ElementName* FESPOTLIGHT;
|
||||
static nsHtml5ElementName* MALIGNGROUP;
|
||||
static nsHtml5ElementName* MPRESCRIPTS;
|
||||
static nsHtml5ElementName* MOMENTABOUT;
|
||||
static nsHtml5ElementName* NOTPRSUBSET;
|
||||
static nsHtml5ElementName* PARTIALDIFF;
|
||||
static nsHtml5ElementName* ALTGLYPHITEM;
|
||||
static nsHtml5ElementName* ANIMATECOLOR;
|
||||
static nsHtml5ElementName* DATATEMPLATE;
|
||||
static nsHtml5ElementName* EXPONENTIALE;
|
||||
static nsHtml5ElementName* FETURBULENCE;
|
||||
static nsHtml5ElementName* FEPOINTLIGHT;
|
||||
static nsHtml5ElementName* FEMORPHOLOGY;
|
||||
static nsHtml5ElementName* OUTERPRODUCT;
|
||||
static nsHtml5ElementName* ANIMATEMOTION;
|
||||
static nsHtml5ElementName* COLOR_PROFILE;
|
||||
static nsHtml5ElementName* FONT_FACE_SRC;
|
||||
static nsHtml5ElementName* FONT_FACE_URI;
|
||||
static nsHtml5ElementName* FOREIGNOBJECT;
|
||||
static nsHtml5ElementName* FECOLORMATRIX;
|
||||
static nsHtml5ElementName* MISSING_GLYPH;
|
||||
static nsHtml5ElementName* MMULTISCRIPTS;
|
||||
static nsHtml5ElementName* SCALARPRODUCT;
|
||||
static nsHtml5ElementName* VECTORPRODUCT;
|
||||
static nsHtml5ElementName* ANNOTATION_XML;
|
||||
static nsHtml5ElementName* DEFINITION_SRC;
|
||||
static nsHtml5ElementName* FONT_FACE_NAME;
|
||||
static nsHtml5ElementName* FEGAUSSIANBLUR;
|
||||
static nsHtml5ElementName* FEDISTANTLIGHT;
|
||||
static nsHtml5ElementName* LINEARGRADIENT;
|
||||
static nsHtml5ElementName* NATURALNUMBERS;
|
||||
static nsHtml5ElementName* RADIALGRADIENT;
|
||||
static nsHtml5ElementName* ANIMATETRANSFORM;
|
||||
static nsHtml5ElementName* CARTESIANPRODUCT;
|
||||
static nsHtml5ElementName* FONT_FACE_FORMAT;
|
||||
static nsHtml5ElementName* FECONVOLVEMATRIX;
|
||||
static nsHtml5ElementName* FEDIFFUSELIGHTING;
|
||||
static nsHtml5ElementName* FEDISPLACEMENTMAP;
|
||||
static nsHtml5ElementName* FESPECULARLIGHTING;
|
||||
static nsHtml5ElementName* DOMAINOFAPPLICATION;
|
||||
static nsHtml5ElementName* FECOMPONENTTRANSFER;
|
||||
private:
|
||||
static nsHtml5ElementName** ELEMENT_NAMES;
|
||||
#ifdef nsHtml5ElementName_cpp__
|
||||
static PRInt32 ELEMENT_HASHES_DATA[];
|
||||
#endif
|
||||
static jArray<PRInt32,PRInt32> ELEMENT_HASHES;
|
||||
public:
|
||||
static void initializeStatics();
|
||||
static void releaseStatics();
|
||||
};
|
||||
|
||||
#ifdef nsHtml5ElementName_cpp__
|
||||
nsHtml5ElementName* nsHtml5ElementName::NULL_ELEMENT_NAME = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::A = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::B = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::G = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::I = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::P = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::Q = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::S = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::U = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::BR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::CI = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::CN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DD = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DL = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::EM = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::EQ = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::H1 = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::H2 = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::H3 = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::H4 = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::H5 = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::H6 = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::GT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::HR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::IN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::LI = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::LN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::LT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MI = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MO = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MS = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::OL = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::OR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::PI = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::RP = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::RT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TD = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::UL = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::AND = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ARG = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ABS = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::BIG = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::BDO = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::CSC = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::COL = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::COS = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::COT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DEL = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DFN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DIR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DIV = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::EXP = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::GCD = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::GEQ = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::IMG = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::INS = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::INT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::KBD = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::LOG = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::LCM = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::LEQ = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MTD = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MIN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MAP = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MTR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MAX = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::NEQ = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::NOT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::NAV = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::PRE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::REM = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SUB = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SEC = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SVG = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SUM = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SIN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SEP = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SUP = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SET = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TAN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::USE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::VAR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::WBR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::XMP = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::XOR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::AREA = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ABBR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::BASE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::BVAR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::BODY = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::CARD = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::CODE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::CITE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::CSCH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::COSH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::COTH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::CURL = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DESC = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DIFF = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DEFS = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FORM = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FONT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::GRAD = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::HEAD = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::HTML = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::LINE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::LINK = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::LIST = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::META = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MSUB = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MODE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MATH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MARK = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MASK = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MEAN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MSUP = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MENU = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MROW = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::NONE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::NOBR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::NEST = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::PATH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::PLUS = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::RULE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::REAL = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::RELN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::RECT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ROOT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::RUBY = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SECH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SINH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SPAN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SAMP = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::STOP = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SDEV = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TIME = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TRUE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TREF = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TANH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TEXT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::VIEW = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ASIDE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::AUDIO = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::APPLY = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::EMBED = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FRAME = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FALSE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FLOOR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::GLYPH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::HKERN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::IMAGE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::IDENT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::INPUT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::LABEL = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::LIMIT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MFRAC = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MPATH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::METER = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MOVER = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MINUS = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MROOT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MSQRT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MTEXT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::NOTIN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::PIECE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::PARAM = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::POWER = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::REALS = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::STYLE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SMALL = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::THEAD = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TABLE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TITLE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TSPAN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TIMES = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TFOOT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TBODY = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::UNION = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::VKERN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::VIDEO = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ARCSEC = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ARCCSC = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ARCTAN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ARCSIN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ARCCOS = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::APPLET = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ARCCOT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::APPROX = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::BUTTON = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::CIRCLE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::CENTER = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::CURSOR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::CANVAS = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DIVIDE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DEGREE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DIALOG = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DOMAIN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::EXISTS = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FETILE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FIGURE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FORALL = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FILTER = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FOOTER = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::HEADER = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::IFRAME = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::KEYGEN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::LAMBDA = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::LEGEND = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MSPACE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MTABLE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MSTYLE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MGLYPH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MEDIAN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MUNDER = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MARKER = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MERROR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MOMENT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MATRIX = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::OPTION = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::OBJECT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::OUTPUT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::PRIMES = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SOURCE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::STRIKE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::STRONG = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SWITCH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SYMBOL = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SPACER = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SELECT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SUBSET = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SCRIPT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TBREAK = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::VECTOR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ARTICLE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ANIMATE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ARCSECH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ARCCSCH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ARCTANH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ARCSINH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ARCCOSH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ARCCOTH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ACRONYM = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ADDRESS = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::BGSOUND = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::COMMAND = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::COMPOSE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::CEILING = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::CSYMBOL = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::CAPTION = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DISCARD = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DECLARE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DETAILS = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ELLIPSE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FEFUNCA = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FEFUNCB = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FEBLEND = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FEFLOOD = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FEIMAGE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FEMERGE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FEFUNCG = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FEFUNCR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::HANDLER = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::INVERSE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::IMPLIES = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ISINDEX = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::LOGBASE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::LISTING = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MFENCED = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MPADDED = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MARQUEE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MACTION = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MSUBSUP = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::NOEMBED = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::POLYGON = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::PATTERN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::PRODUCT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SETDIFF = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SECTION = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TENDSTO = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::UPLIMIT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ALTGLYPH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::BASEFONT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::CLIPPATH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::CODOMAIN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::COLGROUP = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DATAGRID = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::EMPTYSET = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FACTOROF = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FIELDSET = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FRAMESET = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FEOFFSET = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::GLYPHREF = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::INTERVAL = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::INTEGERS = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::INFINITY = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::LISTENER = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::LOWLIMIT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::METADATA = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MENCLOSE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MPHANTOM = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::NOFRAMES = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::NOSCRIPT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::OPTGROUP = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::POLYLINE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::PREFETCH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::PROGRESS = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::PRSUBSET = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::QUOTIENT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SELECTOR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TEXTAREA = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TEXTPATH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::VARIANCE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ANIMATION = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::CONJUGATE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::CONDITION = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::COMPLEXES = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FONT_FACE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FACTORIAL = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::INTERSECT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::IMAGINARY = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::LAPLACIAN = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MATRIXROW = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::NOTSUBSET = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::OTHERWISE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::PIECEWISE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::PLAINTEXT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::RATIONALS = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SEMANTICS = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::TRANSPOSE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ANNOTATION = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::BLOCKQUOTE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DIVERGENCE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::EULERGAMMA = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::EQUIVALENT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::IMAGINARYI = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MALIGNMARK = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MUNDEROVER = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MLABELEDTR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::NOTANUMBER = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SOLIDCOLOR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ALTGLYPHDEF = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DETERMINANT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::EVENTSOURCE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FEMERGENODE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FECOMPOSITE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FESPOTLIGHT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MALIGNGROUP = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MPRESCRIPTS = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MOMENTABOUT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::NOTPRSUBSET = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::PARTIALDIFF = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ALTGLYPHITEM = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ANIMATECOLOR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DATATEMPLATE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::EXPONENTIALE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FETURBULENCE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FEPOINTLIGHT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FEMORPHOLOGY = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::OUTERPRODUCT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ANIMATEMOTION = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::COLOR_PROFILE = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FONT_FACE_SRC = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FONT_FACE_URI = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FOREIGNOBJECT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FECOLORMATRIX = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MISSING_GLYPH = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::MMULTISCRIPTS = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::SCALARPRODUCT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::VECTORPRODUCT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ANNOTATION_XML = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DEFINITION_SRC = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FONT_FACE_NAME = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FEGAUSSIANBLUR = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FEDISTANTLIGHT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::LINEARGRADIENT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::NATURALNUMBERS = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::RADIALGRADIENT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::ANIMATETRANSFORM = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::CARTESIANPRODUCT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FONT_FACE_FORMAT = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FECONVOLVEMATRIX = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FEDIFFUSELIGHTING = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FEDISPLACEMENTMAP = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FESPECULARLIGHTING = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::DOMAINOFAPPLICATION = nsnull;
|
||||
nsHtml5ElementName* nsHtml5ElementName::FECOMPONENTTRANSFER = nsnull;
|
||||
nsHtml5ElementName** nsHtml5ElementName::ELEMENT_NAMES = nsnull;
|
||||
PRInt32 nsHtml5ElementName::ELEMENT_HASHES_DATA[] = { 1057, 1090, 1255, 1321, 1552, 1585, 1651, 1717, 68162, 68899, 69059, 69764, 70020, 70276, 71077, 71205, 72134, 72232, 72264, 72296, 72328, 72360, 72392, 73351, 74312, 75209, 78124, 78284, 78476, 79149, 79309, 79341, 79469, 81295, 81487, 82224, 84498, 84626, 86164, 86292, 86612, 86676, 87445, 3183041, 3186241, 3198017, 3218722, 3226754, 3247715, 3256803, 3263971, 3264995, 3289252, 3291332, 3295524, 3299620, 3326725, 3379303, 3392679, 3448233, 3460553, 3461577, 3510347, 3546604, 3552364, 3556524, 3576461, 3586349, 3588141, 3590797, 3596333, 3622062, 3625454, 3627054, 3675728, 3749042, 3771059, 3771571, 3776211, 3782323, 3782963, 3784883, 3785395, 3788979, 3815476, 3839605, 3885110, 3917911, 3948984, 3951096, 135304769, 135858241, 136498210, 136906434, 137138658, 137512995, 137531875, 137548067, 137629283, 137645539, 137646563, 137775779, 138529956, 138615076, 139040932, 140954086, 141179366, 141690439, 142738600, 143013512, 146979116, 147175724, 147475756, 147902637, 147936877, 148017645, 148131885, 148228141, 148229165, 148309165, 148395629, 148551853, 148618829, 149076462, 149490158, 149572782, 151277616, 151639440, 153268914, 153486514, 153563314, 153750706, 153763314, 153914034, 154406067, 154417459, 154600979, 154678323, 154680979, 154866835, 155366708, 155375188, 155391572, 155465780, 155869364, 158045494, 168988979, 169321621, 169652752, 173151309, 174240818, 174247297, 174669292, 175391532, 176638123, 177380397, 177879204, 177886734, 180753473, 181020073, 181503558, 181686320, 181999237, 181999311, 182048201, 182074866, 182078003, 182083764, 182920847, 184716457, 184976961, 185145071, 187281445, 187872052, 188100653, 188875944, 188919873, 188920457, 189203987, 189371817, 189414886, 189567458, 190266670, 191318187, 191337609, 202479203, 202493027, 202835587, 202843747, 203013219, 203036048, 203045987, 203177552, 203898516, 204648562, 205067918, 205078130, 205096654, 205689142, 205690439, 205766017, 205988909, 207213161, 207794484, 207800999, 208023602, 208213644, 208213647, 210310273, 210940978, 213325049, 213946445, 214055079, 215125040, 215134273, 215135028, 215237420, 215418148, 215553166, 215553394, 215563858, 215627949, 215754324, 217529652, 217713834, 217732628, 218731945, 221417045, 221424946, 221493746, 221515401, 221658189, 221844577, 221908140, 221910626, 221921586, 222659762, 225001091, 236105833, 236113965, 236194995, 236195427, 236206132, 236206387, 236211683, 236212707, 236381647, 236571826, 237124271, 238172205, 238210544, 238270764, 238435405, 238501172, 239224867, 239257644, 239710497, 240307721, 241208789, 241241557, 241318060, 241319404, 241343533, 241344069, 241405397, 241765845, 243864964, 244502085, 244946220, 245109902, 247647266, 247707956, 248648814, 248648836, 248682161, 248986932, 249058914, 249697357, 252132601, 252135604, 252317348, 255007012, 255278388, 256365156, 257566121, 269763372, 271202790, 271863856, 272049197, 272127474, 272770631, 274339449, 274939471, 275388004, 275388005, 275388006, 275977800, 278267602, 278513831, 278712622, 281613765, 281683369, 282120228, 282250732, 282508942, 283743649, 283787570, 284710386, 285391148, 285478533, 285854898, 285873762, 286931113, 288964227, 289445441, 289689648, 291671489, 303512884, 305319975, 305610036, 305764101, 308448294, 308675890, 312085683, 312264750, 315032867, 316391000, 317331042, 317902135, 318950711, 319447220, 321499182, 322538804, 323145200, 337067316, 337826293, 339905989, 340833697, 341457068, 345302593, 349554733, 349771471, 349786245, 350819405, 356072847, 370349192, 373962798, 374509141, 375558638, 375574835, 376053993, 383276530, 383373833, 383407586, 384439906, 386079012, 404133513, 404307343, 407031852, 408072233, 409112005, 409608425, 409771500, 419040932, 437730612, 439529766, 442616365, 442813037, 443157674, 443295316, 450118444, 450482697, 456789668, 459935396, 471217869, 474073645, 476230702, 476665218, 476717289, 483014825, 485083298, 489306281, 538364390, 540675748, 543819186, 543958612, 576960820, 577242548, 610515252, 642202932, 644420819 };
|
||||
jArray<PRInt32,PRInt32> nsHtml5ElementName::ELEMENT_HASHES = J_ARRAY_STATIC(PRInt32, PRInt32, ELEMENT_HASHES_DATA);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
222
content/html/parser/src/nsHtml5HtmlAttributes.cpp
Normal file
222
content/html/parser/src/nsHtml5HtmlAttributes.cpp
Normal file
@ -0,0 +1,222 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Henri Sivonen
|
||||
* Copyright (c) 2008-2009 Mozilla Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Please edit HtmlAttributes.java instead and regenerate.
|
||||
*/
|
||||
|
||||
#define nsHtml5HtmlAttributes_cpp__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsString.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "jArray.h"
|
||||
#include "nsHtml5DocumentMode.h"
|
||||
#include "nsHtml5ArrayCopy.h"
|
||||
#include "nsHtml5NamedCharacters.h"
|
||||
#include "nsHtml5Parser.h"
|
||||
#include "nsHtml5Atoms.h"
|
||||
#include "nsHtml5ByteReadable.h"
|
||||
|
||||
#include "nsHtml5Tokenizer.h"
|
||||
#include "nsHtml5TreeBuilder.h"
|
||||
#include "nsHtml5MetaScanner.h"
|
||||
#include "nsHtml5AttributeName.h"
|
||||
#include "nsHtml5ElementName.h"
|
||||
#include "nsHtml5StackNode.h"
|
||||
#include "nsHtml5UTF16Buffer.h"
|
||||
#include "nsHtml5StateSnapshot.h"
|
||||
#include "nsHtml5Portability.h"
|
||||
|
||||
#include "nsHtml5HtmlAttributes.h"
|
||||
|
||||
|
||||
nsHtml5HtmlAttributes::nsHtml5HtmlAttributes(PRInt32 mode)
|
||||
: mode(mode),
|
||||
length(0),
|
||||
names(jArray<nsHtml5AttributeName*,PRInt32>(5)),
|
||||
values(jArray<nsString*,PRInt32>(5))
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5HtmlAttributes);
|
||||
}
|
||||
|
||||
|
||||
nsHtml5HtmlAttributes::~nsHtml5HtmlAttributes()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsHtml5HtmlAttributes);
|
||||
clear(0);
|
||||
names.release();
|
||||
values.release();
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsHtml5HtmlAttributes::getIndex(nsHtml5AttributeName* name)
|
||||
{
|
||||
for (PRInt32 i = 0; i < length; i++) {
|
||||
if (names[i] == name) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsHtml5HtmlAttributes::getLength()
|
||||
{
|
||||
return length;
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
nsHtml5HtmlAttributes::getLocalName(PRInt32 index)
|
||||
{
|
||||
if (index < length && index >= 0) {
|
||||
return names[index]->getLocal(mode);
|
||||
} else {
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
nsHtml5AttributeName*
|
||||
nsHtml5HtmlAttributes::getAttributeName(PRInt32 index)
|
||||
{
|
||||
if (index < length && index >= 0) {
|
||||
return names[index];
|
||||
} else {
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsHtml5HtmlAttributes::getURI(PRInt32 index)
|
||||
{
|
||||
if (index < length && index >= 0) {
|
||||
return names[index]->getUri(mode);
|
||||
} else {
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
nsHtml5HtmlAttributes::getPrefix(PRInt32 index)
|
||||
{
|
||||
if (index < length && index >= 0) {
|
||||
return names[index]->getPrefix(mode);
|
||||
} else {
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
nsString*
|
||||
nsHtml5HtmlAttributes::getValue(PRInt32 index)
|
||||
{
|
||||
if (index < length && index >= 0) {
|
||||
return values[index];
|
||||
} else {
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
nsString*
|
||||
nsHtml5HtmlAttributes::getValue(nsHtml5AttributeName* name)
|
||||
{
|
||||
PRInt32 index = getIndex(name);
|
||||
if (index == -1) {
|
||||
return nsnull;
|
||||
} else {
|
||||
return getValue(index);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5HtmlAttributes::addAttribute(nsHtml5AttributeName* name, nsString* value)
|
||||
{
|
||||
if (names.length == length) {
|
||||
PRInt32 newLen = length << 1;
|
||||
jArray<nsHtml5AttributeName*,PRInt32> newNames = jArray<nsHtml5AttributeName*,PRInt32>(newLen);
|
||||
nsHtml5ArrayCopy::arraycopy(names, newNames, names.length);
|
||||
names.release();
|
||||
names = newNames;
|
||||
jArray<nsString*,PRInt32> newValues = jArray<nsString*,PRInt32>(newLen);
|
||||
nsHtml5ArrayCopy::arraycopy(values, newValues, values.length);
|
||||
values.release();
|
||||
values = newValues;
|
||||
}
|
||||
names[length] = name;
|
||||
values[length] = value;
|
||||
length++;
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5HtmlAttributes::clear(PRInt32 m)
|
||||
{
|
||||
for (PRInt32 i = 0; i < length; i++) {
|
||||
names[i]->release();
|
||||
names[i] = nsnull;
|
||||
nsHtml5Portability::releaseString(values[i]);
|
||||
values[i] = nsnull;
|
||||
}
|
||||
length = 0;
|
||||
mode = m;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHtml5HtmlAttributes::contains(nsHtml5AttributeName* name)
|
||||
{
|
||||
for (PRInt32 i = 0; i < length; i++) {
|
||||
if (name->equalsAnother(names[i])) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5HtmlAttributes::adjustForMath()
|
||||
{
|
||||
mode = NS_HTML5ATTRIBUTE_NAME_MATHML;
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5HtmlAttributes::adjustForSvg()
|
||||
{
|
||||
mode = NS_HTML5ATTRIBUTE_NAME_SVG;
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5HtmlAttributes::initializeStatics()
|
||||
{
|
||||
EMPTY_ATTRIBUTES = new nsHtml5HtmlAttributes(NS_HTML5ATTRIBUTE_NAME_HTML);
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5HtmlAttributes::releaseStatics()
|
||||
{
|
||||
delete EMPTY_ATTRIBUTES;
|
||||
}
|
||||
|
||||
|
95
content/html/parser/src/nsHtml5HtmlAttributes.h
Normal file
95
content/html/parser/src/nsHtml5HtmlAttributes.h
Normal file
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Henri Sivonen
|
||||
* Copyright (c) 2008-2009 Mozilla Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Please edit HtmlAttributes.java instead and regenerate.
|
||||
*/
|
||||
|
||||
#ifndef nsHtml5HtmlAttributes_h__
|
||||
#define nsHtml5HtmlAttributes_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsString.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "jArray.h"
|
||||
#include "nsHtml5DocumentMode.h"
|
||||
#include "nsHtml5ArrayCopy.h"
|
||||
#include "nsHtml5NamedCharacters.h"
|
||||
#include "nsHtml5Parser.h"
|
||||
#include "nsHtml5Atoms.h"
|
||||
#include "nsHtml5ByteReadable.h"
|
||||
|
||||
class nsHtml5Parser;
|
||||
|
||||
class nsHtml5Tokenizer;
|
||||
class nsHtml5TreeBuilder;
|
||||
class nsHtml5MetaScanner;
|
||||
class nsHtml5AttributeName;
|
||||
class nsHtml5ElementName;
|
||||
class nsHtml5UTF16Buffer;
|
||||
class nsHtml5StateSnapshot;
|
||||
class nsHtml5Portability;
|
||||
|
||||
|
||||
class nsHtml5HtmlAttributes
|
||||
{
|
||||
public:
|
||||
static nsHtml5HtmlAttributes* EMPTY_ATTRIBUTES;
|
||||
private:
|
||||
PRInt32 mode;
|
||||
PRInt32 length;
|
||||
jArray<nsHtml5AttributeName*,PRInt32> names;
|
||||
jArray<nsString*,PRInt32> values;
|
||||
public:
|
||||
nsHtml5HtmlAttributes(PRInt32 mode);
|
||||
~nsHtml5HtmlAttributes();
|
||||
PRInt32 getIndex(nsHtml5AttributeName* name);
|
||||
PRInt32 getLength();
|
||||
nsIAtom* getLocalName(PRInt32 index);
|
||||
nsHtml5AttributeName* getAttributeName(PRInt32 index);
|
||||
PRInt32 getURI(PRInt32 index);
|
||||
nsIAtom* getPrefix(PRInt32 index);
|
||||
nsString* getValue(PRInt32 index);
|
||||
nsString* getValue(nsHtml5AttributeName* name);
|
||||
void addAttribute(nsHtml5AttributeName* name, nsString* value);
|
||||
void clear(PRInt32 m);
|
||||
PRBool contains(nsHtml5AttributeName* name);
|
||||
void adjustForMath();
|
||||
void adjustForSvg();
|
||||
static void initializeStatics();
|
||||
static void releaseStatics();
|
||||
};
|
||||
|
||||
#ifdef nsHtml5HtmlAttributes_cpp__
|
||||
nsHtml5HtmlAttributes* nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES = nsnull;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
714
content/html/parser/src/nsHtml5MetaScanner.cpp
Normal file
714
content/html/parser/src/nsHtml5MetaScanner.cpp
Normal file
@ -0,0 +1,714 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Henri Sivonen
|
||||
* Copyright (c) 2008-2009 Mozilla Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Please edit MetaScanner.java instead and regenerate.
|
||||
*/
|
||||
|
||||
#define nsHtml5MetaScanner_cpp__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsString.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "jArray.h"
|
||||
#include "nsHtml5DocumentMode.h"
|
||||
#include "nsHtml5ArrayCopy.h"
|
||||
#include "nsHtml5NamedCharacters.h"
|
||||
#include "nsHtml5Parser.h"
|
||||
#include "nsHtml5Atoms.h"
|
||||
#include "nsHtml5ByteReadable.h"
|
||||
|
||||
#include "nsHtml5Tokenizer.h"
|
||||
#include "nsHtml5TreeBuilder.h"
|
||||
#include "nsHtml5AttributeName.h"
|
||||
#include "nsHtml5ElementName.h"
|
||||
#include "nsHtml5HtmlAttributes.h"
|
||||
#include "nsHtml5StackNode.h"
|
||||
#include "nsHtml5UTF16Buffer.h"
|
||||
#include "nsHtml5StateSnapshot.h"
|
||||
#include "nsHtml5Portability.h"
|
||||
|
||||
#include "nsHtml5MetaScanner.h"
|
||||
|
||||
void
|
||||
nsHtml5MetaScanner::stateLoop(PRInt32 state)
|
||||
{
|
||||
PRInt32 c = -1;
|
||||
PRBool reconsume = PR_FALSE;
|
||||
stateloop: for (; ; ) {
|
||||
switch(state) {
|
||||
case NS_HTML5META_SCANNER_DATA: {
|
||||
for (; ; ) {
|
||||
if (reconsume) {
|
||||
reconsume = PR_FALSE;
|
||||
} else {
|
||||
c = read();
|
||||
}
|
||||
switch(c) {
|
||||
case -1: {
|
||||
goto stateloop_end;
|
||||
}
|
||||
case '<': {
|
||||
state = NS_HTML5META_SCANNER_TAG_OPEN;
|
||||
goto dataloop_end;
|
||||
}
|
||||
default: {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
dataloop_end: ;
|
||||
}
|
||||
case NS_HTML5META_SCANNER_TAG_OPEN: {
|
||||
for (; ; ) {
|
||||
c = read();
|
||||
switch(c) {
|
||||
case -1: {
|
||||
goto stateloop_end;
|
||||
}
|
||||
case 'm':
|
||||
case 'M': {
|
||||
metaState = NS_HTML5META_SCANNER_M;
|
||||
state = NS_HTML5META_SCANNER_TAG_NAME;
|
||||
goto tagopenloop_end;
|
||||
}
|
||||
case '!': {
|
||||
state = NS_HTML5META_SCANNER_MARKUP_DECLARATION_OPEN;
|
||||
goto stateloop;
|
||||
}
|
||||
case '\?':
|
||||
case '/': {
|
||||
state = NS_HTML5META_SCANNER_SCAN_UNTIL_GT;
|
||||
goto stateloop;
|
||||
}
|
||||
case '>': {
|
||||
state = NS_HTML5META_SCANNER_DATA;
|
||||
goto stateloop;
|
||||
}
|
||||
default: {
|
||||
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
|
||||
metaState = NS_HTML5META_SCANNER_NO;
|
||||
state = NS_HTML5META_SCANNER_TAG_NAME;
|
||||
goto tagopenloop_end;
|
||||
}
|
||||
state = NS_HTML5META_SCANNER_DATA;
|
||||
reconsume = PR_TRUE;
|
||||
goto stateloop;
|
||||
}
|
||||
}
|
||||
}
|
||||
tagopenloop_end: ;
|
||||
}
|
||||
case NS_HTML5META_SCANNER_TAG_NAME: {
|
||||
for (; ; ) {
|
||||
c = read();
|
||||
switch(c) {
|
||||
case -1: {
|
||||
goto stateloop_end;
|
||||
}
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\f': {
|
||||
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME;
|
||||
goto tagnameloop_end;
|
||||
}
|
||||
case '/': {
|
||||
state = NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG;
|
||||
goto stateloop;
|
||||
}
|
||||
case '>': {
|
||||
state = NS_HTML5META_SCANNER_DATA;
|
||||
goto stateloop;
|
||||
}
|
||||
case 'e':
|
||||
case 'E': {
|
||||
if (metaState == NS_HTML5META_SCANNER_M) {
|
||||
metaState = NS_HTML5META_SCANNER_E;
|
||||
} else {
|
||||
metaState = NS_HTML5META_SCANNER_NO;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
case 't':
|
||||
case 'T': {
|
||||
if (metaState == NS_HTML5META_SCANNER_E) {
|
||||
metaState = NS_HTML5META_SCANNER_T;
|
||||
} else {
|
||||
metaState = NS_HTML5META_SCANNER_NO;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
case 'a':
|
||||
case 'A': {
|
||||
if (metaState == NS_HTML5META_SCANNER_T) {
|
||||
metaState = NS_HTML5META_SCANNER_A;
|
||||
} else {
|
||||
metaState = NS_HTML5META_SCANNER_NO;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
default: {
|
||||
metaState = NS_HTML5META_SCANNER_NO;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
tagnameloop_end: ;
|
||||
}
|
||||
case NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME: {
|
||||
for (; ; ) {
|
||||
if (reconsume) {
|
||||
reconsume = PR_FALSE;
|
||||
} else {
|
||||
c = read();
|
||||
}
|
||||
switch(c) {
|
||||
case -1: {
|
||||
goto stateloop_end;
|
||||
}
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\f': {
|
||||
continue;
|
||||
}
|
||||
case '/': {
|
||||
state = NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG;
|
||||
goto stateloop;
|
||||
}
|
||||
case '>': {
|
||||
state = NS_HTML5META_SCANNER_DATA;
|
||||
goto stateloop;
|
||||
}
|
||||
case 'c':
|
||||
case 'C': {
|
||||
contentIndex = 0;
|
||||
charsetIndex = 0;
|
||||
state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME;
|
||||
goto beforeattributenameloop_end;
|
||||
}
|
||||
default: {
|
||||
contentIndex = -1;
|
||||
charsetIndex = -1;
|
||||
state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME;
|
||||
goto beforeattributenameloop_end;
|
||||
}
|
||||
}
|
||||
}
|
||||
beforeattributenameloop_end: ;
|
||||
}
|
||||
case NS_HTML5META_SCANNER_ATTRIBUTE_NAME: {
|
||||
for (; ; ) {
|
||||
c = read();
|
||||
switch(c) {
|
||||
case -1: {
|
||||
goto stateloop_end;
|
||||
}
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\f': {
|
||||
state = NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_NAME;
|
||||
goto stateloop;
|
||||
}
|
||||
case '/': {
|
||||
state = NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG;
|
||||
goto stateloop;
|
||||
}
|
||||
case '=': {
|
||||
strBufLen = 0;
|
||||
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_VALUE;
|
||||
goto attributenameloop_end;
|
||||
}
|
||||
case '>': {
|
||||
state = NS_HTML5META_SCANNER_DATA;
|
||||
goto stateloop;
|
||||
}
|
||||
default: {
|
||||
if (metaState == NS_HTML5META_SCANNER_A) {
|
||||
if (c >= 'A' && c <= 'Z') {
|
||||
c += 0x20;
|
||||
}
|
||||
if (contentIndex == 6) {
|
||||
contentIndex = -1;
|
||||
} else if (contentIndex > -1 && contentIndex < 6 && (c == CONTENT[contentIndex + 1])) {
|
||||
contentIndex++;
|
||||
}
|
||||
if (charsetIndex == 6) {
|
||||
charsetIndex = -1;
|
||||
} else if (charsetIndex > -1 && charsetIndex < 6 && (c == CHARSET[charsetIndex + 1])) {
|
||||
charsetIndex++;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
attributenameloop_end: ;
|
||||
}
|
||||
case NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_VALUE: {
|
||||
for (; ; ) {
|
||||
c = read();
|
||||
switch(c) {
|
||||
case -1: {
|
||||
goto stateloop_end;
|
||||
}
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\f': {
|
||||
continue;
|
||||
}
|
||||
case '\"': {
|
||||
state = NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_DOUBLE_QUOTED;
|
||||
goto beforeattributevalueloop_end;
|
||||
}
|
||||
case '\'': {
|
||||
state = NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_SINGLE_QUOTED;
|
||||
goto stateloop;
|
||||
}
|
||||
case '>': {
|
||||
state = NS_HTML5META_SCANNER_DATA;
|
||||
goto stateloop;
|
||||
}
|
||||
default: {
|
||||
if (charsetIndex == 6 || contentIndex == 6) {
|
||||
addToBuffer(c);
|
||||
}
|
||||
state = NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_UNQUOTED;
|
||||
goto stateloop;
|
||||
}
|
||||
}
|
||||
}
|
||||
beforeattributevalueloop_end: ;
|
||||
}
|
||||
case NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_DOUBLE_QUOTED: {
|
||||
for (; ; ) {
|
||||
if (reconsume) {
|
||||
reconsume = PR_FALSE;
|
||||
} else {
|
||||
c = read();
|
||||
}
|
||||
switch(c) {
|
||||
case -1: {
|
||||
goto stateloop_end;
|
||||
}
|
||||
case '\"': {
|
||||
if (tryCharset()) {
|
||||
goto stateloop_end;
|
||||
}
|
||||
state = NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_VALUE_QUOTED;
|
||||
goto attributevaluedoublequotedloop_end;
|
||||
}
|
||||
default: {
|
||||
if (metaState == NS_HTML5META_SCANNER_A && (contentIndex == 6 || charsetIndex == 6)) {
|
||||
addToBuffer(c);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
attributevaluedoublequotedloop_end: ;
|
||||
}
|
||||
case NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_VALUE_QUOTED: {
|
||||
for (; ; ) {
|
||||
c = read();
|
||||
switch(c) {
|
||||
case -1: {
|
||||
goto stateloop_end;
|
||||
}
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\f': {
|
||||
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME;
|
||||
goto stateloop;
|
||||
}
|
||||
case '/': {
|
||||
state = NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG;
|
||||
goto afterattributevaluequotedloop_end;
|
||||
}
|
||||
case '>': {
|
||||
state = NS_HTML5META_SCANNER_DATA;
|
||||
goto stateloop;
|
||||
}
|
||||
default: {
|
||||
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME;
|
||||
reconsume = PR_TRUE;
|
||||
goto stateloop;
|
||||
}
|
||||
}
|
||||
}
|
||||
afterattributevaluequotedloop_end: ;
|
||||
}
|
||||
case NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG: {
|
||||
c = read();
|
||||
switch(c) {
|
||||
case -1: {
|
||||
goto stateloop_end;
|
||||
}
|
||||
case '>': {
|
||||
state = NS_HTML5META_SCANNER_DATA;
|
||||
goto stateloop;
|
||||
}
|
||||
default: {
|
||||
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME;
|
||||
reconsume = PR_TRUE;
|
||||
goto stateloop;
|
||||
}
|
||||
}
|
||||
}
|
||||
case NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_UNQUOTED: {
|
||||
for (; ; ) {
|
||||
if (reconsume) {
|
||||
reconsume = PR_FALSE;
|
||||
} else {
|
||||
c = read();
|
||||
}
|
||||
switch(c) {
|
||||
case -1: {
|
||||
goto stateloop_end;
|
||||
}
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\f': {
|
||||
if (tryCharset()) {
|
||||
goto stateloop_end;
|
||||
}
|
||||
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME;
|
||||
goto stateloop;
|
||||
}
|
||||
case '>': {
|
||||
if (tryCharset()) {
|
||||
goto stateloop_end;
|
||||
}
|
||||
state = NS_HTML5META_SCANNER_DATA;
|
||||
goto stateloop;
|
||||
}
|
||||
default: {
|
||||
if (metaState == NS_HTML5META_SCANNER_A && (contentIndex == 6 || charsetIndex == 6)) {
|
||||
addToBuffer(c);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_NAME: {
|
||||
for (; ; ) {
|
||||
c = read();
|
||||
switch(c) {
|
||||
case -1: {
|
||||
goto stateloop_end;
|
||||
}
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\f': {
|
||||
continue;
|
||||
}
|
||||
case '/': {
|
||||
if (tryCharset()) {
|
||||
goto stateloop_end;
|
||||
}
|
||||
state = NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG;
|
||||
goto stateloop;
|
||||
}
|
||||
case '=': {
|
||||
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_VALUE;
|
||||
goto stateloop;
|
||||
}
|
||||
case '>': {
|
||||
if (tryCharset()) {
|
||||
goto stateloop_end;
|
||||
}
|
||||
state = NS_HTML5META_SCANNER_DATA;
|
||||
goto stateloop;
|
||||
}
|
||||
case 'c':
|
||||
case 'C': {
|
||||
contentIndex = 0;
|
||||
charsetIndex = 0;
|
||||
state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME;
|
||||
goto stateloop;
|
||||
}
|
||||
default: {
|
||||
contentIndex = -1;
|
||||
charsetIndex = -1;
|
||||
state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME;
|
||||
goto stateloop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case NS_HTML5META_SCANNER_MARKUP_DECLARATION_OPEN: {
|
||||
for (; ; ) {
|
||||
c = read();
|
||||
switch(c) {
|
||||
case -1: {
|
||||
goto stateloop_end;
|
||||
}
|
||||
case '-': {
|
||||
state = NS_HTML5META_SCANNER_MARKUP_DECLARATION_HYPHEN;
|
||||
goto markupdeclarationopenloop_end;
|
||||
}
|
||||
default: {
|
||||
state = NS_HTML5META_SCANNER_SCAN_UNTIL_GT;
|
||||
reconsume = PR_TRUE;
|
||||
goto stateloop;
|
||||
}
|
||||
}
|
||||
}
|
||||
markupdeclarationopenloop_end: ;
|
||||
}
|
||||
case NS_HTML5META_SCANNER_MARKUP_DECLARATION_HYPHEN: {
|
||||
for (; ; ) {
|
||||
c = read();
|
||||
switch(c) {
|
||||
case -1: {
|
||||
goto stateloop_end;
|
||||
}
|
||||
case '-': {
|
||||
state = NS_HTML5META_SCANNER_COMMENT_START;
|
||||
goto markupdeclarationhyphenloop_end;
|
||||
}
|
||||
default: {
|
||||
state = NS_HTML5META_SCANNER_SCAN_UNTIL_GT;
|
||||
reconsume = PR_TRUE;
|
||||
goto stateloop;
|
||||
}
|
||||
}
|
||||
}
|
||||
markupdeclarationhyphenloop_end: ;
|
||||
}
|
||||
case NS_HTML5META_SCANNER_COMMENT_START: {
|
||||
for (; ; ) {
|
||||
c = read();
|
||||
switch(c) {
|
||||
case -1: {
|
||||
goto stateloop_end;
|
||||
}
|
||||
case '-': {
|
||||
state = NS_HTML5META_SCANNER_COMMENT_START_DASH;
|
||||
goto stateloop;
|
||||
}
|
||||
case '>': {
|
||||
state = NS_HTML5META_SCANNER_DATA;
|
||||
goto stateloop;
|
||||
}
|
||||
default: {
|
||||
state = NS_HTML5META_SCANNER_COMMENT;
|
||||
goto commentstartloop_end;
|
||||
}
|
||||
}
|
||||
}
|
||||
commentstartloop_end: ;
|
||||
}
|
||||
case NS_HTML5META_SCANNER_COMMENT: {
|
||||
for (; ; ) {
|
||||
c = read();
|
||||
switch(c) {
|
||||
case -1: {
|
||||
goto stateloop_end;
|
||||
}
|
||||
case '-': {
|
||||
state = NS_HTML5META_SCANNER_COMMENT_END_DASH;
|
||||
goto commentloop_end;
|
||||
}
|
||||
default: {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
commentloop_end: ;
|
||||
}
|
||||
case NS_HTML5META_SCANNER_COMMENT_END_DASH: {
|
||||
for (; ; ) {
|
||||
c = read();
|
||||
switch(c) {
|
||||
case -1: {
|
||||
goto stateloop_end;
|
||||
}
|
||||
case '-': {
|
||||
state = NS_HTML5META_SCANNER_COMMENT_END;
|
||||
goto commentenddashloop_end;
|
||||
}
|
||||
default: {
|
||||
state = NS_HTML5META_SCANNER_COMMENT;
|
||||
goto stateloop;
|
||||
}
|
||||
}
|
||||
}
|
||||
commentenddashloop_end: ;
|
||||
}
|
||||
case NS_HTML5META_SCANNER_COMMENT_END: {
|
||||
for (; ; ) {
|
||||
c = read();
|
||||
switch(c) {
|
||||
case -1: {
|
||||
goto stateloop_end;
|
||||
}
|
||||
case '>': {
|
||||
state = NS_HTML5META_SCANNER_DATA;
|
||||
goto stateloop;
|
||||
}
|
||||
case '-': {
|
||||
continue;
|
||||
}
|
||||
default: {
|
||||
state = NS_HTML5META_SCANNER_COMMENT;
|
||||
goto stateloop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case NS_HTML5META_SCANNER_COMMENT_START_DASH: {
|
||||
c = read();
|
||||
switch(c) {
|
||||
case -1: {
|
||||
goto stateloop_end;
|
||||
}
|
||||
case '-': {
|
||||
state = NS_HTML5META_SCANNER_COMMENT_END;
|
||||
goto stateloop;
|
||||
}
|
||||
case '>': {
|
||||
state = NS_HTML5META_SCANNER_DATA;
|
||||
goto stateloop;
|
||||
}
|
||||
default: {
|
||||
state = NS_HTML5META_SCANNER_COMMENT;
|
||||
goto stateloop;
|
||||
}
|
||||
}
|
||||
}
|
||||
case NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_SINGLE_QUOTED: {
|
||||
for (; ; ) {
|
||||
if (reconsume) {
|
||||
reconsume = PR_FALSE;
|
||||
} else {
|
||||
c = read();
|
||||
}
|
||||
switch(c) {
|
||||
case -1: {
|
||||
goto stateloop_end;
|
||||
}
|
||||
case '\'': {
|
||||
if (tryCharset()) {
|
||||
goto stateloop_end;
|
||||
}
|
||||
state = NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_VALUE_QUOTED;
|
||||
goto stateloop;
|
||||
}
|
||||
default: {
|
||||
if (metaState == NS_HTML5META_SCANNER_A && (contentIndex == 6 || charsetIndex == 6)) {
|
||||
addToBuffer(c);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case NS_HTML5META_SCANNER_SCAN_UNTIL_GT: {
|
||||
for (; ; ) {
|
||||
if (reconsume) {
|
||||
reconsume = PR_FALSE;
|
||||
} else {
|
||||
c = read();
|
||||
}
|
||||
switch(c) {
|
||||
case -1: {
|
||||
goto stateloop_end;
|
||||
}
|
||||
case '>': {
|
||||
state = NS_HTML5META_SCANNER_DATA;
|
||||
goto stateloop;
|
||||
}
|
||||
default: {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stateloop_end: ;
|
||||
stateSave = state;
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5MetaScanner::addToBuffer(PRInt32 c)
|
||||
{
|
||||
if (strBufLen == strBuf.length) {
|
||||
jArray<PRUnichar,PRInt32> newBuf = jArray<PRUnichar,PRInt32>(strBuf.length + (strBuf.length << 1));
|
||||
nsHtml5ArrayCopy::arraycopy(strBuf, newBuf, strBuf.length);
|
||||
strBuf.release();
|
||||
strBuf = newBuf;
|
||||
}
|
||||
strBuf[strBufLen++] = (PRUnichar) c;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHtml5MetaScanner::tryCharset()
|
||||
{
|
||||
if (metaState != NS_HTML5META_SCANNER_A || !(contentIndex == 6 || charsetIndex == 6)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
nsString* attVal = nsHtml5Portability::newStringFromBuffer(strBuf, 0, strBufLen);
|
||||
nsString* candidateEncoding;
|
||||
if (contentIndex == 6) {
|
||||
candidateEncoding = nsHtml5TreeBuilder::extractCharsetFromContent(attVal);
|
||||
nsHtml5Portability::releaseString(attVal);
|
||||
} else {
|
||||
candidateEncoding = attVal;
|
||||
}
|
||||
if (!candidateEncoding) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
PRBool rv = tryCharset(candidateEncoding);
|
||||
nsHtml5Portability::releaseString(candidateEncoding);
|
||||
contentIndex = -1;
|
||||
charsetIndex = -1;
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5MetaScanner::initializeStatics()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5MetaScanner::releaseStatics()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#include "nsHtml5MetaScannerCppSupplement.h"
|
||||
|
122
content/html/parser/src/nsHtml5MetaScanner.h
Normal file
122
content/html/parser/src/nsHtml5MetaScanner.h
Normal file
@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Henri Sivonen
|
||||
* Copyright (c) 2008-2009 Mozilla Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Please edit MetaScanner.java instead and regenerate.
|
||||
*/
|
||||
|
||||
#ifndef nsHtml5MetaScanner_h__
|
||||
#define nsHtml5MetaScanner_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsString.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "jArray.h"
|
||||
#include "nsHtml5DocumentMode.h"
|
||||
#include "nsHtml5ArrayCopy.h"
|
||||
#include "nsHtml5NamedCharacters.h"
|
||||
#include "nsHtml5Parser.h"
|
||||
#include "nsHtml5Atoms.h"
|
||||
#include "nsHtml5ByteReadable.h"
|
||||
|
||||
class nsHtml5Parser;
|
||||
|
||||
class nsHtml5Tokenizer;
|
||||
class nsHtml5TreeBuilder;
|
||||
class nsHtml5AttributeName;
|
||||
class nsHtml5ElementName;
|
||||
class nsHtml5HtmlAttributes;
|
||||
class nsHtml5UTF16Buffer;
|
||||
class nsHtml5StateSnapshot;
|
||||
class nsHtml5Portability;
|
||||
|
||||
|
||||
class nsHtml5MetaScanner
|
||||
{
|
||||
private:
|
||||
static PRUnichar CHARSET[];
|
||||
static PRUnichar CONTENT[];
|
||||
protected:
|
||||
nsHtml5ByteReadable* readable;
|
||||
private:
|
||||
PRInt32 metaState;
|
||||
PRInt32 contentIndex;
|
||||
PRInt32 charsetIndex;
|
||||
protected:
|
||||
PRInt32 stateSave;
|
||||
private:
|
||||
PRInt32 strBufLen;
|
||||
jArray<PRUnichar,PRInt32> strBuf;
|
||||
protected:
|
||||
void stateLoop(PRInt32 state);
|
||||
private:
|
||||
void addToBuffer(PRInt32 c);
|
||||
PRBool tryCharset();
|
||||
protected:
|
||||
PRBool tryCharset(nsString* encoding);
|
||||
public:
|
||||
static void initializeStatics();
|
||||
static void releaseStatics();
|
||||
|
||||
#include "nsHtml5MetaScannerHSupplement.h"
|
||||
};
|
||||
|
||||
#ifdef nsHtml5MetaScanner_cpp__
|
||||
PRUnichar nsHtml5MetaScanner::CHARSET[] = { 'c', 'h', 'a', 'r', 's', 'e', 't' };
|
||||
PRUnichar nsHtml5MetaScanner::CONTENT[] = { 'c', 'o', 'n', 't', 'e', 'n', 't' };
|
||||
#endif
|
||||
|
||||
#define NS_HTML5META_SCANNER_NO 0
|
||||
#define NS_HTML5META_SCANNER_M 1
|
||||
#define NS_HTML5META_SCANNER_E 2
|
||||
#define NS_HTML5META_SCANNER_T 3
|
||||
#define NS_HTML5META_SCANNER_A 4
|
||||
#define NS_HTML5META_SCANNER_DATA 0
|
||||
#define NS_HTML5META_SCANNER_TAG_OPEN 1
|
||||
#define NS_HTML5META_SCANNER_SCAN_UNTIL_GT 2
|
||||
#define NS_HTML5META_SCANNER_TAG_NAME 3
|
||||
#define NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME 4
|
||||
#define NS_HTML5META_SCANNER_ATTRIBUTE_NAME 5
|
||||
#define NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_NAME 6
|
||||
#define NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_VALUE 7
|
||||
#define NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_DOUBLE_QUOTED 8
|
||||
#define NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_SINGLE_QUOTED 9
|
||||
#define NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_UNQUOTED 10
|
||||
#define NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_VALUE_QUOTED 11
|
||||
#define NS_HTML5META_SCANNER_MARKUP_DECLARATION_OPEN 13
|
||||
#define NS_HTML5META_SCANNER_MARKUP_DECLARATION_HYPHEN 14
|
||||
#define NS_HTML5META_SCANNER_COMMENT_START 15
|
||||
#define NS_HTML5META_SCANNER_COMMENT_START_DASH 16
|
||||
#define NS_HTML5META_SCANNER_COMMENT 17
|
||||
#define NS_HTML5META_SCANNER_COMMENT_END_DASH 18
|
||||
#define NS_HTML5META_SCANNER_COMMENT_END 19
|
||||
#define NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG 20
|
||||
|
||||
|
||||
#endif
|
||||
|
137
content/html/parser/src/nsHtml5MetaScannerCppSupplement.h
Normal file
137
content/html/parser/src/nsHtml5MetaScannerCppSupplement.h
Normal file
@ -0,0 +1,137 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is HTML Parser C++ Translator code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsICharsetAlias.h"
|
||||
#include "nsEncoderDecoderUtils.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
|
||||
static NS_DEFINE_CID(kCharsetAliasCID, NS_CHARSETALIAS_CID);
|
||||
|
||||
nsHtml5MetaScanner::nsHtml5MetaScanner()
|
||||
: readable(nsnull),
|
||||
metaState(NS_HTML5META_SCANNER_NO),
|
||||
contentIndex(-1),
|
||||
charsetIndex(-1),
|
||||
stateSave(NS_HTML5META_SCANNER_DATA),
|
||||
strBufLen(0),
|
||||
strBuf(jArray<PRUnichar,PRInt32>(36))
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5MetaScanner);
|
||||
}
|
||||
|
||||
nsHtml5MetaScanner::~nsHtml5MetaScanner()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsHtml5MetaScanner);
|
||||
strBuf.release();
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5MetaScanner::sniff(nsHtml5ByteReadable* bytes, nsIUnicodeDecoder** decoder, nsACString& charset)
|
||||
{
|
||||
readable = bytes;
|
||||
stateLoop(stateSave);
|
||||
readable = nsnull;
|
||||
if (mUnicodeDecoder) {
|
||||
mUnicodeDecoder.forget(decoder);
|
||||
charset.Assign(mCharset);
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHtml5MetaScanner::tryCharset(nsString* charset)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
nsCOMPtr<nsICharsetConverterManager> convManager = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &res);
|
||||
if (NS_FAILED(res)) {
|
||||
NS_ERROR("Could not get CharsetConverterManager service.");
|
||||
return PR_FALSE;
|
||||
}
|
||||
nsCAutoString encoding;
|
||||
CopyUTF16toUTF8(*charset, encoding);
|
||||
// XXX spec says only UTF-16
|
||||
if (encoding.LowerCaseEqualsASCII("utf-16") ||
|
||||
encoding.LowerCaseEqualsASCII("utf-16be") ||
|
||||
encoding.LowerCaseEqualsASCII("utf-16le") ||
|
||||
encoding.LowerCaseEqualsASCII("utf-32") ||
|
||||
encoding.LowerCaseEqualsASCII("utf-32be") ||
|
||||
encoding.LowerCaseEqualsASCII("utf-32le")) {
|
||||
mCharset.Assign("utf-8");
|
||||
res = convManager->GetUnicodeDecoderRaw(mCharset.get(), getter_AddRefs(mUnicodeDecoder));
|
||||
if (NS_FAILED(res)) {
|
||||
NS_ERROR("Could not get decoder for UTF-8.");
|
||||
return PR_FALSE;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
nsCAutoString preferred;
|
||||
nsCOMPtr<nsICharsetAlias> calias(do_GetService(kCharsetAliasCID, &res));
|
||||
if (NS_FAILED(res)) {
|
||||
NS_ERROR("Could not get CharsetAlias service.");
|
||||
return PR_FALSE;
|
||||
}
|
||||
res = calias->GetPreferred(encoding, preferred);
|
||||
if (NS_FAILED(res)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (preferred.LowerCaseEqualsASCII("utf-16") ||
|
||||
preferred.LowerCaseEqualsASCII("utf-16be") ||
|
||||
preferred.LowerCaseEqualsASCII("utf-16le") ||
|
||||
preferred.LowerCaseEqualsASCII("utf-32") ||
|
||||
preferred.LowerCaseEqualsASCII("utf-32be") ||
|
||||
preferred.LowerCaseEqualsASCII("utf-32le") ||
|
||||
preferred.LowerCaseEqualsASCII("utf-7") ||
|
||||
preferred.LowerCaseEqualsASCII("jis_x0212-1990") ||
|
||||
preferred.LowerCaseEqualsASCII("x-jis0208") ||
|
||||
preferred.LowerCaseEqualsASCII("x-imap4-modified-utf7") ||
|
||||
preferred.LowerCaseEqualsASCII("x-user-defined")) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
res = convManager->GetUnicodeDecoderRaw(preferred.get(), getter_AddRefs(mUnicodeDecoder));
|
||||
if (res == NS_ERROR_UCONV_NOCONV) {
|
||||
return PR_FALSE;
|
||||
} else if (NS_FAILED(res)) {
|
||||
NS_ERROR("Getting an encoding decoder failed in a bad way.");
|
||||
mUnicodeDecoder = nsnull;
|
||||
return PR_FALSE;
|
||||
} else {
|
||||
NS_ASSERTION(mUnicodeDecoder, "Getter nsresult and object don't match.");
|
||||
mCharset.Assign(preferred);
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
47
content/html/parser/src/nsHtml5MetaScannerHSupplement.h
Normal file
47
content/html/parser/src/nsHtml5MetaScannerHSupplement.h
Normal file
@ -0,0 +1,47 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is HTML Parser C++ Translator code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIUnicodeDecoder> mUnicodeDecoder;
|
||||
nsCString mCharset;
|
||||
inline PRInt32 read() {
|
||||
return readable->read();
|
||||
}
|
||||
public:
|
||||
void sniff(nsHtml5ByteReadable* bytes, nsIUnicodeDecoder** decoder, nsACString& charset);
|
||||
nsHtml5MetaScanner();
|
||||
~nsHtml5MetaScanner();
|
112
content/html/parser/src/nsHtml5Module.cpp
Normal file
112
content/html/parser/src/nsHtml5Module.cpp
Normal file
@ -0,0 +1,112 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is HTML Parser C++ Translator code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsHtml5AttributeName.h"
|
||||
#include "nsHtml5ElementName.h"
|
||||
#include "nsHtml5HtmlAttributes.h"
|
||||
#include "nsHtml5NamedCharacters.h"
|
||||
#include "nsHtml5Portability.h"
|
||||
#include "nsHtml5StackNode.h"
|
||||
#include "nsHtml5Tokenizer.h"
|
||||
#include "nsHtml5TreeBuilder.h"
|
||||
#include "nsHtml5UTF16Buffer.h"
|
||||
|
||||
#include "nsHtml5Module.h"
|
||||
|
||||
// static
|
||||
void
|
||||
nsHtml5Module::InitializeStatics()
|
||||
{
|
||||
nsHtml5Atoms::AddRefAtoms();
|
||||
nsHtml5AttributeName::initializeStatics();
|
||||
nsHtml5ElementName::initializeStatics();
|
||||
nsHtml5HtmlAttributes::initializeStatics();
|
||||
nsHtml5NamedCharacters::initializeStatics();
|
||||
nsHtml5Portability::initializeStatics();
|
||||
nsHtml5StackNode::initializeStatics();
|
||||
nsHtml5Tokenizer::initializeStatics();
|
||||
nsHtml5TreeBuilder::initializeStatics();
|
||||
nsHtml5UTF16Buffer::initializeStatics();
|
||||
#ifdef DEBUG
|
||||
sNsHtml5ModuleInitialized = PR_TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
nsHtml5Module::ReleaseStatics()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
sNsHtml5ModuleInitialized = PR_FALSE;
|
||||
#endif
|
||||
nsHtml5AttributeName::releaseStatics();
|
||||
nsHtml5ElementName::releaseStatics();
|
||||
nsHtml5HtmlAttributes::releaseStatics();
|
||||
nsHtml5NamedCharacters::releaseStatics();
|
||||
nsHtml5Portability::releaseStatics();
|
||||
nsHtml5StackNode::releaseStatics();
|
||||
nsHtml5Tokenizer::releaseStatics();
|
||||
nsHtml5TreeBuilder::releaseStatics();
|
||||
nsHtml5UTF16Buffer::releaseStatics();
|
||||
}
|
||||
|
||||
// static
|
||||
already_AddRefed<nsIParser>
|
||||
nsHtml5Module::NewHtml5Parser()
|
||||
{
|
||||
NS_ABORT_IF_FALSE(sNsHtml5ModuleInitialized, "nsHtml5Module not initialized.");
|
||||
nsIParser* rv = static_cast<nsIParser*> (new nsHtml5Parser());
|
||||
NS_ADDREF(rv);
|
||||
for (PRInt32 i = 0; i < 1000; i++) {
|
||||
NS_ADDREF(rv);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
// static
|
||||
|
||||
nsresult
|
||||
nsHtml5Module::Initialize(nsIParser* aParser, nsIDocument* aDoc, nsIURI* aURI, nsISupports* aContainer, nsIChannel* aChannel)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(sNsHtml5ModuleInitialized, "nsHtml5Module not initialized.");
|
||||
nsHtml5Parser* parser = static_cast<nsHtml5Parser*> (aParser);
|
||||
return parser->Initialize(aDoc, aURI, aContainer, aChannel);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
PRBool nsHtml5Module::sNsHtml5ModuleInitialized = PR_FALSE;
|
||||
#endif
|
17160
content/html/parser/src/nsHtml5NamedCharacters.cpp
Normal file
17160
content/html/parser/src/nsHtml5NamedCharacters.cpp
Normal file
File diff suppressed because it is too large
Load Diff
4296
content/html/parser/src/nsHtml5NamedCharacters.h
Normal file
4296
content/html/parser/src/nsHtml5NamedCharacters.h
Normal file
File diff suppressed because it is too large
Load Diff
1554
content/html/parser/src/nsHtml5Parser.cpp
Normal file
1554
content/html/parser/src/nsHtml5Parser.cpp
Normal file
File diff suppressed because it is too large
Load Diff
415
content/html/parser/src/nsHtml5Parser.h
Normal file
415
content/html/parser/src/nsHtml5Parser.h
Normal file
@ -0,0 +1,415 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef NS_HTML5_PARSER__
|
||||
#define NS_HTML5_PARSER__
|
||||
|
||||
#include "nsTimer.h"
|
||||
#include "nsIParser.h"
|
||||
#include "nsDeque.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsParserCIID.h"
|
||||
#include "nsITokenizer.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIContentSink.h"
|
||||
#include "nsIParserFilter.h"
|
||||
#include "nsIRequest.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsContentSink.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIUnicharStreamListener.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsICharsetDetectionObserver.h"
|
||||
#include "nsDetectionConfident.h"
|
||||
#include "nsHtml5UTF16Buffer.h"
|
||||
#include "nsHtml5MetaScanner.h"
|
||||
|
||||
#define NS_HTML5_PARSER_CID \
|
||||
{0x3113adb0, 0xe56d, 0x459e, \
|
||||
{0xb9, 0x5b, 0xf1, 0xf2, 0x4a, 0xba, 0x2a, 0x80}}
|
||||
|
||||
#define NS_HTML5_PARSER_READ_BUFFER_SIZE 1024
|
||||
|
||||
#define NS_HTML5_PARSER_SNIFFING_BUFFER_SIZE 512
|
||||
|
||||
enum eHtml5ParserLifecycle {
|
||||
NOT_STARTED = 0,
|
||||
PARSING = 1,
|
||||
STREAM_ENDING = 2,
|
||||
TERMINATED = 3
|
||||
};
|
||||
|
||||
enum eBomState {
|
||||
BOM_SNIFFING_NOT_STARTED = 0,
|
||||
SEEN_UTF_16_LE_FIRST_BYTE = 1,
|
||||
SEEN_UTF_16_BE_FIRST_BYTE = 2,
|
||||
SEEN_UTF_8_FIRST_BYTE = 3,
|
||||
SEEN_UTF_8_SECOND_BYTE = 4,
|
||||
BOM_SNIFFING_OVER = 5
|
||||
};
|
||||
|
||||
class nsHtml5Parser : public nsIParser,
|
||||
public nsIStreamListener,
|
||||
public nsICharsetDetectionObserver,
|
||||
public nsIContentSink,
|
||||
public nsContentSink {
|
||||
|
||||
|
||||
public:
|
||||
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
nsHtml5Parser();
|
||||
|
||||
virtual ~nsHtml5Parser();
|
||||
|
||||
/* Start nsIParser */
|
||||
|
||||
/**
|
||||
* No-op for backwards compat.
|
||||
*/
|
||||
NS_IMETHOD_(void) SetContentSink(nsIContentSink* aSink);
|
||||
|
||||
/**
|
||||
* Returns |this| for backwards compat.
|
||||
*/
|
||||
NS_IMETHOD_(nsIContentSink*) GetContentSink(void);
|
||||
|
||||
/**
|
||||
* Methods for backwards compat.
|
||||
*/
|
||||
NS_IMETHOD_(void) GetCommand(nsCString& aCommand);
|
||||
NS_IMETHOD_(void) SetCommand(const char* aCommand);
|
||||
NS_IMETHOD_(void) SetCommand(eParserCommands aParserCommand);
|
||||
|
||||
/**
|
||||
* Call this method once you've created a parser, and want to instruct it
|
||||
* about what charset to load
|
||||
*
|
||||
* @update ftang 4/23/99
|
||||
* @param aCharset- the charset of a document
|
||||
* @param aCharsetSource- the source of the charset
|
||||
* @return nada
|
||||
*/
|
||||
NS_IMETHOD_(void) SetDocumentCharset(const nsACString& aCharset, PRInt32 aSource);
|
||||
|
||||
NS_IMETHOD_(void) GetDocumentCharset(nsACString& aCharset, PRInt32& aSource)
|
||||
{
|
||||
aCharset = mCharset;
|
||||
aSource = mCharsetSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* No-op for backwards compat.
|
||||
*/
|
||||
NS_IMETHOD_(void) SetParserFilter(nsIParserFilter* aFilter);
|
||||
|
||||
|
||||
/**
|
||||
* Get the channel associated with this parser
|
||||
* @update harishd,gagan 07/17/01
|
||||
* @param aChannel out param that will contain the result
|
||||
* @return NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD GetChannel(nsIChannel** aChannel);
|
||||
|
||||
/**
|
||||
* Return |this| for backwards compat.
|
||||
*/
|
||||
NS_IMETHOD GetDTD(nsIDTD** aDTD);
|
||||
|
||||
NS_IMETHOD ContinueParsing();
|
||||
NS_IMETHOD ContinueInterruptedParsing();
|
||||
NS_IMETHOD_(void) BlockParser();
|
||||
NS_IMETHOD_(void) UnblockParser();
|
||||
|
||||
/**
|
||||
* Call this to query whether the parser is enabled or not.
|
||||
*
|
||||
* @update vidur 4/12/99
|
||||
* @return current state
|
||||
*/
|
||||
NS_IMETHOD_(PRBool) IsParserEnabled();
|
||||
|
||||
/**
|
||||
* Call this to query whether the parser thinks it's done with parsing.
|
||||
*
|
||||
* @update rickg 5/12/01
|
||||
* @return complete state
|
||||
*/
|
||||
NS_IMETHOD_(PRBool) IsComplete();
|
||||
|
||||
/**
|
||||
* Cause parser to parse input from given URL
|
||||
* @update gess5/11/98
|
||||
* @param aURL is a descriptor for source document
|
||||
* @param aListener is a listener to forward notifications to
|
||||
* @return TRUE if all went well -- FALSE otherwise
|
||||
*/
|
||||
NS_IMETHOD Parse(nsIURI* aURL,
|
||||
nsIRequestObserver* aListener = nsnull,
|
||||
void* aKey = 0,
|
||||
nsDTDMode aMode = eDTDMode_autodetect);
|
||||
|
||||
/**
|
||||
* @update gess5/11/98
|
||||
* @param anHTMLString contains a string-full of real HTML
|
||||
* @param appendTokens tells us whether we should insert tokens inline, or append them.
|
||||
* @return TRUE if all went well -- FALSE otherwise
|
||||
*/
|
||||
NS_IMETHOD Parse(const nsAString& aSourceBuffer,
|
||||
void* aKey,
|
||||
const nsACString& aContentType,
|
||||
PRBool aLastCall,
|
||||
nsDTDMode aMode = eDTDMode_autodetect);
|
||||
|
||||
NS_IMETHOD_(void *) GetRootContextKey();
|
||||
|
||||
NS_IMETHOD Terminate(void);
|
||||
|
||||
/**
|
||||
* This method needs documentation
|
||||
*/
|
||||
NS_IMETHOD ParseFragment(const nsAString& aSourceBuffer,
|
||||
void* aKey,
|
||||
nsTArray<nsString>& aTagStack,
|
||||
PRBool aXMLMode,
|
||||
const nsACString& aContentType,
|
||||
nsDTDMode aMode = eDTDMode_autodetect);
|
||||
|
||||
NS_IMETHOD ParseFragment(const nsAString& aSourceBuffer,
|
||||
nsISupports* aTargetNode,
|
||||
nsIAtom* aContextLocalName,
|
||||
PRInt32 aContextNamespace,
|
||||
PRBool aQuirks);
|
||||
|
||||
/**
|
||||
* This method gets called when the tokens have been consumed, and it's time
|
||||
* to build the model via the content sink.
|
||||
* @update gess5/11/98
|
||||
* @return YES if model building went well -- NO otherwise.
|
||||
*/
|
||||
NS_IMETHOD BuildModel(void);
|
||||
|
||||
/**
|
||||
* Retrieve the scanner from the topmost parser context
|
||||
*
|
||||
* @update gess 6/9/98
|
||||
* @return ptr to scanner
|
||||
*/
|
||||
NS_IMETHOD_(nsDTDMode) GetParseMode(void);
|
||||
|
||||
/**
|
||||
* Removes continue parsing events
|
||||
* @update kmcclusk 5/18/98
|
||||
*/
|
||||
|
||||
NS_IMETHODIMP CancelParsingEvents();
|
||||
|
||||
virtual void Reset();
|
||||
|
||||
/**
|
||||
* Tells the parser that a script is now executing. The only data we
|
||||
* should resume parsing for is document.written data. We'll deal with any
|
||||
* data that comes in over the network later.
|
||||
*/
|
||||
virtual void ScriptExecuting();
|
||||
|
||||
/**
|
||||
* Tells the parser that the script is done executing. We should now
|
||||
* continue the regular parsing process.
|
||||
*/
|
||||
virtual void ScriptDidExecute();
|
||||
|
||||
/* End nsIParser */
|
||||
|
||||
//*********************************************
|
||||
// These methods are callback methods used by
|
||||
// net lib to let us know about our inputstream.
|
||||
//*********************************************
|
||||
// nsIRequestObserver methods:
|
||||
NS_DECL_NSIREQUESTOBSERVER
|
||||
|
||||
// nsIStreamListener methods:
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
|
||||
/**
|
||||
* Fired when the continue parse event is triggered.
|
||||
* @update kmcclusk 5/18/98
|
||||
*/
|
||||
void HandleParserContinueEvent(class nsHtml5ParserContinueEvent *);
|
||||
|
||||
// EncodingDeclarationHandler
|
||||
|
||||
void internalEncodingDeclaration(nsString* aEncoding);
|
||||
|
||||
// DocumentModeHandler
|
||||
|
||||
void documentMode(nsHtml5DocumentMode m);
|
||||
|
||||
// nsICharsetDetectionObserver
|
||||
NS_IMETHOD Notify(const char* aCharset, nsDetectionConfident aConf);
|
||||
|
||||
// nsIContentSink
|
||||
|
||||
NS_IMETHOD WillParse();
|
||||
NS_IMETHOD WillBuildModel();
|
||||
NS_IMETHOD DidBuildModel();
|
||||
NS_IMETHOD WillInterrupt();
|
||||
NS_IMETHOD WillResume();
|
||||
NS_IMETHOD SetParser(nsIParser* aParser);
|
||||
virtual void FlushPendingNotifications(mozFlushType aType);
|
||||
NS_IMETHOD SetDocumentCharset(nsACString& aCharset);
|
||||
virtual nsISupports *GetTarget();
|
||||
|
||||
// Not from an external interface
|
||||
public:
|
||||
// nsContentSink methods
|
||||
virtual nsresult Initialize(nsIDocument* aDoc,
|
||||
nsIURI* aURI,
|
||||
nsISupports* aContainer,
|
||||
nsIChannel* aChannel);
|
||||
virtual nsresult ProcessBASETag(nsIContent* aContent);
|
||||
virtual void UpdateChildCounts();
|
||||
virtual nsresult FlushTags();
|
||||
virtual void PostEvaluateScript(nsIScriptElement *aElement);
|
||||
using nsContentSink::Notify;
|
||||
|
||||
// Non-inherited methods
|
||||
nsresult FinalizeSniffing(const PRUint8* aFromSegment,
|
||||
PRUint32 aCount,
|
||||
PRUint32* aWriteCount,
|
||||
PRUint32 aCountToSniffingLimit);
|
||||
nsresult SetupDecodingAndWriteSniffingBufferAndCurrentSegment(const PRUint8* aFromSegment,
|
||||
PRUint32 aCount,
|
||||
PRUint32* aWriteCount);
|
||||
nsresult WriteSniffingBufferAndCurrentSegment(const PRUint8* aFromSegment,
|
||||
PRUint32 aCount,
|
||||
PRUint32* aWriteCount);
|
||||
nsresult SetupDecodingFromBom(const char* aCharsetName,
|
||||
const char* aDecoderCharsetName);
|
||||
nsresult SniffStreamBytes(const PRUint8* aFromSegment,
|
||||
PRUint32 aCount,
|
||||
PRUint32* aWriteCount);
|
||||
nsresult WriteStreamBytes(const PRUint8* aFromSegment,
|
||||
PRUint32 aCount,
|
||||
PRUint32* aWriteCount);
|
||||
void Suspend();
|
||||
void SetScriptElement(nsIContent* aScript);
|
||||
void UpdateStyleSheet(nsIContent* aElement);
|
||||
// Getters and setters for fields from nsContentSink
|
||||
nsIDocument* GetDocument() {
|
||||
return mDocument;
|
||||
}
|
||||
nsNodeInfoManager* GetNodeInfoManager() {
|
||||
return mNodeInfoManager;
|
||||
}
|
||||
nsIDocShell* GetDocShell() {
|
||||
return mDocShell;
|
||||
}
|
||||
PRBool HasDecoder() {
|
||||
return !!mUnicodeDecoder;
|
||||
}
|
||||
void ReadyToCallDidBuildModelHtml5() {
|
||||
ReadyToCallDidBuildModelImpl(mTerminated);
|
||||
}
|
||||
private:
|
||||
void ExecuteScript();
|
||||
void MaybePostContinueEvent();
|
||||
nsresult PerformCharsetSwitch();
|
||||
/**
|
||||
* Parse until pending data is exhausted or tree builder suspends
|
||||
*/
|
||||
void ParseUntilSuspend();
|
||||
void Cleanup();
|
||||
|
||||
private:
|
||||
// State variables
|
||||
PRBool mNeedsCharsetSwitch;
|
||||
PRBool mLastWasCR;
|
||||
PRBool mTerminated;
|
||||
PRBool mLayoutStarted;
|
||||
PRBool mFragmentMode;
|
||||
PRBool mBlocked;
|
||||
PRBool mSuspending;
|
||||
eHtml5ParserLifecycle mLifeCycle;
|
||||
eStreamState mStreamListenerState;
|
||||
|
||||
// script execution
|
||||
nsCOMPtr<nsIContent> mScriptElement;
|
||||
PRUint32 mScriptsExecuting;
|
||||
|
||||
// Gecko integration
|
||||
void* mRootContextKey;
|
||||
nsCOMPtr<nsIRequest> mRequest;
|
||||
nsCOMPtr<nsIRequestObserver> mObserver;
|
||||
nsIRunnable* mContinueEvent; // weak ref
|
||||
|
||||
// tree-related stuff
|
||||
nsIContent* mDocElement; // weak ref
|
||||
|
||||
// encoding-related stuff
|
||||
PRInt32 mCharsetSource;
|
||||
nsCString mCharset;
|
||||
nsCString mPendingCharset;
|
||||
nsCOMPtr<nsIUnicodeDecoder> mUnicodeDecoder;
|
||||
PRUint8* mSniffingBuffer;
|
||||
PRUint32 mSniffingLength; // number of meaningful bytes in mSniffingBuffer
|
||||
eBomState mBomState;
|
||||
nsHtml5MetaScanner* mMetaScanner;
|
||||
|
||||
// Portable parser objects
|
||||
nsHtml5UTF16Buffer* mFirstBuffer; // manually managed strong ref
|
||||
nsHtml5UTF16Buffer* mLastBuffer; // weak ref; always points to
|
||||
// a buffer of the size NS_HTML5_PARSER_READ_BUFFER_SIZE
|
||||
nsHtml5TreeBuilder* mTreeBuilder; // manually managed strong ref
|
||||
nsHtml5Tokenizer* mTokenizer; // manually managed strong ref
|
||||
#ifdef DEBUG
|
||||
nsHtml5StateSnapshot* mSnapshot;
|
||||
static PRUint32 sUnsafeDocWrites;
|
||||
static PRUint32 sTokenSafeDocWrites;
|
||||
static PRUint32 sTreeSafeDocWrites;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
67
content/html/parser/src/nsHtml5PendingNotification.h
Normal file
67
content/html/parser/src/nsHtml5PendingNotification.h
Normal file
@ -0,0 +1,67 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is HTML Parser C++ Translator code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsHtml5PendingNotification_h__
|
||||
#define nsHtml5PendingNotification_h__
|
||||
|
||||
#include "nsNodeUtils.h"
|
||||
|
||||
class nsHtml5TreeBuilder;
|
||||
|
||||
class nsHtml5PendingNotification {
|
||||
public:
|
||||
nsHtml5PendingNotification(nsIContent* aParent)
|
||||
: mParent(aParent),
|
||||
mChildCount(aParent->GetChildCount())
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5PendingNotification);
|
||||
}
|
||||
~nsHtml5PendingNotification() {
|
||||
MOZ_COUNT_DTOR(nsHtml5PendingNotification);
|
||||
}
|
||||
inline void Fire() {
|
||||
nsNodeUtils::ContentAppended(mParent, mChildCount);
|
||||
}
|
||||
inline PRBool Contains(nsIContent* aNode) {
|
||||
return !!(mParent == aNode);
|
||||
}
|
||||
private:
|
||||
nsIContent* mParent;
|
||||
PRUint32 mChildCount;
|
||||
};
|
||||
|
||||
#endif // nsHtml5PendingNotification_h__
|
197
content/html/parser/src/nsHtml5Portability.cpp
Normal file
197
content/html/parser/src/nsHtml5Portability.cpp
Normal file
@ -0,0 +1,197 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is HTML Parser C++ Translator code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008-2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsString.h"
|
||||
#include "jArray.h"
|
||||
|
||||
#include "nsHtml5Portability.h"
|
||||
|
||||
|
||||
nsIAtom*
|
||||
nsHtml5Portability::newLocalNameFromBuffer(PRUnichar* buf, PRInt32 offset, PRInt32 length)
|
||||
{
|
||||
// Optimization opportunity: make buf itself null-terminated
|
||||
PRUnichar* nullTerminated = new PRUnichar[length + 1];
|
||||
memcpy(nullTerminated,buf, length * sizeof(PRUnichar));
|
||||
nullTerminated[length] = 0;
|
||||
nsIAtom* rv = NS_NewAtom(nullTerminated);
|
||||
delete[] nullTerminated;
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsString*
|
||||
nsHtml5Portability::newStringFromBuffer(PRUnichar* buf, PRInt32 offset, PRInt32 length)
|
||||
{
|
||||
return new nsString(buf + offset, length);
|
||||
}
|
||||
|
||||
nsString*
|
||||
nsHtml5Portability::newEmptyString()
|
||||
{
|
||||
return new nsString();
|
||||
}
|
||||
|
||||
nsString*
|
||||
nsHtml5Portability::newStringFromLiteral(const char* literal)
|
||||
{
|
||||
nsString* rv = new nsString();
|
||||
rv->AssignASCII(literal);
|
||||
return rv;
|
||||
}
|
||||
|
||||
jArray<PRUnichar,PRInt32>
|
||||
nsHtml5Portability::newCharArrayFromLocal(nsIAtom* local)
|
||||
{
|
||||
nsAutoString temp;
|
||||
local->ToString(temp);
|
||||
PRInt32 len = temp.Length();
|
||||
jArray<PRUnichar,PRInt32> rv = jArray<PRUnichar,PRInt32>(len);
|
||||
memcpy(rv, temp.BeginReading(), len * sizeof(PRUnichar));
|
||||
return rv;
|
||||
}
|
||||
|
||||
jArray<PRUnichar,PRInt32>
|
||||
nsHtml5Portability::newCharArrayFromString(nsString* string)
|
||||
{
|
||||
PRInt32 len = string->Length();
|
||||
jArray<PRUnichar,PRInt32> rv = jArray<PRUnichar,PRInt32>(len);
|
||||
memcpy(rv, string->BeginReading(), len * sizeof(PRUnichar));
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5Portability::releaseString(nsString* str)
|
||||
{
|
||||
delete str;
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5Portability::retainLocal(nsIAtom* local)
|
||||
{
|
||||
NS_IF_ADDREF(local);
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5Portability::releaseLocal(nsIAtom* local)
|
||||
{
|
||||
NS_IF_RELEASE(local);
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5Portability::retainElement(nsIContent* element)
|
||||
{
|
||||
NS_IF_ADDREF(element);
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5Portability::releaseElement(nsIContent* element)
|
||||
{
|
||||
NS_IF_RELEASE(element);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHtml5Portability::localEqualsBuffer(nsIAtom* local, PRUnichar* buf, PRInt32 offset, PRInt32 length)
|
||||
{
|
||||
nsAutoString temp = nsAutoString(buf + offset, length);
|
||||
return local->Equals(temp);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHtml5Portability::lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(const char* lowerCaseLiteral, nsString* string)
|
||||
{
|
||||
if (!string) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
const char* litPtr = lowerCaseLiteral;
|
||||
const PRUnichar* strPtr = string->BeginReading();
|
||||
const PRUnichar* end = string->EndReading();
|
||||
PRUnichar litChar;
|
||||
while ((litChar = (PRUnichar)*litPtr) && (strPtr < end)) {
|
||||
PRUnichar strChar = *strPtr;
|
||||
if (strChar >= 'A' && strChar <= 'Z') {
|
||||
strChar += 0x20;
|
||||
}
|
||||
if (litChar != strChar) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
++litPtr;
|
||||
++strPtr;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHtml5Portability::lowerCaseLiteralEqualsIgnoreAsciiCaseString(const char* lowerCaseLiteral, nsString* string)
|
||||
{
|
||||
if (!string) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
return string->LowerCaseEqualsASCII(lowerCaseLiteral);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHtml5Portability::literalEqualsString(const char* literal, nsString* string)
|
||||
{
|
||||
if (!string) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
return string->EqualsASCII(literal);
|
||||
}
|
||||
|
||||
jArray<PRUnichar,PRInt32>
|
||||
nsHtml5Portability::isIndexPrompt()
|
||||
{
|
||||
// Yeah, this whole method is uncool
|
||||
char* literal = "This is a searchable index. Insert your search keywords here: ";
|
||||
jArray<PRUnichar,PRInt32> rv = jArray<PRUnichar,PRInt32>(62);
|
||||
for (PRInt32 i = 0; i < 62; ++i) {
|
||||
rv[i] = literal[i];
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5Portability::initializeStatics()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5Portability::releaseStatics()
|
||||
{
|
||||
}
|
87
content/html/parser/src/nsHtml5Portability.h
Normal file
87
content/html/parser/src/nsHtml5Portability.h
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2009 Mozilla Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Please edit Portability.java instead and regenerate.
|
||||
*/
|
||||
|
||||
#ifndef nsHtml5Portability_h__
|
||||
#define nsHtml5Portability_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsString.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "jArray.h"
|
||||
#include "nsHtml5DocumentMode.h"
|
||||
#include "nsHtml5ArrayCopy.h"
|
||||
#include "nsHtml5NamedCharacters.h"
|
||||
#include "nsHtml5Parser.h"
|
||||
#include "nsHtml5Atoms.h"
|
||||
#include "nsHtml5ByteReadable.h"
|
||||
|
||||
class nsHtml5Parser;
|
||||
|
||||
class nsHtml5Tokenizer;
|
||||
class nsHtml5TreeBuilder;
|
||||
class nsHtml5MetaScanner;
|
||||
class nsHtml5AttributeName;
|
||||
class nsHtml5ElementName;
|
||||
class nsHtml5HtmlAttributes;
|
||||
class nsHtml5UTF16Buffer;
|
||||
class nsHtml5StateSnapshot;
|
||||
|
||||
|
||||
class nsHtml5Portability
|
||||
{
|
||||
public:
|
||||
static nsIAtom* newLocalNameFromBuffer(PRUnichar* buf, PRInt32 offset, PRInt32 length);
|
||||
static nsString* newStringFromBuffer(PRUnichar* buf, PRInt32 offset, PRInt32 length);
|
||||
static nsString* newEmptyString();
|
||||
static nsString* newStringFromLiteral(const char* literal);
|
||||
static jArray<PRUnichar,PRInt32> newCharArrayFromLocal(nsIAtom* local);
|
||||
static jArray<PRUnichar,PRInt32> newCharArrayFromString(nsString* string);
|
||||
static void releaseString(nsString* str);
|
||||
static void retainLocal(nsIAtom* local);
|
||||
static void releaseLocal(nsIAtom* local);
|
||||
static void retainElement(nsIContent* elt);
|
||||
static void releaseElement(nsIContent* elt);
|
||||
static PRBool localEqualsBuffer(nsIAtom* local, PRUnichar* buf, PRInt32 offset, PRInt32 length);
|
||||
static PRBool lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(const char* lowerCaseLiteral, nsString* string);
|
||||
static PRBool lowerCaseLiteralEqualsIgnoreAsciiCaseString(const char* lowerCaseLiteral, nsString* string);
|
||||
static PRBool literalEqualsString(const char* literal, nsString* string);
|
||||
static jArray<PRUnichar,PRInt32> isIndexPrompt();
|
||||
static void initializeStatics();
|
||||
static void releaseStatics();
|
||||
};
|
||||
|
||||
#ifdef nsHtml5Portability_cpp__
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
49
content/html/parser/src/nsHtml5ReleasableAttributeName.cpp
Normal file
49
content/html/parser/src/nsHtml5ReleasableAttributeName.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is HTML Parser C++ Translator code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsHtml5ReleasableAttributeName.h"
|
||||
|
||||
nsHtml5ReleasableAttributeName::nsHtml5ReleasableAttributeName(PRInt32* uri, nsIAtom** local, nsIAtom** prefix)
|
||||
: nsHtml5AttributeName(uri, local, prefix)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5ReleasableAttributeName::release()
|
||||
{
|
||||
delete this;
|
||||
}
|
50
content/html/parser/src/nsHtml5ReleasableAttributeName.h
Normal file
50
content/html/parser/src/nsHtml5ReleasableAttributeName.h
Normal file
@ -0,0 +1,50 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is HTML Parser C++ Translator code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsHtml5ReleasableAttributeName_h__
|
||||
#define nsHtml5ReleasableAttributeName_h__
|
||||
|
||||
#include "nsHtml5AttributeName.h"
|
||||
|
||||
class nsHtml5ReleasableAttributeName : public nsHtml5AttributeName
|
||||
{
|
||||
public:
|
||||
nsHtml5ReleasableAttributeName(PRInt32* uri, nsIAtom** local, nsIAtom** prefix);
|
||||
virtual void release();
|
||||
};
|
||||
|
||||
#endif // nsHtml5ReleasableAttributeName_h__
|
49
content/html/parser/src/nsHtml5ReleasableElementName.cpp
Normal file
49
content/html/parser/src/nsHtml5ReleasableElementName.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is HTML Parser C++ Translator code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsHtml5ReleasableElementName.h"
|
||||
|
||||
nsHtml5ReleasableElementName::nsHtml5ReleasableElementName(nsIAtom* name)
|
||||
: nsHtml5ElementName(name)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5ReleasableElementName::release()
|
||||
{
|
||||
delete this;
|
||||
}
|
50
content/html/parser/src/nsHtml5ReleasableElementName.h
Normal file
50
content/html/parser/src/nsHtml5ReleasableElementName.h
Normal file
@ -0,0 +1,50 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is HTML Parser C++ Translator code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsHtml5ReleasableElementName_h__
|
||||
#define nsHtml5ReleasableElementName_h__
|
||||
|
||||
#include "nsHtml5ElementName.h"
|
||||
|
||||
class nsHtml5ReleasableElementName : public nsHtml5ElementName
|
||||
{
|
||||
public:
|
||||
nsHtml5ReleasableElementName(nsIAtom* name);
|
||||
virtual void release();
|
||||
};
|
||||
|
||||
#endif // nsHtml5ReleasableElementName_h__
|
164
content/html/parser/src/nsHtml5StackNode.cpp
Normal file
164
content/html/parser/src/nsHtml5StackNode.cpp
Normal file
@ -0,0 +1,164 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Henri Sivonen
|
||||
* Copyright (c) 2007-2009 Mozilla Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Please edit StackNode.java instead and regenerate.
|
||||
*/
|
||||
|
||||
#define nsHtml5StackNode_cpp__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsString.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "jArray.h"
|
||||
#include "nsHtml5DocumentMode.h"
|
||||
#include "nsHtml5ArrayCopy.h"
|
||||
#include "nsHtml5NamedCharacters.h"
|
||||
#include "nsHtml5Parser.h"
|
||||
#include "nsHtml5Atoms.h"
|
||||
#include "nsHtml5ByteReadable.h"
|
||||
|
||||
#include "nsHtml5Tokenizer.h"
|
||||
#include "nsHtml5TreeBuilder.h"
|
||||
#include "nsHtml5MetaScanner.h"
|
||||
#include "nsHtml5AttributeName.h"
|
||||
#include "nsHtml5ElementName.h"
|
||||
#include "nsHtml5HtmlAttributes.h"
|
||||
#include "nsHtml5UTF16Buffer.h"
|
||||
#include "nsHtml5StateSnapshot.h"
|
||||
#include "nsHtml5Portability.h"
|
||||
|
||||
#include "nsHtml5StackNode.h"
|
||||
|
||||
|
||||
nsHtml5StackNode::nsHtml5StackNode(PRInt32 group, PRInt32 ns, nsIAtom* name, nsIContent* node, PRBool scoping, PRBool special, PRBool fosterParenting, nsIAtom* popName)
|
||||
: group(group),
|
||||
name(name),
|
||||
popName(popName),
|
||||
ns(ns),
|
||||
node(node),
|
||||
scoping(scoping),
|
||||
special(special),
|
||||
fosterParenting(fosterParenting),
|
||||
refcount(1)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5StackNode);
|
||||
nsHtml5Portability::retainLocal(name);
|
||||
nsHtml5Portability::retainLocal(popName);
|
||||
nsHtml5Portability::retainElement(node);
|
||||
}
|
||||
|
||||
|
||||
nsHtml5StackNode::nsHtml5StackNode(PRInt32 ns, nsHtml5ElementName* elementName, nsIContent* node)
|
||||
: group(elementName->group),
|
||||
name(elementName->name),
|
||||
popName(elementName->name),
|
||||
ns(ns),
|
||||
node(node),
|
||||
scoping(elementName->scoping),
|
||||
special(elementName->special),
|
||||
fosterParenting(elementName->fosterParenting),
|
||||
refcount(1)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5StackNode);
|
||||
nsHtml5Portability::retainLocal(name);
|
||||
nsHtml5Portability::retainLocal(popName);
|
||||
nsHtml5Portability::retainElement(node);
|
||||
}
|
||||
|
||||
|
||||
nsHtml5StackNode::nsHtml5StackNode(PRInt32 ns, nsHtml5ElementName* elementName, nsIContent* node, nsIAtom* popName)
|
||||
: group(elementName->group),
|
||||
name(elementName->name),
|
||||
popName(popName),
|
||||
ns(ns),
|
||||
node(node),
|
||||
scoping(elementName->scoping),
|
||||
special(elementName->special),
|
||||
fosterParenting(elementName->fosterParenting),
|
||||
refcount(1)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5StackNode);
|
||||
nsHtml5Portability::retainLocal(name);
|
||||
nsHtml5Portability::retainLocal(popName);
|
||||
nsHtml5Portability::retainElement(node);
|
||||
}
|
||||
|
||||
|
||||
nsHtml5StackNode::nsHtml5StackNode(PRInt32 ns, nsHtml5ElementName* elementName, nsIContent* node, nsIAtom* popName, PRBool scoping)
|
||||
: group(elementName->group),
|
||||
name(elementName->name),
|
||||
popName(popName),
|
||||
ns(ns),
|
||||
node(node),
|
||||
scoping(scoping),
|
||||
special(PR_FALSE),
|
||||
fosterParenting(PR_FALSE),
|
||||
refcount(1)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5StackNode);
|
||||
nsHtml5Portability::retainLocal(name);
|
||||
nsHtml5Portability::retainLocal(popName);
|
||||
nsHtml5Portability::retainElement(node);
|
||||
}
|
||||
|
||||
|
||||
nsHtml5StackNode::~nsHtml5StackNode()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsHtml5StackNode);
|
||||
nsHtml5Portability::releaseLocal(name);
|
||||
nsHtml5Portability::releaseLocal(popName);
|
||||
nsHtml5Portability::releaseElement(node);
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5StackNode::retain()
|
||||
{
|
||||
refcount++;
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5StackNode::release()
|
||||
{
|
||||
refcount--;
|
||||
if (!refcount) {
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5StackNode::initializeStatics()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5StackNode::releaseStatics()
|
||||
{
|
||||
}
|
||||
|
||||
|
91
content/html/parser/src/nsHtml5StackNode.h
Normal file
91
content/html/parser/src/nsHtml5StackNode.h
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Henri Sivonen
|
||||
* Copyright (c) 2007-2009 Mozilla Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Please edit StackNode.java instead and regenerate.
|
||||
*/
|
||||
|
||||
#ifndef nsHtml5StackNode_h__
|
||||
#define nsHtml5StackNode_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsString.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "jArray.h"
|
||||
#include "nsHtml5DocumentMode.h"
|
||||
#include "nsHtml5ArrayCopy.h"
|
||||
#include "nsHtml5NamedCharacters.h"
|
||||
#include "nsHtml5Parser.h"
|
||||
#include "nsHtml5Atoms.h"
|
||||
#include "nsHtml5ByteReadable.h"
|
||||
|
||||
class nsHtml5Parser;
|
||||
|
||||
class nsHtml5Tokenizer;
|
||||
class nsHtml5TreeBuilder;
|
||||
class nsHtml5MetaScanner;
|
||||
class nsHtml5AttributeName;
|
||||
class nsHtml5ElementName;
|
||||
class nsHtml5HtmlAttributes;
|
||||
class nsHtml5UTF16Buffer;
|
||||
class nsHtml5StateSnapshot;
|
||||
class nsHtml5Portability;
|
||||
|
||||
|
||||
class nsHtml5StackNode
|
||||
{
|
||||
public:
|
||||
PRInt32 group;
|
||||
nsIAtom* name;
|
||||
nsIAtom* popName;
|
||||
PRInt32 ns;
|
||||
nsIContent* node;
|
||||
PRBool scoping;
|
||||
PRBool special;
|
||||
PRBool fosterParenting;
|
||||
private:
|
||||
PRInt32 refcount;
|
||||
public:
|
||||
nsHtml5StackNode(PRInt32 group, PRInt32 ns, nsIAtom* name, nsIContent* node, PRBool scoping, PRBool special, PRBool fosterParenting, nsIAtom* popName);
|
||||
nsHtml5StackNode(PRInt32 ns, nsHtml5ElementName* elementName, nsIContent* node);
|
||||
nsHtml5StackNode(PRInt32 ns, nsHtml5ElementName* elementName, nsIContent* node, nsIAtom* popName);
|
||||
nsHtml5StackNode(PRInt32 ns, nsHtml5ElementName* elementName, nsIContent* node, nsIAtom* popName, PRBool scoping);
|
||||
~nsHtml5StackNode();
|
||||
void retain();
|
||||
void release();
|
||||
static void initializeStatics();
|
||||
static void releaseStatics();
|
||||
};
|
||||
|
||||
#ifdef nsHtml5StackNode_cpp__
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
93
content/html/parser/src/nsHtml5StateSnapshot.cpp
Normal file
93
content/html/parser/src/nsHtml5StateSnapshot.cpp
Normal file
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (c) 2009 Mozilla Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Please edit StateSnapshot.java instead and regenerate.
|
||||
*/
|
||||
|
||||
#define nsHtml5StateSnapshot_cpp__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsString.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "jArray.h"
|
||||
#include "nsHtml5DocumentMode.h"
|
||||
#include "nsHtml5ArrayCopy.h"
|
||||
#include "nsHtml5NamedCharacters.h"
|
||||
#include "nsHtml5Parser.h"
|
||||
#include "nsHtml5Atoms.h"
|
||||
#include "nsHtml5ByteReadable.h"
|
||||
|
||||
#include "nsHtml5Tokenizer.h"
|
||||
#include "nsHtml5TreeBuilder.h"
|
||||
#include "nsHtml5MetaScanner.h"
|
||||
#include "nsHtml5AttributeName.h"
|
||||
#include "nsHtml5ElementName.h"
|
||||
#include "nsHtml5HtmlAttributes.h"
|
||||
#include "nsHtml5StackNode.h"
|
||||
#include "nsHtml5UTF16Buffer.h"
|
||||
#include "nsHtml5Portability.h"
|
||||
|
||||
#include "nsHtml5StateSnapshot.h"
|
||||
|
||||
|
||||
nsHtml5StateSnapshot::nsHtml5StateSnapshot(jArray<nsHtml5StackNode*,PRInt32> stack, jArray<nsHtml5StackNode*,PRInt32> listOfActiveFormattingElements, nsIContent* formPointer)
|
||||
: stack(stack),
|
||||
listOfActiveFormattingElements(listOfActiveFormattingElements),
|
||||
formPointer(formPointer)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5StateSnapshot);
|
||||
}
|
||||
|
||||
|
||||
nsHtml5StateSnapshot::~nsHtml5StateSnapshot()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsHtml5StateSnapshot);
|
||||
for (PRInt32 i = 0; i < stack.length; i++) {
|
||||
stack[i]->release();
|
||||
}
|
||||
stack.release();
|
||||
for (PRInt32 i = 0; i < listOfActiveFormattingElements.length; i++) {
|
||||
if (!!listOfActiveFormattingElements[i]) {
|
||||
listOfActiveFormattingElements[i]->release();
|
||||
}
|
||||
}
|
||||
listOfActiveFormattingElements.release();
|
||||
nsHtml5Portability::retainElement(formPointer);
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5StateSnapshot::initializeStatics()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5StateSnapshot::releaseStatics()
|
||||
{
|
||||
}
|
||||
|
||||
|
76
content/html/parser/src/nsHtml5StateSnapshot.h
Normal file
76
content/html/parser/src/nsHtml5StateSnapshot.h
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) 2009 Mozilla Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Please edit StateSnapshot.java instead and regenerate.
|
||||
*/
|
||||
|
||||
#ifndef nsHtml5StateSnapshot_h__
|
||||
#define nsHtml5StateSnapshot_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsString.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "jArray.h"
|
||||
#include "nsHtml5DocumentMode.h"
|
||||
#include "nsHtml5ArrayCopy.h"
|
||||
#include "nsHtml5NamedCharacters.h"
|
||||
#include "nsHtml5Parser.h"
|
||||
#include "nsHtml5Atoms.h"
|
||||
#include "nsHtml5ByteReadable.h"
|
||||
|
||||
class nsHtml5Parser;
|
||||
|
||||
class nsHtml5Tokenizer;
|
||||
class nsHtml5TreeBuilder;
|
||||
class nsHtml5MetaScanner;
|
||||
class nsHtml5AttributeName;
|
||||
class nsHtml5ElementName;
|
||||
class nsHtml5HtmlAttributes;
|
||||
class nsHtml5UTF16Buffer;
|
||||
class nsHtml5Portability;
|
||||
|
||||
|
||||
class nsHtml5StateSnapshot
|
||||
{
|
||||
public:
|
||||
nsHtml5StateSnapshot(jArray<nsHtml5StackNode*,PRInt32> stack, jArray<nsHtml5StackNode*,PRInt32> listOfActiveFormattingElements, nsIContent* formPointer);
|
||||
jArray<nsHtml5StackNode*,PRInt32> stack;
|
||||
jArray<nsHtml5StackNode*,PRInt32> listOfActiveFormattingElements;
|
||||
nsIContent* formPointer;
|
||||
~nsHtml5StateSnapshot();
|
||||
static void initializeStatics();
|
||||
static void releaseStatics();
|
||||
};
|
||||
|
||||
#ifdef nsHtml5StateSnapshot_cpp__
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
2922
content/html/parser/src/nsHtml5Tokenizer.cpp
Normal file
2922
content/html/parser/src/nsHtml5Tokenizer.cpp
Normal file
File diff suppressed because it is too large
Load Diff
374
content/html/parser/src/nsHtml5Tokenizer.h
Normal file
374
content/html/parser/src/nsHtml5Tokenizer.h
Normal file
@ -0,0 +1,374 @@
|
||||
/*
|
||||
* Copyright (c) 2005-2007 Henri Sivonen
|
||||
* Copyright (c) 2007-2009 Mozilla Foundation
|
||||
* Portions of comments Copyright 2004-2008 Apple Computer, Inc., Mozilla
|
||||
* Foundation, and Opera Software ASA.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Please edit Tokenizer.java instead and regenerate.
|
||||
*/
|
||||
|
||||
#ifndef nsHtml5Tokenizer_h__
|
||||
#define nsHtml5Tokenizer_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsString.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "jArray.h"
|
||||
#include "nsHtml5DocumentMode.h"
|
||||
#include "nsHtml5ArrayCopy.h"
|
||||
#include "nsHtml5NamedCharacters.h"
|
||||
#include "nsHtml5Parser.h"
|
||||
#include "nsHtml5Atoms.h"
|
||||
#include "nsHtml5ByteReadable.h"
|
||||
|
||||
class nsHtml5Parser;
|
||||
|
||||
class nsHtml5TreeBuilder;
|
||||
class nsHtml5MetaScanner;
|
||||
class nsHtml5AttributeName;
|
||||
class nsHtml5ElementName;
|
||||
class nsHtml5HtmlAttributes;
|
||||
class nsHtml5UTF16Buffer;
|
||||
class nsHtml5StateSnapshot;
|
||||
class nsHtml5Portability;
|
||||
|
||||
|
||||
class nsHtml5Tokenizer
|
||||
{
|
||||
private:
|
||||
static PRUnichar LT_GT[];
|
||||
static PRUnichar LT_SOLIDUS[];
|
||||
static PRUnichar RSQB_RSQB[];
|
||||
static PRUnichar REPLACEMENT_CHARACTER[];
|
||||
static PRUnichar LF[];
|
||||
static PRUnichar CDATA_LSQB[];
|
||||
static PRUnichar OCTYPE[];
|
||||
static PRUnichar UBLIC[];
|
||||
static PRUnichar YSTEM[];
|
||||
#ifdef nsHtml5Tokenizer_cpp__
|
||||
static PRUnichar TITLE_ARR_DATA[];
|
||||
#endif
|
||||
static jArray<PRUnichar,PRInt32> TITLE_ARR;
|
||||
#ifdef nsHtml5Tokenizer_cpp__
|
||||
static PRUnichar SCRIPT_ARR_DATA[];
|
||||
#endif
|
||||
static jArray<PRUnichar,PRInt32> SCRIPT_ARR;
|
||||
#ifdef nsHtml5Tokenizer_cpp__
|
||||
static PRUnichar STYLE_ARR_DATA[];
|
||||
#endif
|
||||
static jArray<PRUnichar,PRInt32> STYLE_ARR;
|
||||
#ifdef nsHtml5Tokenizer_cpp__
|
||||
static PRUnichar PLAINTEXT_ARR_DATA[];
|
||||
#endif
|
||||
static jArray<PRUnichar,PRInt32> PLAINTEXT_ARR;
|
||||
#ifdef nsHtml5Tokenizer_cpp__
|
||||
static PRUnichar XMP_ARR_DATA[];
|
||||
#endif
|
||||
static jArray<PRUnichar,PRInt32> XMP_ARR;
|
||||
#ifdef nsHtml5Tokenizer_cpp__
|
||||
static PRUnichar TEXTAREA_ARR_DATA[];
|
||||
#endif
|
||||
static jArray<PRUnichar,PRInt32> TEXTAREA_ARR;
|
||||
#ifdef nsHtml5Tokenizer_cpp__
|
||||
static PRUnichar IFRAME_ARR_DATA[];
|
||||
#endif
|
||||
static jArray<PRUnichar,PRInt32> IFRAME_ARR;
|
||||
#ifdef nsHtml5Tokenizer_cpp__
|
||||
static PRUnichar NOEMBED_ARR_DATA[];
|
||||
#endif
|
||||
static jArray<PRUnichar,PRInt32> NOEMBED_ARR;
|
||||
#ifdef nsHtml5Tokenizer_cpp__
|
||||
static PRUnichar NOSCRIPT_ARR_DATA[];
|
||||
#endif
|
||||
static jArray<PRUnichar,PRInt32> NOSCRIPT_ARR;
|
||||
#ifdef nsHtml5Tokenizer_cpp__
|
||||
static PRUnichar NOFRAMES_ARR_DATA[];
|
||||
#endif
|
||||
static jArray<PRUnichar,PRInt32> NOFRAMES_ARR;
|
||||
nsHtml5TreeBuilder* tokenHandler;
|
||||
nsHtml5Parser* encodingDeclarationHandler;
|
||||
PRUnichar prev;
|
||||
PRInt32 line;
|
||||
PRInt32 linePrev;
|
||||
PRInt32 col;
|
||||
PRInt32 colPrev;
|
||||
PRBool nextCharOnNewLine;
|
||||
PRInt32 stateSave;
|
||||
PRInt32 returnStateSave;
|
||||
PRInt32 index;
|
||||
PRBool forceQuirks;
|
||||
PRUnichar additional;
|
||||
PRInt32 entCol;
|
||||
PRInt32 lo;
|
||||
PRInt32 hi;
|
||||
PRInt32 candidate;
|
||||
PRInt32 strBufMark;
|
||||
PRInt32 prevValue;
|
||||
PRInt32 value;
|
||||
PRBool seenDigits;
|
||||
PRInt32 pos;
|
||||
PRInt32 endPos;
|
||||
PRUnichar* buf;
|
||||
PRInt32 cstart;
|
||||
nsString* publicId;
|
||||
nsString* systemId;
|
||||
jArray<PRUnichar,PRInt32> strBuf;
|
||||
PRInt32 strBufLen;
|
||||
jArray<PRUnichar,PRInt32> longStrBuf;
|
||||
PRInt32 longStrBufLen;
|
||||
nsHtml5HtmlAttributes* attributes;
|
||||
jArray<PRUnichar,PRInt32> bmpChar;
|
||||
jArray<PRUnichar,PRInt32> astralChar;
|
||||
PRBool alreadyWarnedAboutPrivateUseCharacters;
|
||||
nsHtml5ElementName* contentModelElement;
|
||||
jArray<PRUnichar,PRInt32> contentModelElementNameAsArray;
|
||||
PRBool endTag;
|
||||
nsHtml5ElementName* tagName;
|
||||
nsHtml5AttributeName* attributeName;
|
||||
nsIAtom* doctypeName;
|
||||
nsString* publicIdentifier;
|
||||
nsString* systemIdentifier;
|
||||
PRInt32 mappingLangToXmlLang;
|
||||
PRBool shouldSuspend;
|
||||
PRBool confident;
|
||||
public:
|
||||
nsHtml5Tokenizer(nsHtml5TreeBuilder* tokenHandler, nsHtml5Parser* encodingDeclarationHandler);
|
||||
void initLocation(nsString* newPublicId, nsString* newSystemId);
|
||||
~nsHtml5Tokenizer();
|
||||
void setContentModelFlag(PRInt32 contentModelFlag, nsIAtom* contentModelElement);
|
||||
void setContentModelFlag(PRInt32 contentModelFlag, nsHtml5ElementName* contentModelElement);
|
||||
private:
|
||||
void contentModelElementToArray();
|
||||
public:
|
||||
nsString* getPublicId();
|
||||
nsString* getSystemId();
|
||||
PRInt32 getLineNumber();
|
||||
PRInt32 getColumnNumber();
|
||||
nsHtml5HtmlAttributes* emptyAttributes();
|
||||
private:
|
||||
void detachStrBuf();
|
||||
void detachLongStrBuf();
|
||||
void clearStrBufAndAppendCurrentC(PRUnichar c);
|
||||
void clearStrBufAndAppendForceWrite(PRUnichar c);
|
||||
void clearStrBufForNextState();
|
||||
void appendStrBuf(PRUnichar c);
|
||||
void appendStrBufForceWrite(PRUnichar c);
|
||||
nsString* strBufToString();
|
||||
nsIAtom* strBufToDoctypeName();
|
||||
void emitStrBuf();
|
||||
void clearLongStrBufForNextState();
|
||||
void clearLongStrBuf();
|
||||
void clearLongStrBufAndAppendCurrentC();
|
||||
void clearLongStrBufAndAppendToComment(PRUnichar c);
|
||||
void appendLongStrBuf(PRUnichar c);
|
||||
void appendSecondHyphenToBogusComment();
|
||||
void adjustDoubleHyphenAndAppendToLongStrBuf(PRUnichar c);
|
||||
void appendLongStrBuf(jArray<PRUnichar,PRInt32> buffer, PRInt32 offset, PRInt32 length);
|
||||
void appendLongStrBuf(jArray<PRUnichar,PRInt32> arr);
|
||||
void appendStrBufToLongStrBuf();
|
||||
nsString* longStrBufToString();
|
||||
void emitComment(PRInt32 provisionalHyphens);
|
||||
PRBool isPrivateUse(PRUnichar c);
|
||||
PRBool isAstralPrivateUse(PRInt32 c);
|
||||
PRBool isNonCharacter(PRInt32 c);
|
||||
void flushChars();
|
||||
void resetAttributes();
|
||||
nsHtml5ElementName* strBufToElementNameString();
|
||||
PRInt32 emitCurrentTagToken(PRBool selfClosing);
|
||||
void attributeNameComplete();
|
||||
void addAttributeWithoutValue();
|
||||
void addAttributeWithValue();
|
||||
public:
|
||||
void start();
|
||||
PRBool tokenizeBuffer(nsHtml5UTF16Buffer* buffer);
|
||||
private:
|
||||
void stateLoop(PRInt32 state, PRUnichar c, PRBool reconsume, PRInt32 returnState);
|
||||
void rememberAmpersandLocation();
|
||||
void bogusDoctype();
|
||||
void bogusDoctypeWithoutQuirks();
|
||||
void emitOrAppendStrBuf(PRInt32 returnState);
|
||||
void handleNcrValue(PRInt32 returnState);
|
||||
public:
|
||||
void eof();
|
||||
private:
|
||||
void emitDoctypeToken();
|
||||
inline PRUnichar read()
|
||||
{
|
||||
PRUnichar c;
|
||||
pos++;
|
||||
if (pos == endPos) {
|
||||
return '\0';
|
||||
}
|
||||
linePrev = line;
|
||||
colPrev = col;
|
||||
if (nextCharOnNewLine) {
|
||||
line++;
|
||||
col = 1;
|
||||
nextCharOnNewLine = PR_FALSE;
|
||||
} else {
|
||||
col++;
|
||||
}
|
||||
c = buf[pos];
|
||||
switch(c) {
|
||||
case '\r': {
|
||||
nextCharOnNewLine = PR_TRUE;
|
||||
buf[pos] = '\n';
|
||||
prev = '\r';
|
||||
return '\n';
|
||||
}
|
||||
case '\n': {
|
||||
if (prev == '\r') {
|
||||
return '\0';
|
||||
}
|
||||
nextCharOnNewLine = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
case '\0': {
|
||||
c = buf[pos] = 0xfffd;
|
||||
break;
|
||||
}
|
||||
}
|
||||
prev = c;
|
||||
return c;
|
||||
}
|
||||
|
||||
public:
|
||||
void internalEncodingDeclaration(nsString* internalCharset);
|
||||
private:
|
||||
void emitOrAppend(jArray<PRUnichar,PRInt32> val, PRInt32 returnState);
|
||||
void emitOrAppendOne(PRUnichar* val, PRInt32 returnState);
|
||||
public:
|
||||
void end();
|
||||
void requestSuspension();
|
||||
void becomeConfident();
|
||||
PRBool isNextCharOnNewLine();
|
||||
PRBool isPrevCR();
|
||||
PRInt32 getLine();
|
||||
PRInt32 getCol();
|
||||
PRBool isInDataState();
|
||||
static void initializeStatics();
|
||||
static void releaseStatics();
|
||||
};
|
||||
|
||||
#ifdef nsHtml5Tokenizer_cpp__
|
||||
PRUnichar nsHtml5Tokenizer::LT_GT[] = { '<', '>' };
|
||||
PRUnichar nsHtml5Tokenizer::LT_SOLIDUS[] = { '<', '/' };
|
||||
PRUnichar nsHtml5Tokenizer::RSQB_RSQB[] = { ']', ']' };
|
||||
PRUnichar nsHtml5Tokenizer::REPLACEMENT_CHARACTER[] = { 0xfffd };
|
||||
PRUnichar nsHtml5Tokenizer::LF[] = { '\n' };
|
||||
PRUnichar nsHtml5Tokenizer::CDATA_LSQB[] = { 'C', 'D', 'A', 'T', 'A', '[' };
|
||||
PRUnichar nsHtml5Tokenizer::OCTYPE[] = { 'o', 'c', 't', 'y', 'p', 'e' };
|
||||
PRUnichar nsHtml5Tokenizer::UBLIC[] = { 'u', 'b', 'l', 'i', 'c' };
|
||||
PRUnichar nsHtml5Tokenizer::YSTEM[] = { 'y', 's', 't', 'e', 'm' };
|
||||
PRUnichar nsHtml5Tokenizer::TITLE_ARR_DATA[] = { 't', 'i', 't', 'l', 'e' };
|
||||
jArray<PRUnichar,PRInt32> nsHtml5Tokenizer::TITLE_ARR = J_ARRAY_STATIC(PRUnichar, PRInt32, TITLE_ARR_DATA);
|
||||
PRUnichar nsHtml5Tokenizer::SCRIPT_ARR_DATA[] = { 's', 'c', 'r', 'i', 'p', 't' };
|
||||
jArray<PRUnichar,PRInt32> nsHtml5Tokenizer::SCRIPT_ARR = J_ARRAY_STATIC(PRUnichar, PRInt32, SCRIPT_ARR_DATA);
|
||||
PRUnichar nsHtml5Tokenizer::STYLE_ARR_DATA[] = { 's', 't', 'y', 'l', 'e' };
|
||||
jArray<PRUnichar,PRInt32> nsHtml5Tokenizer::STYLE_ARR = J_ARRAY_STATIC(PRUnichar, PRInt32, STYLE_ARR_DATA);
|
||||
PRUnichar nsHtml5Tokenizer::PLAINTEXT_ARR_DATA[] = { 'p', 'l', 'a', 'i', 'n', 't', 'e', 'x', 't' };
|
||||
jArray<PRUnichar,PRInt32> nsHtml5Tokenizer::PLAINTEXT_ARR = J_ARRAY_STATIC(PRUnichar, PRInt32, PLAINTEXT_ARR_DATA);
|
||||
PRUnichar nsHtml5Tokenizer::XMP_ARR_DATA[] = { 'x', 'm', 'p' };
|
||||
jArray<PRUnichar,PRInt32> nsHtml5Tokenizer::XMP_ARR = J_ARRAY_STATIC(PRUnichar, PRInt32, XMP_ARR_DATA);
|
||||
PRUnichar nsHtml5Tokenizer::TEXTAREA_ARR_DATA[] = { 't', 'e', 'x', 't', 'a', 'r', 'e', 'a' };
|
||||
jArray<PRUnichar,PRInt32> nsHtml5Tokenizer::TEXTAREA_ARR = J_ARRAY_STATIC(PRUnichar, PRInt32, TEXTAREA_ARR_DATA);
|
||||
PRUnichar nsHtml5Tokenizer::IFRAME_ARR_DATA[] = { 'i', 'f', 'r', 'a', 'm', 'e' };
|
||||
jArray<PRUnichar,PRInt32> nsHtml5Tokenizer::IFRAME_ARR = J_ARRAY_STATIC(PRUnichar, PRInt32, IFRAME_ARR_DATA);
|
||||
PRUnichar nsHtml5Tokenizer::NOEMBED_ARR_DATA[] = { 'n', 'o', 'e', 'm', 'b', 'e', 'd' };
|
||||
jArray<PRUnichar,PRInt32> nsHtml5Tokenizer::NOEMBED_ARR = J_ARRAY_STATIC(PRUnichar, PRInt32, NOEMBED_ARR_DATA);
|
||||
PRUnichar nsHtml5Tokenizer::NOSCRIPT_ARR_DATA[] = { 'n', 'o', 's', 'c', 'r', 'i', 'p', 't' };
|
||||
jArray<PRUnichar,PRInt32> nsHtml5Tokenizer::NOSCRIPT_ARR = J_ARRAY_STATIC(PRUnichar, PRInt32, NOSCRIPT_ARR_DATA);
|
||||
PRUnichar nsHtml5Tokenizer::NOFRAMES_ARR_DATA[] = { 'n', 'o', 'f', 'r', 'a', 'm', 'e', 's' };
|
||||
jArray<PRUnichar,PRInt32> nsHtml5Tokenizer::NOFRAMES_ARR = J_ARRAY_STATIC(PRUnichar, PRInt32, NOFRAMES_ARR_DATA);
|
||||
#endif
|
||||
|
||||
#define NS_HTML5TOKENIZER_DATA 0
|
||||
#define NS_HTML5TOKENIZER_RCDATA 1
|
||||
#define NS_HTML5TOKENIZER_CDATA 2
|
||||
#define NS_HTML5TOKENIZER_PLAINTEXT 3
|
||||
#define NS_HTML5TOKENIZER_TAG_OPEN 49
|
||||
#define NS_HTML5TOKENIZER_CLOSE_TAG_OPEN_PCDATA 50
|
||||
#define NS_HTML5TOKENIZER_TAG_NAME 58
|
||||
#define NS_HTML5TOKENIZER_BEFORE_ATTRIBUTE_NAME 4
|
||||
#define NS_HTML5TOKENIZER_ATTRIBUTE_NAME 5
|
||||
#define NS_HTML5TOKENIZER_AFTER_ATTRIBUTE_NAME 6
|
||||
#define NS_HTML5TOKENIZER_BEFORE_ATTRIBUTE_VALUE 7
|
||||
#define NS_HTML5TOKENIZER_ATTRIBUTE_VALUE_DOUBLE_QUOTED 8
|
||||
#define NS_HTML5TOKENIZER_ATTRIBUTE_VALUE_SINGLE_QUOTED 9
|
||||
#define NS_HTML5TOKENIZER_ATTRIBUTE_VALUE_UNQUOTED 10
|
||||
#define NS_HTML5TOKENIZER_AFTER_ATTRIBUTE_VALUE_QUOTED 11
|
||||
#define NS_HTML5TOKENIZER_BOGUS_COMMENT 12
|
||||
#define NS_HTML5TOKENIZER_MARKUP_DECLARATION_OPEN 13
|
||||
#define NS_HTML5TOKENIZER_DOCTYPE 14
|
||||
#define NS_HTML5TOKENIZER_BEFORE_DOCTYPE_NAME 15
|
||||
#define NS_HTML5TOKENIZER_DOCTYPE_NAME 16
|
||||
#define NS_HTML5TOKENIZER_AFTER_DOCTYPE_NAME 17
|
||||
#define NS_HTML5TOKENIZER_BEFORE_DOCTYPE_PUBLIC_IDENTIFIER 18
|
||||
#define NS_HTML5TOKENIZER_DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED 19
|
||||
#define NS_HTML5TOKENIZER_DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED 20
|
||||
#define NS_HTML5TOKENIZER_AFTER_DOCTYPE_PUBLIC_IDENTIFIER 21
|
||||
#define NS_HTML5TOKENIZER_BEFORE_DOCTYPE_SYSTEM_IDENTIFIER 22
|
||||
#define NS_HTML5TOKENIZER_DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED 23
|
||||
#define NS_HTML5TOKENIZER_DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED 24
|
||||
#define NS_HTML5TOKENIZER_AFTER_DOCTYPE_SYSTEM_IDENTIFIER 25
|
||||
#define NS_HTML5TOKENIZER_BOGUS_DOCTYPE 26
|
||||
#define NS_HTML5TOKENIZER_COMMENT_START 27
|
||||
#define NS_HTML5TOKENIZER_COMMENT_START_DASH 28
|
||||
#define NS_HTML5TOKENIZER_COMMENT 29
|
||||
#define NS_HTML5TOKENIZER_COMMENT_END_DASH 30
|
||||
#define NS_HTML5TOKENIZER_COMMENT_END 31
|
||||
#define NS_HTML5TOKENIZER_CLOSE_TAG_OPEN_NOT_PCDATA 32
|
||||
#define NS_HTML5TOKENIZER_MARKUP_DECLARATION_HYPHEN 33
|
||||
#define NS_HTML5TOKENIZER_MARKUP_DECLARATION_OCTYPE 34
|
||||
#define NS_HTML5TOKENIZER_DOCTYPE_UBLIC 35
|
||||
#define NS_HTML5TOKENIZER_DOCTYPE_YSTEM 36
|
||||
#define NS_HTML5TOKENIZER_CONSUME_CHARACTER_REFERENCE 37
|
||||
#define NS_HTML5TOKENIZER_CONSUME_NCR 38
|
||||
#define NS_HTML5TOKENIZER_CHARACTER_REFERENCE_LOOP 39
|
||||
#define NS_HTML5TOKENIZER_HEX_NCR_LOOP 41
|
||||
#define NS_HTML5TOKENIZER_DECIMAL_NRC_LOOP 42
|
||||
#define NS_HTML5TOKENIZER_HANDLE_NCR_VALUE 43
|
||||
#define NS_HTML5TOKENIZER_SELF_CLOSING_START_TAG 44
|
||||
#define NS_HTML5TOKENIZER_CDATA_START 45
|
||||
#define NS_HTML5TOKENIZER_CDATA_SECTION 46
|
||||
#define NS_HTML5TOKENIZER_CDATA_RSQB 47
|
||||
#define NS_HTML5TOKENIZER_CDATA_RSQB_RSQB 48
|
||||
#define NS_HTML5TOKENIZER_TAG_OPEN_NON_PCDATA 51
|
||||
#define NS_HTML5TOKENIZER_ESCAPE_EXCLAMATION 52
|
||||
#define NS_HTML5TOKENIZER_ESCAPE_EXCLAMATION_HYPHEN 53
|
||||
#define NS_HTML5TOKENIZER_ESCAPE 54
|
||||
#define NS_HTML5TOKENIZER_ESCAPE_HYPHEN 55
|
||||
#define NS_HTML5TOKENIZER_ESCAPE_HYPHEN_HYPHEN 56
|
||||
#define NS_HTML5TOKENIZER_BOGUS_COMMENT_HYPHEN 57
|
||||
#define NS_HTML5TOKENIZER_LEAD_OFFSET (0xD800 - (0x10000 >> 10))
|
||||
#define NS_HTML5TOKENIZER_SURROGATE_OFFSET (0x10000 - (0xD800 << 10) - 0xDC00)
|
||||
#define NS_HTML5TOKENIZER_BUFFER_GROW_BY 1024
|
||||
|
||||
|
||||
#endif
|
||||
|
3707
content/html/parser/src/nsHtml5TreeBuilder.cpp
Normal file
3707
content/html/parser/src/nsHtml5TreeBuilder.cpp
Normal file
File diff suppressed because it is too large
Load Diff
328
content/html/parser/src/nsHtml5TreeBuilder.h
Normal file
328
content/html/parser/src/nsHtml5TreeBuilder.h
Normal file
@ -0,0 +1,328 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Henri Sivonen
|
||||
* Copyright (c) 2007-2009 Mozilla Foundation
|
||||
* Portions of comments Copyright 2004-2008 Apple Computer, Inc., Mozilla
|
||||
* Foundation, and Opera Software ASA.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Please edit TreeBuilder.java instead and regenerate.
|
||||
*/
|
||||
|
||||
#ifndef nsHtml5TreeBuilder_h__
|
||||
#define nsHtml5TreeBuilder_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsString.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "jArray.h"
|
||||
#include "nsHtml5DocumentMode.h"
|
||||
#include "nsHtml5ArrayCopy.h"
|
||||
#include "nsHtml5NamedCharacters.h"
|
||||
#include "nsHtml5Parser.h"
|
||||
#include "nsHtml5Atoms.h"
|
||||
#include "nsHtml5ByteReadable.h"
|
||||
#include "nsHtml5TreeOperation.h"
|
||||
#include "nsHtml5PendingNotification.h"
|
||||
#include "nsHtml5StateSnapshot.h"
|
||||
#include "nsHtml5StackNode.h"
|
||||
|
||||
class nsHtml5Parser;
|
||||
|
||||
class nsHtml5Tokenizer;
|
||||
class nsHtml5MetaScanner;
|
||||
class nsHtml5AttributeName;
|
||||
class nsHtml5ElementName;
|
||||
class nsHtml5HtmlAttributes;
|
||||
class nsHtml5UTF16Buffer;
|
||||
class nsHtml5StateSnapshot;
|
||||
class nsHtml5Portability;
|
||||
|
||||
typedef nsIContent* nsIContentPtr;
|
||||
|
||||
class nsHtml5TreeBuilder
|
||||
{
|
||||
private:
|
||||
static jArray<PRUnichar,PRInt32> ISINDEX_PROMPT;
|
||||
static jArray<const char*,PRInt32> QUIRKY_PUBLIC_IDS;
|
||||
PRInt32 mode;
|
||||
PRInt32 originalMode;
|
||||
PRInt32 foreignFlag;
|
||||
protected:
|
||||
nsHtml5Tokenizer* tokenizer;
|
||||
private:
|
||||
nsHtml5Parser* documentModeHandler;
|
||||
PRBool scriptingEnabled;
|
||||
PRBool needToDropLF;
|
||||
PRBool fragment;
|
||||
nsIAtom* contextName;
|
||||
PRInt32 contextNamespace;
|
||||
nsIContent* contextNode;
|
||||
jArray<nsHtml5StackNode*,PRInt32> stack;
|
||||
PRInt32 currentPtr;
|
||||
jArray<nsHtml5StackNode*,PRInt32> listOfActiveFormattingElements;
|
||||
PRInt32 listPtr;
|
||||
nsIContent* formPointer;
|
||||
nsIContent* headPointer;
|
||||
protected:
|
||||
jArray<PRUnichar,PRInt32> charBuffer;
|
||||
PRInt32 charBufferLen;
|
||||
private:
|
||||
PRBool quirks;
|
||||
public:
|
||||
void startTokenization(nsHtml5Tokenizer* self);
|
||||
void doctype(nsIAtom* name, nsString* publicIdentifier, nsString* systemIdentifier, PRBool forceQuirks);
|
||||
void comment(PRUnichar* buf, PRInt32 start, PRInt32 length);
|
||||
void characters(PRUnichar* buf, PRInt32 start, PRInt32 length);
|
||||
void eof();
|
||||
void endTokenization();
|
||||
void startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes, PRBool selfClosing);
|
||||
static nsString* extractCharsetFromContent(nsString* attributeValue);
|
||||
private:
|
||||
void checkMetaCharset(nsHtml5HtmlAttributes* attributes);
|
||||
public:
|
||||
void endTag(nsHtml5ElementName* elementName);
|
||||
private:
|
||||
void endSelect();
|
||||
PRInt32 findLastInTableScopeOrRootTbodyTheadTfoot();
|
||||
PRInt32 findLast(nsIAtom* name);
|
||||
PRInt32 findLastInTableScope(nsIAtom* name);
|
||||
PRInt32 findLastInScope(nsIAtom* name);
|
||||
PRInt32 findLastInScopeHn();
|
||||
PRBool hasForeignInScope();
|
||||
void generateImpliedEndTagsExceptFor(nsIAtom* name);
|
||||
void generateImpliedEndTags();
|
||||
PRBool isSecondOnStackBody();
|
||||
void documentModeInternal(nsHtml5DocumentMode m, nsString* publicIdentifier, nsString* systemIdentifier, PRBool html4SpecificAdditionalErrorChecks);
|
||||
PRBool isAlmostStandards(nsString* publicIdentifier, nsString* systemIdentifier);
|
||||
PRBool isQuirky(nsIAtom* name, nsString* publicIdentifier, nsString* systemIdentifier, PRBool forceQuirks);
|
||||
void closeTheCell(PRInt32 eltPos);
|
||||
PRInt32 findLastInTableScopeTdTh();
|
||||
void clearStackBackTo(PRInt32 eltPos);
|
||||
void resetTheInsertionMode();
|
||||
void implicitlyCloseP();
|
||||
PRBool clearLastStackSlot();
|
||||
PRBool clearLastListSlot();
|
||||
void push(nsHtml5StackNode* node);
|
||||
void append(nsHtml5StackNode* node);
|
||||
inline void insertMarker()
|
||||
{
|
||||
append(nsnull);
|
||||
}
|
||||
|
||||
void clearTheListOfActiveFormattingElementsUpToTheLastMarker();
|
||||
inline PRBool isCurrent(nsIAtom* name)
|
||||
{
|
||||
return name == stack[currentPtr]->name;
|
||||
}
|
||||
|
||||
void removeFromStack(PRInt32 pos);
|
||||
void removeFromStack(nsHtml5StackNode* node);
|
||||
void removeFromListOfActiveFormattingElements(PRInt32 pos);
|
||||
void adoptionAgencyEndTag(nsIAtom* name);
|
||||
void insertIntoStack(nsHtml5StackNode* node, PRInt32 position);
|
||||
void insertIntoListOfActiveFormattingElements(nsHtml5StackNode* formattingClone, PRInt32 bookmark);
|
||||
PRInt32 findInListOfActiveFormattingElements(nsHtml5StackNode* node);
|
||||
PRInt32 findInListOfActiveFormattingElementsContainsBetweenEndAndLastMarker(nsIAtom* name);
|
||||
PRInt32 findLastOrRoot(nsIAtom* name);
|
||||
PRInt32 findLastOrRoot(PRInt32 group);
|
||||
void addAttributesToBody(nsHtml5HtmlAttributes* attributes);
|
||||
void addAttributesToHtml(nsHtml5HtmlAttributes* attributes);
|
||||
void pushHeadPointerOntoStack();
|
||||
void reconstructTheActiveFormattingElements();
|
||||
void insertIntoFosterParent(nsIContent* child);
|
||||
PRBool isInStack(nsHtml5StackNode* node);
|
||||
void pop();
|
||||
void appendHtmlElementToDocumentAndPush(nsHtml5HtmlAttributes* attributes);
|
||||
void appendHtmlElementToDocumentAndPush();
|
||||
void appendToCurrentNodeAndPushHeadElement(nsHtml5HtmlAttributes* attributes);
|
||||
void appendToCurrentNodeAndPushBodyElement(nsHtml5HtmlAttributes* attributes);
|
||||
void appendToCurrentNodeAndPushBodyElement();
|
||||
void appendToCurrentNodeAndPushFormElementMayFoster(nsHtml5HtmlAttributes* attributes);
|
||||
void appendToCurrentNodeAndPushFormattingElementMayFoster(PRInt32 ns, nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
|
||||
void appendToCurrentNodeAndPushElement(PRInt32 ns, nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
|
||||
void appendToCurrentNodeAndPushElementMayFoster(PRInt32 ns, nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
|
||||
void appendToCurrentNodeAndPushElementMayFosterNoScoping(PRInt32 ns, nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
|
||||
void appendToCurrentNodeAndPushElementMayFosterCamelCase(PRInt32 ns, nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
|
||||
void appendToCurrentNodeAndPushElementMayFoster(PRInt32 ns, nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes, nsIContent* form);
|
||||
void appendVoidElementToCurrentMayFoster(PRInt32 ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContent* form);
|
||||
void appendVoidElementToCurrentMayFoster(PRInt32 ns, nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
|
||||
void appendVoidElementToCurrentMayFosterCamelCase(PRInt32 ns, nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
|
||||
void appendVoidElementToCurrent(PRInt32 ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContent* form);
|
||||
protected:
|
||||
void accumulateCharacters(PRUnichar* buf, PRInt32 start, PRInt32 length);
|
||||
void accumulateCharacter(PRUnichar c);
|
||||
void requestSuspension();
|
||||
nsIContent* createElement(PRInt32 ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes);
|
||||
nsIContent* createElement(PRInt32 ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContent* form);
|
||||
nsIContent* createHtmlElementSetAsRoot(nsHtml5HtmlAttributes* attributes);
|
||||
void detachFromParent(nsIContent* element);
|
||||
PRBool hasChildren(nsIContent* element);
|
||||
nsIContent* shallowClone(nsIContent* element);
|
||||
void appendElement(nsIContent* child, nsIContent* newParent);
|
||||
void appendChildrenToNewParent(nsIContent* oldParent, nsIContent* newParent);
|
||||
void insertFosterParentedChild(nsIContent* child, nsIContent* table, nsIContent* stackParent);
|
||||
void insertFosterParentedCharacters(PRUnichar* buf, PRInt32 start, PRInt32 length, nsIContent* table, nsIContent* stackParent);
|
||||
void appendCharacters(nsIContent* parent, PRUnichar* buf, PRInt32 start, PRInt32 length);
|
||||
void appendComment(nsIContent* parent, PRUnichar* buf, PRInt32 start, PRInt32 length);
|
||||
void appendCommentToDocument(PRUnichar* buf, PRInt32 start, PRInt32 length);
|
||||
void addAttributesToElement(nsIContent* element, nsHtml5HtmlAttributes* attributes);
|
||||
void start(PRBool fragment);
|
||||
void end();
|
||||
void appendDoctypeToDocument(nsIAtom* name, nsString* publicIdentifier, nsString* systemIdentifier);
|
||||
void elementPushed(PRInt32 ns, nsIAtom* name, nsIContent* node);
|
||||
void elementPopped(PRInt32 ns, nsIAtom* name, nsIContent* node);
|
||||
public:
|
||||
void setFragmentContext(nsIAtom* context, PRInt32 ns, nsIContent* node, PRBool quirks);
|
||||
protected:
|
||||
nsIContent* currentNode();
|
||||
public:
|
||||
PRBool isScriptingEnabled();
|
||||
void setScriptingEnabled(PRBool scriptingEnabled);
|
||||
void setDocumentModeHandler(nsHtml5Parser* documentModeHandler);
|
||||
PRBool inForeign();
|
||||
private:
|
||||
void flushCharacters();
|
||||
PRBool charBufferContainsNonWhitespace();
|
||||
public:
|
||||
nsHtml5StateSnapshot* newSnapshot();
|
||||
PRBool snapshotMatches(nsHtml5StateSnapshot* snapshot);
|
||||
static void initializeStatics();
|
||||
static void releaseStatics();
|
||||
|
||||
#include "nsHtml5TreeBuilderHSupplement.h"
|
||||
};
|
||||
|
||||
#ifdef nsHtml5TreeBuilder_cpp__
|
||||
jArray<const char*,PRInt32> nsHtml5TreeBuilder::QUIRKY_PUBLIC_IDS = nsnull;
|
||||
#endif
|
||||
|
||||
#define NS_HTML5TREE_BUILDER_OTHER 0
|
||||
#define NS_HTML5TREE_BUILDER_A 1
|
||||
#define NS_HTML5TREE_BUILDER_BASE 2
|
||||
#define NS_HTML5TREE_BUILDER_BODY 3
|
||||
#define NS_HTML5TREE_BUILDER_BR 4
|
||||
#define NS_HTML5TREE_BUILDER_BUTTON 5
|
||||
#define NS_HTML5TREE_BUILDER_CAPTION 6
|
||||
#define NS_HTML5TREE_BUILDER_COL 7
|
||||
#define NS_HTML5TREE_BUILDER_COLGROUP 8
|
||||
#define NS_HTML5TREE_BUILDER_FORM 9
|
||||
#define NS_HTML5TREE_BUILDER_FRAME 10
|
||||
#define NS_HTML5TREE_BUILDER_FRAMESET 11
|
||||
#define NS_HTML5TREE_BUILDER_IMAGE 12
|
||||
#define NS_HTML5TREE_BUILDER_INPUT 13
|
||||
#define NS_HTML5TREE_BUILDER_ISINDEX 14
|
||||
#define NS_HTML5TREE_BUILDER_LI 15
|
||||
#define NS_HTML5TREE_BUILDER_LINK 16
|
||||
#define NS_HTML5TREE_BUILDER_MATH 17
|
||||
#define NS_HTML5TREE_BUILDER_META 18
|
||||
#define NS_HTML5TREE_BUILDER_SVG 19
|
||||
#define NS_HTML5TREE_BUILDER_HEAD 20
|
||||
#define NS_HTML5TREE_BUILDER_HR 22
|
||||
#define NS_HTML5TREE_BUILDER_HTML 23
|
||||
#define NS_HTML5TREE_BUILDER_NOBR 24
|
||||
#define NS_HTML5TREE_BUILDER_NOFRAMES 25
|
||||
#define NS_HTML5TREE_BUILDER_NOSCRIPT 26
|
||||
#define NS_HTML5TREE_BUILDER_OPTGROUP 27
|
||||
#define NS_HTML5TREE_BUILDER_OPTION 28
|
||||
#define NS_HTML5TREE_BUILDER_P 29
|
||||
#define NS_HTML5TREE_BUILDER_PLAINTEXT 30
|
||||
#define NS_HTML5TREE_BUILDER_SCRIPT 31
|
||||
#define NS_HTML5TREE_BUILDER_SELECT 32
|
||||
#define NS_HTML5TREE_BUILDER_STYLE 33
|
||||
#define NS_HTML5TREE_BUILDER_TABLE 34
|
||||
#define NS_HTML5TREE_BUILDER_TEXTAREA 35
|
||||
#define NS_HTML5TREE_BUILDER_TITLE 36
|
||||
#define NS_HTML5TREE_BUILDER_TR 37
|
||||
#define NS_HTML5TREE_BUILDER_XMP 38
|
||||
#define NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT 39
|
||||
#define NS_HTML5TREE_BUILDER_TD_OR_TH 40
|
||||
#define NS_HTML5TREE_BUILDER_DD_OR_DT 41
|
||||
#define NS_HTML5TREE_BUILDER_H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6 42
|
||||
#define NS_HTML5TREE_BUILDER_MARQUEE_OR_APPLET 43
|
||||
#define NS_HTML5TREE_BUILDER_PRE_OR_LISTING 44
|
||||
#define NS_HTML5TREE_BUILDER_B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U 45
|
||||
#define NS_HTML5TREE_BUILDER_UL_OR_OL_OR_DL 46
|
||||
#define NS_HTML5TREE_BUILDER_IFRAME 47
|
||||
#define NS_HTML5TREE_BUILDER_EMBED_OR_IMG 48
|
||||
#define NS_HTML5TREE_BUILDER_AREA_OR_BASEFONT_OR_BGSOUND_OR_SPACER_OR_WBR 49
|
||||
#define NS_HTML5TREE_BUILDER_DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU 50
|
||||
#define NS_HTML5TREE_BUILDER_ADDRESS_OR_DIR_OR_ARTICLE_OR_ASIDE_OR_DATAGRID_OR_DETAILS_OR_DIALOG_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_NAV_OR_SECTION 51
|
||||
#define NS_HTML5TREE_BUILDER_RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR 52
|
||||
#define NS_HTML5TREE_BUILDER_RT_OR_RP 53
|
||||
#define NS_HTML5TREE_BUILDER_COMMAND_OR_EVENT_SOURCE 54
|
||||
#define NS_HTML5TREE_BUILDER_PARAM_OR_SOURCE 55
|
||||
#define NS_HTML5TREE_BUILDER_MGLYPH_OR_MALIGNMARK 56
|
||||
#define NS_HTML5TREE_BUILDER_MI_MO_MN_MS_MTEXT 57
|
||||
#define NS_HTML5TREE_BUILDER_ANNOTATION_XML 58
|
||||
#define NS_HTML5TREE_BUILDER_FOREIGNOBJECT_OR_DESC 59
|
||||
#define NS_HTML5TREE_BUILDER_NOEMBED 60
|
||||
#define NS_HTML5TREE_BUILDER_FIELDSET 61
|
||||
#define NS_HTML5TREE_BUILDER_OUTPUT_OR_LABEL 62
|
||||
#define NS_HTML5TREE_BUILDER_OBJECT 63
|
||||
#define NS_HTML5TREE_BUILDER_FONT 64
|
||||
#define NS_HTML5TREE_BUILDER_KEYGEN 65
|
||||
#define NS_HTML5TREE_BUILDER_INITIAL 0
|
||||
#define NS_HTML5TREE_BUILDER_BEFORE_HTML 1
|
||||
#define NS_HTML5TREE_BUILDER_BEFORE_HEAD 2
|
||||
#define NS_HTML5TREE_BUILDER_IN_HEAD 3
|
||||
#define NS_HTML5TREE_BUILDER_IN_HEAD_NOSCRIPT 4
|
||||
#define NS_HTML5TREE_BUILDER_AFTER_HEAD 5
|
||||
#define NS_HTML5TREE_BUILDER_IN_BODY 6
|
||||
#define NS_HTML5TREE_BUILDER_IN_TABLE 7
|
||||
#define NS_HTML5TREE_BUILDER_IN_CAPTION 8
|
||||
#define NS_HTML5TREE_BUILDER_IN_COLUMN_GROUP 9
|
||||
#define NS_HTML5TREE_BUILDER_IN_TABLE_BODY 10
|
||||
#define NS_HTML5TREE_BUILDER_IN_ROW 11
|
||||
#define NS_HTML5TREE_BUILDER_IN_CELL 12
|
||||
#define NS_HTML5TREE_BUILDER_IN_SELECT 13
|
||||
#define NS_HTML5TREE_BUILDER_IN_SELECT_IN_TABLE 14
|
||||
#define NS_HTML5TREE_BUILDER_AFTER_BODY 15
|
||||
#define NS_HTML5TREE_BUILDER_IN_FRAMESET 16
|
||||
#define NS_HTML5TREE_BUILDER_AFTER_FRAMESET 17
|
||||
#define NS_HTML5TREE_BUILDER_AFTER_AFTER_BODY 18
|
||||
#define NS_HTML5TREE_BUILDER_AFTER_AFTER_FRAMESET 19
|
||||
#define NS_HTML5TREE_BUILDER_IN_CDATA_RCDATA 20
|
||||
#define NS_HTML5TREE_BUILDER_FRAMESET_OK 21
|
||||
#define NS_HTML5TREE_BUILDER_CHARSET_INITIAL 0
|
||||
#define NS_HTML5TREE_BUILDER_CHARSET_C 1
|
||||
#define NS_HTML5TREE_BUILDER_CHARSET_H 2
|
||||
#define NS_HTML5TREE_BUILDER_CHARSET_A 3
|
||||
#define NS_HTML5TREE_BUILDER_CHARSET_R 4
|
||||
#define NS_HTML5TREE_BUILDER_CHARSET_S 5
|
||||
#define NS_HTML5TREE_BUILDER_CHARSET_E 6
|
||||
#define NS_HTML5TREE_BUILDER_CHARSET_T 7
|
||||
#define NS_HTML5TREE_BUILDER_CHARSET_EQUALS 8
|
||||
#define NS_HTML5TREE_BUILDER_CHARSET_SINGLE_QUOTED 9
|
||||
#define NS_HTML5TREE_BUILDER_CHARSET_DOUBLE_QUOTED 10
|
||||
#define NS_HTML5TREE_BUILDER_CHARSET_UNQUOTED 11
|
||||
#define NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK PR_INT32_MAX
|
||||
#define NS_HTML5TREE_BUILDER_IN_FOREIGN 0
|
||||
#define NS_HTML5TREE_BUILDER_NOT_IN_FOREIGN 1
|
||||
|
||||
|
||||
#endif
|
||||
|
523
content/html/parser/src/nsHtml5TreeBuilderCppSupplement.h
Normal file
523
content/html/parser/src/nsHtml5TreeBuilderCppSupplement.h
Normal file
@ -0,0 +1,523 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 sw=2 et tw=78: */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsContentErrors.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsIDOMDocumentType.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsEvent.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsNodeUtils.h"
|
||||
#include "nsIStyleSheetLinkingElement.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
|
||||
#define NS_HTML5_TREE_BUILDER_MAX_QUEUE_TIME 3000000UL // microseconds
|
||||
#define NS_HTML5_TREE_BUILDER_DEFAULT_QUEUE_LENGTH 200
|
||||
#define NS_HTML5_TREE_BUILDER_MIN_QUEUE_LENGTH 100
|
||||
#define NS_HTML5_TREE_BUILDER_MAX_TIME_WITHOUT_FLUSH 5000 // milliseconds
|
||||
|
||||
// this really should be autogenerated...
|
||||
jArray<PRUnichar,PRInt32> nsHtml5TreeBuilder::ISINDEX_PROMPT = jArray<PRUnichar,PRInt32>();
|
||||
|
||||
nsHtml5TreeBuilder::nsHtml5TreeBuilder(nsHtml5Parser* aParser)
|
||||
: documentModeHandler(aParser),
|
||||
fragment(PR_FALSE),
|
||||
formPointer(nsnull),
|
||||
headPointer(nsnull),
|
||||
mNeedsFlush(PR_FALSE),
|
||||
#ifdef DEBUG
|
||||
mActive(PR_FALSE),
|
||||
#endif
|
||||
mFlushTimer(do_CreateInstance("@mozilla.org/timer;1")),
|
||||
mParser(aParser)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5TreeBuilder);
|
||||
}
|
||||
|
||||
nsHtml5TreeBuilder::~nsHtml5TreeBuilder()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsHtml5TreeBuilder);
|
||||
NS_ASSERTION(!mActive, "nsHtml5TreeBuilder deleted without ever calling end() on it!");
|
||||
mOpQueue.Clear();
|
||||
mFlushTimer->Cancel(); // XXX why is this even necessary? it is, though.
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
nsHtml5TreeBuilder::createElement(PRInt32 aNamespace, nsIAtom* aName, nsHtml5HtmlAttributes* aAttributes)
|
||||
{
|
||||
// XXX recheck http://mxr.mozilla.org/mozilla-central/source/content/base/src/nsDocument.cpp#6660
|
||||
nsIContent* newContent;
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo = mParser->GetNodeInfoManager()->GetNodeInfo(aName, nsnull, aNamespace);
|
||||
NS_ASSERTION(nodeInfo, "Got null nodeinfo.");
|
||||
NS_NewElement(&newContent, nodeInfo->NamespaceID(), nodeInfo, PR_TRUE);
|
||||
NS_ASSERTION(newContent, "Element creation created null pointer.");
|
||||
PRInt32 len = aAttributes->getLength();
|
||||
for (PRInt32 i = 0; i < len; ++i) {
|
||||
newContent->SetAttr(aAttributes->getURI(i), aAttributes->getLocalName(i), aAttributes->getPrefix(i), *(aAttributes->getValue(i)), PR_FALSE);
|
||||
// XXX what to do with nsresult?
|
||||
}
|
||||
|
||||
|
||||
if (aNamespace != kNameSpaceID_MathML && (aName == nsHtml5Atoms::style || (aNamespace == kNameSpaceID_XHTML && aName == nsHtml5Atoms::link))) {
|
||||
nsCOMPtr<nsIStyleSheetLinkingElement> ssle(do_QueryInterface(newContent));
|
||||
if (ssle) {
|
||||
ssle->InitStyleLinkElement(PR_FALSE);
|
||||
ssle->SetEnableUpdates(PR_FALSE);
|
||||
#if 0
|
||||
if (!aNodeInfo->Equals(nsGkAtoms::link, kNameSpaceID_XHTML)) {
|
||||
ssle->SetLineNumber(aLineNumber);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return newContent;
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
nsHtml5TreeBuilder::createElement(PRInt32 aNamespace, nsIAtom* aName, nsHtml5HtmlAttributes* aAttributes, nsIContent* aFormElement)
|
||||
{
|
||||
nsIContent* content = createElement(aNamespace, aName, aAttributes);
|
||||
if (aFormElement) {
|
||||
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(content));
|
||||
NS_ASSERTION(formControl, "Form-associated element did not implement nsIFormControl.");
|
||||
nsCOMPtr<nsIDOMHTMLFormElement> formElement(do_QueryInterface(aFormElement));
|
||||
NS_ASSERTION(formElement, "The form element doesn't implement nsIDOMHTMLFormElement.");
|
||||
if (formControl) { // avoid crashing on <output>
|
||||
formControl->SetForm(formElement);
|
||||
}
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
nsHtml5TreeBuilder::createHtmlElementSetAsRoot(nsHtml5HtmlAttributes* aAttributes)
|
||||
{
|
||||
nsIContent* content = createElement(kNameSpaceID_XHTML, nsHtml5Atoms::html, aAttributes);
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
// XXX if null, OOM!
|
||||
treeOp->Init(eTreeOpAppendToDocument, content);
|
||||
return content;
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeBuilder::detachFromParent(nsIContent* aElement)
|
||||
{
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
// XXX if null, OOM!
|
||||
treeOp->Init(eTreeOpDetach, aElement);
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
nsHtml5TreeBuilder::shallowClone(nsIContent* aElement)
|
||||
{
|
||||
nsINode* clone;
|
||||
aElement->Clone(aElement->NodeInfo(), &clone);
|
||||
// XXX nsresult
|
||||
return static_cast<nsIContent*>(clone);
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeBuilder::appendElement(nsIContent* aChild, nsIContent* aParent)
|
||||
{
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
// XXX if null, OOM!
|
||||
treeOp->Init(aChild, aParent);
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeBuilder::appendChildrenToNewParent(nsIContent* aOldParent, nsIContent* aNewParent)
|
||||
{
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
// XXX if null, OOM!
|
||||
treeOp->Init(eTreeOpAppendChildrenToNewParent, aOldParent, aNewParent);
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeBuilder::insertFosterParentedCharacters(PRUnichar* aBuffer, PRInt32 aStart, PRInt32 aLength, nsIContent* aTable, nsIContent* aStackParent)
|
||||
{
|
||||
nsCOMPtr<nsIContent> text;
|
||||
NS_NewTextNode(getter_AddRefs(text), mParser->GetNodeInfoManager());
|
||||
// XXX nsresult and comment null check?
|
||||
text->SetText(aBuffer + aStart, aLength, PR_FALSE);
|
||||
// XXX nsresult
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
// XXX if null, OOM!
|
||||
treeOp->Init(eTreeOpFosterParent, text, aStackParent, aTable);
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeBuilder::insertFosterParentedChild(nsIContent* aChild, nsIContent* aTable, nsIContent* aStackParent)
|
||||
{
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
// XXX if null, OOM!
|
||||
treeOp->Init(eTreeOpFosterParent, aChild, aStackParent, aTable);
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeBuilder::appendCharacters(nsIContent* aParent, PRUnichar* aBuffer, PRInt32 aStart, PRInt32 aLength)
|
||||
{
|
||||
nsCOMPtr<nsIContent> text;
|
||||
NS_NewTextNode(getter_AddRefs(text), mParser->GetNodeInfoManager());
|
||||
// XXX nsresult and comment null check?
|
||||
text->SetText(aBuffer + aStart, aLength, PR_FALSE);
|
||||
// XXX nsresult
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
// XXX if null, OOM!
|
||||
treeOp->Init(text, aParent);
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeBuilder::appendComment(nsIContent* aParent, PRUnichar* aBuffer, PRInt32 aStart, PRInt32 aLength)
|
||||
{
|
||||
nsCOMPtr<nsIContent> comment;
|
||||
NS_NewCommentNode(getter_AddRefs(comment), mParser->GetNodeInfoManager());
|
||||
// XXX nsresult and comment null check?
|
||||
comment->SetText(aBuffer + aStart, aLength, PR_FALSE);
|
||||
// XXX nsresult
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
// XXX if null, OOM!
|
||||
treeOp->Init(comment, aParent);
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeBuilder::appendCommentToDocument(PRUnichar* aBuffer, PRInt32 aStart, PRInt32 aLength)
|
||||
{
|
||||
nsCOMPtr<nsIContent> comment;
|
||||
NS_NewCommentNode(getter_AddRefs(comment), mParser->GetNodeInfoManager());
|
||||
// XXX nsresult and comment null check?
|
||||
comment->SetText(aBuffer + aStart, aLength, PR_FALSE);
|
||||
// XXX nsresult
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
// XXX if null, OOM!
|
||||
treeOp->Init(eTreeOpAppendToDocument, comment);
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeBuilder::addAttributesToElement(nsIContent* aElement, nsHtml5HtmlAttributes* aAttributes)
|
||||
{
|
||||
nsIContent* holder = createElement(kNameSpaceID_XHTML, nsHtml5Atoms::div, aAttributes);
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
// XXX if null, OOM!
|
||||
treeOp->Init(eTreeOpAddAttributes, holder, aElement);
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeBuilder::start(PRBool fragment)
|
||||
{
|
||||
// XXX check that timer creation didn't fail in constructor
|
||||
if (fragment) {
|
||||
mHasProcessedBase = PR_TRUE;
|
||||
} else {
|
||||
mHasProcessedBase = PR_FALSE;
|
||||
mParser->WillBuildModelImpl();
|
||||
mParser->GetDocument()->BeginLoad(); // XXX fragment?
|
||||
}
|
||||
mNeedsFlush = PR_FALSE;
|
||||
#ifdef DEBUG
|
||||
mActive = PR_TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeBuilder::end()
|
||||
{
|
||||
mFlushTimer->Cancel();
|
||||
Flush();
|
||||
mParser->ReadyToCallDidBuildModelHtml5();
|
||||
#ifdef DEBUG
|
||||
mActive = PR_FALSE;
|
||||
#endif
|
||||
#ifdef DEBUG_hsivonen
|
||||
printf("MAX INSERTION BATCH LEN: %d\n", sInsertionBatchMaxLength);
|
||||
printf("MAX NOTIFICATION BATCH LEN: %d\n", sAppendBatchMaxSize);
|
||||
if (sAppendBatchExaminations != 0) {
|
||||
printf("AVERAGE SLOTS EXAMINED: %d\n", sAppendBatchSlotsExamined / sAppendBatchExaminations);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeBuilder::appendDoctypeToDocument(nsIAtom* aName, nsString* aPublicId, nsString* aSystemId)
|
||||
{
|
||||
// Adapted from nsXMLContentSink
|
||||
|
||||
// Create a new doctype node
|
||||
nsCOMPtr<nsIDOMDocumentType> docType;
|
||||
nsAutoString voidString;
|
||||
voidString.SetIsVoid(PR_TRUE);
|
||||
NS_NewDOMDocumentType(getter_AddRefs(docType), mParser->GetNodeInfoManager(), nsnull,
|
||||
aName, nsnull, nsnull, *aPublicId, *aSystemId,
|
||||
voidString);
|
||||
// if (NS_FAILED(rv) || !docType) {
|
||||
// return rv;
|
||||
// }
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(docType);
|
||||
NS_ASSERTION(content, "doctype isn't content?");
|
||||
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
// XXX if null, OOM!
|
||||
treeOp->Init(eTreeOpAppendToDocument, content);
|
||||
|
||||
// nsXMLContentSink can flush here, but what's the point?
|
||||
// It can also interrupt here, but we can't.
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeBuilder::elementPushed(PRInt32 aNamespace, nsIAtom* aName, nsIContent* aElement)
|
||||
{
|
||||
NS_ASSERTION((aNamespace == kNameSpaceID_XHTML || aNamespace == kNameSpaceID_SVG || aNamespace == kNameSpaceID_MathML), "Element isn't HTML, SVG or MathML!");
|
||||
NS_ASSERTION(aName, "Element doesn't have local name!");
|
||||
NS_ASSERTION(aElement, "No element!");
|
||||
// Give autoloading links a chance to fire
|
||||
if (aNamespace == kNameSpaceID_XHTML) {
|
||||
if (aName == nsHtml5Atoms::body) {
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
// XXX if null, OOM!
|
||||
treeOp->Init(eTreeOpStartLayout, nsnull);
|
||||
} else if (aName == nsHtml5Atoms::html) {
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
// XXX if null, OOM!
|
||||
treeOp->Init(eTreeOpProcessOfflineManifest, aElement);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
#if 0
|
||||
else {
|
||||
nsIDocShell* docShell = mParser->GetDocShell();
|
||||
if (docShell) {
|
||||
nsresult rv = aElement->MaybeTriggerAutoLink(docShell);
|
||||
if (rv == NS_XML_AUTOLINK_REPLACE ||
|
||||
rv == NS_XML_AUTOLINK_UNDEFINED) {
|
||||
// If we do not terminate the parse, we just keep generating link trigger
|
||||
// events. We want to parse only up to the first replace link, and stop.
|
||||
mParser->Terminate();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
MaybeSuspend();
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeBuilder::elementPopped(PRInt32 aNamespace, nsIAtom* aName, nsIContent* aElement)
|
||||
{
|
||||
NS_ASSERTION((aNamespace == kNameSpaceID_XHTML || aNamespace == kNameSpaceID_SVG || aNamespace == kNameSpaceID_MathML), "Element isn't HTML, SVG or MathML!");
|
||||
NS_ASSERTION(aName, "Element doesn't have local name!");
|
||||
NS_ASSERTION(aElement, "No element!");
|
||||
|
||||
MaybeSuspend();
|
||||
|
||||
if (aNamespace == kNameSpaceID_MathML) {
|
||||
return;
|
||||
}
|
||||
// we now have only SVG and HTML
|
||||
|
||||
if (aName == nsHtml5Atoms::script) {
|
||||
// mConstrainSize = PR_TRUE; // XXX what is this?
|
||||
requestSuspension();
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
// XXX if null, OOM!
|
||||
treeOp->Init(eTreeOpScriptEnd, aElement);
|
||||
Flush();
|
||||
return;
|
||||
}
|
||||
|
||||
if (aName == nsHtml5Atoms::title) {
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
// XXX if null, OOM!
|
||||
treeOp->Init(eTreeOpDoneAddingChildren, aElement);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aName == nsHtml5Atoms::style || (aNamespace == kNameSpaceID_XHTML && aName == nsHtml5Atoms::link)) {
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
// XXX if null, OOM!
|
||||
treeOp->Init(eTreeOpUpdateStyleSheet, aElement);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (aNamespace == kNameSpaceID_SVG) {
|
||||
#if 0
|
||||
if (aElement->HasAttr(kNameSpaceID_None, nsHtml5Atoms::onload)) {
|
||||
Flush();
|
||||
|
||||
nsEvent event(PR_TRUE, NS_SVG_LOAD);
|
||||
event.eventStructType = NS_SVG_EVENT;
|
||||
event.flags |= NS_EVENT_FLAG_CANT_BUBBLE;
|
||||
|
||||
// Do we care about forcing presshell creation if it hasn't happened yet?
|
||||
// That is, should this code flush or something? Does it really matter?
|
||||
// For that matter, do we really want to try getting the prescontext? Does
|
||||
// this event ever want one?
|
||||
nsRefPtr<nsPresContext> ctx;
|
||||
nsCOMPtr<nsIPresShell> shell = mParser->GetDocument()->GetPrimaryShell();
|
||||
if (shell) {
|
||||
ctx = shell->GetPresContext();
|
||||
}
|
||||
nsEventDispatcher::Dispatch(aElement, ctx, &event);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
// we now have only HTML
|
||||
|
||||
// Some HTML nodes need DoneAddingChildren() called to initialize
|
||||
// properly (eg form state restoration).
|
||||
// XXX expose ElementName group here and do switch
|
||||
if (aName == nsHtml5Atoms::select ||
|
||||
aName == nsHtml5Atoms::textarea ||
|
||||
#ifdef MOZ_MEDIA
|
||||
aName == nsHtml5Atoms::video ||
|
||||
aName == nsHtml5Atoms::audio ||
|
||||
#endif
|
||||
aName == nsHtml5Atoms::object ||
|
||||
aName == nsHtml5Atoms::applet) {
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
// XXX if null, OOM!
|
||||
treeOp->Init(eTreeOpDoneAddingChildren, aElement);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aName == nsHtml5Atoms::input ||
|
||||
aName == nsHtml5Atoms::button) {
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
// XXX if null, OOM!
|
||||
treeOp->Init(eTreeOpDoneCreatingElement, aElement);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aName == nsHtml5Atoms::base) {
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
// XXX if null, OOM!
|
||||
treeOp->Init(eTreeOpProcessBase, aElement);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aName == nsHtml5Atoms::meta) {
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
// XXX if null, OOM!
|
||||
treeOp->Init(eTreeOpProcessMeta, aElement);
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeBuilder::accumulateCharacters(PRUnichar* aBuf, PRInt32 aStart, PRInt32 aLength)
|
||||
{
|
||||
PRInt32 newFillLen = charBufferLen + aLength;
|
||||
if (newFillLen > charBuffer.length) {
|
||||
PRInt32 newAllocLength = newFillLen + (newFillLen >> 1);
|
||||
jArray<PRUnichar,PRInt32> newBuf(newAllocLength);
|
||||
memcpy(newBuf, charBuffer, sizeof(PRUnichar) * charBufferLen);
|
||||
charBuffer.release();
|
||||
charBuffer = newBuf;
|
||||
}
|
||||
memcpy(charBuffer + charBufferLen, aBuf + aStart, sizeof(PRUnichar) * aLength);
|
||||
charBufferLen = newFillLen;
|
||||
}
|
||||
|
||||
static void
|
||||
TimerCallbackFunc(nsITimer* aTimer, void* aClosure)
|
||||
{
|
||||
(static_cast<nsHtml5TreeBuilder*> (aClosure))->DeferredTimerFlush();
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeBuilder::Flush()
|
||||
{
|
||||
mNeedsFlush = PR_FALSE;
|
||||
MOZ_AUTO_DOC_UPDATE(mParser->GetDocument(), UPDATE_CONTENT_MODEL, PR_TRUE);
|
||||
|
||||
PRTime flushStart = 0;
|
||||
|
||||
PRUint32 opQueueLength = mOpQueue.Length();
|
||||
|
||||
if (opQueueLength > NS_HTML5_TREE_BUILDER_MIN_QUEUE_LENGTH) { // avoid computing averages with too few ops
|
||||
flushStart = PR_Now();
|
||||
}
|
||||
|
||||
mElementsSeenInThisAppendBatch.SetCapacity(opQueueLength * 2);
|
||||
// XXX alloc failure
|
||||
const nsHtml5TreeOperation* start = mOpQueue.Elements();
|
||||
const nsHtml5TreeOperation* end = start + opQueueLength;
|
||||
for (nsHtml5TreeOperation* iter = (nsHtml5TreeOperation*)start; iter < end; ++iter) {
|
||||
iter->Perform(this);
|
||||
}
|
||||
FlushPendingAppendNotifications();
|
||||
#ifdef DEBUG_hsivonen
|
||||
if (mOpQueue.Length() > sInsertionBatchMaxLength) {
|
||||
sInsertionBatchMaxLength = opQueueLength;
|
||||
}
|
||||
#endif
|
||||
mOpQueue.Clear();
|
||||
|
||||
if (flushStart) {
|
||||
sTreeOpQueueMaxLength = (PRUint32)((NS_HTML5_TREE_BUILDER_MAX_QUEUE_TIME * (PRUint64)opQueueLength) / (PR_Now() - flushStart));
|
||||
if (sTreeOpQueueMaxLength < NS_HTML5_TREE_BUILDER_MIN_QUEUE_LENGTH) {
|
||||
sTreeOpQueueMaxLength = NS_HTML5_TREE_BUILDER_MIN_QUEUE_LENGTH;
|
||||
}
|
||||
#ifdef DEBUG_hsivonen
|
||||
printf("QUEUE MAX LENGTH: %d\n", sTreeOpQueueMaxLength);
|
||||
#endif
|
||||
}
|
||||
|
||||
mFlushTimer->InitWithFuncCallback(TimerCallbackFunc, static_cast<void*> (this), NS_HTML5_TREE_BUILDER_MAX_TIME_WITHOUT_FLUSH, nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_hsivonen
|
||||
PRUint32 nsHtml5TreeBuilder::sInsertionBatchMaxLength = 0;
|
||||
PRUint32 nsHtml5TreeBuilder::sAppendBatchMaxSize = 0;
|
||||
PRUint32 nsHtml5TreeBuilder::sAppendBatchSlotsExamined = 0;
|
||||
PRUint32 nsHtml5TreeBuilder::sAppendBatchExaminations = 0;
|
||||
#endif
|
||||
PRUint32 nsHtml5TreeBuilder::sTreeOpQueueMaxLength = NS_HTML5_TREE_BUILDER_DEFAULT_QUEUE_LENGTH;
|
||||
|
164
content/html/parser/src/nsHtml5TreeBuilderHSupplement.h
Normal file
164
content/html/parser/src/nsHtml5TreeBuilderHSupplement.h
Normal file
@ -0,0 +1,164 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is HTML Parser C++ Translator code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008-2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
private:
|
||||
#ifdef DEBUG_hsivonen
|
||||
static PRUint32 sInsertionBatchMaxLength;
|
||||
static PRUint32 sAppendBatchMaxSize;
|
||||
static PRUint32 sAppendBatchSlotsExamined;
|
||||
static PRUint32 sAppendBatchExaminations;
|
||||
#endif
|
||||
static PRUint32 sTreeOpQueueMaxLength;
|
||||
PRBool mNeedsFlush;
|
||||
nsCOMPtr<nsITimer> mFlushTimer;
|
||||
nsHtml5Parser* mParser; // weak ref
|
||||
PRBool mHasProcessedBase;
|
||||
#ifdef DEBUG
|
||||
PRBool mActive;
|
||||
#endif
|
||||
nsTArray<nsHtml5TreeOperation> mOpQueue;
|
||||
nsTArray<nsIContentPtr> mElementsSeenInThisAppendBatch;
|
||||
nsTArray<nsHtml5PendingNotification> mPendingNotifications;
|
||||
|
||||
inline void MaybeSuspend() {
|
||||
if (!mNeedsFlush) {
|
||||
mNeedsFlush = !!(mOpQueue.Length() >= sTreeOpQueueMaxLength);
|
||||
}
|
||||
if (mParser->DidProcessATokenImpl() == NS_ERROR_HTMLPARSER_INTERRUPTED || mNeedsFlush) {
|
||||
// We've been in the parser for too long and/or the op queue is becoming too
|
||||
// long to flush in one go it it grows further.
|
||||
mParser->Suspend();
|
||||
requestSuspension();
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
nsHtml5TreeBuilder(nsHtml5Parser* aParser);
|
||||
~nsHtml5TreeBuilder();
|
||||
void Flush();
|
||||
|
||||
inline void MaybeFlush() {
|
||||
if (mNeedsFlush) {
|
||||
Flush();
|
||||
}
|
||||
}
|
||||
|
||||
inline void DeferredTimerFlush() {
|
||||
if (!mOpQueue.IsEmpty()) {
|
||||
mNeedsFlush = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
inline void PostPendingAppendNotification(nsIContent* aParent, nsIContent* aChild) {
|
||||
PRBool newParent = PR_TRUE;
|
||||
const nsIContentPtr* first = mElementsSeenInThisAppendBatch.Elements();
|
||||
const nsIContentPtr* last = first + (mElementsSeenInThisAppendBatch.Length() - 1);
|
||||
for (const nsIContentPtr* iter = last; iter >= first; --iter) {
|
||||
#ifdef DEBUG_hsivonen
|
||||
sAppendBatchSlotsExamined++;
|
||||
#endif
|
||||
if (*iter == aParent) {
|
||||
newParent = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (aChild->IsNodeOfType(nsINode::eELEMENT)) {
|
||||
mElementsSeenInThisAppendBatch.AppendElement(aChild);
|
||||
}
|
||||
mElementsSeenInThisAppendBatch.AppendElement(aParent);
|
||||
if (newParent) {
|
||||
mPendingNotifications.AppendElement(aParent);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_hsivonen
|
||||
sAppendBatchExaminations++;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
inline void FlushPendingAppendNotifications() {
|
||||
const nsHtml5PendingNotification* start = mPendingNotifications.Elements();
|
||||
const nsHtml5PendingNotification* end = start + mPendingNotifications.Length();
|
||||
for (nsHtml5PendingNotification* iter = (nsHtml5PendingNotification*)start; iter < end; ++iter) {
|
||||
iter->Fire();
|
||||
}
|
||||
mPendingNotifications.Clear();
|
||||
#ifdef DEBUG_hsivonen
|
||||
if (mElementsSeenInThisAppendBatch.Length() > sAppendBatchMaxSize) {
|
||||
sAppendBatchMaxSize = mElementsSeenInThisAppendBatch.Length();
|
||||
}
|
||||
#endif
|
||||
mElementsSeenInThisAppendBatch.Clear();
|
||||
}
|
||||
|
||||
inline nsIDocument* GetDocument() {
|
||||
return mParser->GetDocument();
|
||||
}
|
||||
|
||||
inline void SetScriptElement(nsIContent* aScript) {
|
||||
mParser->SetScriptElement(aScript);
|
||||
}
|
||||
|
||||
inline void UpdateStyleSheet(nsIContent* aSheet) {
|
||||
mParser->UpdateStyleSheet(aSheet);
|
||||
}
|
||||
|
||||
inline nsresult ProcessBase(nsIContent* aBase) {
|
||||
if (!mHasProcessedBase) {
|
||||
nsresult rv = mParser->ProcessBASETag(aBase);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mHasProcessedBase = PR_TRUE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
inline nsresult ProcessMeta(nsIContent* aMeta) {
|
||||
return mParser->ProcessMETATag(aMeta);
|
||||
}
|
||||
|
||||
inline nsresult ProcessOfflineManifest(nsIContent* aHtml) {
|
||||
mParser->ProcessOfflineManifest(aHtml);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
inline void StartLayout() {
|
||||
nsIDocument* doc = GetDocument();
|
||||
if (doc) {
|
||||
FlushPendingAppendNotifications();
|
||||
mParser->StartLayout(PR_FALSE);
|
||||
}
|
||||
}
|
173
content/html/parser/src/nsHtml5TreeOperation.cpp
Normal file
173
content/html/parser/src/nsHtml5TreeOperation.cpp
Normal file
@ -0,0 +1,173 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 sw=2 et tw=78: */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsHtml5TreeOperation.h"
|
||||
#include "nsNodeUtils.h"
|
||||
#include "nsAttrName.h"
|
||||
#include "nsHtml5TreeBuilder.h"
|
||||
|
||||
nsHtml5TreeOperation::nsHtml5TreeOperation()
|
||||
: mOpCode(eTreeOpAppend)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5TreeOperation);
|
||||
}
|
||||
|
||||
nsHtml5TreeOperation::~nsHtml5TreeOperation()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsHtml5TreeOperation);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHtml5TreeOperation::Perform(nsHtml5TreeBuilder* aBuilder)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
switch(mOpCode) {
|
||||
case eTreeOpAppend: {
|
||||
aBuilder->PostPendingAppendNotification(mParent, mNode);
|
||||
rv = mParent->AppendChildTo(mNode, PR_FALSE);
|
||||
return rv;
|
||||
}
|
||||
case eTreeOpDetach: {
|
||||
aBuilder->FlushPendingAppendNotifications();
|
||||
nsIContent* parent = mNode->GetParent();
|
||||
if (parent) {
|
||||
PRUint32 pos = parent->IndexOf(mNode);
|
||||
NS_ASSERTION((pos >= 0), "Element not found as child of its parent");
|
||||
rv = parent->RemoveChildAt(pos, PR_TRUE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// nsNodeUtils::ContentRemoved(parent, mNode, pos);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
case eTreeOpAppendChildrenToNewParent: {
|
||||
aBuilder->FlushPendingAppendNotifications();
|
||||
PRUint32 childCount = mParent->GetChildCount();
|
||||
PRBool didAppend = PR_FALSE;
|
||||
while (mNode->GetChildCount()) {
|
||||
nsCOMPtr<nsIContent> child = mNode->GetChildAt(0);
|
||||
rv = mNode->RemoveChildAt(0, PR_TRUE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// nsNodeUtils::ContentRemoved(mNode, child, 0);
|
||||
rv = mParent->AppendChildTo(child, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
didAppend = PR_TRUE;
|
||||
}
|
||||
if (didAppend) {
|
||||
nsNodeUtils::ContentAppended(mParent, childCount);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
case eTreeOpFosterParent: {
|
||||
nsIContent* parent = mTable->GetParent();
|
||||
if (parent && parent->IsNodeOfType(nsINode::eELEMENT)) {
|
||||
aBuilder->FlushPendingAppendNotifications();
|
||||
PRUint32 pos = parent->IndexOf(mTable);
|
||||
rv = parent->InsertChildAt(mNode, pos, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsNodeUtils::ContentInserted(parent, mNode, pos);
|
||||
} else {
|
||||
aBuilder->PostPendingAppendNotification(mParent, mNode);
|
||||
rv = mParent->AppendChildTo(mNode, PR_FALSE);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
case eTreeOpAppendToDocument: {
|
||||
aBuilder->FlushPendingAppendNotifications();
|
||||
nsIDocument* doc = aBuilder->GetDocument();
|
||||
PRUint32 childCount = doc->GetChildCount();
|
||||
rv = doc->AppendChildTo(mNode, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsNodeUtils::ContentInserted(doc, mNode, childCount);
|
||||
return rv;
|
||||
}
|
||||
case eTreeOpAddAttributes: {
|
||||
// mNode holds the new attributes and mParent is the target
|
||||
PRUint32 len = mNode->GetAttrCount();
|
||||
for (PRUint32 i = 0; i < len; ++i) {
|
||||
const nsAttrName* attrName = mNode->GetAttrNameAt(i);
|
||||
nsIAtom* localName = attrName->LocalName();
|
||||
PRInt32 nsuri = attrName->NamespaceID();
|
||||
if (!mParent->HasAttr(nsuri, localName)) {
|
||||
nsAutoString value;
|
||||
mNode->GetAttr(nsuri, localName, value);
|
||||
mParent->SetAttr(nsuri, localName, attrName->GetPrefix(), value, PR_TRUE);
|
||||
// XXX should not fire mutation event here
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
case eTreeOpScriptEnd: {
|
||||
aBuilder->SetScriptElement(mNode);
|
||||
return rv;
|
||||
}
|
||||
case eTreeOpDoneAddingChildren: {
|
||||
mNode->DoneAddingChildren(PR_FALSE);
|
||||
return rv;
|
||||
}
|
||||
case eTreeOpDoneCreatingElement: {
|
||||
mNode->DoneCreatingElement();
|
||||
return rv;
|
||||
}
|
||||
case eTreeOpUpdateStyleSheet: {
|
||||
aBuilder->UpdateStyleSheet(mNode);
|
||||
return rv;
|
||||
}
|
||||
case eTreeOpProcessBase: {
|
||||
rv = aBuilder->ProcessBase(mNode);
|
||||
return rv;
|
||||
}
|
||||
case eTreeOpProcessMeta: {
|
||||
rv = aBuilder->ProcessMeta(mNode);
|
||||
return rv;
|
||||
}
|
||||
case eTreeOpProcessOfflineManifest: {
|
||||
rv = aBuilder->ProcessOfflineManifest(mNode);
|
||||
return rv;
|
||||
}
|
||||
case eTreeOpStartLayout: {
|
||||
aBuilder->StartLayout(); // this causes a flush anyway
|
||||
return rv;
|
||||
}
|
||||
default: {
|
||||
NS_NOTREACHED("Bogus tree op");
|
||||
}
|
||||
}
|
||||
return rv; // keep compiler happy
|
||||
}
|
95
content/html/parser/src/nsHtml5TreeOperation.h
Normal file
95
content/html/parser/src/nsHtml5TreeOperation.h
Normal file
@ -0,0 +1,95 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is HTML Parser C++ Translator code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsHtml5TreeOperation_h__
|
||||
#define nsHtml5TreeOperation_h__
|
||||
|
||||
#include "nsIContent.h"
|
||||
|
||||
class nsHtml5TreeBuilder;
|
||||
|
||||
enum eHtml5TreeOperation {
|
||||
// main HTML5 ops
|
||||
eTreeOpAppend,
|
||||
eTreeOpDetach,
|
||||
eTreeOpAppendChildrenToNewParent,
|
||||
eTreeOpFosterParent,
|
||||
eTreeOpAppendToDocument,
|
||||
eTreeOpAddAttributes,
|
||||
// Gecko-specific on-pop ops
|
||||
eTreeOpScriptEnd,
|
||||
eTreeOpDoneAddingChildren,
|
||||
eTreeOpDoneCreatingElement,
|
||||
eTreeOpUpdateStyleSheet,
|
||||
eTreeOpProcessBase,
|
||||
eTreeOpProcessMeta,
|
||||
eTreeOpProcessOfflineManifest,
|
||||
eTreeOpStartLayout
|
||||
};
|
||||
|
||||
class nsHtml5TreeOperation {
|
||||
public:
|
||||
nsHtml5TreeOperation();
|
||||
~nsHtml5TreeOperation();
|
||||
inline void Init(nsIContent* aNode, nsIContent* aParent) {
|
||||
mNode = aNode;
|
||||
mParent = aParent;
|
||||
}
|
||||
inline void Init(eHtml5TreeOperation aOpCode, nsIContent* aNode) {
|
||||
mOpCode = aOpCode;
|
||||
mNode = aNode;
|
||||
}
|
||||
inline void Init(eHtml5TreeOperation aOpCode, nsIContent* aNode, nsIContent* aParent) {
|
||||
mOpCode = aOpCode;
|
||||
mNode = aNode;
|
||||
mParent = aParent;
|
||||
}
|
||||
inline void Init(eHtml5TreeOperation aOpCode, nsIContent* aNode, nsIContent* aParent, nsIContent* aTable) {
|
||||
mOpCode = aOpCode;
|
||||
mNode = aNode;
|
||||
mParent = aParent;
|
||||
mTable = aTable;
|
||||
}
|
||||
nsresult Perform(nsHtml5TreeBuilder* aBuilder);
|
||||
private:
|
||||
eHtml5TreeOperation mOpCode;
|
||||
nsCOMPtr<nsIContent> mNode;
|
||||
nsCOMPtr<nsIContent> mParent;
|
||||
nsCOMPtr<nsIContent> mTable;
|
||||
};
|
||||
|
||||
#endif // nsHtml5TreeOperation_h__
|
122
content/html/parser/src/nsHtml5UTF16Buffer.cpp
Normal file
122
content/html/parser/src/nsHtml5UTF16Buffer.cpp
Normal file
@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Mozilla Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Please edit UTF16Buffer.java instead and regenerate.
|
||||
*/
|
||||
|
||||
#define nsHtml5UTF16Buffer_cpp__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsString.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "jArray.h"
|
||||
#include "nsHtml5DocumentMode.h"
|
||||
#include "nsHtml5ArrayCopy.h"
|
||||
#include "nsHtml5NamedCharacters.h"
|
||||
#include "nsHtml5Parser.h"
|
||||
#include "nsHtml5Atoms.h"
|
||||
#include "nsHtml5ByteReadable.h"
|
||||
|
||||
#include "nsHtml5Tokenizer.h"
|
||||
#include "nsHtml5TreeBuilder.h"
|
||||
#include "nsHtml5MetaScanner.h"
|
||||
#include "nsHtml5AttributeName.h"
|
||||
#include "nsHtml5ElementName.h"
|
||||
#include "nsHtml5HtmlAttributes.h"
|
||||
#include "nsHtml5StackNode.h"
|
||||
#include "nsHtml5StateSnapshot.h"
|
||||
#include "nsHtml5Portability.h"
|
||||
|
||||
#include "nsHtml5UTF16Buffer.h"
|
||||
|
||||
|
||||
nsHtml5UTF16Buffer::nsHtml5UTF16Buffer(PRUnichar* buffer, PRInt32 start, PRInt32 end)
|
||||
: buffer(buffer),
|
||||
start(start),
|
||||
end(end)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5UTF16Buffer);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsHtml5UTF16Buffer::getStart()
|
||||
{
|
||||
return start;
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5UTF16Buffer::setStart(PRInt32 start)
|
||||
{
|
||||
this->start = start;
|
||||
}
|
||||
|
||||
PRUnichar*
|
||||
nsHtml5UTF16Buffer::getBuffer()
|
||||
{
|
||||
return buffer;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsHtml5UTF16Buffer::getEnd()
|
||||
{
|
||||
return end;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHtml5UTF16Buffer::hasMore()
|
||||
{
|
||||
return start < end;
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5UTF16Buffer::adjust(PRBool lastWasCR)
|
||||
{
|
||||
if (lastWasCR && buffer[start] == '\n') {
|
||||
start++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5UTF16Buffer::setEnd(PRInt32 end)
|
||||
{
|
||||
this->end = end;
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5UTF16Buffer::initializeStatics()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5UTF16Buffer::releaseStatics()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#include "nsHtml5UTF16BufferCppSupplement.h"
|
||||
|
85
content/html/parser/src/nsHtml5UTF16Buffer.h
Normal file
85
content/html/parser/src/nsHtml5UTF16Buffer.h
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Mozilla Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Please edit UTF16Buffer.java instead and regenerate.
|
||||
*/
|
||||
|
||||
#ifndef nsHtml5UTF16Buffer_h__
|
||||
#define nsHtml5UTF16Buffer_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsString.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "jArray.h"
|
||||
#include "nsHtml5DocumentMode.h"
|
||||
#include "nsHtml5ArrayCopy.h"
|
||||
#include "nsHtml5NamedCharacters.h"
|
||||
#include "nsHtml5Parser.h"
|
||||
#include "nsHtml5Atoms.h"
|
||||
#include "nsHtml5ByteReadable.h"
|
||||
|
||||
class nsHtml5Parser;
|
||||
|
||||
class nsHtml5Tokenizer;
|
||||
class nsHtml5TreeBuilder;
|
||||
class nsHtml5MetaScanner;
|
||||
class nsHtml5AttributeName;
|
||||
class nsHtml5ElementName;
|
||||
class nsHtml5HtmlAttributes;
|
||||
class nsHtml5StateSnapshot;
|
||||
class nsHtml5Portability;
|
||||
|
||||
|
||||
class nsHtml5UTF16Buffer
|
||||
{
|
||||
private:
|
||||
PRUnichar* buffer;
|
||||
PRInt32 start;
|
||||
PRInt32 end;
|
||||
public:
|
||||
nsHtml5UTF16Buffer(PRUnichar* buffer, PRInt32 start, PRInt32 end);
|
||||
PRInt32 getStart();
|
||||
void setStart(PRInt32 start);
|
||||
PRUnichar* getBuffer();
|
||||
PRInt32 getEnd();
|
||||
PRBool hasMore();
|
||||
void adjust(PRBool lastWasCR);
|
||||
void setEnd(PRInt32 end);
|
||||
static void initializeStatics();
|
||||
static void releaseStatics();
|
||||
|
||||
#include "nsHtml5UTF16BufferHSupplement.h"
|
||||
};
|
||||
|
||||
#ifdef nsHtml5UTF16Buffer_cpp__
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
64
content/html/parser/src/nsHtml5UTF16BufferCppSupplement.h
Normal file
64
content/html/parser/src/nsHtml5UTF16BufferCppSupplement.h
Normal file
@ -0,0 +1,64 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is HTML Parser C++ Translator code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsTraceRefcnt.h"
|
||||
|
||||
nsHtml5UTF16Buffer::nsHtml5UTF16Buffer(PRInt32 size)
|
||||
: buffer(new PRUnichar[size]),
|
||||
start(0),
|
||||
end(0),
|
||||
next(nsnull),
|
||||
key(nsnull)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5UTF16Buffer);
|
||||
}
|
||||
|
||||
nsHtml5UTF16Buffer::nsHtml5UTF16Buffer(void* key)
|
||||
: buffer(nsnull),
|
||||
start(0),
|
||||
end(0),
|
||||
next(nsnull),
|
||||
key(key)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5UTF16Buffer);
|
||||
}
|
||||
|
||||
nsHtml5UTF16Buffer::~nsHtml5UTF16Buffer()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsHtml5UTF16Buffer);
|
||||
delete[] buffer;
|
||||
}
|
43
content/html/parser/src/nsHtml5UTF16BufferHSupplement.h
Normal file
43
content/html/parser/src/nsHtml5UTF16BufferHSupplement.h
Normal file
@ -0,0 +1,43 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is HTML Parser C++ Translator code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Henri Sivonen <hsivonen@iki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
public:
|
||||
nsHtml5UTF16Buffer(PRInt32 size);
|
||||
nsHtml5UTF16Buffer(void* key);
|
||||
~nsHtml5UTF16Buffer();
|
||||
nsHtml5UTF16Buffer* next;
|
||||
void* key;
|
@ -1432,33 +1432,6 @@ nsXMLContentSink::ParsePIData(const nsString &aData, nsString &aHref,
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Extends nsContentSink::ProcessMETATag to grab the 'viewport' meta tag. This
|
||||
* information is ignored by the generic content sink because it only stores
|
||||
* http-equiv meta tags. We need it in the XMLContentSink for XHTML documents.
|
||||
*
|
||||
* Initially implemented for bug #436083
|
||||
*/
|
||||
nsresult
|
||||
nsXMLContentSink::ProcessMETATag(nsIContent *aContent) {
|
||||
|
||||
/* Call the superclass method. */
|
||||
nsContentSink::ProcessMETATag(aContent);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
/* Look for the viewport meta tag. If we find it, process it and put the
|
||||
* data into the document header. */
|
||||
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
|
||||
nsGkAtoms::viewport, eIgnoreCase)) {
|
||||
nsAutoString value;
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::content, value);
|
||||
rv = nsContentUtils::ProcessViewportInfo(mDocument, value);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXMLContentSink::HandleXMLDeclaration(const PRUnichar *aVersion,
|
||||
const PRUnichar *aEncoding,
|
||||
|
@ -113,8 +113,6 @@ public:
|
||||
nsString &aTitle, nsString &aMedia,
|
||||
PRBool &aIsAlternate);
|
||||
|
||||
virtual nsresult ProcessMETATag(nsIContent* aContent);
|
||||
|
||||
protected:
|
||||
// Start layout. If aIgnorePendingSheets is true, this will happen even if
|
||||
// we still have stylesheet loads pending. Otherwise, we'll wait until the
|
||||
|
@ -761,6 +761,18 @@ txXPathNodeUtils::comparePosition(const txXPathNode& aNode,
|
||||
return total < otherTotal ? -1 : 1;
|
||||
}
|
||||
|
||||
/* static */
|
||||
PRBool
|
||||
txXPathNodeUtils::isHTMLElementInHTMLDocument(const txXPathNode& aNode)
|
||||
{
|
||||
if (!aNode.isContent()) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
nsIContent* content = aNode.Content();
|
||||
return (content->IsNodeOfType(nsINode::eHTML) &&
|
||||
!(content->GetOwnerDoc()->IsCaseSensitive()));
|
||||
}
|
||||
|
||||
/* static */
|
||||
txXPathNode*
|
||||
txXPathNativeNode::createXPathNode(nsIContent* aContent, PRBool aKeepRootAlive)
|
||||
|
@ -72,7 +72,12 @@ PRBool txNameTest::matches(const txXPathNode& aNode, txIMatchContext* aContext)
|
||||
return MB_TRUE;
|
||||
|
||||
// Compare namespaces
|
||||
if (txXPathNodeUtils::getNamespaceID(aNode) != mNamespace)
|
||||
if (mNamespace != txXPathNodeUtils::getNamespaceID(aNode)
|
||||
#ifndef TX_EXE
|
||||
&& !(mNamespace == kNameSpaceID_None &&
|
||||
txXPathNodeUtils::isHTMLElementInHTMLDocument(aNode))
|
||||
#endif
|
||||
)
|
||||
return MB_FALSE;
|
||||
|
||||
// Name wild?
|
||||
|
@ -143,8 +143,9 @@ public:
|
||||
static PRBool isProcessingInstruction(const txXPathNode& aNode);
|
||||
static PRBool isComment(const txXPathNode& aNode);
|
||||
static PRBool isText(const txXPathNode& aNode);
|
||||
|
||||
#ifdef TX_EXE
|
||||
#ifndef TX_EXE
|
||||
static PRBool isHTMLElementInHTMLDocument(const txXPathNode& aNode);
|
||||
#else
|
||||
private:
|
||||
static void appendNodeValueHelper(NodeDefinition* aNode, nsAString& aResult);
|
||||
#endif
|
||||
|
@ -453,11 +453,10 @@ txMozillaXMLOutput::startElement(nsIAtom* aPrefix, nsIAtom* aLocalName,
|
||||
|
||||
aLowercaseLocalName = owner;
|
||||
}
|
||||
return startElementInternal(nsnull, aLowercaseLocalName,
|
||||
kNameSpaceID_None, kNameSpaceID_XHTML);
|
||||
return startElementInternal(nsnull, aLowercaseLocalName, kNameSpaceID_XHTML);
|
||||
}
|
||||
|
||||
return startElementInternal(aPrefix, aLocalName, aNsID, aNsID);
|
||||
return startElementInternal(aPrefix, aLocalName, aNsID);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -465,11 +464,11 @@ txMozillaXMLOutput::startElement(nsIAtom* aPrefix,
|
||||
const nsSubstring& aLocalName,
|
||||
const PRInt32 aNsID)
|
||||
{
|
||||
PRInt32 elemType = aNsID;
|
||||
PRInt32 nsId = aNsID;
|
||||
nsCOMPtr<nsIAtom> lname;
|
||||
|
||||
if (mOutputFormat.mMethod == eHTMLOutput && aNsID == kNameSpaceID_None) {
|
||||
elemType = kNameSpaceID_XHTML;
|
||||
nsId = kNameSpaceID_XHTML;
|
||||
|
||||
nsAutoString lnameStr;
|
||||
ToLowerCase(aLocalName, lnameStr);
|
||||
@ -483,22 +482,21 @@ txMozillaXMLOutput::startElement(nsIAtom* aPrefix,
|
||||
NS_ENSURE_TRUE(lname, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
// Check that it's a valid name
|
||||
if (!nsContentUtils::IsValidNodeName(lname, aPrefix, aNsID)) {
|
||||
if (!nsContentUtils::IsValidNodeName(lname, aPrefix, nsId)) {
|
||||
// Try without prefix
|
||||
aPrefix = nsnull;
|
||||
if (!nsContentUtils::IsValidNodeName(lname, aPrefix, aNsID)) {
|
||||
if (!nsContentUtils::IsValidNodeName(lname, aPrefix, nsId)) {
|
||||
return NS_ERROR_XSLT_BAD_NODE_NAME;
|
||||
}
|
||||
}
|
||||
|
||||
return startElementInternal(aPrefix, lname, aNsID, elemType);
|
||||
return startElementInternal(aPrefix, lname, nsId);
|
||||
}
|
||||
|
||||
nsresult
|
||||
txMozillaXMLOutput::startElementInternal(nsIAtom* aPrefix,
|
||||
nsIAtom* aLocalName,
|
||||
PRInt32 aNsID,
|
||||
PRInt32 aElemType)
|
||||
PRInt32 aNsID)
|
||||
{
|
||||
TX_ENSURE_CURRENTNODE;
|
||||
|
||||
@ -539,12 +537,12 @@ txMozillaXMLOutput::startElementInternal(nsIAtom* aPrefix,
|
||||
ni = mNodeInfoManager->GetNodeInfo(aLocalName, aPrefix, aNsID);
|
||||
NS_ENSURE_TRUE(ni, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_NewElement(getter_AddRefs(mOpenedElement), aElemType, ni, PR_FALSE);
|
||||
NS_NewElement(getter_AddRefs(mOpenedElement), aNsID, ni, PR_FALSE);
|
||||
|
||||
// Set up the element and adjust state
|
||||
if (!mNoFixup) {
|
||||
if (aElemType == kNameSpaceID_XHTML) {
|
||||
mOpenedElementIsHTML = aNsID != kNameSpaceID_XHTML;
|
||||
if (aNsID == kNameSpaceID_XHTML) {
|
||||
mOpenedElementIsHTML = (mOutputFormat.mMethod == eHTMLOutput);
|
||||
rv = startHTMLElement(mOpenedElement, mOpenedElementIsHTML);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -971,7 +969,7 @@ txMozillaXMLOutput::createHTMLElement(nsIAtom* aName,
|
||||
|
||||
nsCOMPtr<nsINodeInfo> ni;
|
||||
ni = mNodeInfoManager->GetNodeInfo(aName, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(ni, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return NS_NewHTMLElement(aResult, ni, PR_FALSE);
|
||||
|
@ -121,7 +121,7 @@ private:
|
||||
nsresult attributeInternal(nsIAtom* aPrefix, nsIAtom* aLocalName,
|
||||
PRInt32 aNsID, const nsString& aValue);
|
||||
nsresult startElementInternal(nsIAtom* aPrefix, nsIAtom* aLocalName,
|
||||
PRInt32 aNsID, PRInt32 aElemType);
|
||||
PRInt32 aNsID);
|
||||
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
nsCOMPtr<nsINode> mCurrentNode; // This is updated once an element is
|
||||
|
@ -93,7 +93,7 @@ txUnknownHandler::startElement(nsIAtom* aPrefix, nsIAtom* aLocalName,
|
||||
aLowercaseLocalName = owner;
|
||||
}
|
||||
|
||||
PRBool htmlRoot = aNsID == kNameSpaceID_None && !aPrefix &&
|
||||
PRBool htmlRoot = aNsID == kNameSpaceID_XHTML && !aPrefix &&
|
||||
aLowercaseLocalName == txHTMLAtoms::html;
|
||||
|
||||
// Use aLocalName and not aLowercaseLocalName in case the output
|
||||
|
@ -94,6 +94,7 @@ REQUIRES = xpcom \
|
||||
uconv \
|
||||
txtsvc \
|
||||
thebes \
|
||||
html5 \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
@ -120,6 +121,7 @@ SHARED_LIBRARY_LIBS = \
|
||||
$(DEPTH)/content/events/src/$(LIB_PREFIX)gkconevents_s.$(LIB_SUFFIX) \
|
||||
$(DEPTH)/content/html/content/src/$(LIB_PREFIX)gkconhtmlcon_s.$(LIB_SUFFIX) \
|
||||
$(DEPTH)/content/html/document/src/$(LIB_PREFIX)gkconhtmldoc_s.$(LIB_SUFFIX) \
|
||||
$(DEPTH)/content/html/parser/src/$(LIB_PREFIX)html5p.$(LIB_SUFFIX) \
|
||||
$(DEPTH)/content/xml/content/src/$(LIB_PREFIX)gkconxmlcon_s.$(LIB_SUFFIX) \
|
||||
$(DEPTH)/content/xml/document/src/$(LIB_PREFIX)gkconxmldoc_s.$(LIB_SUFFIX) \
|
||||
$(DEPTH)/content/xslt/src/base/$(LIB_PREFIX)txbase_s.$(LIB_SUFFIX) \
|
||||
|
@ -358,15 +358,15 @@ nsContentDLF::CreateBlankDocument(nsILoadGroup *aLoadGroup,
|
||||
nsCOMPtr<nsINodeInfo> htmlNodeInfo;
|
||||
|
||||
// generate an html html element
|
||||
htmlNodeInfo = nim->GetNodeInfo(nsGkAtoms::html, 0, kNameSpaceID_None);
|
||||
htmlNodeInfo = nim->GetNodeInfo(nsGkAtoms::html, 0, kNameSpaceID_XHTML);
|
||||
nsCOMPtr<nsIContent> htmlElement = NS_NewHTMLHtmlElement(htmlNodeInfo);
|
||||
|
||||
// generate an html head element
|
||||
htmlNodeInfo = nim->GetNodeInfo(nsGkAtoms::head, 0, kNameSpaceID_None);
|
||||
htmlNodeInfo = nim->GetNodeInfo(nsGkAtoms::head, 0, kNameSpaceID_XHTML);
|
||||
nsCOMPtr<nsIContent> headElement = NS_NewHTMLHeadElement(htmlNodeInfo);
|
||||
|
||||
// generate an html body element
|
||||
htmlNodeInfo = nim->GetNodeInfo(nsGkAtoms::body, 0, kNameSpaceID_None);
|
||||
htmlNodeInfo = nim->GetNodeInfo(nsGkAtoms::body, 0, kNameSpaceID_XHTML);
|
||||
nsCOMPtr<nsIContent> bodyElement = NS_NewHTMLBodyElement(htmlNodeInfo);
|
||||
|
||||
// blat in the structure
|
||||
|
@ -83,6 +83,7 @@
|
||||
#include "nsIFocusEventSuppressor.h"
|
||||
#include "nsDOMThreadService.h"
|
||||
#include "nsHTMLDNSPrefetch.h"
|
||||
#include "nsHtml5Module.h"
|
||||
#include "nsCrossSiteListenerProxy.h"
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
@ -268,6 +269,8 @@ nsLayoutStatics::Initialize()
|
||||
nsAudioStream::InitLibrary();
|
||||
#endif
|
||||
|
||||
nsHtml5Module::InitializeStatics();
|
||||
|
||||
nsCrossSiteListenerProxy::Startup();
|
||||
|
||||
return NS_OK;
|
||||
@ -356,6 +359,8 @@ nsLayoutStatics::Shutdown()
|
||||
#endif
|
||||
|
||||
nsXMLHttpRequest::ShutdownACCache();
|
||||
|
||||
nsHtml5Module::ReleaseStatics();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1026,7 +1026,7 @@ nsComboboxControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = nimgr->GetNodeInfo(nsGkAtoms::input, nsnull, kNameSpaceID_None);
|
||||
nodeInfo = nimgr->GetNodeInfo(nsGkAtoms::input, nsnull, kNameSpaceID_XHTML);
|
||||
|
||||
// create button which drops the list down
|
||||
NS_NewHTMLElement(getter_AddRefs(mButtonContent), nodeInfo, PR_FALSE);
|
||||
|
@ -155,7 +155,7 @@ nsFileControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::input, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
|
||||
// Create the text content
|
||||
NS_NewHTMLElement(getter_AddRefs(mTextContent), nodeInfo, PR_FALSE);
|
||||
|
@ -193,7 +193,7 @@ nsIsIndexFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
|
||||
|
||||
// Create an hr
|
||||
nsCOMPtr<nsINodeInfo> hrInfo;
|
||||
hrInfo = nimgr->GetNodeInfo(nsGkAtoms::hr, nsnull, kNameSpaceID_None);
|
||||
hrInfo = nimgr->GetNodeInfo(nsGkAtoms::hr, nsnull, kNameSpaceID_XHTML);
|
||||
|
||||
NS_NewHTMLElement(getter_AddRefs(mPreHr), hrInfo, PR_FALSE);
|
||||
if (!mPreHr || !aElements.AppendElement(mPreHr))
|
||||
@ -211,7 +211,7 @@ nsIsIndexFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
|
||||
|
||||
// Create text input field
|
||||
nsCOMPtr<nsINodeInfo> inputInfo;
|
||||
inputInfo = nimgr->GetNodeInfo(nsGkAtoms::input, nsnull, kNameSpaceID_None);
|
||||
inputInfo = nimgr->GetNodeInfo(nsGkAtoms::input, nsnull, kNameSpaceID_XHTML);
|
||||
|
||||
NS_NewHTMLElement(getter_AddRefs(mInputContent), inputInfo, PR_FALSE);
|
||||
if (!mInputContent)
|
||||
|
@ -2967,21 +2967,10 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays()
|
||||
// might kill us...
|
||||
nsCOMPtr<nsIPluginInstanceOwner> kungFuDeathGrip(this);
|
||||
|
||||
if (ni->NamespaceEquals(kNameSpaceID_XHTML)) {
|
||||
// For XHTML elements we need to take the namespace URI into
|
||||
// account when looking for param elements.
|
||||
NS_NAMED_LITERAL_STRING(xhtml_ns, "http://www.w3.org/1999/xhtml");
|
||||
|
||||
NS_NAMED_LITERAL_STRING(xhtml_ns, "http://www.w3.org/1999/xhtml");
|
||||
|
||||
mydomElement->GetElementsByTagNameNS(xhtml_ns, NS_LITERAL_STRING("param"),
|
||||
getter_AddRefs(allParams));
|
||||
} else {
|
||||
// If content is not XHTML, it must be HTML, no need to worry
|
||||
// about namespaces then...
|
||||
|
||||
mydomElement->GetElementsByTagName(NS_LITERAL_STRING("param"),
|
||||
mydomElement->GetElementsByTagNameNS(xhtml_ns, NS_LITERAL_STRING("param"),
|
||||
getter_AddRefs(allParams));
|
||||
}
|
||||
|
||||
if (allParams) {
|
||||
PRUint32 numAllParams;
|
||||
@ -3072,7 +3061,8 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays()
|
||||
// (see the AddAttributes functions in the HTML and XML content sinks).
|
||||
PRInt16 start, end, increment;
|
||||
if (mContent->IsNodeOfType(nsINode::eHTML) &&
|
||||
mContent->NodeInfo()->NamespaceEquals(kNameSpaceID_None)) {
|
||||
mContent->GetOwnerDoc() && // XXX clean up after bug 335998 lands
|
||||
!(mContent->GetOwnerDoc()->IsCaseSensitive())) {
|
||||
// HTML. Walk attributes in reverse order.
|
||||
start = numRealAttrs - 1;
|
||||
end = -1;
|
||||
|
@ -2,7 +2,6 @@
|
||||
<html>
|
||||
<body>
|
||||
test
|
||||
<font color="green" color="red">test</font>
|
||||
<input type="checkbox" type="text" checked="checked">
|
||||
<font color="green" color="red">test</font><input type="checkbox" type="text" checked="checked">
|
||||
</body>
|
||||
</html>
|
||||
|
@ -3,7 +3,6 @@
|
||||
<body>
|
||||
<table>
|
||||
test
|
||||
<font color="green" color="red">test</font>
|
||||
<input type="checkbox" type="text" checked="checked">
|
||||
<font color="green" color="red">test</font><input type="checkbox" type="text" checked="checked">
|
||||
</body>
|
||||
</html>
|
||||
|
@ -11,5 +11,4 @@ img {
|
||||
</style>
|
||||
</head>
|
||||
<body style="width: 150px; border: 1px solid black; white-space:pre;"><table><tbody><tr><td><img>
|
||||
<span><img></span></td></tr></tbody></table></body>
|
||||
</html>
|
||||
<span><img></span></td></tr></tbody></table></body></html>
|
@ -16,5 +16,5 @@ function run() {
|
||||
}
|
||||
</script>
|
||||
<body onload="setTimeout(run, 0)">
|
||||
<iframe style="visibility:hidden;position:absolute;height:100%;width:100%" src="resize-detector-iframe.html"></iframe></p>
|
||||
<iframe style="visibility:hidden;position:absolute;height:100%;width:100%" src="resize-detector-iframe.html"></iframe>
|
||||
</body>
|
||||
|
@ -4,9 +4,11 @@
|
||||
<SCRIPT>
|
||||
|
||||
function doIt() {
|
||||
var table = document.getElementsByTagName("TABLE")[0];
|
||||
var col = document.getElementsByTagName("COL")[0];
|
||||
table.removeChild(col);
|
||||
col.parentNode.removeChild(col);
|
||||
// HTML5 implies a colgroup around the cols,
|
||||
// so this test case should really be XHTML
|
||||
// in order to test bare col
|
||||
}
|
||||
</SCRIPT>
|
||||
</HEAD>
|
||||
|
@ -4,9 +4,11 @@
|
||||
<SCRIPT>
|
||||
|
||||
function doIt() {
|
||||
var table = document.getElementsByTagName("TABLE")[0];
|
||||
var col = document.getElementsByTagName("COL")[1];
|
||||
table.removeChild(col);
|
||||
col.parentNode.removeChild(col);
|
||||
// HTML5 implies a colgroup around the cols,
|
||||
// so this test case should really be XHTML
|
||||
// in order to test bare col
|
||||
}
|
||||
</SCRIPT>
|
||||
</HEAD>
|
||||
|
@ -4,9 +4,11 @@
|
||||
<SCRIPT>
|
||||
|
||||
function doIt() {
|
||||
var table = document.getElementsByTagName("TABLE")[0];
|
||||
var col = document.getElementsByTagName("COL")[2];
|
||||
table.removeChild(col);
|
||||
col.parentNode.removeChild(col);
|
||||
// HTML5 implies a colgroup around the cols,
|
||||
// so this test case should really be XHTML
|
||||
// in order to test bare col
|
||||
}
|
||||
</SCRIPT>
|
||||
</HEAD>
|
||||
|
@ -4,11 +4,12 @@
|
||||
<SCRIPT>
|
||||
|
||||
function doIt() {
|
||||
var table = document.getElementsByTagName("TABLE")[0];
|
||||
var refCol = document.getElementsByTagName("COL")[0];
|
||||
var col = document.createElement("COL", null);
|
||||
col.width = 100;
|
||||
table.insertBefore(col, refCol);
|
||||
refCol.parentNode.insertBefore(col, refCol);
|
||||
// HTML5 parser implies a colgroup around col, so this test
|
||||
// case should really be XHTML
|
||||
}
|
||||
</SCRIPT>
|
||||
</HEAD>
|
||||
|
@ -4,11 +4,12 @@
|
||||
<SCRIPT>
|
||||
|
||||
function doIt() {
|
||||
var table = document.getElementsByTagName("TABLE")[0];
|
||||
var refCol = document.getElementsByTagName("COL")[1];
|
||||
var col = document.createElement("COL", null);
|
||||
col.width = 200;
|
||||
table.insertBefore(col, refCol);
|
||||
refCol.parentNode.insertBefore(col, refCol);
|
||||
// HTML5 parser implies a colgroup around col, so this test
|
||||
// case should really be XHTML
|
||||
}
|
||||
</SCRIPT>
|
||||
</HEAD>
|
||||
|
@ -4,11 +4,12 @@
|
||||
<SCRIPT>
|
||||
|
||||
function doIt() {
|
||||
var table = document.getElementsByTagName("TABLE")[0];
|
||||
var refCol = document.getElementsByTagName("COL")[2];
|
||||
var col = document.createElement("COL", null);
|
||||
col.width = 150;
|
||||
table.insertBefore(col, refCol);
|
||||
refCol.parentNode.insertBefore(col, refCol);
|
||||
// HTML5 parser implies a colgroup around col, so this test
|
||||
// case should really be XHTML
|
||||
}
|
||||
</SCRIPT>
|
||||
</HEAD>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user