Bug 487949 - Land HTML5 parser on trunk preffed off r=mrbkap, sr=jonas
This commit is contained in:
Родитель
240dae8ca9
Коммит
3139ad9f27
|
@ -439,10 +439,13 @@ public:
|
|||
* @param aNotify whether to notify the document (current document for
|
||||
* nsIContent, and |this| for nsIDocument) that the remove has
|
||||
* occurred
|
||||
* @param aMutationEvent whether to fire a mutation event
|
||||
*
|
||||
* Note: If there is no child at aIndex, this method will simply do nothing.
|
||||
*/
|
||||
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify) = 0;
|
||||
virtual nsresult RemoveChildAt(PRUint32 aIndex,
|
||||
PRBool aNotify,
|
||||
PRBool aMutationEvent = PR_TRUE) = 0;
|
||||
|
||||
/**
|
||||
* Get a property associated with this node.
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -164,6 +164,7 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
|
|||
#include "nsIMIMEHeaderParam.h"
|
||||
#include "nsIDOMDragEvent.h"
|
||||
#include "nsDOMDataTransfer.h"
|
||||
#include "nsHtml5Module.h"
|
||||
|
||||
#ifdef IBMBIDI
|
||||
#include "nsIBidiKeyboard.h"
|
||||
|
@ -3578,6 +3579,58 @@ 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 && nsHtml5Module::Enabled) {
|
||||
// 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);
|
||||
if (contextAsContent && !contextAsContent->IsNodeOfType(nsINode::eELEMENT)) {
|
||||
contextAsContent = contextAsContent->GetParent();
|
||||
if (contextAsContent && !contextAsContent->IsNodeOfType(nsINode::eELEMENT)) {
|
||||
// can this even happen?
|
||||
contextAsContent = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
if (contextAsContent) {
|
||||
parser->ParseFragment(aFragment,
|
||||
frag,
|
||||
contextAsContent->Tag(),
|
||||
contextAsContent->GetNameSpaceID(),
|
||||
(document->GetCompatibilityMode() == eCompatibility_NavQuirks));
|
||||
} else {
|
||||
parser->ParseFragment(aFragment,
|
||||
frag,
|
||||
nsGkAtoms::body,
|
||||
kNameSpaceID_XHTML,
|
||||
(document->GetCompatibilityMode() == eCompatibility_NavQuirks));
|
||||
}
|
||||
|
||||
NS_ADDREF(*aReturn = frag);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAutoTArray<nsString, 32> tagStack;
|
||||
nsAutoString uriStr, nameStr;
|
||||
|
@ -3635,14 +3688,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.
|
||||
|
|
|
@ -699,8 +699,9 @@ nsDOMAttribute::AppendChildTo(nsIContent* aKid, PRBool aNotify)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsDOMAttribute::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
|
||||
nsDOMAttribute::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent)
|
||||
{
|
||||
NS_ASSERTION(aMutationEvent, "Someone tried to inhibit mutations on attribute child removal.");
|
||||
if (aIndex != 0 || !mChild) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ public:
|
|||
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
|
||||
PRBool aNotify);
|
||||
virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
|
||||
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
|
||||
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent = PR_TRUE);
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
|
||||
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
|
||||
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
|
||||
|
|
|
@ -3221,8 +3221,9 @@ nsDocument::AppendChildTo(nsIContent* aKid, PRBool aNotify)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsDocument::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
|
||||
nsDocument::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent)
|
||||
{
|
||||
NS_ASSERTION(aMutationEvent, "Someone tried to inhibit mutations on document child removal.");
|
||||
nsCOMPtr<nsIContent> oldKid = GetChildAt(aIndex);
|
||||
if (!oldKid) {
|
||||
return NS_OK;
|
||||
|
@ -3234,7 +3235,8 @@ nsDocument::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
|
|||
}
|
||||
|
||||
nsresult rv = nsGenericElement::doRemoveChildAt(aIndex, aNotify, oldKid,
|
||||
nsnull, this, mChildren);
|
||||
nsnull, this, mChildren,
|
||||
aMutationEvent);
|
||||
mCachedRootContent = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -810,7 +810,7 @@ public:
|
|||
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
|
||||
PRBool aNotify);
|
||||
virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
|
||||
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
|
||||
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent = PR_TRUE);
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
|
||||
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
|
||||
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
|
||||
|
|
|
@ -752,7 +752,7 @@ nsGenericDOMDataNode::InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsGenericDOMDataNode::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
|
||||
nsGenericDOMDataNode::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ public:
|
|||
virtual PRInt32 IndexOf(nsINode* aPossibleChild) const;
|
||||
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
|
||||
PRBool aNotify);
|
||||
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
|
||||
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent = PR_TRUE);
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
|
||||
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
|
||||
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
|
||||
|
|
|
@ -3246,14 +3246,14 @@ nsGenericElement::doInsertChildAt(nsIContent* aKid, PRUint32 aIndex,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsGenericElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
|
||||
nsGenericElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent)
|
||||
{
|
||||
nsCOMPtr<nsIContent> oldKid = mAttrsAndChildren.GetSafeChildAt(aIndex);
|
||||
NS_ASSERTION(oldKid == GetChildAt(aIndex), "Unexpected child in RemoveChildAt");
|
||||
|
||||
if (oldKid) {
|
||||
return doRemoveChildAt(aIndex, aNotify, oldKid, this, GetCurrentDoc(),
|
||||
mAttrsAndChildren);
|
||||
mAttrsAndChildren, aMutationEvent);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -3264,7 +3264,8 @@ nsresult
|
|||
nsGenericElement::doRemoveChildAt(PRUint32 aIndex, PRBool aNotify,
|
||||
nsIContent* aKid, nsIContent* aParent,
|
||||
nsIDocument* aDocument,
|
||||
nsAttrAndChildArray& aChildArray)
|
||||
nsAttrAndChildArray& aChildArray,
|
||||
PRBool aMutationEvent)
|
||||
{
|
||||
NS_PRECONDITION(aParent || aDocument, "Must have document if no parent!");
|
||||
NS_PRECONDITION(!aParent || aParent->GetCurrentDoc() == aDocument,
|
||||
|
@ -3300,6 +3301,7 @@ nsGenericElement::doRemoveChildAt(PRUint32 aIndex, PRBool aNotify,
|
|||
|
||||
mozAutoSubtreeModified subtree(nsnull, nsnull);
|
||||
if (aNotify &&
|
||||
aMutationEvent &&
|
||||
nsContentUtils::HasMutationListeners(aKid,
|
||||
NS_EVENT_BITS_MUTATION_NODEREMOVED, container)) {
|
||||
mozAutoRemovableBlockerRemover blockerRemover;
|
||||
|
|
|
@ -354,7 +354,7 @@ public:
|
|||
virtual PRInt32 IndexOf(nsINode* aPossibleChild) const;
|
||||
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
|
||||
PRBool aNotify);
|
||||
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
|
||||
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent = PR_TRUE);
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
|
||||
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
|
||||
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
|
||||
|
@ -654,7 +654,8 @@ public:
|
|||
static nsresult doRemoveChildAt(PRUint32 aIndex, PRBool aNotify,
|
||||
nsIContent* aKid, nsIContent* aParent,
|
||||
nsIDocument* aDocument,
|
||||
nsAttrAndChildArray& aChildArray);
|
||||
nsAttrAndChildArray& aChildArray,
|
||||
PRBool aMutationEvent);
|
||||
|
||||
/**
|
||||
* Helper methods for implementing querySelector/querySelectorAll
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
#include "nsLWBrkCIID.h"
|
||||
#include "nsIScriptElement.h"
|
||||
#include "nsAttrName.h"
|
||||
#include "nsHtml5Module.h"
|
||||
|
||||
static const char kMozStr[] = "moz";
|
||||
|
||||
|
@ -100,6 +101,7 @@ nsHTMLContentSerializer::AppendDocumentStart(nsIDOMDocument *aDocument,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#include "nsIHTMLDocument.h"
|
||||
void
|
||||
nsHTMLContentSerializer::SerializeAttributes(nsIContent* aContent,
|
||||
nsIDOMElement *aOriginalElement,
|
||||
|
@ -108,19 +110,40 @@ nsHTMLContentSerializer::SerializeAttributes(nsIContent* aContent,
|
|||
nsIAtom* aTagName,
|
||||
nsAString& aStr)
|
||||
{
|
||||
PRInt32 count = aContent->GetAttrCount();
|
||||
if (!count)
|
||||
return;
|
||||
|
||||
nsresult rv;
|
||||
PRUint32 index, count;
|
||||
nsAutoString nameStr, valueStr;
|
||||
|
||||
count = aContent->GetAttrCount();
|
||||
|
||||
NS_NAMED_LITERAL_STRING(_mozStr, "_moz");
|
||||
|
||||
// Loop backward over the attributes, since the order they are stored in is
|
||||
// the opposite of the order they were parsed in (see bug 213347 for reason).
|
||||
// index is unsigned, hence index >= 0 is always true.
|
||||
for (index = count; index > 0; ) {
|
||||
--index;
|
||||
// HTML5 parser stored them in the order they were parsed so we want to
|
||||
// loop forward in that case.
|
||||
nsIDocument* doc = aContent->GetOwnerDocument();
|
||||
PRBool caseSensitive = doc && doc->IsCaseSensitive();
|
||||
PRBool loopForward = PR_FALSE;
|
||||
if (!caseSensitive) {
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc(do_QueryInterface(doc));
|
||||
if (htmlDoc) {
|
||||
loopForward = nsHtml5Module::Enabled;
|
||||
}
|
||||
}
|
||||
PRInt32 index, limit, step;
|
||||
if (loopForward) {
|
||||
index = 0;
|
||||
limit = count;
|
||||
step = 1;
|
||||
}
|
||||
else {
|
||||
// Loop backward over the attributes, since the order they are stored in is
|
||||
// the opposite of the order they were parsed in (see bug 213347 for reason).
|
||||
index = count - 1;
|
||||
limit = -1;
|
||||
step = -1;
|
||||
}
|
||||
|
||||
for (; index != limit; index += step) {
|
||||
const nsAttrName* name = aContent->GetAttrNameAt(index);
|
||||
PRInt32 namespaceID = name->NamespaceID();
|
||||
nsIAtom* attrName = name->LocalName();
|
||||
|
|
|
@ -15,20 +15,20 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=417255
|
|||
<body>
|
||||
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=417255">Mozilla Bug 417255</a>
|
||||
<p id="display" style="width:800px"></p>
|
||||
<div id="display" style="width:800px"></div>
|
||||
|
||||
<p><span id="s1" style="border:2px dotted red;"><span class="spacer" style="width:100px"></span>
|
||||
<div><span id="s1" style="border:2px dotted red;"><span class="spacer" style="width:100px"></span>
|
||||
<div style="width:500px; height:100px; background:yellow;"></div>
|
||||
<span class="spacer" style="width:200px"></span></span>
|
||||
<span class="spacer" style="width:200px"></span></span></div>
|
||||
|
||||
<p><span id="s2" style="border:2px dotted red;"><span class="spacer" style="width:100px"></span>
|
||||
<div><span id="s2" style="border:2px dotted red;"><span class="spacer" style="width:100px"></span>
|
||||
<div style="width:150px; height:100px; background:yellow;"></div>
|
||||
<span class="spacer" style="width:200px"></span></span>
|
||||
<span class="spacer" style="width:200px"></span></span></div>
|
||||
|
||||
<!-- test nested spans around the IB split -->
|
||||
<p><span id="s3" style="border:2px dotted red;"><span><span class="spacer" style="width:100px"></span>
|
||||
<div><span id="s3" style="border:2px dotted red;"><span><span class="spacer" style="width:100px"></span>
|
||||
<div style="width:500px; height:100px; background:yellow;"></div>
|
||||
<span class="spacer" style="width:200px"></span></span></span>
|
||||
<span class="spacer" style="width:200px"></span></span></span></div>
|
||||
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
// nsGenericElement
|
||||
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
|
||||
PRBool aNotify);
|
||||
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
|
||||
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent = PR_TRUE);
|
||||
|
||||
// nsIContent
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
|
||||
|
@ -185,10 +185,11 @@ nsHTMLOptGroupElement::InsertChildAt(nsIContent* aKid,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLOptGroupElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
|
||||
nsHTMLOptGroupElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent)
|
||||
{
|
||||
NS_ASSERTION(aMutationEvent, "Someone tried to inhibit mutation events on optgroup child removal.");
|
||||
nsSafeOptionListMutation safeMutation(GetSelect(), this, nsnull, aIndex);
|
||||
nsresult rv = nsGenericHTMLElement::RemoveChildAt(aIndex, aNotify);
|
||||
nsresult rv = nsGenericHTMLElement::RemoveChildAt(aIndex, aNotify, aMutationEvent);
|
||||
if (NS_FAILED(rv)) {
|
||||
safeMutation.MutationFailed();
|
||||
}
|
||||
|
|
|
@ -208,10 +208,11 @@ nsHTMLSelectElement::InsertChildAt(nsIContent* aKid,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLSelectElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
|
||||
nsHTMLSelectElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent)
|
||||
{
|
||||
NS_ASSERTION(aMutationEvent, "Someone tried to inhibit mutations on select child removal.");
|
||||
nsSafeOptionListMutation safeMutation(this, this, nsnull, aIndex);
|
||||
nsresult rv = nsGenericHTMLFormElement::RemoveChildAt(aIndex, aNotify);
|
||||
nsresult rv = nsGenericHTMLFormElement::RemoveChildAt(aIndex, aNotify, aMutationEvent);
|
||||
if (NS_FAILED(rv)) {
|
||||
safeMutation.MutationFailed();
|
||||
}
|
||||
|
|
|
@ -271,7 +271,7 @@ public:
|
|||
virtual PRBool IsHTMLFocusable(PRBool *aIsFocusable, PRInt32 *aTabIndex);
|
||||
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
|
||||
PRBool aNotify);
|
||||
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
|
||||
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent = PR_TRUE);
|
||||
|
||||
// Overriden nsIFormControl methods
|
||||
NS_IMETHOD_(PRInt32) GetType() const { return NS_FORM_SELECT; }
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<html>
|
||||
<body>
|
||||
<s>
|
||||
<form>a</form>
|
||||
<iframe></iframe>
|
||||
<script src=a></script>
|
||||
<form></form>
|
||||
<table>
|
||||
<optgroup>
|
||||
</body>
|
||||
</html>
|
|
@ -1,14 +0,0 @@
|
|||
<html>
|
||||
<body>
|
||||
<s>
|
||||
<form>a</form>
|
||||
<iframe></iframe>
|
||||
</s>
|
||||
<form></form>
|
||||
<form>
|
||||
<select>
|
||||
<optgroup></optgroup>
|
||||
</select>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
|
@ -1,4 +0,0 @@
|
|||
<table>
|
||||
<th>head</th>
|
||||
<optgroup></optgroup>
|
||||
</table>
|
|
@ -1,8 +0,0 @@
|
|||
<form>
|
||||
<select>
|
||||
<optgroup></optgroup>
|
||||
</select>
|
||||
</form>
|
||||
<table>
|
||||
<th>head</th>
|
||||
</table>
|
|
@ -1,16 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="bug448564_forms.css">
|
||||
</link>
|
||||
</head>
|
||||
<body>
|
||||
<form>
|
||||
<table>
|
||||
<optgroup></optgroup>
|
||||
</table>
|
||||
<input type="button" value="button"></input>
|
||||
</form>
|
||||
<b>asdf</b>
|
||||
</body>
|
||||
</html>
|
|
@ -1,17 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="bug448564_forms.css">
|
||||
</link>
|
||||
</head>
|
||||
<body>
|
||||
<form>
|
||||
<select>
|
||||
<optgroup></optgroup>
|
||||
</select>
|
||||
<table></table>
|
||||
<input type="button" value="button"></input>
|
||||
</form>
|
||||
<b>asdf</b>
|
||||
</body>
|
||||
</html>
|
|
@ -1,10 +1,4 @@
|
|||
== bug448564-1_malformed.html bug448564-1_well-formed.html
|
||||
== bug448564-1_malformed.html bug448564-1_ideal.html
|
||||
|
||||
== bug448564-2_malformed.html bug448564-2_well-formed.html
|
||||
|
||||
== bug448564-3_malformed.html bug448564-3_well-formed.html
|
||||
|
||||
== bug448564-4a.html bug448564-4b.html
|
||||
|
||||
== bug448564-5_malformed.html bug448564-5_well-formed.html
|
||||
|
|
|
@ -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();
|
||||
|
@ -2955,33 +2953,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()
|
||||
|
|
|
@ -141,6 +141,7 @@
|
|||
#include "nsRange.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "nsCCUncollectableMarker.h"
|
||||
#include "nsHtml5Module.h"
|
||||
#include "prprf.h"
|
||||
|
||||
#define NS_MAX_DOCUMENT_WRITE_DEPTH 20
|
||||
|
@ -654,6 +655,11 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
|||
PRBool aReset,
|
||||
nsIContentSink* aSink)
|
||||
{
|
||||
PRBool loadAsHtml5 = nsHtml5Module::Enabled;
|
||||
if (aSink) {
|
||||
loadAsHtml5 = PR_FALSE;
|
||||
}
|
||||
|
||||
nsCAutoString contentType;
|
||||
aChannel->GetContentType(contentType);
|
||||
|
||||
|
@ -663,6 +669,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 {
|
||||
|
@ -709,8 +720,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());
|
||||
|
@ -925,9 +940,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,
|
||||
|
@ -935,12 +951,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);
|
||||
|
||||
|
@ -1784,6 +1805,8 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace)
|
|||
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||
}
|
||||
|
||||
PRBool loadAsHtml5 = nsHtml5Module::Enabled;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// If we already have a parser we ignore the document.open call.
|
||||
|
@ -1935,7 +1958,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;
|
||||
|
@ -1943,18 +1971,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
|
||||
|
|
|
@ -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
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,484 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package nu.validator.htmlparser.impl;
|
||||
|
||||
import nu.validator.htmlparser.annotation.IdType;
|
||||
import nu.validator.htmlparser.annotation.Local;
|
||||
import nu.validator.htmlparser.annotation.NsUri;
|
||||
import nu.validator.htmlparser.annotation.Prefix;
|
||||
import nu.validator.htmlparser.annotation.QName;
|
||||
import nu.validator.htmlparser.common.XmlViolationPolicy;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Be careful with this class. QName is the name in from HTML tokenization.
|
||||
* Otherwise, please refer to the interface doc.
|
||||
*
|
||||
* @version $Id: AttributesImpl.java 206 2008-03-20 14:09:29Z hsivonen $
|
||||
* @author hsivonen
|
||||
*/
|
||||
public final class HtmlAttributes implements Attributes {
|
||||
|
||||
// [NOCPP[
|
||||
|
||||
private static final AttributeName[] EMPTY_ATTRIBUTENAMES = new AttributeName[0];
|
||||
|
||||
private static final String[] EMPTY_STRINGS = new String[0];
|
||||
|
||||
// ]NOCPP]
|
||||
|
||||
public static final HtmlAttributes EMPTY_ATTRIBUTES = new HtmlAttributes(
|
||||
AttributeName.HTML);
|
||||
|
||||
private int mode;
|
||||
|
||||
private int length;
|
||||
|
||||
private AttributeName[] names;
|
||||
|
||||
private String[] values; // XXX perhaps make this @NoLength?
|
||||
|
||||
// [NOCPP[
|
||||
|
||||
private String idValue;
|
||||
|
||||
private int xmlnsLength;
|
||||
|
||||
private AttributeName[] xmlnsNames;
|
||||
|
||||
private String[] xmlnsValues;
|
||||
|
||||
// ]NOCPP]
|
||||
|
||||
public HtmlAttributes(int mode) {
|
||||
this.mode = mode;
|
||||
this.length = 0;
|
||||
this.names = new AttributeName[5]; // covers 98.3% of elements
|
||||
// according to
|
||||
// Hixie
|
||||
this.values = new String[5];
|
||||
|
||||
// [NOCPP[
|
||||
|
||||
this.idValue = null;
|
||||
|
||||
this.xmlnsLength = 0;
|
||||
|
||||
this.xmlnsNames = HtmlAttributes.EMPTY_ATTRIBUTENAMES;
|
||||
|
||||
this.xmlnsValues = HtmlAttributes.EMPTY_STRINGS;
|
||||
|
||||
// ]NOCPP]
|
||||
}
|
||||
/*
|
||||
public HtmlAttributes(HtmlAttributes other) {
|
||||
this.mode = other.mode;
|
||||
this.length = other.length;
|
||||
this.names = new AttributeName[other.length];
|
||||
this.values = new String[other.length];
|
||||
// [NOCPP[
|
||||
this.idValue = other.idValue;
|
||||
this.xmlnsLength = other.xmlnsLength;
|
||||
this.xmlnsNames = new AttributeName[other.xmlnsLength];
|
||||
this.xmlnsValues = new String[other.xmlnsLength];
|
||||
// ]NOCPP]
|
||||
}
|
||||
*/
|
||||
|
||||
void destructor() {
|
||||
clear(0);
|
||||
Portability.releaseArray(names);
|
||||
Portability.releaseArray(values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Only use with a static argument
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public int getIndex(AttributeName name) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (names[i] == name) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// [NOCPP[
|
||||
|
||||
public int getIndex(String qName) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (names[i].getQName(mode).equals(qName)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getIndex(String uri, String localName) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (names[i].getLocal(mode).equals(localName)
|
||||
&& names[i].getUri(mode).equals(uri)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public @IdType String getType(String qName) {
|
||||
int index = getIndex(qName);
|
||||
if (index == -1) {
|
||||
return null;
|
||||
} else {
|
||||
return getType(index);
|
||||
}
|
||||
}
|
||||
|
||||
public @IdType String getType(String uri, String localName) {
|
||||
int index = getIndex(uri, localName);
|
||||
if (index == -1) {
|
||||
return null;
|
||||
} else {
|
||||
return getType(index);
|
||||
}
|
||||
}
|
||||
|
||||
public String getValue(String qName) {
|
||||
int index = getIndex(qName);
|
||||
if (index == -1) {
|
||||
return null;
|
||||
} else {
|
||||
return getValue(index);
|
||||
}
|
||||
}
|
||||
|
||||
public String getValue(String uri, String localName) {
|
||||
int index = getIndex(uri, localName);
|
||||
if (index == -1) {
|
||||
return null;
|
||||
} else {
|
||||
return getValue(index);
|
||||
}
|
||||
}
|
||||
|
||||
// ]NOCPP]
|
||||
|
||||
public int getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
public @Local String getLocalName(int index) {
|
||||
if (index < length && index >= 0) {
|
||||
return names[index].getLocal(mode);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// [NOCPP[
|
||||
|
||||
public @QName String getQName(int index) {
|
||||
if (index < length && index >= 0) {
|
||||
return names[index].getQName(mode);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public @IdType String getType(int index) {
|
||||
if (index < length && index >= 0) {
|
||||
return names[index].getType(mode);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// ]NOCPP]
|
||||
|
||||
public AttributeName getAttributeName(int index) {
|
||||
if (index < length && index >= 0) {
|
||||
return names[index];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public @NsUri String getURI(int index) {
|
||||
if (index < length && index >= 0) {
|
||||
return names[index].getUri(mode);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public @Prefix String getPrefix(int index) {
|
||||
if (index < length && index >= 0) {
|
||||
return names[index].getPrefix(mode);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getValue(int index) {
|
||||
if (index < length && index >= 0) {
|
||||
return values[index];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Only use with static argument.
|
||||
*
|
||||
* @see org.xml.sax.Attributes#getValue(java.lang.String)
|
||||
*/
|
||||
public String getValue(AttributeName name) {
|
||||
int index = getIndex(name);
|
||||
if (index == -1) {
|
||||
return null;
|
||||
} else {
|
||||
return getValue(index);
|
||||
}
|
||||
}
|
||||
|
||||
// [NOCPP[
|
||||
|
||||
public String getId() {
|
||||
return idValue;
|
||||
}
|
||||
|
||||
public int getXmlnsLength() {
|
||||
return xmlnsLength;
|
||||
}
|
||||
|
||||
public @Local String getXmlnsLocalName(int index) {
|
||||
if (index < xmlnsLength && index >= 0) {
|
||||
return xmlnsNames[index].getLocal(mode);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public @NsUri String getXmlnsURI(int index) {
|
||||
if (index < xmlnsLength && index >= 0) {
|
||||
return xmlnsNames[index].getUri(mode);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getXmlnsValue(int index) {
|
||||
if (index < xmlnsLength && index >= 0) {
|
||||
return xmlnsValues[index];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public int getXmlnsIndex(AttributeName name) {
|
||||
for (int i = 0; i < xmlnsLength; i++) {
|
||||
if (xmlnsNames[i] == name) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public String getXmlnsValue(AttributeName name) {
|
||||
int index = getXmlnsIndex(name);
|
||||
if (index == -1) {
|
||||
return null;
|
||||
} else {
|
||||
return getXmlnsValue(index);
|
||||
}
|
||||
}
|
||||
|
||||
public AttributeName getXmlnsAttributeName(int index) {
|
||||
if (index < xmlnsLength && index >= 0) {
|
||||
return xmlnsNames[index];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// ]NOCPP]
|
||||
|
||||
void addAttribute(AttributeName name, String value
|
||||
// [NOCPP[
|
||||
, XmlViolationPolicy xmlnsPolicy
|
||||
// ]NOCPP]
|
||||
) throws SAXException {
|
||||
// [NOCPP[
|
||||
if (name == AttributeName.ID) {
|
||||
idValue = value;
|
||||
}
|
||||
|
||||
if (name.isXmlns()) {
|
||||
if (xmlnsNames.length == xmlnsLength) {
|
||||
int newLen = xmlnsLength == 0 ? 2 : xmlnsLength << 1;
|
||||
AttributeName[] newNames = new AttributeName[newLen];
|
||||
System.arraycopy(xmlnsNames, 0, newNames, 0, xmlnsNames.length);
|
||||
xmlnsNames = newNames;
|
||||
String[] newValues = new String[newLen];
|
||||
System.arraycopy(xmlnsValues, 0, newValues, 0, xmlnsValues.length);
|
||||
xmlnsValues = newValues;
|
||||
}
|
||||
xmlnsNames[xmlnsLength] = name;
|
||||
xmlnsValues[xmlnsLength] = value;
|
||||
xmlnsLength++;
|
||||
switch (xmlnsPolicy) {
|
||||
case FATAL:
|
||||
// this is ugly
|
||||
throw new SAXException("Saw an xmlns attribute.");
|
||||
case ALTER_INFOSET:
|
||||
return;
|
||||
case ALLOW:
|
||||
// fall through
|
||||
}
|
||||
}
|
||||
|
||||
// ]NOCPP]
|
||||
|
||||
if (names.length == length) {
|
||||
int newLen = length << 1; // The first growth covers virtually
|
||||
// 100% of elements according to
|
||||
// Hixie
|
||||
AttributeName[] newNames = new AttributeName[newLen];
|
||||
System.arraycopy(names, 0, newNames, 0, names.length);
|
||||
Portability.releaseArray(names);
|
||||
names = newNames;
|
||||
String[] newValues = new String[newLen];
|
||||
System.arraycopy(values, 0, newValues, 0, values.length);
|
||||
Portability.releaseArray(values);
|
||||
values = newValues;
|
||||
}
|
||||
names[length] = name;
|
||||
values[length] = value;
|
||||
length++;
|
||||
}
|
||||
|
||||
void clear(int m) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
names[i].release();
|
||||
names[i] = null;
|
||||
Portability.releaseString(values[i]);
|
||||
values[i] = null;
|
||||
}
|
||||
length = 0;
|
||||
mode = m;
|
||||
// [NOCPP[
|
||||
idValue = null;
|
||||
for (int i = 0; i < xmlnsLength; i++) {
|
||||
xmlnsNames[i] = null;
|
||||
xmlnsValues[i] = null;
|
||||
}
|
||||
xmlnsLength = 0;
|
||||
// ]NOCPP]
|
||||
}
|
||||
|
||||
/**
|
||||
* This is used in C++ to release special <code>isindex</code>
|
||||
* attribute values whose ownership is not transferred.
|
||||
*/
|
||||
void releaseValue(int i) {
|
||||
Portability.releaseString(values[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is only used for <code>AttributeName</code> ownership transfer
|
||||
* in the isindex case to avoid freeing custom names twice in C++.
|
||||
*/
|
||||
void clearWithoutReleasingContents() {
|
||||
for (int i = 0; i < length; i++) {
|
||||
names[i] = null;
|
||||
values[i] = null;
|
||||
}
|
||||
length = 0;
|
||||
}
|
||||
|
||||
boolean contains(AttributeName name) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (name.equalsAnother(names[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// [NOCPP[
|
||||
for (int i = 0; i < xmlnsLength; i++) {
|
||||
if (name.equalsAnother(xmlnsNames[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// ]NOCPP]
|
||||
return false;
|
||||
}
|
||||
|
||||
public void adjustForMath() {
|
||||
mode = AttributeName.MATHML;
|
||||
}
|
||||
|
||||
public void adjustForSvg() {
|
||||
mode = AttributeName.SVG;
|
||||
}
|
||||
|
||||
// [NOCPP[
|
||||
|
||||
void processNonNcNames(TreeBuilder<?> treeBuilder, XmlViolationPolicy namePolicy) throws SAXException {
|
||||
for (int i = 0; i < length; i++) {
|
||||
AttributeName attName = names[i];
|
||||
if (!attName.isNcName(mode)) {
|
||||
String name = attName.getLocal(mode);
|
||||
switch (namePolicy) {
|
||||
case ALTER_INFOSET:
|
||||
names[i] = AttributeName.create(NCName.escapeName(name));
|
||||
// fall through
|
||||
case ALLOW:
|
||||
if (attName != AttributeName.XML_LANG) {
|
||||
treeBuilder.warn("Attribute \u201C" + name + "\u201D is not serializable as XML 1.0.");
|
||||
}
|
||||
break;
|
||||
case FATAL:
|
||||
treeBuilder.fatal("Attribute \u201C" + name + "\u201D is not serializable as XML 1.0.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void merge(HtmlAttributes attributes) throws SAXException {
|
||||
int len = attributes.getLength();
|
||||
for (int i = 0; i < len; i++) {
|
||||
AttributeName name = attributes.getAttributeName(i);
|
||||
if (!contains(name)) {
|
||||
addAttribute(name, attributes.getValue(i), XmlViolationPolicy.ALLOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ]NOCPP]
|
||||
|
||||
}
|
|
@ -0,0 +1,696 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package nu.validator.htmlparser.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import nu.validator.htmlparser.annotation.NoLength;
|
||||
import nu.validator.htmlparser.common.ByteReadable;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public abstract class MetaScanner {
|
||||
|
||||
private static final @NoLength char[] CHARSET = "charset".toCharArray();
|
||||
|
||||
private static final @NoLength char[] CONTENT = "content".toCharArray();
|
||||
|
||||
private static final int NO = 0;
|
||||
|
||||
private static final int M = 1;
|
||||
|
||||
private static final int E = 2;
|
||||
|
||||
private static final int T = 3;
|
||||
|
||||
private static final int A = 4;
|
||||
|
||||
private static final int DATA = 0;
|
||||
|
||||
private static final int TAG_OPEN = 1;
|
||||
|
||||
private static final int SCAN_UNTIL_GT = 2;
|
||||
|
||||
private static final int TAG_NAME = 3;
|
||||
|
||||
private static final int BEFORE_ATTRIBUTE_NAME = 4;
|
||||
|
||||
private static final int ATTRIBUTE_NAME = 5;
|
||||
|
||||
private static final int AFTER_ATTRIBUTE_NAME = 6;
|
||||
|
||||
private static final int BEFORE_ATTRIBUTE_VALUE = 7;
|
||||
|
||||
private static final int ATTRIBUTE_VALUE_DOUBLE_QUOTED = 8;
|
||||
|
||||
private static final int ATTRIBUTE_VALUE_SINGLE_QUOTED = 9;
|
||||
|
||||
private static final int ATTRIBUTE_VALUE_UNQUOTED = 10;
|
||||
|
||||
private static final int AFTER_ATTRIBUTE_VALUE_QUOTED = 11;
|
||||
|
||||
private static final int MARKUP_DECLARATION_OPEN = 13;
|
||||
|
||||
private static final int MARKUP_DECLARATION_HYPHEN = 14;
|
||||
|
||||
private static final int COMMENT_START = 15;
|
||||
|
||||
private static final int COMMENT_START_DASH = 16;
|
||||
|
||||
private static final int COMMENT = 17;
|
||||
|
||||
private static final int COMMENT_END_DASH = 18;
|
||||
|
||||
private static final int COMMENT_END = 19;
|
||||
|
||||
private static final int SELF_CLOSING_START_TAG = 20;
|
||||
|
||||
protected ByteReadable readable;
|
||||
|
||||
private int metaState = NO;
|
||||
|
||||
private int contentIndex = -1;
|
||||
|
||||
private int charsetIndex = -1;
|
||||
|
||||
protected int stateSave = DATA;
|
||||
|
||||
private int strBufLen;
|
||||
|
||||
private char[] strBuf;
|
||||
|
||||
// [NOCPP[
|
||||
|
||||
/**
|
||||
* @param source
|
||||
* @param errorHandler
|
||||
* @param publicId
|
||||
* @param systemId
|
||||
*/
|
||||
public MetaScanner() {
|
||||
this.readable = null;
|
||||
this.metaState = NO;
|
||||
this.contentIndex = -1;
|
||||
this.charsetIndex = -1;
|
||||
this.stateSave = DATA;
|
||||
strBufLen = 0;
|
||||
strBuf = new char[36];
|
||||
}
|
||||
|
||||
/**
|
||||
* -1 means end.
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
protected int read() throws IOException {
|
||||
return readable.readByte();
|
||||
}
|
||||
|
||||
// ]NOCPP]
|
||||
|
||||
// WARNING When editing this, makes sure the bytecode length shown by javap
|
||||
// stays under 8000 bytes!
|
||||
protected final void stateLoop(int state)
|
||||
throws SAXException, IOException {
|
||||
int c = -1;
|
||||
boolean reconsume = false;
|
||||
stateloop: for (;;) {
|
||||
switch (state) {
|
||||
case DATA:
|
||||
dataloop: for (;;) {
|
||||
if (reconsume) {
|
||||
reconsume = false;
|
||||
} else {
|
||||
c = read();
|
||||
}
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '<':
|
||||
state = MetaScanner.TAG_OPEN;
|
||||
break dataloop; // FALL THROUGH continue
|
||||
// stateloop;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
|
||||
case TAG_OPEN:
|
||||
tagopenloop: for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case 'm':
|
||||
case 'M':
|
||||
metaState = M;
|
||||
state = MetaScanner.TAG_NAME;
|
||||
break tagopenloop;
|
||||
// continue stateloop;
|
||||
case '!':
|
||||
state = MetaScanner.MARKUP_DECLARATION_OPEN;
|
||||
continue stateloop;
|
||||
case '?':
|
||||
case '/':
|
||||
state = MetaScanner.SCAN_UNTIL_GT;
|
||||
continue stateloop;
|
||||
case '>':
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
default:
|
||||
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
|
||||
metaState = NO;
|
||||
state = MetaScanner.TAG_NAME;
|
||||
break tagopenloop;
|
||||
// continue stateloop;
|
||||
}
|
||||
state = MetaScanner.DATA;
|
||||
reconsume = true;
|
||||
continue stateloop;
|
||||
}
|
||||
}
|
||||
// FALL THROUGH DON'T REORDER
|
||||
case TAG_NAME:
|
||||
tagnameloop: for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\u000C':
|
||||
state = MetaScanner.BEFORE_ATTRIBUTE_NAME;
|
||||
break tagnameloop;
|
||||
// continue stateloop;
|
||||
case '/':
|
||||
state = MetaScanner.SELF_CLOSING_START_TAG;
|
||||
continue stateloop;
|
||||
case '>':
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
case 'e':
|
||||
case 'E':
|
||||
if (metaState == M) {
|
||||
metaState = E;
|
||||
} else {
|
||||
metaState = NO;
|
||||
}
|
||||
continue;
|
||||
case 't':
|
||||
case 'T':
|
||||
if (metaState == E) {
|
||||
metaState = T;
|
||||
} else {
|
||||
metaState = NO;
|
||||
}
|
||||
continue;
|
||||
case 'a':
|
||||
case 'A':
|
||||
if (metaState == T) {
|
||||
metaState = A;
|
||||
} else {
|
||||
metaState = NO;
|
||||
}
|
||||
continue;
|
||||
default:
|
||||
metaState = NO;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case BEFORE_ATTRIBUTE_NAME:
|
||||
beforeattributenameloop: for (;;) {
|
||||
if (reconsume) {
|
||||
reconsume = false;
|
||||
} else {
|
||||
c = read();
|
||||
}
|
||||
/*
|
||||
* Consume the next input character:
|
||||
*/
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\u000C':
|
||||
continue;
|
||||
case '/':
|
||||
state = MetaScanner.SELF_CLOSING_START_TAG;
|
||||
continue stateloop;
|
||||
case '>':
|
||||
state = DATA;
|
||||
continue stateloop;
|
||||
case 'c':
|
||||
case 'C':
|
||||
contentIndex = 0;
|
||||
charsetIndex = 0;
|
||||
state = MetaScanner.ATTRIBUTE_NAME;
|
||||
break beforeattributenameloop;
|
||||
default:
|
||||
contentIndex = -1;
|
||||
charsetIndex = -1;
|
||||
state = MetaScanner.ATTRIBUTE_NAME;
|
||||
break beforeattributenameloop;
|
||||
// continue stateloop;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case ATTRIBUTE_NAME:
|
||||
attributenameloop: for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\u000C':
|
||||
state = MetaScanner.AFTER_ATTRIBUTE_NAME;
|
||||
continue stateloop;
|
||||
case '/':
|
||||
state = MetaScanner.SELF_CLOSING_START_TAG;
|
||||
continue stateloop;
|
||||
case '=':
|
||||
strBufLen = 0;
|
||||
state = MetaScanner.BEFORE_ATTRIBUTE_VALUE;
|
||||
break attributenameloop;
|
||||
// continue stateloop;
|
||||
case '>':
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
default:
|
||||
if (metaState == 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;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case BEFORE_ATTRIBUTE_VALUE:
|
||||
beforeattributevalueloop: for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\u000C':
|
||||
continue;
|
||||
case '"':
|
||||
state = MetaScanner.ATTRIBUTE_VALUE_DOUBLE_QUOTED;
|
||||
break beforeattributevalueloop;
|
||||
// continue stateloop;
|
||||
case '\'':
|
||||
state = MetaScanner.ATTRIBUTE_VALUE_SINGLE_QUOTED;
|
||||
continue stateloop;
|
||||
case '>':
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
default:
|
||||
if (charsetIndex == 6 || contentIndex == 6) {
|
||||
addToBuffer(c);
|
||||
}
|
||||
state = MetaScanner.ATTRIBUTE_VALUE_UNQUOTED;
|
||||
continue stateloop;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case ATTRIBUTE_VALUE_DOUBLE_QUOTED:
|
||||
attributevaluedoublequotedloop: for (;;) {
|
||||
if (reconsume) {
|
||||
reconsume = false;
|
||||
} else {
|
||||
c = read();
|
||||
}
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '"':
|
||||
if (tryCharset()) {
|
||||
break stateloop;
|
||||
}
|
||||
state = MetaScanner.AFTER_ATTRIBUTE_VALUE_QUOTED;
|
||||
break attributevaluedoublequotedloop;
|
||||
// continue stateloop;
|
||||
default:
|
||||
if (metaState == A && (contentIndex == 6 || charsetIndex == 6)) {
|
||||
addToBuffer(c);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case AFTER_ATTRIBUTE_VALUE_QUOTED:
|
||||
afterattributevaluequotedloop: for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\u000C':
|
||||
state = MetaScanner.BEFORE_ATTRIBUTE_NAME;
|
||||
continue stateloop;
|
||||
case '/':
|
||||
state = MetaScanner.SELF_CLOSING_START_TAG;
|
||||
break afterattributevaluequotedloop;
|
||||
// continue stateloop;
|
||||
case '>':
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
default:
|
||||
state = MetaScanner.BEFORE_ATTRIBUTE_NAME;
|
||||
reconsume = true;
|
||||
continue stateloop;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case SELF_CLOSING_START_TAG:
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '>':
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
default:
|
||||
state = MetaScanner.BEFORE_ATTRIBUTE_NAME;
|
||||
reconsume = true;
|
||||
continue stateloop;
|
||||
}
|
||||
// XXX reorder point
|
||||
case ATTRIBUTE_VALUE_UNQUOTED:
|
||||
for (;;) {
|
||||
if (reconsume) {
|
||||
reconsume = false;
|
||||
} else {
|
||||
c = read();
|
||||
}
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
|
||||
case '\u000C':
|
||||
if (tryCharset()) {
|
||||
break stateloop;
|
||||
}
|
||||
state = MetaScanner.BEFORE_ATTRIBUTE_NAME;
|
||||
continue stateloop;
|
||||
case '>':
|
||||
if (tryCharset()) {
|
||||
break stateloop;
|
||||
}
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
default:
|
||||
if (metaState == A && (contentIndex == 6 || charsetIndex == 6)) {
|
||||
addToBuffer(c);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// XXX reorder point
|
||||
case AFTER_ATTRIBUTE_NAME:
|
||||
for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\u000C':
|
||||
continue;
|
||||
case '/':
|
||||
if (tryCharset()) {
|
||||
break stateloop;
|
||||
}
|
||||
state = MetaScanner.SELF_CLOSING_START_TAG;
|
||||
continue stateloop;
|
||||
case '=':
|
||||
state = MetaScanner.BEFORE_ATTRIBUTE_VALUE;
|
||||
continue stateloop;
|
||||
case '>':
|
||||
if (tryCharset()) {
|
||||
break stateloop;
|
||||
}
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
case 'c':
|
||||
case 'C':
|
||||
contentIndex = 0;
|
||||
charsetIndex = 0;
|
||||
state = MetaScanner.ATTRIBUTE_NAME;
|
||||
continue stateloop;
|
||||
default:
|
||||
contentIndex = -1;
|
||||
charsetIndex = -1;
|
||||
state = MetaScanner.ATTRIBUTE_NAME;
|
||||
continue stateloop;
|
||||
}
|
||||
}
|
||||
// XXX reorder point
|
||||
case MARKUP_DECLARATION_OPEN:
|
||||
markupdeclarationopenloop: for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '-':
|
||||
state = MetaScanner.MARKUP_DECLARATION_HYPHEN;
|
||||
break markupdeclarationopenloop;
|
||||
// continue stateloop;
|
||||
default:
|
||||
state = MetaScanner.SCAN_UNTIL_GT;
|
||||
reconsume = true;
|
||||
continue stateloop;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case MARKUP_DECLARATION_HYPHEN:
|
||||
markupdeclarationhyphenloop: for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '-':
|
||||
state = MetaScanner.COMMENT_START;
|
||||
break markupdeclarationhyphenloop;
|
||||
// continue stateloop;
|
||||
default:
|
||||
state = MetaScanner.SCAN_UNTIL_GT;
|
||||
reconsume = true;
|
||||
continue stateloop;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case COMMENT_START:
|
||||
commentstartloop: for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '-':
|
||||
state = MetaScanner.COMMENT_START_DASH;
|
||||
continue stateloop;
|
||||
case '>':
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
default:
|
||||
state = MetaScanner.COMMENT;
|
||||
break commentstartloop;
|
||||
// continue stateloop;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case COMMENT:
|
||||
commentloop: for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '-':
|
||||
state = MetaScanner.COMMENT_END_DASH;
|
||||
break commentloop;
|
||||
// continue stateloop;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case COMMENT_END_DASH:
|
||||
commentenddashloop: for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '-':
|
||||
state = MetaScanner.COMMENT_END;
|
||||
break commentenddashloop;
|
||||
// continue stateloop;
|
||||
default:
|
||||
state = MetaScanner.COMMENT;
|
||||
continue stateloop;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case COMMENT_END:
|
||||
for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '>':
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
case '-':
|
||||
continue;
|
||||
default:
|
||||
state = MetaScanner.COMMENT;
|
||||
continue stateloop;
|
||||
}
|
||||
}
|
||||
// XXX reorder point
|
||||
case COMMENT_START_DASH:
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '-':
|
||||
state = MetaScanner.COMMENT_END;
|
||||
continue stateloop;
|
||||
case '>':
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
default:
|
||||
state = MetaScanner.COMMENT;
|
||||
continue stateloop;
|
||||
}
|
||||
// XXX reorder point
|
||||
case ATTRIBUTE_VALUE_SINGLE_QUOTED:
|
||||
for (;;) {
|
||||
if (reconsume) {
|
||||
reconsume = false;
|
||||
} else {
|
||||
c = read();
|
||||
}
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '\'':
|
||||
if (tryCharset()) {
|
||||
break stateloop;
|
||||
}
|
||||
state = MetaScanner.AFTER_ATTRIBUTE_VALUE_QUOTED;
|
||||
continue stateloop;
|
||||
default:
|
||||
if (metaState == A && (contentIndex == 6 || charsetIndex == 6)) {
|
||||
addToBuffer(c);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// XXX reorder point
|
||||
case SCAN_UNTIL_GT:
|
||||
for (;;) {
|
||||
if (reconsume) {
|
||||
reconsume = false;
|
||||
} else {
|
||||
c = read();
|
||||
}
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '>':
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stateSave = state;
|
||||
}
|
||||
|
||||
private void addToBuffer(int c) {
|
||||
if (strBufLen == strBuf.length) {
|
||||
char[] newBuf = new char[strBuf.length + (strBuf.length << 1)];
|
||||
System.arraycopy(strBuf, 0, newBuf, 0, strBuf.length);
|
||||
Portability.releaseArray(strBuf);
|
||||
strBuf = newBuf;
|
||||
}
|
||||
strBuf[strBufLen++] = (char)c;
|
||||
}
|
||||
|
||||
private boolean tryCharset() throws SAXException {
|
||||
if (metaState != A || !(contentIndex == 6 || charsetIndex == 6)) {
|
||||
return false;
|
||||
}
|
||||
String attVal = Portability.newStringFromBuffer(strBuf, 0, strBufLen);
|
||||
String candidateEncoding;
|
||||
if (contentIndex == 6) {
|
||||
candidateEncoding = TreeBuilder.extractCharsetFromContent(attVal);
|
||||
Portability.releaseString(attVal);
|
||||
} else {
|
||||
candidateEncoding = attVal;
|
||||
}
|
||||
if (candidateEncoding == null) {
|
||||
return false;
|
||||
}
|
||||
boolean rv = tryCharset(candidateEncoding);
|
||||
Portability.releaseString(candidateEncoding);
|
||||
contentIndex = -1;
|
||||
charsetIndex = -1;
|
||||
return rv;
|
||||
}
|
||||
|
||||
protected abstract boolean tryCharset(String encoding) throws SAXException;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,167 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package nu.validator.htmlparser.impl;
|
||||
|
||||
import nu.validator.htmlparser.annotation.Literal;
|
||||
import nu.validator.htmlparser.annotation.Local;
|
||||
import nu.validator.htmlparser.annotation.NoLength;
|
||||
|
||||
public final class Portability {
|
||||
|
||||
// Allocating methods
|
||||
|
||||
/**
|
||||
* Allocates a new local name object. In C++, the refcount must be set up in such a way that
|
||||
* calling <code>releaseLocal</code> on the return value balances the refcount set by this method.
|
||||
*/
|
||||
public static @Local String newLocalNameFromBuffer(@NoLength char[] buf, int offset, int length) {
|
||||
return new String(buf, offset, length).intern();
|
||||
}
|
||||
|
||||
public static String newStringFromBuffer(@NoLength char[] buf, int offset, int length) {
|
||||
return new String(buf, offset, length);
|
||||
}
|
||||
|
||||
public static String newEmptyString() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String newStringFromLiteral(@Literal String literal) {
|
||||
return literal;
|
||||
}
|
||||
|
||||
// XXX get rid of this
|
||||
public static char[] newCharArrayFromLocal(@Local String local) {
|
||||
return local.toCharArray();
|
||||
}
|
||||
|
||||
public static char[] newCharArrayFromString(String string) {
|
||||
return string.toCharArray();
|
||||
}
|
||||
|
||||
// Deallocation methods
|
||||
|
||||
public static void releaseString(String str) {
|
||||
// No-op in Java
|
||||
}
|
||||
|
||||
public static void retainLocal(@Local String local) {
|
||||
// No-op in Java
|
||||
}
|
||||
|
||||
/**
|
||||
* This MUST be a no-op on locals that are known at compile time.
|
||||
* @param local
|
||||
*/
|
||||
public static void releaseLocal(@Local String local) {
|
||||
// No-op in Java
|
||||
}
|
||||
|
||||
/**
|
||||
* Releases a Java array. This method is magically replaced by a macro in C++.
|
||||
* @param arr
|
||||
*/
|
||||
public static void releaseArray(Object arr) {
|
||||
// No-op in Java
|
||||
}
|
||||
|
||||
public static void retainElement(Object elt) {
|
||||
// No-op in Java
|
||||
}
|
||||
|
||||
public static void releaseElement(Object elt) {
|
||||
// No-op in Java
|
||||
}
|
||||
|
||||
// Comparison methods
|
||||
|
||||
public static boolean localEqualsBuffer(@Local String local, @NoLength char[] buf, int offset, int length) {
|
||||
if (local.length() != length) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (local.charAt(i) != buf[offset + i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(@Literal String lowerCaseLiteral,
|
||||
String string) {
|
||||
if (string == null) {
|
||||
return false;
|
||||
}
|
||||
if (lowerCaseLiteral.length() > string.length()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < lowerCaseLiteral.length(); i++) {
|
||||
char c0 = lowerCaseLiteral.charAt(i);
|
||||
char c1 = string.charAt(i);
|
||||
if (c1 >= 'A' && c1 <= 'Z') {
|
||||
c1 += 0x20;
|
||||
}
|
||||
if (c0 != c1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean lowerCaseLiteralEqualsIgnoreAsciiCaseString(@Literal String lowerCaseLiteral,
|
||||
String string) {
|
||||
if (string == null) {
|
||||
return false;
|
||||
}
|
||||
if (lowerCaseLiteral.length() != string.length()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < lowerCaseLiteral.length(); i++) {
|
||||
char c0 = lowerCaseLiteral.charAt(i);
|
||||
char c1 = string.charAt(i);
|
||||
if (c1 >= 'A' && c1 <= 'Z') {
|
||||
c1 += 0x20;
|
||||
}
|
||||
if (c0 != c1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean literalEqualsString(@Literal String literal, String string) {
|
||||
return literal.equals(string);
|
||||
}
|
||||
|
||||
public static char[] isIndexPrompt() {
|
||||
return "This is a searchable index. Insert your search keywords here: ".toCharArray();
|
||||
}
|
||||
|
||||
public static void delete(Object o) {
|
||||
|
||||
}
|
||||
|
||||
public static void deleteArray(Object o) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
The *.java files in this directory are the source files from which the
|
||||
corresponding nsHtml5*.cpp and nsHtml5*.h files were generated in
|
||||
../src/.
|
||||
|
||||
You can obtain the full Java version of the parser and the translator
|
||||
program from
|
||||
svn co http://svn.versiondude.net/whattf/htmlparser/trunk/ htmlparser
|
||||
|
||||
See run-cpp-translate.sh at the top level of the SVN checkout.
|
|
@ -0,0 +1,155 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package nu.validator.htmlparser.impl;
|
||||
|
||||
import nu.validator.htmlparser.annotation.Local;
|
||||
import nu.validator.htmlparser.annotation.NsUri;
|
||||
|
||||
final class StackNode<T> {
|
||||
final int group;
|
||||
|
||||
final @Local String name;
|
||||
|
||||
final @Local String popName;
|
||||
|
||||
final @NsUri String ns;
|
||||
|
||||
final T node;
|
||||
|
||||
final boolean scoping;
|
||||
|
||||
final boolean special;
|
||||
|
||||
final boolean fosterParenting;
|
||||
|
||||
private int refcount = 1;
|
||||
|
||||
/**
|
||||
* @param group
|
||||
* TODO
|
||||
* @param name
|
||||
* @param node
|
||||
* @param scoping
|
||||
* @param special
|
||||
* @param popName
|
||||
* TODO
|
||||
*/
|
||||
StackNode(int group, final @NsUri String ns, final @Local String name, final T node,
|
||||
final boolean scoping, final boolean special,
|
||||
final boolean fosterParenting, final @Local String popName) {
|
||||
this.group = group;
|
||||
this.name = name;
|
||||
this.popName = popName;
|
||||
this.ns = ns;
|
||||
this.node = node;
|
||||
this.scoping = scoping;
|
||||
this.special = special;
|
||||
this.fosterParenting = fosterParenting;
|
||||
this.refcount = 1;
|
||||
Portability.retainLocal(name);
|
||||
Portability.retainLocal(popName);
|
||||
Portability.retainElement(node);
|
||||
// not retaining namespace for now
|
||||
}
|
||||
|
||||
/**
|
||||
* @param elementName
|
||||
* TODO
|
||||
* @param node
|
||||
*/
|
||||
StackNode(final @NsUri String ns, ElementName elementName, final T node) {
|
||||
this.group = elementName.group;
|
||||
this.name = elementName.name;
|
||||
this.popName = elementName.name;
|
||||
this.ns = ns;
|
||||
this.node = node;
|
||||
this.scoping = elementName.scoping;
|
||||
this.special = elementName.special;
|
||||
this.fosterParenting = elementName.fosterParenting;
|
||||
this.refcount = 1;
|
||||
Portability.retainLocal(name);
|
||||
Portability.retainLocal(popName);
|
||||
Portability.retainElement(node);
|
||||
// not retaining namespace for now
|
||||
}
|
||||
|
||||
StackNode(final @NsUri String ns, ElementName elementName, final T node, @Local String popName) {
|
||||
this.group = elementName.group;
|
||||
this.name = elementName.name;
|
||||
this.popName = popName;
|
||||
this.ns = ns;
|
||||
this.node = node;
|
||||
this.scoping = elementName.scoping;
|
||||
this.special = elementName.special;
|
||||
this.fosterParenting = elementName.fosterParenting;
|
||||
this.refcount = 1;
|
||||
Portability.retainLocal(name);
|
||||
Portability.retainLocal(popName);
|
||||
Portability.retainElement(node);
|
||||
// not retaining namespace for now
|
||||
}
|
||||
|
||||
StackNode(final @NsUri String ns, ElementName elementName, final T node, @Local String popName, boolean scoping) {
|
||||
this.group = elementName.group;
|
||||
this.name = elementName.name;
|
||||
this.popName = popName;
|
||||
this.ns = ns;
|
||||
this.node = node;
|
||||
this.scoping = scoping;
|
||||
this.special = false;
|
||||
this.fosterParenting = false;
|
||||
this.refcount = 1;
|
||||
Portability.retainLocal(name);
|
||||
Portability.retainLocal(popName);
|
||||
Portability.retainElement(node);
|
||||
// not retaining namespace for now
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused") private void destructor() {
|
||||
Portability.releaseLocal(name);
|
||||
Portability.releaseLocal(popName);
|
||||
Portability.releaseElement(node);
|
||||
// not releasing namespace for now
|
||||
}
|
||||
|
||||
// [NOCPP[
|
||||
/**
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override public @Local String toString() {
|
||||
return name;
|
||||
}
|
||||
// ]NOCPP]
|
||||
|
||||
public void retain() {
|
||||
refcount++;
|
||||
}
|
||||
|
||||
public void release() {
|
||||
refcount--;
|
||||
if (refcount == 0) {
|
||||
Portability.delete(this);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package nu.validator.htmlparser.impl;
|
||||
|
||||
|
||||
public class StateSnapshot<T> {
|
||||
|
||||
/**
|
||||
* @param stack
|
||||
* @param listOfActiveFormattingElements
|
||||
* @param formPointer
|
||||
*/
|
||||
StateSnapshot(StackNode<T>[] stack,
|
||||
StackNode<T>[] listOfActiveFormattingElements, T formPointer) {
|
||||
this.stack = stack;
|
||||
this.listOfActiveFormattingElements = listOfActiveFormattingElements;
|
||||
this.formPointer = formPointer;
|
||||
}
|
||||
|
||||
final StackNode<T>[] stack;
|
||||
|
||||
final StackNode<T>[] listOfActiveFormattingElements;
|
||||
|
||||
final T formPointer;
|
||||
|
||||
@SuppressWarnings("unused") private void destructor() {
|
||||
for (int i = 0; i < stack.length; i++) {
|
||||
stack[i].release();
|
||||
}
|
||||
Portability.releaseArray(stack);
|
||||
for (int i = 0; i < listOfActiveFormattingElements.length; i++) {
|
||||
if (listOfActiveFormattingElements[i] != null) {
|
||||
listOfActiveFormattingElements[i].release();
|
||||
}
|
||||
}
|
||||
Portability.releaseArray(listOfActiveFormattingElements);
|
||||
Portability.retainElement(formPointer);
|
||||
}
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package nu.validator.htmlparser.impl;
|
||||
|
||||
import nu.validator.htmlparser.annotation.NoLength;
|
||||
|
||||
public final class UTF16Buffer {
|
||||
private final @NoLength char[] buffer;
|
||||
|
||||
private int start;
|
||||
|
||||
private int end;
|
||||
|
||||
/**
|
||||
* @param buffer
|
||||
* @param start
|
||||
* @param end
|
||||
*/
|
||||
public UTF16Buffer(@NoLength char[] buffer, int start, int end) {
|
||||
this.buffer = buffer;
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the start.
|
||||
*
|
||||
* @return the start
|
||||
*/
|
||||
public int getStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the start.
|
||||
*
|
||||
* @param start the start to set
|
||||
*/
|
||||
public void setStart(int start) {
|
||||
this.start = start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the buffer.
|
||||
*
|
||||
* @return the buffer
|
||||
*/
|
||||
public @NoLength char[] getBuffer() {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the end.
|
||||
*
|
||||
* @return the end
|
||||
*/
|
||||
public int getEnd() {
|
||||
return end;
|
||||
}
|
||||
|
||||
public boolean hasMore() {
|
||||
return start < end;
|
||||
}
|
||||
|
||||
public void adjust(boolean lastWasCR) {
|
||||
if (lastWasCR && buffer[start] == '\n') {
|
||||
start++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the end.
|
||||
*
|
||||
* @param end the end to set
|
||||
*/
|
||||
public void setEnd(int end) {
|
||||
this.end = end;
|
||||
}
|
||||
}
|
|
@ -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
|
|
@ -119,9 +119,10 @@ nsSVGSwitchElement::InsertChildAt(nsIContent* aKid,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsSVGSwitchElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
|
||||
nsSVGSwitchElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent)
|
||||
{
|
||||
nsresult rv = nsSVGSwitchElementBase::RemoveChildAt(aIndex, aNotify);
|
||||
NS_ASSERTION(aMutationEvent, "Someone tried to inhibit mutations on switch child removal.");
|
||||
nsresult rv = nsSVGSwitchElementBase::RemoveChildAt(aIndex, aNotify, aMutationEvent);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
MaybeInvalidate();
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
// nsINode
|
||||
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
|
||||
PRBool aNotify);
|
||||
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
|
||||
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent = PR_TRUE);
|
||||
|
||||
// nsIContent
|
||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -114,8 +114,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
|
||||
|
|
|
@ -265,12 +265,13 @@ nsXTFElementWrapper::InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsXTFElementWrapper::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
|
||||
nsXTFElementWrapper::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent)
|
||||
{
|
||||
NS_ASSERTION(aMutationEvent, "Someone tried to inhibit mutations on xtf child removal.");
|
||||
nsresult rv;
|
||||
if (mNotificationMask & nsIXTFElement::NOTIFY_WILL_REMOVE_CHILD)
|
||||
GetXTFElement()->WillRemoveChild(aIndex);
|
||||
rv = nsXTFElementWrapperBase::RemoveChildAt(aIndex, aNotify);
|
||||
rv = nsXTFElementWrapperBase::RemoveChildAt(aIndex, aNotify, aMutationEvent);
|
||||
if (mNotificationMask & nsIXTFElement::NOTIFY_CHILD_REMOVED)
|
||||
GetXTFElement()->ChildRemoved(aIndex);
|
||||
return rv;
|
||||
|
|
|
@ -79,7 +79,7 @@ public:
|
|||
PRBool aNullParent = PR_TRUE);
|
||||
nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
|
||||
PRBool aNotify);
|
||||
nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
|
||||
nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent = PR_TRUE);
|
||||
nsIAtom *GetIDAttributeName() const;
|
||||
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
nsIAtom* aPrefix, const nsAString& aValue,
|
||||
|
|
|
@ -913,8 +913,9 @@ nsXULElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsXULElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
|
||||
nsXULElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent)
|
||||
{
|
||||
NS_ASSERTION(aMutationEvent, "Someone tried to inhibit mutations on XUL child removal.");
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIContent> oldKid = mAttrsAndChildren.GetSafeChildAt(aIndex);
|
||||
if (!oldKid) {
|
||||
|
@ -981,7 +982,7 @@ nsXULElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
|
|||
}
|
||||
}
|
||||
|
||||
rv = nsGenericElement::RemoveChildAt(aIndex, aNotify);
|
||||
rv = nsGenericElement::RemoveChildAt(aIndex, aNotify, aMutationEvent);
|
||||
|
||||
if (newCurrentIndex == -2)
|
||||
controlElement->SetCurrentItem(nsnull);
|
||||
|
|
|
@ -513,7 +513,7 @@ public:
|
|||
nsIContent* aBindingParent,
|
||||
PRBool aCompileEventHandlers);
|
||||
virtual void UnbindFromTree(PRBool aDeep, PRBool aNullParent);
|
||||
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
|
||||
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent = PR_TRUE);
|
||||
virtual nsIAtom *GetIDAttributeName() const;
|
||||
virtual nsIAtom *GetClassAttributeName() const;
|
||||
virtual PRBool GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
|
|
|
@ -94,6 +94,7 @@ REQUIRES = xpcom \
|
|||
uconv \
|
||||
txtsvc \
|
||||
thebes \
|
||||
html5 \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
|
@ -139,6 +140,7 @@ SHARED_LIBRARY_LIBS = \
|
|||
$(DEPTH)/dom/src/threads/$(LIB_PREFIX)domthreads_s.$(LIB_SUFFIX) \
|
||||
$(DEPTH)/editor/libeditor/text/$(LIB_PREFIX)texteditor_s.$(LIB_SUFFIX) \
|
||||
$(DEPTH)/editor/libeditor/base/$(LIB_PREFIX)editorbase_s.$(LIB_SUFFIX) \
|
||||
$(DEPTH)/parser/html/$(LIB_PREFIX)html5p_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_MEDIA
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
#include "nsXMLHttpRequest.h"
|
||||
#include "nsDOMThreadService.h"
|
||||
#include "nsHTMLDNSPrefetch.h"
|
||||
#include "nsHtml5Module.h"
|
||||
#include "nsCrossSiteListenerProxy.h"
|
||||
#include "nsFocusManager.h"
|
||||
|
||||
|
@ -276,6 +277,8 @@ nsLayoutStatics::Initialize()
|
|||
nsAudioStream::InitLibrary();
|
||||
#endif
|
||||
|
||||
nsHtml5Module::InitializeStatics();
|
||||
|
||||
nsCrossSiteListenerProxy::Startup();
|
||||
|
||||
return NS_OK;
|
||||
|
@ -363,6 +366,8 @@ nsLayoutStatics::Shutdown()
|
|||
#endif
|
||||
|
||||
nsXMLHttpRequest::ShutdownACCache();
|
||||
|
||||
nsHtml5Module::ReleaseStatics();
|
||||
|
||||
NS_ShutdownChainItemPool();
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -5,7 +5,7 @@
|
|||
window.onload = function() {
|
||||
window.frames[0].document.body.innerHTML =
|
||||
"<img src='passouter.png' " +
|
||||
"onload='window.parent.document.documentElement.className = ""'";
|
||||
"onload='window.parent.document.documentElement.className = ""'>";
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
window.onload = function() {
|
||||
window.frames[0].document.body.innerHTML =
|
||||
"<img src='passouter.png' " +
|
||||
"onload='window.parent.document.documentElement.className = ""'";
|
||||
"onload='window.parent.document.documentElement.className = ""'>";
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
setTimeout(function() {
|
||||
window.frames[0].document.body.innerHTML =
|
||||
"<img src='passouter.png' " +
|
||||
"onload='window.parent.document.documentElement.className = ""'";
|
||||
"onload='window.parent.document.documentElement.className = ""'>";
|
||||
}, 0);
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
setTimeout(function() {
|
||||
window.frames[0].document.body.innerHTML =
|
||||
"<img src='passouter.png' " +
|
||||
"onload='window.parent.document.documentElement.className = ""'";
|
||||
"onload='window.parent.document.documentElement.className = ""'>";
|
||||
}, 0);
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
<script type="text/javascript">
|
||||
function boom()
|
||||
{
|
||||
var table = document.getElementById("table");
|
||||
var col1 = document.getElementById("col1");
|
||||
var parent = col1.parentNode;
|
||||
var next = col1.nextSibling;
|
||||
|
||||
table.removeChild(col1);
|
||||
parent.removeChild(col1);
|
||||
reflow();
|
||||
table.insertBefore(col1, next);
|
||||
parent.insertBefore(col1, next);
|
||||
reflow();
|
||||
col1.removeAttribute("width");
|
||||
}
|
||||
|
|
|
@ -4,12 +4,11 @@
|
|||
<script type="text/javascript">
|
||||
function boom()
|
||||
{
|
||||
var table = document.getElementById("table");
|
||||
var col1 = document.createElement("col");
|
||||
col1.setAttribute("width", "100");
|
||||
var next = document.getElementById("col2");
|
||||
|
||||
table.insertBefore(col1, next);
|
||||
next.parentNode.insertBefore(col1, next);
|
||||
reflow();
|
||||
col1.removeAttribute("width");
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -14,5 +14,4 @@ very model of a modern major-general.
|
|||
very model of a modern major-general.
|
||||
<p style="white-space:pre-line;">I am the
|
||||
very model of a modern major-general.
|
||||
</body>
|
||||
</html>
|
||||
</body></html>
|
|
@ -2743,3 +2743,6 @@ pref("mozilla.widget.disable-native-theme", true);
|
|||
|
||||
// Enable/Disable the geolocation API for content
|
||||
pref("geo.enabled", true);
|
||||
|
||||
// Enable/Disable HTML5 parser
|
||||
pref("html5.enable", false);
|
||||
|
|
|
@ -42,6 +42,7 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = expat htmlparser xml
|
||||
MODULE = parser
|
||||
DIRS = expat htmlparser html xml
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
# ***** 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_s
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
REQUIRES = \
|
||||
gfx \
|
||||
thebes \
|
||||
locale \
|
||||
js \
|
||||
pref \
|
||||
necko \
|
||||
xpcom \
|
||||
string \
|
||||
htmlparser \
|
||||
content \
|
||||
layout \
|
||||
widget \
|
||||
dom \
|
||||
uconv \
|
||||
xpconnect \
|
||||
util \
|
||||
webshell \
|
||||
docshell \
|
||||
chardet \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
nsHtml5Module.h \
|
||||
$(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)/../../content/base/src \
|
||||
$(NULL)
|
|
@ -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>( ((T*)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; arr = 0; length = 0; }
|
||||
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__
|
|
@ -0,0 +1,88 @@
|
|||
/* ***** 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__
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -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));
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/* -*- 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___ */
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,68 @@
|
|||
/* ***** 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
|
|
@ -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__
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,875 @@
|
|||
/*
|
||||
* 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 "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;
|
||||
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;
|
||||
jArray<PRInt32,PRInt32> nsHtml5ElementName::ELEMENT_HASHES = 0;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,237 @@
|
|||
/*
|
||||
* 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 "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;
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5HtmlAttributes::releaseValue(PRInt32 i)
|
||||
{
|
||||
nsHtml5Portability::releaseString(values[i]);
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5HtmlAttributes::clearWithoutReleasingContents()
|
||||
{
|
||||
for (PRInt32 i = 0; i < length; i++) {
|
||||
names[i] = nsnull;
|
||||
values[i] = nsnull;
|
||||
}
|
||||
length = 0;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* 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 "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);
|
||||
void releaseValue(PRInt32 i);
|
||||
void clearWithoutReleasingContents();
|
||||
PRBool contains(nsHtml5AttributeName* name);
|
||||
void adjustForMath();
|
||||
void adjustForSvg();
|
||||
static void initializeStatics();
|
||||
static void releaseStatics();
|
||||
};
|
||||
|
||||
#ifdef nsHtml5HtmlAttributes_cpp__
|
||||
nsHtml5HtmlAttributes* nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES = nsnull;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,713 @@
|
|||
/*
|
||||
* 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 "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"
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
/*
|
||||
* 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 "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
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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();
|
|
@ -0,0 +1,115 @@
|
|||
/* ***** 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 "nsContentUtils.h"
|
||||
#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
|
||||
PRBool nsHtml5Module::Enabled = PR_FALSE;
|
||||
|
||||
// static
|
||||
void
|
||||
nsHtml5Module::InitializeStatics()
|
||||
{
|
||||
nsContentUtils::AddBoolPrefVarCache("html5.enable", &Enabled);
|
||||
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
|
|
@ -0,0 +1,57 @@
|
|||
/* ***** 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);
|
||||
static PRBool Enabled;
|
||||
#ifdef DEBUG
|
||||
private:
|
||||
static PRBool sNsHtml5ModuleInitialized;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // nsHtml5Module_h__
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,18 @@
|
|||
#ifndef nsHtml5NamedCharacters_h__
|
||||
#define nsHtml5NamedCharacters_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "jArray.h"
|
||||
#include "nscore.h"
|
||||
|
||||
class nsHtml5NamedCharacters
|
||||
{
|
||||
public:
|
||||
static jArray<jArray<PRUnichar,PRInt32>,PRInt32> NAMES;
|
||||
static jArray<PRUnichar,PRInt32>* VALUES;
|
||||
static PRUnichar** WINDOWS_1252;
|
||||
static void initializeStatics();
|
||||
static void releaseStatics();
|
||||
};
|
||||
|
||||
#endif // nsHtml5NamedCharacters_h__
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,666 @@
|
|||
/* -*- 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 "nsAutoPtr.h"
|
||||
#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_READ_BUFFER_SIZE 1024
|
||||
#define NS_HTML5_PARSER_SNIFFING_BUFFER_SIZE 512
|
||||
|
||||
enum eHtml5ParserLifecycle {
|
||||
/**
|
||||
* The parser has told the tokenizer to start yet.
|
||||
*/
|
||||
NOT_STARTED = 0,
|
||||
|
||||
/**
|
||||
* The parser has started the tokenizer and the stream hasn't ended yet.
|
||||
*/
|
||||
PARSING = 1,
|
||||
|
||||
/**
|
||||
* The parser hasn't told the tokenizer to emit EOF yet, but the network
|
||||
* stream has been exhausted or document.close() called.
|
||||
*/
|
||||
STREAM_ENDING = 2,
|
||||
|
||||
/**
|
||||
* The parser has told the tokenizer to emit EOF.
|
||||
*/
|
||||
TERMINATED = 3
|
||||
};
|
||||
|
||||
enum eBomState {
|
||||
/**
|
||||
* BOM sniffing hasn't started.
|
||||
*/
|
||||
BOM_SNIFFING_NOT_STARTED = 0,
|
||||
|
||||
/**
|
||||
* BOM sniffing is ongoing, and the first byte of an UTF-16LE BOM has been
|
||||
* seen.
|
||||
*/
|
||||
SEEN_UTF_16_LE_FIRST_BYTE = 1,
|
||||
|
||||
/**
|
||||
* BOM sniffing is ongoing, and the first byte of an UTF-16BE BOM has been
|
||||
* seen.
|
||||
*/
|
||||
SEEN_UTF_16_BE_FIRST_BYTE = 2,
|
||||
|
||||
/**
|
||||
* BOM sniffing is ongoing, and the first byte of an UTF-8 BOM has been
|
||||
* seen.
|
||||
*/
|
||||
SEEN_UTF_8_FIRST_BYTE = 3,
|
||||
|
||||
/**
|
||||
* BOM sniffing is ongoing, and the first and second bytes of an UTF-8 BOM
|
||||
* have been seen.
|
||||
*/
|
||||
SEEN_UTF_8_SECOND_BYTE = 4,
|
||||
|
||||
/**
|
||||
* BOM sniffing was started but is now over for whatever reason.
|
||||
*/
|
||||
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
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHtml5Parser, nsContentSink)
|
||||
|
||||
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);
|
||||
|
||||
/**
|
||||
* Always returns "view" for backwards compat.
|
||||
*/
|
||||
NS_IMETHOD_(void) GetCommand(nsCString& aCommand);
|
||||
|
||||
/**
|
||||
* No-op for backwards compat.
|
||||
*/
|
||||
NS_IMETHOD_(void) SetCommand(const char* aCommand);
|
||||
|
||||
/**
|
||||
* No-op for backwards compat.
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @param aCharset the charset of a document
|
||||
* @param aCharsetSource the source of the charset
|
||||
*/
|
||||
NS_IMETHOD_(void) SetDocumentCharset(const nsACString& aCharset, PRInt32 aSource);
|
||||
|
||||
/**
|
||||
* Getter for backwards compat.
|
||||
*/
|
||||
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
|
||||
* @param aChannel out param that will contain the result
|
||||
* @return NS_OK if successful or NS_NOT_AVAILABLE if not
|
||||
*/
|
||||
NS_IMETHOD GetChannel(nsIChannel** aChannel);
|
||||
|
||||
/**
|
||||
* Return |this| for backwards compat.
|
||||
*/
|
||||
NS_IMETHOD GetDTD(nsIDTD** aDTD);
|
||||
|
||||
/**
|
||||
* Unblocks parser and calls ContinueInterruptedParsing()
|
||||
*/
|
||||
NS_IMETHOD ContinueParsing();
|
||||
|
||||
/**
|
||||
* If scripts are not executing, maybe flushes tree builder and parses
|
||||
* until suspension.
|
||||
*/
|
||||
NS_IMETHOD ContinueInterruptedParsing();
|
||||
|
||||
/**
|
||||
* Don't call. For interface backwards compat only.
|
||||
*/
|
||||
NS_IMETHOD_(void) BlockParser();
|
||||
|
||||
/**
|
||||
* Unblocks the parser.
|
||||
*/
|
||||
NS_IMETHOD_(void) UnblockParser();
|
||||
|
||||
/**
|
||||
* Query whether the parser is enabled or not.
|
||||
*/
|
||||
NS_IMETHOD_(PRBool) IsParserEnabled();
|
||||
|
||||
/**
|
||||
* Query whether the parser thinks it's done with parsing.
|
||||
*/
|
||||
NS_IMETHOD_(PRBool) IsComplete();
|
||||
|
||||
/**
|
||||
* Set up request observer.
|
||||
*
|
||||
* @param aURL ignored (for interface compat only)
|
||||
* @param aListener a listener to forward notifications to
|
||||
* @param aKey the root context key (used for document.write)
|
||||
* @param aMode ignored (for interface compat only)
|
||||
*/
|
||||
NS_IMETHOD Parse(nsIURI* aURL,
|
||||
nsIRequestObserver* aListener = nsnull,
|
||||
void* aKey = 0,
|
||||
nsDTDMode aMode = eDTDMode_autodetect);
|
||||
|
||||
/**
|
||||
* document.write and document.close
|
||||
*
|
||||
* @param aSourceBuffer the argument of document.write (empty for .close())
|
||||
* @param aKey a key unique to the script element that caused this call
|
||||
* @param aContentType ignored (for interface compat only)
|
||||
* @param aLastCall true if .close() false if .write()
|
||||
* @param aMode ignored (for interface compat only)
|
||||
*/
|
||||
NS_IMETHOD Parse(const nsAString& aSourceBuffer,
|
||||
void* aKey,
|
||||
const nsACString& aContentType,
|
||||
PRBool aLastCall,
|
||||
nsDTDMode aMode = eDTDMode_autodetect);
|
||||
|
||||
/**
|
||||
* Gets the key passed to initial Parse()
|
||||
*/
|
||||
NS_IMETHOD_(void *) GetRootContextKey();
|
||||
|
||||
/**
|
||||
* Stops the parser prematurely
|
||||
*/
|
||||
NS_IMETHOD Terminate(void);
|
||||
|
||||
/**
|
||||
* Don't call. For interface backwards compat only.
|
||||
*/
|
||||
NS_IMETHOD ParseFragment(const nsAString& aSourceBuffer,
|
||||
void* aKey,
|
||||
nsTArray<nsString>& aTagStack,
|
||||
PRBool aXMLMode,
|
||||
const nsACString& aContentType,
|
||||
nsDTDMode aMode = eDTDMode_autodetect);
|
||||
|
||||
/**
|
||||
* Invoke the fragment parsing algorithm (innerHTML).
|
||||
*
|
||||
* @param aSourceBuffer the string being set as innerHTML
|
||||
* @param aTargetNode the target container (must QI to nsIContent)
|
||||
* @param aContextLocalName local name of context node
|
||||
* @param aContextNamespace namespace of context node
|
||||
* @param aQuirks true to make <table> not close <p>
|
||||
*/
|
||||
NS_IMETHOD ParseFragment(const nsAString& aSourceBuffer,
|
||||
nsISupports* aTargetNode,
|
||||
nsIAtom* aContextLocalName,
|
||||
PRInt32 aContextNamespace,
|
||||
PRBool aQuirks);
|
||||
|
||||
/**
|
||||
* Calls ParseUntilSuspend()
|
||||
*/
|
||||
NS_IMETHOD BuildModel(void);
|
||||
|
||||
/**
|
||||
* Removes continue parsing events
|
||||
*/
|
||||
NS_IMETHODIMP CancelParsingEvents();
|
||||
|
||||
/**
|
||||
* Sets the state to initial values
|
||||
*/
|
||||
virtual void Reset();
|
||||
|
||||
/**
|
||||
* True in fragment mode and during synchronous document.write
|
||||
*/
|
||||
virtual PRBool CanInterrupt();
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
void HandleParserContinueEvent(class nsHtml5ParserContinueEvent *);
|
||||
|
||||
// EncodingDeclarationHandler
|
||||
/**
|
||||
* Tree builder uses this to report a late <meta charset>
|
||||
*/
|
||||
void internalEncodingDeclaration(nsString* aEncoding);
|
||||
|
||||
// DocumentModeHandler
|
||||
/**
|
||||
* Tree builder uses this to report quirkiness of the document
|
||||
*/
|
||||
void documentMode(nsHtml5DocumentMode m);
|
||||
|
||||
// nsICharsetDetectionObserver
|
||||
/**
|
||||
* Chardet calls this to report the detection result
|
||||
*/
|
||||
NS_IMETHOD Notify(const char* aCharset, nsDetectionConfident aConf);
|
||||
|
||||
// nsIContentSink
|
||||
|
||||
/**
|
||||
* Unimplemented. For interface compat only.
|
||||
*/
|
||||
NS_IMETHOD WillParse();
|
||||
|
||||
/**
|
||||
* Unimplemented. For interface compat only.
|
||||
*/
|
||||
NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode);
|
||||
|
||||
/**
|
||||
* Emits EOF.
|
||||
*/
|
||||
NS_IMETHOD DidBuildModel();
|
||||
|
||||
/**
|
||||
* Forwards to nsContentSink
|
||||
*/
|
||||
NS_IMETHOD WillInterrupt();
|
||||
|
||||
/**
|
||||
* Unimplemented. For interface compat only.
|
||||
*/
|
||||
NS_IMETHOD WillResume();
|
||||
|
||||
/**
|
||||
* Unimplemented. For interface compat only.
|
||||
*/
|
||||
NS_IMETHOD SetParser(nsIParser* aParser);
|
||||
|
||||
/**
|
||||
* No-op for backwards compat.
|
||||
*/
|
||||
virtual void FlushPendingNotifications(mozFlushType aType);
|
||||
|
||||
/**
|
||||
* Sets mCharset
|
||||
*/
|
||||
NS_IMETHOD SetDocumentCharset(nsACString& aCharset);
|
||||
|
||||
/**
|
||||
* Returns the document.
|
||||
*/
|
||||
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
|
||||
|
||||
/**
|
||||
* <meta charset> scan failed. Try chardet if applicable. After this, the
|
||||
* the parser will have some encoding even if a last resolt fallback.
|
||||
*
|
||||
* @param aFromSegment The current network buffer or null if the sniffing
|
||||
* buffer is being flushed due to network stream ending.
|
||||
* @param aCount The number of bytes in aFromSegment (ignored if
|
||||
* aFromSegment is null)
|
||||
* @param aWriteCount Return value for how many bytes got read from the
|
||||
* buffer.
|
||||
* @param aCountToSniffingLimit The number of unfilled slots in
|
||||
* mSniffingBuffer
|
||||
*/
|
||||
nsresult FinalizeSniffing(const PRUint8* aFromSegment,
|
||||
PRUint32 aCount,
|
||||
PRUint32* aWriteCount,
|
||||
PRUint32 aCountToSniffingLimit);
|
||||
|
||||
/**
|
||||
* Set up the Unicode decoder and write the sniffing buffer into it
|
||||
* followed by the current network buffer.
|
||||
*
|
||||
* @param aFromSegment The current network buffer or null if the sniffing
|
||||
* buffer is being flushed due to network stream ending.
|
||||
* @param aCount The number of bytes in aFromSegment (ignored if
|
||||
* aFromSegment is null)
|
||||
* @param aWriteCount Return value for how many bytes got read from the
|
||||
* buffer.
|
||||
*/
|
||||
nsresult SetupDecodingAndWriteSniffingBufferAndCurrentSegment(const PRUint8* aFromSegment,
|
||||
PRUint32 aCount,
|
||||
PRUint32* aWriteCount);
|
||||
|
||||
/**
|
||||
* Write the sniffing buffer into the Unicode decoder followed by the
|
||||
* current network buffer.
|
||||
*
|
||||
* @param aFromSegment The current network buffer or null if the sniffing
|
||||
* buffer is being flushed due to network stream ending.
|
||||
* @param aCount The number of bytes in aFromSegment (ignored if
|
||||
* aFromSegment is null)
|
||||
* @param aWriteCount Return value for how many bytes got read from the
|
||||
* buffer.
|
||||
*/
|
||||
nsresult WriteSniffingBufferAndCurrentSegment(const PRUint8* aFromSegment,
|
||||
PRUint32 aCount,
|
||||
PRUint32* aWriteCount);
|
||||
|
||||
/**
|
||||
* Initialize the Unicode decoder, mark the BOM as the source and
|
||||
* drop the sniffer.
|
||||
*
|
||||
* @param aCharsetName The charset name to report to the outside (UTF-16
|
||||
* or UTF-8)
|
||||
* @param aDecoderCharsetName The actual name for the decoder's charset
|
||||
* (UTF-16BE, UTF-16LE or UTF-8; the BOM has
|
||||
* been swallowed)
|
||||
*/
|
||||
nsresult SetupDecodingFromBom(const char* aCharsetName,
|
||||
const char* aDecoderCharsetName);
|
||||
|
||||
/**
|
||||
* True when there is a Unicode decoder already
|
||||
*/
|
||||
PRBool HasDecoder() {
|
||||
return !!mUnicodeDecoder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Push bytes from network when there is no Unicode decoder yet
|
||||
*/
|
||||
nsresult SniffStreamBytes(const PRUint8* aFromSegment,
|
||||
PRUint32 aCount,
|
||||
PRUint32* aWriteCount);
|
||||
|
||||
/**
|
||||
* Push bytes from network when there is a Unicode decoder already
|
||||
*/
|
||||
nsresult WriteStreamBytes(const PRUint8* aFromSegment,
|
||||
PRUint32 aCount,
|
||||
PRUint32* aWriteCount);
|
||||
|
||||
/**
|
||||
* Request event loop spin as soon as the tokenizer returns
|
||||
*/
|
||||
void Suspend();
|
||||
|
||||
/**
|
||||
* Request execution of the script element when the tokenizer returns
|
||||
*/
|
||||
void SetScriptElement(nsIContent* aScript);
|
||||
|
||||
/**
|
||||
* Sets up style sheet load / parse
|
||||
*/
|
||||
void UpdateStyleSheet(nsIContent* aElement);
|
||||
|
||||
// Getters and setters for fields from nsContentSink
|
||||
nsIDocument* GetDocument() {
|
||||
return mDocument;
|
||||
}
|
||||
nsNodeInfoManager* GetNodeInfoManager() {
|
||||
return mNodeInfoManager;
|
||||
}
|
||||
nsIDocShell* GetDocShell() {
|
||||
return mDocShell;
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
* Runs mScriptElement
|
||||
*/
|
||||
void ExecuteScript();
|
||||
|
||||
/**
|
||||
* Posts a continue event if there isn't one already
|
||||
*/
|
||||
void MaybePostContinueEvent();
|
||||
|
||||
/**
|
||||
* Renavigates to the document with a different charset
|
||||
*/
|
||||
nsresult PerformCharsetSwitch();
|
||||
|
||||
/**
|
||||
* Parse until pending data is exhausted or tree builder suspends
|
||||
*/
|
||||
void ParseUntilSuspend();
|
||||
|
||||
private:
|
||||
// State variables
|
||||
/**
|
||||
* Call to PerformCharsetSwitch() needed
|
||||
*/
|
||||
PRBool mNeedsCharsetSwitch;
|
||||
|
||||
/**
|
||||
* Whether the last character tokenized was a carriage return (for CRLF)
|
||||
*/
|
||||
PRBool mLastWasCR;
|
||||
|
||||
/**
|
||||
* The parser is in the fragment mode
|
||||
*/
|
||||
PRBool mFragmentMode;
|
||||
|
||||
/**
|
||||
* The parser is blocking on a script
|
||||
*/
|
||||
PRBool mBlocked;
|
||||
|
||||
/**
|
||||
* The event loop will spin ASAP
|
||||
*/
|
||||
PRBool mSuspending;
|
||||
|
||||
/**
|
||||
* The current point on parser life cycle
|
||||
*/
|
||||
eHtml5ParserLifecycle mLifeCycle;
|
||||
|
||||
// script execution
|
||||
/**
|
||||
* Script to run ASAP
|
||||
*/
|
||||
nsCOMPtr<nsIContent> mScriptElement;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
PRBool mUninterruptibleDocWrite;
|
||||
|
||||
// Gecko integration
|
||||
void* mRootContextKey;
|
||||
nsCOMPtr<nsIRequest> mRequest;
|
||||
nsCOMPtr<nsIRequestObserver> mObserver;
|
||||
nsIRunnable* mContinueEvent; // weak ref
|
||||
|
||||
// encoding-related stuff
|
||||
/**
|
||||
* The source (confidence) of the character encoding in use
|
||||
*/
|
||||
PRInt32 mCharsetSource;
|
||||
|
||||
/**
|
||||
* The character encoding in use
|
||||
*/
|
||||
nsCString mCharset;
|
||||
|
||||
/**
|
||||
* The character encoding to which to switch in a late <meta> renavigation
|
||||
*/
|
||||
nsCString mPendingCharset;
|
||||
|
||||
/**
|
||||
* The Unicode decoder
|
||||
*/
|
||||
nsCOMPtr<nsIUnicodeDecoder> mUnicodeDecoder;
|
||||
|
||||
/**
|
||||
* The buffer for sniffing the character encoding
|
||||
*/
|
||||
nsAutoArrayPtr<PRUint8> mSniffingBuffer;
|
||||
|
||||
/**
|
||||
* The number of meaningful bytes in mSniffingBuffer
|
||||
*/
|
||||
PRUint32 mSniffingLength;
|
||||
|
||||
/**
|
||||
* BOM sniffing state
|
||||
*/
|
||||
eBomState mBomState;
|
||||
|
||||
/**
|
||||
* <meta> prescan implementation
|
||||
*/
|
||||
nsAutoPtr<nsHtml5MetaScanner> mMetaScanner;
|
||||
|
||||
// Portable parser objects
|
||||
/**
|
||||
* The first buffer in the pending UTF-16 buffer queue
|
||||
*/
|
||||
nsHtml5UTF16Buffer* mFirstBuffer; // manually managed strong ref
|
||||
|
||||
/**
|
||||
* The last buffer in the pending UTF-16 buffer queue
|
||||
*/
|
||||
nsHtml5UTF16Buffer* mLastBuffer; // weak ref; always points to
|
||||
// a buffer of the size NS_HTML5_PARSER_READ_BUFFER_SIZE
|
||||
|
||||
/**
|
||||
* The HTML5 tree builder
|
||||
*/
|
||||
nsAutoPtr<nsHtml5TreeBuilder> mTreeBuilder;
|
||||
|
||||
/**
|
||||
* The HTML5 tokenizer
|
||||
*/
|
||||
nsAutoPtr<nsHtml5Tokenizer> mTokenizer;
|
||||
|
||||
#ifdef DEBUG
|
||||
/**
|
||||
* For asserting stream life cycle
|
||||
*/
|
||||
eStreamState mStreamListenerState;
|
||||
#endif
|
||||
|
||||
#ifdef GATHER_DOCWRITE_STATISTICS
|
||||
nsHtml5StateSnapshot* mSnapshot;
|
||||
static PRUint32 sUnsafeDocWrites;
|
||||
static PRUint32 sTokenSafeDocWrites;
|
||||
static PRUint32 sTreeSafeDocWrites;
|
||||
#endif
|
||||
};
|
||||
#endif
|
|
@ -0,0 +1,79 @@
|
|||
/* ***** 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:
|
||||
/**
|
||||
* An element
|
||||
*/
|
||||
nsIContent* mParent;
|
||||
|
||||
/**
|
||||
* Child count at start of notification deferring
|
||||
*/
|
||||
PRUint32 mChildCount;
|
||||
};
|
||||
|
||||
#endif // nsHtml5PendingNotification_h__
|
|
@ -0,0 +1,193 @@
|
|||
/* ***** 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)
|
||||
{
|
||||
NS_ASSERTION(!offset, "The offset should always be zero here.");
|
||||
return NS_NewAtom(nsDependentSubstring(buf, buf + length));
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return local->Equals(nsDependentString(buf + offset, buf + offset + length));
|
||||
}
|
||||
|
||||
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 = *litPtr) {
|
||||
NS_ASSERTION(!(litChar >= 'A' && litChar <= 'Z'), "Literal isn't in lower case.");
|
||||
if (strPtr = end) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
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()
|
||||
{
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* 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 "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
|
||||
|
|
@ -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;
|
||||
}
|
|
@ -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__
|
|
@ -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;
|
||||
}
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче