Bug 1447098 part 1. Rename FromContent on various DOM classes to FromNode. r=mystor

MozReview-Commit-ID: 202nkbmkwfR
This commit is contained in:
Boris Zbarsky 2018-03-21 17:39:04 -04:00
Родитель 5620b5bda6
Коммит 29d232e53f
96 изменённых файлов: 273 добавлений и 275 удалений

Просмотреть файл

@ -139,7 +139,7 @@ bool
HTMLLabelIterator::IsLabel(Accessible* aLabel)
{
dom::HTMLLabelElement* labelEl =
dom::HTMLLabelElement::FromContent(aLabel->GetContent());
dom::HTMLLabelElement::FromNode(aLabel->GetContent());
return labelEl && labelEl->GetControl() == mAcc->GetContent();
}

Просмотреть файл

@ -48,7 +48,7 @@ using namespace mozilla;
bool
nsCoreUtils::IsLabelWithControl(nsIContent* aContent)
{
dom::HTMLLabelElement* label = dom::HTMLLabelElement::FromContent(aContent);
dom::HTMLLabelElement* label = dom::HTMLLabelElement::FromNode(aContent);
if (label && label->GetControl())
return true;
@ -100,7 +100,7 @@ nsCoreUtils::DispatchClickEvent(nsITreeBoxObject *aTreeBoxObj,
nsCOMPtr<nsIContent> tcXULElm(do_QueryInterface(tcElm));
nsCOMPtr<nsIBoxObject> tcBoxObj =
nsXULElement::FromContent(tcXULElm)->GetBoxObject(IgnoreErrors());
nsXULElement::FromNode(tcXULElm)->GetBoxObject(IgnoreErrors());
int32_t tcX = 0;
tcBoxObj->GetX(&tcX);
@ -493,7 +493,7 @@ nsCoreUtils::GetTreeBodyBoxObject(nsITreeBoxObject *aTreeBoxObj)
nsCOMPtr<nsIDOMElement> tcElm;
aTreeBoxObj->GetTreeBody(getter_AddRefs(tcElm));
nsCOMPtr<nsIContent> tcContent(do_QueryInterface(tcElm));
RefPtr<nsXULElement> tcXULElm = nsXULElement::FromContentOrNull(tcContent);
RefPtr<nsXULElement> tcXULElm = nsXULElement::FromNodeOrNull(tcContent);
if (!tcXULElm)
return nullptr;
@ -510,7 +510,7 @@ nsCoreUtils::GetTreeBoxObject(nsIContent *aContent)
kNameSpaceID_XUL)) {
// We will get the nsITreeBoxObject from the tree node
RefPtr<nsXULElement> xulElement =
nsXULElement::FromContent(currentContent);
nsXULElement::FromNode(currentContent);
nsCOMPtr<nsIBoxObject> box = xulElement->GetBoxObject(IgnoreErrors());
nsCOMPtr<nsITreeBoxObject> treeBox(do_QueryInterface(box));
if (treeBox)

Просмотреть файл

@ -645,7 +645,7 @@ Accessible::RelativeBounds(nsIFrame** aBoundingFrame) const
if (canvasFrame) {
*aBoundingFrame = canvasFrame;
dom::HTMLCanvasElement *canvas =
dom::HTMLCanvasElement::FromContent(canvasFrame->GetContent());
dom::HTMLCanvasElement::FromNode(canvasFrame->GetContent());
// get the bounding rect of the hit region
nsRect bounds;
@ -1067,7 +1067,7 @@ Accessible::NativeAttributes()
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::tag, tagName);
// Expose draggable object attribute.
if (auto htmlElement = nsGenericHTMLElement::FromContent(mContent)) {
if (auto htmlElement = nsGenericHTMLElement::FromNode(mContent)) {
if (htmlElement->Draggable()) {
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::draggable,
NS_LITERAL_STRING("true"));

Просмотреть файл

@ -203,7 +203,7 @@ ImageAccessible::GetLongDescURI() const
target->IsHTMLElement(nsGkAtoms::area)) &&
target->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
nsGenericHTMLElement* element =
nsGenericHTMLElement::FromContent(target);
nsGenericHTMLElement::FromNode(target);
nsCOMPtr<nsIURI> uri;
element->GetURIAttr(nsGkAtoms::href, nullptr, getter_AddRefs(uri));

Просмотреть файл

@ -68,7 +68,7 @@ HTMLLabelAccessible::RelationByType(RelationType aType)
{
Relation rel = AccessibleWrap::RelationByType(aType);
if (aType == RelationType::LABEL_FOR) {
dom::HTMLLabelElement* label = dom::HTMLLabelElement::FromContent(mContent);
dom::HTMLLabelElement* label = dom::HTMLLabelElement::FromNode(mContent);
rel.AppendTarget(mDoc, label->GetControl());
}
@ -139,7 +139,7 @@ HTMLSummaryAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName)
return;
}
dom::HTMLSummaryElement* summary = dom::HTMLSummaryElement::FromContent(mContent);
dom::HTMLSummaryElement* summary = dom::HTMLSummaryElement::FromNode(mContent);
if (!summary) {
return;
}
@ -171,7 +171,7 @@ HTMLSummaryAccessible::NativeState()
{
uint64_t state = HyperTextAccessibleWrap::NativeState();
dom::HTMLSummaryElement* summary = dom::HTMLSummaryElement::FromContent(mContent);
dom::HTMLSummaryElement* summary = dom::HTMLSummaryElement::FromNode(mContent);
if (!summary) {
return state;
}

Просмотреть файл

@ -81,7 +81,7 @@ HTMLCheckboxAccessible::NativeState()
uint64_t state = LeafAccessible::NativeState();
state |= states::CHECKABLE;
HTMLInputElement* input = HTMLInputElement::FromContent(mContent);
HTMLInputElement* input = HTMLInputElement::FromNode(mContent);
if (!input)
return state;
@ -115,7 +115,7 @@ HTMLRadioButtonAccessible::NativeState()
state |= states::CHECKABLE;
HTMLInputElement* input = HTMLInputElement::FromContent(mContent);
HTMLInputElement* input = HTMLInputElement::FromNode(mContent);
if (input && input->Checked())
state |= states::CHECKED;
@ -345,13 +345,13 @@ HTMLTextFieldAccessible::Value(nsString& aValue)
if (NativeState() & states::PROTECTED) // Don't return password text!
return;
HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromContent(mContent);
HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromNode(mContent);
if (textArea) {
textArea->GetValue(aValue);
return;
}
HTMLInputElement* input = HTMLInputElement::FromContent(mContent);
HTMLInputElement* input = HTMLInputElement::FromNode(mContent);
if (input) {
// Pass NonSystem as the caller type, to be safe. We don't expect to have a
// file input here.
@ -392,7 +392,7 @@ HTMLTextFieldAccessible::NativeState()
}
// Is it an <input> or a <textarea> ?
HTMLInputElement* input = HTMLInputElement::FromContent(mContent);
HTMLInputElement* input = HTMLInputElement::FromNode(mContent);
state |= input && input->IsSingleLineTextControl() ?
states::SINGLE_LINE : states::MULTI_LINE;
@ -557,8 +557,7 @@ HTMLSpinnerAccessible::Value(nsString& aValue)
// Pass NonSystem as the caller type, to be safe. We don't expect to have a
// file input here.
HTMLInputElement::FromContent(mContent)->GetValue(aValue,
CallerType::NonSystem);
HTMLInputElement::FromNode(mContent)->GetValue(aValue, CallerType::NonSystem);
}
double
@ -568,7 +567,7 @@ HTMLSpinnerAccessible::MaxValue() const
if (!IsNaN(value))
return value;
return HTMLInputElement::FromContent(mContent)->GetMaximum().toDouble();
return HTMLInputElement::FromNode(mContent)->GetMaximum().toDouble();
}
@ -579,7 +578,7 @@ HTMLSpinnerAccessible::MinValue() const
if (!IsNaN(value))
return value;
return HTMLInputElement::FromContent(mContent)->GetMinimum().toDouble();
return HTMLInputElement::FromNode(mContent)->GetMinimum().toDouble();
}
double
@ -589,7 +588,7 @@ HTMLSpinnerAccessible::Step() const
if (!IsNaN(value))
return value;
return HTMLInputElement::FromContent(mContent)->GetStep().toDouble();
return HTMLInputElement::FromNode(mContent)->GetStep().toDouble();
}
double
@ -599,14 +598,14 @@ HTMLSpinnerAccessible::CurValue() const
if (!IsNaN(value))
return value;
return HTMLInputElement::FromContent(mContent)->GetValueAsDecimal().toDouble();
return HTMLInputElement::FromNode(mContent)->GetValueAsDecimal().toDouble();
}
bool
HTMLSpinnerAccessible::SetCurValue(double aValue)
{
ErrorResult er;
HTMLInputElement::FromContent(mContent)->SetValueAsNumber(aValue, er);
HTMLInputElement::FromNode(mContent)->SetValueAsNumber(aValue, er);
return !er.Failed();
}
@ -636,8 +635,8 @@ HTMLRangeAccessible::Value(nsString& aValue)
// Pass NonSystem as the caller type, to be safe. We don't expect to have a
// file input here.
HTMLInputElement::FromContent(mContent)->GetValue(aValue,
CallerType::NonSystem);
HTMLInputElement::FromNode(mContent)->GetValue(aValue,
CallerType::NonSystem);
}
double
@ -647,7 +646,7 @@ HTMLRangeAccessible::MaxValue() const
if (!IsNaN(value))
return value;
return HTMLInputElement::FromContent(mContent)->GetMaximum().toDouble();
return HTMLInputElement::FromNode(mContent)->GetMaximum().toDouble();
}
double
@ -657,7 +656,7 @@ HTMLRangeAccessible::MinValue() const
if (!IsNaN(value))
return value;
return HTMLInputElement::FromContent(mContent)->GetMinimum().toDouble();
return HTMLInputElement::FromNode(mContent)->GetMinimum().toDouble();
}
double
@ -667,7 +666,7 @@ HTMLRangeAccessible::Step() const
if (!IsNaN(value))
return value;
return HTMLInputElement::FromContent(mContent)->GetStep().toDouble();
return HTMLInputElement::FromNode(mContent)->GetStep().toDouble();
}
double
@ -677,14 +676,14 @@ HTMLRangeAccessible::CurValue() const
if (!IsNaN(value))
return value;
return HTMLInputElement::FromContent(mContent)->GetValueAsDecimal().toDouble();
return HTMLInputElement::FromNode(mContent)->GetValueAsDecimal().toDouble();
}
bool
HTMLRangeAccessible::SetCurValue(double aValue)
{
ErrorResult er;
HTMLInputElement::FromContent(mContent)->SetValueAsNumber(aValue, er);
HTMLInputElement::FromNode(mContent)->SetValueAsNumber(aValue, er);
return !er.Failed();
}

Просмотреть файл

@ -163,7 +163,7 @@ HTMLAreaAccessible::Description(nsString& aDescription)
// Still to do - follow IE's standard here
RefPtr<dom::HTMLAreaElement> area =
dom::HTMLAreaElement::FromContentOrNull(mContent);
dom::HTMLAreaElement::FromNodeOrNull(mContent);
if (area)
area->GetShape(aDescription);
}

Просмотреть файл

