mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 13:34:03 +00:00
backout bug 1134280 for fixing yandex search "Read more" link
This commit is contained in:
@@ -141,7 +141,7 @@ HTMLLabelIterator::Next()
|
||||
// element, or <label> ancestor which implicitly point to it.
|
||||
Accessible* label = nullptr;
|
||||
while ((label = mRelIter.Next())) {
|
||||
if (label->GetContent()->IsHTMLElement(nsGkAtoms::label))
|
||||
if (label->GetContent()->Tag() == nsGkAtoms::label)
|
||||
return label;
|
||||
}
|
||||
|
||||
@@ -155,14 +155,16 @@ HTMLLabelIterator::Next()
|
||||
Accessible* walkUp = mAcc->Parent();
|
||||
while (walkUp && !walkUp->IsDoc()) {
|
||||
nsIContent* walkUpElm = walkUp->GetContent();
|
||||
if (walkUpElm->IsHTMLElement(nsGkAtoms::label) &&
|
||||
!walkUpElm->HasAttr(kNameSpaceID_None, nsGkAtoms::_for)) {
|
||||
mLabelFilter = eSkipAncestorLabel; // prevent infinite loop
|
||||
return walkUp;
|
||||
}
|
||||
if (walkUpElm->IsHTML()) {
|
||||
if (walkUpElm->Tag() == nsGkAtoms::label &&
|
||||
!walkUpElm->HasAttr(kNameSpaceID_None, nsGkAtoms::_for)) {
|
||||
mLabelFilter = eSkipAncestorLabel; // prevent infinite loop
|
||||
return walkUp;
|
||||
}
|
||||
|
||||
if (walkUpElm->IsHTMLElement(nsGkAtoms::form))
|
||||
break;
|
||||
if (walkUpElm->Tag() == nsGkAtoms::form)
|
||||
break;
|
||||
}
|
||||
|
||||
walkUp = walkUp->Parent();
|
||||
}
|
||||
@@ -186,7 +188,7 @@ HTMLOutputIterator::Next()
|
||||
{
|
||||
Accessible* output = nullptr;
|
||||
while ((output = mRelIter.Next())) {
|
||||
if (output->GetContent()->IsHTMLElement(nsGkAtoms::output))
|
||||
if (output->GetContent()->Tag() == nsGkAtoms::output)
|
||||
return output;
|
||||
}
|
||||
|
||||
@@ -209,7 +211,7 @@ XULLabelIterator::Next()
|
||||
{
|
||||
Accessible* label = nullptr;
|
||||
while ((label = mRelIter.Next())) {
|
||||
if (label->GetContent()->IsXULElement(nsGkAtoms::label))
|
||||
if (label->GetContent()->Tag() == nsGkAtoms::label)
|
||||
return label;
|
||||
}
|
||||
|
||||
@@ -232,7 +234,7 @@ XULDescriptionIterator::Next()
|
||||
{
|
||||
Accessible* descr = nullptr;
|
||||
while ((descr = mRelIter.Next())) {
|
||||
if (descr->GetContent()->IsXULElement(nsGkAtoms::description))
|
||||
if (descr->GetContent()->Tag() == nsGkAtoms::description)
|
||||
return descr;
|
||||
}
|
||||
|
||||
|
||||
@@ -713,7 +713,7 @@ logging::Node(const char* aDescr, nsINode* aNode)
|
||||
dom::Element* elm = aNode->AsElement();
|
||||
|
||||
nsAutoCString tag;
|
||||
elm->NodeInfo()->NameAtom()->ToUTF8String(tag);
|
||||
elm->Tag()->ToUTF8String(tag);
|
||||
|
||||
nsIAtom* idAtom = elm->GetID();
|
||||
nsAutoCString id;
|
||||
|
||||
@@ -872,10 +872,11 @@ TextAttrsMgr::TextPosTextAttr::
|
||||
}
|
||||
|
||||
const nsIContent* content = aFrame->GetContent();
|
||||
if (content) {
|
||||
if (content->IsHTMLElement(nsGkAtoms::sup))
|
||||
if (content && content->IsHTML()) {
|
||||
const nsIAtom* tagName = content->Tag();
|
||||
if (tagName == nsGkAtoms::sup)
|
||||
return eTextPosSuper;
|
||||
if (content->IsHTMLElement(nsGkAtoms::sub))
|
||||
if (tagName == nsGkAtoms::sub)
|
||||
return eTextPosSub;
|
||||
}
|
||||
|
||||
|
||||
@@ -889,7 +889,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
|
||||
#ifdef DEBUG
|
||||
nsImageFrame* imageFrame = do_QueryFrame(frame);
|
||||
NS_ASSERTION(imageFrame && content->IsHTMLElement(nsGkAtoms::area),
|
||||
NS_ASSERTION(imageFrame && content->IsHTML() && content->Tag() == nsGkAtoms::area,
|
||||
"Unknown case of not main content for the frame!");
|
||||
#endif
|
||||
return nullptr;
|
||||
@@ -897,7 +897,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
|
||||
#ifdef DEBUG
|
||||
nsImageFrame* imageFrame = do_QueryFrame(frame);
|
||||
NS_ASSERTION(!imageFrame || !content->IsHTMLElement(nsGkAtoms::area),
|
||||
NS_ASSERTION(!imageFrame || !content->IsHTML() || content->Tag() != nsGkAtoms::area,
|
||||
"Image map manages the area accessible creation!");
|
||||
#endif
|
||||
|
||||
@@ -926,7 +926,8 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
return newAcc;
|
||||
}
|
||||
|
||||
if (content->IsHTMLElement(nsGkAtoms::map)) {
|
||||
bool isHTML = content->IsHTML();
|
||||
if (isHTML && content->Tag() == nsGkAtoms::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
|
||||
// map rect is empty then it is used for links grouping. Otherwise it should
|
||||
@@ -965,7 +966,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
roleMapEntry = nullptr;
|
||||
}
|
||||
|
||||
if (!newAcc && content->IsHTMLElement()) { // HTML accessibles
|
||||
if (!newAcc && isHTML) { // HTML accessibles
|
||||
bool isARIATableOrCell = roleMapEntry &&
|
||||
(roleMapEntry->accTypes & (eTableCell | eTable));
|
||||
|
||||
@@ -1003,9 +1004,9 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
aContext->ARIARoleMap() == &aria::gEmptyRoleMap) {
|
||||
roleMapEntry = &aria::gEmptyRoleMap;
|
||||
|
||||
} else if (content->IsAnyOfHTMLElements(nsGkAtoms::dt,
|
||||
nsGkAtoms::li,
|
||||
nsGkAtoms::dd) ||
|
||||
} else if (content->Tag() == nsGkAtoms::dt ||
|
||||
content->Tag() == nsGkAtoms::li ||
|
||||
content->Tag() == nsGkAtoms::dd ||
|
||||
frame->AccessibleType() == eHTMLLiType) {
|
||||
nsRoleMapEntry* contextRoleMap = aContext->ARIARoleMap();
|
||||
if (!contextRoleMap->IsOfType(eList))
|
||||
@@ -1015,7 +1016,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
}
|
||||
|
||||
// Accessible XBL types and deck stuff are used in XUL only currently.
|
||||
if (!newAcc && content->IsXULElement()) {
|
||||
if (!newAcc && content->IsXUL()) {
|
||||
// No accessible for not selected deck panel and its children.
|
||||
if (!aContext->IsXULTabpanels()) {
|
||||
nsDeckFrame* deckFrame = do_QueryFrame(frame->GetParent());
|
||||
@@ -1044,18 +1045,18 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
}
|
||||
|
||||
if (!newAcc) {
|
||||
if (content->IsSVGElement()) {
|
||||
if (content->IsSVG()) {
|
||||
nsSVGPathGeometryFrame* pathGeometryFrame = do_QueryFrame(frame);
|
||||
if (pathGeometryFrame) {
|
||||
// A graphic elements: rect, circle, ellipse, line, path, polygon,
|
||||
// polyline and image. A 'use' and 'text' graphic elements require
|
||||
// special support.
|
||||
newAcc = new EnumRoleAccessible(content, document, roles::GRAPHIC);
|
||||
} else if (content->IsSVGElement(nsGkAtoms::svg)) {
|
||||
} else if (content->Tag() == nsGkAtoms::svg) {
|
||||
newAcc = new EnumRoleAccessible(content, document, roles::DIAGRAM);
|
||||
}
|
||||
} else if (content->IsMathMLElement()) {
|
||||
if (content->IsMathMLElement(nsGkAtoms::math))
|
||||
} else if (content->IsMathML()){
|
||||
if (content->Tag() == nsGkAtoms::math)
|
||||
newAcc = new EnumRoleAccessible(content, document, roles::EQUATION);
|
||||
else
|
||||
newAcc = new HyperTextAccessible(content, document);
|
||||
@@ -1066,15 +1067,13 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
// of some property that makes this object interesting
|
||||
// We don't do this for <body>, <html>, <window>, <dialog> etc. which
|
||||
// correspond to the doc accessible and will be created in any case
|
||||
if (!newAcc && !content->IsHTMLElement(nsGkAtoms::body) &&
|
||||
content->GetParent() &&
|
||||
if (!newAcc && content->Tag() != nsGkAtoms::body && content->GetParent() &&
|
||||
(roleMapEntry || MustBeAccessible(content, document) ||
|
||||
(content->IsHTMLElement() &&
|
||||
nsCoreUtils::HasClickListener(content)))) {
|
||||
(isHTML && nsCoreUtils::HasClickListener(content)))) {
|
||||
// This content is focusable or has an interesting dynamic content accessibility property.
|
||||
// If it's interesting we need it in the accessibility hierarchy so that events or
|
||||
// other accessibles can point to it, or so that it can hold a state, etc.
|
||||
if (content->IsHTMLElement()) {
|
||||
if (isHTML) {
|
||||
// Interesting HTML container which may have selectable text and/or embedded objects
|
||||
newAcc = new HyperTextAccessibleWrap(content, document);
|
||||
} else { // XUL, SVG, MathML etc.
|
||||
@@ -1254,7 +1253,7 @@ nsAccessibilityService::CreateAccessibleByType(nsIContent* aContent,
|
||||
|
||||
for (nsIContent* child = listItem->GetFirstChild(); child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsXULElement(nsGkAtoms::listcell) && child != aContent) {
|
||||
if (child->IsXUL(nsGkAtoms::listcell) && child != aContent) {
|
||||
accessible = new XULListCellAccessibleWrap(aContent, aDoc);
|
||||
break;
|
||||
}
|
||||
@@ -1286,7 +1285,7 @@ nsAccessibilityService::CreateAccessibleByType(nsIContent* aContent,
|
||||
// implementations on each platform for a consistent scripting environment, but
|
||||
// then strip out redundant accessibles in the AccessibleWrap class for each platform.
|
||||
nsIContent *parent = aContent->GetParent();
|
||||
if (parent && parent->IsXULElement(nsGkAtoms::menu))
|
||||
if (parent && parent->IsXUL() && parent->Tag() == nsGkAtoms::menu)
|
||||
return nullptr;
|
||||
#endif
|
||||
|
||||
@@ -1380,45 +1379,45 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame,
|
||||
}
|
||||
|
||||
// This method assumes we're in an HTML namespace.
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::figcaption)) {
|
||||
nsIAtom* tag = aContent->Tag();
|
||||
if (tag == nsGkAtoms::figcaption) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HTMLFigcaptionAccessible(aContent, document);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::figure)) {
|
||||
if (tag == nsGkAtoms::figure) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HTMLFigureAccessible(aContent, document);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::legend)) {
|
||||
if (tag == nsGkAtoms::legend) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HTMLLegendAccessible(aContent, document);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::option)) {
|
||||
if (tag == nsGkAtoms::option) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HTMLSelectOptionAccessible(aContent, document);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::optgroup)) {
|
||||
if (tag == nsGkAtoms::optgroup) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HTMLSelectOptGroupAccessible(aContent, document);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
if (aContent->IsAnyOfHTMLElements(nsGkAtoms::ul,
|
||||
nsGkAtoms::ol,
|
||||
nsGkAtoms::dl)) {
|
||||
if (tag == nsGkAtoms::ul || tag == nsGkAtoms::ol ||
|
||||
tag == nsGkAtoms::dl) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HTMLListAccessible(aContent, document);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::a)) {
|
||||
if (tag == nsGkAtoms::a) {
|
||||
// Only some roles truly enjoy life as HTMLLinkAccessibles, for details
|
||||
// see closed bug 494807.
|
||||
nsRoleMapEntry* roleMapEntry = aria::GetRoleMap(aContent);
|
||||
@@ -1439,13 +1438,13 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame,
|
||||
// it unconditionally by tag name. nsBlockFrame creates the list item
|
||||
// accessible for other elements styled as list items.
|
||||
if (aContext->GetContent() == aContent->GetParent()) {
|
||||
if (aContent->IsAnyOfHTMLElements(nsGkAtoms::dt, nsGkAtoms::li)) {
|
||||
if (tag == nsGkAtoms::dt || tag == nsGkAtoms::li) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HTMLLIAccessible(aContent, document);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::dd)) {
|
||||
if (tag == nsGkAtoms::dd) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HyperTextAccessibleWrap(aContent, document);
|
||||
return accessible.forget();
|
||||
@@ -1455,42 +1454,42 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aContent->IsAnyOfHTMLElements(nsGkAtoms::abbr,
|
||||
nsGkAtoms::acronym,
|
||||
nsGkAtoms::article,
|
||||
nsGkAtoms::aside,
|
||||
nsGkAtoms::blockquote,
|
||||
nsGkAtoms::form,
|
||||
nsGkAtoms::footer,
|
||||
nsGkAtoms::header,
|
||||
nsGkAtoms::h1,
|
||||
nsGkAtoms::h2,
|
||||
nsGkAtoms::h3,
|
||||
nsGkAtoms::h4,
|
||||
nsGkAtoms::h5,
|
||||
nsGkAtoms::h6,
|
||||
nsGkAtoms::nav,
|
||||
nsGkAtoms::q,
|
||||
nsGkAtoms::section,
|
||||
nsGkAtoms::time)) {
|
||||
if (tag == nsGkAtoms::abbr ||
|
||||
tag == nsGkAtoms::acronym ||
|
||||
tag == nsGkAtoms::article ||
|
||||
tag == nsGkAtoms::aside ||
|
||||
tag == nsGkAtoms::blockquote ||
|
||||
tag == nsGkAtoms::form ||
|
||||
tag == nsGkAtoms::footer ||
|
||||
tag == nsGkAtoms::header ||
|
||||
tag == nsGkAtoms::h1 ||
|
||||
tag == nsGkAtoms::h2 ||
|
||||
tag == nsGkAtoms::h3 ||
|
||||
tag == nsGkAtoms::h4 ||
|
||||
tag == nsGkAtoms::h5 ||
|
||||
tag == nsGkAtoms::h6 ||
|
||||
tag == nsGkAtoms::nav ||
|
||||
tag == nsGkAtoms::q ||
|
||||
tag == nsGkAtoms::section ||
|
||||
tag == nsGkAtoms::time) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HyperTextAccessibleWrap(aContent, document);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::label)) {
|
||||
if (tag == nsGkAtoms::label) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HTMLLabelAccessible(aContent, document);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::output)) {
|
||||
if (tag == nsGkAtoms::output) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HTMLOutputAccessible(aContent, document);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::progress)) {
|
||||
if (tag == nsGkAtoms::progress) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HTMLProgressMeterAccessible(aContent, document);
|
||||
return accessible.forget();
|
||||
@@ -1608,7 +1607,7 @@ nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame,
|
||||
newAcc = new HTMLTextFieldAccessible(aContent, document);
|
||||
break;
|
||||
case eHyperTextType:
|
||||
if (!aContent->IsAnyOfHTMLElements(nsGkAtoms::dt, nsGkAtoms::dd))
|
||||
if (aContent->Tag() != nsGkAtoms::dt && aContent->Tag() != nsGkAtoms::dd)
|
||||
newAcc = new HyperTextAccessibleWrap(aContent, document);
|
||||
break;
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ nsTextEquivUtils::AppendTextEquivFromTextContent(nsIContent *aContent,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aContent->IsHTMLElement() &&
|
||||
if (aContent->IsHTML() &&
|
||||
aContent->NodeInfo()->Equals(nsGkAtoms::br)) {
|
||||
aString->AppendLiteral("\r\n");
|
||||
return NS_OK;
|
||||
@@ -301,7 +301,7 @@ nsTextEquivUtils::AppendFromDOMNode(nsIContent *aContent, nsAString *aString)
|
||||
if (rv != NS_OK_NO_NAME_CLAUSE_HANDLED)
|
||||
return NS_OK;
|
||||
|
||||
if (aContent->IsXULElement()) {
|
||||
if (aContent->IsXUL()) {
|
||||
nsAutoString textEquivalent;
|
||||
nsCOMPtr<nsIDOMXULLabeledControlElement> labeledEl =
|
||||
do_QueryInterface(aContent);
|
||||
|
||||
@@ -48,7 +48,7 @@ inline bool
|
||||
Accessible::IsSearchbox() const
|
||||
{
|
||||
return (mRoleMapEntry && mRoleMapEntry->Is(nsGkAtoms::searchbox)) ||
|
||||
(mContent->IsHTMLElement(nsGkAtoms::input) &&
|
||||
(mContent->IsHTML(nsGkAtoms::input) &&
|
||||
mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::textInputType, eCaseMatters));
|
||||
}
|
||||
|
||||
@@ -141,22 +141,22 @@ Accessible::Name(nsString& aName)
|
||||
return nameFlag;
|
||||
|
||||
// In the end get the name from tooltip.
|
||||
if (mContent->IsHTMLElement()) {
|
||||
if (mContent->IsHTML()) {
|
||||
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::title, aName)) {
|
||||
aName.CompressWhitespace();
|
||||
return eNameFromTooltip;
|
||||
}
|
||||
} else if (mContent->IsXULElement()) {
|
||||
} else if (mContent->IsXUL()) {
|
||||
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext, aName)) {
|
||||
aName.CompressWhitespace();
|
||||
return eNameFromTooltip;
|
||||
}
|
||||
} else if (mContent->IsSVGElement()) {
|
||||
} else if (mContent->IsSVG()) {
|
||||
// If user agents need to choose among multiple ‘desc’ or ‘title’ elements
|
||||
// for processing, the user agent shall choose the first one.
|
||||
for (nsIContent* childElm = mContent->GetFirstChild(); childElm;
|
||||
childElm = childElm->GetNextSibling()) {
|
||||
if (childElm->IsSVGElement(nsGkAtoms::desc)) {
|
||||
if (childElm->IsSVG(nsGkAtoms::desc)) {
|
||||
nsTextEquivUtils::AppendTextEquivFromContent(this, childElm, &aName);
|
||||
return eNameFromTooltip;
|
||||
}
|
||||
@@ -186,7 +186,7 @@ Accessible::Description(nsString& aDescription)
|
||||
aDescription);
|
||||
|
||||
if (aDescription.IsEmpty()) {
|
||||
bool isXUL = mContent->IsXULElement();
|
||||
bool isXUL = mContent->IsXUL();
|
||||
if (isXUL) {
|
||||
// Try XUL <description control="[id]">description text</description>
|
||||
XULDescriptionIterator iter(Document(), mContent);
|
||||
@@ -199,14 +199,14 @@ Accessible::Description(nsString& aDescription)
|
||||
|
||||
if (aDescription.IsEmpty()) {
|
||||
// Keep the Name() method logic.
|
||||
if (mContent->IsHTMLElement()) {
|
||||
if (mContent->IsHTML()) {
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::title, aDescription);
|
||||
} else if (mContent->IsXULElement()) {
|
||||
} else if (mContent->IsXUL()) {
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext, aDescription);
|
||||
} else if (mContent->IsSVGElement()) {
|
||||
} else if (mContent->IsSVG()) {
|
||||
for (nsIContent* childElm = mContent->GetFirstChild(); childElm;
|
||||
childElm = childElm->GetNextSibling()) {
|
||||
if (childElm->IsSVGElement(nsGkAtoms::desc)) {
|
||||
if (childElm->IsSVG(nsGkAtoms::desc)) {
|
||||
nsTextEquivUtils::AppendTextEquivFromContent(this, childElm,
|
||||
&aDescription);
|
||||
break;
|
||||
@@ -237,14 +237,14 @@ Accessible::AccessKey() const
|
||||
Accessible* label = nullptr;
|
||||
|
||||
// Copy access key from label node.
|
||||
if (mContent->IsHTMLElement()) {
|
||||
if (mContent->IsHTML()) {
|
||||
// Unless it is labeled via an ancestor <label>, in which case that would
|
||||
// be redundant.
|
||||
HTMLLabelIterator iter(Document(), this,
|
||||
HTMLLabelIterator::eSkipAncestorLabel);
|
||||
label = iter.Next();
|
||||
|
||||
} else if (mContent->IsXULElement()) {
|
||||
} else if (mContent->IsXUL()) {
|
||||
XULLabelIterator iter(Document(), mContent);
|
||||
label = iter.Next();
|
||||
}
|
||||
@@ -354,7 +354,8 @@ Accessible::VisibilityState()
|
||||
nsIFrame* parentFrame = curFrame->GetParent();
|
||||
nsDeckFrame* deckFrame = do_QueryFrame(parentFrame);
|
||||
if (deckFrame && deckFrame->GetSelectedBox() != curFrame) {
|
||||
if (deckFrame->GetContent()->IsXULElement(nsGkAtoms::tabpanels))
|
||||
if (deckFrame->GetContent()->IsXUL() &&
|
||||
deckFrame->GetContent()->Tag() == nsGkAtoms::tabpanels)
|
||||
return states::OFFSCREEN;
|
||||
|
||||
NS_NOTREACHED("Children of not selected deck panel are not accessible.");
|
||||
@@ -434,7 +435,7 @@ Accessible::NativeState()
|
||||
|
||||
// XXX we should look at layout for non XUL box frames, but need to decide
|
||||
// how that interacts with ARIA.
|
||||
if (HasOwnContent() && mContent->IsXULElement() && frame->IsBoxFrame()) {
|
||||
if (HasOwnContent() && mContent->IsXUL() && frame->IsBoxFrame()) {
|
||||
const nsStyleXUL* xulStyle = frame->StyleXUL();
|
||||
if (xulStyle && frame->IsBoxFrame()) {
|
||||
// In XUL all boxes are either vertical or horizontal
|
||||
@@ -447,7 +448,7 @@ Accessible::NativeState()
|
||||
}
|
||||
|
||||
// Check if a XUL element has the popup attribute (an attached popup menu).
|
||||
if (HasOwnContent() && mContent->IsXULElement() &&
|
||||
if (HasOwnContent() && mContent->IsXUL() &&
|
||||
mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::popup))
|
||||
state |= states::HASPOPUP;
|
||||
|
||||
@@ -484,7 +485,7 @@ Accessible::NativeLinkState() const
|
||||
bool
|
||||
Accessible::NativelyUnavailable() const
|
||||
{
|
||||
if (mContent->IsHTMLElement())
|
||||
if (mContent->IsHTML())
|
||||
return mContent->AsElement()->State().HasState(NS_EVENT_STATE_DISABLED);
|
||||
|
||||
return mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
|
||||
@@ -819,7 +820,7 @@ Accessible::XULElmName(DocAccessible* aDocument,
|
||||
nsIContent* parent =
|
||||
bindingParent? bindingParent->GetParent() : aElm->GetParent();
|
||||
while (parent) {
|
||||
if (parent->IsXULElement(nsGkAtoms::toolbaritem) &&
|
||||
if (parent->Tag() == nsGkAtoms::toolbaritem &&
|
||||
parent->GetAttr(kNameSpaceID_None, nsGkAtoms::title, aName)) {
|
||||
aName.CompressWhitespace();
|
||||
return;
|
||||
@@ -1518,9 +1519,9 @@ Accessible::RelationByType(RelationType aType)
|
||||
case RelationType::LABELLED_BY: {
|
||||
Relation rel(new IDRefsIterator(mDoc, mContent,
|
||||
nsGkAtoms::aria_labelledby));
|
||||
if (mContent->IsHTMLElement()) {
|
||||
if (mContent->IsHTML()) {
|
||||
rel.AppendIter(new HTMLLabelIterator(Document(), this));
|
||||
} else if (mContent->IsXULElement()) {
|
||||
} else if (mContent->IsXUL()) {
|
||||
rel.AppendIter(new XULLabelIterator(Document(), mContent));
|
||||
}
|
||||
|
||||
@@ -1530,7 +1531,7 @@ Accessible::RelationByType(RelationType aType)
|
||||
case RelationType::LABEL_FOR: {
|
||||
Relation rel(new RelatedAccIterator(Document(), mContent,
|
||||
nsGkAtoms::aria_labelledby));
|
||||
if (mContent->IsXULElement(nsGkAtoms::label))
|
||||
if (mContent->Tag() == nsGkAtoms::label && mContent->IsXUL())
|
||||
rel.AppendIter(new IDRefsIterator(mDoc, mContent, nsGkAtoms::control));
|
||||
|
||||
return rel;
|
||||
@@ -1539,7 +1540,7 @@ Accessible::RelationByType(RelationType aType)
|
||||
case RelationType::DESCRIBED_BY: {
|
||||
Relation rel(new IDRefsIterator(mDoc, mContent,
|
||||
nsGkAtoms::aria_describedby));
|
||||
if (mContent->IsXULElement())
|
||||
if (mContent->IsXUL())
|
||||
rel.AppendIter(new XULDescriptionIterator(Document(), mContent));
|
||||
|
||||
return rel;
|
||||
@@ -1552,7 +1553,8 @@ Accessible::RelationByType(RelationType aType)
|
||||
// This affectively adds an optional control attribute to xul:description,
|
||||
// which only affects accessibility, by allowing the description to be
|
||||
// tied to a control.
|
||||
if (mContent->IsXULElement(nsGkAtoms::description))
|
||||
if (mContent->Tag() == nsGkAtoms::description &&
|
||||
mContent->IsXUL())
|
||||
rel.AppendIter(new IDRefsIterator(mDoc, mContent,
|
||||
nsGkAtoms::control));
|
||||
|
||||
@@ -1637,7 +1639,7 @@ Accessible::RelationByType(RelationType aType)
|
||||
return Relation();
|
||||
|
||||
case RelationType::DEFAULT_BUTTON: {
|
||||
if (mContent->IsHTMLElement()) {
|
||||
if (mContent->IsHTML()) {
|
||||
// HTML form controls implements nsIFormControl interface.
|
||||
nsCOMPtr<nsIFormControl> control(do_QueryInterface(mContent));
|
||||
if (control) {
|
||||
@@ -1872,7 +1874,7 @@ Accessible::ARIAName(nsString& aName)
|
||||
ENameValueFlag
|
||||
Accessible::NativeName(nsString& aName)
|
||||
{
|
||||
if (mContent->IsHTMLElement()) {
|
||||
if (mContent->IsHTML()) {
|
||||
Accessible* label = nullptr;
|
||||
HTMLLabelIterator iter(Document(), this);
|
||||
while ((label = iter.Next())) {
|
||||
@@ -1888,7 +1890,7 @@ Accessible::NativeName(nsString& aName)
|
||||
return aName.IsEmpty() ? eNameOK : eNameFromSubtree;
|
||||
}
|
||||
|
||||
if (mContent->IsXULElement()) {
|
||||
if (mContent->IsXUL()) {
|
||||
XULElmName(mDoc, mContent, aName);
|
||||
if (!aName.IsEmpty())
|
||||
return eNameOK;
|
||||
@@ -1897,12 +1899,12 @@ Accessible::NativeName(nsString& aName)
|
||||
return aName.IsEmpty() ? eNameOK : eNameFromSubtree;
|
||||
}
|
||||
|
||||
if (mContent->IsSVGElement()) {
|
||||
if (mContent->IsSVG()) {
|
||||
// If user agents need to choose among multiple ‘desc’ or ‘title’ elements
|
||||
// for processing, the user agent shall choose the first one.
|
||||
for (nsIContent* childElm = mContent->GetFirstChild(); childElm;
|
||||
childElm = childElm->GetNextSibling()) {
|
||||
if (childElm->IsSVGElement(nsGkAtoms::title)) {
|
||||
if (childElm->IsSVG(nsGkAtoms::title)) {
|
||||
nsTextEquivUtils::AppendTextEquivFromContent(this, childElm, &aName);
|
||||
return eNameOK;
|
||||
}
|
||||
@@ -2524,7 +2526,7 @@ Accessible::GetActionRule() const
|
||||
return eNoAction;
|
||||
|
||||
// Return "click" action on elements that have an attached popup menu.
|
||||
if (mContent->IsXULElement())
|
||||
if (mContent->IsXUL())
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::popup))
|
||||
return eClickAction;
|
||||
|
||||
|
||||
@@ -565,7 +565,8 @@ public:
|
||||
|
||||
inline bool IsAbbreviation() const
|
||||
{
|
||||
return mContent->IsAnyOfHTMLElements(nsGkAtoms::abbr, nsGkAtoms::acronym);
|
||||
return mContent->IsHTML() &&
|
||||
(mContent->Tag() == nsGkAtoms::abbr || mContent->Tag() == nsGkAtoms::acronym);
|
||||
}
|
||||
|
||||
bool IsApplication() const { return mType == eApplicationType; }
|
||||
|
||||
@@ -94,7 +94,7 @@ DocAccessible::
|
||||
mPresShell->SetDocAccessible(this);
|
||||
|
||||
// If this is a XUL Document, it should not implement nsHyperText
|
||||
if (mDocumentNode && mDocumentNode->IsXULDocument())
|
||||
if (mDocumentNode && mDocumentNode->IsXUL())
|
||||
mGenericTypes &= ~eHyperText;
|
||||
}
|
||||
|
||||
@@ -877,8 +877,7 @@ DocAccessible::AttributeChangedImpl(Accessible* aAccessible,
|
||||
}
|
||||
|
||||
// ARIA or XUL selection
|
||||
if ((aAccessible->GetContent()->IsXULElement() &&
|
||||
aAttribute == nsGkAtoms::selected) ||
|
||||
if ((aAccessible->GetContent()->IsXUL() && aAttribute == nsGkAtoms::selected) ||
|
||||
aAttribute == nsGkAtoms::aria_selected) {
|
||||
Accessible* widget =
|
||||
nsAccUtils::GetSelectableContainer(aAccessible, aAccessible->State());
|
||||
@@ -1342,7 +1341,7 @@ DocAccessible::ProcessInvalidationList()
|
||||
Accessible*
|
||||
DocAccessible::GetAccessibleEvenIfNotInMap(nsINode* aNode) const
|
||||
{
|
||||
if (!aNode->IsContent() || !aNode->AsContent()->IsHTMLElement(nsGkAtoms::area))
|
||||
if (!aNode->IsContent() || !aNode->AsContent()->IsHTML(nsGkAtoms::area))
|
||||
return GetAccessible(aNode);
|
||||
|
||||
// XXX Bug 135040, incorrect when multiple images use the same map.
|
||||
@@ -1504,13 +1503,15 @@ DocAccessible::AddDependentIDsFor(dom::Element* aRelProviderElm,
|
||||
continue;
|
||||
|
||||
if (relAttr == nsGkAtoms::_for) {
|
||||
if (!aRelProviderElm->IsAnyOfHTMLElements(nsGkAtoms::label,
|
||||
nsGkAtoms::output))
|
||||
if (!aRelProviderElm->IsHTML() ||
|
||||
(aRelProviderElm->Tag() != nsGkAtoms::label &&
|
||||
aRelProviderElm->Tag() != nsGkAtoms::output))
|
||||
continue;
|
||||
|
||||
} else if (relAttr == nsGkAtoms::control) {
|
||||
if (!aRelProviderElm->IsAnyOfXULElements(nsGkAtoms::label,
|
||||
nsGkAtoms::description))
|
||||
if (!aRelProviderElm->IsXUL() ||
|
||||
(aRelProviderElm->Tag() != nsGkAtoms::label &&
|
||||
aRelProviderElm->Tag() != nsGkAtoms::description))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,34 +59,34 @@ NS_IMPL_ISUPPORTS_INHERITED0(HyperTextAccessible, Accessible)
|
||||
role
|
||||
HyperTextAccessible::NativeRole()
|
||||
{
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::dd))
|
||||
nsIAtom *tag = mContent->Tag();
|
||||
|
||||
if (tag == nsGkAtoms::dd)
|
||||
return roles::DEFINITION;
|
||||
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::form))
|
||||
if (tag == nsGkAtoms::form)
|
||||
return roles::FORM;
|
||||
|
||||
if (mContent->IsAnyOfHTMLElements(nsGkAtoms::blockquote,
|
||||
nsGkAtoms::div,
|
||||
nsGkAtoms::section,
|
||||
nsGkAtoms::nav))
|
||||
if (tag == nsGkAtoms::blockquote || tag == nsGkAtoms::div ||
|
||||
tag == nsGkAtoms::section || tag == nsGkAtoms::nav)
|
||||
return roles::SECTION;
|
||||
|
||||
if (mContent->IsAnyOfHTMLElements(nsGkAtoms::h1, nsGkAtoms::h2,
|
||||
nsGkAtoms::h3, nsGkAtoms::h4,
|
||||
nsGkAtoms::h5, nsGkAtoms::h6))
|
||||
if (tag == nsGkAtoms::h1 || tag == nsGkAtoms::h2 ||
|
||||
tag == nsGkAtoms::h3 || tag == nsGkAtoms::h4 ||
|
||||
tag == nsGkAtoms::h5 || tag == nsGkAtoms::h6)
|
||||
return roles::HEADING;
|
||||
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::article))
|
||||
if (tag == nsGkAtoms::article)
|
||||
return roles::DOCUMENT;
|
||||
|
||||
// Deal with html landmark elements
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::header))
|
||||
if (tag == nsGkAtoms::header)
|
||||
return roles::HEADER;
|
||||
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::footer))
|
||||
if (tag == nsGkAtoms::footer)
|
||||
return roles::FOOTER;
|
||||
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::aside))
|
||||
if (tag == nsGkAtoms::aside)
|
||||
return roles::NOTE;
|
||||
|
||||
// Treat block frames as paragraphs
|
||||
@@ -105,7 +105,7 @@ HyperTextAccessible::NativeState()
|
||||
if (mContent->AsElement()->State().HasState(NS_EVENT_STATE_MOZ_READWRITE)) {
|
||||
states |= states::EDITABLE;
|
||||
|
||||
} else if (mContent->IsHTMLElement(nsGkAtoms::article)) {
|
||||
} else if (mContent->Tag() == nsGkAtoms::article) {
|
||||
// We want <article> to behave like a document in terms of readonly state.
|
||||
states |= states::READONLY;
|
||||
}
|
||||
@@ -294,7 +294,7 @@ HyperTextAccessible::DOMPointToOffset(nsINode* aNode, int32_t aNodeOffset,
|
||||
Accessible* descendant = nullptr;
|
||||
if (findNode) {
|
||||
nsCOMPtr<nsIContent> findContent(do_QueryInterface(findNode));
|
||||
if (findContent && findContent->IsHTMLElement() &&
|
||||
if (findContent && findContent->IsHTML() &&
|
||||
findContent->NodeInfo()->Equals(nsGkAtoms::br) &&
|
||||
findContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::mozeditorbogusnode,
|
||||
@@ -900,17 +900,18 @@ HyperTextAccessible::DefaultTextAttributes()
|
||||
int32_t
|
||||
HyperTextAccessible::GetLevelInternal()
|
||||
{
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::h1))
|
||||
nsIAtom *tag = mContent->Tag();
|
||||
if (tag == nsGkAtoms::h1)
|
||||
return 1;
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::h2))
|
||||
if (tag == nsGkAtoms::h2)
|
||||
return 2;
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::h3))
|
||||
if (tag == nsGkAtoms::h3)
|
||||
return 3;
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::h4))
|
||||
if (tag == nsGkAtoms::h4)
|
||||
return 4;
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::h5))
|
||||
if (tag == nsGkAtoms::h5)
|
||||
return 5;
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::h6))
|
||||
if (tag == nsGkAtoms::h6)
|
||||
return 6;
|
||||
|
||||
return AccessibleWrap::GetLevelInternal();
|
||||
@@ -943,13 +944,14 @@ HyperTextAccessible::NativeAttributes()
|
||||
if (!HasOwnContent())
|
||||
return attributes.forget();
|
||||
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::section)) {
|
||||
nsIAtom* tag = mContent->Tag();
|
||||
if (tag == nsGkAtoms::section) {
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles,
|
||||
NS_LITERAL_STRING("region"));
|
||||
} else if (mContent->IsHTMLElement(nsGkAtoms::article)) {
|
||||
} else if (tag == nsGkAtoms::article) {
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles,
|
||||
NS_LITERAL_STRING("article"));
|
||||
} else if (mContent->IsHTMLElement(nsGkAtoms::time)) {
|
||||
} else if (tag == nsGkAtoms::time) {
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles,
|
||||
NS_LITERAL_STRING("time"));
|
||||
|
||||
@@ -968,42 +970,38 @@ HyperTextAccessible::LandmarkRole() const
|
||||
{
|
||||
// For the html landmark elements we expose them like we do ARIA landmarks to
|
||||
// make AT navigation schemes "just work".
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::nav)) {
|
||||
nsIAtom* tag = mContent->Tag();
|
||||
if (tag == nsGkAtoms::nav)
|
||||
return nsGkAtoms::navigation;
|
||||
}
|
||||
|
||||
if (mContent->IsAnyOfHTMLElements(nsGkAtoms::header,
|
||||
nsGkAtoms::footer)) {
|
||||
if (tag == nsGkAtoms::header || tag == nsGkAtoms::footer) {
|
||||
// Only map header and footer if they are not descendants of an article
|
||||
// or section tag.
|
||||
nsIContent* parent = mContent->GetParent();
|
||||
while (parent) {
|
||||
if (parent->IsAnyOfHTMLElements(nsGkAtoms::article, nsGkAtoms::section)) {
|
||||
if (parent->Tag() == nsGkAtoms::article ||
|
||||
parent->Tag() == nsGkAtoms::section)
|
||||
break;
|
||||
}
|
||||
parent = parent->GetParent();
|
||||
}
|
||||
|
||||
// No article or section elements found.
|
||||
if (!parent) {
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::header)) {
|
||||
if (tag == nsGkAtoms::header)
|
||||
return nsGkAtoms::banner;
|
||||
}
|
||||
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::footer)) {
|
||||
if (tag == nsGkAtoms::footer) {
|
||||
return nsGkAtoms::contentinfo;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::aside)) {
|
||||
if (tag == nsGkAtoms::aside)
|
||||
return nsGkAtoms::complementary;
|
||||
}
|
||||
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::main)) {
|
||||
if (tag == nsGkAtoms::main)
|
||||
return nsGkAtoms::main;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@@ -1694,7 +1692,7 @@ HyperTextAccessible::NativeName(nsString& aName)
|
||||
{
|
||||
// Check @alt attribute for invalid img elements.
|
||||
bool hasImgAlt = false;
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::img)) {
|
||||
if (mContent->IsHTML(nsGkAtoms::img)) {
|
||||
hasImgAlt = mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName);
|
||||
if (!aName.IsEmpty())
|
||||
return eNameOK;
|
||||
|
||||
@@ -200,8 +200,7 @@ ImageAccessible::GetLongDescURI() const
|
||||
if (document) {
|
||||
IDRefsIterator iter(document, mContent, nsGkAtoms::aria_describedby);
|
||||
while (nsIContent* target = iter.NextElem()) {
|
||||
if ((target->IsHTMLElement(nsGkAtoms::a) ||
|
||||
target->IsHTMLElement(nsGkAtoms::area)) &&
|
||||
if ((target->IsHTML(nsGkAtoms::a) || target->IsHTML(nsGkAtoms::area)) &&
|
||||
target->HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
||||
nsGenericHTMLElement* element =
|
||||
nsGenericHTMLElement::FromContent(target);
|
||||
|
||||
@@ -92,8 +92,8 @@ RootAccessible::NativeRole()
|
||||
{
|
||||
// If it's a <dialog> or <wizard>, use roles::DIALOG instead
|
||||
dom::Element* rootElm = mDocumentNode->GetRootElement();
|
||||
if (rootElm && rootElm->IsAnyOfXULElements(nsGkAtoms::dialog,
|
||||
nsGkAtoms::wizard))
|
||||
if (rootElm && (rootElm->Tag() == nsGkAtoms::dialog ||
|
||||
rootElm->Tag() == nsGkAtoms::wizard))
|
||||
return roles::DIALOG;
|
||||
|
||||
return DocAccessibleWrap::NativeRole();
|
||||
|
||||
@@ -250,7 +250,7 @@ HTMLButtonAccessible::NativeName(nsString& aName)
|
||||
// type="submit"/"reset"/"image" elements.
|
||||
|
||||
ENameValueFlag nameFlag = Accessible::NativeName(aName);
|
||||
if (!aName.IsEmpty() || !mContent->IsHTMLElement(nsGkAtoms::input) ||
|
||||
if (!aName.IsEmpty() || mContent->Tag() != nsGkAtoms::input ||
|
||||
!mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::image, eCaseMatters))
|
||||
return nameFlag;
|
||||
|
||||
@@ -26,7 +26,7 @@ NS_IMPL_ISUPPORTS_INHERITED0(HTMLListAccessible, HyperTextAccessible)
|
||||
role
|
||||
HTMLListAccessible::NativeRole()
|
||||
{
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::dl))
|
||||
if (mContent->Tag() == nsGkAtoms::dl)
|
||||
return roles::DEFINITION_LIST;
|
||||
|
||||
return roles::LIST;
|
||||
@@ -69,7 +69,7 @@ HTMLLIAccessible::Shutdown()
|
||||
role
|
||||
HTMLLIAccessible::NativeRole()
|
||||
{
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::dt))
|
||||
if (mContent->Tag() == nsGkAtoms::dt)
|
||||
return roles::TERM;
|
||||
|
||||
return roles::LISTITEM;
|
||||
|
||||
@@ -126,12 +126,13 @@ HTMLSelectListAccessible::CacheChildren()
|
||||
// a flat tree under the Select List.
|
||||
for (nsIContent* childContent = mContent->GetFirstChild(); childContent;
|
||||
childContent = childContent->GetNextSibling()) {
|
||||
if (!childContent->IsHTMLElement()) {
|
||||
if (!childContent->IsHTML()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (childContent->IsAnyOfHTMLElements(nsGkAtoms::option,
|
||||
nsGkAtoms::optgroup)) {
|
||||
nsIAtom* tag = childContent->Tag();
|
||||
if (tag == nsGkAtoms::option ||
|
||||
tag == nsGkAtoms::optgroup) {
|
||||
|
||||
// Get an accessible for option or optgroup and cache it.
|
||||
nsRefPtr<Accessible> accessible =
|
||||
|
||||
@@ -929,7 +929,7 @@ HTMLTableAccessible::IsProbablyLayoutTable()
|
||||
RETURN_LAYOUT_ANSWER(false, "Has role attribute, weak role, and role is table");
|
||||
}
|
||||
|
||||
if (!mContent->IsHTMLElement(nsGkAtoms::table))
|
||||
if (mContent->Tag() != nsGkAtoms::table)
|
||||
RETURN_LAYOUT_ANSWER(true, "table built by CSS display:table style");
|
||||
|
||||
// Check if datatable attribute has "0" value.
|
||||
@@ -951,24 +951,24 @@ HTMLTableAccessible::IsProbablyLayoutTable()
|
||||
|
||||
for (nsIContent* childElm = mContent->GetFirstChild(); childElm;
|
||||
childElm = childElm->GetNextSibling()) {
|
||||
if (!childElm->IsHTMLElement())
|
||||
if (!childElm->IsHTML())
|
||||
continue;
|
||||
|
||||
if (childElm->IsAnyOfHTMLElements(nsGkAtoms::col,
|
||||
nsGkAtoms::colgroup,
|
||||
nsGkAtoms::tfoot,
|
||||
nsGkAtoms::thead)) {
|
||||
if (childElm->Tag() == nsGkAtoms::col ||
|
||||
childElm->Tag() == nsGkAtoms::colgroup ||
|
||||
childElm->Tag() == nsGkAtoms::tfoot ||
|
||||
childElm->Tag() == nsGkAtoms::thead) {
|
||||
RETURN_LAYOUT_ANSWER(false,
|
||||
"Has col, colgroup, tfoot or thead -- legitimate table structures");
|
||||
}
|
||||
|
||||
if (childElm->IsHTMLElement(nsGkAtoms::tbody)) {
|
||||
if (childElm->Tag() == nsGkAtoms::tbody) {
|
||||
for (nsIContent* rowElm = childElm->GetFirstChild(); rowElm;
|
||||
rowElm = rowElm->GetNextSibling()) {
|
||||
if (rowElm->IsHTMLElement(nsGkAtoms::tr)) {
|
||||
if (rowElm->IsHTML() && rowElm->Tag() == nsGkAtoms::tr) {
|
||||
for (nsIContent* cellElm = rowElm->GetFirstChild(); cellElm;
|
||||
cellElm = cellElm->GetNextSibling()) {
|
||||
if (cellElm->IsHTMLElement()) {
|
||||
if (cellElm->IsHTML()) {
|
||||
|
||||
if (cellElm->NodeInfo()->Equals(nsGkAtoms::th)) {
|
||||
RETURN_LAYOUT_ANSWER(false,
|
||||
|
||||
@@ -1214,7 +1214,7 @@ AccessibleWrap::HandleAccEvent(AccEvent* aEvent)
|
||||
nsAutoCString id;
|
||||
nsIContent* cnt = accessible->GetContent();
|
||||
if (cnt) {
|
||||
cnt->NodeInfo()->NameAtom()->ToString(tag);
|
||||
cnt->Tag()->ToString(tag);
|
||||
nsIAtom* aid = cnt->GetID();
|
||||
if (aid)
|
||||
aid->ToUTF8String(id);
|
||||
|
||||
@@ -92,7 +92,7 @@ XULLabelAccessible::RelationByType(RelationType aType)
|
||||
if (aType == RelationType::LABEL_FOR) {
|
||||
// Caption is the label for groupbox
|
||||
nsIContent* parent = mContent->GetFlattenedTreeParent();
|
||||
if (parent && parent->IsXULElement(nsGkAtoms::caption)) {
|
||||
if (parent && parent->Tag() == nsGkAtoms::caption) {
|
||||
Accessible* parent = Parent();
|
||||
if (parent && parent->Role() == roles::GROUPING)
|
||||
rel.AppendTarget(parent);
|
||||
|
||||
@@ -182,7 +182,7 @@ XULButtonAccessible::IsAcceptableChild(Accessible* aPossibleChild) const
|
||||
// Button type="menu-button" contains a real button. Get an accessible
|
||||
// for it. Ignore dropmarker button which is placed as a last child.
|
||||
if (role != roles::PUSHBUTTON ||
|
||||
aPossibleChild->GetContent()->IsXULElement(nsGkAtoms::dropMarker))
|
||||
aPossibleChild->GetContent()->Tag() == nsGkAtoms::dropMarker)
|
||||
return false;
|
||||
|
||||
return mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
@@ -569,10 +569,9 @@ bool
|
||||
XULToolbarButtonAccessible::IsSeparator(Accessible* aAccessible)
|
||||
{
|
||||
nsIContent* content = aAccessible->GetContent();
|
||||
return content && content->IsAnyOfXULElements(nsGkAtoms::toolbarseparator,
|
||||
nsGkAtoms::toolbarspacer,
|
||||
nsGkAtoms::toolbarspring);
|
||||
}
|
||||
return content && ((content->Tag() == nsGkAtoms::toolbarseparator) ||
|
||||
(content->Tag() == nsGkAtoms::toolbarspacer) ||
|
||||
(content->Tag() == nsGkAtoms::toolbarspring)); }
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -352,7 +352,11 @@ IsElementAnchor(nsIContent* aContent)
|
||||
{
|
||||
// Make sure we are dealing with either an <A> or <AREA> element in the HTML
|
||||
// or XHTML namespace.
|
||||
return aContent->IsAnyOfHTMLElements(nsGkAtoms::a, nsGkAtoms::area);
|
||||
if (!aContent->IsHTML()) {
|
||||
return false;
|
||||
}
|
||||
nsIAtom* nameAtom = aContent->Tag();
|
||||
return nameAtom == nsGkAtoms::a || nameAtom == nsGkAtoms::area;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2652,7 +2656,7 @@ nsDocShell::GetFullscreenAllowed(bool* aFullscreenAllowed)
|
||||
}
|
||||
nsCOMPtr<Element> frameElement = win->GetFrameElementInternal();
|
||||
if (frameElement &&
|
||||
frameElement->IsHTMLElement(nsGkAtoms::iframe) &&
|
||||
frameElement->IsHTML(nsGkAtoms::iframe) &&
|
||||
!frameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::allowfullscreen) &&
|
||||
!frameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::mozallowfullscreen)) {
|
||||
return NS_OK;
|
||||
@@ -13628,8 +13632,7 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent,
|
||||
// XXX When the linking node was HTMLFormElement, it is synchronous event.
|
||||
// That is, the caller of this method is not |OnLinkClickEvent::Run()|
|
||||
// but |HTMLFormElement::SubmitSubmission(...)|.
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::form) &&
|
||||
ShouldBlockLoadingForBackButton()) {
|
||||
if (nsGkAtoms::form == aContent->Tag() && ShouldBlockLoadingForBackButton()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -13659,7 +13662,7 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent,
|
||||
|
||||
uint32_t flags = INTERNAL_LOAD_FLAGS_NONE;
|
||||
if (IsElementAnchor(aContent)) {
|
||||
MOZ_ASSERT(aContent->IsHTMLElement());
|
||||
MOZ_ASSERT(aContent->IsHTML());
|
||||
nsAutoString referrer;
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::rel, referrer);
|
||||
nsWhitespaceTokenizerTemplate<nsContentUtils::IsHTMLWhitespace> tok(referrer);
|
||||
|
||||
+1
-1
@@ -167,7 +167,7 @@ Attr::GetNameAtom(nsIContent* aContent)
|
||||
if (!mNsAware &&
|
||||
mNodeInfo->NamespaceID() == kNameSpaceID_None &&
|
||||
aContent->IsInHTMLDocument() &&
|
||||
aContent->IsHTMLElement()) {
|
||||
aContent->IsHTML()) {
|
||||
nsString name;
|
||||
mNodeInfo->GetName(name);
|
||||
nsAutoString lowercaseName;
|
||||
|
||||
@@ -58,7 +58,7 @@ GetMatchedNodesForPoint(nsIContent* aContent)
|
||||
}
|
||||
|
||||
// Web components case
|
||||
MOZ_ASSERT(aContent->IsHTMLElement(nsGkAtoms::content));
|
||||
MOZ_ASSERT(aContent->IsHTML(nsGkAtoms::content));
|
||||
return MatchedNodes(static_cast<HTMLContentElement*>(aContent));
|
||||
}
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ static bool
|
||||
DoesNotParticipateInAutoDirection(const Element* aElement)
|
||||
{
|
||||
mozilla::dom::NodeInfo* nodeInfo = aElement->NodeInfo();
|
||||
return (!aElement->IsHTMLElement() ||
|
||||
return (!aElement->IsHTML() ||
|
||||
nodeInfo->Equals(nsGkAtoms::script) ||
|
||||
nodeInfo->Equals(nsGkAtoms::style) ||
|
||||
nodeInfo->Equals(nsGkAtoms::textarea) ||
|
||||
@@ -249,7 +249,7 @@ IsBdiWithoutDirAuto(const Element* aElement)
|
||||
// We are testing for bdi elements without explicit dir="auto", so we can't
|
||||
// use the HasDirAuto() flag, since that will return true for bdi element with
|
||||
// no dir attribute or an invalid dir attribute
|
||||
return (aElement->IsHTMLElement(nsGkAtoms::bdi) &&
|
||||
return (aElement->IsHTML(nsGkAtoms::bdi) &&
|
||||
(!aElement->HasValidDir() || aElement->HasFixedDir()));
|
||||
}
|
||||
|
||||
@@ -931,7 +931,7 @@ void
|
||||
OnSetDirAttr(Element* aElement, const nsAttrValue* aNewValue,
|
||||
bool hadValidDir, bool hadDirAuto, bool aNotify)
|
||||
{
|
||||
if (aElement->IsHTMLElement(nsGkAtoms::input)) {
|
||||
if (aElement->IsHTML(nsGkAtoms::input)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -986,7 +986,7 @@ SetDirOnBind(mozilla::dom::Element* aElement, nsIContent* aParent)
|
||||
// Set the AncestorHasDirAuto flag, unless this element shouldn't affect
|
||||
// ancestors that have dir=auto
|
||||
if (!DoesNotParticipateInAutoDirection(aElement) &&
|
||||
!aElement->IsHTMLElement(nsGkAtoms::bdi) &&
|
||||
!aElement->IsHTML(nsGkAtoms::bdi) &&
|
||||
aParent && aParent->NodeOrAncestorHasDirAuto()) {
|
||||
aElement->SetAncestorHasDirAuto();
|
||||
|
||||
|
||||
+23
-23
@@ -158,7 +158,7 @@ nsIContent::DoGetClasses() const
|
||||
MOZ_ASSERT(HasFlag(NODE_MAY_HAVE_CLASS), "Unexpected call");
|
||||
MOZ_ASSERT(IsElement(), "Only elements can have classes");
|
||||
|
||||
if (IsSVGElement()) {
|
||||
if (IsSVG()) {
|
||||
const nsAttrValue* animClass =
|
||||
static_cast<const nsSVGElement*>(this)->GetAnimatedClassName();
|
||||
if (animClass) {
|
||||
@@ -387,10 +387,10 @@ Element::GetBindingURL(nsIDocument *aDocument, css::URLValue **aResult)
|
||||
// otherwise, don't do anything else here unless we're dealing with
|
||||
// XUL or an HTML element that may have a plugin-related overlay
|
||||
// (i.e. object, embed, or applet).
|
||||
bool isXULorPluginElement = (IsXULElement() ||
|
||||
IsHTMLElement(nsGkAtoms::object) ||
|
||||
IsHTMLElement(nsGkAtoms::embed) ||
|
||||
IsHTMLElement(nsGkAtoms::applet));
|
||||
bool isXULorPluginElement = (IsXUL() ||
|
||||
IsHTML(nsGkAtoms::object) ||
|
||||
IsHTML(nsGkAtoms::embed) ||
|
||||
IsHTML(nsGkAtoms::applet));
|
||||
nsIPresShell *shell = aDocument->GetShell();
|
||||
if (!shell || GetPrimaryFrame() || !isXULorPluginElement) {
|
||||
*aResult = nullptr;
|
||||
@@ -557,7 +557,7 @@ nsIScrollableFrame*
|
||||
Element::GetScrollFrame(nsIFrame **aStyledFrame, bool aFlushLayout)
|
||||
{
|
||||
// it isn't clear what to return for SVG nodes, so just return nothing
|
||||
if (IsSVGElement()) {
|
||||
if (IsSVG()) {
|
||||
if (aStyledFrame) {
|
||||
*aStyledFrame = nullptr;
|
||||
}
|
||||
@@ -837,7 +837,7 @@ static nsSize GetScrollRectSizeForOverflowVisibleFrame(nsIFrame* aFrame)
|
||||
int32_t
|
||||
Element::ScrollHeight()
|
||||
{
|
||||
if (IsSVGElement())
|
||||
if (IsSVG())
|
||||
return 0;
|
||||
|
||||
nsIScrollableFrame* sf = GetScrollFrame();
|
||||
@@ -854,7 +854,7 @@ Element::ScrollHeight()
|
||||
int32_t
|
||||
Element::ScrollWidth()
|
||||
{
|
||||
if (IsSVGElement())
|
||||
if (IsSVG())
|
||||
return 0;
|
||||
|
||||
nsIScrollableFrame* sf = GetScrollFrame();
|
||||
@@ -938,7 +938,7 @@ Element::AddToIdTable(nsIAtom* aId)
|
||||
containingShadow->AddToIdTable(this, aId);
|
||||
} else {
|
||||
nsIDocument* doc = GetUncomposedDoc();
|
||||
if (doc && (!IsInAnonymousSubtree() || doc->IsXULDocument())) {
|
||||
if (doc && (!IsInAnonymousSubtree() || doc->IsXUL())) {
|
||||
doc->AddToIdTable(this, aId);
|
||||
}
|
||||
}
|
||||
@@ -961,7 +961,7 @@ Element::RemoveFromIdTable()
|
||||
}
|
||||
} else {
|
||||
nsIDocument* doc = GetUncomposedDoc();
|
||||
if (doc && (!IsInAnonymousSubtree() || doc->IsXULDocument())) {
|
||||
if (doc && (!IsInAnonymousSubtree() || doc->IsXUL())) {
|
||||
doc->RemoveFromIdTable(this, id);
|
||||
}
|
||||
}
|
||||
@@ -1128,12 +1128,12 @@ Element::GetAttribute(const nsAString& aName, DOMString& aReturn)
|
||||
{
|
||||
const nsAttrValue* val =
|
||||
mAttrsAndChildren.GetAttr(aName,
|
||||
IsHTMLElement() && IsInHTMLDocument() ?
|
||||
IsHTML() && IsInHTMLDocument() ?
|
||||
eIgnoreCase : eCaseMatters);
|
||||
if (val) {
|
||||
val->ToString(aReturn);
|
||||
} else {
|
||||
if (IsXULElement()) {
|
||||
if (IsXUL()) {
|
||||
// XXX should be SetDOMStringToNull(aReturn);
|
||||
// See bug 232598
|
||||
// aReturn is already empty
|
||||
@@ -1157,7 +1157,7 @@ Element::SetAttribute(const nsAString& aName,
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> nameAtom;
|
||||
if (IsHTMLElement() && IsInHTMLDocument()) {
|
||||
if (IsHTML() && IsInHTMLDocument()) {
|
||||
nsAutoString lower;
|
||||
nsContentUtils::ASCIIToLower(aName, lower);
|
||||
nameAtom = do_GetAtom(lower);
|
||||
@@ -1556,7 +1556,7 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
// This has to be here, rather than in nsGenericHTMLElement::BindToTree,
|
||||
// because it has to happen after updating the parent pointer, but before
|
||||
// recursively binding the kids.
|
||||
if (IsHTMLElement()) {
|
||||
if (IsHTML()) {
|
||||
SetDirOnBind(this, aParent);
|
||||
}
|
||||
|
||||
@@ -1622,7 +1622,7 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
AddToIdTable(DoGetID());
|
||||
}
|
||||
|
||||
if (MayHaveStyle() && !IsXULElement()) {
|
||||
if (MayHaveStyle() && !IsXUL()) {
|
||||
// XXXbz if we already have a style attr parsed, this won't do
|
||||
// anything... need to fix that.
|
||||
// If MayHaveStyle() is true, we must be an nsStyledElement
|
||||
@@ -1812,7 +1812,7 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
// This has to be here, rather than in nsGenericHTMLElement::UnbindFromTree,
|
||||
// because it has to happen after unsetting the parent pointer, but before
|
||||
// recursively unbinding the kids.
|
||||
if (IsHTMLElement()) {
|
||||
if (IsHTML()) {
|
||||
ResetDir(this);
|
||||
}
|
||||
|
||||
@@ -2317,7 +2317,7 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
|
||||
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aName == nsGkAtoms::dir) {
|
||||
hadValidDir = HasValidDir() || IsHTMLElement(nsGkAtoms::bdi);
|
||||
hadValidDir = HasValidDir() || IsHTML(nsGkAtoms::bdi);
|
||||
hadDirAuto = HasDirAuto(); // already takes bdi into account
|
||||
}
|
||||
|
||||
@@ -2554,7 +2554,7 @@ Element::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
bool hadDirAuto = false;
|
||||
|
||||
if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::dir) {
|
||||
hadValidDir = HasValidDir() || IsHTMLElement(nsGkAtoms::bdi);
|
||||
hadValidDir = HasValidDir() || IsHTML(nsGkAtoms::bdi);
|
||||
hadDirAuto = HasDirAuto(); // already takes bdi into account
|
||||
}
|
||||
|
||||
@@ -3294,12 +3294,12 @@ Element::SetOuterHTML(const nsAString& aOuterHTML, ErrorResult& aError)
|
||||
return;
|
||||
}
|
||||
|
||||
if (OwnerDoc()->IsHTMLDocument()) {
|
||||
if (OwnerDoc()->IsHTML()) {
|
||||
nsIAtom* localName;
|
||||
int32_t namespaceID;
|
||||
if (parent->IsElement()) {
|
||||
localName = parent->NodeInfo()->NameAtom();
|
||||
namespaceID = parent->NodeInfo()->NamespaceID();
|
||||
localName = static_cast<nsIContent*>(parent.get())->Tag();
|
||||
namespaceID = static_cast<nsIContent*>(parent.get())->GetNameSpaceID();
|
||||
} else {
|
||||
NS_ASSERTION(parent->NodeType() == nsIDOMNode::DOCUMENT_FRAGMENT_NODE,
|
||||
"How come the parent isn't a document, a fragment or an element?");
|
||||
@@ -3391,13 +3391,13 @@ Element::InsertAdjacentHTML(const nsAString& aPosition, const nsAString& aText,
|
||||
mozAutoSubtreeModified subtree(doc, nullptr);
|
||||
|
||||
// Parse directly into destination if possible
|
||||
if (doc->IsHTMLDocument() && !OwnerDoc()->MayHaveDOMMutationObservers() &&
|
||||
if (doc->IsHTML() && !OwnerDoc()->MayHaveDOMMutationObservers() &&
|
||||
(position == eBeforeEnd ||
|
||||
(position == eAfterEnd && !GetNextSibling()) ||
|
||||
(position == eAfterBegin && !GetFirstChild()))) {
|
||||
int32_t oldChildCount = destination->GetChildCount();
|
||||
int32_t contextNs = destination->GetNameSpaceID();
|
||||
nsIAtom* contextLocal = destination->NodeInfo()->NameAtom();
|
||||
nsIAtom* contextLocal = destination->Tag();
|
||||
if (contextLocal == nsGkAtoms::html && contextNs == kNameSpaceID_XHTML) {
|
||||
// For compat with IE6 through IE9. Willful violation of HTML5 as of
|
||||
// 2011-04-06. CreateContextualFragment does the same already.
|
||||
|
||||
+1
-1
@@ -351,7 +351,7 @@ public:
|
||||
// false
|
||||
inline bool HasDirAuto() const {
|
||||
return (!HasFixedDir() &&
|
||||
(HasValidDir() || IsHTMLElement(nsGkAtoms::bdi)));
|
||||
(HasValidDir() || IsHTML(nsGkAtoms::bdi)));
|
||||
}
|
||||
|
||||
Directionality GetComputedDirectionality() const;
|
||||
|
||||
@@ -306,7 +306,7 @@ nsIContent::GetBaseURI(bool aTryUseXHRDocBaseURI) const
|
||||
const nsIContent *elem = this;
|
||||
do {
|
||||
// First check for SVG specialness (why is this SVG specific?)
|
||||
if (elem->IsSVGElement()) {
|
||||
if (elem->IsSVG()) {
|
||||
nsIContent* bindingParent = elem->GetBindingParent();
|
||||
if (bindingParent) {
|
||||
nsXBLBinding* binding = bindingParent->GetXBLBinding();
|
||||
@@ -731,10 +731,10 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
do_QueryInterface(aVisitor.mEvent->originalTarget);
|
||||
nsAutoString ot, ct, rt;
|
||||
if (originalTarget) {
|
||||
originalTarget->NodeInfo()->NameAtom()->ToString(ot);
|
||||
originalTarget->Tag()->ToString(ot);
|
||||
}
|
||||
NodeInfo()->NameAtom()->ToString(ct);
|
||||
relatedTarget->NodeInfo()->NameAtom()->ToString(rt);
|
||||
Tag()->ToString(ct);
|
||||
relatedTarget->Tag()->ToString(rt);
|
||||
printf("Stopping %s propagation:"
|
||||
"\n\toriginalTarget=%s \n\tcurrentTarget=%s %s"
|
||||
"\n\trelatedTarget=%s %s \n%s",
|
||||
@@ -1347,7 +1347,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FragmentOrElement)
|
||||
// which is dispatched in UnbindFromTree.
|
||||
|
||||
if (tmp->HasProperties()) {
|
||||
if (tmp->IsHTMLElement() || tmp->IsSVGElement()) {
|
||||
if (tmp->IsHTML() || tmp->IsSVG()) {
|
||||
nsIAtom*** props = Element::HTMLSVGPropertiesToTraverseAndUnlink();
|
||||
for (uint32_t i = 0; props[i]; ++i) {
|
||||
tmp->DeleteProperty(*props[i]);
|
||||
@@ -1389,7 +1389,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FragmentOrElement)
|
||||
{
|
||||
nsDOMSlots *slots = tmp->GetExistingDOMSlots();
|
||||
if (slots) {
|
||||
slots->Unlink(tmp->IsXULElement());
|
||||
slots->Unlink(tmp->IsXUL());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1899,7 +1899,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(FragmentOrElement)
|
||||
tmp->OwnerDoc()->BindingManager()->Traverse(tmp, cb);
|
||||
|
||||
if (tmp->HasProperties()) {
|
||||
if (tmp->IsHTMLElement() || tmp->IsSVGElement()) {
|
||||
if (tmp->IsHTML() || tmp->IsSVG()) {
|
||||
nsIAtom*** props = Element::HTMLSVGPropertiesToTraverseAndUnlink();
|
||||
for (uint32_t i = 0; props[i]; ++i) {
|
||||
nsISupports* property =
|
||||
@@ -1934,7 +1934,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(FragmentOrElement)
|
||||
{
|
||||
nsDOMSlots *slots = tmp->GetExistingDOMSlots();
|
||||
if (slots) {
|
||||
slots->Traverse(cb, tmp->IsXULElement());
|
||||
slots->Traverse(cb, tmp->IsXUL());
|
||||
}
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
@@ -2428,12 +2428,11 @@ AppendEncodedAttributeValue(nsAutoString* aValue, StringBuilder& aBuilder)
|
||||
static void
|
||||
StartElement(Element* aContent, StringBuilder& aBuilder)
|
||||
{
|
||||
nsIAtom* localName = aContent->NodeInfo()->NameAtom();
|
||||
nsIAtom* localName = aContent->Tag();
|
||||
int32_t tagNS = aContent->GetNameSpaceID();
|
||||
|
||||
aBuilder.Append("<");
|
||||
if (aContent->IsHTMLElement() || aContent->IsSVGElement() ||
|
||||
aContent->IsMathMLElement()) {
|
||||
if (aContent->IsHTML() || aContent->IsSVG() || aContent->IsMathML()) {
|
||||
aBuilder.Append(localName);
|
||||
} else {
|
||||
aBuilder.Append(aContent->NodeName());
|
||||
@@ -2498,7 +2497,7 @@ StartElement(Element* aContent, StringBuilder& aBuilder)
|
||||
// pre/textarea/listing is a textnode and starts with a \n.
|
||||
// But because browsers haven't traditionally had that behavior,
|
||||
// we're not changing our behavior either - yet.
|
||||
if (aContent->IsHTMLElement()) {
|
||||
if (aContent->IsHTML()) {
|
||||
if (localName == nsGkAtoms::pre || localName == nsGkAtoms::textarea ||
|
||||
localName == nsGkAtoms::listing) {
|
||||
nsIContent* fc = aContent->GetFirstChild();
|
||||
@@ -2517,7 +2516,7 @@ StartElement(Element* aContent, StringBuilder& aBuilder)
|
||||
static inline bool
|
||||
ShouldEscape(nsIContent* aParent)
|
||||
{
|
||||
if (!aParent || !aParent->IsHTMLElement()) {
|
||||
if (!aParent || !aParent->IsHTML()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2540,7 +2539,7 @@ ShouldEscape(nsIContent* aParent)
|
||||
}
|
||||
}
|
||||
|
||||
nsIAtom* tag = aParent->NodeInfo()->NameAtom();
|
||||
nsIAtom* tag = aParent->Tag();
|
||||
if (sFilter.mightContain(tag)) {
|
||||
for (uint32_t i = 0; i < ArrayLength(nonEscapingElements); ++i) {
|
||||
if (tag == nonEscapingElements[i]) {
|
||||
@@ -2586,10 +2585,10 @@ IsVoidTag(nsIAtom* aTag)
|
||||
static inline bool
|
||||
IsVoidTag(Element* aElement)
|
||||
{
|
||||
if (!aElement->IsHTMLElement()) {
|
||||
if (!aElement->IsHTML()) {
|
||||
return false;
|
||||
}
|
||||
return IsVoidTag(aElement->NodeInfo()->NameAtom());
|
||||
return IsVoidTag(aElement->Tag());
|
||||
}
|
||||
|
||||
/* static */
|
||||
@@ -2666,9 +2665,8 @@ Serialize(FragmentOrElement* aRoot, bool aDescendentsOnly, nsAString& aOut)
|
||||
if (!isVoid && current->NodeType() == nsIDOMNode::ELEMENT_NODE) {
|
||||
builder.Append("</");
|
||||
nsIContent* elem = static_cast<nsIContent*>(current);
|
||||
if (elem->IsHTMLElement() || elem->IsSVGElement() ||
|
||||
elem->IsMathMLElement()) {
|
||||
builder.Append(elem->NodeInfo()->NameAtom());
|
||||
if (elem->IsHTML() || elem->IsSVG() || elem->IsMathML()) {
|
||||
builder.Append(elem->Tag());
|
||||
} else {
|
||||
builder.Append(current->NodeName());
|
||||
}
|
||||
@@ -2839,17 +2837,17 @@ FragmentOrElement::SetInnerHTMLInternal(const nsAString& aInnerHTML, ErrorResult
|
||||
|
||||
nsAutoScriptLoaderDisabler sld(doc);
|
||||
|
||||
nsIAtom* contextLocalName = NodeInfo()->NameAtom();
|
||||
nsIAtom* contextLocalName = Tag();
|
||||
int32_t contextNameSpaceID = GetNameSpaceID();
|
||||
|
||||
ShadowRoot* shadowRoot = ShadowRoot::FromNode(this);
|
||||
if (shadowRoot) {
|
||||
// Fix up the context to be the host of the ShadowRoot.
|
||||
contextLocalName = shadowRoot->GetHost()->NodeInfo()->NameAtom();
|
||||
contextLocalName = shadowRoot->GetHost()->Tag();
|
||||
contextNameSpaceID = shadowRoot->GetHost()->GetNameSpaceID();
|
||||
}
|
||||
|
||||
if (doc->IsHTMLDocument()) {
|
||||
if (doc->IsHTML()) {
|
||||
int32_t oldChildCount = target->GetChildCount();
|
||||
aError = nsContentUtils::ParseFragmentHTML(aInnerHTML,
|
||||
target,
|
||||
|
||||
+2
-4
@@ -40,10 +40,8 @@ Link::~Link()
|
||||
bool
|
||||
Link::ElementHasHref() const
|
||||
{
|
||||
return ((!mElement->IsSVGElement() &&
|
||||
mElement->HasAttr(kNameSpaceID_None, nsGkAtoms::href))
|
||||
|| (!mElement->IsHTMLElement() &&
|
||||
mElement->HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)));
|
||||
return ((!mElement->IsSVG() && mElement->HasAttr(kNameSpaceID_None, nsGkAtoms::href))
|
||||
|| (!mElement->IsHTML() && mElement->HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -83,7 +83,7 @@ NodeInfo::NodeInfo(nsIAtom *aName, nsIAtom *aPrefix, int32_t aNamespaceID,
|
||||
// Correct the case for HTML
|
||||
if (aNodeType == nsIDOMNode::ELEMENT_NODE &&
|
||||
aNamespaceID == kNameSpaceID_XHTML && GetDocument() &&
|
||||
GetDocument()->IsHTMLDocument()) {
|
||||
GetDocument()->IsHTML()) {
|
||||
nsContentUtils::ASCIIToUpper(mQualifiedName, mNodeName);
|
||||
} else {
|
||||
mNodeName = mQualifiedName;
|
||||
|
||||
@@ -565,7 +565,7 @@ ShadowRoot::ChangePoolHost(nsIContent* aNewHost)
|
||||
bool
|
||||
ShadowRoot::IsShadowInsertionPoint(nsIContent* aContent)
|
||||
{
|
||||
if (aContent && aContent->IsHTMLElement(nsGkAtoms::shadow)) {
|
||||
if (aContent && aContent->IsHTML(nsGkAtoms::shadow)) {
|
||||
HTMLShadowElement* shadowElem = static_cast<HTMLShadowElement*>(aContent);
|
||||
return shadowElem->IsInsertionPoint();
|
||||
}
|
||||
@@ -597,7 +597,7 @@ ShadowRoot::IsPooledNode(nsIContent* aContent, nsIContent* aContainer,
|
||||
return true;
|
||||
}
|
||||
|
||||
if (aContainer && aContainer->IsHTMLElement(nsGkAtoms::content)) {
|
||||
if (aContainer && aContainer->IsHTML(nsGkAtoms::content)) {
|
||||
// Fallback content will end up in pool if its parent is a child of the host.
|
||||
HTMLContentElement* content = static_cast<HTMLContentElement*>(aContainer);
|
||||
return content->IsInsertionPoint() && content->MatchedNodes().IsEmpty() &&
|
||||
|
||||
@@ -472,7 +472,7 @@ TraceActiveWindowGlobal(const uint64_t& aId, nsGlobalWindow*& aWindow, void* aCl
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
nsIDocument* doc = aWindow->GetExtantDoc();
|
||||
if (doc && doc->IsXULDocument()) {
|
||||
if (doc && doc->IsXUL()) {
|
||||
XULDocument* xulDoc = static_cast<XULDocument*>(doc);
|
||||
xulDoc->TraceProtos(closure->mTrc, closure->mGCNumber);
|
||||
}
|
||||
|
||||
@@ -420,7 +420,7 @@ nsContentList::nsContentList(nsINode* aRootNode,
|
||||
// not parser-created and don't need to be flushing stuff under us
|
||||
// to get our kids right.
|
||||
nsIDocument* doc = mRootNode->GetUncomposedDoc();
|
||||
mFlushesNeeded = doc && !doc->IsHTMLDocument();
|
||||
mFlushesNeeded = doc && !doc->IsHTML();
|
||||
}
|
||||
|
||||
nsContentList::nsContentList(nsINode* aRootNode,
|
||||
@@ -453,7 +453,7 @@ nsContentList::nsContentList(nsINode* aRootNode,
|
||||
// not parser-created and don't need to be flushing stuff under us
|
||||
// to get our kids right.
|
||||
nsIDocument* doc = mRootNode->GetUncomposedDoc();
|
||||
mFlushesNeeded = doc && !doc->IsHTMLDocument();
|
||||
mFlushesNeeded = doc && !doc->IsHTML();
|
||||
}
|
||||
|
||||
nsContentList::~nsContentList()
|
||||
@@ -865,7 +865,7 @@ nsContentList::Match(Element *aElement)
|
||||
return toReturn;
|
||||
|
||||
bool matchHTML = aElement->GetNameSpaceID() == kNameSpaceID_XHTML &&
|
||||
aElement->OwnerDoc()->IsHTMLDocument();
|
||||
aElement->OwnerDoc()->IsHTML();
|
||||
|
||||
if (unknown) {
|
||||
return matchHTML ? ni->QualifiedNameEquals(mHTMLMatchAtom) :
|
||||
|
||||
+42
-43
@@ -1526,41 +1526,42 @@ nsContentUtils::IsHTMLWhitespaceOrNBSP(char16_t aChar)
|
||||
|
||||
/* static */
|
||||
bool
|
||||
nsContentUtils::IsHTMLBlock(nsIContent* aContent)
|
||||
nsContentUtils::IsHTMLBlock(nsIAtom* aLocalName)
|
||||
{
|
||||
return aContent->IsAnyOfHTMLElements(nsGkAtoms::address,
|
||||
nsGkAtoms::article,
|
||||
nsGkAtoms::aside,
|
||||
nsGkAtoms::blockquote,
|
||||
nsGkAtoms::center,
|
||||
nsGkAtoms::dir,
|
||||
nsGkAtoms::div,
|
||||
nsGkAtoms::dl, // XXX why not dt and dd?
|
||||
nsGkAtoms::fieldset,
|
||||
nsGkAtoms::figure, // XXX shouldn't figcaption be on this list
|
||||
nsGkAtoms::footer,
|
||||
nsGkAtoms::form,
|
||||
nsGkAtoms::h1,
|
||||
nsGkAtoms::h2,
|
||||
nsGkAtoms::h3,
|
||||
nsGkAtoms::h4,
|
||||
nsGkAtoms::h5,
|
||||
nsGkAtoms::h6,
|
||||
nsGkAtoms::header,
|
||||
nsGkAtoms::hgroup,
|
||||
nsGkAtoms::hr,
|
||||
nsGkAtoms::li,
|
||||
nsGkAtoms::listing,
|
||||
nsGkAtoms::menu,
|
||||
nsGkAtoms::multicol, // XXX get rid of this one?
|
||||
nsGkAtoms::nav,
|
||||
nsGkAtoms::ol,
|
||||
nsGkAtoms::p,
|
||||
nsGkAtoms::pre,
|
||||
nsGkAtoms::section,
|
||||
nsGkAtoms::table,
|
||||
nsGkAtoms::ul,
|
||||
nsGkAtoms::xmp);
|
||||
return
|
||||
(aLocalName == nsGkAtoms::address) ||
|
||||
(aLocalName == nsGkAtoms::article) ||
|
||||
(aLocalName == nsGkAtoms::aside) ||
|
||||
(aLocalName == nsGkAtoms::blockquote) ||
|
||||
(aLocalName == nsGkAtoms::center) ||
|
||||
(aLocalName == nsGkAtoms::dir) ||
|
||||
(aLocalName == nsGkAtoms::div) ||
|
||||
(aLocalName == nsGkAtoms::dl) || // XXX why not dt and dd?
|
||||
(aLocalName == nsGkAtoms::fieldset) ||
|
||||
(aLocalName == nsGkAtoms::figure) || // XXX shouldn't figcaption be on this list
|
||||
(aLocalName == nsGkAtoms::footer) ||
|
||||
(aLocalName == nsGkAtoms::form) ||
|
||||
(aLocalName == nsGkAtoms::h1) ||
|
||||
(aLocalName == nsGkAtoms::h2) ||
|
||||
(aLocalName == nsGkAtoms::h3) ||
|
||||
(aLocalName == nsGkAtoms::h4) ||
|
||||
(aLocalName == nsGkAtoms::h5) ||
|
||||
(aLocalName == nsGkAtoms::h6) ||
|
||||
(aLocalName == nsGkAtoms::header) ||
|
||||
(aLocalName == nsGkAtoms::hgroup) ||
|
||||
(aLocalName == nsGkAtoms::hr) ||
|
||||
(aLocalName == nsGkAtoms::li) ||
|
||||
(aLocalName == nsGkAtoms::listing) ||
|
||||
(aLocalName == nsGkAtoms::menu) ||
|
||||
(aLocalName == nsGkAtoms::multicol) || // XXX get rid of this one?
|
||||
(aLocalName == nsGkAtoms::nav) ||
|
||||
(aLocalName == nsGkAtoms::ol) ||
|
||||
(aLocalName == nsGkAtoms::p) ||
|
||||
(aLocalName == nsGkAtoms::pre) ||
|
||||
(aLocalName == nsGkAtoms::section) ||
|
||||
(aLocalName == nsGkAtoms::table) ||
|
||||
(aLocalName == nsGkAtoms::ul) ||
|
||||
(aLocalName == nsGkAtoms::xmp);
|
||||
}
|
||||
|
||||
/* static */
|
||||
@@ -2563,8 +2564,7 @@ nsContentUtils::GenerateStateKey(nsIContent* aContent,
|
||||
// we can't figure out form info. Append the tag name if it's an element
|
||||
// to avoid restoring state for one type of element on another type.
|
||||
if (aContent->IsElement()) {
|
||||
KeyAppendString(nsDependentAtomString(aContent->NodeInfo()->NameAtom()),
|
||||
aKey);
|
||||
KeyAppendString(nsDependentAtomString(aContent->Tag()), aKey);
|
||||
}
|
||||
else {
|
||||
// Append a character that is not "d" or "f" to disambiguate from
|
||||
@@ -4123,7 +4123,7 @@ nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
|
||||
// If we don't have a document here, we can't get the right security context
|
||||
// for compiling event handlers... so just bail out.
|
||||
nsCOMPtr<nsIDocument> document = aContextNode->OwnerDoc();
|
||||
bool isHTML = document->IsHTMLDocument();
|
||||
bool isHTML = document->IsHTML();
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(document);
|
||||
NS_ASSERTION(!isHTML || htmlDoc, "Should have HTMLDocument here!");
|
||||
@@ -4142,9 +4142,9 @@ nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
|
||||
}
|
||||
}
|
||||
|
||||
if (contextAsContent && !contextAsContent->IsHTMLElement(nsGkAtoms::html)) {
|
||||
if (contextAsContent && !contextAsContent->IsHTML(nsGkAtoms::html)) {
|
||||
aRv = ParseFragmentHTML(aFragment, frag,
|
||||
contextAsContent->NodeInfo()->NameAtom(),
|
||||
contextAsContent->Tag(),
|
||||
contextAsContent->GetNameSpaceID(),
|
||||
(document->GetCompatibilityMode() ==
|
||||
eCompatibility_NavQuirks),
|
||||
@@ -4771,9 +4771,8 @@ nsContentUtils::TriggerLink(nsIContent *aContent, nsPresContext *aPresContext,
|
||||
// as downloadable. If this check fails we will just do the normal thing
|
||||
// (i.e. navigate to the resource).
|
||||
nsAutoString fileName;
|
||||
if ((!aContent->IsHTMLElement(nsGkAtoms::a) &&
|
||||
!aContent->IsHTMLElement(nsGkAtoms::area) &&
|
||||
!aContent->IsSVGElement(nsGkAtoms::a)) ||
|
||||
if ((!aContent->IsHTML(nsGkAtoms::a) && !aContent->IsHTML(nsGkAtoms::area) &&
|
||||
!aContent->IsSVG(nsGkAtoms::a)) ||
|
||||
!aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::download, fileName) ||
|
||||
NS_FAILED(aContent->NodePrincipal()->CheckMayLoad(aLinkURI, false, true))) {
|
||||
fileName.SetIsVoid(true); // No actionable download attribute was found.
|
||||
@@ -6944,7 +6943,7 @@ nsContentUtils::IsContentInsertionPoint(const nsIContent* aContent)
|
||||
}
|
||||
|
||||
// Check if the content is a web components content insertion point.
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::content)) {
|
||||
if (aContent->IsHTML(nsGkAtoms::content)) {
|
||||
return static_cast<const HTMLContentElement*>(aContent)->IsInsertionPoint();
|
||||
}
|
||||
|
||||
|
||||
@@ -361,7 +361,7 @@ public:
|
||||
/**
|
||||
* Is the HTML local name a block element?
|
||||
*/
|
||||
static bool IsHTMLBlock(nsIContent* aContent);
|
||||
static bool IsHTMLBlock(nsIAtom* aLocalName);
|
||||
|
||||
enum ParseHTMLIntegerResultFlags {
|
||||
eParseHTMLInteger_NoFlags = 0,
|
||||
|
||||
@@ -510,7 +510,7 @@ static nsresult AppendDOMNode(nsITransferable *aTransferable,
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(document, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, NS_OK);
|
||||
|
||||
NS_ENSURE_TRUE(document->IsHTMLDocument(), NS_OK);
|
||||
NS_ENSURE_TRUE(document->IsHTML(), NS_OK);
|
||||
|
||||
// init encoder with document and node
|
||||
rv = docEncoder->NativeInit(document, NS_LITERAL_STRING(kHTMLMime),
|
||||
|
||||
@@ -1656,18 +1656,20 @@ nsDOMWindowUtils::GetTranslationNodes(nsIDOMNode* aRoot,
|
||||
// skip the root tag from being a translation node.
|
||||
nsIContent* content = root;
|
||||
while ((limit > 0) && (content = content->GetNextNode(root))) {
|
||||
if (!content->IsHTMLElement()) {
|
||||
if (!content->IsHTML()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
nsIAtom* localName = content->Tag();
|
||||
|
||||
// Skip elements that usually contain non-translatable text content.
|
||||
if (content->IsAnyOfHTMLElements(nsGkAtoms::script,
|
||||
nsGkAtoms::iframe,
|
||||
nsGkAtoms::frameset,
|
||||
nsGkAtoms::frame,
|
||||
nsGkAtoms::code,
|
||||
nsGkAtoms::noscript,
|
||||
nsGkAtoms::style)) {
|
||||
if (localName == nsGkAtoms::script ||
|
||||
localName == nsGkAtoms::iframe ||
|
||||
localName == nsGkAtoms::frameset ||
|
||||
localName == nsGkAtoms::frame ||
|
||||
localName == nsGkAtoms::code ||
|
||||
localName == nsGkAtoms::noscript ||
|
||||
localName == nsGkAtoms::style) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
+19
-16
@@ -626,7 +626,7 @@ nsIdentifierMapEntry::RemoveIdElement(Element* aElement)
|
||||
// This could fire in OOM situations
|
||||
// Only assert this in HTML documents for now as XUL does all sorts of weird
|
||||
// crap.
|
||||
NS_ASSERTION(!aElement->OwnerDoc()->IsHTMLDocument() ||
|
||||
NS_ASSERTION(!aElement->OwnerDoc()->IsHTML() ||
|
||||
mIdContentList.IndexOf(aElement) >= 0,
|
||||
"Removing id entry that doesn't exist");
|
||||
|
||||
@@ -5473,7 +5473,7 @@ nsIDocument::CreateElement(const nsAString& aTagName, ErrorResult& rv)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool needsLowercase = IsHTMLDocument() && !IsLowercaseASCII(aTagName);
|
||||
bool needsLowercase = IsHTML() && !IsLowercaseASCII(aTagName);
|
||||
nsAutoString lcTagName;
|
||||
if (needsLowercase) {
|
||||
nsContentUtils::ASCIIToLower(aTagName, lcTagName);
|
||||
@@ -5497,7 +5497,7 @@ nsDocument::SetupCustomElement(Element* aElement,
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> tagAtom = aElement->NodeInfo()->NameAtom();
|
||||
nsCOMPtr<nsIAtom> tagAtom = aElement->Tag();
|
||||
nsCOMPtr<nsIAtom> typeAtom = aTypeExtension ?
|
||||
do_GetAtom(*aTypeExtension) : tagAtom;
|
||||
|
||||
@@ -5676,7 +5676,7 @@ already_AddRefed<CDATASection>
|
||||
nsIDocument::CreateCDATASection(const nsAString& aData,
|
||||
ErrorResult& rv)
|
||||
{
|
||||
if (IsHTMLDocument()) {
|
||||
if (IsHTML()) {
|
||||
rv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -6134,7 +6134,7 @@ nsDocument::RegisterElement(JSContext* aCx, const nsAString& aType,
|
||||
// Only convert NAME to lowercase in HTML documents. Note that NAME is
|
||||
// options.extends.
|
||||
nsAutoString lcName;
|
||||
if (IsHTMLDocument()) {
|
||||
if (IsHTML()) {
|
||||
nsContentUtils::ASCIIToLower(aOptions.mExtends, lcName);
|
||||
} else {
|
||||
lcName.Assign(aOptions.mExtends);
|
||||
@@ -6327,12 +6327,15 @@ nsDocument::RegisterElement(JSContext* aCx, const nsAString& aType,
|
||||
// Make sure that the element name matches the name in the definition.
|
||||
// (e.g. a definition for x-button extending button should match
|
||||
// <button is="x-button"> but not <x-button>.
|
||||
if (elem->NodeInfo()->NameAtom() != nameAtom) {
|
||||
// Note: we also check the tag name, because if it's not the above
|
||||
// mentioned case, it can be that only the |is| property has been
|
||||
// changed, which we should ignore by the spec.
|
||||
if (elem->NodeInfo()->NameAtom() != nameAtom &&
|
||||
elem->Tag() == nameAtom) {
|
||||
//Skip over this element because definition does not apply.
|
||||
continue;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(elem->IsHTMLElement(nameAtom));
|
||||
nsWrapperCache* cache;
|
||||
CallQueryInterface(elem, &cache);
|
||||
MOZ_ASSERT(cache, "Element doesn't support wrapper cache?");
|
||||
@@ -6999,7 +7002,7 @@ Element*
|
||||
nsIDocument::GetHtmlElement() const
|
||||
{
|
||||
Element* rootElement = GetRootElement();
|
||||
if (rootElement && rootElement->IsHTMLElement(nsGkAtoms::html))
|
||||
if (rootElement && rootElement->IsHTML(nsGkAtoms::html))
|
||||
return rootElement;
|
||||
return nullptr;
|
||||
}
|
||||
@@ -7016,7 +7019,7 @@ nsIDocument::GetHtmlChildElement(nsIAtom* aTag)
|
||||
for (nsIContent* child = html->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsHTMLElement(aTag))
|
||||
if (child->IsHTML(aTag))
|
||||
return child->AsElement();
|
||||
}
|
||||
return nullptr;
|
||||
@@ -7076,7 +7079,7 @@ nsDocument::GetTitle(nsString& aTitle)
|
||||
break;
|
||||
#endif
|
||||
case kNameSpaceID_SVG:
|
||||
if (rootElement->IsSVGElement(nsGkAtoms::svg)) {
|
||||
if (rootElement->Tag() == nsGkAtoms::svg) {
|
||||
GetTitleFromElement(kNameSpaceID_SVG, tmp);
|
||||
break;
|
||||
} // else fall through
|
||||
@@ -7203,7 +7206,7 @@ nsDocument::GetBoxObjectFor(Element* aElement, ErrorResult& aRv)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!mHasWarnedAboutBoxObjects && !aElement->IsXULElement()) {
|
||||
if (!mHasWarnedAboutBoxObjects && !aElement->IsXUL()) {
|
||||
mHasWarnedAboutBoxObjects = true;
|
||||
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||
NS_LITERAL_CSTRING("BoxObjects"), this,
|
||||
@@ -8154,7 +8157,7 @@ nsDocument::FlushPendingNotifications(mozFlushType aType)
|
||||
// make sure that layout is started as needed. But we can skip that
|
||||
// part if we have no presshell or if it's already done an initial
|
||||
// reflow.
|
||||
if ((!IsHTMLDocument() ||
|
||||
if ((!IsHTML() ||
|
||||
(aType > Flush_ContentAndNotify && mPresShell &&
|
||||
!mPresShell->DidInitialize())) &&
|
||||
(mParser || mWeakSink)) {
|
||||
@@ -8327,7 +8330,7 @@ nsRadioGroupStruct*
|
||||
nsDocument::GetRadioGroupInternal(const nsAString& aName) const
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (IsHTMLDocument()) {
|
||||
if (IsHTML()) {
|
||||
nsAutoString lcName;
|
||||
ToLowerCase(aName, lcName);
|
||||
MOZ_ASSERT(aName == lcName);
|
||||
@@ -8346,7 +8349,7 @@ nsRadioGroupStruct*
|
||||
nsDocument::GetRadioGroup(const nsAString& aName) const
|
||||
{
|
||||
nsAutoString tmKey(aName);
|
||||
if (IsHTMLDocument()) {
|
||||
if (IsHTML()) {
|
||||
ToLowerCase(tmKey); //should case-insensitive.
|
||||
}
|
||||
|
||||
@@ -8357,7 +8360,7 @@ nsRadioGroupStruct*
|
||||
nsDocument::GetOrCreateRadioGroup(const nsAString& aName)
|
||||
{
|
||||
nsAutoString tmKey(aName);
|
||||
if (IsHTMLDocument()) {
|
||||
if (IsHTML()) {
|
||||
ToLowerCase(tmKey); //should case-insensitive.
|
||||
}
|
||||
|
||||
@@ -8427,7 +8430,7 @@ nsDocument::GetNextRadioButton(const nsAString& aName,
|
||||
else if (++index >= numRadios) {
|
||||
index = 0;
|
||||
}
|
||||
NS_ASSERTION(static_cast<nsGenericHTMLFormElement*>(radioGroup->mRadioButtons[index])->IsHTMLElement(nsGkAtoms::input),
|
||||
NS_ASSERTION(static_cast<nsGenericHTMLFormElement*>(radioGroup->mRadioButtons[index])->IsHTML(nsGkAtoms::input),
|
||||
"mRadioButtons holding a non-radio button");
|
||||
radio = static_cast<HTMLInputElement*>(radioGroup->mRadioButtons[index]);
|
||||
} while (radio->Disabled() && radio != currentRadio);
|
||||
|
||||
@@ -134,6 +134,8 @@ protected:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool IsTag(nsIContent* aContent, nsIAtom* aAtom);
|
||||
|
||||
virtual bool IncludeInContext(nsINode *aNode);
|
||||
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
@@ -528,7 +530,7 @@ nsDocumentEncoder::SerializeToStringIterative(nsINode* aNode,
|
||||
current->NodeType() == nsIDOMNode::DOCUMENT_FRAGMENT_NODE) {
|
||||
DocumentFragment* frag = static_cast<DocumentFragment*>(current);
|
||||
nsIContent* host = frag->GetHost();
|
||||
if (host && host->IsHTMLElement(nsGkAtoms::_template)) {
|
||||
if (host && host->IsHTML(nsGkAtoms::_template)) {
|
||||
current = host;
|
||||
}
|
||||
}
|
||||
@@ -539,6 +541,12 @@ nsDocumentEncoder::SerializeToStringIterative(nsINode* aNode,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsDocumentEncoder::IsTag(nsIContent* aContent, nsIAtom* aAtom)
|
||||
{
|
||||
return aContent && aContent->Tag() == aAtom;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
ConvertAndWrite(const nsAString& aString,
|
||||
nsIOutputStream* aStream,
|
||||
@@ -1024,7 +1032,7 @@ static bool ParentIsTR(nsIContent* aContent) {
|
||||
if (!parent) {
|
||||
return false;
|
||||
}
|
||||
return parent->IsHTMLElement(nsGkAtoms::tr);
|
||||
return parent->IsHTML(nsGkAtoms::tr);
|
||||
}
|
||||
|
||||
|
||||
@@ -1094,7 +1102,7 @@ nsDocumentEncoder::EncodeToStringWithMaxLength(uint32_t aMaxLength,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(node);
|
||||
if (content && content->IsHTMLElement(nsGkAtoms::tr) && !ParentIsTR(content)) {
|
||||
if (content && content->IsHTML(nsGkAtoms::tr) && !ParentIsTR(content)) {
|
||||
nsINode* n = content;
|
||||
if (!prevNode) {
|
||||
// Went from a non-<tr> to a <tr>
|
||||
@@ -1379,7 +1387,9 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection)
|
||||
selContent = selContent->GetParent())
|
||||
{
|
||||
// checking for selection inside a plaintext form widget
|
||||
if (selContent->IsAnyOfHTMLElements(nsGkAtoms::input, nsGkAtoms::textarea))
|
||||
nsIAtom *atom = selContent->Tag();
|
||||
if (atom == nsGkAtoms::input ||
|
||||
atom == nsGkAtoms::textarea)
|
||||
{
|
||||
mIsTextWidget = true;
|
||||
break;
|
||||
@@ -1400,7 +1410,7 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection)
|
||||
|
||||
// also consider ourselves in a text widget if we can't find an html document
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(mDocument);
|
||||
if (!(htmlDoc && mDocument->IsHTMLDocument())) {
|
||||
if (!(htmlDoc && mDocument->IsHTML())) {
|
||||
mIsTextWidget = true;
|
||||
mSelection = aSelection;
|
||||
// mMimeType is set to text/plain when encoding starts.
|
||||
@@ -1513,32 +1523,34 @@ nsHTMLCopyEncoder::IncludeInContext(nsINode *aNode)
|
||||
if (!content)
|
||||
return false;
|
||||
|
||||
return content->IsAnyOfHTMLElements(nsGkAtoms::b,
|
||||
nsGkAtoms::i,
|
||||
nsGkAtoms::u,
|
||||
nsGkAtoms::a,
|
||||
nsGkAtoms::tt,
|
||||
nsGkAtoms::s,
|
||||
nsGkAtoms::big,
|
||||
nsGkAtoms::small,
|
||||
nsGkAtoms::strike,
|
||||
nsGkAtoms::em,
|
||||
nsGkAtoms::strong,
|
||||
nsGkAtoms::dfn,
|
||||
nsGkAtoms::code,
|
||||
nsGkAtoms::cite,
|
||||
nsGkAtoms::var,
|
||||
nsGkAtoms::abbr,
|
||||
nsGkAtoms::font,
|
||||
nsGkAtoms::script,
|
||||
nsGkAtoms::span,
|
||||
nsGkAtoms::pre,
|
||||
nsGkAtoms::h1,
|
||||
nsGkAtoms::h2,
|
||||
nsGkAtoms::h3,
|
||||
nsGkAtoms::h4,
|
||||
nsGkAtoms::h5,
|
||||
nsGkAtoms::h6);
|
||||
nsIAtom *tag = content->Tag();
|
||||
|
||||
return (tag == nsGkAtoms::b ||
|
||||
tag == nsGkAtoms::i ||
|
||||
tag == nsGkAtoms::u ||
|
||||
tag == nsGkAtoms::a ||
|
||||
tag == nsGkAtoms::tt ||
|
||||
tag == nsGkAtoms::s ||
|
||||
tag == nsGkAtoms::big ||
|
||||
tag == nsGkAtoms::small ||
|
||||
tag == nsGkAtoms::strike ||
|
||||
tag == nsGkAtoms::em ||
|
||||
tag == nsGkAtoms::strong ||
|
||||
tag == nsGkAtoms::dfn ||
|
||||
tag == nsGkAtoms::code ||
|
||||
tag == nsGkAtoms::cite ||
|
||||
tag == nsGkAtoms::var ||
|
||||
tag == nsGkAtoms::abbr ||
|
||||
tag == nsGkAtoms::font ||
|
||||
tag == nsGkAtoms::script ||
|
||||
tag == nsGkAtoms::span ||
|
||||
tag == nsGkAtoms::pre ||
|
||||
tag == nsGkAtoms::h1 ||
|
||||
tag == nsGkAtoms::h2 ||
|
||||
tag == nsGkAtoms::h3 ||
|
||||
tag == nsGkAtoms::h4 ||
|
||||
tag == nsGkAtoms::h5 ||
|
||||
tag == nsGkAtoms::h6);
|
||||
}
|
||||
|
||||
|
||||
@@ -1702,11 +1714,10 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t
|
||||
if (bResetPromotion)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(parent);
|
||||
if (content && content->IsHTMLElement())
|
||||
if (content)
|
||||
{
|
||||
bool isBlock = false;
|
||||
parserService->IsBlock(parserService->HTMLAtomTagToId(
|
||||
content->NodeInfo()->NameAtom()), isBlock);
|
||||
parserService->IsBlock(parserService->HTMLAtomTagToId(content->Tag()), isBlock);
|
||||
if (isBlock)
|
||||
{
|
||||
bResetPromotion = false;
|
||||
@@ -1785,11 +1796,10 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t
|
||||
if (bResetPromotion)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(parent);
|
||||
if (content && content->IsHTMLElement())
|
||||
if (content)
|
||||
{
|
||||
bool isBlock = false;
|
||||
parserService->IsBlock(parserService->HTMLAtomTagToId(
|
||||
content->NodeInfo()->NameAtom()), isBlock);
|
||||
parserService->IsBlock(parserService->HTMLAtomTagToId(content->Tag()), isBlock);
|
||||
if (isBlock)
|
||||
{
|
||||
bResetPromotion = false;
|
||||
@@ -1848,7 +1858,7 @@ nsHTMLCopyEncoder::IsMozBR(nsIDOMNode* aNode)
|
||||
MOZ_ASSERT(aNode);
|
||||
nsCOMPtr<Element> element = do_QueryInterface(aNode);
|
||||
return element &&
|
||||
element->IsHTMLElement(nsGkAtoms::br) &&
|
||||
element->IsHTML(nsGkAtoms::br) &&
|
||||
element->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
NS_LITERAL_STRING("_moz"), eIgnoreCase);
|
||||
}
|
||||
@@ -1880,17 +1890,16 @@ bool
|
||||
nsHTMLCopyEncoder::IsRoot(nsIDOMNode* aNode)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
||||
if (!content) {
|
||||
return false;
|
||||
}
|
||||
if (content)
|
||||
{
|
||||
if (mIsTextWidget)
|
||||
return (IsTag(content, nsGkAtoms::div));
|
||||
|
||||
if (mIsTextWidget) {
|
||||
return content->IsHTMLElement(nsGkAtoms::div);
|
||||
return (IsTag(content, nsGkAtoms::body) ||
|
||||
IsTag(content, nsGkAtoms::td) ||
|
||||
IsTag(content, nsGkAtoms::th));
|
||||
}
|
||||
|
||||
return content->IsAnyOfHTMLElements(nsGkAtoms::body,
|
||||
nsGkAtoms::td,
|
||||
nsGkAtoms::th);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -2008,12 +2017,11 @@ nsHTMLCopyEncoder::GetImmediateContextCount(const nsTArray<nsINode*>& aAncestorA
|
||||
break;
|
||||
}
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
||||
if (!content ||
|
||||
!content->IsAnyOfHTMLElements(nsGkAtoms::tr,
|
||||
nsGkAtoms::thead,
|
||||
nsGkAtoms::tbody,
|
||||
nsGkAtoms::tfoot,
|
||||
nsGkAtoms::table)) {
|
||||
if (!content || !content->IsHTML() || (content->Tag() != nsGkAtoms::tr &&
|
||||
content->Tag() != nsGkAtoms::thead &&
|
||||
content->Tag() != nsGkAtoms::tbody &&
|
||||
content->Tag() != nsGkAtoms::tfoot &&
|
||||
content->Tag() != nsGkAtoms::table)) {
|
||||
break;
|
||||
}
|
||||
++j;
|
||||
|
||||
+12
-11
@@ -84,7 +84,7 @@ PRLogModuleInfo* gFocusNavigationLog;
|
||||
{ \
|
||||
nsAutoCString tag(NS_LITERAL_CSTRING("(none)")); \
|
||||
if (content) { \
|
||||
content->NodeInfo()->NameAtom()->ToUTF8String(tag); \
|
||||
content->Tag()->ToUTF8String(tag); \
|
||||
} \
|
||||
PR_LOG(log, 4, (format, tag.get())); \
|
||||
}
|
||||
@@ -316,7 +316,7 @@ nsIContent*
|
||||
nsFocusManager::GetRedirectedFocus(nsIContent* aContent)
|
||||
{
|
||||
#ifdef MOZ_XUL
|
||||
if (aContent->IsXULElement()) {
|
||||
if (aContent->IsXUL()) {
|
||||
nsCOMPtr<nsIDOMNode> inputField;
|
||||
|
||||
nsCOMPtr<nsIDOMXULTextBoxElement> textbox = do_QueryInterface(aContent);
|
||||
@@ -328,7 +328,7 @@ nsFocusManager::GetRedirectedFocus(nsIContent* aContent)
|
||||
if (menulist) {
|
||||
menulist->GetInputField(getter_AddRefs(inputField));
|
||||
}
|
||||
else if (aContent->IsXULElement(nsGkAtoms::scale)) {
|
||||
else if (aContent->Tag() == nsGkAtoms::scale) {
|
||||
nsCOMPtr<nsIDocument> doc = aContent->GetComposedDoc();
|
||||
if (!doc)
|
||||
return nullptr;
|
||||
@@ -336,7 +336,7 @@ nsFocusManager::GetRedirectedFocus(nsIContent* aContent)
|
||||
nsINodeList* children = doc->BindingManager()->GetAnonymousNodesFor(aContent);
|
||||
if (children) {
|
||||
nsIContent* child = children->Item(0);
|
||||
if (child && child->IsXULElement(nsGkAtoms::slider))
|
||||
if (child && child->Tag() == nsGkAtoms::slider)
|
||||
return child;
|
||||
}
|
||||
}
|
||||
@@ -1552,7 +1552,7 @@ nsFocusManager::CheckIfFocusable(nsIContent* aContent, uint32_t aFlags)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::area)) {
|
||||
if (aContent->Tag() == nsGkAtoms::area && aContent->IsHTML()) {
|
||||
// HTML areas do not have their own frame, and the img frame we get from
|
||||
// GetPrimaryFrame() is not relevant as to whether it is focusable or
|
||||
// not, so we have to do all the relevant checks manually for them.
|
||||
@@ -2503,7 +2503,8 @@ nsFocusManager::DetermineElementToMoveFocus(nsPIDOMWindow* aWindow,
|
||||
int32_t tabIndex = forward ? 1 : 0;
|
||||
if (startContent) {
|
||||
nsIFrame* frame = startContent->GetPrimaryFrame();
|
||||
if (startContent->IsHTMLElement(nsGkAtoms::area))
|
||||
if (startContent->Tag() == nsGkAtoms::area &&
|
||||
startContent->IsHTML())
|
||||
startContent->IsFocusable(&tabIndex);
|
||||
else if (frame)
|
||||
frame->IsFocusable(&tabIndex, 0);
|
||||
@@ -2811,8 +2812,8 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
|
||||
}
|
||||
}
|
||||
else if (getNextFrame &&
|
||||
(!iterStartContent ||
|
||||
!iterStartContent->IsHTMLElement(nsGkAtoms::area))) {
|
||||
(!iterStartContent || iterStartContent->Tag() != nsGkAtoms::area ||
|
||||
!iterStartContent->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)
|
||||
@@ -2841,7 +2842,7 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
|
||||
nsIContent* currentContent = frame->GetContent();
|
||||
if (tabIndex >= 0) {
|
||||
NS_ASSERTION(currentContent, "IsFocusable set a tabindex for a frame with no content");
|
||||
if (currentContent->IsHTMLElement(nsGkAtoms::img) &&
|
||||
if (currentContent->Tag() == nsGkAtoms::img &&
|
||||
currentContent->HasAttr(kNameSpaceID_None, nsGkAtoms::usemap)) {
|
||||
// This is an image with a map. Image map areas are not traversed by
|
||||
// nsIFrameTraversal so look for the next or previous area element.
|
||||
@@ -3074,7 +3075,7 @@ nsFocusManager::GetRootForFocus(nsPIDOMWindow* aWindow,
|
||||
nsCOMPtr<Element> docElement = aWindow->GetFrameElementInternal();
|
||||
// document navigation skips iframes and frames that are specifically non-focusable
|
||||
if (docElement) {
|
||||
if (docElement->NodeInfo()->NameAtom() == nsGkAtoms::iframe)
|
||||
if (docElement->Tag() == nsGkAtoms::iframe)
|
||||
return nullptr;
|
||||
|
||||
nsIFrame* frame = docElement->GetPrimaryFrame();
|
||||
@@ -3227,7 +3228,7 @@ nsFocusManager::GetNextTabbablePanel(nsIDocument* aDocument, nsIFrame* aCurrentP
|
||||
}
|
||||
|
||||
// Skip over non-panels
|
||||
if (!popupFrame->GetContent()->IsXULElement(nsGkAtoms::panel) ||
|
||||
if (popupFrame->GetContent()->Tag() != nsGkAtoms::panel ||
|
||||
(aDocument && popupFrame->GetContent()->GetComposedDoc() != aDocument)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ nsFrameLoader::LoadFrame()
|
||||
|
||||
nsAutoString src;
|
||||
|
||||
bool isSrcdoc = mOwnerContent->IsHTMLElement(nsGkAtoms::iframe) &&
|
||||
bool isSrcdoc = mOwnerContent->IsHTML(nsGkAtoms::iframe) &&
|
||||
mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::srcdoc);
|
||||
if (isSrcdoc) {
|
||||
src.AssignLiteral("about:srcdoc");
|
||||
@@ -222,7 +222,7 @@ nsFrameLoader::LoadFrame()
|
||||
// If the frame is a XUL element and has the attribute 'nodefaultsrc=true'
|
||||
// then we will not use 'about:blank' as fallback but return early without
|
||||
// starting a load if no 'src' attribute is given (or it's empty).
|
||||
if (mOwnerContent->IsXULElement() &&
|
||||
if (mOwnerContent->IsXUL() &&
|
||||
mOwnerContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::nodefaultsrc,
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
return NS_OK;
|
||||
@@ -402,7 +402,7 @@ nsFrameLoader::ReallyStartLoadingInternal()
|
||||
nsCOMPtr<nsIURI> referrer;
|
||||
|
||||
nsAutoString srcdoc;
|
||||
bool isSrcdoc = mOwnerContent->IsHTMLElement(nsGkAtoms::iframe) &&
|
||||
bool isSrcdoc = mOwnerContent->IsHTML(nsGkAtoms::iframe) &&
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::srcdoc,
|
||||
srcdoc);
|
||||
|
||||
@@ -1729,7 +1729,7 @@ nsFrameLoader::MaybeCreateDocShell()
|
||||
}
|
||||
|
||||
if (mIsTopLevelContent &&
|
||||
mOwnerContent->IsXULElement(nsGkAtoms::browser) &&
|
||||
mOwnerContent->IsXUL(nsGkAtoms::browser) &&
|
||||
!mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disablehistory)) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISHistory> sessionHistory =
|
||||
@@ -1815,7 +1815,7 @@ nsFrameLoader::GetURL(nsString& aURI)
|
||||
{
|
||||
aURI.Truncate();
|
||||
|
||||
if (mOwnerContent->IsHTMLElement(nsGkAtoms::object)) {
|
||||
if (mOwnerContent->Tag() == nsGkAtoms::object) {
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::data, aURI);
|
||||
} else {
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::src, aURI);
|
||||
@@ -2115,7 +2115,7 @@ nsFrameLoader::TryRemoteBrowser()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mOwnerContent->IsXULElement()) {
|
||||
if (!mOwnerContent->IsXUL()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2424,7 +2424,7 @@ nsFrameLoader::EnsureMessageManager()
|
||||
if (!mIsTopLevelContent &&
|
||||
!OwnerIsBrowserOrAppFrame() &&
|
||||
!mRemoteFrame &&
|
||||
!(mOwnerContent->IsXULElement() &&
|
||||
!(mOwnerContent->IsXUL() &&
|
||||
mOwnerContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::forcemessagemanager,
|
||||
nsGkAtoms::_true, eCaseMatters))) {
|
||||
@@ -2445,7 +2445,7 @@ nsFrameLoader::EnsureMessageManager()
|
||||
|
||||
if (chromeWindow) {
|
||||
nsAutoString messagemanagergroup;
|
||||
if (mOwnerContent->IsXULElement() &&
|
||||
if (mOwnerContent->IsXUL() &&
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::messagemanagergroup,
|
||||
messagemanagergroup)) {
|
||||
|
||||
@@ -306,8 +306,7 @@ private:
|
||||
nsIDocShell* aParentNode);
|
||||
|
||||
nsIAtom* TypeAttrName() const {
|
||||
return mOwnerContent->IsXULElement()
|
||||
? nsGkAtoms::type : nsGkAtoms::mozframetype;
|
||||
return mOwnerContent->IsXUL() ? nsGkAtoms::type : nsGkAtoms::mozframetype;
|
||||
}
|
||||
|
||||
// Update the permission manager's app-id refcount based on mOwnerContent's
|
||||
|
||||
@@ -10086,7 +10086,7 @@ nsGlobalWindow::SetChromeEventHandler(EventTarget* aChromeEventHandler)
|
||||
|
||||
static bool IsLink(nsIContent* aContent)
|
||||
{
|
||||
return aContent && (aContent->IsHTMLElement(nsGkAtoms::a) ||
|
||||
return aContent && (aContent->IsHTML(nsGkAtoms::a) ||
|
||||
aContent->AttrValueIs(kNameSpaceID_XLink, nsGkAtoms::type,
|
||||
nsGkAtoms::simple, eCaseMatters));
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ nsHTMLContentSerializer::AppendElementStart(Element* aElement,
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIAtom *name = content->NodeInfo()->NameAtom();
|
||||
nsIAtom *name = content->Tag();
|
||||
int32_t ns = content->GetNameSpaceID();
|
||||
|
||||
bool lineBreakBeforeOpen = LineBreakBeforeOpen(ns, name);
|
||||
@@ -306,7 +306,7 @@ nsHTMLContentSerializer::AppendElementEnd(Element* aElement,
|
||||
|
||||
nsIContent* content = aElement;
|
||||
|
||||
nsIAtom *name = content->NodeInfo()->NameAtom();
|
||||
nsIAtom *name = content->Tag();
|
||||
int32_t ns = content->GetNameSpaceID();
|
||||
|
||||
if (ns == kNameSpaceID_XHTML &&
|
||||
|
||||
+25
-34
@@ -39,8 +39,8 @@ enum nsLinkState {
|
||||
|
||||
// IID for the nsIContent interface
|
||||
#define NS_ICONTENT_IID \
|
||||
{ 0x70f7e9ea, 0xa9bf, 0x48cc, \
|
||||
{ 0xad, 0x9d, 0x8a, 0xca, 0xee, 0xd2, 0x9b, 0x68 } }
|
||||
{ 0x697a2fe1, 0x5549, 0x48e7, \
|
||||
{ 0x9a, 0x1a, 0xc2, 0x9d, 0xab, 0x14, 0xe2, 0x39 } }
|
||||
|
||||
/**
|
||||
* A node of content in a document's content model. This interface
|
||||
@@ -250,69 +250,60 @@ public:
|
||||
return mNodeInfo->NamespaceID();
|
||||
}
|
||||
|
||||
inline bool IsHTMLElement() const
|
||||
/**
|
||||
* Get the NodeInfo for this element
|
||||
* @return the nodes node info
|
||||
*/
|
||||
inline mozilla::dom::NodeInfo* NodeInfo() const
|
||||
{
|
||||
return mNodeInfo;
|
||||
}
|
||||
|
||||
inline bool IsInNamespace(int32_t aNamespace) const
|
||||
{
|
||||
return mNodeInfo->NamespaceID() == aNamespace;
|
||||
}
|
||||
|
||||
inline bool IsHTML() const
|
||||
{
|
||||
return IsInNamespace(kNameSpaceID_XHTML);
|
||||
}
|
||||
|
||||
inline bool IsHTMLElement(nsIAtom* aTag) const
|
||||
inline bool IsHTML(nsIAtom* aTag) const
|
||||
{
|
||||
return mNodeInfo->Equals(aTag, kNameSpaceID_XHTML);
|
||||
}
|
||||
|
||||
template<typename First, typename... Args>
|
||||
inline bool IsAnyOfHTMLElements(First aFirst, Args... aArgs) const
|
||||
{
|
||||
return IsHTMLElement() && IsNodeInternal(aFirst, aArgs...);
|
||||
}
|
||||
|
||||
inline bool IsSVGElement() const
|
||||
inline bool IsSVG() const
|
||||
{
|
||||
return IsInNamespace(kNameSpaceID_SVG);
|
||||
}
|
||||
|
||||
inline bool IsSVGElement(nsIAtom* aTag) const
|
||||
inline bool IsSVG(nsIAtom* aTag) const
|
||||
{
|
||||
return mNodeInfo->Equals(aTag, kNameSpaceID_SVG);
|
||||
}
|
||||
|
||||
template<typename First, typename... Args>
|
||||
inline bool IsAnyOfSVGElements(First aFirst, Args... aArgs) const
|
||||
{
|
||||
return IsSVGElement() && IsNodeInternal(aFirst, aArgs...);
|
||||
}
|
||||
|
||||
inline bool IsXULElement() const
|
||||
inline bool IsXUL() const
|
||||
{
|
||||
return IsInNamespace(kNameSpaceID_XUL);
|
||||
}
|
||||
|
||||
inline bool IsXULElement(nsIAtom* aTag) const
|
||||
inline bool IsXUL(nsIAtom* aTag) const
|
||||
{
|
||||
return mNodeInfo->Equals(aTag, kNameSpaceID_XUL);
|
||||
}
|
||||
|
||||
template<typename First, typename... Args>
|
||||
inline bool IsAnyOfXULElements(First aFirst, Args... aArgs) const
|
||||
{
|
||||
return IsXULElement() && IsNodeInternal(aFirst, aArgs...);
|
||||
}
|
||||
|
||||
inline bool IsMathMLElement() const
|
||||
inline bool IsMathML() const
|
||||
{
|
||||
return IsInNamespace(kNameSpaceID_MathML);
|
||||
}
|
||||
|
||||
inline bool IsMathMLElement(nsIAtom* aTag) const
|
||||
inline bool IsMathML(nsIAtom* aTag) const
|
||||
{
|
||||
return mNodeInfo->Equals(aTag, kNameSpaceID_MathML);
|
||||
}
|
||||
|
||||
template<typename First, typename... Args>
|
||||
inline bool IsAnyOfMathMLElements(First aFirst, Args... aArgs) const
|
||||
{
|
||||
return IsMathMLElement() && IsNodeInternal(aFirst, aArgs...);
|
||||
}
|
||||
inline bool IsActiveChildrenElement() const
|
||||
{
|
||||
return mNodeInfo->Equals(nsGkAtoms::children, kNameSpaceID_XBL) &&
|
||||
@@ -928,7 +919,7 @@ public:
|
||||
// XHTML1 section C.7).
|
||||
bool hasAttr = content->GetAttr(kNameSpaceID_XML, nsGkAtoms::lang,
|
||||
aResult);
|
||||
if (!hasAttr && (content->IsHTMLElement() || content->IsSVGElement())) {
|
||||
if (!hasAttr && (content->IsHTML() || content->IsSVG())) {
|
||||
hasAttr = content->GetAttr(kNameSpaceID_None, nsGkAtoms::lang,
|
||||
aResult);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
inline bool
|
||||
nsIContent::IsInHTMLDocument() const
|
||||
{
|
||||
return OwnerDoc()->IsHTMLDocument();
|
||||
return OwnerDoc()->IsHTML();
|
||||
}
|
||||
|
||||
inline void
|
||||
|
||||
@@ -149,9 +149,10 @@ struct FullScreenOptions {
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
// 137c6144-513e-4edf-840e-5e3156638ed6
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0x0b78eabe, 0x8b94, 0x4ea1, \
|
||||
{ 0x93, 0x31, 0x5d, 0x48, 0xe8, 0x3a, 0xda, 0x95 } }
|
||||
{ 0x137c6144, 0x513e, 0x4edf, \
|
||||
{ 0x84, 0x0e, 0x5e, 0x31, 0x56, 0x63, 0x8e, 0xd6 } }
|
||||
|
||||
// Enum for requesting a particular type of document when creating a doc
|
||||
enum DocumentFlavor {
|
||||
@@ -1324,7 +1325,7 @@ public:
|
||||
* media documents). Returns false for XHTML and any other documents parsed
|
||||
* by the XML parser.
|
||||
*/
|
||||
bool IsHTMLDocument() const
|
||||
bool IsHTML() const
|
||||
{
|
||||
return mType == eHTML;
|
||||
}
|
||||
@@ -1332,15 +1333,15 @@ public:
|
||||
{
|
||||
return mType == eHTML || mType == eXHTML;
|
||||
}
|
||||
bool IsXMLDocument() const
|
||||
bool IsXML() const
|
||||
{
|
||||
return !IsHTMLDocument();
|
||||
return !IsHTML();
|
||||
}
|
||||
bool IsSVGDocument() const
|
||||
bool IsSVG() const
|
||||
{
|
||||
return mType == eSVG;
|
||||
}
|
||||
bool IsXULDocument() const
|
||||
bool IsXUL() const
|
||||
{
|
||||
return mType == eXUL;
|
||||
}
|
||||
@@ -1350,7 +1351,7 @@ public:
|
||||
}
|
||||
bool LoadsFullXULStyleSheetUpFront()
|
||||
{
|
||||
return IsXULDocument() || AllowXULXBL();
|
||||
return IsXUL() || AllowXULXBL();
|
||||
}
|
||||
|
||||
virtual bool IsScriptEnabled() = 0;
|
||||
|
||||
@@ -220,7 +220,7 @@ nsINode::GetTextEditorRootContent(nsIEditor** aEditor)
|
||||
*aEditor = nullptr;
|
||||
for (nsINode* node = this; node; node = node->GetParentNode()) {
|
||||
if (!node->IsElement() ||
|
||||
!node->IsHTMLElement())
|
||||
!node->AsElement()->IsHTML())
|
||||
continue;
|
||||
|
||||
nsCOMPtr<nsIEditor> editor =
|
||||
@@ -427,7 +427,7 @@ nsINode::IsAnonymousContentInSVGUseSubtree() const
|
||||
MOZ_ASSERT(IsInAnonymousSubtree());
|
||||
nsIContent* parent = AsContent()->GetBindingParent();
|
||||
// Watch out for parentless native-anonymous subtrees.
|
||||
return parent && parent->IsSVGElement(nsGkAtoms::use);
|
||||
return parent && parent->IsSVG(nsGkAtoms::use);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@@ -1905,7 +1905,7 @@ bool IsAllowedAsChild(nsIContent* aNewChild, nsINode* aParent,
|
||||
// HTML template elements and ShadowRoot hosts need
|
||||
// to be checked to ensure that they are not inserted into
|
||||
// the hosted content.
|
||||
aNewChild->NodeInfo()->NameAtom() == nsGkAtoms::_template ||
|
||||
aNewChild->Tag() == nsGkAtoms::_template ||
|
||||
aNewChild->GetShadowRoot()) &&
|
||||
nsContentUtils::ContentIsHostIncludingDescendantOf(aParent,
|
||||
aNewChild))) {
|
||||
|
||||
+8
-90
@@ -250,8 +250,8 @@ private:
|
||||
|
||||
// IID for the nsINode interface
|
||||
#define NS_INODE_IID \
|
||||
{ 0xe8fdd227, 0x27da, 0x46ee, \
|
||||
{ 0xbe, 0xf3, 0x1a, 0xef, 0x5a, 0x8f, 0xc5, 0xb4 } }
|
||||
{ 0x66972940, 0x1d1b, 0x4d15, \
|
||||
{ 0x93, 0x11, 0x96, 0x72, 0x84, 0x2e, 0xc7, 0x27 } }
|
||||
|
||||
/**
|
||||
* An internal interface that abstracts some DOMNode-related parts that both
|
||||
@@ -570,96 +570,14 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the NodeInfo for this element
|
||||
* @return the nodes node info
|
||||
* Get the tag for this element. This will always return a non-null atom
|
||||
* pointer (as implied by the naming of the method). For elements this is
|
||||
* the non-namespaced tag, and for other nodes it's something like "#text",
|
||||
* "#comment", "#document", etc.
|
||||
*/
|
||||
inline mozilla::dom::NodeInfo* NodeInfo() const
|
||||
nsIAtom* Tag() const
|
||||
{
|
||||
return mNodeInfo;
|
||||
}
|
||||
|
||||
inline bool IsInNamespace(int32_t aNamespace) const
|
||||
{
|
||||
return mNodeInfo->NamespaceID() == aNamespace;
|
||||
}
|
||||
|
||||
protected:
|
||||
// These 2 methods are useful for the recursive templates IsHTMLElement,
|
||||
// IsSVGElement, etc.
|
||||
inline bool IsNodeInternal() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename First, typename... Args>
|
||||
inline bool IsNodeInternal(First aFirst, Args... aArgs) const
|
||||
{
|
||||
return mNodeInfo->Equals(aFirst) || IsNodeInternal(aArgs...);
|
||||
}
|
||||
|
||||
public:
|
||||
inline bool IsHTMLElement() const
|
||||
{
|
||||
return IsElement() && IsInNamespace(kNameSpaceID_XHTML);
|
||||
}
|
||||
|
||||
inline bool IsHTMLElement(nsIAtom* aTag) const
|
||||
{
|
||||
return IsElement() && mNodeInfo->Equals(aTag, kNameSpaceID_XHTML);
|
||||
}
|
||||
|
||||
template<typename First, typename... Args>
|
||||
inline bool IsAnyOfHTMLElements(First aFirst, Args... aArgs) const
|
||||
{
|
||||
return IsHTMLElement() && IsNodeInternal(aFirst, aArgs...);
|
||||
}
|
||||
|
||||
inline bool IsSVGElement() const
|
||||
{
|
||||
return IsElement() && IsInNamespace(kNameSpaceID_SVG);
|
||||
}
|
||||
|
||||
inline bool IsSVGElement(nsIAtom* aTag) const
|
||||
{
|
||||
return IsElement() && mNodeInfo->Equals(aTag, kNameSpaceID_SVG);
|
||||
}
|
||||
|
||||
template<typename First, typename... Args>
|
||||
inline bool IsAnyOfSVGElements(First aFirst, Args... aArgs) const
|
||||
{
|
||||
return IsSVGElement() && IsNodeInternal(aFirst, aArgs...);
|
||||
}
|
||||
|
||||
inline bool IsXULElement() const
|
||||
{
|
||||
return IsElement() && IsInNamespace(kNameSpaceID_XUL);
|
||||
}
|
||||
|
||||
inline bool IsXULElement(nsIAtom* aTag) const
|
||||
{
|
||||
return IsElement() && mNodeInfo->Equals(aTag, kNameSpaceID_XUL);
|
||||
}
|
||||
|
||||
template<typename First, typename... Args>
|
||||
inline bool IsAnyOfXULElements(First aFirst, Args... aArgs) const
|
||||
{
|
||||
return IsXULElement() && IsNodeInternal(aFirst, aArgs...);
|
||||
}
|
||||
|
||||
inline bool IsMathMLElement() const
|
||||
{
|
||||
return IsElement() && IsInNamespace(kNameSpaceID_MathML);
|
||||
}
|
||||
|
||||
inline bool IsMathMLElement(nsIAtom* aTag) const
|
||||
{
|
||||
return IsElement() && mNodeInfo->Equals(aTag, kNameSpaceID_MathML);
|
||||
}
|
||||
|
||||
template<typename First, typename... Args>
|
||||
inline bool IsAnyOfMathMLElements(First aFirst, Args... aArgs) const
|
||||
{
|
||||
return IsMathMLElement() && IsNodeInternal(aFirst, aArgs...);
|
||||
return mNodeInfo->NameAtom();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -224,7 +224,7 @@ nsNodeUtils::LastRelease(nsINode* aNode)
|
||||
static_cast<nsGenericHTMLFormElement*>(aNode)->ClearForm(true);
|
||||
}
|
||||
|
||||
if (aNode->IsHTMLElement(nsGkAtoms::img) &&
|
||||
if (aNode->IsElement() && aNode->AsElement()->IsHTML(nsGkAtoms::img) &&
|
||||
aNode->HasFlag(ADDED_TO_FORM)) {
|
||||
HTMLImageElement* imageElem = static_cast<HTMLImageElement*>(aNode);
|
||||
imageElem->ClearForm(true);
|
||||
@@ -542,7 +542,8 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool 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->IsXULElement()) {
|
||||
if (aClone && !aParent && aNode->IsElement() &&
|
||||
aNode->AsElement()->IsXUL()) {
|
||||
if (!aNode->OwnerDoc()->IsLoadedAsInteractiveData()) {
|
||||
clone->SetFlags(NODE_FORCE_XBL_BINDINGS);
|
||||
}
|
||||
@@ -570,7 +571,7 @@ nsNodeUtils::UnlinkUserData(nsINode *aNode)
|
||||
bool
|
||||
nsNodeUtils::IsTemplateElement(const nsINode *aNode)
|
||||
{
|
||||
return aNode->IsHTMLElement(nsGkAtoms::_template);
|
||||
return aNode->IsElement() && aNode->AsElement()->IsHTML(nsGkAtoms::_template);
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
|
||||
@@ -994,7 +994,7 @@ nsObjectLoadingContent::BuildParametersArray()
|
||||
|
||||
int32_t start = 0, end = content->GetAttrCount(), step = 1;
|
||||
// HTML attributes are stored in reverse order.
|
||||
if (content->IsHTMLElement() && content->IsInHTMLDocument()) {
|
||||
if (content->IsHTML() && content->IsInHTMLDocument()) {
|
||||
start = end - 1;
|
||||
end = -1;
|
||||
step = -1;
|
||||
@@ -1046,7 +1046,7 @@ nsObjectLoadingContent::BuildParametersArray()
|
||||
// Nav 4.x would simply replace the "data" with "src". Because some plugins correctly
|
||||
// look for "data", lets instead copy the "data" attribute and add another entry
|
||||
// to the bottom of the array if there isn't already a "src" specified.
|
||||
if (content->IsHTMLElement(nsGkAtoms::object) &&
|
||||
if (content->Tag() == nsGkAtoms::object &&
|
||||
!content->HasAttr(kNameSpaceID_None, nsGkAtoms::src)) {
|
||||
MozPluginParameter param;
|
||||
content->GetAttr(kNameSpaceID_None, nsGkAtoms::data, param.mValue);
|
||||
@@ -2930,13 +2930,13 @@ nsObjectLoadingContent::LoadFallback(FallbackType aType, bool aNotify) {
|
||||
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
NS_ASSERTION(thisContent, "must be a content");
|
||||
|
||||
if (!thisContent->IsHTMLElement() || mContentType.IsEmpty()) {
|
||||
if (!thisContent->IsHTML() || mContentType.IsEmpty()) {
|
||||
// Don't let custom fallback handlers run outside HTML, tags without a
|
||||
// determined type should always just be alternate content
|
||||
aType = eFallbackAlternate;
|
||||
}
|
||||
|
||||
if (thisContent->IsHTMLElement(nsGkAtoms::object) &&
|
||||
if (thisContent->Tag() == nsGkAtoms::object &&
|
||||
(aType == eFallbackUnsupported ||
|
||||
aType == eFallbackDisabled ||
|
||||
aType == eFallbackBlocklisted))
|
||||
@@ -2944,7 +2944,7 @@ nsObjectLoadingContent::LoadFallback(FallbackType aType, bool aNotify) {
|
||||
// Show alternate content instead, if it exists
|
||||
for (nsIContent* child = thisContent->GetFirstChild();
|
||||
child; child = child->GetNextSibling()) {
|
||||
if (!child->IsHTMLElement(nsGkAtoms::param) &&
|
||||
if (!child->IsHTML(nsGkAtoms::param) &&
|
||||
nsStyleUtil::IsSignificantChild(child, true, false)) {
|
||||
aType = eFallbackAlternate;
|
||||
break;
|
||||
|
||||
@@ -431,7 +431,7 @@ nsPlainTextSerializer::DoOpenContainer(nsIAtom* aTag)
|
||||
{
|
||||
// Check if we need output current node as placeholder character and ignore
|
||||
// child nodes.
|
||||
if (ShouldReplaceContainerWithPlaceholder(mElement->NodeInfo()->NameAtom())) {
|
||||
if (ShouldReplaceContainerWithPlaceholder(mElement->Tag())) {
|
||||
if (mIgnoredChildNodeLevel == 0) {
|
||||
// Serialize current node as placeholder character
|
||||
Write(NS_LITERAL_STRING("\xFFFC"));
|
||||
@@ -776,7 +776,7 @@ nsPlainTextSerializer::DoOpenContainer(nsIAtom* aTag)
|
||||
nsresult
|
||||
nsPlainTextSerializer::DoCloseContainer(nsIAtom* aTag)
|
||||
{
|
||||
if (ShouldReplaceContainerWithPlaceholder(mElement->NodeInfo()->NameAtom())) {
|
||||
if (ShouldReplaceContainerWithPlaceholder(mElement->Tag())) {
|
||||
mIgnoredChildNodeLevel--;
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1773,11 +1773,11 @@ nsPlainTextSerializer::IsCurrentNodeConverted()
|
||||
nsIAtom*
|
||||
nsPlainTextSerializer::GetIdForContent(nsIContent* aContent)
|
||||
{
|
||||
if (!aContent->IsHTMLElement()) {
|
||||
if (!aContent->IsHTML()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIAtom* localName = aContent->NodeInfo()->NameAtom();
|
||||
nsIAtom* localName = aContent->Tag();
|
||||
return localName->IsStaticAtom() ? localName : nullptr;
|
||||
}
|
||||
|
||||
@@ -1812,7 +1812,7 @@ nsPlainTextSerializer::IsElementBlock(Element* aElement)
|
||||
return displayStyle->IsBlockOutsideStyle();
|
||||
}
|
||||
// Fall back to looking at the tag, in case there is no style information.
|
||||
return nsContentUtils::IsHTMLBlock(aElement);
|
||||
return nsContentUtils::IsHTMLBlock(GetIdForContent(aElement));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1118,12 +1118,11 @@ nsRange::IsValidBoundary(nsINode* aNode)
|
||||
}
|
||||
|
||||
if (aNode->IsNodeOfType(nsINode::eCONTENT)) {
|
||||
if (aNode->NodeInfo()->NameAtom() == nsGkAtoms::documentTypeNodeName) {
|
||||
nsIContent* content = static_cast<nsIContent*>(aNode);
|
||||
if (content->Tag() == nsGkAtoms::documentTypeNodeName) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIContent* content = static_cast<nsIContent*>(aNode);
|
||||
|
||||
if (!mMaySpanAnonymousSubtrees) {
|
||||
// If the node is in a shadow tree then the ShadowRoot is the root.
|
||||
ShadowRoot* containingShadow = content->GetContainingShadow();
|
||||
@@ -3245,7 +3244,7 @@ IsVisibleAndNotInReplacedElement(nsIFrame* aFrame)
|
||||
}
|
||||
for (nsIFrame* f = aFrame->GetParent(); f; f = f->GetParent()) {
|
||||
if (f->IsFrameOfType(nsIFrame::eReplaced) &&
|
||||
!f->GetContent()->IsHTMLElement(nsGkAtoms::button)) {
|
||||
!f->GetContent()->IsHTML(nsGkAtoms::button)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -3292,7 +3291,7 @@ enum TreeTraversalState {
|
||||
static int8_t
|
||||
GetRequiredInnerTextLineBreakCount(nsIFrame* aFrame)
|
||||
{
|
||||
if (aFrame->GetContent()->IsHTMLElement(nsGkAtoms::p)) {
|
||||
if (aFrame->GetContent()->IsHTML(nsGkAtoms::p)) {
|
||||
return 2;
|
||||
}
|
||||
const nsStyleDisplay* styleDisplay = aFrame->StyleDisplay();
|
||||
@@ -3387,7 +3386,7 @@ nsRange::GetInnerTextNoFlush(DOMString& aValue, ErrorResult& aError,
|
||||
bool isVisibleAndNotReplaced = IsVisibleAndNotInReplacedElement(f);
|
||||
if (currentState == AT_NODE) {
|
||||
bool isText = currentNode->IsNodeOfType(nsINode::eTEXT);
|
||||
if (isText && currentNode->GetParent()->IsHTMLElement(nsGkAtoms::rp) &&
|
||||
if (isText && currentNode->GetParent()->IsHTML(nsGkAtoms::rp) &&
|
||||
ElementIsVisibleNoFlush(currentNode->GetParent()->AsElement())) {
|
||||
nsAutoString str;
|
||||
currentNode->GetTextContent(str, aError);
|
||||
@@ -3410,7 +3409,7 @@ nsRange::GetInnerTextNoFlush(DOMString& aValue, ErrorResult& aError,
|
||||
break;
|
||||
}
|
||||
if (isVisibleAndNotReplaced) {
|
||||
if (currentNode->IsHTMLElement(nsGkAtoms::br)) {
|
||||
if (currentNode->IsHTML(nsGkAtoms::br)) {
|
||||
result.Append('\n');
|
||||
}
|
||||
switch (f->StyleDisplay()->mDisplay) {
|
||||
@@ -3443,4 +3442,4 @@ nsRange::GetInnerTextNoFlush(DOMString& aValue, ErrorResult& aError,
|
||||
}
|
||||
// Do not flush trailing line breaks! Required breaks at the end of the text
|
||||
// are suppressed.
|
||||
}
|
||||
}
|
||||
@@ -189,7 +189,7 @@ NS_IMPL_ISUPPORTS(nsScriptLoader, nsIStreamLoaderObserver)
|
||||
static bool
|
||||
IsScriptEventHandler(nsIContent* aScriptElement)
|
||||
{
|
||||
if (!aScriptElement->IsHTMLElement()) {
|
||||
if (!aScriptElement->IsHTML()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -595,7 +595,7 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
|
||||
// no 'type=' element
|
||||
// "language" is a deprecated attribute of HTML, so we check it only for
|
||||
// HTML script elements.
|
||||
if (scriptContent->IsHTMLElement()) {
|
||||
if (scriptContent->IsHTML()) {
|
||||
nsAutoString language;
|
||||
scriptContent->GetAttr(kNameSpaceID_None, nsGkAtoms::language, language);
|
||||
if (!language.IsEmpty()) {
|
||||
|
||||
@@ -235,8 +235,8 @@ IsScopedStyleElement(nsIContent* aContent)
|
||||
// This is quicker than, say, QIing aContent to nsStyleLinkElement
|
||||
// and then calling its virtual GetStyleSheetInfo method to find out
|
||||
// if it is scoped.
|
||||
return (aContent->IsHTMLElement(nsGkAtoms::style) ||
|
||||
aContent->IsSVGElement(nsGkAtoms::style)) &&
|
||||
return (aContent->IsHTML(nsGkAtoms::style) ||
|
||||
aContent->IsSVG(nsGkAtoms::style)) &&
|
||||
aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::scoped);
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
|
||||
// Check for a ShadowRoot because link elements are inert in a
|
||||
// ShadowRoot.
|
||||
ShadowRoot* containingShadow = thisContent->GetContainingShadow();
|
||||
if (thisContent->IsHTMLElement(nsGkAtoms::link) &&
|
||||
if (thisContent->IsHTML(nsGkAtoms::link) &&
|
||||
(aOldShadowRoot || containingShadow)) {
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -413,7 +413,7 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(thisContent->NodeInfo()->NameAtom() != nsGkAtoms::link,
|
||||
MOZ_ASSERT(thisContent->Tag() != nsGkAtoms::link,
|
||||
"<link> is not 'inline', and needs different CSP checks");
|
||||
if (!nsStyleUtil::CSPAllowsInlineStyle(thisContent,
|
||||
thisContent->NodePrincipal(),
|
||||
|
||||
@@ -1214,10 +1214,10 @@ nsTreeSanitizer::SanitizeAttributes(mozilla::dom::Element* aElement,
|
||||
}
|
||||
if (aAllowed->GetEntry(attrLocal) &&
|
||||
!((attrLocal == nsGkAtoms::rel &&
|
||||
aElement->IsHTMLElement(nsGkAtoms::link)) ||
|
||||
aElement->IsHTML(nsGkAtoms::link)) ||
|
||||
(!mFullDocument &&
|
||||
attrLocal == nsGkAtoms::name &&
|
||||
aElement->IsHTMLElement(nsGkAtoms::meta)))) {
|
||||
aElement->IsHTML(nsGkAtoms::meta)))) {
|
||||
// name="" and rel="" are whitelisted, but treat them as blacklisted
|
||||
// for <meta name> (fragment case) and <link rel> (all cases) to avoid
|
||||
// document-wide metadata or styling overrides with non-conforming
|
||||
@@ -1273,7 +1273,8 @@ nsTreeSanitizer::SanitizeAttributes(mozilla::dom::Element* aElement,
|
||||
|
||||
// If we've got HTML audio or video, add the controls attribute, because
|
||||
// otherwise the content is unplayable with scripts removed.
|
||||
if (aElement->IsAnyOfHTMLElements(nsGkAtoms::video, nsGkAtoms::audio)) {
|
||||
if (aElement->IsHTML(nsGkAtoms::video) ||
|
||||
aElement->IsHTML(nsGkAtoms::audio)) {
|
||||
aElement->SetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::controls,
|
||||
EmptyString(),
|
||||
@@ -1357,7 +1358,7 @@ nsTreeSanitizer::Sanitize(nsIDocument* aDocument)
|
||||
#ifdef DEBUG
|
||||
NS_PRECONDITION(!aDocument->GetContainer(), "The document is in a shell.");
|
||||
nsRefPtr<mozilla::dom::Element> root = aDocument->GetRootElement();
|
||||
NS_PRECONDITION(root->IsHTMLElement(nsGkAtoms::html), "Not HTML root.");
|
||||
NS_PRECONDITION(root->IsHTML(nsGkAtoms::html), "Not HTML root.");
|
||||
#endif
|
||||
|
||||
mFullDocument = true;
|
||||
|
||||
@@ -459,8 +459,10 @@ nsXHTMLContentSerializer::AfterElementStart(nsIContent* aContent,
|
||||
nsIContent* aOriginalElement,
|
||||
nsAString& aStr)
|
||||
{
|
||||
if (mRewriteEncodingDeclaration &&
|
||||
aContent->IsHTMLElement(nsGkAtoms::head)) {
|
||||
nsIAtom *name = aContent->Tag();
|
||||
if (aContent->GetNameSpaceID() == kNameSpaceID_XHTML &&
|
||||
mRewriteEncodingDeclaration &&
|
||||
name == nsGkAtoms::head) {
|
||||
|
||||
// Check if there already are any content-type meta children.
|
||||
// If there are, they will be modified to use the correct charset.
|
||||
@@ -469,7 +471,7 @@ nsXHTMLContentSerializer::AfterElementStart(nsIContent* aContent,
|
||||
for (nsIContent* child = aContent->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsHTMLElement(nsGkAtoms::meta) &&
|
||||
if (child->IsHTML(nsGkAtoms::meta) &&
|
||||
child->HasAttr(kNameSpaceID_None, nsGkAtoms::content)) {
|
||||
nsAutoString header;
|
||||
child->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv, header);
|
||||
@@ -506,9 +508,12 @@ nsXHTMLContentSerializer::AfterElementEnd(nsIContent * aContent,
|
||||
{
|
||||
NS_ASSERTION(!mIsHTMLSerializer, "nsHTMLContentSerializer shouldn't call this method !");
|
||||
|
||||
int32_t namespaceID = aContent->GetNameSpaceID();
|
||||
nsIAtom *name = aContent->Tag();
|
||||
|
||||
// this method is not called by nsHTMLContentSerializer
|
||||
// so we don't have to check HTML element, just XHTML
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::body)) {
|
||||
if (kNameSpaceID_XHTML == namespaceID && name == nsGkAtoms::body) {
|
||||
--mInBody;
|
||||
}
|
||||
}
|
||||
@@ -538,17 +543,21 @@ nsXHTMLContentSerializer::CheckElementStart(nsIContent * aContent,
|
||||
aForceFormat = !(mFlags & nsIDocumentEncoder::OutputIgnoreMozDirty) &&
|
||||
aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdirty);
|
||||
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::br) &&
|
||||
(mFlags & nsIDocumentEncoder::OutputNoFormattingInPre) &&
|
||||
PreLevel() > 0) {
|
||||
AppendNewLineToString(aStr);
|
||||
return false;
|
||||
}
|
||||
nsIAtom *name = aContent->Tag();
|
||||
int32_t namespaceID = aContent->GetNameSpaceID();
|
||||
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::body)) {
|
||||
++mInBody;
|
||||
}
|
||||
if (namespaceID == kNameSpaceID_XHTML) {
|
||||
if (name == nsGkAtoms::br &&
|
||||
(mFlags & nsIDocumentEncoder::OutputNoFormattingInPre) &&
|
||||
PreLevel() > 0) {
|
||||
aResult = AppendNewLineToString(aStr) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (name == nsGkAtoms::body) {
|
||||
++mInBody;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -562,10 +571,13 @@ nsXHTMLContentSerializer::CheckElementEnd(nsIContent * aContent,
|
||||
aForceFormat = !(mFlags & nsIDocumentEncoder::OutputIgnoreMozDirty) &&
|
||||
aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdirty);
|
||||
|
||||
nsIAtom *name = aContent->Tag();
|
||||
int32_t namespaceID = aContent->GetNameSpaceID();
|
||||
|
||||
// this method is not called by nsHTMLContentSerializer
|
||||
// so we don't have to check HTML element, just XHTML
|
||||
if (aContent->IsHTMLElement()) {
|
||||
if (mIsCopying && aContent->IsHTMLElement(nsGkAtoms::ol)) {
|
||||
if (namespaceID == kNameSpaceID_XHTML) {
|
||||
if (mIsCopying && name == nsGkAtoms::ol) {
|
||||
NS_ASSERTION((!mOLStateStack.IsEmpty()), "Cannot have an empty OL Stack");
|
||||
/* Though at this point we must always have an state to be deleted as all
|
||||
the OL opening tags are supposed to push an olState object to the stack*/
|
||||
@@ -581,8 +593,7 @@ nsXHTMLContentSerializer::CheckElementEnd(nsIContent * aContent,
|
||||
bool isContainer;
|
||||
|
||||
parserService->
|
||||
IsContainer(parserService->HTMLCaseSensitiveAtomTagToId(
|
||||
aContent->NodeInfo()->NameAtom()),
|
||||
IsContainer(parserService->HTMLCaseSensitiveAtomTagToId(name),
|
||||
isContainer);
|
||||
if (!isContainer) {
|
||||
// non-container HTML elements are already closed,
|
||||
@@ -845,15 +856,18 @@ void
|
||||
nsXHTMLContentSerializer::MaybeEnterInPreContent(nsIContent* aNode)
|
||||
{
|
||||
if (!ShouldMaintainPreLevel() ||
|
||||
!aNode->IsHTMLElement()) {
|
||||
aNode->GetNameSpaceID() != kNameSpaceID_XHTML) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsIAtom *name = aNode->Tag();
|
||||
|
||||
if (IsElementPreformatted(aNode) ||
|
||||
aNode->IsAnyOfHTMLElements(nsGkAtoms::script,
|
||||
nsGkAtoms::style,
|
||||
nsGkAtoms::noscript,
|
||||
nsGkAtoms::noframes)) {
|
||||
name == nsGkAtoms::script ||
|
||||
name == nsGkAtoms::style ||
|
||||
name == nsGkAtoms::noscript ||
|
||||
name == nsGkAtoms::noframes
|
||||
) {
|
||||
PreLevel()++;
|
||||
}
|
||||
}
|
||||
@@ -862,15 +876,17 @@ void
|
||||
nsXHTMLContentSerializer::MaybeLeaveFromPreContent(nsIContent* aNode)
|
||||
{
|
||||
if (!ShouldMaintainPreLevel() ||
|
||||
!aNode->IsHTMLElement()) {
|
||||
aNode->GetNameSpaceID() != kNameSpaceID_XHTML) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsIAtom *name = aNode->Tag();
|
||||
if (IsElementPreformatted(aNode) ||
|
||||
aNode->IsAnyOfHTMLElements(nsGkAtoms::script,
|
||||
nsGkAtoms::style,
|
||||
nsGkAtoms::noscript,
|
||||
nsGkAtoms::noframes)) {
|
||||
name == nsGkAtoms::script ||
|
||||
name == nsGkAtoms::style ||
|
||||
name == nsGkAtoms::noscript ||
|
||||
name == nsGkAtoms::noframes
|
||||
) {
|
||||
--PreLevel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -773,9 +773,9 @@ bool
|
||||
nsXMLContentSerializer::IsJavaScript(nsIContent * aContent, nsIAtom* aAttrNameAtom,
|
||||
int32_t aAttrNamespaceID, const nsAString& aValueString)
|
||||
{
|
||||
bool isHtml = aContent->IsHTMLElement();
|
||||
bool isXul = aContent->IsXULElement();
|
||||
bool isSvg = aContent->IsSVGElement();
|
||||
bool isHtml = aContent->IsHTML();
|
||||
bool isXul = aContent->IsXUL();
|
||||
bool isSvg = aContent->IsSVG();
|
||||
|
||||
if (aAttrNamespaceID == kNameSpaceID_None &&
|
||||
(isHtml || isXul || isSvg) &&
|
||||
@@ -907,7 +907,7 @@ nsXMLContentSerializer::AppendElementStart(Element* aElement,
|
||||
uint32_t skipAttr = ScanNamespaceDeclarations(content,
|
||||
aOriginalElement, tagNamespaceURI);
|
||||
|
||||
nsIAtom *name = content->NodeInfo()->NameAtom();
|
||||
nsIAtom *name = content->Tag();
|
||||
bool lineBreakBeforeOpen = LineBreakBeforeOpen(content->GetNameSpaceID(), name);
|
||||
|
||||
if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()) {
|
||||
@@ -999,7 +999,7 @@ nsXMLContentSerializer::AppendElementEnd(Element* aElement,
|
||||
bool forceFormat = false, outputElementEnd;
|
||||
outputElementEnd = CheckElementEnd(content, forceFormat, aStr);
|
||||
|
||||
nsIAtom *name = content->NodeInfo()->NameAtom();
|
||||
nsIAtom *name = content->Tag();
|
||||
|
||||
if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()) {
|
||||
DecrIndentation(name);
|
||||
|
||||
@@ -195,7 +195,8 @@ ContentEventHandler::QueryContentRect(nsIContent* aContent,
|
||||
// we don't want to include the bogus BRs at the end.
|
||||
static bool IsContentBR(nsIContent* aContent)
|
||||
{
|
||||
return aContent->IsHTMLElement(nsGkAtoms::br) &&
|
||||
return aContent->IsHTML() &&
|
||||
aContent->Tag() == nsGkAtoms::br &&
|
||||
!aContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::type,
|
||||
nsGkAtoms::moz,
|
||||
@@ -1390,8 +1391,8 @@ static void AdjustRangeForSelection(nsIContent* aRoot,
|
||||
}
|
||||
|
||||
nsIContent* brContent = node->GetChildAt(nodeOffset - 1);
|
||||
while (brContent && brContent->IsHTMLElement()) {
|
||||
if (!brContent->IsHTMLElement(nsGkAtoms::br) || IsContentBR(brContent)) {
|
||||
while (brContent && brContent->IsHTML()) {
|
||||
if (brContent->Tag() != nsGkAtoms::br || IsContentBR(brContent)) {
|
||||
break;
|
||||
}
|
||||
brContent = node->GetChildAt(--nodeOffset - 1);
|
||||
|
||||
@@ -896,7 +896,7 @@ IsAccessKeyTarget(nsIContent* aContent, nsIFrame* aFrame, nsAString& aKey)
|
||||
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDoc =
|
||||
do_QueryInterface(aContent->OwnerDoc());
|
||||
if (!xulDoc && !aContent->IsXULElement())
|
||||
if (!xulDoc && !aContent->IsXUL())
|
||||
return true;
|
||||
|
||||
// For XUL we do visibility checks.
|
||||
@@ -914,18 +914,21 @@ IsAccessKeyTarget(nsIContent* aContent, nsIFrame* aFrame, nsAString& aKey)
|
||||
if (control)
|
||||
return true;
|
||||
|
||||
// HTML area, label and legend elements are never focusable, so
|
||||
// we need to check for them explicitly before giving up.
|
||||
if (aContent->IsAnyOfHTMLElements(nsGkAtoms::area,
|
||||
nsGkAtoms::label,
|
||||
nsGkAtoms::legend)) {
|
||||
return true;
|
||||
}
|
||||
if (aContent->IsHTML()) {
|
||||
nsIAtom* tag = aContent->Tag();
|
||||
|
||||
// XUL label elements are never focusable, so we need to check for them
|
||||
// explicitly before giving up.
|
||||
if (aContent->IsXULElement(nsGkAtoms::label)) {
|
||||
return true;
|
||||
// HTML area, label and legend elements are never focusable, so
|
||||
// we need to check for them explicitly before giving up.
|
||||
if (tag == nsGkAtoms::area ||
|
||||
tag == nsGkAtoms::label ||
|
||||
tag == nsGkAtoms::legend)
|
||||
return true;
|
||||
|
||||
} 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)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -1145,7 +1148,9 @@ EventStateManager::IsRemoteTarget(nsIContent* target) {
|
||||
}
|
||||
|
||||
// <browser/iframe remote=true> from XUL
|
||||
if (target->IsAnyOfXULElements(nsGkAtoms::browser, nsGkAtoms::iframe) &&
|
||||
if ((target->Tag() == nsGkAtoms::browser ||
|
||||
target->Tag() == nsGkAtoms::iframe) &&
|
||||
target->IsXUL() &&
|
||||
target->AttrValueIs(kNameSpaceID_None, nsGkAtoms::Remote,
|
||||
nsGkAtoms::_true, eIgnoreCase)) {
|
||||
return true;
|
||||
@@ -1309,7 +1314,7 @@ EventStateManager::CreateClickHoldTimer(nsPresContext* inPresContext,
|
||||
return;
|
||||
|
||||
// check for a <menubutton> like bookmarks
|
||||
if (mGestureDownContent->IsXULElement(nsGkAtoms::menubutton))
|
||||
if (mGestureDownContent->Tag() == nsGkAtoms::menubutton)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1403,37 +1408,40 @@ EventStateManager::FireContextClick()
|
||||
|
||||
// before dispatching, check that we're not on something that
|
||||
// doesn't get a context menu
|
||||
nsIAtom *tag = mGestureDownContent->Tag();
|
||||
bool allowedToDispatch = true;
|
||||
|
||||
if (mGestureDownContent->IsAnyOfXULElements(nsGkAtoms::scrollbar,
|
||||
nsGkAtoms::scrollbarbutton,
|
||||
nsGkAtoms::button)) {
|
||||
allowedToDispatch = false;
|
||||
} else if (mGestureDownContent->IsXULElement(nsGkAtoms::toolbarbutton)) {
|
||||
// a <toolbarbutton> that has the container attribute set
|
||||
// will already have its own dropdown.
|
||||
if (nsContentUtils::HasNonEmptyAttr(mGestureDownContent,
|
||||
kNameSpaceID_None, nsGkAtoms::container)) {
|
||||
if (mGestureDownContent->IsXUL()) {
|
||||
if (tag == nsGkAtoms::scrollbar ||
|
||||
tag == nsGkAtoms::scrollbarbutton ||
|
||||
tag == nsGkAtoms::button)
|
||||
allowedToDispatch = false;
|
||||
} else {
|
||||
// If the toolbar button has an open menu, don't attempt to open
|
||||
// a second menu
|
||||
if (mGestureDownContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open,
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
else if (tag == nsGkAtoms::toolbarbutton) {
|
||||
// a <toolbarbutton> that has the container attribute set
|
||||
// will already have its own dropdown.
|
||||
if (nsContentUtils::HasNonEmptyAttr(mGestureDownContent,
|
||||
kNameSpaceID_None, nsGkAtoms::container)) {
|
||||
allowedToDispatch = false;
|
||||
} else {
|
||||
// If the toolbar button has an open menu, don't attempt to open
|
||||
// a second menu
|
||||
if (mGestureDownContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open,
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
allowedToDispatch = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (mGestureDownContent->IsHTMLElement()) {
|
||||
else if (mGestureDownContent->IsHTML()) {
|
||||
nsCOMPtr<nsIFormControl> formCtrl(do_QueryInterface(mGestureDownContent));
|
||||
|
||||
if (formCtrl) {
|
||||
allowedToDispatch = formCtrl->IsTextOrNumberControl(/*aExcludePassword*/ false) ||
|
||||
formCtrl->GetType() == NS_FORM_INPUT_FILE;
|
||||
}
|
||||
else if (mGestureDownContent->IsAnyOfHTMLElements(nsGkAtoms::applet,
|
||||
nsGkAtoms::embed,
|
||||
nsGkAtoms::object)) {
|
||||
else if (tag == nsGkAtoms::applet ||
|
||||
tag == nsGkAtoms::embed ||
|
||||
tag == nsGkAtoms::object) {
|
||||
allowedToDispatch = false;
|
||||
}
|
||||
}
|
||||
@@ -2672,7 +2680,7 @@ static bool
|
||||
NodeAllowsClickThrough(nsINode* aNode)
|
||||
{
|
||||
while (aNode) {
|
||||
if (aNode->IsXULElement()) {
|
||||
if (aNode->IsElement() && aNode->AsElement()->IsXUL()) {
|
||||
mozilla::dom::Element* element = aNode->AsElement();
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::always, &nsGkAtoms::never, nullptr};
|
||||
@@ -2914,7 +2922,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
EnsureDocument(mPresContext);
|
||||
if (mDocument) {
|
||||
#ifdef XP_MACOSX
|
||||
if (!activeContent || !activeContent->IsXULElement())
|
||||
if (!activeContent || !activeContent->IsXUL())
|
||||
#endif
|
||||
fm->ClearFocus(mDocument->GetWindow());
|
||||
fm->SetFocusedWindow(mDocument->GetWindow());
|
||||
@@ -4868,7 +4876,8 @@ EventStateManager::ContentRemoved(nsIDocument* aDocument, nsIContent* aContent)
|
||||
* the current link. We want to make sure that the UI gets informed when they
|
||||
* are actually removed from the DOM.
|
||||
*/
|
||||
if (aContent->IsAnyOfHTMLElements(nsGkAtoms::a, nsGkAtoms::area) &&
|
||||
if (aContent->IsHTML() &&
|
||||
(aContent->Tag() == nsGkAtoms::a || aContent->Tag() == nsGkAtoms::area) &&
|
||||
(aContent->AsElement()->State().HasAtLeastOneOfStates(NS_EVENT_STATE_FOCUS |
|
||||
NS_EVENT_STATE_HOVER))) {
|
||||
nsGenericHTMLElement* element = static_cast<nsGenericHTMLElement*>(aContent);
|
||||
|
||||
@@ -917,7 +917,7 @@ GetContentBR(dom::Element* aElement)
|
||||
return nullptr;
|
||||
}
|
||||
nsIContent* content = static_cast<nsIContent*>(aElement);
|
||||
return content->IsHTMLElement(nsGkAtoms::br) ? content : nullptr;
|
||||
return content->IsHTML(nsGkAtoms::br) ? content : nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -791,9 +791,10 @@ IMEStateManager::SetIMEState(const IMEState& aState,
|
||||
InputContext context;
|
||||
context.mIMEState = aState;
|
||||
|
||||
if (aContent &&
|
||||
aContent->IsAnyOfHTMLElements(nsGkAtoms::input, nsGkAtoms::textarea)) {
|
||||
if (!aContent->IsHTMLElement(nsGkAtoms::textarea)) {
|
||||
if (aContent && aContent->GetNameSpaceID() == kNameSpaceID_XHTML &&
|
||||
(aContent->Tag() == nsGkAtoms::input ||
|
||||
aContent->Tag() == nsGkAtoms::textarea)) {
|
||||
if (aContent->Tag() != nsGkAtoms::textarea) {
|
||||
// <input type=number> has an anonymous <input type=text> descendant
|
||||
// that gets focus whenever anyone tries to focus the number control. We
|
||||
// need to check if aContent is one of those anonymous text controls and,
|
||||
@@ -829,7 +830,7 @@ IMEStateManager::SetIMEState(const IMEState& aState,
|
||||
// If we don't have an action hint and
|
||||
// return won't submit the form, use "next".
|
||||
if (context.mActionHint.IsEmpty() &&
|
||||
inputContent->IsHTMLElement(nsGkAtoms::input)) {
|
||||
inputContent->Tag() == nsGkAtoms::input) {
|
||||
bool willSubmit = false;
|
||||
nsCOMPtr<nsIFormControl> control(do_QueryInterface(inputContent));
|
||||
mozilla::dom::Element* formElement = control->GetFormElement();
|
||||
@@ -840,7 +841,8 @@ IMEStateManager::SetIMEState(const IMEState& aState,
|
||||
form->GetDefaultSubmitElement()) {
|
||||
willSubmit = true;
|
||||
// is this an html form and does it only have a single text input element?
|
||||
} else if (formElement && formElement->IsHTMLElement(nsGkAtoms::form) &&
|
||||
} else if (formElement && formElement->Tag() == nsGkAtoms::form &&
|
||||
formElement->IsHTML() &&
|
||||
!static_cast<dom::HTMLFormElement*>(formElement)->
|
||||
ImplicitSubmissionIsDisabled()) {
|
||||
willSubmit = true;
|
||||
|
||||
@@ -68,21 +68,23 @@ HTMLAllCollection::Collection()
|
||||
static bool
|
||||
IsAllNamedElement(nsIContent* aContent)
|
||||
{
|
||||
return aContent->IsAnyOfHTMLElements(nsGkAtoms::a,
|
||||
nsGkAtoms::applet,
|
||||
nsGkAtoms::button,
|
||||
nsGkAtoms::embed,
|
||||
nsGkAtoms::form,
|
||||
nsGkAtoms::iframe,
|
||||
nsGkAtoms::img,
|
||||
nsGkAtoms::input,
|
||||
nsGkAtoms::map,
|
||||
nsGkAtoms::meta,
|
||||
nsGkAtoms::object,
|
||||
nsGkAtoms::select,
|
||||
nsGkAtoms::textarea,
|
||||
nsGkAtoms::frame,
|
||||
nsGkAtoms::frameset);
|
||||
nsIAtom* tag = aContent->Tag();
|
||||
return
|
||||
tag == nsGkAtoms::a ||
|
||||
tag == nsGkAtoms::applet ||
|
||||
tag == nsGkAtoms::button ||
|
||||
tag == nsGkAtoms::embed ||
|
||||
tag == nsGkAtoms::form ||
|
||||
tag == nsGkAtoms::iframe ||
|
||||
tag == nsGkAtoms::img ||
|
||||
tag == nsGkAtoms::input ||
|
||||
tag == nsGkAtoms::map ||
|
||||
tag == nsGkAtoms::meta ||
|
||||
tag == nsGkAtoms::object ||
|
||||
tag == nsGkAtoms::select ||
|
||||
tag == nsGkAtoms::textarea ||
|
||||
tag == nsGkAtoms::frame ||
|
||||
tag == nsGkAtoms::frameset;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
||||
@@ -65,7 +65,8 @@ HTMLContentElement::BindToTree(nsIDocument* aDocument,
|
||||
if (containingShadow && !oldContainingShadow) {
|
||||
nsINode* parentNode = nsINode::GetParentNode();
|
||||
while (parentNode && parentNode != containingShadow) {
|
||||
if (parentNode->IsHTMLElement(nsGkAtoms::content)) {
|
||||
if (parentNode->IsElement() &&
|
||||
parentNode->AsElement()->IsHTML(nsGkAtoms::content)) {
|
||||
// Content element in fallback content is not an insertion point.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ HTMLDetailsElement::GetFirstSummary() const
|
||||
for (nsIContent* child = nsINode::GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsHTMLElement(nsGkAtoms::summary)) {
|
||||
if (child->IsHTML(nsGkAtoms::summary)) {
|
||||
return child;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ HTMLFieldSetElement::InsertChildAt(nsIContent* aChild, uint32_t aIndex,
|
||||
{
|
||||
bool firstLegendHasChanged = false;
|
||||
|
||||
if (aChild->IsHTMLElement(nsGkAtoms::legend)) {
|
||||
if (aChild->IsHTML(nsGkAtoms::legend)) {
|
||||
if (!mFirstLegend) {
|
||||
mFirstLegend = aChild;
|
||||
// We do not want to notify the first time mFirstElement is set.
|
||||
@@ -204,7 +204,7 @@ HTMLFieldSetElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
|
||||
firstLegendHasChanged = true;
|
||||
|
||||
for (; child; child = child->GetNextSibling()) {
|
||||
if (child->IsHTMLElement(nsGkAtoms::legend)) {
|
||||
if (child->IsHTML(nsGkAtoms::legend)) {
|
||||
mFirstLegend = child;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -704,7 +704,7 @@ HTMLFormElement::BuildSubmission(nsFormSubmission** aFormSubmission,
|
||||
if (formEvent) {
|
||||
nsIContent* originator = formEvent->originator;
|
||||
if (originator) {
|
||||
if (!originator->IsHTMLElement()) {
|
||||
if (!originator->IsHTML()) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
originatingElement = static_cast<nsGenericHTMLElement*>(originator);
|
||||
@@ -1968,7 +1968,7 @@ HTMLFormElement::CheckValidFormSubmission()
|
||||
i < length; ++i) {
|
||||
// Input elements can trigger a form submission and we want to
|
||||
// update the style in that case.
|
||||
if (mControls->mElements[i]->IsHTMLElement(nsGkAtoms::input) &&
|
||||
if (mControls->mElements[i]->IsHTML(nsGkAtoms::input) &&
|
||||
nsContentUtils::IsFocusedContent(mControls->mElements[i])) {
|
||||
static_cast<HTMLInputElement*>(mControls->mElements[i])
|
||||
->UpdateValidityUIBits(true);
|
||||
|
||||
@@ -586,7 +586,7 @@ HTMLImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
UpdateFormOwner();
|
||||
}
|
||||
|
||||
bool addedToPicture = aParent && aParent->IsHTMLElement(nsGkAtoms::picture) &&
|
||||
bool addedToPicture = aParent && aParent->IsHTML(nsGkAtoms::picture) &&
|
||||
HTMLPictureElement::IsPictureEnabled();
|
||||
if (addedToPicture) {
|
||||
QueueImageLoadTask();
|
||||
@@ -631,7 +631,7 @@ HTMLImageElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
}
|
||||
|
||||
if (aNullParent && GetParent() &&
|
||||
GetParent()->IsHTMLElement(nsGkAtoms::picture) &&
|
||||
GetParent()->IsHTML(nsGkAtoms::picture) &&
|
||||
HTMLPictureElement::IsPictureEnabled()) {
|
||||
// Being removed from picture re-triggers selection, even if we
|
||||
// weren't using a <source> peer
|
||||
@@ -889,7 +889,7 @@ HTMLImageElement::HaveSrcsetOrInPicture()
|
||||
}
|
||||
|
||||
Element *parent = nsINode::GetParentElement();
|
||||
return (parent && parent->IsHTMLElement(nsGkAtoms::picture));
|
||||
return (parent && parent->IsHTML(nsGkAtoms::picture));
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -1047,7 +1047,7 @@ HTMLImageElement::UpdateResponsiveSource()
|
||||
Element *parent = pictureEnabled ? nsINode::GetParentElement() : nullptr;
|
||||
|
||||
nsINode *candidateSource = nullptr;
|
||||
if (parent && parent->IsHTMLElement(nsGkAtoms::picture)) {
|
||||
if (parent && parent->IsHTML(nsGkAtoms::picture)) {
|
||||
// Walk source nodes previous to ourselves
|
||||
candidateSource = parent->GetFirstChild();
|
||||
} else {
|
||||
@@ -1076,7 +1076,8 @@ HTMLImageElement::UpdateResponsiveSource()
|
||||
mResponsiveSelector = nullptr;
|
||||
}
|
||||
break;
|
||||
} else if (candidateSource->IsHTMLElement(nsGkAtoms::source) &&
|
||||
} else if (candidateSource->IsElement() &&
|
||||
candidateSource->AsElement()->IsHTML(nsGkAtoms::source) &&
|
||||
TryCreateResponsiveSelector(candidateSource->AsContent())) {
|
||||
// This led to a valid source, stop
|
||||
break;
|
||||
@@ -1109,10 +1110,10 @@ HTMLImageElement::TryCreateResponsiveSelector(nsIContent *aSourceNode,
|
||||
|
||||
bool pictureEnabled = HTMLPictureElement::IsPictureEnabled();
|
||||
// Skip if this is not a <source> with matching media query
|
||||
bool isSourceTag = aSourceNode->IsHTMLElement(nsGkAtoms::source);
|
||||
bool isSourceTag = aSourceNode->IsHTML(nsGkAtoms::source);
|
||||
if (isSourceTag) {
|
||||
DebugOnly<Element *> parent(nsINode::GetParentElement());
|
||||
MOZ_ASSERT(parent && parent->IsHTMLElement(nsGkAtoms::picture));
|
||||
MOZ_ASSERT(parent && parent->IsHTML(nsGkAtoms::picture));
|
||||
MOZ_ASSERT(IsPreviousSibling(aSourceNode, this));
|
||||
MOZ_ASSERT(pictureEnabled);
|
||||
|
||||
@@ -1127,7 +1128,7 @@ HTMLImageElement::TryCreateResponsiveSelector(nsIContent *aSourceNode,
|
||||
!SupportedPictureSourceType(type)) {
|
||||
return false;
|
||||
}
|
||||
} else if (aSourceNode->IsHTMLElement(nsGkAtoms::img)) {
|
||||
} else if (aSourceNode->IsHTML(nsGkAtoms::img)) {
|
||||
// Otherwise this is the <img> tag itself
|
||||
MOZ_ASSERT(aSourceNode == this);
|
||||
}
|
||||
|
||||
@@ -1898,7 +1898,7 @@ HTMLInputElement::GetList() const
|
||||
}
|
||||
|
||||
Element* element = doc->GetElementById(dataListId);
|
||||
if (!element || !element->IsHTMLElement(nsGkAtoms::datalist)) {
|
||||
if (!element || !element->IsHTML(nsGkAtoms::datalist)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ HTMLLegendElement::GetFieldSet() const
|
||||
{
|
||||
nsIContent* parent = GetParent();
|
||||
|
||||
if (parent && parent->IsHTMLElement(nsGkAtoms::fieldset)) {
|
||||
if (parent && parent->IsHTML(nsGkAtoms::fieldset)) {
|
||||
return parent;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ already_AddRefed<HTMLFormElement>
|
||||
HTMLLegendElement::GetForm()
|
||||
{
|
||||
Element* form = GetFormElement();
|
||||
MOZ_ASSERT_IF(form, form->IsHTMLElement(nsGkAtoms::form));
|
||||
MOZ_ASSERT_IF(form, form->IsHTML(nsGkAtoms::form));
|
||||
nsRefPtr<HTMLFormElement> ret = static_cast<HTMLFormElement*>(form);
|
||||
return ret.forget();
|
||||
}
|
||||
|
||||
@@ -818,7 +818,7 @@ static bool HasSourceChildren(nsIContent* aElement)
|
||||
for (nsIContent* child = aElement->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsHTMLElement(nsGkAtoms::source))
|
||||
if (child->IsHTML(nsGkAtoms::source))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -4150,7 +4150,7 @@ nsIContent* HTMLMediaElement::GetNextSource()
|
||||
nsIContent* child = GetChildAt(startOffset);
|
||||
|
||||
// If child is a <source> element, it is the next candidate.
|
||||
if (child && child->IsHTMLElement(nsGkAtoms::source)) {
|
||||
if (child && child->IsHTML(nsGkAtoms::source)) {
|
||||
mSourceLoadCandidate = child;
|
||||
return child;
|
||||
}
|
||||
|
||||
@@ -206,7 +206,9 @@ HTMLMenuElement::TraverseContent(nsIContent* aContent,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (child->IsHTMLElement(nsGkAtoms::menuitem)) {
|
||||
nsIAtom* tag = child->Tag();
|
||||
|
||||
if (tag == nsGkAtoms::menuitem) {
|
||||
HTMLMenuItemElement* menuitem = HTMLMenuItemElement::FromContent(child);
|
||||
|
||||
if (menuitem->IsHidden()) {
|
||||
@@ -225,7 +227,9 @@ HTMLMenuElement::TraverseContent(nsIContent* aContent,
|
||||
aBuilder->AddItemFor(menuitem, CanLoadIcon(child, icon));
|
||||
|
||||
aSeparator = ST_FALSE;
|
||||
} else if (child->IsHTMLElement(nsGkAtoms::menu) && !element->IsHidden()) {
|
||||
} else if (child->IsHTML(nsGkAtoms::hr)) {
|
||||
aBuilder->AddSeparator();
|
||||
} else if (tag == nsGkAtoms::menu && !element->IsHidden()) {
|
||||
if (child->HasAttr(kNameSpaceID_None, nsGkAtoms::label)) {
|
||||
nsAutoString label;
|
||||
child->GetAttr(kNameSpaceID_None, nsGkAtoms::label, label);
|
||||
|
||||
@@ -72,11 +72,11 @@ nsIContent*
|
||||
HTMLOptGroupElement::GetSelect()
|
||||
{
|
||||
nsIContent* parent = this;
|
||||
while ((parent = parent->GetParent()) && parent->IsHTMLElement()) {
|
||||
if (parent->IsHTMLElement(nsGkAtoms::select)) {
|
||||
while ((parent = parent->GetParent()) && parent->IsHTML()) {
|
||||
if (parent->Tag() == nsGkAtoms::select) {
|
||||
return parent;
|
||||
}
|
||||
if (!parent->IsHTMLElement(nsGkAtoms::optgroup)) {
|
||||
if (parent->Tag() != nsGkAtoms::optgroup) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,8 +311,7 @@ HTMLOptionElement::GetText(nsAString& aText)
|
||||
child->NodeType() == nsIDOMNode::CDATA_SECTION_NODE) {
|
||||
child->AppendTextTo(text);
|
||||
}
|
||||
if (child->IsHTMLElement(nsGkAtoms::script) ||
|
||||
child->IsSVGElement(nsGkAtoms::script)) {
|
||||
if (child->IsHTML(nsGkAtoms::script) || child->IsSVG(nsGkAtoms::script)) {
|
||||
child = child->GetNextNonChildNode(this);
|
||||
} else {
|
||||
child = child->GetNextNode(this);
|
||||
@@ -377,12 +376,12 @@ HTMLOptionElement::GetSelect()
|
||||
{
|
||||
nsIContent* parent = this;
|
||||
while ((parent = parent->GetParent()) &&
|
||||
parent->IsHTMLElement()) {
|
||||
parent->IsHTML()) {
|
||||
HTMLSelectElement* select = HTMLSelectElement::FromContent(parent);
|
||||
if (select) {
|
||||
return select;
|
||||
}
|
||||
if (!parent->IsHTMLElement(nsGkAtoms::optgroup)) {
|
||||
if (parent->Tag() != nsGkAtoms::optgroup) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ HTMLPictureElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
|
||||
// Find all img siblings after this <source> to notify them of its demise
|
||||
nsCOMPtr<nsIContent> child = GetChildAt(aIndex);
|
||||
nsCOMPtr<nsIContent> nextSibling;
|
||||
if (child && child->IsHTMLElement(nsGkAtoms::source)) {
|
||||
if (child && child->IsHTML(nsGkAtoms::source)) {
|
||||
nextSibling = child->GetNextSibling();
|
||||
}
|
||||
|
||||
|
||||
@@ -277,11 +277,11 @@ HTMLPropertiesCollection::CrawlSubtree(Element* aElement)
|
||||
while (aContent) {
|
||||
// We must check aContent against mRoot because
|
||||
// an element must not be its own property
|
||||
if (aContent == mRoot || !aContent->IsHTMLElement()) {
|
||||
if (aContent == mRoot || !aContent->IsHTML()) {
|
||||
// Move on to the next node in the tree
|
||||
aContent = aContent->GetNextNode(aElement);
|
||||
} else {
|
||||
MOZ_ASSERT(aContent->IsElement(), "IsHTMLElement() returned true!");
|
||||
MOZ_ASSERT(aContent->IsElement(), "IsHTML() returned true!");
|
||||
Element* element = aContent->AsElement();
|
||||
if (element->HasAttr(kNameSpaceID_None, nsGkAtoms::itemprop) &&
|
||||
!mProperties.Contains(element)) {
|
||||
|
||||
@@ -350,7 +350,7 @@ HTMLSelectElement::InsertOptionsIntoListRecurse(nsIContent* aOptions,
|
||||
}
|
||||
|
||||
// Recurse down into optgroups
|
||||
if (aOptions->IsHTMLElement(nsGkAtoms::optgroup)) {
|
||||
if (aOptions->IsHTML(nsGkAtoms::optgroup)) {
|
||||
mOptGroupCount++;
|
||||
|
||||
for (nsIContent* child = aOptions->GetFirstChild();
|
||||
@@ -391,7 +391,7 @@ HTMLSelectElement::RemoveOptionsFromListRecurse(nsIContent* aOptions,
|
||||
}
|
||||
|
||||
// Recurse down deeper for options
|
||||
if (mOptGroupCount && aOptions->IsHTMLElement(nsGkAtoms::optgroup)) {
|
||||
if (mOptGroupCount && aOptions->IsHTML(nsGkAtoms::optgroup)) {
|
||||
mOptGroupCount--;
|
||||
|
||||
for (nsIContent* child = aOptions->GetFirstChild();
|
||||
@@ -1136,7 +1136,7 @@ HTMLSelectElement::IsOptionDisabled(HTMLOptionElement* aOption)
|
||||
node;
|
||||
node = node->GetParentElement()) {
|
||||
// If we reached the select element, we're done
|
||||
if (node->IsHTMLElement(nsGkAtoms::select)) {
|
||||
if (node->IsHTML(nsGkAtoms::select)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1801,7 +1801,7 @@ AddOptionsRecurse(nsIContent* aRoot, HTMLOptionsCollection* aArray)
|
||||
HTMLOptionElement* opt = HTMLOptionElement::FromContent(cur);
|
||||
if (opt) {
|
||||
aArray->AppendOption(opt);
|
||||
} else if (cur->IsHTMLElement(nsGkAtoms::optgroup)) {
|
||||
} else if (cur->IsHTML(nsGkAtoms::optgroup)) {
|
||||
AddOptionsRecurse(cur, aArray);
|
||||
}
|
||||
}
|
||||
@@ -1882,7 +1882,7 @@ VerifyOptionsRecurse(nsIContent* aRoot, int32_t& aIndex,
|
||||
if (opt) {
|
||||
NS_ASSERTION(opt == aArray->ItemAsOption(aIndex++),
|
||||
"Options collection broken");
|
||||
} else if (cur->IsHTMLElement(nsGkAtoms::optgroup)) {
|
||||
} else if (cur->IsHTML(nsGkAtoms::optgroup)) {
|
||||
VerifyOptionsRecurse(cur, aIndex, aArray);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,8 @@ IsInFallbackContent(nsIContent* aContent)
|
||||
{
|
||||
nsINode* parentNode = aContent->GetParentNode();
|
||||
while (parentNode) {
|
||||
if (parentNode->IsHTMLElement(nsGkAtoms::content)) {
|
||||
if (parentNode->IsElement() &&
|
||||
parentNode->AsElement()->IsHTML(nsGkAtoms::content)) {
|
||||
return true;
|
||||
}
|
||||
parentNode = parentNode->GetParentNode();
|
||||
|
||||
@@ -157,7 +157,7 @@ SetBaseURIUsingFirstBaseWithHref(nsIDocument* aDocument, nsIContent* aMustMatch)
|
||||
|
||||
for (nsIContent* child = aDocument->GetFirstChild(); child;
|
||||
child = child->GetNextNode()) {
|
||||
if (child->IsHTMLElement(nsGkAtoms::base) &&
|
||||
if (child->IsHTML(nsGkAtoms::base) &&
|
||||
child->HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
||||
if (aMustMatch && child != aMustMatch) {
|
||||
return;
|
||||
@@ -194,7 +194,7 @@ SetBaseTargetUsingFirstBaseWithTarget(nsIDocument* aDocument,
|
||||
|
||||
for (nsIContent* child = aDocument->GetFirstChild(); child;
|
||||
child = child->GetNextNode()) {
|
||||
if (child->IsHTMLElement(nsGkAtoms::base) &&
|
||||
if (child->IsHTML(nsGkAtoms::base) &&
|
||||
child->HasAttr(kNameSpaceID_None, nsGkAtoms::target)) {
|
||||
if (aMustMatch && child != aMustMatch) {
|
||||
return;
|
||||
|
||||
@@ -86,12 +86,12 @@ HTMLSourceElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
aName == nsGkAtoms::sizes ||
|
||||
aName == nsGkAtoms::media ||
|
||||
aName == nsGkAtoms::type) &&
|
||||
parent && parent->IsHTMLElement(nsGkAtoms::picture)) {
|
||||
parent && parent->IsHTML(nsGkAtoms::picture)) {
|
||||
nsString strVal = aValue ? aValue->GetStringValue() : EmptyString();
|
||||
// Find all img siblings after this <source> and notify them of the change
|
||||
nsCOMPtr<nsIContent> sibling = AsContent();
|
||||
while ( (sibling = sibling->GetNextSibling()) ) {
|
||||
if (sibling->IsHTMLElement(nsGkAtoms::img)) {
|
||||
if (sibling->IsHTML(nsGkAtoms::img)) {
|
||||
HTMLImageElement *img = static_cast<HTMLImageElement*>(sibling.get());
|
||||
if (aName == nsGkAtoms::srcset) {
|
||||
img->PictureSourceSrcsetChanged(AsContent(), strVal, aNotify);
|
||||
@@ -147,11 +147,11 @@ HTMLSourceElement::BindToTree(nsIDocument *aDocument,
|
||||
if (aParent && aParent->IsNodeOfType(nsINode::eMEDIA)) {
|
||||
HTMLMediaElement* media = static_cast<HTMLMediaElement*>(aParent);
|
||||
media->NotifyAddedSource();
|
||||
} else if (aParent && aParent->IsHTMLElement(nsGkAtoms::picture)) {
|
||||
} else if (aParent && aParent->IsHTML(nsGkAtoms::picture)) {
|
||||
// Find any img siblings after this <source> and notify them
|
||||
nsCOMPtr<nsIContent> sibling = AsContent();
|
||||
while ( (sibling = sibling->GetNextSibling()) ) {
|
||||
if (sibling->IsHTMLElement(nsGkAtoms::img)) {
|
||||
if (sibling->IsHTML(nsGkAtoms::img)) {
|
||||
HTMLImageElement *img = static_cast<HTMLImageElement*>(sibling.get());
|
||||
img->PictureSourceAdded(AsContent());
|
||||
}
|
||||
|
||||
@@ -56,14 +56,14 @@ HTMLTableCellElement::GetTable() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (section->IsHTMLElement(nsGkAtoms::table)) {
|
||||
if (section->IsHTML(nsGkAtoms::table)) {
|
||||
// XHTML, without a row group.
|
||||
return static_cast<HTMLTableElement*>(section);
|
||||
}
|
||||
|
||||
// We have a row group.
|
||||
nsIContent* result = section->GetParent();
|
||||
if (result && result->IsHTMLElement(nsGkAtoms::table)) {
|
||||
if (result && result->IsHTML(nsGkAtoms::table)) {
|
||||
return static_cast<HTMLTableElement*>(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ NS_INTERFACE_MAP_END
|
||||
/* TBodies */ \
|
||||
for (nsIContent* _node = mParent->nsINode::GetFirstChild(); \
|
||||
_node; _node = _node->GetNextSibling()) { \
|
||||
if (_node->IsHTMLElement(nsGkAtoms::tbody)) { \
|
||||
if (_node->IsHTML(nsGkAtoms::tbody)) { \
|
||||
rowGroup = static_cast<HTMLTableSectionElement*>(_node); \
|
||||
rows = rowGroup->Rows(); \
|
||||
do { /* gives scoping */ \
|
||||
@@ -475,7 +475,7 @@ HTMLTableElement::CreateTBody()
|
||||
for (nsIContent* child = nsINode::GetLastChild();
|
||||
child;
|
||||
child = child->GetPreviousSibling()) {
|
||||
if (child->IsHTMLElement(nsGkAtoms::tbody)) {
|
||||
if (child->IsHTML(nsGkAtoms::tbody)) {
|
||||
referenceNode = child->GetNextSibling();
|
||||
break;
|
||||
}
|
||||
@@ -553,7 +553,7 @@ HTMLTableElement::InsertRow(int32_t aIndex, ErrorResult& aError)
|
||||
for (nsIContent* child = nsINode::GetLastChild();
|
||||
child;
|
||||
child = child->GetPreviousSibling()) {
|
||||
if (child->IsHTMLElement(nsGkAtoms::tbody)) {
|
||||
if (child->IsHTML(nsGkAtoms::tbody)) {
|
||||
rowGroup = child;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
}
|
||||
void SetTHead(HTMLTableSectionElement* aTHead, ErrorResult& aError)
|
||||
{
|
||||
if (aTHead && !aTHead->IsHTMLElement(nsGkAtoms::thead)) {
|
||||
if (aTHead && !aTHead->IsHTML(nsGkAtoms::thead)) {
|
||||
aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
|
||||
return;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
}
|
||||
void SetTFoot(HTMLTableSectionElement* aTFoot, ErrorResult& aError)
|
||||
{
|
||||
if (aTFoot && !aTFoot->IsHTMLElement(nsGkAtoms::tfoot)) {
|
||||
if (aTFoot && !aTFoot->IsHTML(nsGkAtoms::tfoot)) {
|
||||
aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
|
||||
return;
|
||||
}
|
||||
@@ -213,7 +213,7 @@ protected:
|
||||
{
|
||||
for (nsIContent* cur = nsINode::GetFirstChild(); cur;
|
||||
cur = cur->GetNextSibling()) {
|
||||
if (cur->IsHTMLElement(aTag)) {
|
||||
if (cur->IsHTML(aTag)) {
|
||||
return cur;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,10 +51,9 @@ HTMLTableSectionElement*
|
||||
HTMLTableRowElement::GetSection() const
|
||||
{
|
||||
nsIContent* parent = GetParent();
|
||||
if (parent &&
|
||||
parent->IsAnyOfHTMLElements(nsGkAtoms::thead,
|
||||
nsGkAtoms::tbody,
|
||||
nsGkAtoms::tfoot)) {
|
||||
if (parent && parent->IsHTML() && (parent->Tag() == nsGkAtoms::thead ||
|
||||
parent->Tag() == nsGkAtoms::tbody ||
|
||||
parent->Tag() == nsGkAtoms::tfoot)) {
|
||||
return static_cast<HTMLTableSectionElement*>(parent);
|
||||
}
|
||||
return nullptr;
|
||||
@@ -122,7 +121,10 @@ static bool
|
||||
IsCell(nsIContent *aContent, int32_t aNamespaceID,
|
||||
nsIAtom* aAtom, void *aData)
|
||||
{
|
||||
return aContent->IsAnyOfHTMLElements(nsGkAtoms::td, nsGkAtoms::th);
|
||||
nsIAtom* tag = aContent->Tag();
|
||||
|
||||
return ((tag == nsGkAtoms::td || tag == nsGkAtoms::th) &&
|
||||
aContent->IsHTML());
|
||||
}
|
||||
|
||||
nsIHTMLCollection*
|
||||
|
||||
@@ -641,7 +641,7 @@ ImageDocument::CreateSyntheticDocument()
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsRefPtr<mozilla::dom::NodeInfo> nodeInfo;
|
||||
nsRefPtr<NodeInfo> nodeInfo;
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::img, nullptr,
|
||||
kNameSpaceID_XHTML,
|
||||
nsIDOMNode::ELEMENT_NODE);
|
||||
|
||||
@@ -317,9 +317,8 @@ IsOffsetParent(nsIFrame* aFrame)
|
||||
// with display: table-cell with no actual table
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
|
||||
return content->IsAnyOfHTMLElements(nsGkAtoms::table,
|
||||
nsGkAtoms::td,
|
||||
nsGkAtoms::th);
|
||||
return content->IsHTML(nsGkAtoms::table) || content->IsHTML(nsGkAtoms::td)
|
||||
|| content->IsHTML(nsGkAtoms::th);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -347,8 +346,7 @@ nsGenericHTMLElement::GetOffsetRect(CSSIntRect& aRect)
|
||||
Element* docElement = GetComposedDoc()->GetRootElement();
|
||||
nsIContent* content = frame->GetContent();
|
||||
|
||||
if (content && (content->IsHTMLElement(nsGkAtoms::body) ||
|
||||
content == docElement)) {
|
||||
if (content && (content->IsHTML(nsGkAtoms::body) || content == docElement)) {
|
||||
parent = frame;
|
||||
}
|
||||
else {
|
||||
@@ -380,7 +378,7 @@ nsGenericHTMLElement::GetOffsetRect(CSSIntRect& aRect)
|
||||
|
||||
// Break if the ancestor frame type makes it suitable as offset parent
|
||||
// and this element is *not* positioned or if we found the body element.
|
||||
if (isOffsetParent || content->IsHTMLElement(nsGkAtoms::body)) {
|
||||
if (isOffsetParent || content->IsHTML(nsGkAtoms::body)) {
|
||||
offsetParent = content;
|
||||
break;
|
||||
}
|
||||
@@ -440,7 +438,7 @@ nsGenericHTMLElement::Spellcheck()
|
||||
// Has the state has been explicitly set?
|
||||
nsIContent* node;
|
||||
for (node = this; node; node = node->GetParent()) {
|
||||
if (node->IsHTMLElement()) {
|
||||
if (node->IsHTML()) {
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::_true, &nsGkAtoms::_false, nullptr};
|
||||
switch (node->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::spellcheck,
|
||||
@@ -601,7 +599,7 @@ HTMLFormElement*
|
||||
nsGenericHTMLElement::FindAncestorForm(HTMLFormElement* aCurrentForm)
|
||||
{
|
||||
NS_ASSERTION(!HasAttr(kNameSpaceID_None, nsGkAtoms::form) ||
|
||||
IsHTMLElement(nsGkAtoms::img),
|
||||
IsHTML(nsGkAtoms::img),
|
||||
"FindAncestorForm should not be called if @form is set!");
|
||||
|
||||
// Make sure we don't end up finding a form that's anonymous from
|
||||
@@ -611,7 +609,7 @@ nsGenericHTMLElement::FindAncestorForm(HTMLFormElement* aCurrentForm)
|
||||
nsIContent* content = this;
|
||||
while (content != bindingParent && content) {
|
||||
// If the current ancestor is a form, return it as our form
|
||||
if (content->IsHTMLElement(nsGkAtoms::form)) {
|
||||
if (content->IsHTML(nsGkAtoms::form)) {
|
||||
#ifdef DEBUG
|
||||
if (!nsContentUtils::IsInSameAnonymousTree(this, content)) {
|
||||
// It's possible that we started unbinding at |content| or
|
||||
@@ -667,8 +665,7 @@ nsGenericHTMLElement::CheckHandleEventForAnchorsPreconditions(
|
||||
nsCOMPtr<nsIContent> target = aVisitor.mPresContext->EventStateManager()->
|
||||
GetEventTargetContent(aVisitor.mEvent);
|
||||
|
||||
return !target || !target->IsHTMLElement(nsGkAtoms::area) ||
|
||||
IsHTMLElement(nsGkAtoms::area);
|
||||
return !target || !target->IsHTML(nsGkAtoms::area) || IsHTML(nsGkAtoms::area);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@@ -812,7 +809,7 @@ nsGenericHTMLElement::GetEventListenerManagerForAttr(nsIAtom* aAttrName,
|
||||
EventHandlerNonNull* \
|
||||
nsGenericHTMLElement::GetOn##name_() \
|
||||
{ \
|
||||
if (IsAnyOfHTMLElements(nsGkAtoms::body, nsGkAtoms::frameset)) { \
|
||||
if (Tag() == nsGkAtoms::body || Tag() == nsGkAtoms::frameset) { \
|
||||
/* XXXbz note to self: add tests for this! */ \
|
||||
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
|
||||
if (win) { \
|
||||
@@ -828,7 +825,7 @@ nsGenericHTMLElement::GetOn##name_() \
|
||||
void \
|
||||
nsGenericHTMLElement::SetOn##name_(EventHandlerNonNull* handler) \
|
||||
{ \
|
||||
if (IsAnyOfHTMLElements(nsGkAtoms::body, nsGkAtoms::frameset)) { \
|
||||
if (Tag() == nsGkAtoms::body || Tag() == nsGkAtoms::frameset) { \
|
||||
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
|
||||
if (!win) { \
|
||||
return; \
|
||||
@@ -845,7 +842,7 @@ nsGenericHTMLElement::SetOn##name_(EventHandlerNonNull* handler) \
|
||||
already_AddRefed<EventHandlerNonNull> \
|
||||
nsGenericHTMLElement::GetOn##name_() \
|
||||
{ \
|
||||
if (IsAnyOfHTMLElements(nsGkAtoms::body, nsGkAtoms::frameset)) { \
|
||||
if (Tag() == nsGkAtoms::body || Tag() == nsGkAtoms::frameset) { \
|
||||
/* XXXbz note to self: add tests for this! */ \
|
||||
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
|
||||
if (win) { \
|
||||
@@ -867,7 +864,7 @@ nsGenericHTMLElement::GetOn##name_() \
|
||||
void \
|
||||
nsGenericHTMLElement::SetOn##name_(EventHandlerNonNull* handler) \
|
||||
{ \
|
||||
if (IsAnyOfHTMLElements(nsGkAtoms::body, nsGkAtoms::frameset)) { \
|
||||
if (Tag() == nsGkAtoms::body || Tag() == nsGkAtoms::frameset) { \
|
||||
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
|
||||
if (!win) { \
|
||||
return; \
|
||||
@@ -1015,7 +1012,7 @@ nsGenericHTMLElement::ParseAttribute(int32_t aNamespaceID,
|
||||
|
||||
aResult.ParseAtom(aValue);
|
||||
|
||||
if (CanHaveName(NodeInfo()->NameAtom())) {
|
||||
if (CanHaveName(Tag())) {
|
||||
SetHasName();
|
||||
AddToNameTable(aResult.GetAtomValue());
|
||||
}
|
||||
@@ -1800,15 +1797,17 @@ nsGenericHTMLElement::GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu)
|
||||
bool
|
||||
nsGenericHTMLElement::IsLabelable() const
|
||||
{
|
||||
return IsAnyOfHTMLElements(nsGkAtoms::progress, nsGkAtoms::meter);
|
||||
return Tag() == nsGkAtoms::progress ||
|
||||
Tag() == nsGkAtoms::meter;
|
||||
}
|
||||
|
||||
bool
|
||||
nsGenericHTMLElement::IsInteractiveHTMLContent(bool aIgnoreTabindex) const
|
||||
{
|
||||
return IsAnyOfHTMLElements(nsGkAtoms::details, nsGkAtoms::embed,
|
||||
nsGkAtoms::keygen) ||
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::tabindex);
|
||||
return Tag() == nsGkAtoms::details ||
|
||||
Tag() == nsGkAtoms::embed ||
|
||||
Tag() == nsGkAtoms::keygen ||
|
||||
(!aIgnoreTabindex && HasAttr(kNameSpaceID_None, nsGkAtoms::tabindex));
|
||||
}
|
||||
|
||||
already_AddRefed<UndoManager>
|
||||
@@ -2402,7 +2401,7 @@ nsGenericHTMLFormElement::FormIdUpdated(Element* aOldElement,
|
||||
nsGenericHTMLFormElement* element =
|
||||
static_cast<nsGenericHTMLFormElement*>(aData);
|
||||
|
||||
NS_ASSERTION(element->IsHTMLElement(), "aData should be an HTML element");
|
||||
NS_ASSERTION(element->IsHTML(), "aData should be an HTML element");
|
||||
|
||||
element->UpdateFormOwner(false, aNewElement);
|
||||
|
||||
@@ -2477,7 +2476,7 @@ nsGenericHTMLFormElement::UpdateFormOwner(bool aBindToTree,
|
||||
"element should be equals to the current element "
|
||||
"associated with the id in @form!");
|
||||
|
||||
if (element && element->IsHTMLElement(nsGkAtoms::form)) {
|
||||
if (element && element->IsHTML(nsGkAtoms::form)) {
|
||||
mForm = static_cast<HTMLFormElement*>(element);
|
||||
}
|
||||
}
|
||||
@@ -2815,7 +2814,7 @@ nsGenericHTMLElement::IsCurrentBodyElement()
|
||||
{
|
||||
// TODO Bug 698498: Should this handle the case where GetBody returns a
|
||||
// frameset?
|
||||
if (!IsHTMLElement(nsGkAtoms::body)) {
|
||||
if (!IsHTML(nsGkAtoms::body)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -301,25 +301,6 @@ public:
|
||||
return rcFrame.height;
|
||||
}
|
||||
|
||||
// These methods are already implemented in nsIContent but we want something
|
||||
// faster for HTMLElements ignoring the namespace checking.
|
||||
// This is safe because we already know that we are in the HTML namespace.
|
||||
inline bool IsHTMLElement() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool IsHTMLElement(nsIAtom* aTag) const
|
||||
{
|
||||
return mNodeInfo->Equals(aTag);
|
||||
}
|
||||
|
||||
template<typename First, typename... Args>
|
||||
inline bool IsAnyOfHTMLElements(First aFirst, Args... aArgs) const
|
||||
{
|
||||
return IsNodeInternal(aFirst, aArgs...);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~nsGenericHTMLElement() {}
|
||||
|
||||
@@ -949,16 +930,19 @@ public:
|
||||
static inline bool
|
||||
ShouldExposeNameAsHTMLDocumentProperty(Element* aElement)
|
||||
{
|
||||
return aElement->IsHTMLElement() &&
|
||||
CanHaveName(aElement->NodeInfo()->NameAtom());
|
||||
return aElement->IsHTML() && CanHaveName(aElement->Tag());
|
||||
}
|
||||
static inline bool
|
||||
ShouldExposeIdAsHTMLDocumentProperty(Element* aElement)
|
||||
{
|
||||
return aElement->IsAnyOfHTMLElements(nsGkAtoms::img,
|
||||
nsGkAtoms::applet,
|
||||
nsGkAtoms::embed,
|
||||
nsGkAtoms::object);
|
||||
if (!aElement->IsHTML()) {
|
||||
return false;
|
||||
}
|
||||
nsIAtom* tag = aElement->Tag();
|
||||
return tag == nsGkAtoms::img ||
|
||||
tag == nsGkAtoms::applet ||
|
||||
tag == nsGkAtoms::embed ||
|
||||
tag == nsGkAtoms::object;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
||||
@@ -265,7 +265,7 @@ nsGenericHTMLFrameElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::src &&
|
||||
(!IsHTMLElement(nsGkAtoms::iframe) ||
|
||||
(Tag() != nsGkAtoms::iframe ||
|
||||
!HasAttr(kNameSpaceID_None,nsGkAtoms::srcdoc))) {
|
||||
// Don't propagate error here. The attribute was successfully set, that's
|
||||
// what we should reflect.
|
||||
|
||||
+15
-16
@@ -684,9 +684,9 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsHTMLDocument() || !docShell) { // no docshell for text/html XHR
|
||||
charsetSource = IsHTMLDocument() ? kCharsetFromFallback
|
||||
: kCharsetFromDocTypeDefault;
|
||||
if (!IsHTML() || !docShell) { // no docshell for text/html XHR
|
||||
charsetSource = IsHTML() ? kCharsetFromFallback
|
||||
: kCharsetFromDocTypeDefault;
|
||||
charset.AssignLiteral("UTF-8");
|
||||
TryChannelCharset(aChannel, charsetSource, charset, executor);
|
||||
parserCharsetSource = charsetSource;
|
||||
@@ -778,7 +778,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
||||
mParser->SetDocumentCharset(parserCharset, parserCharsetSource);
|
||||
mParser->SetCommand(aCommand);
|
||||
|
||||
if (!IsHTMLDocument()) {
|
||||
if (!IsHTML()) {
|
||||
MOZ_ASSERT(!loadAsHtml5);
|
||||
nsCOMPtr<nsIXMLContentSink> xmlsink;
|
||||
NS_NewXMLContentSink(getter_AddRefs(xmlsink), this, uri,
|
||||
@@ -863,7 +863,7 @@ nsHTMLDocument::EndLoad()
|
||||
void
|
||||
nsHTMLDocument::SetCompatibilityMode(nsCompatibility aMode)
|
||||
{
|
||||
NS_ASSERTION(IsHTMLDocument() || aMode == eCompatibility_FullStandards,
|
||||
NS_ASSERTION(IsHTML() || aMode == eCompatibility_FullStandards,
|
||||
"Bad compat mode for XHTML document!");
|
||||
|
||||
mCompatMode = aMode;
|
||||
@@ -1017,8 +1017,7 @@ nsHTMLDocument::GetBody()
|
||||
for (nsIContent* child = html->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsHTMLElement(nsGkAtoms::body) ||
|
||||
child->IsHTMLElement(nsGkAtoms::frameset)) {
|
||||
if (child->IsHTML(nsGkAtoms::body) || child->IsHTML(nsGkAtoms::frameset)) {
|
||||
return static_cast<nsGenericHTMLElement*>(child);
|
||||
}
|
||||
}
|
||||
@@ -1040,7 +1039,7 @@ NS_IMETHODIMP
|
||||
nsHTMLDocument::SetBody(nsIDOMHTMLElement* aBody)
|
||||
{
|
||||
nsCOMPtr<nsIContent> newBody = do_QueryInterface(aBody);
|
||||
MOZ_ASSERT(!newBody || newBody->IsHTMLElement(),
|
||||
MOZ_ASSERT(!newBody || newBody->IsHTML(),
|
||||
"How could we be an nsIContent but not actually HTML here?");
|
||||
ErrorResult rv;
|
||||
SetBody(static_cast<nsGenericHTMLElement*>(newBody.get()), rv);
|
||||
@@ -1055,10 +1054,10 @@ nsHTMLDocument::SetBody(nsGenericHTMLElement* newBody, ErrorResult& rv)
|
||||
// The body element must be either a body tag or a frameset tag. And we must
|
||||
// have a html root tag, otherwise GetBody will not return the newly set
|
||||
// body.
|
||||
if (!newBody ||
|
||||
!newBody->IsAnyOfHTMLElements(nsGkAtoms::body, nsGkAtoms::frameset) ||
|
||||
!root || !root->IsHTMLElement() ||
|
||||
!root->IsHTMLElement(nsGkAtoms::html)) {
|
||||
if (!newBody || !(newBody->Tag() == nsGkAtoms::body ||
|
||||
newBody->Tag() == nsGkAtoms::frameset) ||
|
||||
!root || !root->IsHTML() ||
|
||||
root->Tag() != nsGkAtoms::html) {
|
||||
rv.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
|
||||
return;
|
||||
}
|
||||
@@ -1421,7 +1420,7 @@ nsHTMLDocument::Open(JSContext* cx,
|
||||
{
|
||||
NS_ASSERTION(nsContentUtils::CanCallerAccess(static_cast<nsIDOMHTMLDocument*>(this)),
|
||||
"XOW should have caught this!");
|
||||
if (!IsHTMLDocument() || mDisableDocWrite || !IsMasterDocument()) {
|
||||
if (!IsHTML() || mDisableDocWrite || !IsMasterDocument()) {
|
||||
// No calling document.open() on XHTML
|
||||
rv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return nullptr;
|
||||
@@ -1767,7 +1766,7 @@ nsHTMLDocument::Close()
|
||||
void
|
||||
nsHTMLDocument::Close(ErrorResult& rv)
|
||||
{
|
||||
if (!IsHTMLDocument()) {
|
||||
if (!IsHTML()) {
|
||||
// No calling document.close() on XHTML!
|
||||
|
||||
rv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
@@ -1852,7 +1851,7 @@ nsHTMLDocument::WriteCommon(JSContext *cx,
|
||||
(mWriteLevel > NS_MAX_DOCUMENT_WRITE_DEPTH || mTooDeepWriteRecursion);
|
||||
NS_ENSURE_STATE(!mTooDeepWriteRecursion);
|
||||
|
||||
if (!IsHTMLDocument() || mDisableDocWrite || !IsMasterDocument()) {
|
||||
if (!IsHTML() || mDisableDocWrite || !IsMasterDocument()) {
|
||||
// No calling document.write*() on XHTML!
|
||||
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
@@ -1998,7 +1997,7 @@ nsHTMLDocument::GetElementsByName(const nsAString& aElementName,
|
||||
static bool MatchItems(nsIContent* aContent, int32_t aNameSpaceID,
|
||||
nsIAtom* aAtom, void* aData)
|
||||
{
|
||||
if (!aContent->IsHTMLElement()) {
|
||||
if (!(aContent->IsElement() && aContent->AsElement()->IsHTML())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ nsITextControlElement::GetWrapPropertyEnum(nsIContent* aContent,
|
||||
aWrapProp = eHTMLTextWrap_Soft; // the default
|
||||
|
||||
nsAutoString wrap;
|
||||
if (aContent->IsHTMLElement()) {
|
||||
if (aContent->IsHTML()) {
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::HARD, &nsGkAtoms::OFF, nullptr};
|
||||
|
||||
@@ -570,7 +570,7 @@ nsTextInputSelectionImpl::CompleteMove(bool aForward, bool aExtend)
|
||||
{
|
||||
nsIContent *child = parentDIV->GetLastChild();
|
||||
|
||||
if (child->IsHTMLElement(nsGkAtoms::br))
|
||||
if (child->Tag() == nsGkAtoms::br)
|
||||
{
|
||||
--offset;
|
||||
hint = CARET_ASSOCIATE_AFTER; // for Bug 106855
|
||||
|
||||
@@ -150,7 +150,7 @@ nsMathMLElement::ParseAttribute(int32_t aNamespaceID,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (IsMathMLElement(nsGkAtoms::math) && aAttribute == nsGkAtoms::mode) {
|
||||
if (Tag() == nsGkAtoms::math && aAttribute == nsGkAtoms::mode) {
|
||||
WarnDeprecated(nsGkAtoms::mode->GetUTF16String(),
|
||||
nsGkAtoms::display->GetUTF16String(), OwnerDoc());
|
||||
}
|
||||
@@ -232,40 +232,42 @@ nsMathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
};
|
||||
|
||||
// We don't support mglyph (yet).
|
||||
if (IsAnyOfMathMLElements(nsGkAtoms::ms_, nsGkAtoms::mi_, nsGkAtoms::mn_,
|
||||
nsGkAtoms::mo_, nsGkAtoms::mtext_,
|
||||
nsGkAtoms::mspace_))
|
||||
nsIAtom* tag = Tag();
|
||||
if (tag == nsGkAtoms::ms_ || tag == nsGkAtoms::mi_ ||
|
||||
tag == nsGkAtoms::mn_ || tag == nsGkAtoms::mo_ ||
|
||||
tag == nsGkAtoms::mtext_ || tag == nsGkAtoms::mspace_)
|
||||
return FindAttributeDependence(aAttribute, tokenMap);
|
||||
if (IsAnyOfMathMLElements(nsGkAtoms::mstyle_, nsGkAtoms::math))
|
||||
if (tag == nsGkAtoms::mstyle_ ||
|
||||
tag == nsGkAtoms::math)
|
||||
return FindAttributeDependence(aAttribute, mstyleMap);
|
||||
|
||||
if (IsMathMLElement(nsGkAtoms::mtable_))
|
||||
if (tag == nsGkAtoms::mtable_)
|
||||
return FindAttributeDependence(aAttribute, mtableMap);
|
||||
|
||||
if (IsMathMLElement(nsGkAtoms::mrow_))
|
||||
if (tag == nsGkAtoms::mrow_)
|
||||
return FindAttributeDependence(aAttribute, mrowMap);
|
||||
|
||||
if (IsAnyOfMathMLElements(nsGkAtoms::maction_,
|
||||
nsGkAtoms::maligngroup_,
|
||||
nsGkAtoms::malignmark_,
|
||||
nsGkAtoms::menclose_,
|
||||
nsGkAtoms::merror_,
|
||||
nsGkAtoms::mfenced_,
|
||||
nsGkAtoms::mfrac_,
|
||||
nsGkAtoms::mover_,
|
||||
nsGkAtoms::mpadded_,
|
||||
nsGkAtoms::mphantom_,
|
||||
nsGkAtoms::mprescripts_,
|
||||
nsGkAtoms::mroot_,
|
||||
nsGkAtoms::msqrt_,
|
||||
nsGkAtoms::msub_,
|
||||
nsGkAtoms::msubsup_,
|
||||
nsGkAtoms::msup_,
|
||||
nsGkAtoms::mtd_,
|
||||
nsGkAtoms::mtr_,
|
||||
nsGkAtoms::munder_,
|
||||
nsGkAtoms::munderover_,
|
||||
nsGkAtoms::none)) {
|
||||
if (tag == nsGkAtoms::maction_ ||
|
||||
tag == nsGkAtoms::maligngroup_ ||
|
||||
tag == nsGkAtoms::malignmark_ ||
|
||||
tag == nsGkAtoms::menclose_ ||
|
||||
tag == nsGkAtoms::merror_ ||
|
||||
tag == nsGkAtoms::mfenced_ ||
|
||||
tag == nsGkAtoms::mfrac_ ||
|
||||
tag == nsGkAtoms::mover_ ||
|
||||
tag == nsGkAtoms::mpadded_ ||
|
||||
tag == nsGkAtoms::mphantom_ ||
|
||||
tag == nsGkAtoms::mprescripts_ ||
|
||||
tag == nsGkAtoms::mroot_ ||
|
||||
tag == nsGkAtoms::msqrt_ ||
|
||||
tag == nsGkAtoms::msub_ ||
|
||||
tag == nsGkAtoms::msubsup_ ||
|
||||
tag == nsGkAtoms::msup_ ||
|
||||
tag == nsGkAtoms::mtd_ ||
|
||||
tag == nsGkAtoms::mtr_ ||
|
||||
tag == nsGkAtoms::munder_ ||
|
||||
tag == nsGkAtoms::munderover_ ||
|
||||
tag == nsGkAtoms::none) {
|
||||
return FindAttributeDependence(aAttribute, commonPresMap);
|
||||
}
|
||||
|
||||
@@ -970,8 +972,11 @@ nsMathMLElement::IsLink(nsIURI** aURI) const
|
||||
{
|
||||
// http://www.w3.org/TR/2010/REC-MathML3-20101021/chapter6.html#interf.link
|
||||
// The REC says that the following elements should not be linking elements:
|
||||
if (IsAnyOfMathMLElements(nsGkAtoms::mprescripts_, nsGkAtoms::none,
|
||||
nsGkAtoms::malignmark_, nsGkAtoms::maligngroup_)) {
|
||||
nsIAtom* tag = Tag();
|
||||
if (tag == nsGkAtoms::mprescripts_ ||
|
||||
tag == nsGkAtoms::none ||
|
||||
tag == nsGkAtoms::malignmark_ ||
|
||||
tag == nsGkAtoms::maligngroup_) {
|
||||
*aURI = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1004,11 +1004,13 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetTagType(nsPluginTagType *result)
|
||||
*result = nsPluginTagType_Unknown;
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryReferent(mContent);
|
||||
if (content->IsHTMLElement(nsGkAtoms::applet))
|
||||
nsIAtom *atom = content->Tag();
|
||||
|
||||
if (atom == nsGkAtoms::applet)
|
||||
*result = nsPluginTagType_Applet;
|
||||
else if (content->IsHTMLElement(nsGkAtoms::embed))
|
||||
else if (atom == nsGkAtoms::embed)
|
||||
*result = nsPluginTagType_Embed;
|
||||
else if (content->IsHTMLElement(nsGkAtoms::object))
|
||||
else if (atom == nsGkAtoms::object)
|
||||
*result = nsPluginTagType_Object;
|
||||
|
||||
return NS_OK;
|
||||
|
||||
@@ -780,7 +780,7 @@ nsSMILAnimationController::GetTargetIdentifierForAnimation(
|
||||
// animateTransform can only animate transforms, conversely transforms
|
||||
// can only be animated by animateTransform
|
||||
if (IsTransformAttribute(attributeNamespaceID, attributeName) !=
|
||||
(aAnimElem->IsSVGElement(nsGkAtoms::animateTransform)))
|
||||
(aAnimElem->Tag() == nsGkAtoms::animateTransform))
|
||||
return false;
|
||||
|
||||
// Look up target (animated) attribute-type
|
||||
|
||||
@@ -138,8 +138,7 @@ SVGAnimationElement::GetTargetElement()
|
||||
// We'll just call the other GetTargetElement method, and QI to the right type
|
||||
nsIContent* target = GetTargetElementContent();
|
||||
|
||||
return (target && target->IsSVGElement())
|
||||
? static_cast<nsSVGElement*>(target) : nullptr;
|
||||
return (target && target->IsSVG()) ? static_cast<nsSVGElement*>(target) : nullptr;
|
||||
}
|
||||
|
||||
float
|
||||
|
||||
+14
-13
@@ -41,13 +41,13 @@ SVGContentUtils::GetOuterSVGElement(nsSVGElement *aSVGElement)
|
||||
nsIContent *element = nullptr;
|
||||
nsIContent *ancestor = aSVGElement->GetFlattenedTreeParent();
|
||||
|
||||
while (ancestor && ancestor->IsSVGElement() &&
|
||||
!ancestor->IsSVGElement(nsGkAtoms::foreignObject)) {
|
||||
while (ancestor && ancestor->IsSVG() &&
|
||||
ancestor->Tag() != nsGkAtoms::foreignObject) {
|
||||
element = ancestor;
|
||||
ancestor = element->GetFlattenedTreeParent();
|
||||
}
|
||||
|
||||
if (element && element->IsSVGElement(nsGkAtoms::svg)) {
|
||||
if (element && element->Tag() == nsGkAtoms::svg) {
|
||||
return static_cast<SVGSVGElement*>(element);
|
||||
}
|
||||
return nullptr;
|
||||
@@ -101,7 +101,7 @@ GetStrokeDashData(SVGContentUtils::AutoStrokeOptions* aStrokeOptions,
|
||||
return eContinuousStroke;
|
||||
}
|
||||
Float pathScale = 1.0;
|
||||
if (aElement->IsSVGElement(nsGkAtoms::path)) {
|
||||
if (aElement->Tag() == nsGkAtoms::path) {
|
||||
pathScale = static_cast<SVGPathElement*>(aElement)->
|
||||
GetPathLengthScale(SVGPathElement::eForStroking);
|
||||
if (pathScale <= 0) {
|
||||
@@ -362,9 +362,10 @@ SVGContentUtils::EstablishesViewport(nsIContent *aContent)
|
||||
// Although SVG 1.1 states that <image> is an element that establishes a
|
||||
// viewport, this is really only for the document it references, not
|
||||
// for any child content, which is what this function is used for.
|
||||
return aContent && aContent->IsAnyOfSVGElements(nsGkAtoms::svg,
|
||||
nsGkAtoms::foreignObject,
|
||||
nsGkAtoms::symbol);
|
||||
return aContent && aContent->IsSVG() &&
|
||||
(aContent->Tag() == nsGkAtoms::svg ||
|
||||
aContent->Tag() == nsGkAtoms::foreignObject ||
|
||||
aContent->Tag() == nsGkAtoms::symbol);
|
||||
}
|
||||
|
||||
nsSVGElement*
|
||||
@@ -372,9 +373,9 @@ SVGContentUtils::GetNearestViewportElement(nsIContent *aContent)
|
||||
{
|
||||
nsIContent *element = aContent->GetFlattenedTreeParent();
|
||||
|
||||
while (element && element->IsSVGElement()) {
|
||||
while (element && element->IsSVG()) {
|
||||
if (EstablishesViewport(element)) {
|
||||
if (element->IsSVGElement(nsGkAtoms::foreignObject)) {
|
||||
if (element->Tag() == nsGkAtoms::foreignObject) {
|
||||
return nullptr;
|
||||
}
|
||||
return static_cast<nsSVGElement*>(element);
|
||||
@@ -392,8 +393,8 @@ GetCTMInternal(nsSVGElement *aElement, bool aScreenCTM, bool aHaveRecursed)
|
||||
nsSVGElement *element = aElement;
|
||||
nsIContent *ancestor = aElement->GetFlattenedTreeParent();
|
||||
|
||||
while (ancestor && ancestor->IsSVGElement() &&
|
||||
!ancestor->IsSVGElement(nsGkAtoms::foreignObject)) {
|
||||
while (ancestor && ancestor->IsSVG() &&
|
||||
ancestor->Tag() != nsGkAtoms::foreignObject) {
|
||||
element = static_cast<nsSVGElement*>(ancestor);
|
||||
matrix *= element->PrependLocalTransformsTo(gfxMatrix()); // i.e. *A*ppend
|
||||
if (!aScreenCTM && SVGContentUtils::EstablishesViewport(element)) {
|
||||
@@ -411,7 +412,7 @@ GetCTMInternal(nsSVGElement *aElement, bool aScreenCTM, bool aHaveRecursed)
|
||||
// didn't find a nearestViewportElement
|
||||
return gfx::Matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); // singular
|
||||
}
|
||||
if (!element->IsSVGElement(nsGkAtoms::svg)) {
|
||||
if (element->Tag() != nsGkAtoms::svg) {
|
||||
// Not a valid SVG fragment
|
||||
return gfx::Matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); // singular
|
||||
}
|
||||
@@ -427,7 +428,7 @@ GetCTMInternal(nsSVGElement *aElement, bool aScreenCTM, bool aHaveRecursed)
|
||||
if (!ancestor || !ancestor->IsElement()) {
|
||||
return gfx::ToMatrix(matrix);
|
||||
}
|
||||
if (ancestor->IsSVGElement()) {
|
||||
if (ancestor->IsSVG()) {
|
||||
return
|
||||
gfx::ToMatrix(matrix) * GetCTMInternal(static_cast<nsSVGElement*>(ancestor), true, true);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ SVGDocument::GetRootElement(ErrorResult& aRv)
|
||||
if (!root) {
|
||||
return nullptr;
|
||||
}
|
||||
if (!root->IsSVGElement()) {
|
||||
if (!root->IsSVG()) {
|
||||
aRv.Throw(NS_NOINTERFACE);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ SVGDocument::InsertChildAt(nsIContent* aKid, uint32_t aIndex, bool aNotify)
|
||||
{
|
||||
nsresult rv = XMLDocument::InsertChildAt(aKid, aIndex, aNotify);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && aKid->IsElement() && !aKid->IsSVGElement()) {
|
||||
if (NS_SUCCEEDED(rv) && aKid->IsElement() && !aKid->IsSVG()) {
|
||||
// We can get here when well formed XML with a non-SVG root element is
|
||||
// served with the SVG MIME type, for example. In that case we need to load
|
||||
// the non-SVG UA sheets or else we can get bugs like bug 1016145.
|
||||
|
||||
@@ -353,7 +353,7 @@ SVGFEImageElement::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect*
|
||||
void
|
||||
SVGFEImageElement::Invalidate()
|
||||
{
|
||||
if (GetParent() && GetParent()->IsSVGElement(nsGkAtoms::filter)) {
|
||||
if (GetParent() && GetParent()->IsSVG(nsGkAtoms::filter)) {
|
||||
static_cast<SVGFilterElement*>(GetParent())->Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ SVGFEMergeElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
|
||||
for (nsIContent* child = nsINode::GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsSVGElement(nsGkAtoms::feMergeNode)) {
|
||||
if (child->IsSVG(nsGkAtoms::feMergeNode)) {
|
||||
SVGFEMergeNodeElement* node = static_cast<SVGFEMergeNodeElement*>(child);
|
||||
aSources.AppendElement(nsSVGStringInfo(node->GetIn1(), node));
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ SVGForeignObjectElement::BindToTree(nsIDocument* aDocument,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
if (doc && doc->IsSVGDocument()) {
|
||||
if (doc && doc->IsSVG()) {
|
||||
// We assume that we're going to have HTML content, so we ensure that the
|
||||
// UA style sheets that nsDocumentViewer::CreateStyleSet skipped when
|
||||
// it saw the document was an SVG document are loaded.
|
||||
|
||||
@@ -33,7 +33,7 @@ static dom::SVGViewElement*
|
||||
GetViewElement(nsIDocument* aDocument, const nsAString& aId)
|
||||
{
|
||||
dom::Element* element = aDocument->GetElementById(aId);
|
||||
return (element && element->IsSVGElement(nsGkAtoms::view)) ?
|
||||
return (element && element->IsSVG(nsGkAtoms::view)) ?
|
||||
static_cast<dom::SVGViewElement*>(element) : nullptr;
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ bool
|
||||
SVGFragmentIdentifier::ProcessFragmentIdentifier(nsIDocument* aDocument,
|
||||
const nsAString& aAnchorName)
|
||||
{
|
||||
MOZ_ASSERT(aDocument->GetRootElement()->IsSVGElement(nsGkAtoms::svg),
|
||||
MOZ_ASSERT(aDocument->GetRootElement()->IsSVG(nsGkAtoms::svg),
|
||||
"expecting an SVG root element");
|
||||
|
||||
dom::SVGSVGElement* rootElement =
|
||||
|
||||
@@ -187,7 +187,7 @@ SVGMPathElement::GetReferencedPath()
|
||||
}
|
||||
|
||||
nsIContent* genericTarget = mHrefTarget.get();
|
||||
if (genericTarget && genericTarget->IsSVGElement(nsGkAtoms::path)) {
|
||||
if (genericTarget && genericTarget->IsSVG(nsGkAtoms::path)) {
|
||||
return static_cast<SVGPathElement*>(genericTarget);
|
||||
}
|
||||
return nullptr;
|
||||
@@ -246,7 +246,7 @@ SVGMPathElement::UnlinkHrefTarget(bool aNotifyParent)
|
||||
void
|
||||
SVGMPathElement::NotifyParentOfMpathChange(nsIContent* aParent)
|
||||
{
|
||||
if (aParent && aParent->IsSVGElement(nsGkAtoms::animateMotion)) {
|
||||
if (aParent && aParent->IsSVG(nsGkAtoms::animateMotion)) {
|
||||
|
||||
SVGAnimateMotionElement* animateMotionParent =
|
||||
static_cast<SVGAnimateMotionElement*>(aParent);
|
||||
|
||||
@@ -134,7 +134,7 @@ GetFirstMPathChild(nsIContent* aElem)
|
||||
for (nsIContent* child = aElem->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsSVGElement(nsGkAtoms::mpath)) {
|
||||
if (child->IsSVG(nsGkAtoms::mpath)) {
|
||||
return static_cast<SVGMPathElement*>(child);
|
||||
}
|
||||
}
|
||||
@@ -152,7 +152,7 @@ SVGMotionSMILAnimationFunction::
|
||||
MOZ_ASSERT(mPathVertices.IsEmpty(),
|
||||
"regenerating when we already have vertices");
|
||||
|
||||
if (!aContextElem->IsSVGElement()) {
|
||||
if (!aContextElem->IsSVG()) {
|
||||
NS_ERROR("Uh oh, SVG animateMotion element targeting a non-SVG node");
|
||||
return;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user