mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 07:15:46 +00:00
Bug 1686037 - Part 1: Move nsGenericHTMLElement::GetPresContext to Element; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D102321
This commit is contained in:
parent
56848ca9c1
commit
f43f83b1a9
@ -4147,6 +4147,17 @@ already_AddRefed<nsIAutoCompletePopup> Element::AsAutoCompletePopup() {
|
||||
return value.forget();
|
||||
}
|
||||
|
||||
nsPresContext* Element::GetPresContext(PresContextFor aFor) {
|
||||
// Get the document
|
||||
Document* doc =
|
||||
(aFor == eForComposedDoc) ? GetComposedDoc() : GetUncomposedDoc();
|
||||
if (doc) {
|
||||
return doc->GetPresContext();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_DEFINE_MALLOC_SIZE_OF(ServoElementMallocSizeOf)
|
||||
MOZ_DEFINE_MALLOC_ENCLOSING_SIZE_OF(ServoElementMallocEnclosingSizeOf)
|
||||
|
||||
|
@ -1640,6 +1640,13 @@ class Element : public FragmentOrElement {
|
||||
already_AddRefed<nsIBrowser> AsBrowser();
|
||||
already_AddRefed<nsIAutoCompletePopup> AsAutoCompletePopup();
|
||||
|
||||
/**
|
||||
* Get the presentation context for this content node.
|
||||
* @return the presentation context
|
||||
*/
|
||||
enum PresContextFor { eForComposedDoc, eForUncomposedDoc };
|
||||
nsPresContext* GetPresContext(PresContextFor aFor);
|
||||
|
||||
protected:
|
||||
/*
|
||||
* Named-bools for use with SetAttrAndNotify to make call sites easier to
|
||||
|
@ -5667,10 +5667,8 @@ void EventStateManager::ContentRemoved(Document* aDocument,
|
||||
if (aContent->IsAnyOfHTMLElements(nsGkAtoms::a, nsGkAtoms::area) &&
|
||||
(aContent->AsElement()->State().HasAtLeastOneOfStates(
|
||||
NS_EVENT_STATE_FOCUS | NS_EVENT_STATE_HOVER))) {
|
||||
nsGenericHTMLElement* element =
|
||||
static_cast<nsGenericHTMLElement*>(aContent);
|
||||
element->LeaveLink(
|
||||
element->GetPresContext(nsGenericHTMLElement::eForComposedDoc));
|
||||
Element* element = aContent->AsElement();
|
||||
element->LeaveLink(element->GetPresContext(Element::eForComposedDoc));
|
||||
}
|
||||
|
||||
IMEStateManager::OnRemoveContent(mPresContext, aContent);
|
||||
|
@ -971,17 +971,6 @@ nsIFormControlFrame* nsGenericHTMLElement::GetFormControlFrame(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsPresContext* nsGenericHTMLElement::GetPresContext(PresContextFor aFor) {
|
||||
// Get the document
|
||||
Document* doc =
|
||||
(aFor == eForComposedDoc) ? GetComposedDoc() : GetUncomposedDoc();
|
||||
if (doc) {
|
||||
return doc->GetPresContext();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static const nsAttrValue::EnumTable kDivAlignTable[] = {
|
||||
{"left", StyleTextAlign::MozLeft},
|
||||
{"right", StyleTextAlign::MozRight},
|
||||
|
@ -575,12 +575,6 @@ class nsGenericHTMLElement : public nsGenericHTMLElementBase {
|
||||
*/
|
||||
static void MapScrollingAttributeInto(const nsMappedAttributes* aAttributes,
|
||||
mozilla::MappedDeclarations&);
|
||||
/**
|
||||
* Get the presentation context for this content node.
|
||||
* @return the presentation context
|
||||
*/
|
||||
enum PresContextFor { eForComposedDoc, eForUncomposedDoc };
|
||||
nsPresContext* GetPresContext(PresContextFor aFor);
|
||||
|
||||
// Form Helper Routines
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user