@ -186,7 +186,7 @@ HTMLSelectOptionAccessible::NativeState()
return state;
// Are we selected?
HTMLOptionElement* option = HTMLOptionElement::FromContent(mContent);
HTMLOptionElement* option = HTMLOptionElement::FromNode(mContent);
bool selected = option && option->Selected();
if (selected)
state |= states::SELECTED;
@ -280,7 +280,7 @@ HTMLSelectOptionAccessible::DoAction(uint8_t aIndex)
void
HTMLSelectOptionAccessible::SetSelected(bool aSelect)
{
HTMLOptionElement* option = HTMLOptionElement::FromContent(mContent);
HTMLOptionElement* option = HTMLOptionElement::FromNode(mContent);
if (option)
option->SetSelected(aSelect);
}
@ -516,7 +516,7 @@ HTMLComboboxAccessible::SetCurrentItem(Accessible* aItem)
Accessible*
HTMLComboboxAccessible::SelectedOption() const
{
HTMLSelectElement* select = HTMLSelectElement::FromContent(mContent);
HTMLSelectElement* select = HTMLSelectElement::FromNode(mContent);
int32_t selectedIndex = select->SelectedIndex();
if (selectedIndex >= 0) {

Просмотреть файл

@ -480,7 +480,7 @@ HTMLTableAccessible::Caption() const
void
HTMLTableAccessible::Summary(nsString& aSummary)
{
dom::HTMLTableElement* table = dom::HTMLTableElement::FromContent(mContent);
dom::HTMLTableElement* table = dom::HTMLTableElement::FromNode(mContent);
if (table)
table->GetSummary(aSummary);

Просмотреть файл

@ -52,7 +52,7 @@ XULTabAccessible::DoAction(uint8_t index)
{
if (index == eAction_Switch) {
// XXXbz Could this just FromContent?
RefPtr<nsXULElement> tab = nsXULElement::FromContentOrNull(mContent);
RefPtr<nsXULElement> tab = nsXULElement::FromNodeOrNull(mContent);
if (tab) {
tab->Click(mozilla::dom::CallerType::System);
return true;

Просмотреть файл

@ -13735,7 +13735,7 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent,
// If this is an anchor element, grab its type property to use as a hint
nsAutoString typeHint;
RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::FromContent(aContent);
RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::FromNode(aContent);
if (anchor) {
anchor->GetType(typeHint);
NS_ConvertUTF16toUTF8 utf8Hint(typeHint);

Просмотреть файл

@ -26,7 +26,7 @@ ExplicitChildIterator::ExplicitChildIterator(const nsIContent* aParent,
mIndexInInserted(0)
{
mParentAsSlot = nsDocument::IsShadowDOMEnabled(mParent) ?
HTMLSlotElement::FromContent(mParent) : nullptr;
HTMLSlotElement::FromNode(mParent) : nullptr;
}
nsIContent*

Просмотреть файл

@ -1537,7 +1537,7 @@ Element::GetElementsByMatching(nsElementMatchFunc aFunc,
static uint32_t
EditableInclusiveDescendantCount(nsIContent* aContent)
{
auto htmlElem = nsGenericHTMLElement::FromContent(aContent);
auto htmlElem = nsGenericHTMLElement::FromNode(aContent);
if (htmlElem) {
return htmlElem->EditableInclusiveDescendantCount();
}
@ -1577,7 +1577,7 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
#ifdef MOZ_XUL
// First set the binding parent
nsXULElement* xulElem = nsXULElement::FromContent(this);
nsXULElement* xulElem = nsXULElement::FromNode(this);
if (xulElem) {
xulElem->SetXULBindingParent(aBindingParent);
}
@ -1979,7 +1979,7 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
bool clearBindingParent = true;
#ifdef MOZ_XUL
if (nsXULElement* xulElem = nsXULElement::FromContent(this)) {;
if (nsXULElement* xulElem = nsXULElement::FromNode(this)) {;
xulElem->SetXULBindingParent(nullptr);
clearBindingParent = false;
}

Просмотреть файл

@ -619,7 +619,7 @@ ShadowRoot::ContentInserted(nsIContent* aChild)
// If parent's root is a shadow root, and parent is a slot whose assigned
// nodes is the empty list, then run signal a slot change for parent.
HTMLSlotElement* slot = HTMLSlotElement::FromContentOrNull(aChild->GetParent());
HTMLSlotElement* slot = HTMLSlotElement::FromNodeOrNull(aChild->GetParent());
if (slot && slot->GetContainingShadow() == this &&
slot->AssignedNodes().IsEmpty()) {
slot->EnqueueSlotChangeEvent();
@ -655,7 +655,7 @@ ShadowRoot::ContentRemoved(nsIContent* aChild, nsIContent* aPreviousSibling)
// If parent's root is a shadow root, and parent is a slot whose assigned
// nodes is the empty list, then run signal a slot change for parent.
HTMLSlotElement* slot = HTMLSlotElement::FromContentOrNull(aChild->GetParent());
HTMLSlotElement* slot = HTMLSlotElement::FromNodeOrNull(aChild->GetParent());
if (slot && slot->GetContainingShadow() == this &&
slot->AssignedNodes().IsEmpty()) {
slot->EnqueueSlotChangeEvent();

Просмотреть файл

@ -509,7 +509,7 @@ DragDataProducer::Produce(DataTransfer* aDataTransfer,
// set for linked images, and links
nsCOMPtr<nsIContent> linkNode;
RefPtr<HTMLAreaElement> areaElem = HTMLAreaElement::FromContentOrNull(draggedNode);
RefPtr<HTMLAreaElement> areaElem = HTMLAreaElement::FromNodeOrNull(draggedNode);
if (areaElem) {
// use the alt text (or, if missing, the href) as the title
areaElem->GetAttribute(NS_LITERAL_STRING("alt"), mTitleString);

Просмотреть файл

@ -546,7 +546,7 @@ nsContentList::GetSupportedNames(nsTArray<nsString>& aNames)
}
}
nsGenericHTMLElement* el = nsGenericHTMLElement::FromContent(content);
nsGenericHTMLElement* el = nsGenericHTMLElement::FromNode(content);
if (el) {
// XXXbz should we be checking for particular tags here? How
// stable is this part of the spec?

Просмотреть файл

@ -3893,7 +3893,7 @@ nsContentUtils::ContentIsDraggable(nsIContent* aContent)
{
MOZ_ASSERT(aContent);
if (auto htmlElement = nsGenericHTMLElement::FromContent(aContent)) {
if (auto htmlElement = nsGenericHTMLElement::FromNode(aContent)) {
if (htmlElement->Draggable()) {
return true;
}

Просмотреть файл

@ -1480,8 +1480,8 @@ nsDOMWindowUtils::CompareCanvases(nsISupports *aCanvas1,
nsCOMPtr<nsIContent> contentCanvas1 = do_QueryInterface(aCanvas1);
nsCOMPtr<nsIContent> contentCanvas2 = do_QueryInterface(aCanvas2);
auto canvas1 = HTMLCanvasElement::FromContentOrNull(contentCanvas1);
auto canvas2 = HTMLCanvasElement::FromContentOrNull(contentCanvas2);
auto canvas1 = HTMLCanvasElement::FromNodeOrNull(contentCanvas1);
auto canvas2 = HTMLCanvasElement::FromNodeOrNull(contentCanvas2);
if (!canvas1 || !canvas2) {
return NS_ERROR_FAILURE;
@ -4167,7 +4167,7 @@ nsDOMWindowUtils::ForceUseCounterFlush(nsIDOMNode *aNode)
}
if (nsCOMPtr<nsIContent> content = do_QueryInterface(aNode)) {
if (HTMLImageElement* img = HTMLImageElement::FromContent(content)) {
if (HTMLImageElement* img = HTMLImageElement::FromNode(content)) {
img->FlushUseCounters();
return NS_OK;
}

Просмотреть файл

@ -4710,7 +4710,7 @@ static void
CheckIfContainsEMEContent(nsISupports* aSupports, void* aContainsEME)
{
nsCOMPtr<nsIContent> content(do_QueryInterface(aSupports));
if (auto mediaElem = HTMLMediaElement::FromContentOrNull(content)) {
if (auto mediaElem = HTMLMediaElement::FromNodeOrNull(content)) {
bool* contains = static_cast<bool*>(aContainsEME);
if (mediaElem->GetMediaKeys()) {
*contains = true;
@ -4731,7 +4731,7 @@ static void
CheckIfContainsMSEContent(nsISupports* aSupports, void* aContainsMSE)
{
nsCOMPtr<nsIContent> content(do_QueryInterface(aSupports));
if (auto mediaElem = HTMLMediaElement::FromContentOrNull(content)) {
if (auto mediaElem = HTMLMediaElement::FromNodeOrNull(content)) {
bool* contains = static_cast<bool*>(aContainsMSE);
RefPtr<MediaSource> ms = mediaElem->GetMozMediaSourceObject();
if (ms) {
@ -4753,7 +4753,7 @@ static void
NotifyActivityChanged(nsISupports *aSupports, void *aUnused)
{
nsCOMPtr<nsIContent> content(do_QueryInterface(aSupports));
if (auto mediaElem = HTMLMediaElement::FromContentOrNull(content)) {
if (auto mediaElem = HTMLMediaElement::FromNodeOrNull(content)) {
mediaElem->NotifyOwnerDocumentActivityChanged();
}
nsCOMPtr<nsIObjectLoadingContent> objectLoadingContent(do_QueryInterface(aSupports));
@ -8051,7 +8051,7 @@ nsIDocument::Sanitize()
for (uint32_t i = 0; i < length; ++i) {
NS_ASSERTION(nodes->Item(i), "null item in node list!");
RefPtr<HTMLInputElement> input = HTMLInputElement::FromContentOrNull(nodes->Item(i));
RefPtr<HTMLInputElement> input = HTMLInputElement::FromNodeOrNull(nodes->Item(i));
if (!input)
continue;
@ -8078,7 +8078,7 @@ nsIDocument::Sanitize()
for (uint32_t i = 0; i < length; ++i) {
NS_ASSERTION(nodes->Item(i), "null item in nodelist");
HTMLFormElement* form = HTMLFormElement::FromContent(nodes->Item(i));
HTMLFormElement* form = HTMLFormElement::FromNode(nodes->Item(i));
if (!form)
continue;
@ -10068,7 +10068,7 @@ nsIDocument::CaretPositionFromPoint(float aX, float aY)
if (nodeIsAnonymous) {
node = ptFrame->GetContent();
nsIContent* nonanon = node->FindFirstNonChromeOnlyAccessContent();
HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromContent(nonanon);
HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromNode(nonanon);
nsITextControlFrame* textFrame = do_QueryFrame(nonanon->GetPrimaryFrame());
nsNumberControlFrame* numberFrame = do_QueryFrame(nonanon->GetPrimaryFrame());
if (textFrame || numberFrame) {

Просмотреть файл

@ -573,7 +573,7 @@ nsFrameLoader::ReallyStartLoadingInternal()
// load iframe referrer attribute if enabled in preferences
// per element referrer overrules document wide referrer if enabled
net::ReferrerPolicy referrerPolicy = mOwnerContent->OwnerDoc()->GetReferrerPolicy();
HTMLIFrameElement* iframe = HTMLIFrameElement::FromContent(mOwnerContent);
HTMLIFrameElement* iframe = HTMLIFrameElement::FromNode(mOwnerContent);
if (iframe) {
net::ReferrerPolicy iframeReferrerPolicy = iframe->GetReferrerPolicyAsEnum();
if (iframeReferrerPolicy != net::RP_Unset) {
@ -2248,7 +2248,7 @@ nsFrameLoader::MaybeCreateDocShell()
// Note: ApplySandboxFlags should be called after mDocShell->SetFrameType
// because we need to get the correct presentation URL in ApplySandboxFlags.
uint32_t sandboxFlags = 0;
HTMLIFrameElement* iframe = HTMLIFrameElement::FromContent(mOwnerContent);
HTMLIFrameElement* iframe = HTMLIFrameElement::FromNode(mOwnerContent);
if (iframe) {
sandboxFlags = iframe->GetSandboxFlags();
}

Просмотреть файл

@ -1008,22 +1008,22 @@ inline nsIContent* nsINode::AsContent()
return static_cast<nsIContent*>(this);
}
#define NS_IMPL_FROMCONTENT_HELPER(_class, _check) \
static _class* FromContent(nsINode* aContent) \
{ \
return aContent->_check ? static_cast<_class*>(aContent) : nullptr; \
} \
static const _class* FromContent(const nsINode* aContent) \
{ \
return aContent->_check ? static_cast<const _class*>(aContent) : nullptr; \
} \
static _class* FromContentOrNull(nsINode* aContent) \
{ \
return aContent ? FromContent(aContent) : nullptr; \
} \
static const _class* FromContentOrNull(const nsINode* aContent) \
{ \
return aContent ? FromContent(aContent) : nullptr; \
#define NS_IMPL_FROMCONTENT_HELPER(_class, _check) \
static _class* FromNode(nsINode* aNode) \
{ \
return aNode->_check ? static_cast<_class*>(aNode) : nullptr; \
} \
static const _class* FromNode(const nsINode* aNode) \
{ \
return aNode->_check ? static_cast<const _class*>(aNode) : nullptr; \
} \
static _class* FromNodeOrNull(nsINode* aNode) \
{ \
return aNode ? FromNode(aNode) : nullptr; \
} \
static const _class* FromNodeOrNull(const nsINode* aNode) \
{ \
return aNode ? FromNode(aNode) : nullptr; \
}
#define NS_IMPL_FROMCONTENT(_class, _nsid) \

Просмотреть файл

@ -95,7 +95,7 @@ GetFlattenedTreeParentNode(const nsINode* aNode)
}
if (parentAsContent->IsInShadowTree()) {
if (auto* slot = mozilla::dom::HTMLSlotElement::FromContent(parentAsContent)) {
if (auto* slot = mozilla::dom::HTMLSlotElement::FromNode(parentAsContent)) {
// If the assigned nodes list is empty, we're fallback content which is
// active, otherwise we are not part of the flat tree.
return slot->AssignedNodes().IsEmpty()

Просмотреть файл

@ -560,7 +560,7 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
if (wasRegistered && oldDoc != newDoc) {
nsIContent* content = aNode->AsContent();
if (auto mediaElem = HTMLMediaElement::FromContentOrNull(content)) {
if (auto mediaElem = HTMLMediaElement::FromNodeOrNull(content)) {
mediaElem->NotifyOwnerDocumentActivityChanged();
}
nsCOMPtr<nsIObjectLoadingContent> objectLoadingContent(do_QueryInterface(aNode));

Просмотреть файл

@ -889,7 +889,7 @@ nsObjectLoadingContent::GetNestedParams(nsTArray<MozPluginParameter>& aParams)
nsCOMPtr<nsIContent> parent = element->GetParent();
RefPtr<HTMLObjectElement> objectElement;
while (!objectElement && parent) {
objectElement = HTMLObjectElement::FromContent(parent);
objectElement = HTMLObjectElement::FromNode(parent);
parent = parent->GetParent();
}
@ -2969,10 +2969,10 @@ nsObjectLoadingContent::LoadFallback(FallbackType aType, bool aNotify) {
aType = eFallbackAlternate;
}
if (thisIsObject) {
if (auto embed = HTMLEmbedElement::FromContent(child)) {
if (auto embed = HTMLEmbedElement::FromNode(child)) {
embed->StartObjectLoad(true, true);
skipChildDescendants = true;
} else if (auto object = HTMLObjectElement::FromContent(child)) {
} else if (auto object = HTMLObjectElement::FromNode(child)) {
object->StartObjectLoad(true, true);
skipChildDescendants = true;
}
@ -3802,7 +3802,7 @@ nsObjectLoadingContent::BlockEmbedOrObjectContentLoading()
// If we have an ancestor that is an object with a source, it'll have an
// associated displayed type. If that type is not null, don't load content
// for the embed.
if (HTMLObjectElement* object = HTMLObjectElement::FromContent(parent)) {
if (HTMLObjectElement* object = HTMLObjectElement::FromNode(parent)) {
uint32_t type = object->DisplayedType();
if (type != eType_Null) {
return true;

Просмотреть файл

@ -2288,7 +2288,7 @@ nsRange::CutContents(DocumentFragment** aFragment)
// XXX_kin: We need to also handle ProcessingInstruction
// XXX_kin: according to the spec.
if (auto charData = CharacterData::FromContent(node)) {
if (auto charData = CharacterData::FromNode(node)) {
uint32_t dataLength = 0;
if (node == startContainer) {
@ -2725,7 +2725,7 @@ nsRange::CloneContents(ErrorResult& aRv)
// XXX_kin: We need to also handle ProcessingInstruction
// XXX_kin: according to the spec.
if (auto charData = CharacterData::FromContent(clone))
if (auto charData = CharacterData::FromNode(clone))
{
if (node == mEnd.Container()) {
// We only need the data before mEndOffset, so get rid of any

Просмотреть файл

@ -224,7 +224,7 @@ nsWindowRoot::GetControllers(bool aForVisibleWindow,
getter_AddRefs(focusedWindow));
if (focusedContent) {
#ifdef MOZ_XUL
RefPtr<nsXULElement> xulElement = nsXULElement::FromContent(focusedContent);
RefPtr<nsXULElement> xulElement = nsXULElement::FromNode(focusedContent);
if (xulElement) {
ErrorResult rv;
*aResult = xulElement->GetControllers(rv);
@ -234,12 +234,12 @@ nsWindowRoot::GetControllers(bool aForVisibleWindow,
#endif
HTMLTextAreaElement* htmlTextArea =
HTMLTextAreaElement::FromContent(focusedContent);
HTMLTextAreaElement::FromNode(focusedContent);
if (htmlTextArea)
return htmlTextArea->GetControllers(aResult);
HTMLInputElement* htmlInputElement =
HTMLInputElement::FromContent(focusedContent);
HTMLInputElement::FromNode(focusedContent);
if (htmlInputElement)
return htmlInputElement->GetControllers(aResult);

Просмотреть файл

@ -1993,7 +1993,7 @@ EventStateManager::DetermineDragTargetAndDefaultData(nsPIDOMWindowOuter* aWindow
// found, just use the clicked node.
if (!*aSelection) {
while (dragContent) {
if (auto htmlElement = nsGenericHTMLElement::FromContent(dragContent)) {
if (auto htmlElement = nsGenericHTMLElement::FromNode(dragContent)) {
if (htmlElement->Draggable()) {
break;
}
@ -5009,7 +5009,7 @@ static Element*
GetLabelTarget(nsIContent* aPossibleLabel)
{
mozilla::dom::HTMLLabelElement* label =
mozilla::dom::HTMLLabelElement::FromContent(aPossibleLabel);
mozilla::dom::HTMLLabelElement::FromNode(aPossibleLabel);
if (!label)
return nullptr;

Просмотреть файл

@ -1295,7 +1295,7 @@ IMEStateManager::SetIMEState(const IMEState& aState,
// if so, use the number control instead:
Element* element = aContent->AsElement();
HTMLInputElement* inputElement =
HTMLInputElement::FromContentOrNull(aContent);
HTMLInputElement::FromNodeOrNull(aContent);
if (inputElement) {
HTMLInputElement* ownerNumberControl =
inputElement->GetOwnerNumberControl();

Просмотреть файл

@ -93,7 +93,7 @@ DocAllResultMatch(Element* aElement, int32_t aNamespaceID, nsAtom* aAtom,
return true;
}
nsGenericHTMLElement* elm = nsGenericHTMLElement::FromContent(aElement);
nsGenericHTMLElement* elm = nsGenericHTMLElement::FromNode(aElement);
if (!elm) {
return false;
}
@ -173,7 +173,7 @@ HTMLAllCollection::GetSupportedNames(nsTArray<nsString>& aNames)
}
}
nsGenericHTMLElement* el = nsGenericHTMLElement::FromContent(content);
nsGenericHTMLElement* el = nsGenericHTMLElement::FromNode(content);
if (el) {
// Note: nsINode::HasName means the name is exposed on the document,
// which is false for options, so we don't check it here.

Просмотреть файл

@ -263,7 +263,7 @@ HTMLFieldSetElement::AddElement(nsGenericHTMLFormElement* aElement)
// If the element that we are adding aElement is a fieldset, then all the
// invalid elements in aElement are also invalid elements of this.
HTMLFieldSetElement* fieldSet = FromContent(aElement);
HTMLFieldSetElement* fieldSet = FromNode(aElement);
if (fieldSet) {
for (int32_t i = 0; i < fieldSet->mInvalidElementsCount; i++) {
UpdateValidity(false);
@ -281,7 +281,7 @@ HTMLFieldSetElement::AddElement(nsGenericHTMLFormElement* aElement)
#if DEBUG
int32_t debugInvalidElementsCount = 0;
for (uint32_t i = 0; i < mDependentElements.Length(); i++) {
HTMLFieldSetElement* fieldSet = FromContent(mDependentElements[i]);
HTMLFieldSetElement* fieldSet = FromNode(mDependentElements[i]);
if (fieldSet) {
debugInvalidElementsCount += fieldSet->mInvalidElementsCount;
continue;
@ -305,7 +305,7 @@ HTMLFieldSetElement::RemoveElement(nsGenericHTMLFormElement* aElement)
// If the element that we are removing aElement is a fieldset, then all the
// invalid elements in aElement are also removed from this.
HTMLFieldSetElement* fieldSet = FromContent(aElement);
HTMLFieldSetElement* fieldSet = FromNode(aElement);
if (fieldSet) {
for (int32_t i = 0; i < fieldSet->mInvalidElementsCount; i++) {
UpdateValidity(true);
@ -323,7 +323,7 @@ HTMLFieldSetElement::RemoveElement(nsGenericHTMLFormElement* aElement)
#if DEBUG
int32_t debugInvalidElementsCount = 0;
for (uint32_t i = 0; i < mDependentElements.Length(); i++) {
HTMLFieldSetElement* fieldSet = FromContent(mDependentElements[i]);
HTMLFieldSetElement* fieldSet = FromNode(mDependentElements[i]);
if (fieldSet) {
debugInvalidElementsCount += fieldSet->mInvalidElementsCount;
continue;

Просмотреть файл

@ -1624,11 +1624,11 @@ HTMLFormElement::GetActionURL(nsIURI** aActionURL,
"The originating element must be a submit form control!");
#endif // DEBUG
HTMLInputElement* inputElement = HTMLInputElement::FromContent(aOriginatingElement);
HTMLInputElement* inputElement = HTMLInputElement::FromNode(aOriginatingElement);
if (inputElement) {
inputElement->GetFormAction(action);
} else {
auto buttonElement = HTMLButtonElement::FromContent(aOriginatingElement);
auto buttonElement = HTMLButtonElement::FromNode(aOriginatingElement);
if (buttonElement) {
buttonElement->GetFormAction(action);
} else {
@ -2201,7 +2201,7 @@ HTMLFormElement::GetNextRadioButton(const nsAString& aName,
else if (++index >= (int32_t)numRadios) {
index = 0;
}
radio = HTMLInputElement::FromContentOrNull(radioGroup->Item(index));
radio = HTMLInputElement::FromNodeOrNull(radioGroup->Item(index));
isRadio = radio && radio->ControlType() == NS_FORM_INPUT_RADIO;
if (!isRadio) {
continue;

Просмотреть файл

@ -1043,7 +1043,7 @@ HTMLImageElement::PictureSourceSrcsetChanged(nsIContent *aSourceNode,
nsCOMPtr<nsIPrincipal> principal;
if (aSourceNode == this) {
principal = mSrcsetTriggeringPrincipal;
} else if (auto* source = HTMLSourceElement::FromContent(aSourceNode)) {
} else if (auto* source = HTMLSourceElement::FromNode(aSourceNode)) {
principal = source->GetSrcsetTriggeringPrincipal();
}
mResponsiveSelector->SetCandidatesFromSourceSet(aNewValue, principal);
@ -1239,7 +1239,7 @@ HTMLImageElement::TryCreateResponsiveSelector(Element* aSourceElement)
if (!SourceElementMatches(aSourceElement)) {
return false;
}
auto* source = HTMLSourceElement::FromContent(aSourceElement);
auto* source = HTMLSourceElement::FromNode(aSourceElement);
principal = source->GetSrcsetTriggeringPrincipal();
} else if (aSourceElement->IsHTMLElement(nsGkAtoms::img)) {
// Otherwise this is the <img> tag itself

Просмотреть файл

@ -2465,7 +2465,7 @@ HTMLInputElement::GetOwnerNumberControl()
mType == NS_FORM_INPUT_TEXT &&
GetParent() && GetParent()->GetParent()) {
HTMLInputElement* grandparent =
HTMLInputElement::FromContentOrNull(GetParent()->GetParent());
HTMLInputElement::FromNodeOrNull(GetParent()->GetParent());
if (grandparent && grandparent->mType == NS_FORM_INPUT_NUMBER) {
return grandparent;
}
@ -4244,7 +4244,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
if (oldType == NS_FORM_INPUT_RADIO) {
nsCOMPtr<nsIContent> content = do_QueryInterface(aVisitor.mItemData);
HTMLInputElement* selectedRadioButton =
HTMLInputElement::FromContentOrNull(content);
HTMLInputElement::FromNodeOrNull(content);
if (selectedRadioButton) {
selectedRadioButton->SetChecked(true);
}
@ -4280,7 +4280,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
// Fire event for the previous selected radio.
nsCOMPtr<nsIContent> content = do_QueryInterface(aVisitor.mItemData);
HTMLInputElement* previous =
HTMLInputElement::FromContentOrNull(content);
HTMLInputElement::FromNodeOrNull(content);
if (previous) {
FireEventForAccessibility(previous, aVisitor.mPresContext,
eFormRadioStateChange);

Просмотреть файл

@ -2397,7 +2397,7 @@ void HTMLMediaElement::LoadFromSourceChildren()
return;
}
}
HTMLSourceElement *childSrc = HTMLSourceElement::FromContent(child);
HTMLSourceElement *childSrc = HTMLSourceElement::FromNode(child);
LOG(LogLevel::Debug, ("%p Trying load from <source>=%s type=%s", this,
NS_ConvertUTF16toUTF8(src).get(), NS_ConvertUTF16toUTF8(type).get()));
@ -4511,7 +4511,7 @@ HTMLMediaElement::ReportTelemetry()
FrameStatisticsData data;
if (HTMLVideoElement* vid = HTMLVideoElement::FromContentOrNull(this)) {
if (HTMLVideoElement* vid = HTMLVideoElement::FromNodeOrNull(this)) {
FrameStatistics* stats = vid->GetFrameStatistics();
if (stats) {
data = stats->GetFrameStatisticsData();

Просмотреть файл

@ -185,13 +185,13 @@ HTMLMenuElement::TraverseContent(nsIContent* aContent,
nsCOMPtr<nsIContent> child;
for (child = aContent->GetFirstChild(); child;
child = child->GetNextSibling()) {
nsGenericHTMLElement* element = nsGenericHTMLElement::FromContent(child);
nsGenericHTMLElement* element = nsGenericHTMLElement::FromNode(child);
if (!element) {
continue;
}
if (child->IsHTMLElement(nsGkAtoms::menuitem)) {
HTMLMenuItemElement* menuitem = HTMLMenuItemElement::FromContent(child);
HTMLMenuItemElement* menuitem = HTMLMenuItemElement::FromNode(child);
if (menuitem->IsHidden()) {
continue;

Просмотреть файл

@ -284,7 +284,7 @@ HTMLMenuItemElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
uint8_t oldType = NS_MENUITEM_TYPE(aVisitor.mItemFlags);
nsCOMPtr<nsIContent> content(do_QueryInterface(aVisitor.mItemData));
RefPtr<HTMLMenuItemElement> selectedRadio = HTMLMenuItemElement::FromContentOrNull(content);
RefPtr<HTMLMenuItemElement> selectedRadio = HTMLMenuItemElement::FromNodeOrNull(content);
if (selectedRadio) {
selectedRadio->SetChecked(true);
if (mType != CMD_TYPE_RADIO) {
@ -416,7 +416,7 @@ HTMLMenuItemElement::WalkRadioGroup(Visitor* aVisitor)
for (nsIContent* cur = parent->GetFirstChild();
cur;
cur = cur->GetNextSibling()) {
HTMLMenuItemElement* menuitem = HTMLMenuItemElement::FromContent(cur);
HTMLMenuItemElement* menuitem = HTMLMenuItemElement::FromNode(cur);
if (!menuitem || menuitem->GetType() != CMD_TYPE_RADIO) {
continue;

Просмотреть файл

@ -142,7 +142,7 @@ HTMLOptGroupElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
// disabled attribute. We should make sure their state is updated.
for (nsIContent* child = nsINode::GetFirstChild(); child;
child = child->GetNextSibling()) {
if (auto optElement = HTMLOptionElement::FromContent(child)) {
if (auto optElement = HTMLOptionElement::FromNode(child)) {
optElement->OptGroupDisabledChanged(true);
}
}

Просмотреть файл

@ -82,7 +82,7 @@ HTMLOptionElement::UpdateDisabledState(bool aNotify)
if (!isDisabled) {
nsIContent* parent = GetParent();
if (auto optGroupElement = HTMLOptGroupElement::FromContentOrNull(parent)) {
if (auto optGroupElement = HTMLOptGroupElement::FromNodeOrNull(parent)) {
isDisabled = optGroupElement->IsDisabled();
}
}
@ -318,7 +318,7 @@ HTMLOptionElement::GetSelect()
return nullptr;
}
HTMLSelectElement* select = HTMLSelectElement::FromContent(parent);
HTMLSelectElement* select = HTMLSelectElement::FromNode(parent);
if (select) {
return select;
}
@ -327,7 +327,7 @@ HTMLOptionElement::GetSelect()
return nullptr;
}
return HTMLSelectElement::FromContentOrNull(parent->GetParent());
return HTMLSelectElement::FromNodeOrNull(parent->GetParent());
}
already_AddRefed<HTMLOptionElement>

Просмотреть файл

@ -36,7 +36,7 @@ HTMLPictureElement::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
nsCOMPtr<nsIContent> child = GetChildAt_Deprecated(aIndex);
if (child && child->IsHTMLElement(nsGkAtoms::img)) {
HTMLImageElement* img = HTMLImageElement::FromContent(child);
HTMLImageElement* img = HTMLImageElement::FromNode(child);
if (img) {
img->PictureSourceRemoved(child->AsContent());
}
@ -45,7 +45,7 @@ HTMLPictureElement::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
nsCOMPtr<nsIContent> nextSibling = child->GetNextSibling();
if (nextSibling && nextSibling->GetParentNode() == this) {
do {
HTMLImageElement* img = HTMLImageElement::FromContent(nextSibling);
HTMLImageElement* img = HTMLImageElement::FromNode(nextSibling);
if (img) {
img->PictureSourceRemoved(child->AsContent());
}
@ -60,7 +60,7 @@ void
HTMLPictureElement::RemoveChildNode(nsIContent* aKid, bool aNotify)
{
if (aKid && aKid->IsHTMLElement(nsGkAtoms::img)) {
HTMLImageElement* img = HTMLImageElement::FromContent(aKid);
HTMLImageElement* img = HTMLImageElement::FromNode(aKid);
if (img) {
img->PictureSourceRemoved(aKid->AsContent());
}
@ -69,7 +69,7 @@ HTMLPictureElement::RemoveChildNode(nsIContent* aKid, bool aNotify)
nsCOMPtr<nsIContent> nextSibling = aKid->GetNextSibling();
if (nextSibling && nextSibling->GetParentNode() == this) {
do {
HTMLImageElement* img = HTMLImageElement::FromContent(nextSibling);
HTMLImageElement* img = HTMLImageElement::FromNode(nextSibling);
if (img) {
img->PictureSourceRemoved(aKid->AsContent());
}
@ -91,7 +91,7 @@ HTMLPictureElement::InsertChildBefore(nsIContent* aKid, nsIContent* aBeforeThis,
NS_ENSURE_TRUE(aKid, rv);
if (aKid->IsHTMLElement(nsGkAtoms::img)) {
HTMLImageElement* img = HTMLImageElement::FromContent(aKid);
HTMLImageElement* img = HTMLImageElement::FromNode(aKid);
if (img) {
img->PictureSourceAdded(aKid->AsContent());
}
@ -100,7 +100,7 @@ HTMLPictureElement::InsertChildBefore(nsIContent* aKid, nsIContent* aBeforeThis,
nsCOMPtr<nsIContent> nextSibling = aKid->GetNextSibling();
if (nextSibling && nextSibling->GetParentNode() == this) {
do {
HTMLImageElement* img = HTMLImageElement::FromContent(nextSibling);
HTMLImageElement* img = HTMLImageElement::FromNode(nextSibling);
if (img) {
img->PictureSourceAdded(aKid->AsContent());
}
@ -120,7 +120,7 @@ HTMLPictureElement::InsertChildAt_Deprecated(nsIContent* aKid, uint32_t aIndex,
NS_ENSURE_TRUE(aKid, rv);
if (aKid->IsHTMLElement(nsGkAtoms::img)) {
HTMLImageElement* img = HTMLImageElement::FromContent(aKid);
HTMLImageElement* img = HTMLImageElement::FromNode(aKid);
if (img) {
img->PictureSourceAdded(aKid->AsContent());
}
@ -129,7 +129,7 @@ HTMLPictureElement::InsertChildAt_Deprecated(nsIContent* aKid, uint32_t aIndex,
nsCOMPtr<nsIContent> nextSibling = aKid->GetNextSibling();
if (nextSibling && nextSibling->GetParentNode() == this) {
do {
HTMLImageElement* img = HTMLImageElement::FromContent(nextSibling);
HTMLImageElement* img = HTMLImageElement::FromNode(nextSibling);
if (img) {
img->PictureSourceAdded(aKid->AsContent());
}

Просмотреть файл

@ -54,7 +54,7 @@ SafeOptionListMutation::SafeOptionListMutation(nsIContent* aSelect,
nsIContent* aKid,
uint32_t aIndex,
bool aNotify)
: mSelect(HTMLSelectElement::FromContentOrNull(aSelect))
: mSelect(HTMLSelectElement::FromNodeOrNull(aSelect))
, mTopLevelMutation(false)
, mNeedsRebuild(false)
, mNotify(aNotify)
@ -258,7 +258,7 @@ HTMLSelectElement::InsertOptionsIntoList(nsIContent* aOptions,
MOZ_ASSERT(aDepth == 0 || aDepth == 1);
int32_t insertIndex = aListIndex;
HTMLOptionElement* optElement = HTMLOptionElement::FromContent(aOptions);
HTMLOptionElement* optElement = HTMLOptionElement::FromNode(aOptions);
if (optElement) {
mOptions->InsertOptionAt(optElement, insertIndex);
insertIndex++;
@ -274,7 +274,7 @@ HTMLSelectElement::InsertOptionsIntoList(nsIContent* aOptions,
for (nsIContent* child = aOptions->GetFirstChild();
child;
child = child->GetNextSibling()) {
optElement = HTMLOptionElement::FromContent(child);
optElement = HTMLOptionElement::FromNode(child);
if (optElement) {
mOptions->InsertOptionAt(optElement, insertIndex);
insertIndex++;
@ -339,7 +339,7 @@ HTMLSelectElement::RemoveOptionsFromList(nsIContent* aOptions,
MOZ_ASSERT(aDepth == 0 || aDepth == 1);
int32_t numRemoved = 0;
HTMLOptionElement* optElement = HTMLOptionElement::FromContent(aOptions);
HTMLOptionElement* optElement = HTMLOptionElement::FromNode(aOptions);
if (optElement) {
if (mOptions->ItemAsOption(aListIndex) != optElement) {
NS_ERROR("wrong option at index");
@ -358,7 +358,7 @@ HTMLSelectElement::RemoveOptionsFromList(nsIContent* aOptions,
for (nsIContent* child = aOptions->GetFirstChild();
child;
child = child->GetNextSibling()) {
optElement = HTMLOptionElement::FromContent(child);
optElement = HTMLOptionElement::FromNode(child);
if (optElement) {
if (mOptions->ItemAsOption(aListIndex) != optElement) {
NS_ERROR("wrong option at index");
@ -534,7 +534,7 @@ int32_t
HTMLSelectElement::GetFirstOptionIndex(nsIContent* aOptions)
{
int32_t listIndex = -1;
HTMLOptionElement* optElement = HTMLOptionElement::FromContent(aOptions);
HTMLOptionElement* optElement = HTMLOptionElement::FromNode(aOptions);
if (optElement) {
mOptions->GetOptionIndex(optElement->AsElement(), 0, true, &listIndex);
return listIndex;
@ -698,7 +698,7 @@ HTMLSelectElement::MatchSelectedOptions(Element* aElement,
nsAtom* /* unused */,
void* /* unused*/)
{
HTMLOptionElement* option = HTMLOptionElement::FromContent(aElement);
HTMLOptionElement* option = HTMLOptionElement::FromNode(aElement);
return option && option->Selected();
}
@ -1014,7 +1014,7 @@ HTMLSelectElement::IsOptionDisabled(HTMLOptionElement* aOption) const
}
RefPtr<HTMLOptGroupElement> optGroupElement =
HTMLOptGroupElement::FromContent(node);
HTMLOptGroupElement::FromNode(node);
if (!optGroupElement) {
// If you put something else between you and the optgroup, you're a
@ -1634,14 +1634,14 @@ AddOptions(nsIContent* aRoot, HTMLOptionsCollection* aArray)
for (nsIContent* child = aRoot->GetFirstChild();
child;
child = child->GetNextSibling()) {
HTMLOptionElement* opt = HTMLOptionElement::FromContent(child);
HTMLOptionElement* opt = HTMLOptionElement::FromNode(child);
if (opt) {
aArray->AppendOption(opt);
} else if (child->IsHTMLElement(nsGkAtoms::optgroup)) {
for (nsIContent* grandchild = child->GetFirstChild();
grandchild;
grandchild = grandchild->GetNextSibling()) {
opt = HTMLOptionElement::FromContent(grandchild);
opt = HTMLOptionElement::FromNode(grandchild);
if (opt) {
aArray->AppendOption(opt);
}
@ -1726,7 +1726,7 @@ HTMLSelectElement::VerifyOptionsArray()
for (nsIContent* child = nsINode::GetFirstChild();
child;
child = child->GetNextSibling()) {
HTMLOptionElement* opt = HTMLOptionElement::FromContent(child);
HTMLOptionElement* opt = HTMLOptionElement::FromNode(child);
if (opt) {
NS_ASSERTION(opt == mOptions->ItemAsOption(index++),
"Options collection broken");
@ -1734,7 +1734,7 @@ HTMLSelectElement::VerifyOptionsArray()
for (nsIContent* grandchild = child->GetFirstChild();
grandchild;
grandchild = grandchild->GetNextSibling()) {
opt = HTMLOptionElement::FromContent(grandchild);
opt = HTMLOptionElement::FromNode(grandchild);
if (opt) {
NS_ASSERTION(opt == mOptions->ItemAsOption(index++),
"Options collection broken");

Просмотреть файл

@ -420,7 +420,7 @@ public:
// If item index is out of range, insert to last.
// (since beforeElement becomes null, it is inserted to last)
nsIContent* beforeContent = mOptions->GetElementAt(aIndex);
return Add(aElement, nsGenericHTMLElement::FromContentOrNull(beforeContent),
return Add(aElement, nsGenericHTMLElement::FromNodeOrNull(beforeContent),
aError);
}

Просмотреть файл

@ -140,7 +140,7 @@ FlattenAssignedNodes(HTMLSlotElement* aSlot, nsTArray<RefPtr<nsINode>>& aNodes)
}
if (child->IsHTMLElement(nsGkAtoms::slot)) {
FlattenAssignedNodes(HTMLSlotElement::FromContent(child), aNodes);
FlattenAssignedNodes(HTMLSlotElement::FromNode(child), aNodes);
} else {
aNodes.AppendElement(child);
}
@ -152,7 +152,7 @@ FlattenAssignedNodes(HTMLSlotElement* aSlot, nsTArray<RefPtr<nsINode>>& aNodes)
nsINode* assignedNode = assignedNodes[i];
if (assignedNode->IsHTMLElement(nsGkAtoms::slot)) {
FlattenAssignedNodes(
HTMLSlotElement::FromContent(assignedNode->AsContent()), aNodes);
HTMLSlotElement::FromNode(assignedNode->AsContent()), aNodes);
} else {
aNodes.AppendElement(assignedNode);
}

Просмотреть файл

@ -143,7 +143,7 @@ HTMLSummaryElement::IsMainSummary() const
HTMLDetailsElement*
HTMLSummaryElement::GetDetails() const
{
return HTMLDetailsElement::FromContentOrNull(GetParent());
return HTMLDetailsElement::FromNodeOrNull(GetParent());
}
JSObject*

Просмотреть файл

@ -35,7 +35,7 @@ NS_IMPL_ELEMENT_CLONE(HTMLTableCellElement)
HTMLTableRowElement*
HTMLTableCellElement::GetRow() const
{
return HTMLTableRowElement::FromContentOrNull(GetParent());
return HTMLTableRowElement::FromNodeOrNull(GetParent());
}
// protected method

Просмотреть файл

@ -274,7 +274,7 @@ TableRowsCollection::GetSupportedNames(nsTArray<nsString>& aNames)
}
}
nsGenericHTMLElement* el = nsGenericHTMLElement::FromContent(node);
nsGenericHTMLElement* el = nsGenericHTMLElement::FromNode(node);
if (el) {
const nsAttrValue* val = el->GetParsedAttr(nsGkAtoms::name);
if (val && val->Type() == nsAttrValue::eAtom) {

Просмотреть файл

@ -66,12 +66,12 @@ HTMLTableRowElement::GetTable() const
}
// We may not be in a section
HTMLTableElement* table = HTMLTableElement::FromContent(parent);
HTMLTableElement* table = HTMLTableElement::FromNode(parent);
if (table) {
return table;
}
return HTMLTableElement::FromContentOrNull(parent->GetParent());
return HTMLTableElement::FromNodeOrNull(parent->GetParent());
}
int32_t

Просмотреть файл

@ -361,7 +361,7 @@ ImageDocument::ShrinkToFit()
// displayed image height by getting .height on the HTMLImageElement.
//
// Hold strong ref, because Height() can run script.
RefPtr<HTMLImageElement> img = HTMLImageElement::FromContent(mImageContent);
RefPtr<HTMLImageElement> img = HTMLImageElement::FromNode(mImageContent);
uint32_t imageHeight = img->Height();
nsDOMTokenList* classList = img->ClassList();
ErrorResult ignored;
@ -382,7 +382,7 @@ ImageDocument::ShrinkToFit()
#endif
// Keep image content alive while changing the attributes.
RefPtr<HTMLImageElement> image = HTMLImageElement::FromContent(mImageContent);
RefPtr<HTMLImageElement> image = HTMLImageElement::FromNode(mImageContent);
uint32_t newWidth = std::max(1, NSToCoordFloor(GetRatio() * mImageWidth));
uint32_t newHeight = std::max(1, NSToCoordFloor(GetRatio() * mImageHeight));
@ -639,7 +639,7 @@ ImageDocument::HandleEvent(nsIDOMEvent* aEvent)
MouseEvent* event = aEvent->InternalDOMEvent()->AsMouseEvent();
if (event) {
RefPtr<HTMLImageElement> img =
HTMLImageElement::FromContent(mImageContent);
HTMLImageElement::FromNode(mImageContent);
x = event->ClientX() - img->OffsetLeft();
y = event->ClientY() - img->OffsetTop();
}

Просмотреть файл

@ -24,7 +24,7 @@ RadioNodeList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
HTMLInputElement*
GetAsRadio(nsIContent* node)
{
HTMLInputElement* el = HTMLInputElement::FromContent(node);
HTMLInputElement* el = HTMLInputElement::FromNode(node);
if (el && el->ControlType() == NS_FORM_INPUT_RADIO) {
return el;
}

Просмотреть файл

@ -1610,7 +1610,7 @@ nsGenericHTMLElement::GetContextMenu() const
//XXXsmaug How should this work in Shadow DOM?
nsIDocument* doc = GetUncomposedDoc();
if (doc) {
return HTMLMenuElement::FromContentOrNull(doc->GetElementById(value));
return HTMLMenuElement::FromNodeOrNull(doc->GetElementById(value));
}
}
return nullptr;
@ -1626,7 +1626,7 @@ nsGenericHTMLElement::IsLabelable() const
nsGenericHTMLElement::MatchLabelsElement(Element* aElement, int32_t aNamespaceID,
nsAtom* aAtom, void* aData)
{
HTMLLabelElement* element = HTMLLabelElement::FromContent(aElement);
HTMLLabelElement* element = HTMLLabelElement::FromNode(aElement);
return element && element->GetControl() == aData;
}
@ -2338,7 +2338,7 @@ nsGenericHTMLFormElement::UpdateFieldSet(bool aNotify)
for (parent = GetParent(); parent && parent != bindingParent;
prev = parent, parent = parent->GetParent()) {
HTMLFieldSetElement* fieldset =
HTMLFieldSetElement::FromContent(parent);
HTMLFieldSetElement::FromNode(parent);
if (fieldset &&
(!prev || fieldset->GetFirstLegend() != prev)) {
if (mFieldSet == fieldset) {
@ -2406,7 +2406,7 @@ nsGenericHTMLFormElement::UpdateRequiredState(bool aIsRequired, bool aNotify)
"This should be called only on types that @required applies");
#ifdef DEBUG
HTMLInputElement* input = HTMLInputElement::FromContent(this);
HTMLInputElement* input = HTMLInputElement::FromNode(this);
if (input) {
MOZ_ASSERT(input->DoesRequiredApply(),
"This should be called only on input types that @required applies");
@ -2637,7 +2637,7 @@ void
nsGenericHTMLElement::SyncEditorsOnSubtree(nsIContent* content)
{
/* Sync this node */
nsGenericHTMLElement* element = FromContent(content);
nsGenericHTMLElement* element = FromNode(content);
if (element) {
RefPtr<TextEditor> textEditor = element->GetAssociatedEditor();
if (textEditor) {

Просмотреть файл

@ -149,7 +149,7 @@ public:
bool IsContentEditable()
{
for (nsIContent* node = this; node; node = node->GetParent()) {
nsGenericHTMLElement* element = FromContent(node);
nsGenericHTMLElement* element = FromNode(node);
if (element) {
ContentEditableTristate value = element->GetContentEditableValue();
if (value != eInherit) {

Просмотреть файл

@ -177,7 +177,7 @@ nsIConstraintValidation::ReportValidity()
if (content->IsHTMLElement(nsGkAtoms::input) &&
nsContentUtils::IsFocusedContent(content)) {
HTMLInputElement* inputElement = HTMLInputElement::FromContent(content);
HTMLInputElement* inputElement = HTMLInputElement::FromNode(content);
inputElement->UpdateValidityUIBits(true);
}

Просмотреть файл

@ -882,12 +882,12 @@ DoCommandCallback(Command aCommand, void* aData)
nsIContent *content = frame->GetContent();
nsCOMPtr<nsIControllers> controllers;
HTMLInputElement* input = HTMLInputElement::FromContent(content);
HTMLInputElement* input = HTMLInputElement::FromNode(content);
if (input) {
input->GetControllers(getter_AddRefs(controllers));
} else {
HTMLTextAreaElement* textArea =
HTMLTextAreaElement::FromContent(content);
HTMLTextAreaElement::FromNode(content);
if (textArea) {
textArea->GetControllers(getter_AddRefs(controllers));
@ -1414,12 +1414,12 @@ nsTextEditorState::PrepareEditor(const nsAString *aValue)
nsCOMPtr<nsIControllers> controllers;
nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
HTMLInputElement* inputElement =
HTMLInputElement::FromContentOrNull(content);
HTMLInputElement::FromNodeOrNull(content);
if (inputElement) {
rv = inputElement->GetControllers(getter_AddRefs(controllers));
} else {
HTMLTextAreaElement* textAreaElement =
HTMLTextAreaElement::FromContentOrNull(content);
HTMLTextAreaElement::FromNodeOrNull(content);
if (!textAreaElement)
return NS_ERROR_FAILURE;
@ -1986,7 +1986,7 @@ nsTextEditorState::GetParentNumberControl(nsFrame* aFrame) const
if (!parentOfParent) {
return nullptr;
}
HTMLInputElement* input = HTMLInputElement::FromContent(parentOfParent);
HTMLInputElement* input = HTMLInputElement::FromNode(parentOfParent);
if (input) {
// This function might be called during frame reconstruction as a result
// of changing the input control's type from number to something else. In
@ -2073,13 +2073,13 @@ nsTextEditorState::UnbindFromFrame(nsTextControlFrame* aFrame)
nsCOMPtr<nsIControllers> controllers;
nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
HTMLInputElement* inputElement =
HTMLInputElement::FromContentOrNull(content);
HTMLInputElement::FromNodeOrNull(content);
if (inputElement)
inputElement->GetControllers(getter_AddRefs(controllers));
else
{
HTMLTextAreaElement* textAreaElement =
HTMLTextAreaElement::FromContentOrNull(content);
HTMLTextAreaElement::FromNodeOrNull(content);
if (textAreaElement) {
textAreaElement->GetControllers(getter_AddRefs(controllers));
}
@ -2152,7 +2152,7 @@ nsTextEditorState::GetMaxLength()
{
nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
nsGenericHTMLElement* element =
nsGenericHTMLElement::FromContentOrNull(content);
nsGenericHTMLElement::FromNodeOrNull(content);
if (NS_WARN_IF(!element)) {
return -1;
}

Просмотреть файл

@ -448,7 +448,7 @@ ResourceReader::OnWalkDOMNode(nsIDOMNode* aNode)
}
// Fixup xml-stylesheet processing instructions
if (auto nodeAsPI = dom::ProcessingInstruction::FromContent(content)) {
if (auto nodeAsPI = dom::ProcessingInstruction::FromNode(content)) {
nsAutoString target;
nodeAsPI->GetTarget(target);
if (target.EqualsLiteral("xml-stylesheet")) {
@ -510,7 +510,7 @@ ResourceReader::OnWalkDOMNode(nsIDOMNode* aNode)
return OnWalkAttribute(aNode, "data");
}
if (auto nodeAsLink = dom::HTMLLinkElement::FromContent(content)) {
if (auto nodeAsLink = dom::HTMLLinkElement::FromNode(content)) {
// Test if the link has a rel value indicating it to be a stylesheet
nsAutoString linkRel;
nodeAsLink->GetRel(linkRel);
@ -558,7 +558,7 @@ ResourceReader::OnWalkDOMNode(nsIDOMNode* aNode)
return OnWalkSubframe(aNode);
}
auto nodeAsInput = dom::HTMLInputElement::FromContent(content);
auto nodeAsInput = dom::HTMLInputElement::FromNode(content);
if (nodeAsInput) {
return OnWalkAttribute(aNode, "src");
}
@ -879,7 +879,7 @@ PersistNodeFixup::FixupNode(nsINode* aNodeIn,
// Fixup xml-stylesheet processing instructions
if (auto nodeAsPI =
dom::ProcessingInstruction::FromContent(aNodeIn->AsContent())) {
dom::ProcessingInstruction::FromNode(aNodeIn)) {
nsAutoString target;
nodeAsPI->GetTarget(target);
if (target.EqualsLiteral("xml-stylesheet"))
@ -927,7 +927,7 @@ PersistNodeFixup::FixupNode(nsINode* aNodeIn,
}
// Fix up href and file links in the elements
RefPtr<dom::HTMLAnchorElement> nodeAsAnchor = dom::HTMLAnchorElement::FromContent(content);
RefPtr<dom::HTMLAnchorElement> nodeAsAnchor = dom::HTMLAnchorElement::FromNode(content);
if (nodeAsAnchor) {
nsresult rv = GetNodeToFixup(aNodeIn, aNodeOut);
if (NS_SUCCEEDED(rv) && *aNodeOut) {
@ -936,7 +936,7 @@ PersistNodeFixup::FixupNode(nsINode* aNodeIn,
return rv;
}
RefPtr<dom::HTMLAreaElement> nodeAsArea = dom::HTMLAreaElement::FromContent(content);
RefPtr<dom::HTMLAreaElement> nodeAsArea = dom::HTMLAreaElement::FromNode(content);
if (nodeAsArea) {
nsresult rv = GetNodeToFixup(aNodeIn, aNodeOut);
if (NS_SUCCEEDED(rv) && *aNodeOut) {
@ -1087,7 +1087,7 @@ PersistNodeFixup::FixupNode(nsINode* aNodeIn,
}
RefPtr<dom::HTMLInputElement> nodeAsInput =
dom::HTMLInputElement::FromContentOrNull(content);
dom::HTMLInputElement::FromNodeOrNull(content);
if (nodeAsInput) {
nsresult rv = GetNodeToFixup(aNodeIn, aNodeOut);
if (NS_SUCCEEDED(rv) && *aNodeOut) {
@ -1104,7 +1104,7 @@ PersistNodeFixup::FixupNode(nsINode* aNodeIn,
NS_NAMED_LITERAL_STRING(valueAttr, "value");
// Update element node attributes with user-entered form state
RefPtr<dom::HTMLInputElement> outElt =
dom::HTMLInputElement::FromContent((*aNodeOut)->AsContent());
dom::HTMLInputElement::FromNode((*aNodeOut)->AsContent());
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(*aNodeOut);
switch (formControl->ControlType()) {
case NS_FORM_INPUT_EMAIL:
@ -1139,7 +1139,7 @@ PersistNodeFixup::FixupNode(nsINode* aNodeIn,
return rv;
}
dom::HTMLTextAreaElement* nodeAsTextArea = dom::HTMLTextAreaElement::FromContent(content);
dom::HTMLTextAreaElement* nodeAsTextArea = dom::HTMLTextAreaElement::FromNode(content);
if (nodeAsTextArea) {
nsresult rv = GetNodeToFixup(aNodeIn, aNodeOut);
if (NS_SUCCEEDED(rv) && *aNodeOut) {
@ -1154,12 +1154,12 @@ PersistNodeFixup::FixupNode(nsINode* aNodeIn,
return rv;
}
dom::HTMLOptionElement* nodeAsOption = dom::HTMLOptionElement::FromContent(content);
dom::HTMLOptionElement* nodeAsOption = dom::HTMLOptionElement::FromNode(content);
if (nodeAsOption) {
nsresult rv = GetNodeToFixup(aNodeIn, aNodeOut);
if (NS_SUCCEEDED(rv) && *aNodeOut) {
dom::HTMLOptionElement* outElt =
dom::HTMLOptionElement::FromContent((*aNodeOut)->AsContent());
dom::HTMLOptionElement::FromNode((*aNodeOut)->AsContent());
bool selected = nodeAsOption->Selected();
outElt->SetDefaultSelected(selected, IgnoreErrors());
}

Просмотреть файл

@ -664,19 +664,19 @@ nsXBLPrototypeHandler::GetController(EventTarget* aTarget)
nsCOMPtr<nsIContent> targetContent(do_QueryInterface(aTarget));
RefPtr<nsXULElement> xulElement =
nsXULElement::FromContentOrNull(targetContent);
nsXULElement::FromNodeOrNull(targetContent);
if (xulElement) {
controllers = xulElement->GetControllers(IgnoreErrors());
}
if (!controllers) {
HTMLTextAreaElement* htmlTextArea = HTMLTextAreaElement::FromContent(targetContent);
HTMLTextAreaElement* htmlTextArea = HTMLTextAreaElement::FromNode(targetContent);
if (htmlTextArea)
htmlTextArea->GetControllers(getter_AddRefs(controllers));
}
if (!controllers) {
HTMLInputElement* htmlInputElement = HTMLInputElement::FromContent(targetContent);
HTMLInputElement* htmlInputElement = HTMLInputElement::FromNode(targetContent);
if (htmlInputElement)
htmlInputElement->GetControllers(getter_AddRefs(controllers));
}

Просмотреть файл

@ -280,7 +280,7 @@ nsXMLContentSink::DidBuildModel(bool aTerminated)
for (nsIContent* child = mDocument->GetFirstChild();
child;
child = child->GetNextSibling()) {
if (auto pi = ProcessingInstruction::FromContent(child)) {
if (auto pi = ProcessingInstruction::FromNode(child)) {
CheckXSLTParamPI(pi, mXSLTProcessor, mDocument);
}
else if (child->IsElement()) {

Просмотреть файл

@ -177,7 +177,7 @@ nsXULElement::Create(nsXULPrototypeElement* aPrototype, mozilla::dom::NodeInfo *
NS_NewXULElement(getter_AddRefs(baseElement), ni.forget(), dom::FROM_PARSER_NETWORK);
if (baseElement) {
nsXULElement* element = FromContent(baseElement);
nsXULElement* element = FromNode(baseElement);
if (aPrototype->mHasIdAttribute) {
element->SetHasID();
@ -577,7 +577,7 @@ nsXULElement::PerformAccesskey(bool aKeyCausesActivation,
}
bool focused = false;
nsXULElement* elm = FromContent(content);
nsXULElement* elm = FromNode(content);
if (elm) {
// Define behavior for each type of XUL element.
if (!content->IsXULElement(nsGkAtoms::toolbarbutton)) {
@ -870,7 +870,7 @@ nsXULElement::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
if (!controlElement)
GetParentTree(getter_AddRefs(controlElement));
nsCOMPtr<nsIContent> controlContent(do_QueryInterface(controlElement));
RefPtr<nsXULElement> xulElement = FromContentOrNull(controlContent);
RefPtr<nsXULElement> xulElement = FromNodeOrNull(controlContent);
nsCOMPtr<nsIDOMElement> oldKidElem = do_QueryInterface(oldKid);
if (xulElement && oldKidElem) {
@ -964,7 +964,7 @@ nsXULElement::RemoveChildNode(nsIContent* aKid, bool aNotify)
if (!controlElement)
GetParentTree(getter_AddRefs(controlElement));
nsCOMPtr<nsIContent> controlContent(do_QueryInterface(controlElement));
RefPtr<nsXULElement> xulElement = FromContentOrNull(controlContent);
RefPtr<nsXULElement> xulElement = FromNodeOrNull(controlContent);
nsCOMPtr<nsIDOMElement> oldKidElem = do_QueryInterface(aKid);
if (xulElement && oldKidElem) {

Просмотреть файл

@ -444,7 +444,7 @@ EditorBase::GetDesiredSpellCheckState()
return false;
}
auto element = nsGenericHTMLElement::FromContent(content);
auto element = nsGenericHTMLElement::FromNode(content);
if (!element) {
return false;
}
@ -4351,7 +4351,7 @@ EditorBase::DeleteSelectionImpl(EDirection aAction,
}
RefPtr<CharacterData> deleteCharData =
CharacterData::FromContentOrNull(deleteNode);
CharacterData::FromNodeOrNull(deleteNode);
AutoRules beginRulesSniffing(this, EditAction::deleteSelection, aAction);
if (mRules && mRules->AsHTMLEditRules()) {

Просмотреть файл

@ -493,7 +493,7 @@ HTMLEditor::GetPositionAndDimensions(Element& aElement,
} else {
mResizedObjectIsAbsolutelyPositioned = false;
RefPtr<nsGenericHTMLElement> htmlElement =
nsGenericHTMLElement::FromContent(&aElement);
nsGenericHTMLElement::FromNode(&aElement);
if (!htmlElement) {
return NS_ERROR_NULL_POINTER;
}

Просмотреть файл

@ -338,7 +338,7 @@ HTMLEditUtils::IsLink(nsINode* aNode)
return false;
}
RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::FromContentOrNull(aNode->AsContent());
RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::FromNodeOrNull(aNode->AsContent());
if (!anchor) {
return false;
}

Просмотреть файл

@ -2687,7 +2687,7 @@ HTMLEditor::InsertLinkAroundSelection(nsIDOMElement* aAnchorElement)
// Be sure we were given an anchor element
nsCOMPtr<nsIContent> content = do_QueryInterface(aAnchorElement);
RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::FromContentOrNull(content);
RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::FromNodeOrNull(content);
if (!anchor) {
return NS_OK;
}

Просмотреть файл

@ -204,7 +204,7 @@ HTMLEditor::RefreshInlineTableEditingUI()
}
RefPtr<nsGenericHTMLElement> htmlElement =
nsGenericHTMLElement::FromContent(mInlineEditedCell);
nsGenericHTMLElement::FromNode(mInlineEditedCell);
if (!htmlElement) {
return NS_ERROR_NULL_POINTER;
}

Просмотреть файл

@ -8238,8 +8238,7 @@ PresShell::GetCurrentItemAndPositionForElement(nsIDOMElement *aCurrentEl,
int32_t currentIndex;
multiSelect->GetCurrentIndex(&currentIndex);
if (currentIndex >= 0) {
RefPtr<nsXULElement> xulElement =
nsXULElement::FromContent(focusedContent);
RefPtr<nsXULElement> xulElement = nsXULElement::FromNode(focusedContent);
if (xulElement) {
nsCOMPtr<nsIBoxObject> box = xulElement->GetBoxObject(IgnoreErrors());
nsCOMPtr<nsITreeBoxObject> treeBox(do_QueryInterface(box));

Просмотреть файл

@ -3083,7 +3083,7 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState,
nsStyleContext* const styleContext = aItem.mStyleContext;
// Construct a frame-based listbox or combobox
dom::HTMLSelectElement* sel = dom::HTMLSelectElement::FromContent(content);
dom::HTMLSelectElement* sel = dom::HTMLSelectElement::FromNode(content);
MOZ_ASSERT(sel);
if (sel->IsCombobox()) {
// Construct a frame-based combo box.
@ -5776,12 +5776,12 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
// to things that are not roots of native anonymous subtrees (except for
// ::before and ::after); we always want to create "internal" anonymous
// content.
auto* details = HTMLDetailsElement::FromContentOrNull(parent);
auto* details = HTMLDetailsElement::FromNodeOrNull(parent);
if (details && !details->Open() &&
(!aContent->IsRootOfNativeAnonymousSubtree() ||
aContent->IsGeneratedContentContainerForBefore() ||
aContent->IsGeneratedContentContainerForAfter())) {
auto* summary = HTMLSummaryElement::FromContentOrNull(aContent);
auto* summary = HTMLSummaryElement::FromNodeOrNull(aContent);
if (!summary || !summary->IsMainSummary()) {
SetAsUndisplayedContent(aState, aItems, aContent, styleContext,
isGeneratedContent);
@ -5928,7 +5928,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
FrameConstructionItem* item = nullptr;
if (details && details->Open()) {
auto* summary = HTMLSummaryElement::FromContentOrNull(aContent);
auto* summary = HTMLSummaryElement::FromNodeOrNull(aContent);
if (summary && summary->IsMainSummary()) {
// If details is open, the main summary needs to be rendered as if it is
// the first child, so add the item to the front of the item list.
@ -6814,7 +6814,7 @@ MaybeGetListBoxBodyFrame(nsIContent* aContainer, nsIContent* aChild)
if (IsXULListBox(aContainer) &&
aChild->IsXULElement(nsGkAtoms::listitem)) {
RefPtr<nsXULElement> xulElement = nsXULElement::FromContent(aContainer);
RefPtr<nsXULElement> xulElement = nsXULElement::FromNode(aContainer);
nsCOMPtr<nsIBoxObject> boxObject = xulElement->GetBoxObject(IgnoreErrors());
nsCOMPtr<nsPIListBoxObject> listBoxObject = do_QueryInterface(boxObject);
if (listBoxObject) {
@ -9033,7 +9033,7 @@ nsCSSFrameConstructor::MaybeRecreateContainerForFrameRemoval(nsIFrame* aFrame)
if (parent && parent->IsDetailsFrame()) {
HTMLSummaryElement* summary =
HTMLSummaryElement::FromContent(aFrame->GetContent());
HTMLSummaryElement::FromNode(aFrame->GetContent());
DetailsFrame* detailsFrame = static_cast<DetailsFrame*>(parent);
// Unlike adding summary element cases, we need to check children of the

Просмотреть файл

@ -7760,7 +7760,7 @@ nsLayoutUtils::SurfaceFromElement(nsIImageLoadingContent* aElement,
int32_t imgWidth, imgHeight;
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
HTMLImageElement* element = HTMLImageElement::FromContentOrNull(content);
HTMLImageElement* element = HTMLImageElement::FromNodeOrNull(content);
if (aSurfaceFlags & SFE_USE_ELEMENT_SIZE_IF_VECTOR &&
element &&
imgContainer->GetType() == imgIContainer::TYPE_VECTOR) {
@ -7928,13 +7928,13 @@ nsLayoutUtils::SurfaceFromElement(dom::Element* aElement,
{
// If it's a <canvas>, we may be able to just grab its internal surface
if (HTMLCanvasElement* canvas =
HTMLCanvasElement::FromContentOrNull(aElement)) {
HTMLCanvasElement::FromNodeOrNull(aElement)) {
return SurfaceFromElement(canvas, aSurfaceFlags, aTarget);
}
// Maybe it's <video>?
if (HTMLVideoElement* video =
HTMLVideoElement::FromContentOrNull(aElement)) {
HTMLVideoElement::FromNodeOrNull(aElement)) {
return SurfaceFromElement(video, aSurfaceFlags, aTarget);
}

Просмотреть файл

@ -196,7 +196,7 @@ nsCheckboxRadioFrame::HandleEvent(nsPresContext* aPresContext,
void
nsCheckboxRadioFrame::GetCurrentCheckState(bool* aState)
{
HTMLInputElement* inputElement = HTMLInputElement::FromContent(mContent);
HTMLInputElement* inputElement = HTMLInputElement::FromNode(mContent);
if (inputElement) {
*aState = inputElement->Checked();
}

Просмотреть файл

@ -93,7 +93,7 @@ nsColorControlFrame::UpdateColor()
// Get the color from the "value" property of our content; it will return the
// default color (through the sanitization algorithm) if the value is empty.
nsAutoString color;
HTMLInputElement* elt = HTMLInputElement::FromContent(mContent);
HTMLInputElement* elt = HTMLInputElement::FromNode(mContent);
elt->GetValue(color, CallerType::System);
if (color.IsEmpty()) {

Просмотреть файл

@ -107,7 +107,7 @@ MakeAnonButton(nsIDocument* aDoc, const char* labelKey,
// Make sure access key and tab order for the element actually redirect to the
// file picking button.
RefPtr<HTMLButtonElement> buttonElement =
HTMLButtonElement::FromContentOrNull(button);
HTMLButtonElement::FromNodeOrNull(button);
if (!aAccessKey.IsEmpty()) {
buttonElement->SetAccessKey(aAccessKey, IgnoreErrors());
@ -126,7 +126,7 @@ nsFileControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
{
nsCOMPtr<nsIDocument> doc = mContent->GetComposedDoc();
RefPtr<HTMLInputElement> fileContent = HTMLInputElement::FromContentOrNull(mContent);
RefPtr<HTMLInputElement> fileContent = HTMLInputElement::FromNodeOrNull(mContent);
// The access key is transferred to the "Choose files..." button only. In
// effect that access key allows access to the control via that button, then
@ -153,7 +153,7 @@ nsFileControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
// Update the displayed text to reflect the current element's value.
nsAutoString value;
HTMLInputElement::FromContent(mContent)->GetDisplayFileName(value);
HTMLInputElement::FromNode(mContent)->GetDisplayFileName(value);
UpdateDisplayedValue(value, false);
if (!aElements.AppendElement(mTextContent)) {
@ -254,7 +254,7 @@ nsFileControlFrame::DnDListener::HandleEvent(nsIDOMEvent* aEvent)
RefPtr<HTMLInputElement> inputElement =
HTMLInputElement::FromContent(mFrame->GetContent());
HTMLInputElement::FromNode(mFrame->GetContent());
bool supportsMultiple =
inputElement->HasAttr(kNameSpaceID_None, nsGkAtoms::multiple);
if (!CanDropTheseFiles(dataTransfer, supportsMultiple)) {
@ -347,7 +347,7 @@ nsFileControlFrame::DnDListener::GetBlobImplForWebkitDirectory(FileList* aFileLi
*aBlobImpl = nullptr;
HTMLInputElement* inputElement =
HTMLInputElement::FromContent(mFrame->GetContent());
HTMLInputElement::FromNode(mFrame->GetContent());
bool webkitDirPicker =
DOMPrefs::WebkitBlinkDirectoryPickerEnabled() &&
inputElement->HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory);

Просмотреть файл

@ -108,7 +108,7 @@ nsGfxButtonControlFrame::GetLabel(nsString& aLabel)
{
// Get the text from the "value" property on our content if there is
// one; otherwise set it to a default value (localized).
dom::HTMLInputElement* elt = dom::HTMLInputElement::FromContent(mContent);
dom::HTMLInputElement* elt = dom::HTMLInputElement::FromNode(mContent);
if (elt && elt->HasAttr(kNameSpaceID_None, nsGkAtoms::value)) {
elt->GetValue(aLabel, dom::CallerType::System);
} else {

Просмотреть файл

@ -59,7 +59,7 @@ int32_t
nsLegendFrame::GetLogicalAlign(WritingMode aCBWM)
{
int32_t intValue = NS_STYLE_TEXT_ALIGN_START;
nsGenericHTMLElement* content = nsGenericHTMLElement::FromContent(mContent);
nsGenericHTMLElement* content = nsGenericHTMLElement::FromNode(mContent);
if (content) {
const nsAttrValue* attr = content->GetParsedAttr(nsGkAtoms::align);
if (attr && attr->Type() == nsAttrValue::eEnum) {

Просмотреть файл

@ -237,7 +237,7 @@ void nsListControlFrame::PaintFocus(DrawTarget* aDrawTarget, nsPoint aPt)
fRect += aPt;
bool lastItemIsSelected = false;
HTMLOptionElement* domOpt = HTMLOptionElement::FromContentOrNull(focusedContent);
HTMLOptionElement* domOpt = HTMLOptionElement::FromNodeOrNull(focusedContent);
if (domOpt) {
lastItemIsSelected = domOpt->Selected();
}
@ -283,7 +283,7 @@ GetMaxOptionBSize(nsIFrame* aContainer, WritingMode aWM)
nscoord result = 0;
for (nsIFrame* option : aContainer->PrincipalChildList()) {
nscoord optionBSize;
if (HTMLOptGroupElement::FromContent(option->GetContent())) {
if (HTMLOptGroupElement::FromNode(option->GetContent())) {
// An optgroup; drill through any scroll frame and recurse. |frame| might
// be null here though if |option| is an anonymous leaf frame of some sort.
auto frame = option->GetContentInsertionFrame();
@ -753,7 +753,7 @@ CountOptionsAndOptgroups(nsIFrame* aFrame)
++count;
} else {
RefPtr<HTMLOptGroupElement> optgroup =
HTMLOptGroupElement::FromContent(content);
HTMLOptGroupElement::FromNode(content);
if (optgroup) {
nsAutoString label;
optgroup->GetLabel(label);
@ -1004,7 +1004,7 @@ dom::HTMLOptionsCollection*
nsListControlFrame::GetOptions() const
{
dom::HTMLSelectElement* select =
dom::HTMLSelectElement::FromContentOrNull(mContent);
dom::HTMLSelectElement::FromNodeOrNull(mContent);
NS_ENSURE_TRUE(select, nullptr);
return select->Options();
@ -1014,7 +1014,7 @@ dom::HTMLOptionElement*
nsListControlFrame::GetOption(uint32_t aIndex) const
{
dom::HTMLSelectElement* select =
dom::HTMLSelectElement::FromContentOrNull(mContent);
dom::HTMLSelectElement::FromNodeOrNull(mContent);
NS_ENSURE_TRUE(select, nullptr);
return select->Item(aIndex);
@ -1050,7 +1050,7 @@ nsListControlFrame::ResetList(bool aAllowScrolling)
// Scroll to the selected index
int32_t indexToSelect = kNothingSelected;
HTMLSelectElement* selectElement = HTMLSelectElement::FromContent(mContent);
HTMLSelectElement* selectElement = HTMLSelectElement::FromNode(mContent);
if (selectElement) {
indexToSelect = selectElement->SelectedIndex();
AutoWeakFrame weakFrame(this);
@ -1108,7 +1108,7 @@ int32_t
nsListControlFrame::GetSelectedIndex()
{
dom::HTMLSelectElement* select =
dom::HTMLSelectElement::FromContentOrNull(mContent);
dom::HTMLSelectElement::FromNodeOrNull(mContent);
return select->SelectedIndex();
}
@ -1133,7 +1133,7 @@ nsListControlFrame::GetNonDisabledOptionFrom(int32_t aFromIndex,
int32_t* aFoundIndex)
{
RefPtr<dom::HTMLSelectElement> selectElement =
dom::HTMLSelectElement::FromContent(mContent);
dom::HTMLSelectElement::FromNode(mContent);
const uint32_t length = selectElement->Length();
for (uint32_t i = std::max(aFromIndex, 0); i < length; ++i) {
@ -1285,7 +1285,7 @@ nsListControlFrame::SetOptionsSelectedFromFrame(int32_t aStartIndex,
bool aClearAll)
{
RefPtr<dom::HTMLSelectElement> selectElement =
dom::HTMLSelectElement::FromContent(mContent);
dom::HTMLSelectElement::FromNode(mContent);
uint32_t mask = dom::HTMLSelectElement::NOTIFY;
if (mForceSelection) {
@ -1309,7 +1309,7 @@ nsListControlFrame::ToggleOptionSelectedFromFrame(int32_t aIndex)
NS_ENSURE_TRUE(option, false);
RefPtr<dom::HTMLSelectElement> selectElement =
dom::HTMLSelectElement::FromContent(mContent);
dom::HTMLSelectElement::FromNode(mContent);
uint32_t mask = dom::HTMLSelectElement::NOTIFY;
if (!option->Selected()) {
@ -1549,7 +1549,7 @@ nsresult
nsListControlFrame::IsOptionDisabled(int32_t anIndex, bool &aIsDisabled)
{
RefPtr<dom::HTMLSelectElement> sel =
dom::HTMLSelectElement::FromContent(mContent);
dom::HTMLSelectElement::FromNode(mContent);
if (sel) {
sel->IsOptionDisabled(anIndex, &aIsDisabled);
return NS_OK;
@ -1584,7 +1584,7 @@ nsListControlFrame::CalcIntrinsicBSize(nscoord aBSizeOfARow,
"Shouldn't be in dropdown mode when we call this");
dom::HTMLSelectElement* select =
dom::HTMLSelectElement::FromContentOrNull(mContent);
dom::HTMLSelectElement::FromNodeOrNull(mContent);
if (select) {
mNumDisplayRows = select->Size();
} else {
@ -1764,7 +1764,7 @@ nsListControlFrame::GetIndexFromDOMEvent(nsIDOMEvent* aMouseEvent,
PresContext()->EventStateManager()->GetEventTargetContent(nullptr);
content && !option;
content = content->GetParent()) {
option = dom::HTMLOptionElement::FromContent(content);
option = dom::HTMLOptionElement::FromNode(content);
}
if (option) {
@ -1848,7 +1848,7 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent)
nsCOMPtr<nsIDOMEventTarget> etarget;
aMouseEvent->GetTarget(getter_AddRefs(etarget));
nsCOMPtr<nsIContent> econtent = do_QueryInterface(etarget);
HTMLOptionElement* option = HTMLOptionElement::FromContentOrNull(econtent);
HTMLOptionElement* option = HTMLOptionElement::FromNodeOrNull(econtent);
if (option) {
return NS_OK;
}

Просмотреть файл

@ -311,7 +311,7 @@ public:
NS_IMETHOD Run() override
{
if (mNumber->AsElement()->State().HasState(NS_EVENT_STATE_FOCUS)) {
HTMLInputElement::FromContent(mTextField)->Focus(IgnoreErrors());
HTMLInputElement::FromNode(mTextField)->Focus(IgnoreErrors());
}
return NS_OK;
@ -386,8 +386,8 @@ nsNumberControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
mTextField->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
NS_LITERAL_STRING("text"), PR_FALSE);
HTMLInputElement* content = HTMLInputElement::FromContent(mContent);
HTMLInputElement* textField = HTMLInputElement::FromContent(mTextField);
HTMLInputElement* content = HTMLInputElement::FromNode(mContent);
HTMLInputElement* textField = HTMLInputElement::FromNode(mTextField);
// Initialize the text field value:
nsAutoString value;
@ -465,7 +465,7 @@ nsNumberControlFrame::SetFormProperty(nsAtom* aName, const nsAString& aValue)
HTMLInputElement*
nsNumberControlFrame::GetAnonTextControl()
{
return mTextField ? HTMLInputElement::FromContent(mTextField) : nullptr;
return HTMLInputElement::FromNode(mTextField);
}
/* static */ nsNumberControlFrame*
@ -569,14 +569,14 @@ nsNumberControlFrame::SpinnerStateChanged() const
bool
nsNumberControlFrame::SpinnerUpButtonIsDepressed() const
{
return HTMLInputElement::FromContent(mContent)->
return HTMLInputElement::FromNode(mContent)->
NumberSpinnerUpButtonIsDepressed();
}
bool
nsNumberControlFrame::SpinnerDownButtonIsDepressed() const
{
return HTMLInputElement::FromContent(mContent)->
return HTMLInputElement::FromNode(mContent)->
NumberSpinnerDownButtonIsDepressed();
}
@ -595,7 +595,7 @@ nsNumberControlFrame::HandleFocusEvent(WidgetEvent* aEvent)
{
if (aEvent->mOriginalTarget != mTextField) {
// Move focus to our text field
RefPtr<HTMLInputElement> textField = HTMLInputElement::FromContent(mTextField);
RefPtr<HTMLInputElement> textField = HTMLInputElement::FromNode(mTextField);
textField->Focus(IgnoreErrors());
}
}
@ -603,7 +603,7 @@ nsNumberControlFrame::HandleFocusEvent(WidgetEvent* aEvent)
void
nsNumberControlFrame::HandleSelectCall()
{
RefPtr<HTMLInputElement> textField = HTMLInputElement::FromContent(mTextField);
RefPtr<HTMLInputElement> textField = HTMLInputElement::FromNode(mTextField);
textField->Select();
}
@ -677,9 +677,9 @@ nsNumberControlFrame::SetValueOfAnonTextControl(const nsAString& aValue)
// Pass NonSystem as the caller type; this should work fine for actual number
// inputs, and be safe in case our input has a type we don't expect for some
// reason.
HTMLInputElement::FromContent(mTextField)->SetValue(localizedValue,
CallerType::NonSystem,
IgnoreErrors());
HTMLInputElement::FromNode(mTextField)->SetValue(localizedValue,
CallerType::NonSystem,
IgnoreErrors());
}
void
@ -690,7 +690,7 @@ nsNumberControlFrame::GetValueOfAnonTextControl(nsAString& aValue)
return;
}
HTMLInputElement::FromContent(mTextField)->GetValue(aValue, CallerType::System);
HTMLInputElement::FromNode(mTextField)->GetValue(aValue, CallerType::System);
// Here we need to de-localize any number typed in by the user. That is, we
// need to convert it from the number format of the user's language, region,
@ -741,7 +741,7 @@ nsNumberControlFrame::AnonTextControlIsEmpty()
return true;
}
nsAutoString value;
HTMLInputElement::FromContent(mTextField)->GetValue(value, CallerType::System);
HTMLInputElement::FromNode(mTextField)->GetValue(value, CallerType::System);
return value.IsEmpty();
}

Просмотреть файл

@ -421,7 +421,7 @@ nsTextControlFrame::ShouldInitializeEagerly() const
}
// So do input text controls with spellcheck=true
if (auto* htmlElement = nsGenericHTMLElement::FromContent(mContent)) {
if (auto* htmlElement = nsGenericHTMLElement::FromNode(mContent)) {
if (htmlElement->Spellcheck()) {
return true;
}
@ -1168,7 +1168,7 @@ nsTextControlFrame::GetText(nsString& aText)
// There will be no line breaks so we can ignore the wrap property.
txtCtrl->GetTextEditorValue(aText, true);
} else {
HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromContent(mContent);
HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromNode(mContent);
if (textArea) {
textArea->GetValue(aText);
}
@ -1184,7 +1184,7 @@ nsTextControlFrame::GetMaxLength(int32_t* aSize)
{
*aSize = -1;
nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(mContent);
nsGenericHTMLElement *content = nsGenericHTMLElement::FromNode(mContent);
if (content) {
const nsAttrValue* attr = content->GetParsedAttr(nsGkAtoms::maxlength);
if (attr && attr->Type() == nsAttrValue::eInteger) {

Просмотреть файл

@ -58,7 +58,7 @@ DetailsFrame::CheckValidMainSummary(const nsFrameList& aFrameList) const
{
for (nsIFrame* child : aFrameList) {
HTMLSummaryElement* summary =
HTMLSummaryElement::FromContent(child->GetContent());
HTMLSummaryElement::FromNode(child->GetContent());
if (child == aFrameList.FirstChild()) {
if (summary && summary->IsMainSummary()) {
@ -91,7 +91,7 @@ DetailsFrame::DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroy
nsresult
DetailsFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
{
auto* details = HTMLDetailsElement::FromContent(GetContent());
auto* details = HTMLDetailsElement::FromNode(GetContent());
if (details->GetFirstSummary()) {
return NS_OK;
}

Просмотреть файл

@ -2902,7 +2902,7 @@ ReflowInput::CalcLineHeight(nsIContent* aContent,
NS_ASSERTION(lineHeight >= 0, "ComputeLineHeight screwed up");
HTMLInputElement* input = HTMLInputElement::FromContentOrNull(aContent);
HTMLInputElement* input = HTMLInputElement::FromNodeOrNull(aContent);
if (input && input->IsSingleLineTextControl()) {
// For Web-compatibility, single-line text input elements cannot
// have a line-height smaller than one.

Просмотреть файл

@ -916,7 +916,7 @@ nsBulletFrame::SetListItemOrdinal(int32_t aNextOrdinal,
nsIContent* parentContent = GetParent()->GetContent();
if (parentContent) {
nsGenericHTMLElement *hc =
nsGenericHTMLElement::FromContent(parentContent);
nsGenericHTMLElement::FromNode(parentContent);
if (hc) {
const nsAttrValue* attr = hc->GetParsedAttr(nsGkAtoms::value);
if (attr && attr->Type() == nsAttrValue::eInteger) {

Просмотреть файл

@ -1834,7 +1834,7 @@ nsContainerFrame::RenumberList()
increment = 1;
}
nsGenericHTMLElement* hc = nsGenericHTMLElement::FromContent(mContent);
nsGenericHTMLElement* hc = nsGenericHTMLElement::FromNode(mContent);
// Must be non-null, since FrameStartsCounterScope only returns true
// for HTML elements.
MOZ_ASSERT(hc, "How is mContent not HTML?");
@ -1878,7 +1878,7 @@ nsContainerFrame::RenumberFrameAndDescendants(int32_t* aOrdinal,
// Do not renumber list for summary elements.
HTMLSummaryElement* summary =
HTMLSummaryElement::FromContent(kid->GetContent());
HTMLSummaryElement::FromNode(kid->GetContent());
if (summary && summary->IsMainSummary()) {
return false;
}

Просмотреть файл

@ -6553,7 +6553,7 @@ nsIFrame::IsContentDisabled() const
return true;
}
auto* element = nsGenericHTMLElement::FromContentOrNull(GetContent());
auto* element = nsGenericHTMLElement::FromNodeOrNull(GetContent());
return element && element->IsDisabled();
}

Просмотреть файл

@ -227,7 +227,7 @@ nsHTMLFramesetFrame::Init(nsIContent* aContent,
nscolor borderColor = GetBorderColor();
// Get the rows= cols= data
HTMLFrameSetElement* ourContent = HTMLFrameSetElement::FromContent(mContent);
HTMLFrameSetElement* ourContent = HTMLFrameSetElement::FromNode(mContent);
NS_ASSERTION(ourContent, "Someone gave us a broken frameset element!");
const nsFramesetSpec* rowSpecs = nullptr;
const nsFramesetSpec* colSpecs = nullptr;
@ -542,7 +542,7 @@ int32_t nsHTMLFramesetFrame::GetBorderWidth(nsPresContext* aPresContext,
if (frameborder == eFrameborder_No) {
return 0;
}
nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(mContent);
nsGenericHTMLElement *content = nsGenericHTMLElement::FromNode(mContent);
if (content) {
const nsAttrValue* attr = content->GetParsedAttr(nsGkAtoms::border);
@ -736,7 +736,7 @@ nsFrameborder GetFrameBorderHelper(nsGenericHTMLElement* aContent)
nsFrameborder nsHTMLFramesetFrame::GetFrameBorder()
{
nsFrameborder result = eFrameborder_Notset;
nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(mContent);
nsGenericHTMLElement *content = nsGenericHTMLElement::FromNode(mContent);
if (content) {
result = GetFrameBorderHelper(content);
@ -751,7 +751,7 @@ nsFrameborder nsHTMLFramesetFrame::GetFrameBorder(nsIContent* aContent)
{
nsFrameborder result = eFrameborder_Notset;
nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(aContent);
nsGenericHTMLElement *content = nsGenericHTMLElement::FromNode(aContent);
if (content) {
result = GetFrameBorderHelper(content);
@ -764,7 +764,7 @@ nsFrameborder nsHTMLFramesetFrame::GetFrameBorder(nsIContent* aContent)
nscolor nsHTMLFramesetFrame::GetBorderColor()
{
nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(mContent);
nsGenericHTMLElement *content = nsGenericHTMLElement::FromNode(mContent);
if (content) {
const nsAttrValue* attr = content->GetParsedAttr(nsGkAtoms::bordercolor);
@ -781,7 +781,7 @@ nscolor nsHTMLFramesetFrame::GetBorderColor()
nscolor nsHTMLFramesetFrame::GetBorderColor(nsIContent* aContent)
{
nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(aContent);
nsGenericHTMLElement *content = nsGenericHTMLElement::FromNode(aContent);
if (content) {
const nsAttrValue* attr = content->GetParsedAttr(nsGkAtoms::bordercolor);
@ -839,7 +839,7 @@ nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext,
height -= (mNumRows - 1) * borderWidth;
if (height < 0) height = 0;
HTMLFrameSetElement* ourContent = HTMLFrameSetElement::FromContent(mContent);
HTMLFrameSetElement* ourContent = HTMLFrameSetElement::FromNode(mContent);
NS_ASSERTION(ourContent, "Someone gave us a broken frameset element!");
const nsFramesetSpec* rowSpecs = nullptr;
const nsFramesetSpec* colSpecs = nullptr;
@ -1257,7 +1257,7 @@ nsHTMLFramesetFrame::MouseDrag(nsPresContext* aPresContext,
if (change != 0) {
// Recompute the specs from the new sizes.
nscoord width = mRect.width - (mNumCols - 1) * GetBorderWidth(aPresContext, true);
HTMLFrameSetElement* ourContent = HTMLFrameSetElement::FromContent(mContent);
HTMLFrameSetElement* ourContent = HTMLFrameSetElement::FromNode(mContent);
NS_ASSERTION(ourContent, "Someone gave us a broken frameset element!");
const nsFramesetSpec* colSpecs = nullptr;
ourContent->GetColSpec(&mNumCols, &colSpecs);
@ -1282,7 +1282,7 @@ nsHTMLFramesetFrame::MouseDrag(nsPresContext* aPresContext,
if (change != 0) {
// Recompute the specs from the new sizes.
nscoord height = mRect.height - (mNumRows - 1) * GetBorderWidth(aPresContext, true);
HTMLFrameSetElement* ourContent = HTMLFrameSetElement::FromContent(mContent);
HTMLFrameSetElement* ourContent = HTMLFrameSetElement::FromNode(mContent);
NS_ASSERTION(ourContent, "Someone gave us a broken frameset element!");
const nsFramesetSpec* rowSpecs = nullptr;
ourContent->GetRowSpec(&mNumRows, &rowSpecs);

Просмотреть файл

@ -4621,7 +4621,7 @@ ScrollFrameHelper::CreateAnonymousContent(
if (textFrame) {
// Make sure we are not a text area.
HTMLTextAreaElement* textAreaElement =
HTMLTextAreaElement::FromContent(parent->GetContent());
HTMLTextAreaElement::FromNode(parent->GetContent());
if (!textAreaElement) {
mNeverHasVerticalScrollbar = mNeverHasHorizontalScrollbar = true;
return NS_OK;

Просмотреть файл

@ -84,7 +84,7 @@ public:
*aSnap = false;
nsHTMLCanvasFrame* f = static_cast<nsHTMLCanvasFrame*>(Frame());
HTMLCanvasElement* canvas =
HTMLCanvasElement::FromContent(f->GetContent());
HTMLCanvasElement::FromNode(f->GetContent());
nsRegion result;
if (canvas->GetIsOpaque()) {
// OK, the entire region painted by the canvas is opaque. But what is
@ -211,7 +211,7 @@ public:
LayerManager* aManager,
const ContainerLayerParameters& aParameters) override
{
if (HTMLCanvasElement::FromContent(mFrame->GetContent())->ShouldForceInactiveLayer(aManager))
if (HTMLCanvasElement::FromNode(mFrame->GetContent())->ShouldForceInactiveLayer(aManager))
return LAYER_INACTIVE;
// If compositing is cheap, just do that
@ -258,7 +258,7 @@ nsHTMLCanvasFrame::GetCanvasSize()
{
nsIntSize size(0,0);
HTMLCanvasElement *canvas =
HTMLCanvasElement::FromContentOrNull(GetContent());
HTMLCanvasElement::FromNodeOrNull(GetContent());
if (canvas) {
size = canvas->GetSize();
MOZ_ASSERT(size.width >= 0 && size.height >= 0,

Просмотреть файл

@ -2015,7 +2015,7 @@ nsImageFrame::GetAnchorHREFTargetAndNode(nsIURI** aHref, nsString& aTarget,
}
status = (*aHref != nullptr);
RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::FromContent(content);
RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::FromNode(content);
if (anchor) {
anchor->GetTarget(aTarget);
}

Просмотреть файл

@ -756,7 +756,7 @@ nsImageMap::SearchForAreas(nsIContent* aParent)
for (nsIContent* child = aParent->GetFirstChild();
child;
child = child->GetNextSibling()) {
if (auto* area = HTMLAreaElement::FromContent(child)) {
if (auto* area = HTMLAreaElement::FromNode(child)) {
AddArea(area);
// Continue to next child. This stops mConsiderWholeSubtree from
@ -947,7 +947,7 @@ nsImageMap::ContentRemoved(nsIContent* aChild,
return;
}
auto* areaElement = HTMLAreaElement::FromContent(aChild);
auto* areaElement = HTMLAreaElement::FromNode(aChild);
if (!areaElement) {
return;
}

Просмотреть файл

@ -460,7 +460,7 @@ GetPrintCanvasElementsInFrame(nsIFrame* aFrame,
// If there is a canvasFrame, try to get actual canvas element.
if (canvasFrame) {
HTMLCanvasElement* canvas =
HTMLCanvasElement::FromContentOrNull(canvasFrame->GetContent());
HTMLCanvasElement::FromNodeOrNull(canvasFrame->GetContent());
if (canvas && canvas->GetMozPrintCallback()) {
aArr->AppendElement(canvas);
continue;

Просмотреть файл

@ -1036,7 +1036,7 @@ CSSIntSize
nsSubDocumentFrame::GetMarginAttributes()
{
CSSIntSize result(-1, -1);
nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(mContent);
nsGenericHTMLElement *content = nsGenericHTMLElement::FromNode(mContent);
if (content) {
const nsAttrValue* attr = content->GetParsedAttr(nsGkAtoms::marginwidth);
if (attr && attr->Type() == nsAttrValue::eInteger)

Просмотреть файл

@ -2761,7 +2761,7 @@ DocHasPrintCallbackCanvas(nsIDocument* aDoc, void* aData)
NS_LITERAL_STRING("canvas"));
uint32_t canvasCount = canvases->Length(true);
for (uint32_t i = 0; i < canvasCount; ++i) {
HTMLCanvasElement* canvas = HTMLCanvasElement::FromContentOrNull(canvases->Item(i, false));
HTMLCanvasElement* canvas = HTMLCanvasElement::FromNodeOrNull(canvases->Item(i, false));
if (canvas && canvas->GetMozPrintCallback()) {
// This subdocument has a print callback. Set result and return false to
// stop iteration.

Просмотреть файл

@ -452,7 +452,7 @@ Gecko_GetHTMLPresentationAttrDeclarationBlock(RawGeckoElementBorrowed aElement)
{
const nsMappedAttributes* attrs = aElement->GetMappedAttributes();
if (!attrs) {
auto* svg = nsSVGElement::FromContentOrNull(aElement);
auto* svg = nsSVGElement::FromNodeOrNull(aElement);
if (svg) {
if (auto decl = svg->GetContentDeclarationBlock()) {
return decl->AsServo()->RefRawStrong();

Просмотреть файл

@ -429,7 +429,7 @@ nsSplitterFrameInner::MouseUp(nsPresContext* aPresContext,
// if we dragged then fire a command event.
if (mDidDrag) {
RefPtr<nsXULElement> element =
nsXULElement::FromContent(mOuter->GetContent());
nsXULElement::FromNode(mOuter->GetContent());
element->DoCommand();
}

Просмотреть файл

@ -460,7 +460,7 @@ GetTreeCellCoords(nsITreeBoxObject* aTreeBox, nsIContent* aSourceNode,
{
int32_t junk;
aTreeBox->GetCoordsForCellItem(aRow, aCol, EmptyCString(), aX, aY, &junk, &junk);
RefPtr<nsXULElement> xulEl = nsXULElement::FromContent(aSourceNode);
RefPtr<nsXULElement> xulEl = nsXULElement::FromNode(aSourceNode);
nsCOMPtr<nsIBoxObject> bx = xulEl->GetBoxObject(IgnoreErrors());
int32_t myX, myY;
bx->GetX(&myX);
@ -722,7 +722,7 @@ nsXULTooltipListener::GetSourceTreeBoxObject(nsITreeBoxObject** aBoxObject)
nsCOMPtr<nsIContent> sourceNode = do_QueryReferent(mSourceNode);
if (mIsSourceTree && sourceNode) {
RefPtr<nsXULElement> xulEl =
nsXULElement::FromContentOrNull(sourceNode->GetParent());
nsXULElement::FromNodeOrNull(sourceNode->GetParent());
if (xulEl) {
nsCOMPtr<nsIBoxObject> bx = xulEl->GetBoxObject(IgnoreErrors());
nsCOMPtr<nsITreeBoxObject> obx(do_QueryInterface(bx));

Просмотреть файл

@ -143,7 +143,7 @@ TreeBoxObject::GetView(nsITreeView * *aView)
return mTreeBody->GetView(aView);
}
if (!mView) {
RefPtr<nsXULElement> xulele = nsXULElement::FromContentOrNull(mContent);
RefPtr<nsXULElement> xulele = nsXULElement::FromNodeOrNull(mContent);
if (xulele) {
// No tree builder, create a tree content view.
nsresult rv = NS_NewTreeContentView(getter_AddRefs(mView));

Просмотреть файл

@ -170,7 +170,7 @@ nsTreeColFrame::GetTreeBoxObject()
if (parent) {
nsIContent* grandParent = parent->GetParent();
RefPtr<nsXULElement> treeElement =
nsXULElement::FromContentOrNull(grandParent);
nsXULElement::FromNodeOrNull(grandParent);
if (treeElement) {
nsCOMPtr<nsIBoxObject> boxObject =
treeElement->GetBoxObject(IgnoreErrors());

Просмотреть файл

@ -631,13 +631,13 @@ nsHtml5TreeOperation::SetFormElement(nsIContent* aNode, nsIContent* aParent)
{
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(aNode));
RefPtr<dom::HTMLImageElement> domImageElement =
dom::HTMLImageElement::FromContentOrNull(aNode);
dom::HTMLImageElement::FromNodeOrNull(aNode);
// NS_ASSERTION(formControl, "Form-associated element did not implement
// nsIFormControl.");
// TODO: uncomment the above line when <keygen> (bug 101019) is supported by
// Gecko
RefPtr<dom::HTMLFormElement> formElement =
dom::HTMLFormElement::FromContentOrNull(aParent);
dom::HTMLFormElement::FromNodeOrNull(aParent);
NS_ASSERTION(formElement,
"The form element doesn't implement HTMLFormElement.");
// avoid crashing on <keygen>

Просмотреть файл

@ -310,7 +310,7 @@ nsFormFillController::MarkAsLoginManagerField(nsIDOMHTMLInputElement *aInput)
nsCOMPtr<nsIContent> focusedContent = fm->GetFocusedContent();
if (focusedContent == node) {
if (!mFocusedInput) {
MaybeStartControllingInput(HTMLInputElement::FromContent(node));
MaybeStartControllingInput(HTMLInputElement::FromNode(node));
}
}
}
@ -349,7 +349,7 @@ nsFormFillController::MarkAsAutofillField(nsIDOMHTMLInputElement *aInput)
if (fm) {
nsCOMPtr<nsIContent> focusedContent = fm->GetFocusedContent();
if (focusedContent == node) {
MaybeStartControllingInput(HTMLInputElement::FromContent(node));
MaybeStartControllingInput(HTMLInputElement::FromNode(node));
}
}
@ -1032,7 +1032,7 @@ nsFormFillController::Focus(nsIDOMEvent* aEvent)
{
nsCOMPtr<nsIContent> input = do_QueryInterface(
aEvent->InternalDOMEvent()->GetTarget());
MaybeStartControllingInput(HTMLInputElement::FromContentOrNull(input));
MaybeStartControllingInput(HTMLInputElement::FromNodeOrNull(input));
// Bail if we didn't start controlling the input.
if (!mFocusedInput) {

Просмотреть файл

@ -258,7 +258,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(uint8_t aWidgetType, nsIFrame* aFrame,
} else {
if (aWidgetFlags) {
*aWidgetFlags = 0;
HTMLInputElement* inputElt = HTMLInputElement::FromContent(aFrame->GetContent());
HTMLInputElement* inputElt = HTMLInputElement::FromNode(aFrame->GetContent());
if (inputElt && inputElt->Checked())
*aWidgetFlags |= MOZ_GTK_WIDGET_CHECKED;

Просмотреть файл

@ -680,7 +680,7 @@ nsBaseDragService::DrawDrag(nsIDOMNode* aDOMNode,
// an image or canvas, fall through to RenderNode below.
if (mImage) {
nsCOMPtr<nsIContent> content = do_QueryInterface(dragNode);
HTMLCanvasElement *canvas = HTMLCanvasElement::FromContentOrNull(content);
HTMLCanvasElement *canvas = HTMLCanvasElement::FromNodeOrNull(content);
if (canvas) {
return DrawDragForImage(*aPresContext, nullptr, canvas, aScreenDragRect, aSurface);
}

Просмотреть файл

@ -210,7 +210,7 @@ nsNativeTheme::GetCheckedOrSelected(nsIFrame* aFrame, bool aCheckSelected)
aFrame = aFrame->GetParent();
} else {
// Check for an HTML input element
HTMLInputElement* inputElt = HTMLInputElement::FromContent(content);
HTMLInputElement* inputElt = HTMLInputElement::FromNode(content);
if (inputElt) {
return inputElt->Checked();
}
@ -260,7 +260,7 @@ nsNativeTheme::GetIndeterminate(nsIFrame* aFrame)
}
// Check for an HTML input element
HTMLInputElement* inputElt = HTMLInputElement::FromContent(content);
HTMLInputElement* inputElt = HTMLInputElement::FromNode(content);
if (inputElt) {
return inputElt->Indeterminate();
}

Просмотреть файл

@ -348,7 +348,7 @@ TaskbarPreviewCallback::Done(nsISupports *aCanvas, bool aDrawBorder) {
}
nsCOMPtr<nsIContent> content(do_QueryInterface(aCanvas));
auto canvas = dom::HTMLCanvasElement::FromContentOrNull(content);
auto canvas = dom::HTMLCanvasElement::FromNodeOrNull(content);
if (!canvas) {
return NS_ERROR_FAILURE;
}