зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1075279 - GetCurrentDoc fixes in content/html, r=wchen
--HG-- extra : rebase_source : ad4f485b2346d629b84e6c1558c24615fdf8d29b
This commit is contained in:
Родитель
9189d91016
Коммит
d0bc3f8d23
|
@ -150,8 +150,9 @@ HTMLAnchorElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Prefetch links
|
||||
if (aDocument) {
|
||||
aDocument->RegisterPendingLinkUpdate(this);
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
if (doc) {
|
||||
doc->RegisterPendingLinkUpdate(this);
|
||||
if (nsHTMLDNSPrefetch::IsAllowed(OwnerDoc())) {
|
||||
nsHTMLDNSPrefetch::PrefetchLow(this);
|
||||
}
|
||||
|
@ -181,8 +182,10 @@ HTMLAnchorElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
|||
// If this link is ever reinserted into a document, it might
|
||||
// be under a different xml:base, so forget the cached state now.
|
||||
Link::ResetLinkState(false, Link::ElementHasHref());
|
||||
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
|
||||
// Note, we need to use OwnerDoc() here, since GetComposedDoc() might
|
||||
// return null.
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
if (doc) {
|
||||
doc->UnregisterPendingLinkUpdate(this);
|
||||
}
|
||||
|
|
|
@ -135,13 +135,16 @@ HTMLAreaElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
bool aCompileEventHandlers)
|
||||
{
|
||||
Link::ResetLinkState(false, Link::ElementHasHref());
|
||||
if (aDocument) {
|
||||
aDocument->RegisterPendingLinkUpdate(this);
|
||||
}
|
||||
|
||||
return nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
if (doc) {
|
||||
doc->RegisterPendingLinkUpdate(this);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -150,8 +153,10 @@ HTMLAreaElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
|||
// If this link is ever reinserted into a document, it might
|
||||
// be under a different xml:base, so forget the cached state now.
|
||||
Link::ResetLinkState(false, Link::ElementHasHref());
|
||||
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
|
||||
// Note, we need to use OwnerDoc() here, since GetComposedDoc() might
|
||||
// return null.
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
if (doc) {
|
||||
doc->UnregisterPendingLinkUpdate(this);
|
||||
}
|
||||
|
|
|
@ -401,7 +401,7 @@ HTMLBodyElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
|||
nsGenericHTMLElement::WalkContentStyleRules(aRuleWalker);
|
||||
|
||||
if (!mContentStyleRule && IsInDoc()) {
|
||||
// XXXbz should this use OwnerDoc() or GetCurrentDoc()?
|
||||
// XXXbz should this use OwnerDoc() or GetComposedDoc()?
|
||||
// sXBL/XBL2 issue!
|
||||
mContentStyleRule = new BodyRule(this);
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ void
|
|||
HTMLFormControlsCollection::FlushPendingNotifications()
|
||||
{
|
||||
if (mForm) {
|
||||
nsIDocument* doc = mForm->GetCurrentDoc();
|
||||
nsIDocument* doc = mForm->GetUncomposedDoc();
|
||||
if (doc) {
|
||||
doc->FlushPendingNotifications(Flush_Content);
|
||||
}
|
||||
|
|
|
@ -446,7 +446,7 @@ CollectOrphans(nsINode* aRemovalRoot,
|
|||
void
|
||||
HTMLFormElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
{
|
||||
nsCOMPtr<nsIHTMLDocument> oldDocument = do_QueryInterface(GetCurrentDoc());
|
||||
nsCOMPtr<nsIHTMLDocument> oldDocument = do_QueryInterface(GetUncomposedDoc());
|
||||
|
||||
// Mark all of our controls as maybe being orphans
|
||||
MarkOrphans(mControls->mElements);
|
||||
|
@ -583,7 +583,7 @@ HTMLFormElement::DoSubmitOrReset(WidgetEvent* aEvent,
|
|||
int32_t aMessage)
|
||||
{
|
||||
// Make sure the presentation is up-to-date
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
if (doc) {
|
||||
doc->FlushPendingNotifications(Flush_ContentAndNotify);
|
||||
}
|
||||
|
@ -633,7 +633,7 @@ HTMLFormElement::DoReset()
|
|||
nsresult
|
||||
HTMLFormElement::DoSubmit(WidgetEvent* aEvent)
|
||||
{
|
||||
NS_ASSERTION(GetCurrentDoc(), "Should never get here without a current doc");
|
||||
NS_ASSERTION(GetComposedDoc(), "Should never get here without a current doc");
|
||||
|
||||
if (mIsSubmitting) {
|
||||
NS_WARNING("Preventing double form submission");
|
||||
|
@ -741,7 +741,7 @@ HTMLFormElement::SubmitSubmission(nsFormSubmission* aFormSubmission)
|
|||
}
|
||||
|
||||
// If there is no link handler, then we won't actually be able to submit.
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
nsCOMPtr<nsISupports> container = doc ? doc->GetContainer() : nullptr;
|
||||
nsCOMPtr<nsILinkHandler> linkHandler(do_QueryInterface(container));
|
||||
if (!linkHandler || IsEditable()) {
|
||||
|
@ -1801,7 +1801,7 @@ HTMLFormElement::CheckValidFormSubmission()
|
|||
// Don't do validation for a form submit done by a sandboxed document that
|
||||
// doesn't have 'allow-forms', the submit will have been blocked and the
|
||||
// HTML5 spec says we shouldn't validate in this case.
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
if (doc && (doc->GetSandboxFlags() & SANDBOXED_FORMS)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1858,7 +1858,8 @@ HTMLInputElement::GetList() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
//XXXsmaug How should this all work in case input element is in Shadow DOM.
|
||||
nsIDocument* doc = GetUncomposedDoc();
|
||||
if (!doc) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2262,8 +2263,8 @@ HTMLInputElement::StepUp(int32_t n, uint8_t optional_argc)
|
|||
void
|
||||
HTMLInputElement::FlushFrames()
|
||||
{
|
||||
if (GetCurrentDoc()) {
|
||||
GetCurrentDoc()->FlushPendingNotifications(Flush_Frames);
|
||||
if (GetComposedDoc()) {
|
||||
GetComposedDoc()->FlushPendingNotifications(Flush_Frames);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3029,7 +3030,8 @@ HTMLInputElement::GetRadioGroupContainer() const
|
|||
return mForm;
|
||||
}
|
||||
|
||||
return static_cast<nsDocument*>(GetCurrentDoc());
|
||||
//XXXsmaug It isn't clear how this should work in Shadow DOM.
|
||||
return static_cast<nsDocument*>(GetUncomposedDoc());
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMHTMLInputElement>
|
||||
|
@ -3964,7 +3966,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
if (fm && IsSingleLineTextControl(false) &&
|
||||
!aVisitor.mEvent->AsFocusEvent()->fromRaise &&
|
||||
SelectTextFieldOnFocus()) {
|
||||
nsIDocument* document = GetCurrentDoc();
|
||||
nsIDocument* document = GetComposedDoc();
|
||||
if (document) {
|
||||
uint32_t lastFocusMethod;
|
||||
fm->GetLastFocusMethod(document->GetWindow(), &lastFocusMethod);
|
||||
|
|
|
@ -246,7 +246,10 @@ HTMLLabelElement::GetLabeledElement() const
|
|||
|
||||
// We have a @for. The id has to be linked to an element in the same document
|
||||
// and this element should be a labelable form control.
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
//XXXsmaug It is unclear how this should work in case the element is in
|
||||
// Shadow DOM.
|
||||
// See https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365.
|
||||
nsIDocument* doc = GetUncomposedDoc();
|
||||
if (!doc) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -177,18 +177,15 @@ HTMLLinkElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
|||
// be under a different xml:base, so forget the cached state now.
|
||||
Link::ResetLinkState(false, Link::ElementHasHref());
|
||||
|
||||
// Once we have XPCOMGC we shouldn't need to call UnbindFromTree during Unlink
|
||||
// and so this messy event dispatch can go away.
|
||||
nsCOMPtr<nsIDocument> oldDoc = GetCurrentDoc();
|
||||
nsCOMPtr<nsIDocument> oldDoc = GetUncomposedDoc();
|
||||
|
||||
// Check for a ShadowRoot because link elements are inert in a
|
||||
// ShadowRoot.
|
||||
ShadowRoot* oldShadowRoot = GetBindingParent() ?
|
||||
GetBindingParent()->GetShadowRoot() : nullptr;
|
||||
|
||||
if (oldDoc && !oldShadowRoot) {
|
||||
oldDoc->UnregisterPendingLinkUpdate(this);
|
||||
}
|
||||
OwnerDoc()->UnregisterPendingLinkUpdate(this);
|
||||
|
||||
CreateAndDispatchEvent(oldDoc, NS_LITERAL_STRING("DOMLinkRemoved"));
|
||||
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
|
||||
|
||||
|
@ -251,7 +248,7 @@ void
|
|||
HTMLLinkElement::UpdateImport()
|
||||
{
|
||||
// 1. link node should be attached to the document.
|
||||
nsCOMPtr<nsIDocument> doc = GetCurrentDoc();
|
||||
nsCOMPtr<nsIDocument> doc = GetUncomposedDoc();
|
||||
if (!doc) {
|
||||
// We might have been just removed from the document, so
|
||||
// let's remove ourself from the list of link nodes of
|
||||
|
|
|
@ -70,7 +70,7 @@ HTMLMenuElement::SendShowEvent()
|
|||
{
|
||||
NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_DOM_SECURITY_ERR);
|
||||
|
||||
nsCOMPtr<nsIDocument> document = GetCurrentDoc();
|
||||
nsCOMPtr<nsIDocument> document = GetComposedDoc();
|
||||
if (!document) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ HTMLMetaElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||
{
|
||||
if (aNameSpaceID == kNameSpaceID_None) {
|
||||
if (aName == nsGkAtoms::content) {
|
||||
nsIDocument *document = GetCurrentDoc();
|
||||
nsIDocument *document = GetUncomposedDoc();
|
||||
CreateAndDispatchEvent(document, NS_LITERAL_STRING("DOMMetaChanged"));
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ HTMLMetaElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
void
|
||||
HTMLMetaElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> oldDoc = GetCurrentDoc();
|
||||
nsCOMPtr<nsIDocument> oldDoc = GetUncomposedDoc();
|
||||
CreateAndDispatchEvent(oldDoc, NS_LITERAL_STRING("DOMMetaRemoved"));
|
||||
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ HTMLObjectElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
|||
bool
|
||||
HTMLObjectElement::IsFocusableForTabIndex()
|
||||
{
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
if (!doc || doc->HasFlag(NODE_IS_EDITABLE)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ HTMLObjectElement::IsHTMLFocusable(bool aWithMouse,
|
|||
{
|
||||
// TODO: this should probably be managed directly by IsHTMLFocusable.
|
||||
// See bug 597242.
|
||||
nsIDocument *doc = GetCurrentDoc();
|
||||
nsIDocument *doc = GetComposedDoc();
|
||||
if (!doc || doc->HasFlag(NODE_IS_EDITABLE)) {
|
||||
if (aTabIndex) {
|
||||
GetTabIndex(aTabIndex);
|
||||
|
|
|
@ -43,7 +43,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
|||
|
||||
HTMLPropertiesCollection::HTMLPropertiesCollection(nsGenericHTMLElement* aRoot)
|
||||
: mRoot(aRoot)
|
||||
, mDoc(aRoot->GetCurrentDoc())
|
||||
, mDoc(aRoot->GetUncomposedDoc())
|
||||
, mIsDirty(true)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
|
@ -248,7 +248,7 @@ GetElementByIdForConnectedSubtree(nsIContent* aContent, const nsIAtom* aId)
|
|||
void
|
||||
HTMLPropertiesCollection::CrawlProperties()
|
||||
{
|
||||
nsIDocument* doc = mRoot->GetCurrentDoc();
|
||||
nsIDocument* doc = mRoot->GetUncomposedDoc();
|
||||
|
||||
const nsAttrValue* attr = mRoot->GetParsedAttr(nsGkAtoms::itemref);
|
||||
if (attr) {
|
||||
|
@ -306,7 +306,7 @@ HTMLPropertiesCollection::GetSupportedNames(unsigned, nsTArray<nsString>& aNames
|
|||
PropertyNodeList::PropertyNodeList(HTMLPropertiesCollection* aCollection,
|
||||
nsIContent* aParent, const nsAString& aName)
|
||||
: mName(aName),
|
||||
mDoc(aParent->GetCurrentDoc()),
|
||||
mDoc(aParent->GetUncomposedDoc()),
|
||||
mCollection(aCollection),
|
||||
mParent(aParent),
|
||||
mIsDirty(true)
|
||||
|
|
|
@ -227,9 +227,9 @@ HTMLSharedElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||
aNameSpaceID == kNameSpaceID_None &&
|
||||
IsInDoc()) {
|
||||
if (aName == nsGkAtoms::href) {
|
||||
SetBaseURIUsingFirstBaseWithHref(GetCurrentDoc(), this);
|
||||
SetBaseURIUsingFirstBaseWithHref(GetUncomposedDoc(), this);
|
||||
} else if (aName == nsGkAtoms::target) {
|
||||
SetBaseTargetUsingFirstBaseWithTarget(GetCurrentDoc(), this);
|
||||
SetBaseTargetUsingFirstBaseWithTarget(GetUncomposedDoc(), this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,9 +250,9 @@ HTMLSharedElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||
aNameSpaceID == kNameSpaceID_None &&
|
||||
IsInDoc()) {
|
||||
if (aName == nsGkAtoms::href) {
|
||||
SetBaseURIUsingFirstBaseWithHref(GetCurrentDoc(), nullptr);
|
||||
SetBaseURIUsingFirstBaseWithHref(GetUncomposedDoc(), nullptr);
|
||||
} else if (aName == nsGkAtoms::target) {
|
||||
SetBaseTargetUsingFirstBaseWithTarget(GetCurrentDoc(), nullptr);
|
||||
SetBaseTargetUsingFirstBaseWithTarget(GetUncomposedDoc(), nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ HTMLSharedElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
void
|
||||
HTMLSharedElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
{
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
nsIDocument* doc = GetUncomposedDoc();
|
||||
|
||||
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
|
||||
|
||||
|
|
|
@ -896,7 +896,7 @@ HTMLTableElement::BuildInheritedAttributes()
|
|||
{
|
||||
NS_ASSERTION(mTableInheritedAttributes == TABLE_ATTRS_DIRTY,
|
||||
"potential leak, plus waste of work");
|
||||
nsIDocument *document = GetCurrentDoc();
|
||||
nsIDocument *document = GetComposedDoc();
|
||||
nsHTMLStyleSheet* sheet = document ?
|
||||
document->GetAttributeStyleSheet() : nullptr;
|
||||
nsRefPtr<nsMappedAttributes> newAttrs;
|
||||
|
|
|
@ -127,7 +127,7 @@ HTMLTitleElement::DoneAddingChildren(bool aHaveNotified)
|
|||
void
|
||||
HTMLTitleElement::SendTitleChangeEvent(bool aBound)
|
||||
{
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
nsIDocument* doc = GetUncomposedDoc();
|
||||
if (doc) {
|
||||
doc->NotifyPossibleTitleChange(aBound);
|
||||
}
|
||||
|
|
|
@ -820,7 +820,7 @@ GetSubmissionFromForm(nsGenericHTMLElement* aForm,
|
|||
nsFormSubmission** aFormSubmission)
|
||||
{
|
||||
// Get all the information necessary to encode the form data
|
||||
NS_ASSERTION(aForm->GetCurrentDoc(),
|
||||
NS_ASSERTION(aForm->GetComposedDoc(),
|
||||
"Should have doc if we're building submission!");
|
||||
|
||||
// Get encoding type (default: urlencoded)
|
||||
|
|
|
@ -580,7 +580,8 @@ nsGenericHTMLElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
|||
RemoveFromNameTable();
|
||||
|
||||
if (GetContentEditableValue() == eTrue) {
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDocument = do_QueryInterface(GetCurrentDoc());
|
||||
//XXXsmaug Fix this for Shadow DOM, bug 1066965.
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDocument = do_QueryInterface(GetUncomposedDoc());
|
||||
if (htmlDocument) {
|
||||
htmlDocument->ChangeContentEditableCount(this, -1);
|
||||
}
|
||||
|
@ -780,7 +781,7 @@ nsGenericHTMLElement::GetEventListenerManagerForAttr(nsIAtom* aAttrName,
|
|||
// If we have a document, and it has a window, add the event
|
||||
// listener on the window (the inner window). If not, proceed as
|
||||
// normal.
|
||||
// XXXbz sXBL/XBL2 issue: should we instead use GetCurrentDoc() here,
|
||||
// XXXbz sXBL/XBL2 issue: should we instead use GetComposedDoc() here,
|
||||
// override BindToTree for those classes and munge event listeners there?
|
||||
nsIDocument *document = OwnerDoc();
|
||||
|
||||
|
@ -1772,7 +1773,8 @@ nsGenericHTMLElement::GetContextMenu() const
|
|||
nsAutoString value;
|
||||
GetHTMLAttr(nsGkAtoms::contextmenu, value);
|
||||
if (!value.IsEmpty()) {
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
//XXXsmaug How should this work in Shadow DOM?
|
||||
nsIDocument* doc = GetUncomposedDoc();
|
||||
if (doc) {
|
||||
return HTMLMenuElement::FromContentOrNull(doc->GetElementById(value));
|
||||
}
|
||||
|
@ -2030,7 +2032,7 @@ nsGenericHTMLFormElement::BindToTree(nsIDocument* aDocument,
|
|||
// wouldn't be possible to find a form ancestor.
|
||||
// We should not call UpdateFormOwner if none of these conditions are
|
||||
// fulfilled.
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::form) ? !!GetCurrentDoc()
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::form) ? !!GetUncomposedDoc()
|
||||
: !!aParent) {
|
||||
UpdateFormOwner(true, nullptr);
|
||||
}
|
||||
|
@ -2182,7 +2184,8 @@ nsGenericHTMLFormElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||
|
||||
if (aName == nsGkAtoms::form) {
|
||||
// We need a new form id observer.
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
//XXXsmaug How should this work in Shadow DOM?
|
||||
nsIDocument* doc = GetUncomposedDoc();
|
||||
if (doc) {
|
||||
Element* formIdElement = nullptr;
|
||||
if (aValue && !aValue->IsEmptyString()) {
|
||||
|
@ -2348,8 +2351,8 @@ nsGenericHTMLFormElement::FocusState()
|
|||
Element*
|
||||
nsGenericHTMLFormElement::AddFormIdObserver()
|
||||
{
|
||||
NS_ASSERTION(GetCurrentDoc(), "When adding a form id observer, "
|
||||
"we should be in a document!");
|
||||
NS_ASSERTION(GetUncomposedDoc(), "When adding a form id observer, "
|
||||
"we should be in a document!");
|
||||
|
||||
nsAutoString formId;
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
|
@ -2369,8 +2372,8 @@ nsGenericHTMLFormElement::RemoveFormIdObserver()
|
|||
* element actually being in the tree. If it is not and @form value changes,
|
||||
* this method will be called for nothing but removing an observer which does
|
||||
* not exist doesn't cost so much (no entry in the hash table) so having a
|
||||
* boolean for GetCurrentDoc()/GetOwnerDoc() would make everything look more
|
||||
* complex for nothing.
|
||||
* boolean for GetUncomposedDoc()/GetOwnerDoc() would make everything look
|
||||
* more complex for nothing.
|
||||
*/
|
||||
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
|
@ -2449,10 +2452,10 @@ nsGenericHTMLFormElement::UpdateFormOwner(bool aBindToTree,
|
|||
element = aFormIdElement;
|
||||
}
|
||||
|
||||
NS_ASSERTION(GetCurrentDoc(), "The element should be in a document "
|
||||
"when UpdateFormOwner is called!");
|
||||
NS_ASSERTION(!GetCurrentDoc() ||
|
||||
element == GetCurrentDoc()->GetElementById(formId),
|
||||
NS_ASSERTION(GetUncomposedDoc(), "The element should be in a document "
|
||||
"when UpdateFormOwner is called!");
|
||||
NS_ASSERTION(!GetUncomposedDoc() ||
|
||||
element == GetUncomposedDoc()->GetElementById(formId),
|
||||
"element should be equals to the current element "
|
||||
"associated with the id in @form!");
|
||||
|
||||
|
@ -2765,7 +2768,7 @@ nsGenericHTMLElement::IsCurrentBodyElement()
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLDocument> htmlDocument =
|
||||
do_QueryInterface(GetCurrentDoc());
|
||||
do_QueryInterface(GetUncomposedDoc());
|
||||
if (!htmlDocument) {
|
||||
return false;
|
||||
}
|
||||
|
@ -2822,7 +2825,7 @@ nsGenericHTMLElement::RecompileScriptEventListeners()
|
|||
bool
|
||||
nsGenericHTMLElement::IsEditableRoot() const
|
||||
{
|
||||
nsIDocument *document = GetCurrentDoc();
|
||||
nsIDocument *document = GetComposedDoc();
|
||||
if (!document) {
|
||||
return false;
|
||||
}
|
||||
|
@ -2868,7 +2871,8 @@ MakeContentDescendantsEditable(nsIContent *aContent, nsIDocument *aDocument)
|
|||
void
|
||||
nsGenericHTMLElement::ChangeEditableState(int32_t aChange)
|
||||
{
|
||||
nsIDocument* document = GetCurrentDoc();
|
||||
//XXXsmaug Fix this for Shadow DOM, bug 1066965.
|
||||
nsIDocument* document = GetUncomposedDoc();
|
||||
if (!document) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1056,7 +1056,7 @@ HTMLContentSink::NotifyInsert(nsIContent* aContent,
|
|||
nsIContent* aChildContent,
|
||||
int32_t aIndexInContainer)
|
||||
{
|
||||
if (aContent && aContent->GetCurrentDoc() != mDocument) {
|
||||
if (aContent && aContent->GetUncomposedDoc() != mDocument) {
|
||||
// aContent is not actually in our document anymore.... Just bail out of
|
||||
// here; notifying on our document for this insert would be wrong.
|
||||
return;
|
||||
|
|
|
@ -1119,7 +1119,7 @@ bool
|
|||
nsHTMLDocument::MatchLinks(nsIContent *aContent, int32_t aNamespaceID,
|
||||
nsIAtom* aAtom, void* aData)
|
||||
{
|
||||
nsIDocument* doc = aContent->GetCurrentDoc();
|
||||
nsIDocument* doc = aContent->GetUncomposedDoc();
|
||||
|
||||
if (doc) {
|
||||
NS_ASSERTION(aContent->IsInDoc(),
|
||||
|
@ -1128,7 +1128,7 @@ nsHTMLDocument::MatchLinks(nsIContent *aContent, int32_t aNamespaceID,
|
|||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<nsIHTMLDocument> htmldoc =
|
||||
do_QueryInterface(aContent->GetCurrentDoc());
|
||||
do_QueryInterface(aContent->GetUncomposedDoc());
|
||||
NS_ASSERTION(htmldoc,
|
||||
"Huh, how did this happen? This should only be used with "
|
||||
"HTML documents!");
|
||||
|
@ -1173,7 +1173,7 @@ nsHTMLDocument::MatchAnchors(nsIContent *aContent, int32_t aNamespaceID,
|
|||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<nsIHTMLDocument> htmldoc =
|
||||
do_QueryInterface(aContent->GetCurrentDoc());
|
||||
do_QueryInterface(aContent->GetUncomposedDoc());
|
||||
NS_ASSERTION(htmldoc,
|
||||
"Huh, how did this happen? This should only be used with "
|
||||
"HTML documents!");
|
||||
|
|
Загрузка…
Ссылка в новой задаче