mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 468708 - Make namespace URI for HTML elements be http://www.w3.org/1999/xhtml
This commit is contained in:
parent
6a77ff7122
commit
51bb8f55eb
@ -45,7 +45,7 @@ function openContextMenuFor(element) {
|
||||
|
||||
// This seems to work, as long as we explicitly set the popupNode first.
|
||||
// For frames, the popupNode needs to be set to inside the frame.
|
||||
if (element.localName == "IFRAME")
|
||||
if (element.localName == "iframe")
|
||||
chromeWin.document.popupNode = element.contentDocument.body;
|
||||
else
|
||||
chromeWin.document.popupNode = element;
|
||||
|
@ -817,7 +817,9 @@ nsFrameLoader::EnsureDocShell()
|
||||
nsAutoString frameName;
|
||||
|
||||
PRInt32 namespaceID = mOwnerContent->GetNameSpaceID();
|
||||
if (namespaceID == kNameSpaceID_XHTML) {
|
||||
if (namespaceID == kNameSpaceID_XHTML
|
||||
&& mOwnerContent->GetOwnerDoc() // clean up after bug 335998
|
||||
&& mOwnerContent->GetOwnerDoc()->IsCaseSensitive()) {
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::id, frameName);
|
||||
} else {
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::name, frameName);
|
||||
|
@ -18,42 +18,42 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=276037
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
/** Test for Bug 276037 **/
|
||||
function countElements (node, namespaceURI, tagName) {
|
||||
function countElements (node, namespaceURI, localName) {
|
||||
var count = 0;
|
||||
for (var i = 0; i < node.childNodes.length; i++) {
|
||||
var child = node.childNodes[i];
|
||||
if (child.nodeType == Node.ELEMENT_NODE && child.tagName == tagName &&
|
||||
if (child.nodeType == Node.ELEMENT_NODE && child.localName == localName &&
|
||||
child.namespaceURI == namespaceURI) {
|
||||
count++;
|
||||
}
|
||||
if (child.hasChildNodes()) {
|
||||
count += countElements(child, namespaceURI, tagName);
|
||||
count += countElements(child, namespaceURI, localName);
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
function checkElements(namespaceURI, tagName) {
|
||||
var elementsNS = document.getElementsByTagNameNS(namespaceURI, tagName);
|
||||
var elements = document.getElementsByTagName(tagName);
|
||||
var elementCount = countElements(document, namespaceURI, tagName);
|
||||
const gEBTN = 'document.getElementsByTagName(\'' + tagName + '\').length: ' + elements.length;
|
||||
const gEBTNNS = '; document.getElementsByTagNameNS(\'' + namespaceURI + '\', \'' + tagName + '\').length: ' + elementsNS.length;
|
||||
function checkElements(namespaceURI, localName) {
|
||||
var elementsNS = document.getElementsByTagNameNS(namespaceURI, localName);
|
||||
var elements = document.getElementsByTagName(localName);
|
||||
var elementCount = countElements(document, namespaceURI, localName);
|
||||
const gEBTN = 'document.getElementsByTagName(\'' + localName + '\').length: ' + elements.length;
|
||||
const gEBTNNS = '; document.getElementsByTagNameNS(\'' + namespaceURI + '\', \'' + localName + '\').length: ' + elementsNS.length;
|
||||
|
||||
text1 = gEBTN + '; element count: ' + elementCount;
|
||||
text2 = gEBTNNS + '; element count: ' + elementCount;
|
||||
|
||||
is(elements.length, elementCount, text1);
|
||||
is(elementsNS.length, elementCount, text2);
|
||||
is(global.gEBTN[namespaceURI][tagName].length, elementCount, text1);
|
||||
is(global.gEBTNNS[namespaceURI][tagName].length, elementCount, text2);
|
||||
is(global.gEBTN[namespaceURI][localName].length, elementCount, text1);
|
||||
is(global.gEBTNNS[namespaceURI][localName].length, elementCount, text2);
|
||||
}
|
||||
|
||||
const xhtmlNS = null;
|
||||
const xhtmlNS = 'http://www.w3.org/1999/xhtml';
|
||||
|
||||
function checkSpansAndScripts () {
|
||||
checkElements(xhtmlNS, 'SPAN');
|
||||
checkElements(xhtmlNS, 'SCRIPT');
|
||||
checkElements(xhtmlNS, 'span');
|
||||
checkElements(xhtmlNS, 'script');
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
@ -67,10 +67,10 @@ global.gEBTN[xhtmlNS] = {};
|
||||
global.gEBTNNS = {};
|
||||
global.gEBTNNS[xhtmlNS] = {};
|
||||
|
||||
global.gEBTN[xhtmlNS].SPAN = document.getElementsByTagName("span");
|
||||
global.gEBTNNS[xhtmlNS].SPAN = document.getElementsByTagNameNS(xhtmlNS, "span");
|
||||
global.gEBTN[xhtmlNS].SCRIPT = document.getElementsByTagName("script");
|
||||
global.gEBTNNS[xhtmlNS].SCRIPT = document.getElementsByTagNameNS(xhtmlNS, "script");
|
||||
global.gEBTN[xhtmlNS].span = document.getElementsByTagName("span");
|
||||
global.gEBTNNS[xhtmlNS].span = document.getElementsByTagNameNS(xhtmlNS, "span");
|
||||
global.gEBTN[xhtmlNS].script = document.getElementsByTagName("script");
|
||||
global.gEBTNNS[xhtmlNS].script = document.getElementsByTagNameNS(xhtmlNS, "script");
|
||||
</script>
|
||||
<p><span>Static text in span.</span></p>
|
||||
<script type="text/javascript">
|
||||
|
@ -306,7 +306,8 @@ nsGenericHTMLElement::SetAttribute(const nsAString& aName,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAtom> nameAtom;
|
||||
if (mNodeInfo->NamespaceEquals(kNameSpaceID_None)) {
|
||||
if (GetOwnerDoc() // XXX clean up after bug 335998 lands
|
||||
&& !(GetOwnerDoc()->IsCaseSensitive())) {
|
||||
nsAutoString lower;
|
||||
ToLowerCase(aName, lower);
|
||||
nameAtom = do_GetAtom(lower);
|
||||
@ -328,58 +329,27 @@ nsGenericHTMLElement::GetNodeName(nsAString& aNodeName)
|
||||
{
|
||||
mNodeInfo->GetQualifiedName(aNodeName);
|
||||
|
||||
if (mNodeInfo->NamespaceEquals(kNameSpaceID_None))
|
||||
if (GetOwnerDoc() // XXX clean up after bug 335998 lands
|
||||
&& !(GetOwnerDoc()->IsCaseSensitive()))
|
||||
ToUpperCase(aNodeName);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetLocalName(nsAString& aLocalName)
|
||||
{
|
||||
mNodeInfo->GetLocalName(aLocalName);
|
||||
|
||||
if (mNodeInfo->NamespaceEquals(kNameSpaceID_None)) {
|
||||
// No namespace, this means we're dealing with a good ol' HTML
|
||||
// element, so uppercase the local name.
|
||||
|
||||
ToUpperCase(aLocalName);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetElementsByTagName(const nsAString& aTagname,
|
||||
nsIDOMNodeList** aReturn)
|
||||
{
|
||||
nsAutoString tagName(aTagname);
|
||||
|
||||
// Only lowercase the name if this element has no namespace (i.e.
|
||||
// it's a HTML element, not an XHTML element).
|
||||
if (mNodeInfo && mNodeInfo->NamespaceEquals(kNameSpaceID_None))
|
||||
// Only lowercase the name if this is an HTML document.
|
||||
if (GetOwnerDoc() // XXX clean up after bug 335998 lands
|
||||
&& !(GetOwnerDoc()->IsCaseSensitive()))
|
||||
ToLowerCase(tagName);
|
||||
|
||||
return nsGenericHTMLElementBase::GetElementsByTagName(tagName, aReturn);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName,
|
||||
nsIDOMNodeList** aReturn)
|
||||
{
|
||||
nsAutoString localName(aLocalName);
|
||||
|
||||
// Only lowercase the name if this element has no namespace (i.e.
|
||||
// it's a HTML element, not an XHTML element).
|
||||
if (mNodeInfo && mNodeInfo->NamespaceEquals(kNameSpaceID_None))
|
||||
ToLowerCase(localName);
|
||||
|
||||
return nsGenericHTMLElementBase::GetElementsByTagNameNS(aNamespaceURI,
|
||||
localName,
|
||||
aReturn);
|
||||
}
|
||||
|
||||
// Implementation for nsIDOMHTMLElement
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetId(nsAString& aId)
|
||||
@ -1195,7 +1165,7 @@ nsGenericHTMLElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||
already_AddRefed<nsIURI>
|
||||
nsGenericHTMLElement::GetBaseURI() const
|
||||
{
|
||||
nsIDocument* doc = GetOwnerDoc();
|
||||
nsIDocument* doc = GetOwnerDoc(); // XXX clean up after bug 335998 lands
|
||||
|
||||
void* prop;
|
||||
if (HasFlag(NODE_HAS_PROPERTIES) && (prop = GetProperty(nsGkAtoms::htmlBaseHref))) {
|
||||
@ -1207,15 +1177,11 @@ nsGenericHTMLElement::GetBaseURI() const
|
||||
|
||||
// If we are a plain old HTML element (not XHTML), don't bother asking the
|
||||
// base class -- our base URI is determined solely by the document base.
|
||||
if (mNodeInfo->NamespaceEquals(kNameSpaceID_None)) {
|
||||
if (doc) {
|
||||
nsIURI *uri = doc->GetBaseURI();
|
||||
NS_IF_ADDREF(uri);
|
||||
if (doc && !(doc->IsCaseSensitive())) {
|
||||
nsIURI *uri = doc->GetBaseURI();
|
||||
NS_IF_ADDREF(uri);
|
||||
|
||||
return uri;
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
return uri;
|
||||
}
|
||||
|
||||
return nsGenericHTMLElementBase::GetBaseURI();
|
||||
@ -3441,7 +3407,8 @@ nsGenericHTMLElement::GetHashFromHrefURI(nsAString& aHash)
|
||||
const nsAttrName*
|
||||
nsGenericHTMLElement::InternalGetExistingAttrNameFromQName(const nsAString& aStr) const
|
||||
{
|
||||
if (mNodeInfo->NamespaceEquals(kNameSpaceID_None)) {
|
||||
if (GetOwnerDoc() // XXX clean up after bug 335998 lands
|
||||
&& !(GetOwnerDoc()->IsCaseSensitive())) {
|
||||
nsAutoString lower;
|
||||
ToLowerCase(aStr, lower);
|
||||
return mAttrsAndChildren.GetExistingAttrNameFromQName(
|
||||
|
@ -103,7 +103,6 @@ public:
|
||||
|
||||
// Implementation for nsIDOMNode
|
||||
NS_METHOD GetNodeName(nsAString& aNodeName);
|
||||
NS_METHOD GetLocalName(nsAString& aLocalName);
|
||||
|
||||
// Implementation for nsIDOMElement
|
||||
NS_METHOD SetAttribute(const nsAString& aName,
|
||||
@ -111,9 +110,6 @@ public:
|
||||
NS_METHOD GetTagName(nsAString& aTagName);
|
||||
NS_METHOD GetElementsByTagName(const nsAString& aTagname,
|
||||
nsIDOMNodeList** aReturn);
|
||||
NS_METHOD GetElementsByTagNameNS(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName,
|
||||
nsIDOMNodeList** aReturn);
|
||||
|
||||
// nsIDOMHTMLElement methods. Note that these are non-virtual
|
||||
// methods, implementations are expected to forward calls to these
|
||||
|
@ -152,7 +152,7 @@ NS_NewHTMLOptionElement(nsINodeInfo *aNodeInfo, PRBool aFromParser)
|
||||
NS_ENSURE_TRUE(doc, nsnull);
|
||||
|
||||
nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::option, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, nsnull);
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,8 @@ nsHTMLStyleElement::GetStyleSheetURL(PRBool* aIsInline,
|
||||
if (*aIsInline) {
|
||||
return;
|
||||
}
|
||||
if (mNodeInfo->NamespaceEquals(kNameSpaceID_XHTML)) {
|
||||
if (GetOwnerDoc() && // XXX clean up after bug 335998 lands
|
||||
!(GetOwnerDoc()->IsCaseSensitive())) {
|
||||
// We stopped supporting <style src="..."> for XHTML as it is
|
||||
// non-standard.
|
||||
*aIsInline = PR_TRUE;
|
||||
|
@ -250,7 +250,7 @@ nsHTMLTableRowElement::GetCells(nsIDOMHTMLCollection** aValue)
|
||||
nsnull, // closure data
|
||||
PR_FALSE,
|
||||
nsnull,
|
||||
kNameSpaceID_None,
|
||||
kNameSpaceID_XHTML,
|
||||
PR_FALSE);
|
||||
|
||||
NS_ENSURE_TRUE(mCells, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
@ -547,7 +547,7 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode,
|
||||
ToLowerCase(tmp);
|
||||
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(tmp);
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_None);
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_XHTML);
|
||||
}
|
||||
else if (mNodeInfoCache[aNodeType]) {
|
||||
nodeInfo = mNodeInfoCache[aNodeType];
|
||||
@ -560,7 +560,7 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode,
|
||||
nsIAtom *name = parserService->HTMLIdToAtomTag(aNodeType);
|
||||
NS_ASSERTION(name, "What? Reverse mapping of id to string broken!!!");
|
||||
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_None);
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_XHTML);
|
||||
NS_IF_ADDREF(mNodeInfoCache[aNodeType] = nodeInfo);
|
||||
}
|
||||
|
||||
@ -582,15 +582,7 @@ NS_NewHTMLElement(nsIContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
|
||||
nsIAtom *name = aNodeInfo->NameAtom();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (aNodeInfo->NamespaceEquals(kNameSpaceID_None)) {
|
||||
nsAutoString nameStr, lname;
|
||||
name->ToString(nameStr);
|
||||
ToLowerCase(nameStr, lname);
|
||||
NS_ASSERTION(nameStr.Equals(lname), "name should be lowercase by now");
|
||||
NS_ASSERTION(!aNodeInfo->GetPrefixAtom(), "should not have a prefix");
|
||||
}
|
||||
#endif
|
||||
NS_ASSERTION(aNodeInfo->NamespaceEquals(kNameSpaceID_XHTML), "Someone is still trying to create HTML elements is no namespace!");
|
||||
|
||||
*aResult = CreateHTMLElement(parserService->
|
||||
HTMLCaseSensitiveAtomTagToId(name),
|
||||
@ -1680,7 +1672,7 @@ HTMLContentSink::Init(nsIDocument* aDoc,
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::html, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
// Make root part
|
||||
@ -1708,7 +1700,7 @@ HTMLContentSink::Init(nsIDocument* aDoc,
|
||||
|
||||
// Make head part
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::head,
|
||||
nsnull, kNameSpaceID_None);
|
||||
nsnull, kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
mHead = NS_NewHTMLHeadElement(nodeInfo);
|
||||
@ -2899,7 +2891,7 @@ HTMLContentSink::ProcessLINKTag(const nsIParserNode& aNode)
|
||||
// Create content object
|
||||
nsCOMPtr<nsIContent> element;
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::link, nsnull, kNameSpaceID_None);
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::link, nsnull, kNameSpaceID_XHTML);
|
||||
|
||||
result = NS_NewHTMLElement(getter_AddRefs(element), nodeInfo, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
@ -1210,7 +1210,7 @@ nsHTMLDocument::CreateElement(const nsAString& aTagName,
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(tagName);
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
rv = CreateElem(name, nsnull, GetDefaultNamespaceID(), PR_TRUE,
|
||||
rv = CreateElem(name, nsnull, kNameSpaceID_XHTML, PR_TRUE,
|
||||
getter_AddRefs(content));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -1591,7 +1591,7 @@ NS_IMETHODIMP
|
||||
nsHTMLDocument::GetImages(nsIDOMHTMLCollection** aImages)
|
||||
{
|
||||
if (!mImages) {
|
||||
mImages = new nsContentList(this, nsGkAtoms::img, GetDefaultNamespaceID());
|
||||
mImages = new nsContentList(this, nsGkAtoms::img, kNameSpaceID_XHTML);
|
||||
if (!mImages) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -1608,7 +1608,7 @@ nsHTMLDocument::GetApplets(nsIDOMHTMLCollection** aApplets)
|
||||
{
|
||||
if (!mApplets) {
|
||||
mApplets = new nsContentList(this, nsGkAtoms::applet,
|
||||
GetDefaultNamespaceID());
|
||||
kNameSpaceID_XHTML);
|
||||
if (!mApplets) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -1641,10 +1641,9 @@ nsHTMLDocument::MatchLinks(nsIContent *aContent, PRInt32 aNamespaceID,
|
||||
#endif
|
||||
|
||||
nsINodeInfo *ni = aContent->NodeInfo();
|
||||
PRInt32 namespaceID = doc->GetDefaultNamespaceID();
|
||||
|
||||
nsIAtom *localName = ni->NameAtom();
|
||||
if (ni->NamespaceID() == namespaceID &&
|
||||
if (ni->NamespaceID() == kNameSpaceID_XHTML &&
|
||||
(localName == nsGkAtoms::a || localName == nsGkAtoms::area)) {
|
||||
return aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::href);
|
||||
}
|
||||
@ -1686,8 +1685,7 @@ nsHTMLDocument::MatchAnchors(nsIContent *aContent, PRInt32 aNamespaceID,
|
||||
}
|
||||
#endif
|
||||
|
||||
PRInt32 namespaceID = aContent->GetCurrentDoc()->GetDefaultNamespaceID();
|
||||
if (aContent->NodeInfo()->Equals(nsGkAtoms::a, namespaceID)) {
|
||||
if (aContent->NodeInfo()->Equals(nsGkAtoms::a, kNameSpaceID_XHTML)) {
|
||||
return aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::name);
|
||||
}
|
||||
|
||||
@ -2305,13 +2303,7 @@ nsHTMLDocument::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName,
|
||||
nsIDOMNodeList** aReturn)
|
||||
{
|
||||
nsAutoString tmp(aLocalName);
|
||||
|
||||
if (!IsXHTML()) {
|
||||
ToLowerCase(tmp); // HTML elements are lower case internally.
|
||||
}
|
||||
|
||||
return nsDocument::GetElementsByTagNameNS(aNamespaceURI, tmp, aReturn);
|
||||
return nsDocument::GetElementsByTagNameNS(aNamespaceURI, aLocalName, aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -2619,7 +2611,7 @@ NS_IMETHODIMP
|
||||
nsHTMLDocument::GetEmbeds(nsIDOMHTMLCollection** aEmbeds)
|
||||
{
|
||||
if (!mEmbeds) {
|
||||
mEmbeds = new nsContentList(this, nsGkAtoms::embed, GetDefaultNamespaceID());
|
||||
mEmbeds = new nsContentList(this, nsGkAtoms::embed, kNameSpaceID_XHTML);
|
||||
if (!mEmbeds) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -2952,7 +2944,7 @@ nsContentList*
|
||||
nsHTMLDocument::GetForms()
|
||||
{
|
||||
if (!mForms)
|
||||
mForms = new nsContentList(this, nsGkAtoms::form, GetDefaultNamespaceID());
|
||||
mForms = new nsContentList(this, nsGkAtoms::form, kNameSpaceID_XHTML);
|
||||
|
||||
return mForms;
|
||||
}
|
||||
@ -3170,7 +3162,7 @@ DocAllResultMatch(nsIContent* aContent, PRInt32 aNamespaceID, nsIAtom* aAtom,
|
||||
}
|
||||
|
||||
nsGenericHTMLElement* elm = nsGenericHTMLElement::FromContent(aContent);
|
||||
if (!elm || aContent->GetNameSpaceID() != kNameSpaceID_None) {
|
||||
if (!elm) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
@ -4093,31 +4085,6 @@ nsHTMLDocument::QueryCommandValue(const nsAString & commandID,
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
nsresult
|
||||
nsHTMLDocument::CreateElem(nsIAtom *aName, nsIAtom *aPrefix,
|
||||
PRInt32 aNamespaceID, PRBool aDocumentDefaultType,
|
||||
nsIContent** aResult)
|
||||
{
|
||||
NS_ASSERTION(!aDocumentDefaultType || IsXHTML() ||
|
||||
aNamespaceID == kNameSpaceID_None,
|
||||
"HTML elements in an HTML document should have "
|
||||
"kNamespaceID_None as their namespace ID.");
|
||||
|
||||
if (IsXHTML() &&
|
||||
(aDocumentDefaultType || aNamespaceID == kNameSpaceID_XHTML)) {
|
||||
nsCAutoString name, lcName;
|
||||
aName->ToUTF8String(name);
|
||||
ToLowerCase(name, lcName);
|
||||
NS_ASSERTION(lcName.Equals(name),
|
||||
"aName should be lowercase, fix caller.");
|
||||
}
|
||||
|
||||
return nsDocument::CreateElem(aName, aPrefix, aNamespaceID,
|
||||
aDocumentDefaultType, aResult);
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsHTMLDocument::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
|
||||
{
|
||||
|
@ -184,13 +184,6 @@ public:
|
||||
return !mIsRegularHTML;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
virtual nsresult CreateElem(nsIAtom *aName, nsIAtom *aPrefix,
|
||||
PRInt32 aNamespaceID,
|
||||
PRBool aDocumentDefaultType,
|
||||
nsIContent** aResult);
|
||||
#endif
|
||||
|
||||
nsresult ChangeContentEditableCount(nsIContent *aElement, PRInt32 aChange);
|
||||
|
||||
virtual EditingState GetEditingState()
|
||||
@ -274,7 +267,7 @@ protected:
|
||||
|
||||
virtual PRInt32 GetDefaultNamespaceID() const
|
||||
{
|
||||
return mIsRegularHTML ? kNameSpaceID_None : kNameSpaceID_XHTML;
|
||||
return kNameSpaceID_XHTML;
|
||||
}
|
||||
|
||||
nsCOMArray<nsIDOMHTMLMapElement> mImageMaps;
|
||||
|
@ -419,7 +419,7 @@ nsHTMLFragmentContentSink::OpenContainer(const nsIParserNode& aNode)
|
||||
ToLowerCase(tmp);
|
||||
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(tmp);
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_None);
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
else if (mNodeInfoCache[nodeType]) {
|
||||
@ -433,7 +433,7 @@ nsHTMLFragmentContentSink::OpenContainer(const nsIParserNode& aNode)
|
||||
nsIAtom *name = parserService->HTMLIdToAtomTag(nodeType);
|
||||
NS_ASSERTION(name, "This should not happen!");
|
||||
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_None);
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(mNodeInfoCache[nodeType] = nodeInfo);
|
||||
@ -521,7 +521,7 @@ nsHTMLFragmentContentSink::AddLeaf(const nsIParserNode& aNode)
|
||||
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(tmp);
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
else if (mNodeInfoCache[nodeType]) {
|
||||
@ -532,7 +532,7 @@ nsHTMLFragmentContentSink::AddLeaf(const nsIParserNode& aNode)
|
||||
NS_ASSERTION(name, "This should not happen!");
|
||||
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ADDREF(mNodeInfoCache[nodeType] = nodeInfo);
|
||||
}
|
||||
@ -1011,7 +1011,7 @@ nsHTMLParanoidFragmentSink::NameFromNode(const nsIParserNode& aNode,
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
rv =
|
||||
mNodeInfoManager->GetNodeInfo(aNode.GetText(), nsnull,
|
||||
kNameSpaceID_None,
|
||||
kNameSpaceID_XHTML,
|
||||
getter_AddRefs(nodeInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_IF_ADDREF(*aResult = nodeInfo->NameAtom());
|
||||
@ -1175,7 +1175,7 @@ nsHTMLParanoidFragmentSink::AddLeaf(const nsIParserNode& aNode)
|
||||
if (!parserService)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(name, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
rv = NS_NewHTMLElement(getter_AddRefs(content), nodeInfo, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -627,7 +627,7 @@ nsImageDocument::CreateSyntheticDocument()
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::img, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
mImageContent = NS_NewHTMLImageElement(nodeInfo);
|
||||
|
@ -234,7 +234,7 @@ nsMediaDocument::CreateSyntheticDocument()
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::html, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsRefPtr<nsGenericHTMLElement> root = NS_NewHTMLHtmlElement(nodeInfo);
|
||||
@ -247,7 +247,7 @@ nsMediaDocument::CreateSyntheticDocument()
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::head, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
// Create a <head> so our title has somewhere to live
|
||||
@ -259,7 +259,7 @@ nsMediaDocument::CreateSyntheticDocument()
|
||||
root->AppendChildTo(head, PR_FALSE);
|
||||
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::body, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsRefPtr<nsGenericHTMLElement> body = NS_NewHTMLBodyElement(nodeInfo);
|
||||
|
@ -281,7 +281,7 @@ nsPluginDocument::CreateSyntheticPluginDocument()
|
||||
// make plugin content
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::embed, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
rv = NS_NewHTMLElement(getter_AddRefs(mPluginContent), nodeInfo, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -108,7 +108,7 @@ nsVideoDocument::CreateSyntheticVideoDocument(nsIChannel* aChannel,
|
||||
// make content
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::video, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
|
||||
|
||||
nsRefPtr<nsHTMLMediaElement> element =
|
||||
|
@ -761,6 +761,18 @@ txXPathNodeUtils::comparePosition(const txXPathNode& aNode,
|
||||
return total < otherTotal ? -1 : 1;
|
||||
}
|
||||
|
||||
/* static */
|
||||
PRBool
|
||||
txXPathNodeUtils::isHTMLElementInHTMLDocument(const txXPathNode& aNode)
|
||||
{
|
||||
if (!aNode.isContent()) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
nsIContent* content = aNode.Content();
|
||||
return (content->IsNodeOfType(nsINode::eHTML) &&
|
||||
!(content->GetOwnerDoc()->IsCaseSensitive()));
|
||||
}
|
||||
|
||||
/* static */
|
||||
txXPathNode*
|
||||
txXPathNativeNode::createXPathNode(nsIContent* aContent, PRBool aKeepRootAlive)
|
||||
|
@ -72,7 +72,12 @@ PRBool txNameTest::matches(const txXPathNode& aNode, txIMatchContext* aContext)
|
||||
return MB_TRUE;
|
||||
|
||||
// Compare namespaces
|
||||
if (txXPathNodeUtils::getNamespaceID(aNode) != mNamespace)
|
||||
if (mNamespace != txXPathNodeUtils::getNamespaceID(aNode)
|
||||
#ifndef TX_EXE
|
||||
&& !(mNamespace == kNameSpaceID_None &&
|
||||
txXPathNodeUtils::isHTMLElementInHTMLDocument(aNode))
|
||||
#endif
|
||||
)
|
||||
return MB_FALSE;
|
||||
|
||||
// Name wild?
|
||||
|
@ -143,8 +143,9 @@ public:
|
||||
static PRBool isProcessingInstruction(const txXPathNode& aNode);
|
||||
static PRBool isComment(const txXPathNode& aNode);
|
||||
static PRBool isText(const txXPathNode& aNode);
|
||||
|
||||
#ifdef TX_EXE
|
||||
#ifndef TX_EXE
|
||||
static PRBool isHTMLElementInHTMLDocument(const txXPathNode& aNode);
|
||||
#else
|
||||
private:
|
||||
static void appendNodeValueHelper(NodeDefinition* aNode, nsAString& aResult);
|
||||
#endif
|
||||
|
@ -453,11 +453,10 @@ txMozillaXMLOutput::startElement(nsIAtom* aPrefix, nsIAtom* aLocalName,
|
||||
|
||||
aLowercaseLocalName = owner;
|
||||
}
|
||||
return startElementInternal(nsnull, aLowercaseLocalName,
|
||||
kNameSpaceID_None, kNameSpaceID_XHTML);
|
||||
return startElementInternal(nsnull, aLowercaseLocalName, kNameSpaceID_XHTML);
|
||||
}
|
||||
|
||||
return startElementInternal(aPrefix, aLocalName, aNsID, aNsID);
|
||||
return startElementInternal(aPrefix, aLocalName, aNsID);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -465,11 +464,11 @@ txMozillaXMLOutput::startElement(nsIAtom* aPrefix,
|
||||
const nsSubstring& aLocalName,
|
||||
const PRInt32 aNsID)
|
||||
{
|
||||
PRInt32 elemType = aNsID;
|
||||
PRInt32 nsId = aNsID;
|
||||
nsCOMPtr<nsIAtom> lname;
|
||||
|
||||
if (mOutputFormat.mMethod == eHTMLOutput && aNsID == kNameSpaceID_None) {
|
||||
elemType = kNameSpaceID_XHTML;
|
||||
nsId = kNameSpaceID_XHTML;
|
||||
|
||||
nsAutoString lnameStr;
|
||||
ToLowerCase(aLocalName, lnameStr);
|
||||
@ -483,22 +482,21 @@ txMozillaXMLOutput::startElement(nsIAtom* aPrefix,
|
||||
NS_ENSURE_TRUE(lname, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
// Check that it's a valid name
|
||||
if (!nsContentUtils::IsValidNodeName(lname, aPrefix, aNsID)) {
|
||||
if (!nsContentUtils::IsValidNodeName(lname, aPrefix, nsId)) {
|
||||
// Try without prefix
|
||||
aPrefix = nsnull;
|
||||
if (!nsContentUtils::IsValidNodeName(lname, aPrefix, aNsID)) {
|
||||
if (!nsContentUtils::IsValidNodeName(lname, aPrefix, nsId)) {
|
||||
return NS_ERROR_XSLT_BAD_NODE_NAME;
|
||||
}
|
||||
}
|
||||
|
||||
return startElementInternal(aPrefix, lname, aNsID, elemType);
|
||||
return startElementInternal(aPrefix, lname, nsId);
|
||||
}
|
||||
|
||||
nsresult
|
||||
txMozillaXMLOutput::startElementInternal(nsIAtom* aPrefix,
|
||||
nsIAtom* aLocalName,
|
||||
PRInt32 aNsID,
|
||||
PRInt32 aElemType)
|
||||
PRInt32 aNsID)
|
||||
{
|
||||
TX_ENSURE_CURRENTNODE;
|
||||
|
||||
@ -539,12 +537,12 @@ txMozillaXMLOutput::startElementInternal(nsIAtom* aPrefix,
|
||||
ni = mNodeInfoManager->GetNodeInfo(aLocalName, aPrefix, aNsID);
|
||||
NS_ENSURE_TRUE(ni, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_NewElement(getter_AddRefs(mOpenedElement), aElemType, ni, PR_FALSE);
|
||||
NS_NewElement(getter_AddRefs(mOpenedElement), aNsID, ni, PR_FALSE);
|
||||
|
||||
// Set up the element and adjust state
|
||||
if (!mNoFixup) {
|
||||
if (aElemType == kNameSpaceID_XHTML) {
|
||||
mOpenedElementIsHTML = aNsID != kNameSpaceID_XHTML;
|
||||
if (aNsID == kNameSpaceID_XHTML) {
|
||||
mOpenedElementIsHTML = (mOutputFormat.mMethod == eHTMLOutput);
|
||||
rv = startHTMLElement(mOpenedElement, mOpenedElementIsHTML);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -971,7 +969,7 @@ txMozillaXMLOutput::createHTMLElement(nsIAtom* aName,
|
||||
|
||||
nsCOMPtr<nsINodeInfo> ni;
|
||||
ni = mNodeInfoManager->GetNodeInfo(aName, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(ni, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return NS_NewHTMLElement(aResult, ni, PR_FALSE);
|
||||
|
@ -121,7 +121,7 @@ private:
|
||||
nsresult attributeInternal(nsIAtom* aPrefix, nsIAtom* aLocalName,
|
||||
PRInt32 aNsID, const nsString& aValue);
|
||||
nsresult startElementInternal(nsIAtom* aPrefix, nsIAtom* aLocalName,
|
||||
PRInt32 aNsID, PRInt32 aElemType);
|
||||
PRInt32 aNsID);
|
||||
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
nsCOMPtr<nsINode> mCurrentNode; // This is updated once an element is
|
||||
|
@ -361,15 +361,15 @@ nsContentDLF::CreateBlankDocument(nsILoadGroup *aLoadGroup,
|
||||
nsCOMPtr<nsINodeInfo> htmlNodeInfo;
|
||||
|
||||
// generate an html html element
|
||||
htmlNodeInfo = nim->GetNodeInfo(nsGkAtoms::html, 0, kNameSpaceID_None);
|
||||
htmlNodeInfo = nim->GetNodeInfo(nsGkAtoms::html, 0, kNameSpaceID_XHTML);
|
||||
nsCOMPtr<nsIContent> htmlElement = NS_NewHTMLHtmlElement(htmlNodeInfo);
|
||||
|
||||
// generate an html head element
|
||||
htmlNodeInfo = nim->GetNodeInfo(nsGkAtoms::head, 0, kNameSpaceID_None);
|
||||
htmlNodeInfo = nim->GetNodeInfo(nsGkAtoms::head, 0, kNameSpaceID_XHTML);
|
||||
nsCOMPtr<nsIContent> headElement = NS_NewHTMLHeadElement(htmlNodeInfo);
|
||||
|
||||
// generate an html body element
|
||||
htmlNodeInfo = nim->GetNodeInfo(nsGkAtoms::body, 0, kNameSpaceID_None);
|
||||
htmlNodeInfo = nim->GetNodeInfo(nsGkAtoms::body, 0, kNameSpaceID_XHTML);
|
||||
nsCOMPtr<nsIContent> bodyElement = NS_NewHTMLBodyElement(htmlNodeInfo);
|
||||
|
||||
// blat in the structure
|
||||
|
@ -1026,7 +1026,7 @@ nsComboboxControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = nimgr->GetNodeInfo(nsGkAtoms::input, nsnull, kNameSpaceID_None);
|
||||
nodeInfo = nimgr->GetNodeInfo(nsGkAtoms::input, nsnull, kNameSpaceID_XHTML);
|
||||
|
||||
// create button which drops the list down
|
||||
NS_NewHTMLElement(getter_AddRefs(mButtonContent), nodeInfo, PR_FALSE);
|
||||
|
@ -155,7 +155,7 @@ nsFileControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::input, nsnull,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_XHTML);
|
||||
|
||||
// Create the text content
|
||||
NS_NewHTMLElement(getter_AddRefs(mTextContent), nodeInfo, PR_FALSE);
|
||||
|
@ -193,7 +193,7 @@ nsIsIndexFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
|
||||
|
||||
// Create an hr
|
||||
nsCOMPtr<nsINodeInfo> hrInfo;
|
||||
hrInfo = nimgr->GetNodeInfo(nsGkAtoms::hr, nsnull, kNameSpaceID_None);
|
||||
hrInfo = nimgr->GetNodeInfo(nsGkAtoms::hr, nsnull, kNameSpaceID_XHTML);
|
||||
|
||||
NS_NewHTMLElement(getter_AddRefs(mPreHr), hrInfo, PR_FALSE);
|
||||
if (!mPreHr || !aElements.AppendElement(mPreHr))
|
||||
@ -211,7 +211,7 @@ nsIsIndexFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
|
||||
|
||||
// Create text input field
|
||||
nsCOMPtr<nsINodeInfo> inputInfo;
|
||||
inputInfo = nimgr->GetNodeInfo(nsGkAtoms::input, nsnull, kNameSpaceID_None);
|
||||
inputInfo = nimgr->GetNodeInfo(nsGkAtoms::input, nsnull, kNameSpaceID_XHTML);
|
||||
|
||||
NS_NewHTMLElement(getter_AddRefs(mInputContent), inputInfo, PR_FALSE);
|
||||
if (!mInputContent)
|
||||
|
@ -3057,21 +3057,10 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays()
|
||||
// might kill us...
|
||||
nsCOMPtr<nsIPluginInstanceOwner> kungFuDeathGrip(this);
|
||||
|
||||
if (ni->NamespaceEquals(kNameSpaceID_XHTML)) {
|
||||
// For XHTML elements we need to take the namespace URI into
|
||||
// account when looking for param elements.
|
||||
NS_NAMED_LITERAL_STRING(xhtml_ns, "http://www.w3.org/1999/xhtml");
|
||||
|
||||
NS_NAMED_LITERAL_STRING(xhtml_ns, "http://www.w3.org/1999/xhtml");
|
||||
|
||||
mydomElement->GetElementsByTagNameNS(xhtml_ns, NS_LITERAL_STRING("param"),
|
||||
getter_AddRefs(allParams));
|
||||
} else {
|
||||
// If content is not XHTML, it must be HTML, no need to worry
|
||||
// about namespaces then...
|
||||
|
||||
mydomElement->GetElementsByTagName(NS_LITERAL_STRING("param"),
|
||||
mydomElement->GetElementsByTagNameNS(xhtml_ns, NS_LITERAL_STRING("param"),
|
||||
getter_AddRefs(allParams));
|
||||
}
|
||||
|
||||
if (allParams) {
|
||||
PRUint32 numAllParams;
|
||||
@ -3162,7 +3151,8 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays()
|
||||
// (see the AddAttributes functions in the HTML and XML content sinks).
|
||||
PRInt16 start, end, increment;
|
||||
if (mContent->IsNodeOfType(nsINode::eHTML) &&
|
||||
mContent->NodeInfo()->NamespaceEquals(kNameSpaceID_None)) {
|
||||
mContent->GetOwnerDoc() && // XXX clean up after bug 335998 lands
|
||||
!(mContent->GetOwnerDoc()->IsCaseSensitive())) {
|
||||
// HTML. Walk attributes in reverse order.
|
||||
start = numRealAttrs - 1;
|
||||
end = -1;
|
||||
|
@ -897,16 +897,11 @@ RuleProcessorData::RuleProcessorData(nsPresContext* aPresContext,
|
||||
// see if there are attributes for the content
|
||||
mHasAttributes = aContent->GetAttrCount() > 0;
|
||||
|
||||
// get the namespace
|
||||
mNameSpaceID = aContent->GetNameSpaceID();
|
||||
|
||||
// check for HTMLContent and Link status
|
||||
if (aContent->IsNodeOfType(nsINode::eHTML)) {
|
||||
mIsHTMLContent = PR_TRUE;
|
||||
// Note that we want to treat non-XML HTML content as XHTML for namespace
|
||||
// purposes, since html.css has that namespace declared.
|
||||
mNameSpaceID = kNameSpaceID_XHTML;
|
||||
} else {
|
||||
// get the namespace
|
||||
mNameSpaceID = aContent->GetNameSpaceID();
|
||||
}
|
||||
mIsHTMLContent = (mNameSpaceID == kNameSpaceID_XHTML);
|
||||
|
||||
// if HTML content and it has some attributes, check for an HTML link
|
||||
// NOTE: optimization: cannot be a link if no attributes (since it needs an href)
|
||||
@ -998,9 +993,7 @@ const nsString* RuleProcessorData::GetLang()
|
||||
static inline PRInt32
|
||||
CSSNameSpaceID(nsIContent *aContent)
|
||||
{
|
||||
return aContent->IsNodeOfType(nsINode::eHTML)
|
||||
? kNameSpaceID_XHTML
|
||||
: aContent->GetNameSpaceID();
|
||||
return aContent->GetNameSpaceID();
|
||||
}
|
||||
|
||||
PRInt32
|
||||
@ -1571,7 +1564,8 @@ static PRBool SelectorMatches(RuleProcessorData &data,
|
||||
}
|
||||
else if (nsCSSPseudoClasses::mozIsHTML == pseudoClass->mAtom) {
|
||||
result = data.mIsHTMLContent &&
|
||||
data.mContent->GetNameSpaceID() == kNameSpaceID_None;
|
||||
data.mContent->GetOwnerDoc() && // XXX clean up after bug 335998 lands
|
||||
!(data.mContent->GetOwnerDoc()->IsCaseSensitive());
|
||||
}
|
||||
#ifdef MOZ_MATHML
|
||||
else if (nsCSSPseudoClasses::mozMathIncrementScriptLevel == pseudoClass->mAtom) {
|
||||
|
Loading…
Reference in New Issue
Block a user