Bug 488249. Replace IsNodeOfType(eHTML) checks with namespace checks. r+sr=jst

This commit is contained in:
David Zbarsky 2009-08-24 16:02:07 -04:00
parent bb1da31747
commit 932e28482f
80 changed files with 242 additions and 241 deletions

View File

@ -1483,7 +1483,7 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
return InitAccessible(newAcc, aAccessible, nsnull);
}
PRBool isHTML = content->IsNodeOfType(nsINode::eHTML);
PRBool isHTML = content->IsHTML();
if (isHTML && content->Tag() == nsAccessibilityAtoms::map) {
// Create hyper text accessible for HTML map if it is used to group links
// (see http://www.w3.org/TR/WCAG10-HTML-TECHS/#group-bypass). If the HTML

View File

@ -298,9 +298,9 @@ nsAccessible::GetName(nsAString& aName)
nsIAtom *tooltipAttr = nsnull;
if (content->IsNodeOfType(nsINode::eHTML))
if (content->IsHTML())
tooltipAttr = nsAccessibilityAtoms::title;
else if (content->IsNodeOfType(nsINode::eXUL))
else if (content->IsXUL())
tooltipAttr = nsAccessibilityAtoms::tooltiptext;
else
return NS_OK;
@ -342,7 +342,7 @@ NS_IMETHODIMP nsAccessible::GetDescription(nsAString& aDescription)
NS_ENSURE_SUCCESS(rv, rv);
if (description.IsEmpty()) {
PRBool isXUL = content->IsNodeOfType(nsINode::eXUL);
PRBool isXUL = content->IsXUL();
if (isXUL) {
// Try XUL <description control="[id]">description text</description>
nsIContent *descriptionContent =
@ -1009,7 +1009,7 @@ nsAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
// if someone sets it on another attribute,
// it seems reasonable to consider it unavailable
PRBool isDisabled;
if (content->IsNodeOfType(nsINode::eHTML)) {
if (content->IsHTML()) {
// In HTML, just the presence of the disabled attribute means it is disabled,
// therefore disabled="false" indicates disabled!
isDisabled = content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::disabled);
@ -2410,7 +2410,7 @@ nsAccessible::GetRelationByType(PRUint32 aRelationType,
case nsIAccessibleRelation::RELATION_LABEL_FOR:
{
if (content->Tag() == nsAccessibilityAtoms::label) {
nsIAtom *IDAttr = content->IsNodeOfType(nsINode::eHTML) ?
nsIAtom *IDAttr = content->IsHTML() ?
nsAccessibilityAtoms::_for : nsAccessibilityAtoms::control;
rv = nsRelUtils::
AddTargetFromIDRefAttr(aRelationType, aRelation, content, IDAttr);
@ -2467,7 +2467,7 @@ nsAccessible::GetRelationByType(PRUint32 aRelationType,
return NS_OK; // XXX bug 381599, avoid performance problems
if (content->Tag() == nsAccessibilityAtoms::description &&
content->IsNodeOfType(nsINode::eXUL)) {
content->IsXUL()) {
// This affectively adds an optional control attribute to xul:description,
// which only affects accessibility, by allowing the description to be
// tied to a control.
@ -2551,7 +2551,7 @@ nsAccessible::GetRelationByType(PRUint32 aRelationType,
case nsIAccessibleRelation::RELATION_DEFAULT_BUTTON:
{
if (content->IsNodeOfType(nsINode::eHTML)) {
if (content->IsHTML()) {
// HTML form controls implements nsIFormControl interface.
nsCOMPtr<nsIFormControl> control(do_QueryInterface(content));
if (control) {
@ -3098,10 +3098,10 @@ nsAccessible::GetNameInternal(nsAString& aName)
if (!content)
return NS_OK;
if (content->IsNodeOfType(nsINode::eHTML))
if (content->IsHTML())
return GetHTMLName(aName);
if (content->IsNodeOfType(nsINode::eXUL))
if (content->IsXUL())
return GetXULName(aName);
return NS_OK;

View File

@ -75,7 +75,7 @@ nsAccessibleTreeWalker::~nsAccessibleTreeWalker()
void nsAccessibleTreeWalker::GetKids(nsIDOMNode *aParentNode)
{
nsCOMPtr<nsIContent> parentContent(do_QueryInterface(aParentNode));
if (!parentContent || !parentContent->IsNodeOfType(nsINode::eHTML)) {
if (!parentContent || !parentContent->IsHTML()) {
mState.frame = nsnull; // Don't walk frames in non-HTML content, just walk the DOM.
}

View File

@ -760,7 +760,7 @@ nsCoreUtils::FindDescendantPointingToIDImpl(nsCString& aIdWithSpaces,
nsIContent*
nsCoreUtils::GetLabelContent(nsIContent *aForNode)
{
if (aForNode->IsNodeOfType(nsINode::eXUL))
if (aForNode->IsXUL())
return FindNeighbourPointingToNode(aForNode, nsAccessibilityAtoms::control,
nsAccessibilityAtoms::label);

View File

@ -219,7 +219,7 @@ nsTextEquivUtils::AppendTextEquivFromTextContent(nsIContent *aContent,
return NS_OK;
}
if (aContent->IsNodeOfType(nsINode::eHTML) &&
if (aContent->IsHTML() &&
aContent->NodeInfo()->Equals(nsAccessibilityAtoms::br)) {
aString->AppendLiteral("\r\n");
return NS_OK;
@ -393,7 +393,7 @@ nsTextEquivUtils::AppendFromDOMNode(nsIContent *aContent, nsAString *aString)
if (rv != NS_OK_NO_NAME_CLAUSE_HANDLED)
return NS_OK;
if (aContent->IsNodeOfType(nsINode::eXUL)) {
if (aContent->IsXUL()) {
nsAutoString textEquivalent;
nsCOMPtr<nsIDOMXULLabeledControlElement> labeledEl =
do_QueryInterface(aContent);

View File

@ -408,7 +408,7 @@ nsHTMLSelectListAccessible::CacheOptSiblings(nsIAccessibilityService *aAccServic
for (PRUint32 count = 0; count < numChildren; count ++) {
nsIContent *childContent = aParentContent->GetChildAt(count);
if (!childContent->IsNodeOfType(nsINode::eHTML)) {
if (!childContent->IsHTML()) {
continue;
}
nsCOMPtr<nsIAtom> tag = childContent->Tag();
@ -835,7 +835,7 @@ nsresult nsHTMLSelectOptionAccessible::GetFocusedOptionNode(nsIDOMNode *aListNod
void nsHTMLSelectOptionAccessible::SelectionChangedIfOption(nsIContent *aPossibleOption)
{
if (!aPossibleOption || aPossibleOption->Tag() != nsAccessibilityAtoms::option ||
!aPossibleOption->IsNodeOfType(nsINode::eHTML)) {
!aPossibleOption->IsHTML()) {
return;
}

View File

@ -633,7 +633,7 @@ nsresult nsHyperTextAccessible::DOMPointToHypertextOffset(nsIDOMNode* aNode, PRI
nsCOMPtr<nsIAccessible> descendantAccessible;
if (findNode) {
nsCOMPtr<nsIContent> findContent = do_QueryInterface(findNode);
if (findContent->IsNodeOfType(nsINode::eHTML) &&
if (findContent->IsHTML() &&
findContent->NodeInfo()->Equals(nsAccessibilityAtoms::br)) {
nsIContent *parent = findContent->GetParent();
if (parent &&

View File

@ -247,6 +247,26 @@ public:
return mNodeInfo;
}
inline PRBool IsInNamespace(PRInt32 aNamespace) const {
return mNodeInfo->NamespaceID() == aNamespace;
}
inline PRBool IsHTML() const {
return IsInNamespace(kNameSpaceID_XHTML);
}
inline PRBool IsSVG() const {
return IsInNamespace(kNameSpaceID_SVG);
}
inline PRBool IsXUL() const {
return IsInNamespace(kNameSpaceID_XUL);
}
inline PRBool IsMathML() const {
return IsInNamespace(kNameSpaceID_MathML);
}
/**
* Returns an atom holding the name of the attribute of type ID on
* this content node (if applicable). Returns null for non-element

View File

@ -293,28 +293,21 @@ public:
ePROCESSING_INSTRUCTION = 1 << 5,
/** comment nodes */
eCOMMENT = 1 << 6,
/** html elements */
eHTML = 1 << 7,
/** form control elements */
eHTML_FORM_CONTROL = 1 << 8,
eHTML_FORM_CONTROL = 1 << 7,
/** XUL elements */
eXUL = 1 << 9,
/** svg elements */
eSVG = 1 << 10,
/** document fragments */
eDOCUMENT_FRAGMENT = 1 << 11,
eDOCUMENT_FRAGMENT = 1 << 8,
/** data nodes (comments, PIs, text). Nodes of this type always
returns a non-null value for nsIContent::GetText() */
eDATA_NODE = 1 << 12,
/** nsMathMLElement */
eMATHML = 1 << 13,
eDATA_NODE = 1 << 9,
/** nsHTMLMediaElement */
eMEDIA = 1 << 14
eMEDIA = 1 << 10
};
/**
* API for doing a quick check if a content is of a given
* type, such as HTML, XUL, Text, ... Use this when you can instead of
* type, such as Text, Document, Comment ... Use this when you can instead of
* checking the tag.
*
* @param aFlags what types you want to test for (see above)

View File

@ -214,7 +214,7 @@ mozSanitizingHTMLSerializer::IsContainer(PRInt32 aId)
PRInt32
mozSanitizingHTMLSerializer::GetIdForContent(nsIContent* aContent)
{
if (!aContent->IsNodeOfType(nsINode::eHTML)) {
if (!aContent->IsHTML()) {
return eHTMLTag_unknown;
}

View File

@ -2092,7 +2092,7 @@ nsContentUtils::BelongsInForm(nsIDOMHTMLFormElement *aForm,
}
if (content->Tag() == nsGkAtoms::form &&
content->IsNodeOfType(nsINode::eHTML)) {
content->IsHTML()) {
// The child is contained within a form, but not the right form
// so we ignore it.

View File

@ -349,7 +349,7 @@ nsresult nsCopySupport::IsPlainTextContext(nsISelection *aSel, nsIDocument *aDoc
{
// checking for selection inside a plaintext form widget
if (!selContent->IsNodeOfType(nsINode::eHTML)) {
if (!selContent->IsHTML()) {
continue;
}

View File

@ -354,7 +354,7 @@ nsDOMAttributeMap::SetNamedItemInternal(nsIDOMNode *aNode,
iAttribute->SetMap(this);
if (!aWithNS && ni->NamespaceID() == kNameSpaceID_None &&
mContent->IsNodeOfType(nsINode::eHTML)) {
mContent->IsHTML()) {
// Set via setAttribute(), which may do normalization on the
// attribute name for HTML
nsCOMPtr<nsIDOMElement> ourElement(do_QueryInterface(mContent));

View File

@ -4825,7 +4825,7 @@ nsDocument::GetHtmlContent()
{
nsIContent* rootContent = GetRootContent();
if (rootContent && rootContent->Tag() == nsGkAtoms::html &&
rootContent->IsNodeOfType(nsINode::eHTML))
rootContent->IsHTML())
return rootContent;
return nsnull;
}
@ -4841,14 +4841,14 @@ nsDocument::GetHtmlChildContent(nsIAtom* aTag)
// forwards to find the first such element.
for (PRUint32 i = 0; i < html->GetChildCount(); ++i) {
nsIContent* result = html->GetChildAt(i);
if (result->Tag() == aTag && result->IsNodeOfType(nsINode::eHTML))
if (result->Tag() == aTag && result->IsHTML())
return result;
}
return nsnull;
}
nsIContent*
nsDocument::GetTitleContent(PRUint32 aNodeType)
nsDocument::GetTitleContent(PRUint32 aNamespace)
{
// mMayHaveTitleElement will have been set to true if any HTML or SVG
// <title> element has been bound to this document. So if it's false,
@ -4870,15 +4870,15 @@ nsDocument::GetTitleContent(PRUint32 aNodeType)
nsIContent* elem = list->Item(i, PR_FALSE);
if (!elem)
return nsnull;
if (elem->IsNodeOfType(aNodeType))
if (elem->IsInNamespace(aNamespace))
return elem;
}
}
void
nsDocument::GetTitleFromElement(PRUint32 aNodeType, nsAString& aTitle)
nsDocument::GetTitleFromElement(PRUint32 aNamespace, nsAString& aTitle)
{
nsIContent* title = GetTitleContent(aNodeType);
nsIContent* title = GetTitleContent(aNamespace);
if (!title)
return;
nsContentUtils::GetNodeTextContent(title, PR_FALSE, aTitle);
@ -4904,12 +4904,12 @@ nsDocument::GetTitle(nsAString& aTitle)
#ifdef MOZ_SVG
case kNameSpaceID_SVG:
if (rootContent->Tag() == nsGkAtoms::svg) {
GetTitleFromElement(nsINode::eSVG, tmp);
GetTitleFromElement(kNameSpaceID_SVG, tmp);
break;
} // else fall through
#endif
default:
GetTitleFromElement(nsINode::eHTML, tmp);
GetTitleFromElement(kNameSpaceID_XHTML, tmp);
break;
}
@ -4941,7 +4941,7 @@ nsDocument::SetTitle(const nsAString& aTitle)
// element" under us
mozAutoDocUpdate updateBatch(this, UPDATE_CONTENT_MODEL, PR_TRUE);
nsIContent* title = GetTitleContent(nsINode::eHTML);
nsIContent* title = GetTitleContent(kNameSpaceID_XHTML);
if (!title) {
nsIContent *head = GetHeadContent();
if (!head)
@ -5020,7 +5020,7 @@ nsDocument::GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult)
nsIDocument* doc = content->GetOwnerDoc();
NS_ENSURE_TRUE(doc == this, NS_ERROR_DOM_WRONG_DOCUMENT_ERR);
if (!mHasWarnedAboutBoxObjects && !content->IsNodeOfType(eXUL)) {
if (!mHasWarnedAboutBoxObjects && !content->IsXUL()) {
mHasWarnedAboutBoxObjects = PR_TRUE;
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
"UseOfGetBoxObjectForWarning",

View File

@ -400,7 +400,7 @@ AddTreeItemToTreeOwner(nsIDocShellTreeItem* aItem, nsIContent* aOwningContent,
nsAutoString value;
PRBool isContent = PR_FALSE;
if (aOwningContent->IsNodeOfType(nsINode::eXUL)) {
if (aOwningContent->IsXUL()) {
aOwningContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type, value);
}

View File

@ -338,7 +338,8 @@ nsINode::GetTextEditorRootContent(nsIEditor** aEditor)
if (aEditor)
*aEditor = nsnull;
for (nsINode* node = this; node; node = node->GetNodeParent()) {
if (!node->IsNodeOfType(eHTML))
if (!node->IsNodeOfType(eELEMENT) ||
!static_cast<nsIContent*>(node)->IsHTML())
continue;
nsCOMPtr<nsIEditor> editor;
@ -1144,7 +1145,7 @@ nsNSElementTearoff::GetScrollInfo(nsIScrollableView **aScrollableView,
*aScrollableView = nsnull;
// it isn't clear what to return for SVG nodes, so just return nothing
if (mContent->IsNodeOfType(nsINode::eSVG)) {
if (mContent->IsSVG()) {
if (aFrame)
*aFrame = nsnull;
return;
@ -1296,7 +1297,7 @@ nsNSElementTearoff::GetScrollHeight(PRInt32* aScrollHeight)
NS_ENSURE_ARG_POINTER(aScrollHeight);
*aScrollHeight = 0;
if (mContent->IsNodeOfType(nsINode::eSVG))
if (mContent->IsSVG())
return NS_OK;
nsIScrollableView *scrollView;
@ -1327,7 +1328,7 @@ nsNSElementTearoff::GetScrollWidth(PRInt32* aScrollWidth)
NS_ENSURE_ARG_POINTER(aScrollWidth);
*aScrollWidth = 0;
if (mContent->IsNodeOfType(nsINode::eSVG))
if (mContent->IsSVG())
return NS_OK;
nsIScrollableView *scrollView;
@ -1358,7 +1359,7 @@ nsNSElementTearoff::GetClientAreaRect()
nsIFrame *frame;
// it isn't clear what to return for SVG nodes, so just return 0
if (mContent->IsNodeOfType(nsINode::eSVG))
if (mContent->IsSVG())
return nsRect(0, 0, 0, 0);
GetScrollInfo(&scrollView, &frame);
@ -3949,7 +3950,7 @@ nsGenericElement::doReplaceOrInsertBefore(PRBool aReplace,
}
}
if (!newContent->IsNodeOfType(eXUL)) {
if (!newContent->IsXUL()) {
nsContentUtils::ReparentContentWrapper(newContent, aParent,
container->GetOwnerDoc(),
container->GetOwnerDoc());
@ -4008,7 +4009,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericElement)
NS_IMPL_CYCLE_COLLECTION_UNLINK_LISTENERMANAGER
NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA
if (tmp->HasProperties() && tmp->IsNodeOfType(nsINode::eXUL)) {
if (tmp->HasProperties() && tmp->IsXUL()) {
tmp->DeleteProperty(nsGkAtoms::contextmenulistener);
tmp->DeleteProperty(nsGkAtoms::popuplistener);
}
@ -4038,7 +4039,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericElement)
slots->mAttributeMap->DropReference();
slots->mAttributeMap = nsnull;
}
if (tmp->IsNodeOfType(nsINode::eXUL))
if (tmp->IsXUL())
NS_IF_RELEASE(slots->mControllers);
slots->mChildrenList = nsnull;
}
@ -4076,7 +4077,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGenericElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_LISTENERMANAGER
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_USERDATA
if (tmp->HasProperties() && tmp->IsNodeOfType(nsINode::eXUL)) {
if (tmp->HasProperties() && tmp->IsXUL()) {
nsISupports* property =
static_cast<nsISupports*>
(tmp->GetProperty(nsGkAtoms::contextmenulistener));
@ -4118,7 +4119,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGenericElement)
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "slots mAttributeMap");
cb.NoteXPCOMChild(slots->mAttributeMap.get());
if (tmp->IsNodeOfType(nsINode::eXUL))
if (tmp->IsXUL())
cb.NoteXPCOMChild(slots->mControllers);
cb.NoteXPCOMChild(
static_cast<nsIDOMNodeList*>(slots->mChildrenList.get()));

View File

@ -690,7 +690,7 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, PRBool aClone, PRBool aDeep,
// cloning, so kids of the new node aren't confused about whether they're
// in a document.
#ifdef MOZ_XUL
if (aClone && !aParent && aNode->IsNodeOfType(nsINode::eXUL)) {
if (aClone && !aParent && aNode->IsNodeOfType(nsINode::eELEMENT) && static_cast<nsIContent*>(aNode)->IsXUL()) {
nsXULElement *xulElem = static_cast<nsXULElement*>(elem);
if (!xulElem->mPrototype || xulElem->IsInDoc()) {
clone->SetFlags(NODE_FORCE_XBL_BINDINGS);

View File

@ -1788,7 +1788,7 @@ nsObjectLoadingContent::ShouldShowDefaultPlugin(nsIContent* aContent,
nsObjectLoadingContent::GetPluginSupportState(nsIContent* aContent,
const nsCString& aContentType)
{
if (!aContent->IsNodeOfType(nsINode::eHTML)) {
if (!aContent->IsHTML()) {
return ePluginOtherState;
}
@ -1805,7 +1805,7 @@ nsObjectLoadingContent::GetPluginSupportState(nsIContent* aContent,
nsIContent* child = aContent->GetChildAt(i);
NS_ASSERTION(child, "GetChildCount lied!");
if (child->IsNodeOfType(nsINode::eHTML) &&
if (child->IsHTML() &&
child->Tag() == nsGkAtoms::param) {
if (child->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
NS_LITERAL_STRING("pluginurl"), eIgnoreCase)) {

View File

@ -1853,7 +1853,7 @@ nsPlainTextSerializer::IsCurrentNodeConverted(const nsIParserNode* aNode)
PRInt32
nsPlainTextSerializer::GetIdForContent(nsIContent* aContent)
{
if (!aContent->IsNodeOfType(nsINode::eHTML)) {
if (!aContent->IsHTML()) {
return eHTMLTag_unknown;
}

View File

@ -145,23 +145,23 @@ nsScriptElement::ContentInserted(nsIDocument *aDocument,
}
static PRBool
InNonScriptingContainer(nsINode* aNode)
InNonScriptingContainer(nsIContent* aNode)
{
aNode = aNode->GetNodeParent();
aNode = aNode->GetParent();
while (aNode) {
// XXX noframes and noembed are currently unconditionally not
// displayed and processed. This might change if we support either
// prefs or per-document container settings for not allowing
// frames or plugins.
if (aNode->IsNodeOfType(nsINode::eHTML)) {
nsIAtom *localName = static_cast<nsIContent*>(aNode)->Tag();
if (aNode->IsHTML()) {
nsIAtom *localName = aNode->Tag();
if (localName == nsGkAtoms::iframe ||
localName == nsGkAtoms::noframes ||
localName == nsGkAtoms::noembed) {
return PR_TRUE;
}
}
aNode = aNode->GetNodeParent();
aNode = aNode->GetParent();
}
return PR_FALSE;

View File

@ -503,7 +503,7 @@ nsXHTMLContentSerializer::AfterElementStart(nsIContent * aContent,
PRUint32 i, childCount = aContent->GetChildCount();
for (i = 0; i < childCount; ++i) {
nsIContent* child = aContent->GetChildAt(i);
if (child->IsNodeOfType(nsINode::eHTML) &&
if (child->IsHTML() &&
child->Tag() == nsGkAtoms::meta &&
child->HasAttr(kNameSpaceID_None, nsGkAtoms::content)) {
nsAutoString header;

View File

@ -772,7 +772,7 @@ nsXMLContentSerializer::IsJavaScript(nsIContent * aContent, nsIAtom* aAttrNameAt
PRInt32 aAttrNamespaceID, const nsAString& aValueString)
{
PRInt32 namespaceID = aContent->GetNameSpaceID();
PRBool isHtml = aContent->IsNodeOfType(nsINode::eHTML);
PRBool isHtml = aContent->IsHTML();
if (aAttrNamespaceID == kNameSpaceID_None &&
(isHtml ||

View File

@ -141,7 +141,7 @@ nsContentEventHandler::Init(nsQueryContentEvent* aEvent)
// we don't want to include the bogus BRs at the end.
static PRBool IsContentBR(nsIContent* aContent)
{
return aContent->IsNodeOfType(nsINode::eHTML) &&
return aContent->IsHTML() &&
aContent->Tag() == nsGkAtoms::br &&
!aContent->AttrValueIs(kNameSpaceID_None,
nsGkAtoms::type,
@ -857,12 +857,12 @@ static void AdjustRangeForSelection(nsIContent* aRoot,
node = node->GetParent();
offset = node->IndexOf(*aNode) + (offset ? 1 : 0);
}
nsINode* brNode = node->GetChildAt(offset - 1);
while (brNode && brNode->IsNodeOfType(nsINode::eHTML)) {
nsIContent* brContent = static_cast<nsIContent*>(brNode);
nsIContent* brContent = node->GetChildAt(offset - 1);
while (brContent && brContent->IsHTML()) {
if (brContent->Tag() != nsGkAtoms::br || IsContentBR(brContent))
break;
brNode = node->GetChildAt(--offset - 1);
brContent = node->GetChildAt(--offset - 1);
}
*aNode = node;
*aOffset = PR_MAX(offset, 0);

View File

@ -1243,7 +1243,7 @@ IsAccessKeyTarget(nsIContent* aContent, nsIFrame* aFrame, nsAString& aKey)
nsCOMPtr<nsIDOMXULDocument> xulDoc =
do_QueryInterface(aContent->GetOwnerDoc());
if (!xulDoc && !aContent->IsNodeOfType(nsINode::eXUL))
if (!xulDoc && !aContent->IsXUL())
return PR_TRUE;
// For XUL we do visibility checks.
@ -1264,7 +1264,7 @@ IsAccessKeyTarget(nsIContent* aContent, nsIFrame* aFrame, nsAString& aKey)
if (control)
return PR_TRUE;
if (aContent->IsNodeOfType(nsINode::eHTML)) {
if (aContent->IsHTML()) {
nsIAtom* tag = aContent->Tag();
// HTML area, label and legend elements are never focusable, so
@ -1274,7 +1274,7 @@ IsAccessKeyTarget(nsIContent* aContent, nsIFrame* aFrame, nsAString& aKey)
tag == nsGkAtoms::legend)
return PR_TRUE;
} else if (aContent->IsNodeOfType(nsINode::eXUL)) {
} else if (aContent->IsXUL()) {
// XUL label elements are never focusable, so we need to check for them
// explicitly before giving up.
if (aContent->Tag() == nsGkAtoms::label)
@ -1557,7 +1557,7 @@ nsEventStateManager::FireContextClick()
nsIAtom *tag = mGestureDownContent->Tag();
PRBool allowedToDispatch = PR_TRUE;
if (mGestureDownContent->IsNodeOfType(nsINode::eXUL)) {
if (mGestureDownContent->IsXUL()) {
if (tag == nsGkAtoms::scrollbar ||
tag == nsGkAtoms::scrollbarbutton ||
tag == nsGkAtoms::button)
@ -1578,7 +1578,7 @@ nsEventStateManager::FireContextClick()
}
}
}
else if (mGestureDownContent->IsNodeOfType(nsINode::eHTML)) {
else if (mGestureDownContent->IsHTML()) {
nsCOMPtr<nsIFormControl> formCtrl(do_QueryInterface(mGestureDownContent));
if (formCtrl) {
@ -2207,7 +2207,7 @@ nsEventStateManager::DoScrollZoom(nsIFrame *aTargetFrame,
nsIContent *content = aTargetFrame->GetContent();
if (content &&
!content->IsNodeOfType(nsINode::eHTML_FORM_CONTROL) &&
!content->IsNodeOfType(nsINode::eXUL))
!content->IsXUL())
{
// positive adjustment to decrease zoom, negative to increase
PRInt32 change = (adjustment > 0) ? -1 : 1;

View File

@ -436,8 +436,8 @@ nsGenericHTMLElement::SetClassName(const nsAString& aClassName)
static PRBool
IsBody(nsIContent *aContent)
{
return (aContent->NodeInfo()->Equals(nsGkAtoms::body) &&
aContent->IsNodeOfType(nsINode::eHTML));
return aContent->NodeInfo()->Equals(nsGkAtoms::body) &&
aContent->IsHTML();
}
static PRBool IS_TABLE_CELL(nsIAtom* frameType) {
@ -752,14 +752,13 @@ nsGenericHTMLElement::GetSpellcheck(PRBool* aSpellcheck)
*aSpellcheck = PR_FALSE; // Default answer is to not spellcheck
// Has the state has been explicitly set?
nsINode* node;
for (node = this; node; node = node->GetNodeParent()) {
if (node->IsNodeOfType(nsINode::eHTML)) {
nsIContent* node;
for (node = this; node; node = node->GetParent()) {
if (node->IsHTML()) {
static nsIContent::AttrValuesArray strings[] =
{&nsGkAtoms::_true, &nsGkAtoms::_false, nsnull};
switch (static_cast<nsIContent*>(node)->
FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::spellcheck,
strings, eCaseMatters)) {
switch (node->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::spellcheck,
strings, eCaseMatters)) {
case 0: // spellcheck = "true"
*aSpellcheck = PR_TRUE;
// Fall through
@ -906,7 +905,7 @@ nsGenericHTMLElement::FindForm(nsIForm* aCurrentForm)
while (content != bindingParent && content) {
// If the current ancestor is a form, return it as our form
if (content->Tag() == nsGkAtoms::form &&
content->IsNodeOfType(nsINode::eHTML)) {
content->IsHTML()) {
#ifdef DEBUG
if (!nsContentUtils::IsInSameAnonymousTree(this, content)) {
// It's possible that we started unbinding at |content| or
@ -959,7 +958,7 @@ static PRBool
IsArea(nsIContent *aContent)
{
return (aContent->Tag() == nsGkAtoms::area &&
aContent->IsNodeOfType(nsINode::eHTML));
aContent->IsHTML());
}
PRBool
@ -1211,7 +1210,7 @@ nsGenericHTMLElement::GetBaseTarget(nsAString& aBaseTarget) const
PRBool
nsGenericHTMLElement::IsNodeOfType(PRUint32 aFlags) const
{
return !(aFlags & ~(eCONTENT | eELEMENT | eHTML));
return !(aFlags & ~(eCONTENT | eELEMENT));
}
//----------------------------------------------------------------------
@ -2293,7 +2292,7 @@ NS_IMPL_QUERY_INTERFACE_INHERITED1(nsGenericHTMLFormElement,
PRBool
nsGenericHTMLFormElement::IsNodeOfType(PRUint32 aFlags) const
{
return !(aFlags & ~(eCONTENT | eELEMENT | eHTML | eHTML_FORM_CONTROL));
return !(aFlags & ~(eCONTENT | eELEMENT | eHTML_FORM_CONTROL));
}
void

View File

@ -79,7 +79,7 @@ public:
/** Typesafe, non-refcounting cast from nsIContent. Cheaper than QI. **/
static nsGenericHTMLElement* FromContent(nsIContent *aContent)
{
if (aContent->IsNodeOfType(eHTML))
if (aContent->IsHTML())
return static_cast<nsGenericHTMLElement*>(aContent);
return nsnull;
}

View File

@ -436,7 +436,7 @@ static PRBool HasSourceChildren(nsIContent *aElement)
NS_ASSERTION(child, "GetChildCount lied!");
if (child &&
child->Tag() == nsGkAtoms::source &&
child->IsNodeOfType(nsINode::eHTML))
child->IsHTML())
{
return PR_TRUE;
}
@ -1626,7 +1626,7 @@ void nsHTMLMediaElement::Thaw()
PRBool
nsHTMLMediaElement::IsNodeOfType(PRUint32 aFlags) const
{
return !(aFlags & ~(eCONTENT | eELEMENT | eHTML | eMEDIA));
return !(aFlags & ~(eCONTENT | eELEMENT | eMEDIA));
}
void nsHTMLMediaElement::NotifyAddedSource()
@ -1679,7 +1679,7 @@ already_AddRefed<nsIURI> nsHTMLMediaElement::GetNextSource()
// If child is a <source> element, it may be the next candidate.
if (child &&
child->Tag() == nsGkAtoms::source &&
child->IsNodeOfType(nsINode::eHTML))
child->IsHTML())
{
nsCOMPtr<nsIURI> uri;
nsAutoString src,type;

View File

@ -158,8 +158,7 @@ nsIContent*
nsHTMLOptGroupElement::GetSelect()
{
nsIContent* parent = this;
while ((parent = parent->GetParent()) &&
parent->IsNodeOfType(eHTML)) {
while ((parent = parent->GetParent()) && parent->IsHTML()) {
if (parent->Tag() == nsGkAtoms::select) {
return parent;
}

View File

@ -442,7 +442,7 @@ nsHTMLOptionElement::GetSelect()
{
nsIContent* parent = this;
while ((parent = parent->GetParent()) &&
parent->IsNodeOfType(eHTML)) {
parent->IsHTML()) {
if (parent->Tag() == nsGkAtoms::select) {
return parent;
}

View File

@ -331,7 +331,7 @@ nsHTMLSelectElement::RemoveOptionsFromList(nsIContent* aOptions,
static PRBool IsOptGroup(nsIContent *aContent)
{
return (aContent->NodeInfo()->Equals(nsGkAtoms::optgroup) &&
aContent->IsNodeOfType(nsINode::eHTML));
aContent->IsHTML());
}
// If the document is such that recursing over these options gets us

View File

@ -140,7 +140,7 @@ nsHTMLTableCellElement::GetTable()
if (parent) { // GetParent() should be a row
nsIContent* section = parent->GetParent();
if (section) {
if (section->IsNodeOfType(eHTML) &&
if (section->IsHTML() &&
section->NodeInfo()->Equals(nsGkAtoms::table)) {
// XHTML, without a row group
result = section;

View File

@ -237,7 +237,7 @@ IsCell(nsIContent *aContent, PRInt32 aNamespaceID,
nsIAtom* tag = aContent->Tag();
return ((tag == nsGkAtoms::td || tag == nsGkAtoms::th) &&
aContent->IsNodeOfType(nsINode::eHTML));
aContent->IsHTML());
}
NS_IMETHODIMP

View File

@ -1592,7 +1592,7 @@ nsHTMLDocument::SetBody(nsIDOMHTMLElement* aBody)
// body.
if (!newBody || !(newBody->Tag() == nsGkAtoms::body ||
newBody->Tag() == nsGkAtoms::frameset) ||
!root || !root->IsNodeOfType(nsINode::eHTML) ||
!root || !root->IsHTML() ||
root->Tag() != nsGkAtoms::html) {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
}
@ -2824,7 +2824,7 @@ nsHTMLDocument::ResolveName(const nsAString& aName,
nsIContent *e = entry->GetIdContent();
if (e && e->IsNodeOfType(nsINode::eHTML)) {
if (e && e->IsHTML()) {
nsIAtom *tag = e->Tag();
if ((tag == nsGkAtoms::embed ||

View File

@ -410,7 +410,7 @@ nsMathMLElement::IntrinsicState() const
PRBool
nsMathMLElement::IsNodeOfType(PRUint32 aFlags) const
{
return !(aFlags & ~(eCONTENT | eELEMENT | eMATHML));
return !(aFlags & ~(eCONTENT | eELEMENT));
}
void

View File

@ -699,7 +699,7 @@ nsSVGElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRBool
nsSVGElement::IsNodeOfType(PRUint32 aFlags) const
{
return !(aFlags & ~(eCONTENT | eELEMENT | eSVG));
return !(aFlags & ~(eCONTENT | eELEMENT));
}
already_AddRefed<nsIURI>

View File

@ -289,7 +289,7 @@ float
nsSVGLength2::GetUnitScaleFactor(nsIFrame *aFrame, PRUint8 aUnitType) const
{
nsIContent* content = aFrame->GetContent();
if (content->IsNodeOfType(nsINode::eSVG))
if (content->IsSVG())
return GetUnitScaleFactor(static_cast<nsSVGElement*>(content), aUnitType);
switch (aUnitType) {

View File

@ -899,7 +899,7 @@ nsresult
nsXBLContentSink::AddAttributes(const PRUnichar** aAtts,
nsIContent* aContent)
{
if (aContent->IsNodeOfType(nsINode::eXUL))
if (aContent->IsXUL())
return NS_OK; // Nothing to do, since the proto already has the attrs.
return nsXMLContentSink::AddAttributes(aAtts, aContent);

View File

@ -481,8 +481,7 @@ nsXBLPrototypeHandler::DispatchXBLCommand(nsPIDOMEventTarget* aTarget, nsIDOMEve
// element is focused and has a parent.
if (focusedContent && focusedContent->GetParent()) {
while (content) {
if (content->Tag() == nsGkAtoms::a &&
content->IsNodeOfType(nsINode::eHTML)) {
if (content->Tag() == nsGkAtoms::a && content->IsHTML()) {
isLink = PR_TRUE;
break;
}

View File

@ -1172,8 +1172,7 @@ nsXBLService::LoadBindingDocumentInfo(nsIContent* aBoundElement,
ni->Equals(nsGkAtoms::thumb, kNameSpaceID_XUL) ||
((ni->Equals(nsGkAtoms::input) ||
ni->Equals(nsGkAtoms::select)) &&
aBoundElement->IsNodeOfType(nsINode::eHTML)))) &&
!aForceSyncLoad) {
aBoundElement->IsHTML()))) && !aForceSyncLoad) {
// The third line of defense is to investigate whether or not the
// document is currently being loaded asynchronously. If so, there's no
// document yet, but we need to glom on our request so that it will be

View File

@ -437,13 +437,6 @@ txXPathNodeUtils::getLocalName(const txXPathNode& aNode, nsAString& aLocalName)
if (aNode.mNode->IsNodeOfType(nsINode::eELEMENT)) {
nsINodeInfo* nodeInfo = aNode.Content()->NodeInfo();
nodeInfo->GetLocalName(aLocalName);
// Check for html
if (nodeInfo->NamespaceEquals(kNameSpaceID_None) &&
aNode.mNode->IsNodeOfType(nsINode::eHTML)) {
ToUpperCase(aLocalName);
}
return;
}
@ -465,7 +458,7 @@ txXPathNodeUtils::getLocalName(const txXPathNode& aNode, nsAString& aLocalName)
// Check for html
if (aNode.Content()->NodeInfo()->NamespaceEquals(kNameSpaceID_None) &&
aNode.Content()->IsNodeOfType(nsINode::eHTML)) {
aNode.Content()->IsHTML()) {
ToUpperCase(aLocalName);
}
}
@ -486,11 +479,9 @@ txXPathNodeUtils::getNodeName(const txXPathNode& aNode, nsAString& aName)
nodeInfo->GetQualifiedName(aName);
// Check for html
if (nodeInfo->NamespaceEquals(kNameSpaceID_None) &&
aNode.Content()->IsNodeOfType(nsINode::eHTML)) {
if (aNode.Content()->IsHTML()) {
ToUpperCase(aName);
}
return;
}
@ -510,8 +501,7 @@ txXPathNodeUtils::getNodeName(const txXPathNode& aNode, nsAString& aName)
aNode.Content()->GetAttrNameAt(aNode.mIndex)->GetQualifiedName(aName);
// Check for html
if (aNode.Content()->NodeInfo()->NamespaceEquals(kNameSpaceID_None) &&
aNode.Content()->IsNodeOfType(nsINode::eHTML)) {
if (aNode.Content()->IsHTML()) {
ToUpperCase(aName);
}
}

View File

@ -150,7 +150,7 @@ public:
return PR_FALSE;
}
nsIContent* content = aNode.Content();
return content->IsNodeOfType(nsINode::eHTML) && content->IsInHTMLDocument();
return content->IsHTML() && content->IsInHTMLDocument();
}
#else
private:

View File

@ -308,14 +308,14 @@ txMozillaXMLOutput::endElement()
// Handle html-elements
if (!mNoFixup) {
if (element->IsNodeOfType(nsINode::eHTML)) {
if (element->IsHTML()) {
rv = endHTMLElement(element);
NS_ENSURE_SUCCESS(rv, rv);
}
// Handle script elements
if (element->Tag() == nsGkAtoms::script &&
(element->IsNodeOfType(nsINode::eHTML) ||
(element->IsHTML() ||
element->GetNameSpaceID() == kNameSpaceID_SVG)) {
rv = element->DoneAddingChildren(PR_TRUE);

View File

@ -2152,7 +2152,7 @@ nsXULElement::GetBindingParent() const
PRBool
nsXULElement::IsNodeOfType(PRUint32 aFlags) const
{
return !(aFlags & ~(eCONTENT | eELEMENT | eXUL));
return !(aFlags & ~(eCONTENT | eELEMENT));
}
static void

View File

@ -476,7 +476,7 @@ public:
/** Typesafe, non-refcounting cast from nsIContent. Cheaper than QI. **/
static nsXULElement* FromContent(nsIContent *aContent)
{
if (aContent->IsNodeOfType(eXUL))
if (aContent->IsXUL())
return static_cast<nsXULElement*>(aContent);
return nsnull;
}

View File

@ -1302,7 +1302,7 @@ PRBool
nsXULContentBuilder::IsOpen(nsIContent* aElement)
{
// Determine if this is a <treeitem> or <menu> element
if (!aElement->IsNodeOfType(nsINode::eXUL))
if (!aElement->IsXUL())
return PR_TRUE;
// XXXhyatt Use the XBL service to obtain a base tag.

View File

@ -112,7 +112,7 @@ XULSortServiceImpl::SetSortColumnHints(nsIContent *content,
for (PRUint32 childIndex = 0; childIndex < numChildren; ++childIndex) {
nsIContent *child = content->GetChildAt(childIndex);
if (child->IsNodeOfType(nsINode::eXUL)) {
if (child->IsXUL()) {
nsIAtom *tag = child->Tag();
if (tag == nsGkAtoms::treecols) {

View File

@ -1249,7 +1249,7 @@ nsXULTemplateBuilder::LoadDataSources(nsIDocument* aDocument,
if (xuldoc)
xuldoc->SetTemplateBuilderFor(mRoot, this);
if (!mRoot->IsNodeOfType(nsINode::eXUL)) {
if (!mRoot->IsXUL()) {
// Hmm. This must be an HTML element. Try to set it as a
// JS property "by hand".
InitHTMLTemplateRoot();

View File

@ -356,7 +356,7 @@ ForEachPing(nsIContent *content, ForEachPingCallback callback, void *closure)
// Make sure we are dealing with either an <A> or <AREA> element in the HTML
// or XHTML namespace.
if (!content->IsNodeOfType(nsINode::eHTML))
if (!content->IsHTML())
return;
nsIAtom *nameAtom = content->Tag();
if (!nameAtom->EqualsUTF8(NS_LITERAL_CSTRING("a")) &&

View File

@ -7000,7 +7000,8 @@ nsNodeSH::PreCreate(nsISupports *nativeObj, JSContext *cx, JSObject *globalObj,
nsISupports *native_parent;
PRBool slimWrappers = PR_TRUE;
if (node->IsNodeOfType(nsINode::eELEMENT | nsINode::eXUL)) {
PRBool nodeIsElement = node->IsNodeOfType(nsINode::eELEMENT);
if (nodeIsElement && static_cast<nsIContent*>(node)->IsXUL()) {
// For XUL elements, use the parent, if any.
native_parent = node->GetParent();
@ -7016,9 +7017,8 @@ nsNodeSH::PreCreate(nsISupports *nativeObj, JSContext *cx, JSObject *globalObj,
native_parent = doc;
// But for HTML form controls, use the form as scope parent.
if (node->IsNodeOfType(nsINode::eELEMENT |
nsIContent::eHTML |
nsIContent::eHTML_FORM_CONTROL)) {
if (nodeIsElement &&
node->IsNodeOfType(nsINode::eHTML_FORM_CONTROL)) {
nsCOMPtr<nsIFormControl> form_control(do_QueryInterface(node));
if (form_control) {

View File

@ -265,7 +265,7 @@ nsIContent*
nsFocusManager::GetRedirectedFocus(nsIContent* aContent)
{
#ifdef MOZ_XUL
if (aContent->IsNodeOfType(nsINode::eXUL)) {
if (aContent->IsXUL()) {
nsCOMPtr<nsIDOMNode> inputField;
nsCOMPtr<nsIDOMXULTextBoxElement> textbox = do_QueryInterface(aContent);
@ -1254,7 +1254,7 @@ nsFocusManager::CheckIfFocusable(nsIContent* aContent, PRUint32 aFlags)
if (!frame)
return nsnull;
if (aContent->Tag() == nsGkAtoms::area && aContent->IsNodeOfType(nsINode::eHTML)) {
if (aContent->Tag() == nsGkAtoms::area && aContent->IsHTML()) {
// HTML areas do not have their own frame, and the img frame we get from
// GetPrimaryFrameFor() is not relevant as to whether it is focusable or
// not, so we have to do all the relevant checks manually for them.
@ -2074,7 +2074,7 @@ nsFocusManager::DetermineElementToMoveFocus(nsPIDOMWindow* aWindow,
if (startContent) {
nsIFrame* frame = presShell->GetPrimaryFrameFor(startContent);
if (startContent->Tag() == nsGkAtoms::area &&
startContent->IsNodeOfType(nsINode::eHTML))
startContent->IsHTML())
startContent->IsFocusable(&tabIndex);
else if (frame)
frame->IsFocusable(&tabIndex, 0);
@ -2354,7 +2354,7 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
frameTraversal->Last();
}
else if (!aStartContent || aStartContent->Tag() != nsGkAtoms::area ||
!aStartContent->IsNodeOfType(nsINode::eHTML)) {
!aStartContent->IsHTML()) {
// Need to do special check in case we're in an imagemap which has multiple
// content nodes per frame, so don't skip over the starting frame.
if (aForward)
@ -2638,7 +2638,7 @@ nsFocusManager::GetRootForFocus(nsPIDOMWindow* aWindow,
for (PRUint32 i = 0; i < childCount; ++i) {
nsIContent *childContent = rootContent->GetChildAt(i);
nsINodeInfo *ni = childContent->NodeInfo();
if (childContent->IsNodeOfType(nsINode::eHTML) &&
if (childContent->IsHTML() &&
ni->Equals(nsGkAtoms::frameset))
return nsnull;
}

View File

@ -789,7 +789,7 @@ nsFind::NextNode(nsIDOMRange* aSearchRange,
PRBool nsFind::IsBlockNode(nsIContent* aContent)
{
if (!aContent->IsNodeOfType(nsINode::eHTML)) {
if (!aContent->IsHTML()) {
return PR_FALSE;
}
@ -854,7 +854,7 @@ PRBool nsFind::SkipNode(nsIContent* aContent)
// We may not need to skip comment nodes,
// now that IsTextNode distinguishes them from real text nodes.
return (aContent->IsNodeOfType(nsINode::eCOMMENT) ||
(aContent->IsNodeOfType(nsINode::eHTML) &&
(aContent->IsHTML() &&
(atom == sScriptAtom ||
atom == sNoframesAtom ||
atom == sSelectAtom)));
@ -871,7 +871,7 @@ PRBool nsFind::SkipNode(nsIContent* aContent)
atom = content->Tag();
if (aContent->IsNodeOfType(nsINode::eCOMMENT) ||
(content->IsNodeOfType(nsINode::eHTML) &&
(content->IsHTML() &&
(atom == sScriptAtom ||
atom == sNoframesAtom ||
atom == sSelectAtom)))

View File

@ -1798,7 +1798,7 @@ nsCSSFrameConstructor::CreateGeneratedContent(nsFrameConstructorState& aState,
return content.forget();
}
if (aParentContent->IsNodeOfType(nsINode::eHTML) &&
if (aParentContent->IsHTML() &&
aParentContent->NodeInfo()->Equals(nsGkAtoms::input)) {
if (aParentContent->HasAttr(kNameSpaceID_None, nsGkAtoms::value)) {
nsCOMPtr<nsIContent> content;
@ -2407,7 +2407,7 @@ nsCSSFrameConstructor::PropagateScrollToViewport()
// of the viewport
// XXX what about XHTML?
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc(do_QueryInterface(mDocument));
if (!htmlDoc || !docElement->IsNodeOfType(nsINode::eHTML)) {
if (!htmlDoc || !docElement->IsHTML()) {
return nsnull;
}
@ -2540,7 +2540,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIContent* aDocEle
// Check whether we need to build a XUL box or SVG root frame
#ifdef MOZ_XUL
if (aDocElement->IsNodeOfType(nsINode::eXUL)) {
if (aDocElement->IsXUL()) {
contentFrame = NS_NewDocElementBoxFrame(mPresShell, styleContext);
if (NS_UNLIKELY(!contentFrame)) {
return NS_ERROR_OUT_OF_MEMORY;
@ -2799,7 +2799,7 @@ nsCSSFrameConstructor::SetUpDocElementContainingBlock(nsIContent* aDocElement)
if (!isPaginated) {
#ifdef MOZ_XUL
if (aDocElement->IsNodeOfType(nsINode::eXUL))
if (aDocElement->IsXUL())
{
// pass a temporary stylecontext, the correct one will be set later
rootFrame = NS_NewRootBoxFrame(mPresShell, viewportPseudoStyle);
@ -2838,11 +2838,11 @@ nsCSSFrameConstructor::SetUpDocElementContainingBlock(nsIContent* aDocElement)
// 3) nsIScrollable::Scrollbar_Always = scrollbars always
// Only need to create a scroll frame/view for cases 2 and 3.
PRBool isHTML = aDocElement->IsNodeOfType(nsINode::eHTML);
PRBool isHTML = aDocElement->IsHTML();
PRBool isXUL = PR_FALSE;
if (!isHTML) {
isXUL = aDocElement->IsNodeOfType(nsINode::eXUL);
isXUL = aDocElement->IsXUL();
}
// Never create scrollbars for XUL documents
@ -3656,7 +3656,7 @@ nsCSSFrameConstructor::FindHTMLData(nsIContent* aContent,
// Ignore the tag if it's not HTML content and if it doesn't extend (via XBL)
// a valid HTML namespace. This check must match the one in
// ShouldHaveFirstLineStyle.
if (!aContent->IsNodeOfType(nsINode::eHTML) &&
if (!aContent->IsHTML() &&
aNameSpaceID != kNameSpaceID_XHTML) {
return nsnull;
}
@ -4496,7 +4496,7 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay,
// make this function static.
PRBool propagatedScrollToViewport = PR_FALSE;
if (aContent->NodeInfo()->Equals(nsGkAtoms::body) &&
aContent->IsNodeOfType(nsINode::eHTML)) {
aContent->IsHTML()) {
propagatedScrollToViewport =
PropagateScrollToViewport() == aContent;
}
@ -6064,7 +6064,7 @@ static PRBool
IsSpecialFramesetChild(nsIContent* aContent)
{
// IMPORTANT: This must match the conditions in nsHTMLFramesetFrame::Init.
return aContent->IsNodeOfType(nsINode::eHTML) &&
return aContent->IsHTML() &&
(aContent->Tag() == nsGkAtoms::frameset ||
aContent->Tag() == nsGkAtoms::frame);
}
@ -6081,8 +6081,8 @@ MaybeGetListBoxBodyFrame(nsIContent* aContainer, nsIContent* aChild)
if (!aContainer)
return nsnull;
if (aContainer->IsNodeOfType(nsINode::eXUL) &&
aChild->IsNodeOfType(nsINode::eXUL) &&
if (aContainer->IsXUL() &&
aChild->IsXUL() &&
aContainer->Tag() == nsGkAtoms::listbox &&
aChild->Tag() == nsGkAtoms::listitem) {
nsCOMPtr<nsIDOMXULElement> xulElement = do_QueryInterface(aContainer);
@ -7556,7 +7556,7 @@ InvalidateCanvasIfNeeded(nsIPresShell* presShell, nsIContent* node)
// Check whether it's an HTML body
if (node->Tag() != nsGkAtoms::body ||
!node->IsNodeOfType(nsINode::eHTML)) {
!node->IsHTML()) {
return;
}
}
@ -8833,7 +8833,7 @@ nsCSSFrameConstructor::GetInsertionPoint(nsIFrame* aParentFrame,
// have to look at insertionElement here...
if (aMultiple && !*aMultiple) {
nsIContent* content = insertionElement ? insertionElement : container;
if (content->IsNodeOfType(nsINode::eHTML) &&
if (content->IsHTML() &&
content->Tag() == nsGkAtoms::fieldset) {
*aMultiple = PR_TRUE;
}
@ -9194,7 +9194,7 @@ nsCSSFrameConstructor::ShouldHaveFirstLineStyle(nsIContent* aContent,
// This check must match the one in FindHTMLData.
hasFirstLine = tag != nsGkAtoms::fieldset ||
(namespaceID != kNameSpaceID_XHTML &&
!aContent->IsNodeOfType(nsINode::eHTML));
!aContent->IsHTML());
}
return hasFirstLine;

View File

@ -1424,7 +1424,7 @@ public:
nsIContent* root = aContent->GetCurrentDoc()->GetRootContent();
while (aContent && aContent->IsInNativeAnonymousSubtree()) {
nsIContent* parent = aContent->GetParent();
if (parent == root && aContent->IsNodeOfType(nsINode::eXUL)) {
if (parent == root && aContent->IsXUL()) {
nsIAtom* tag = aContent->Tag();
return tag == nsGkAtoms::scrollbar || tag == nsGkAtoms::scrollcorner;
}
@ -3744,7 +3744,7 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, PRBool aScroll)
content = do_QueryInterface(node);
if (content) {
if (content->Tag() == nsGkAtoms::a &&
content->IsNodeOfType(nsINode::eHTML)) {
content->IsHTML()) {
break;
}
content = nsnull;

View File

@ -433,14 +433,14 @@ static inline PRBool
IsOptGroup(nsIContent *aContent)
{
return (aContent->NodeInfo()->Equals(nsGkAtoms::optgroup) &&
aContent->IsNodeOfType(nsINode::eHTML));
aContent->IsHTML());
}
static inline PRBool
IsOption(nsIContent *aContent)
{
return (aContent->NodeInfo()->Equals(nsGkAtoms::option) &&
aContent->IsNodeOfType(nsINode::eHTML));
aContent->IsHTML());
}
static PRUint32

View File

@ -165,7 +165,7 @@ GetWrapPropertyEnum(nsIContent* aContent, nsHTMLTextWrap& aWrapProp)
aWrapProp = eHTMLTextWrap_Soft; // the default
nsAutoString wrap;
if (aContent->IsNodeOfType(nsINode::eHTML)) {
if (aContent->IsHTML()) {
static nsIContent::AttrValuesArray strings[] =
{&nsGkAtoms::HARD, &nsGkAtoms::OFF, nsnull};

View File

@ -6552,7 +6552,7 @@ PRBool
nsBlockFrame::FrameStartsCounterScope(nsIFrame* aFrame)
{
nsIContent* content = aFrame->GetContent();
if (!content || !content->IsNodeOfType(nsINode::eHTML))
if (!content || !content->IsHTML())
return PR_FALSE;
nsIAtom *localName = content->NodeInfo()->NameAtom();

View File

@ -516,7 +516,7 @@ nsContainerFrame::SyncWindowProperties(nsPresContext* aPresContext,
return;
nsIContent* rootContent = aPresContext->Document()->GetRootContent();
if (!rootContent || !rootContent->IsNodeOfType(nsINode::eXUL)) {
if (!rootContent || !rootContent->IsXUL()) {
// Scrollframes use native widgets which don't work well with
// translucent windows, at least in Windows XP. So if the document
// has a root scrollrame it's useless to try to make it transparent,

View File

@ -6047,7 +6047,7 @@ nsIFrame::IsFocusable(PRInt32 *aTabIndex, PRBool aWithMouse)
isFocusable = mContent->IsFocusable(&tabIndex);
if (!isFocusable && !aWithMouse &&
GetType() == nsGkAtoms::scrollFrame &&
mContent->IsNodeOfType(nsINode::eHTML) &&
mContent->IsHTML() &&
!mContent->IsRootOfNativeAnonymousSubtree() &&
mContent->GetParent() &&
!mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::tabindex)) {

View File

@ -394,7 +394,7 @@ nsSubDocumentFrame::GetIntrinsicWidth()
return 0; // HTML <frame> has no useful intrinsic width
}
if (mContent->IsNodeOfType(nsINode::eXUL)) {
if (mContent->IsXUL()) {
return 0; // XUL <iframe> and <browser> have no useful intrinsic width
}
@ -412,7 +412,7 @@ nsSubDocumentFrame::GetIntrinsicHeight()
// <frame> processing does not use this routine, only <iframe>
NS_ASSERTION(IsInline(), "Shouldn't have been called");
if (mContent->IsNodeOfType(nsINode::eXUL)) {
if (mContent->IsXUL()) {
return 0;
}
@ -685,7 +685,7 @@ nsSubDocumentFrame::AttributeChanged(PRInt32 aNameSpaceID,
if (!mFrameLoader)
return NS_OK;
if (!mContent->IsNodeOfType(nsINode::eXUL)) {
if (!mContent->IsXUL()) {
return NS_OK;
}

View File

@ -383,7 +383,7 @@ nsHTMLFramesetFrame::Init(nsIContent* aContent,
// IMPORTANT: This must match the conditions in
// nsCSSFrameConstructor::ContentAppended/Inserted/Removed
if (!child->IsNodeOfType(nsINode::eHTML))
if (!child->IsHTML())
continue;
nsIAtom *tag = child->Tag();
@ -736,7 +736,7 @@ nsHTMLFramesetFrame* nsHTMLFramesetFrame::GetFramesetParent(nsIFrame* aChild)
if (content) {
nsCOMPtr<nsIContent> contentParent = content->GetParent();
if (contentParent && contentParent->IsNodeOfType(nsINode::eHTML) &&
if (contentParent && contentParent->IsHTML() &&
contentParent->Tag() == nsGkAtoms::frameset) {
nsIFrame* fptr = aChild->GetParent();
parent = (nsHTMLFramesetFrame*) fptr;
@ -1393,7 +1393,7 @@ nsHTMLFramesetFrame::RecalculateBorderResize()
for (childIndex = 0; childIndex < numChildren; childIndex++) {
nsIContent *child = mContent->GetChildAt(childIndex);
if (child->IsNodeOfType(nsINode::eHTML)) {
if (child->IsHTML()) {
nsINodeInfo *ni = child->NodeInfo();
if (ni->Equals(nsGkAtoms::frameset)) {

View File

@ -806,7 +806,7 @@ nsImageMap::SearchForAreas(nsIContent* aParent, PRBool& aFoundArea,
for (i = 0; i < n; i++) {
nsIContent *child = aParent->GetChildAt(i);
if (child->IsNodeOfType(nsINode::eHTML)) {
if (child->IsHTML()) {
// If we haven't determined that the map element contains an
// <a> element yet, then look for <area>.
if (!aFoundAnchor && child->Tag() == nsGkAtoms::area) {
@ -957,7 +957,7 @@ nsImageMap::AttributeChanged(nsIDocument* aDocument,
// are the only cases we care about.
if ((aContent->NodeInfo()->Equals(nsGkAtoms::area) ||
aContent->NodeInfo()->Equals(nsGkAtoms::a)) &&
aContent->IsNodeOfType(nsINode::eHTML) &&
aContent->IsHTML() &&
aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::shape ||
aAttribute == nsGkAtoms::coords)) {

View File

@ -859,7 +859,7 @@ NS_IMETHODIMP nsInlineFrame::GetAccessible(nsIAccessible** aAccessible)
*aAccessible = nsnull;
nsIAtom *tagAtom = mContent->Tag();
if ((tagAtom == nsGkAtoms::img || tagAtom == nsGkAtoms::input ||
tagAtom == nsGkAtoms::label) && mContent->IsNodeOfType(nsINode::eHTML)) {
tagAtom == nsGkAtoms::label) && mContent->IsHTML()) {
// Only get accessibility service if we're going to use it
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
if (!accService)

View File

@ -3254,7 +3254,7 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays()
// source order, while in XML and XHTML it's the same as the source order
// (see the AddAttributes functions in the HTML and XML content sinks).
PRInt16 start, end, increment;
if (mContent->IsNodeOfType(nsINode::eHTML) &&
if (mContent->IsHTML() &&
mContent->IsInHTMLDocument()) {
// HTML. Walk attributes in reverse order.
start = numRealAttrs - 1;

View File

@ -2367,7 +2367,7 @@ static PRBool IsCell(nsIContent *aContent)
{
return ((aContent->Tag() == nsGkAtoms::td ||
aContent->Tag() == nsGkAtoms::th) &&
aContent->IsNodeOfType(nsINode::eHTML));
aContent->IsHTML());
}
nsITableCellLayout*
@ -3075,7 +3075,7 @@ nsFrameSelection::GetParentTable(nsIContent *aCell) const
for (nsIContent* parent = aCell->GetParent(); parent;
parent = parent->GetParent()) {
if (parent->Tag() == nsGkAtoms::table &&
parent->IsNodeOfType(nsINode::eHTML)) {
parent->IsHTML()) {
return parent;
}
}
@ -3213,13 +3213,14 @@ nsTypedSelection::GetTableSelectionType(nsIRange* aRange,
if ((endOffset - startOffset) != 1)
return NS_OK;
if (!startNode->IsNodeOfType(nsINode::eHTML)) {
nsIContent* startContent = static_cast<nsIContent*>(startNode);
if (!(startNode->IsNodeOfType(nsINode::eELEMENT) && startContent->IsHTML())) {
// Implies a check for being an element; if we ever make this work
// for non-HTML, need to keep checking for elements.
return NS_OK;
}
nsIAtom *tag = static_cast<nsIContent*>(startNode)->Tag();
nsIAtom *tag = startContent->Tag();
if (tag == nsGkAtoms::tr)
{

View File

@ -1344,7 +1344,7 @@ nsMathMLContainerFrame::SetIncrementScriptLevel(PRInt32 aChildIndex, PRBool aInc
if (!child)
return;
nsIContent* content = child->GetContent();
if (!content->IsNodeOfType(nsINode::eMATHML))
if (!content->IsMathML())
return;
nsMathMLElement* element = static_cast<nsMathMLElement*>(content);

View File

@ -2676,7 +2676,7 @@ PRBool nsPrintEngine::HasFramesetChild(nsIContent* aContent)
for (PRUint32 i = 0; i < numChildren; ++i) {
nsIContent *child = aContent->GetChildAt(i);
if (child->Tag() == nsGkAtoms::frameset &&
child->IsNodeOfType(nsINode::eHTML)) {
child->IsHTML()) {
return PR_TRUE;
}
}

View File

@ -175,7 +175,7 @@ nsPrintPreviewListener::HandleEvent(nsIDOMEvent* aEvent)
if (nsEvent)
nsEvent->GetOriginalTarget(getter_AddRefs(target));
nsCOMPtr<nsIContent> content(do_QueryInterface(target));
if (content && !content->IsNodeOfType(nsINode::eXUL)) {
if (content && !content->IsXUL()) {
eEventAction action = ::GetActionForEvent(aEvent);
switch (action) {
case eEventAction_Tab:

View File

@ -956,7 +956,7 @@ RuleProcessorData::RuleProcessorData(nsPresContext* aPresContext,
// NOTE: optimization: cannot be an XLink if no attributes (since it needs an
if(!mIsLink &&
mHasAttributes &&
!(mIsHTMLContent || aContent->IsNodeOfType(nsINode::eXUL)) &&
!(mIsHTMLContent || aContent->IsXUL()) &&
nsStyleUtil::IsLink(aContent, linkHandler, &mLinkState)) {
mIsLink = PR_TRUE;
}
@ -1012,7 +1012,7 @@ const nsString* RuleProcessorData::GetLang()
// XHTML1 section C.7).
PRBool hasAttr = content->GetAttr(kNameSpaceID_XML, nsGkAtoms::lang,
*mLanguage);
if (!hasAttr && content->IsNodeOfType(nsINode::eHTML)) {
if (!hasAttr && content->IsHTML()) {
hasAttr = content->GetAttr(kNameSpaceID_None, nsGkAtoms::lang,
*mLanguage);
}
@ -1434,7 +1434,7 @@ static PRBool SelectorMatches(RuleProcessorData &data,
if (element) {
do {
child = element->GetChildAt(++index);
if (child && child->IsNodeOfType(nsINode::eHTML) &&
if (child && child->IsHTML() &&
child->Tag() == nsGkAtoms::param &&
child->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
NS_LITERAL_STRING("pluginurl"), eIgnoreCase)) {

View File

@ -462,7 +462,7 @@ nsHTMLStyleSheet::RulesMatching(ElementRuleProcessorData* aData)
}
else if (tag == nsGkAtoms::col) {
nsIContent* parent = aData->mParentContent;
if (parent && parent->IsNodeOfType(nsIContent::eHTML) &&
if (parent && parent->IsHTML() &&
parent->Tag() == nsGkAtoms::colgroup) {
ruleWalker->Forward(mTableColRule);
} else {
@ -533,7 +533,7 @@ nsHTMLStyleSheet::HasAttributeDependentStyle(AttributeRuleProcessorData* aData,
if (aData->mAttribute == nsGkAtoms::href &&
(mLinkRule || mVisitedRule || mActiveRule) &&
content &&
content->IsNodeOfType(nsINode::eHTML) &&
content->IsHTML() &&
aData->mContentTag == nsGkAtoms::a) {
*aResult = eReStyle_Self;
return NS_OK;

View File

@ -432,7 +432,7 @@ PRBool nsStyleUtil::IsHTMLLink(nsIContent *aContent,
nsILinkHandler *aLinkHandler,
nsLinkState *aState)
{
NS_ASSERTION(aContent->IsNodeOfType(nsINode::eHTML),
NS_ASSERTION(aContent->IsHTML(),
"Only use this function with HTML elements");
NS_ASSERTION(aState, "null arg in IsHTMLLink");

View File

@ -269,7 +269,7 @@ nsSVGDisplayContainerFrame::GetBBoxContribution(const gfxMatrix &aToBBoxUserspac
// nsSVGGlyphFrame's mContent is a nsTextNode!
if (kid->GetType() != nsGkAtoms::svgGlyphFrame) {
nsIContent *content = kid->GetContent();
if (content->IsNodeOfType(nsINode::eSVG)) {
if (content->IsSVG()) {
transform = static_cast<nsSVGElement*>(content)->
PrependLocalTransformTo(aToBBoxUserspace);
}

View File

@ -191,7 +191,7 @@ nsSVGSwitchFrame::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace)
if (svgKid) {
nsIContent *content = kid->GetContent();
gfxMatrix transform = aToBBoxUserspace;
if (content->IsNodeOfType(nsINode::eSVG)) {
if (content->IsSVG()) {
transform = static_cast<nsSVGElement*>(content)->
PrependLocalTransformTo(aToBBoxUserspace);
}

View File

@ -670,7 +670,7 @@ nsIBox::AddCSSPrefSize(nsBoxLayoutState& aState, nsIBox* aBox, nsSize& aSize)
// ignore 'height' and 'width' attributes if the actual element is not XUL
// For example, we might be magic XUL frames whose primary content is an HTML
// <select>
if (content && content->IsNodeOfType(nsINode::eXUL)) {
if (content && content->IsXUL()) {
nsAutoString value;
PRInt32 error;

View File

@ -1220,7 +1220,7 @@ nsListBoxBodyFrame::GetNextItemBox(nsIBox* aBox, PRInt32 aOffset,
// There is a content node that wants a frame.
nsIContent *nextContent = parentContent->GetChildAt(i + aOffset + 1);
if (!nextContent->IsNodeOfType(nsINode::eXUL) ||
if (!nextContent->IsXUL() ||
nextContent->Tag() != nsGkAtoms::listitem)
return GetNextItemBox(aBox, ++aOffset, aCreated);

View File

@ -227,7 +227,7 @@ nsTreeBodyFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState)
desiredRows = 0;
}
else if (baseElement->Tag() == nsGkAtoms::select &&
baseElement->IsNodeOfType(nsINode::eHTML)) {
baseElement->IsHTML()) {
min.width = CalcMaxRowWidth();
nsAutoString size;
baseElement->GetAttr(kNameSpaceID_None, nsGkAtoms::size, size);
@ -1824,7 +1824,7 @@ nsTreeBodyFrame::MarkDirtyIfSelect()
nsIContent* baseElement = GetBaseElement();
if (baseElement && baseElement->Tag() == nsGkAtoms::select &&
baseElement->IsNodeOfType(nsINode::eHTML)) {
baseElement->IsHTML()) {
// If we are an intrinsically sized select widget, we may need to
// resize, if the widest item was removed or a new item was added.
// XXX optimize this more
@ -4303,7 +4303,7 @@ nsTreeBodyFrame::GetBaseElement()
if (ni->Equals(nsGkAtoms::tree, kNameSpaceID_XUL) ||
(ni->Equals(nsGkAtoms::select) &&
content->IsNodeOfType(nsINode::eHTML)))
content->IsHTML()))
return content;
}

View File

@ -517,18 +517,18 @@ nsTreeContentView::GetCellText(PRInt32 aRow, nsITreeColumn* aCol, nsAString& _re
nsIAtom *rowTag = row->mContent->Tag();
if (rowTag == nsGkAtoms::option &&
row->mContent->IsNodeOfType(nsINode::eHTML)) {
row->mContent->IsHTML()) {
// Use the text node child as the label
nsCOMPtr<nsIDOMHTMLOptionElement> elem = do_QueryInterface(row->mContent);
elem->GetText(_retval);
}
else if (rowTag == nsGkAtoms::optgroup &&
row->mContent->IsNodeOfType(nsINode::eHTML)) {
row->mContent->IsHTML()) {
nsCOMPtr<nsIDOMHTMLOptGroupElement> elem = do_QueryInterface(row->mContent);
elem->GetLabel(_retval);
}
else if (rowTag == nsGkAtoms::treeitem &&
row->mContent->IsNodeOfType(nsINode::eXUL)) {
row->mContent->IsXUL()) {
nsIContent* realRow =
nsTreeUtils::GetImmediateChild(row->mContent, nsGkAtoms::treerow);
if (realRow) {
@ -588,7 +588,7 @@ nsTreeContentView::ToggleOpenState(PRInt32 aIndex)
Row* row = mRows[aIndex];
if (row->mContent->Tag() == nsGkAtoms::optgroup &&
row->mContent->IsNodeOfType(nsINode::eHTML)) {
row->mContent->IsHTML()) {
// we don't use an attribute for optgroup's open state
if (row->IsOpen())
CloseContainer(aIndex);
@ -794,7 +794,7 @@ nsTreeContentView::ContentStatesChanged(nsIDocument* aDocument,
PRInt32 aStateMask)
{
if (!aContent1 || !mSelection ||
!aContent1->IsNodeOfType(nsINode::eHTML) ||
!aContent1->IsHTML() ||
!(aStateMask & NS_EVENT_STATE_CHECKED))
return;
@ -823,7 +823,7 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
mBoxObject->Invalidate();
}
if (aContent->IsNodeOfType(nsINode::eXUL)) {
if (aContent->IsXUL()) {
if (tag != nsGkAtoms::treecol &&
tag != nsGkAtoms::treeitem &&
tag != nsGkAtoms::treeseparator &&
@ -842,8 +842,8 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
if (!element)
return; // this is not for us
nsIAtom *parentTag = element->Tag();
if ((element->IsNodeOfType(nsINode::eXUL) && parentTag == nsGkAtoms::tree) ||
(element->IsNodeOfType(nsINode::eHTML) && parentTag == nsGkAtoms::select))
if ((element->IsXUL() && parentTag == nsGkAtoms::tree) ||
(element->IsHTML() && parentTag == nsGkAtoms::select))
return; // this is not for us
}
@ -984,12 +984,12 @@ nsTreeContentView::ContentInserted(nsIDocument *aDocument,
// First check the tag to see if it's one that we care about.
nsIAtom *childTag = aChild->Tag();
if (aChild->IsNodeOfType(nsINode::eHTML)) {
if (aChild->IsHTML()) {
if (childTag != nsGkAtoms::option &&
childTag != nsGkAtoms::optgroup)
return;
}
else if (aChild->IsNodeOfType(nsINode::eXUL)) {
else if (aChild->IsXUL()) {
if (childTag != nsGkAtoms::treeitem &&
childTag != nsGkAtoms::treeseparator &&
childTag != nsGkAtoms::treechildren &&
@ -1008,8 +1008,8 @@ nsTreeContentView::ContentInserted(nsIDocument *aDocument,
if (!element)
return; // this is not for us
nsIAtom *parentTag = element->Tag();
if ((element->IsNodeOfType(nsINode::eXUL) && parentTag == nsGkAtoms::tree) ||
(element->IsNodeOfType(nsINode::eHTML) && parentTag == nsGkAtoms::select))
if ((element->IsXUL() && parentTag == nsGkAtoms::tree) ||
(element->IsHTML() && parentTag == nsGkAtoms::select))
return; // this is not for us
}
@ -1067,12 +1067,12 @@ nsTreeContentView::ContentRemoved(nsIDocument *aDocument,
// First check the tag to see if it's one that we care about.
nsIAtom *tag = aChild->Tag();
if (aChild->IsNodeOfType(nsINode::eHTML)) {
if (aChild->IsHTML()) {
if (tag != nsGkAtoms::option &&
tag != nsGkAtoms::optgroup)
return;
}
else if (aChild->IsNodeOfType(nsINode::eXUL)) {
else if (aChild->IsXUL()) {
if (tag != nsGkAtoms::treeitem &&
tag != nsGkAtoms::treeseparator &&
tag != nsGkAtoms::treechildren &&
@ -1091,8 +1091,8 @@ nsTreeContentView::ContentRemoved(nsIDocument *aDocument,
if (!element)
return; // this is not for us
nsIAtom *parentTag = element->Tag();
if ((element->IsNodeOfType(nsINode::eXUL) && parentTag == nsGkAtoms::tree) ||
(element->IsNodeOfType(nsINode::eHTML) && parentTag == nsGkAtoms::select))
if ((element->IsXUL() && parentTag == nsGkAtoms::tree) ||
(element->IsHTML() && parentTag == nsGkAtoms::select))
return; // this is not for us
}
@ -1154,13 +1154,13 @@ nsTreeContentView::Serialize(nsIContent* aContent, PRInt32 aParentIndex,
nsIAtom *tag = content->Tag();
PRInt32 count = aRows.Length();
if (content->IsNodeOfType(nsINode::eXUL)) {
if (content->IsXUL()) {
if (tag == nsGkAtoms::treeitem)
SerializeItem(content, aParentIndex, aIndex, aRows);
else if (tag == nsGkAtoms::treeseparator)
SerializeSeparator(content, aParentIndex, aIndex, aRows);
}
else if (content->IsNodeOfType(nsINode::eHTML)) {
else if (content->IsHTML()) {
if (tag == nsGkAtoms::option)
SerializeOption(content, aParentIndex, aIndex, aRows);
else if (tag == nsGkAtoms::optgroup)
@ -1271,7 +1271,7 @@ nsTreeContentView::GetIndexInSubtree(nsIContent* aContainer,
nsIAtom *tag = content->Tag();
if (content->IsNodeOfType(nsINode::eXUL)) {
if (content->IsXUL()) {
if (tag == nsGkAtoms::treeitem) {
if (! content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::hidden,
nsGkAtoms::_true, eCaseMatters)) {
@ -1293,7 +1293,7 @@ nsTreeContentView::GetIndexInSubtree(nsIContent* aContainer,
(*aIndex)++;
}
}
else if (content->IsNodeOfType(nsINode::eHTML)) {
else if (content->IsHTML()) {
if (tag == nsGkAtoms::optgroup) {
(*aIndex)++;
GetIndexInSubtree(content, aContent, aIndex);
@ -1365,8 +1365,8 @@ nsTreeContentView::InsertRowFor(nsIContent* aParent, nsIContent* aChild)
nsCOMPtr<nsIContent> grandParent = aParent->GetParent();
nsIAtom* grandParentTag = grandParent->Tag();
if ((grandParent->IsNodeOfType(nsINode::eXUL) && grandParentTag == nsGkAtoms::tree) ||
(grandParent->IsNodeOfType(nsINode::eHTML) && grandParentTag == nsGkAtoms::select)
if ((grandParent->IsXUL() && grandParentTag == nsGkAtoms::tree) ||
(grandParent->IsHTML() && grandParentTag == nsGkAtoms::select)
) {
// Allow insertion to the outermost container.
insertRow = PR_TRUE;
@ -1399,13 +1399,13 @@ nsTreeContentView::InsertRow(PRInt32 aParentIndex, PRInt32 aIndex, nsIContent* a
{
nsAutoTArray<Row*, 8> rows;
nsIAtom *tag = aContent->Tag();
if (aContent->IsNodeOfType(nsINode::eXUL)) {
if (aContent->IsXUL()) {
if (tag == nsGkAtoms::treeitem)
SerializeItem(aContent, aParentIndex, &aIndex, rows);
else if (tag == nsGkAtoms::treeseparator)
SerializeSeparator(aContent, aParentIndex, &aIndex, rows);
}
else if (aContent->IsNodeOfType(nsINode::eHTML)) {
else if (aContent->IsHTML()) {
if (tag == nsGkAtoms::option)
SerializeOption(aContent, aParentIndex, &aIndex, rows);
else if (tag == nsGkAtoms::optgroup)

View File

@ -831,7 +831,7 @@ nsTypeAheadFind::RangeStartsInsideLink(nsIDOMRange *aRange,
// Keep testing while startContent is equal to something,
// eventually we'll run out of ancestors
if (startContent->IsNodeOfType(nsINode::eHTML)) {
if (startContent->IsHTML()) {
nsCOMPtr<nsILink> link(do_QueryInterface(startContent));
if (link) {
// Check to see if inside HTML link

View File

@ -120,12 +120,12 @@ nsNativeThemeGTK::RefreshWidgetWindow(nsIFrame* aFrame)
vm->UpdateAllViews(NS_VMREFRESH_NO_SYNC);
}
static PRBool IsFrameContentNodeOfType(nsIFrame *aFrame, PRUint32 aFlags)
static PRBool IsFrameContentNodeInNamespace(nsIFrame *aFrame, PRUint32 aNamespace)
{
nsIContent *content = aFrame ? aFrame->GetContent() : nsnull;
if (!content)
return false;
return content->IsNodeOfType(aFlags);
return content->IsInNamespace(aNamespace);
}
static PRBool IsWidgetTypeDisabled(PRUint8* aDisabledVector, PRUint8 aWidgetType) {
@ -199,7 +199,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
aWidgetType == NS_THEME_RADIO_LABEL)) {
nsIAtom* atom = nsnull;
if (IsFrameContentNodeOfType(aFrame, nsINode::eXUL)) {
if (IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XUL)) {
if (aWidgetType == NS_THEME_CHECKBOX_LABEL ||
aWidgetType == NS_THEME_RADIO_LABEL) {
// Adjust stateFrame so GetContentState finds the correct state.
@ -247,7 +247,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
aState->canDefault = FALSE; // XXX fix me
aState->depressed = FALSE;
if (IsFrameContentNodeOfType(aFrame, nsINode::eXUL)) {
if (IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XUL)) {
// For these widget types, some element (either a child or parent)
// actually has element focus, so we check the focused attribute
// to see whether to draw in the focused state.
@ -496,7 +496,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
case NS_THEME_DROPDOWN:
aGtkWidgetType = MOZ_GTK_DROPDOWN;
if (aWidgetFlags)
*aWidgetFlags = IsFrameContentNodeOfType(aFrame, nsINode::eHTML);
*aWidgetFlags = IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XHTML);
break;
case NS_THEME_DROPDOWN_TEXT:
return PR_FALSE; // nothing to do, but prevents the bg from being drawn
@ -871,7 +871,7 @@ nsNativeThemeGTK::GetWidgetBorder(nsIDeviceContext* aContext, nsIFrame* aFrame,
nsnull))
moz_gtk_get_widget_border(gtkWidgetType, &aResult->left, &aResult->top,
&aResult->right, &aResult->bottom, direction,
IsFrameContentNodeOfType(aFrame, nsINode::eHTML));
IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XHTML));
}
}
return NS_OK;
@ -1304,7 +1304,7 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
case NS_THEME_DROPDOWN_BUTTON:
// "Native" dropdown buttons cause padding and margin problems, but only
// in HTML so allow them in XUL.
return (!aFrame || IsFrameContentNodeOfType(aFrame, nsINode::eXUL)) &&
return (!aFrame || IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XUL)) &&
!IsWidgetStyled(aPresContext, aFrame, aWidgetType);
}

View File

@ -118,7 +118,7 @@ GetViewportOrgEx(HDC hdc, LPPOINT lpPoint)
static inline bool IsHTMLContent(nsIFrame *frame)
{
nsIContent* content = frame->GetContent();
return content && content->IsNodeOfType(nsINode::eHTML);
return content && content->IsHTML();
}
nsNativeThemeWin::nsNativeThemeWin() {
@ -388,7 +388,7 @@ PRBool
nsNativeThemeWin::IsMenuActive(nsIFrame *aFrame, PRUint8 aWidgetType)
{
nsIContent* content = aFrame->GetContent();
if (content->IsNodeOfType(nsINode::eXUL) &&
if (content->IsXUL() &&
content->NodeInfo()->Equals(nsWidgetAtoms::richlistitem))
return CheckBooleanAttr(aFrame, nsWidgetAtoms::selected);
@ -495,7 +495,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
/* XUL textboxes don't get focused themselves, because they have child
* html:input.. but we can check the XUL focused attributes on them
*/
if (content && content->IsNodeOfType(nsINode::eXUL) && IsFocused(aFrame))
if (content && content->IsXUL() && IsFocused(aFrame))
aState = TFS_EDITBORDER_FOCUSED;
else if (eventState & NS_EVENT_STATE_ACTIVE || eventState & NS_EVENT_STATE_FOCUS)
aState = TFS_EDITBORDER_FOCUSED;
@ -776,7 +776,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
}
case NS_THEME_DROPDOWN: {
nsIContent* content = aFrame->GetContent();
PRBool isHTML = content && content->IsNodeOfType(nsINode::eHTML);
PRBool isHTML = content && content->IsHTML();
/* On vista, in HTML, we use CBP_DROPBORDER instead of DROPFRAME for HTML content;
* this gives us the thin outline in HTML content, instead of the gradient-filled
@ -1178,7 +1178,7 @@ RENDER_AGAIN:
// Draw focus rectangles for XP HTML checkboxes and radio buttons
// XXX it'd be nice to draw these outside of the frame
if ((aWidgetType == NS_THEME_CHECKBOX || aWidgetType == NS_THEME_RADIO) &&
aFrame->GetContent()->IsNodeOfType(nsINode::eHTML) ||
aFrame->GetContent()->IsHTML() ||
aWidgetType == NS_THEME_SCALE_HORIZONTAL ||
aWidgetType == NS_THEME_SCALE_VERTICAL) {
PRInt32 contentState;
@ -1341,7 +1341,7 @@ nsNativeThemeWin::GetWidgetBorder(nsIDeviceContext* aContext,
if (aFrame && (aWidgetType == NS_THEME_TEXTFIELD || aWidgetType == NS_THEME_TEXTFIELD_MULTILINE)) {
nsIContent* content = aFrame->GetContent();
if (content && content->IsNodeOfType(nsINode::eHTML)) {
if (content && content->IsHTML()) {
// We need to pad textfields by 1 pixel, since the caret will draw
// flush against the edge by default if we don't.
aResult->top++;
@ -1623,7 +1623,7 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame*
// GetPreferredWidgetSize from GetMinimumWidgetSize, so callers can
// use the one they want.
if (aWidgetType == NS_THEME_BUTTON &&
aFrame->GetContent()->IsNodeOfType(nsINode::eHTML))
aFrame->GetContent()->IsHTML())
sizeReq = 0; /* TS_MIN */
SIZE sz;
@ -2074,7 +2074,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
// The down state is flat if the button is focusable
if (uiData->mUserFocus == NS_STYLE_USER_FOCUS_NORMAL) {
#ifndef WINCE
if (!aFrame->GetContent()->IsNodeOfType(nsINode::eHTML))
if (!aFrame->GetContent()->IsHTML())
aState |= DFCS_FLAT;
#endif
aFocused = PR_TRUE;
@ -2116,7 +2116,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
}
contentState = GetContentState(aFrame, aWidgetType);
if (!content->IsNodeOfType(nsINode::eXUL) &&
if (!content->IsXUL() &&
(contentState & NS_EVENT_STATE_FOCUS)) {
aFocused = PR_TRUE;
}
@ -2595,7 +2595,7 @@ RENDER_AGAIN:
// Fill in background
if (IsDisabled(aFrame) ||
(aFrame->GetContent()->IsNodeOfType(nsINode::eXUL) &&
(aFrame->GetContent()->IsXUL() &&
IsReadOnly(aFrame)))
::FillRect(hdc, &widgetRect, (HBRUSH) (COLOR_BTNFACE+1));
else

View File

@ -77,7 +77,7 @@ nsNativeTheme::GetContentState(nsIFrame* aFrame, PRUint8 aWidgetType)
PRBool isXULCheckboxRadio =
(aWidgetType == NS_THEME_CHECKBOX ||
aWidgetType == NS_THEME_RADIO) &&
aFrame->GetContent()->IsNodeOfType(nsINode::eXUL);
aFrame->GetContent()->IsXUL();
if (isXULCheckboxRadio)
aFrame = aFrame->GetParent();
@ -109,7 +109,7 @@ nsNativeTheme::CheckBooleanAttr(nsIFrame* aFrame, nsIAtom* aAtom)
if (!content)
return PR_FALSE;
if (content->IsNodeOfType(nsINode::eHTML))
if (content->IsHTML())
return content->HasAttr(kNameSpaceID_None, aAtom);
// For XML/XUL elements, an attribute must be equal to the literal
@ -142,7 +142,7 @@ nsNativeTheme::GetCheckedOrSelected(nsIFrame* aFrame, PRBool aCheckSelected)
nsIContent* content = aFrame->GetContent();
if (content->IsNodeOfType(nsINode::eXUL)) {
if (content->IsXUL()) {
// For a XUL checkbox or radio button, the state of the parent determines
// the checked state
aFrame = aFrame->GetParent();
@ -179,7 +179,7 @@ nsNativeTheme::GetIndeterminate(nsIFrame* aFrame)
nsIContent* content = aFrame->GetContent();
if (content->IsNodeOfType(nsINode::eXUL)) {
if (content->IsXUL()) {
// For a XUL checkbox or radio button, the state of the parent determines
// the state
return CheckBooleanAttr(aFrame->GetParent(), nsWidgetAtoms::indeterminate);
@ -207,7 +207,7 @@ nsNativeTheme::IsWidgetStyled(nsPresContext* aPresContext, nsIFrame* aFrame,
aWidgetType == NS_THEME_TEXTFIELD_MULTILINE ||
aWidgetType == NS_THEME_LISTBOX ||
aWidgetType == NS_THEME_DROPDOWN) &&
aFrame->GetContent()->IsNodeOfType(nsINode::eHTML) &&
aFrame->GetContent()->IsHTML() &&
aPresContext->HasAuthorSpecifiedRules(aFrame,
NS_AUTHOR_SPECIFIED_BORDER |
NS_AUTHOR_SPECIFIED_BACKGROUND);