Merge mozilla-central to mozilla-inbound

This commit is contained in:
Marco Bonardo 2011-10-19 11:50:01 +02:00
Родитель f64d358262 3a0bb8b0e6
Коммит 1716d593fe
165 изменённых файлов: 879 добавлений и 1247 удалений

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

@ -103,7 +103,7 @@ AccEvent::GetDocAccessible()
{
nsINode *node = GetNode();
if (node)
return GetAccService()->GetDocAccessible(node->GetOwnerDoc());
return GetAccService()->GetDocAccessible(node->OwnerDoc());
return nsnull;
}

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

@ -278,10 +278,10 @@ IDRefsIterator::IDRefsIterator(nsIContent* aContent, nsIAtom* aIDRefsAttr) :
return;
if (aContent->IsInAnonymousSubtree()) {
mXBLDocument = do_QueryInterface(aContent->GetOwnerDoc());
mXBLDocument = do_QueryInterface(aContent->OwnerDoc());
mBindingParent = do_QueryInterface(aContent->GetBindingParent());
} else {
mDocument = aContent->GetOwnerDoc();
mDocument = aContent->OwnerDoc();
}
}

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

@ -81,7 +81,7 @@ FocusManager::IsFocused(const nsAccessible* aAccessible) const
// peculiarity we would end up with plain implementation based on
// FocusedAccessible() method call. Make sure this issue is fixed in
// bug 638465.
if (focusedNode->GetOwnerDoc() == aAccessible->GetNode()->GetOwnerDoc()) {
if (focusedNode->OwnerDoc() == aAccessible->GetNode()->OwnerDoc()) {
return aAccessible ==
GetAccService()->GetAccessibleOrContainer(focusedNode, nsnull);
}
@ -145,7 +145,7 @@ FocusManager::NotifyOfDOMFocus(nsISupports* aTarget)
nsCOMPtr<nsINode> targetNode(do_QueryInterface(aTarget));
if (targetNode) {
nsDocAccessible* document =
GetAccService()->GetDocAccessible(targetNode->GetOwnerDoc());
GetAccService()->GetDocAccessible(targetNode->OwnerDoc());
if (document) {
// Set selection listener for focused element.
if (targetNode->IsElement()) {
@ -171,8 +171,8 @@ FocusManager::NotifyOfDOMBlur(nsISupports* aTarget)
// If DOM document stays focused then fire accessible focus event to process
// the case when no element within this DOM document will be focused.
nsCOMPtr<nsINode> targetNode(do_QueryInterface(aTarget));
if (targetNode && targetNode->GetOwnerDoc() == FocusedDOMDocument()) {
nsIDocument* DOMDoc = targetNode->GetOwnerDoc();
if (targetNode && targetNode->OwnerDoc() == FocusedDOMDocument()) {
nsIDocument* DOMDoc = targetNode->OwnerDoc();
nsDocAccessible* document =
GetAccService()->GetDocAccessible(DOMDoc);
if (document) {
@ -216,7 +216,7 @@ FocusManager::ForceFocusEvent()
nsINode* focusedNode = FocusedDOMNode();
if (focusedNode) {
nsDocAccessible* document =
GetAccService()->GetDocAccessible(focusedNode->GetOwnerDoc());
GetAccService()->GetDocAccessible(focusedNode->OwnerDoc());
if (document) {
document->HandleNotification<FocusManager, nsINode>
(this, &FocusManager::ProcessDOMFocus, focusedNode);
@ -246,7 +246,7 @@ FocusManager::ProcessDOMFocus(nsINode* aTarget)
"Notification target", aTarget)
nsDocAccessible* document =
GetAccService()->GetDocAccessible(aTarget->GetOwnerDoc());
GetAccService()->GetDocAccessible(aTarget->OwnerDoc());
nsAccessible* target = document->GetAccessibleOrContainer(aTarget);
if (target) {

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

@ -380,7 +380,7 @@ NotificationController::CoalesceEvents()
// is supported. Ignore events from different documents since we don't
// coalesce them.
if (!thisEvent->mNode ||
thisEvent->mNode->GetOwnerDoc() != tailEvent->mNode->GetOwnerDoc())
thisEvent->mNode->OwnerDoc() != tailEvent->mNode->OwnerDoc())
continue;
// Coalesce earlier event for the same target.

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

@ -262,7 +262,7 @@ nsDocAccessible *
nsAccessNode::GetDocAccessible() const
{
return mContent ?
GetAccService()->GetDocAccessible(mContent->GetOwnerDoc()) : nsnull;
GetAccService()->GetDocAccessible(mContent->OwnerDoc()) : nsnull;
}
nsRootAccessible*
@ -465,10 +465,8 @@ nsAccessNode::GetLanguage(nsAString& aLanguage)
nsCoreUtils::GetLanguageFor(mContent, nsnull, aLanguage);
if (aLanguage.IsEmpty()) { // Nothing found, so use document's language
nsIDocument *doc = mContent->GetOwnerDoc();
if (doc) {
doc->GetHeaderData(nsGkAtoms::headerContentLanguage, aLanguage);
}
mContent->OwnerDoc()->GetHeaderData(nsGkAtoms::headerContentLanguage,
aLanguage);
}
return NS_OK;

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

@ -152,7 +152,7 @@ public:
virtual nsINode* GetNode() const { return mContent; }
nsIContent* GetContent() const { return mContent; }
virtual nsIDocument* GetDocumentNode() const
{ return mContent ? mContent->GetOwnerDoc() : nsnull; }
{ return mContent ? mContent->OwnerDoc() : nsnull; }
/**
* Return node type information of DOM node associated with the accessible.

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

@ -864,7 +864,7 @@ nsAccessibilityService::GetAccessible(nsINode* aNode)
{
NS_PRECONDITION(aNode, "Getting an accessible for null node! Crash.");
nsDocAccessible* document = GetDocAccessible(aNode->GetOwnerDoc());
nsDocAccessible* document = GetDocAccessible(aNode->OwnerDoc());
return document ? document->GetAccessible(aNode) : nsnull;
}
@ -876,7 +876,7 @@ nsAccessibilityService::GetAccessibleOrContainer(nsINode* aNode,
return nsnull;
// XXX: weak shell is ignored until multiple shell documents are supported.
nsDocAccessible* document = GetDocAccessible(aNode->GetOwnerDoc());
nsDocAccessible* document = GetDocAccessible(aNode->OwnerDoc());
return document ? document->GetAccessibleOrContainer(aNode) : nsnull;
}
@ -936,7 +936,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
return nsnull;
}
if (aNode->GetOwnerDoc() != aPresShell->GetDocument()) {
if (aNode->OwnerDoc() != aPresShell->GetDocument()) {
NS_ERROR("Creating accessible for wrong pres shell");
return nsnull;
}
@ -983,7 +983,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
#endif
nsDocAccessible* docAcc =
GetAccService()->GetDocAccessible(aNode->GetOwnerDoc());
GetAccService()->GetDocAccessible(aNode->OwnerDoc());
if (!docAcc) {
NS_NOTREACHED("Node has no host document accessible!");
return nsnull;

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

@ -2101,7 +2101,7 @@ nsAccessible::RelationByType(PRUint32 aType)
} else {
// In XUL, use first <button default="true" .../> in the document
nsCOMPtr<nsIDOMXULDocument> xulDoc =
do_QueryInterface(mContent->GetOwnerDoc());
do_QueryInterface(mContent->OwnerDoc());
nsCOMPtr<nsIDOMXULButtonElement> buttonEl;
if (xulDoc) {
nsCOMPtr<nsIDOMNodeList> possibleDefaultButtons;
@ -2769,7 +2769,7 @@ nsAccessible::AnchorURIAt(PRUint32 aAnchorIndex)
mContent->GetAttr(kNameSpaceID_XLink, nsGkAtoms::href, href);
nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
nsCOMPtr<nsIDocument> document = mContent->GetOwnerDoc();
nsCOMPtr<nsIDocument> document = mContent->OwnerDoc();
nsIURI* anchorURI = nsnull;
NS_NewURI(&anchorURI, href,
document ? document->GetDocumentCharacterSet().get() : nsnull,
@ -2942,7 +2942,7 @@ nsAccessible::CurrentItem()
nsAutoString id;
if (mContent->GetAttr(kNameSpaceID_None,
nsGkAtoms::aria_activedescendant, id)) {
nsIDocument* DOMDoc = mContent->GetOwnerDoc();
nsIDocument* DOMDoc = mContent->OwnerDoc();
dom::Element* activeDescendantElm = DOMDoc->GetElementById(id);
if (activeDescendantElm) {
nsDocAccessible* document = GetDocAccessible();
@ -3057,7 +3057,7 @@ nsAccessible::GetFirstAvailableAccessible(nsINode *aStartNode) const
if (accessible)
return accessible;
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(aStartNode->GetOwnerDoc());
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(aStartNode->OwnerDoc());
NS_ENSURE_TRUE(domDoc, nsnull);
nsCOMPtr<nsIDOMNode> currentNode = do_QueryInterface(aStartNode);

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

@ -386,11 +386,7 @@ nsCaretAccessible::GetSelectionControllerForNode(nsIContent *aContent)
if (!aContent)
return nsnull;
nsIDocument *document = aContent->GetOwnerDoc();
if (!document)
return nsnull;
nsIPresShell *presShell = document->GetShell();
nsIPresShell *presShell = aContent->OwnerDoc()->GetShell();
if (!presShell)
return nsnull;

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

@ -207,11 +207,7 @@ nsCoreUtils::GetAccessKeyFor(nsIContent *aContent)
if (!aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::accesskey))
return 0;
nsCOMPtr<nsIDocument> doc = aContent->GetOwnerDoc();
if (!doc)
return 0;
nsCOMPtr<nsIPresShell> presShell = doc->GetShell();
nsCOMPtr<nsIPresShell> presShell = aContent->OwnerDoc()->GetShell();
if (!presShell)
return 0;
@ -439,11 +435,7 @@ nsCoreUtils::GetDocShellTreeItemFor(nsINode *aNode)
if (!aNode)
return nsnull;
nsIDocument *doc = aNode->GetOwnerDoc();
NS_ASSERTION(doc, "No document for node passed in");
NS_ENSURE_TRUE(doc, nsnull);
nsCOMPtr<nsISupports> container = doc->GetContainer();
nsCOMPtr<nsISupports> container = aNode->OwnerDoc()->GetContainer();
nsIDocShellTreeItem *docShellTreeItem = nsnull;
if (container)
CallQueryInterface(container, &docShellTreeItem);
@ -603,11 +595,8 @@ nsCoreUtils::GetComputedStyleDeclaration(const nsAString& aPseudoElt,
return nsnull;
// Returns number of items in style declaration
nsIDocument* document = content->GetOwnerDoc();
if (!document)
return nsnull;
nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(document->GetWindow());
nsCOMPtr<nsIDOMWindow> window =
do_QueryInterface(content->OwnerDoc()->GetWindow());
if (!window)
return nsnull;

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

@ -254,8 +254,7 @@ public:
*/
static nsIPresShell *GetPresShellFor(nsINode *aNode)
{
nsIDocument *document = aNode->GetOwnerDoc();
return document ? document->GetShell() : nsnull;
return aNode->OwnerDoc()->GetShell();
}
static already_AddRefed<nsIWeakReference> GetWeakShellFor(nsINode *aNode)
{

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

@ -1182,7 +1182,7 @@ nsDocAccessible::ARIAActiveDescendantChanged(nsIContent* aElm)
if (FocusMgr()->HasDOMFocus(aElm)) {
nsAutoString id;
if (aElm->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant, id)) {
nsIDocument* DOMDoc = aElm->GetOwnerDoc();
nsIDocument* DOMDoc = aElm->OwnerDoc();
dom::Element* activeDescendantElm = DOMDoc->GetElementById(id);
if (activeDescendantElm) {
nsAccessible* activeDescendant = GetAccessible(activeDescendantElm);

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

@ -324,7 +324,7 @@ nsRootAccessible::HandleEvent(nsIDOMEvent* aDOMEvent)
return NS_OK;
nsDocAccessible* document =
GetAccService()->GetDocAccessible(origTargetNode->GetOwnerDoc());
GetAccService()->GetDocAccessible(origTargetNode->OwnerDoc());
if (document) {
#ifdef DEBUG_NOTIFICATIONS

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

@ -201,7 +201,7 @@ nsHTMLRadioButtonAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
if (form) {
form->GetElementsByTagNameNS(nsURI, tagName, getter_AddRefs(inputs));
} else {
nsIDocument* doc = mContent->GetOwnerDoc();
nsIDocument* doc = mContent->OwnerDoc();
nsCOMPtr<nsIDOMDocument> document(do_QueryInterface(doc));
if (document)
document->GetElementsByTagNameNS(nsURI, tagName, getter_AddRefs(inputs));

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

@ -167,7 +167,7 @@ nsHTMLImageAccessible::DoAction(PRUint8 aIndex)
nsresult rv = element->GetLongDesc(longDesc);
NS_ENSURE_SUCCESS(rv, rv);
nsIDocument* document = mContent->GetOwnerDoc();
nsIDocument* document = mContent->OwnerDoc();
nsCOMPtr<nsPIDOMWindow> piWindow = document->GetWindow();
nsCOMPtr<nsIDOMWindow> win = do_QueryInterface(piWindow);
NS_ENSURE_TRUE(win, NS_ERROR_FAILURE);

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

@ -463,11 +463,7 @@ nsXULMenuitemAccessible::KeyboardShortcut() const
if (keyElmId.IsEmpty())
return KeyBinding();
nsIDocument* document = mContent->GetOwnerDoc();
if (!document)
return KeyBinding();
nsIContent* keyElm = document->GetElementById(keyElmId);
nsIContent* keyElm = mContent->OwnerDoc()->GetElementById(keyElmId);
if (!keyElm)
return KeyBinding();

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

@ -204,11 +204,7 @@ nsXULSliderAccessible::GetSliderNode()
return nsnull;
if (!mSliderNode) {
nsIDocument* document = mContent->GetOwnerDoc();
if (!document)
return nsnull;
nsCOMPtr<nsIDOMDocumentXBL> xblDoc(do_QueryInterface(document));
nsCOMPtr<nsIDOMDocumentXBL> xblDoc(do_QueryInterface(mContent->OwnerDoc()));
if (!xblDoc)
return nsnull;

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

@ -257,11 +257,11 @@ nsXULLinkAccessible::AnchorURIAt(PRUint32 aAnchorIndex)
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
nsIDocument* document = mContent->GetOwnerDoc();
nsIDocument* document = mContent->OwnerDoc();
nsIURI* anchorURI = nsnull;
NS_NewURI(&anchorURI, href,
document ? document->GetDocumentCharacterSet().get() : nsnull,
document->GetDocumentCharacterSet().get(),
baseURI);
return anchorURI;

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

@ -52,7 +52,6 @@ let TabView = {
PREF_RESTORE_ENABLED_ONCE: "browser.panorama.session_restore_enabled_once",
GROUPS_IDENTIFIER: "tabview-groups",
VISIBILITY_IDENTIFIER: "tabview-visibility",
LAST_SESSION_GROUP_NAME_IDENTIFIER: "tabview-last-session-group-name",
// ----------
get windowTitle() {
@ -143,10 +142,6 @@ let TabView = {
"TabShow", this._tabShowEventListener, false);
gBrowser.tabContainer.addEventListener(
"TabClose", this._tabCloseEventListener, false);
// grab the last used group title
this._lastSessionGroupName = sessionstore.getWindowValue(window,
this.LAST_SESSION_GROUP_NAME_IDENTIFIER);
}
}
@ -279,30 +274,6 @@ let TabView = {
else
this.show();
},
getActiveGroupName: function TabView_getActiveGroupName() {
if (!this._window)
return this._lastSessionGroupName;
// We get the active group this way, instead of querying
// GroupItems.getActiveGroupItem() because the tabSelect event
// will not have happened by the time the browser tries to
// update the title.
let groupItem = null;
let activeTab = window.gBrowser.selectedTab;
let activeTabItem = activeTab._tabViewTabItem;
if (activeTab.pinned) {
// It's an app tab, so it won't have a .tabItem. However, its .parent
// will already be set as the active group.
groupItem = this._window.GroupItems.getActiveGroupItem();
} else if (activeTabItem) {
groupItem = activeTabItem.parent;
}
// groupItem may still be null, if the active tab is an orphan.
return groupItem ? groupItem.getTitle() : "";
},
// ----------
updateContextMenu: function TabView_updateContextMenu(tab, popup) {

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

@ -813,12 +813,6 @@
}
} catch (e) {}
if ("TabView" in window) {
let groupName = TabView.getActiveGroupName();
if (groupName)
newTitle = groupName + sep + newTitle;
}
return newTitle;
]]>
</body>

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

@ -214,15 +214,6 @@ let Storage = {
win, win.TabView.VISIBILITY_IDENTIFIER, data);
},
// ----------
// Function: saveActiveGroupName
// Saves the active group's name for the given window.
saveActiveGroupName: function Storage_saveActiveGroupName(win) {
let groupName = win.TabView.getActiveGroupName();
this._sessionStore.setWindowValue(
win, win.TabView.LAST_SESSION_GROUP_NAME_IDENTIFIER, groupName);
},
// ----------
// Function: saveData
// Generic routine for saving data to a window.

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

@ -295,7 +295,6 @@ let UI = {
TabItems.saveAll();
TabItems.saveAllThumbnails({synchronously: true});
Storage.saveActiveGroupName(gWindow);
self._save();
}, false);

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

@ -60,7 +60,6 @@ _BROWSER_FILES = \
browser_tabview_bug591706.js \
browser_tabview_bug593283.js \
browser_tabview_bug594958.js \
browser_tabview_bug595020.js \
browser_tabview_bug595191.js \
browser_tabview_bug595436.js \
browser_tabview_bug595518.js \

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

@ -1,39 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
let stateStartup = {windows:[
{tabs:[{entries:[{url:"about:home"}]}], extData:{"tabview-last-session-group-name":"title"}}
]};
function test() {
let assertWindowTitle = function (win, title) {
let browser = win.gBrowser.tabs[0].linkedBrowser;
let winTitle = win.gBrowser.getWindowTitleForBrowser(browser);
info('window title is: "' + winTitle + '"');
is(winTitle.indexOf(title), 0, "title starts with '" + title + "'");
};
let testGroupNameChange = function (win) {
showTabView(function () {
let cw = win.TabView.getContentWindow();
let groupItem = cw.GroupItems.groupItems[0];
groupItem.setTitle("new-title");
hideTabView(function () {
assertWindowTitle(win, "new-title");
finish();
}, win);
}, win);
};
waitForExplicitFinish();
newWindowWithState(stateStartup, function (win) {
registerCleanupFunction(function () win.close());
assertWindowTitle(win, "title");
testGroupNameChange(win);
});
}

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

@ -174,12 +174,8 @@ nsMacShellService::SetDesktopBackground(nsIDOMElement* aElement,
// We need the referer URI for nsIWebBrowserPersist::saveURI
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocument> doc;
doc = content->GetOwnerDoc();
if (!doc)
return NS_ERROR_FAILURE;
nsIURI *docURI = doc->GetDocumentURI();
nsIURI *docURI = content->OwnerDoc()->GetDocumentURI();
if (!docURI)
return NS_ERROR_FAILURE;

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

@ -284,7 +284,6 @@ CssHtmlTree.prototype = {
this.cssLogic.sourceFilter = this.showOnlyUserStyles ?
CssLogic.FILTER.ALL :
CssLogic.FILTER.UA;
this.refreshPanel();
},
@ -443,12 +442,28 @@ PropertyView.prototype = {
return this.tree.cssLogic.getPropertyInfo(this.name);
},
/**
* Does the property have any matched selectors?
*/
get hasMatchedSelectors()
{
return this.propertyInfo.hasMatchedSelectors();
},
/**
* Does the property have any unmatched selectors?
*/
get hasUnmatchedSelectors()
{
return this.propertyInfo.hasUnmatchedSelectors();
},
/**
* Should this property be visible?
*/
get visible()
{
if (this.tree.showOnlyUserStyles && this.matchedSelectorCount == 0) {
if (this.tree.showOnlyUserStyles && !this.hasMatchedSelectors) {
return false;
}
@ -469,22 +484,6 @@ PropertyView.prototype = {
return this.visible ? "property-view" : "property-view-hidden";
},
/**
* The number of matched selectors.
*/
get matchedSelectorCount()
{
return this.propertyInfo.matchedSelectors.length;
},
/**
* The number of unmatched selectors.
*/
get unmatchedSelectorCount()
{
return this.propertyInfo.unmatchedSelectors.length;
},
/**
* Refresh the panel's CSS property value.
*/
@ -520,10 +519,10 @@ PropertyView.prototype = {
*/
refreshMatchedSelectors: function PropertyView_refreshMatchedSelectors()
{
this.matchedSelectorsTitleNode.innerHTML = this.matchedSelectorTitle();
this.matchedSelectorsContainer.hidden = this.matchedSelectorCount == 0;
let hasMatchedSelectors = this.hasMatchedSelectors;
this.matchedSelectorsContainer.hidden = !hasMatchedSelectors;
if (this.matchedExpanded && this.matchedSelectorCount > 0) {
if (this.matchedExpanded && hasMatchedSelectors) {
CssHtmlTree.processTemplate(this.templateMatchedSelectors,
this.matchedSelectorTable, this);
this.matchedExpander.setAttribute("open", "");
@ -536,11 +535,12 @@ PropertyView.prototype = {
/**
* Refresh the panel unmatched rules.
*/
refreshUnmatchedSelectors: function PropertyView_refreshUnmatchedSelectors() {
this.unmatchedSelectorsTitleNode.innerHTML = this.unmatchedSelectorTitle();
this.unmatchedSelectorsContainer.hidden = this.unmatchedSelectorCount == 0;
refreshUnmatchedSelectors: function PropertyView_refreshUnmatchedSelectors()
{
let hasUnmatchedSelectors = this.hasUnmatchedSelectors;
this.unmatchedSelectorsContainer.hidden = !hasUnmatchedSelectors;
if (this.unmatchedExpanded && this.unmatchedSelectorCount > 0) {
if (this.unmatchedExpanded && hasUnmatchedSelectors) {
CssHtmlTree.processTemplate(this.templateUnmatchedSelectors,
this.unmatchedSelectorTable, this);
this.unmatchedExpander.setAttribute("open", "");
@ -550,42 +550,6 @@ PropertyView.prototype = {
}
},
/**
* Compute the title of the matched selector expander. The title includes the
* number of selectors that match the currently selected element.
*
* @return {string} The rule title.
*/
matchedSelectorTitle: function PropertyView_matchedSelectorTitle()
{
let result = "";
if (this.matchedSelectorCount > 0) {
let str = CssHtmlTree.l10n("property.numberOfMatchedSelectors");
result = PluralForm.get(this.matchedSelectorCount, str)
.replace("#1", this.matchedSelectorCount);
}
return result;
},
/**
* Compute the title of the unmatched selector expander. The title includes
* the number of selectors that match the currently selected element.
*
* @return {string} The rule title.
*/
unmatchedSelectorTitle: function PropertyView_unmatchedSelectorTitle()
{
let result = "";
if (this.unmatchedSelectorCount > 0) {
let str = CssHtmlTree.l10n("property.numberOfUnmatchedSelectors");
result = PluralForm.get(this.unmatchedSelectorCount, str)
.replace("#1", this.unmatchedSelectorCount);
}
return result;
},
/**
* Provide access to the matched SelectorViews that we are currently
* displaying.

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

@ -216,7 +216,8 @@ CssLogic.prototype = {
/**
* Source filter. Only display properties coming from the given source (web
* address).
* address). Note that in order to avoid information overload we DO NOT show
* unmatched system rules.
* @see CssLogic.FILTER.*
*/
set sourceFilter(aValue) {
@ -415,6 +416,27 @@ CssLogic.prototype = {
}
},
/**
* Process *some* cached stylesheets in the document using your callback. The
* callback function should return true in order to halt processing.
*
* @param {function} aCallback the function you want executed for some of the
* CssSheet objects cached.
* @param {object} aScope the scope you want for the callback function. aScope
* will be the this object when aCallback executes.
* @return {Boolean} true if aCallback returns true during any iteration,
* otherwise false is returned.
*/
forSomeSheets: function CssLogic_forSomeSheets(aCallback, aScope)
{
for each (let sheets in this._sheets) {
if (sheets.some(aCallback, aScope)) {
return true;
}
}
return false;
},
/**
* Get the number nsIDOMCSSRule objects in the document, counted from all of
* the stylesheets. System sheets are excluded. If a filter is active, this
@ -554,7 +576,6 @@ CssLogic.prototype = {
if (!this._matchedSelectors) {
this.processMatchedSelectors();
}
if (this._unmatchedSelectors) {
if (aCallback) {
this._unmatchedSelectors.forEach(aCallback, aScope);
@ -565,6 +586,7 @@ CssLogic.prototype = {
this._unmatchedSelectors = [];
this.forEachSheet(function (aSheet) {
// We do not show unmatched selectors from system stylesheets
if (aSheet.systemSheet) {
return;
}
@ -581,6 +603,79 @@ CssLogic.prototype = {
}, this);
}, this);
},
/**
* Check if the highlighted element or it's parents have matched selectors.
* If aCallback is provided then the domRules for the element are passed to
* the callback function.
*
* @param {function} [aCallback] Simple callback method
* @return {Boolean} true if the current element or it's parents have
* matching CssSelector objects, false otherwise
*/
hasMatchedSelectors: function CL_hasMatchedSelectors(aCallback)
{
let domRules;
let element = this.viewedElement;
let matched = false;
do {
try {
domRules = this.domUtils.getCSSStyleRules(element);
} catch (ex) {
Services.console.
logStringMessage("CssLogic_hasMatchedSelectors error: " + ex);
continue;
}
if (domRules.Count() && (!aCallback || aCallback(domRules))) {
matched = true;
break;
}
} while ((element = element.parentNode) &&
element.nodeType === Ci.nsIDOMNode.ELEMENT_NODE);
return matched;
},
/**
* Check if the highlighted element or it's parents have unmatched selectors.
*
* @param {String} aProperty The CSS property to check against
* @return {Boolean} true if the current element or it's parents have
* unmatched CssSelector objects, false otherwise
*/
hasUnmatchedSelectors: function CL_hasUnmatchedSelectors(aProperty)
{
return this.forSomeSheets(function (aSheet) {
// We do not show unmatched selectors from system stylesheets
if (aSheet.systemSheet) {
return false;
}
return aSheet.forSomeRules(function (aRule) {
if (aRule.getPropertyValue(aProperty)) {
let element = this.viewedElement;
let selectorText = aRule._domRule.selectorText;
let matches = false;
do {
if (element.mozMatchesSelector(selectorText)) {
matches = true;
break;
}
} while ((element = element.parentNode) &&
element.nodeType === Ci.nsIDOMNode.ELEMENT_NODE);
if (!matches) {
// Now we know that there are rules but none match.
return true;
}
}
}, this);
}, this);
},
};
/**
@ -914,6 +1009,36 @@ CssSheet.prototype = {
this._ruleCount = ruleCount;
},
/**
* Process *some* rules in this stylesheet using your callback function. Your
* function receives one argument: the CssRule object for each CSSStyleRule
* inside the stylesheet. In order to stop processing the callback function
* needs to return a value.
*
* Note that this method also iterates through @media rules inside the
* stylesheet.
*
* @param {function} aCallback the function you want to execute for each of
* the style rules.
* @param {object} aScope the scope you want for the callback function. aScope
* will be the this object when aCallback executes.
* @return {Boolean} true if aCallback returns true during any iteration,
* otherwise false is returned.
*/
forSomeRules: function CssSheet_forSomeRules(aCallback, aScope)
{
let domRules = this.domSheet.cssRules;
function _iterator(aDomRule) {
if (aDomRule.type == Ci.nsIDOMCSSRule.STYLE_RULE) {
return aCallback.call(aScope, this.getRule(aDomRule));
} else if (aDomRule.type == Ci.nsIDOMCSSRule.MEDIA_RULE &&
aDomRule.cssRules && CssLogic.sheetMediaAllowed(aDomRule)) {
return Array.prototype.some.call(aDomRule.cssRules, _iterator, this);
}
}
return Array.prototype.some.call(domRules, _iterator, this);
},
toString: function CssSheet_toString()
{
return "CssSheet[" + this.shortSource + "]";
@ -1264,6 +1389,9 @@ function CssPropertyInfo(aCssLogic, aProperty)
// counted. This includes rules that come from filtered stylesheets (those
// that have sheetAllowed = false).
this._matchedSelectors = null;
this._unmatchedSelectors = null;
this._hasMatchedSelectors = null;
this._hasUnmatchedSelectors = null;
}
CssPropertyInfo.prototype = {
@ -1361,6 +1489,55 @@ CssPropertyInfo.prototype = {
return this._unmatchedSelectors;
},
/**
* Check if the property has any matched selectors.
*
* @return {Boolean} true if the current element or it's parents have
* matching CssSelector objects, false otherwise
*/
hasMatchedSelectors: function CssPropertyInfo_hasMatchedSelectors()
{
if (this._hasMatchedSelectors === null) {
this._hasMatchedSelectors = this._cssLogic.hasMatchedSelectors(function(aDomRules) {
for (let i = 0; i < aDomRules.Count(); i++) {
let domRule = aDomRules.GetElementAt(i);
if (domRule.type !== Ci.nsIDOMCSSRule.STYLE_RULE) {
continue;
}
let domSheet = domRule.parentStyleSheet;
let systemSheet = CssLogic.isSystemStyleSheet(domSheet);
let filter = this._cssLogic.sourceFilter;
if (filter !== CssLogic.FILTER.UA && systemSheet) {
continue;
}
if (domRule.style.getPropertyValue(this.property)) {
return true;
}
}
return false;
}.bind(this));
}
return this._hasMatchedSelectors;
},
/**
* Check if the property has any matched selectors.
*
* @return {Boolean} true if the current element or it's parents have
* unmatched CssSelector objects, false otherwise
*/
hasUnmatchedSelectors: function CssPropertyInfo_hasUnmatchedSelectors()
{
if (this._hasUnmatchedSelectors === null) {
this._hasUnmatchedSelectors = this._cssLogic.hasUnmatchedSelectors(this.property);
}
return this._hasUnmatchedSelectors;
},
/**
* Find the selectors that match the highlighted element and its parents.
* Uses CssLogic.processMatchedSelectors() to find the matched selectors,
@ -1437,7 +1614,8 @@ CssPropertyInfo.prototype = {
},
/**
* Process an unmatched CssSelector object.
* Process an unmatched CssSelector object. Note that in order to avoid
* information overload we DO NOT show unmatched system rules.
*
* @private
* @param {CssSelector} aSelector the unmatched CssSelector object.

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

@ -130,9 +130,7 @@ To visually debug the templates without running firefox, alter the display:none
<div save="${matchedSelectorsContainer}" class="rulelink" dir="${getRTLAttr}">
<div onclick="${matchedSelectorsClick}" class="rule-matched">
<div save="${matchedExpander}" class="expander"></div>
<div save="${matchedSelectorsTitleNode}">
${matchedSelectorTitle(__element)}
</div>
<div save="${matchedSelectorsTitleNode}">&matchedSelectors;</div>
</div>
<table save="${matchedSelectorTable}" dir="${getRTLAttr}"></table>
</div>
@ -140,9 +138,7 @@ To visually debug the templates without running firefox, alter the display:none
<div save="${unmatchedSelectorsContainer}" class="rulelink" dir="${getRTLAttr}">
<div onclick="${unmatchedSelectorsClick}" class="rule-unmatched">
<div save="${unmatchedExpander}" class="expander"></div>
<div save="${unmatchedSelectorsTitleNode}">
${unmatchedSelectorTitle(__element)}
</div>
<div save="${unmatchedSelectorsTitleNode}">&unmatchedSelectors;</div>
</div>
<table save="${unmatchedSelectorTable}" dir="${getRTLAttr}"></table>
</div>

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

@ -62,15 +62,8 @@ function testMatchedSelectors()
is(numMatchedSelectors, 6,
"CssLogic returns the correct number of matched selectors for div");
let returnedSelectorTitle = propertyView.matchedSelectorTitle();
let str = CssHtmlTree.l10n("property.numberOfMatchedSelectors");
let calculatedSelectorTitle = PluralForm.get(numMatchedSelectors, str)
.replace("#1", numMatchedSelectors);
info("returnedSelectorTitle: '" + returnedSelectorTitle + "'");
is(returnedSelectorTitle, calculatedSelectorTitle,
"returned title for matched selectors is correct");
is(propertyView.propertyInfo.hasMatchedSelectors(), true,
"hasMatchedSelectors returns true");
}
function testUnmatchedSelectors()
@ -93,15 +86,8 @@ function testUnmatchedSelectors()
is(numUnmatchedSelectors, 13,
"CssLogic returns the correct number of unmatched selectors for body");
let returnedSelectorTitle = propertyView.unmatchedSelectorTitle();
let str = CssHtmlTree.l10n("property.numberOfUnmatchedSelectors");
let calculatedSelectorTitle = PluralForm.get(numUnmatchedSelectors, str)
.replace("#1", numUnmatchedSelectors);
info("returnedSelectorTitle: '" + returnedSelectorTitle + "'");
is(returnedSelectorTitle, calculatedSelectorTitle,
"returned title for unmatched selectors is correct");
is(propertyView.propertyInfo.hasUnmatchedSelectors(), true,
"hasUnmatchedSelectors returns true");
}
function finishUp()

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

@ -13,3 +13,13 @@
- quickly jump to the documentation from the Mozilla Developer Network site.
- This is the link title shown in the hover tooltip. -->
<!ENTITY helpLinkTitle "Read the documentation for this property">
<!-- LOCALIZATION NOTE (matchedSelectors): For each style property the
- panel shows whether there are any selectors that match the currently
- selected element. -->
<!ENTITY matchedSelectors "Matched selectors">
<!-- LOCALIZATION NOTE (unmatchedSelectors): For each style property
- the panel shows whether there are any selectors that do not match the
- currently selected element. -->
<!ENTITY unmatchedSelectors "Unmatched selectors">

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

@ -3,19 +3,6 @@
# LOCALIZATION NOTE (panelTitle): This is the panel title
panelTitle=Style Inspector
# LOCALIZATION NOTE (property.numberOfMatchedSelectors): For each style property the
# panel shows the number of selectors which match the currently selected
# element, counted from all stylesheets in the web page inspected.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
property.numberOfMatchedSelectors=1 matched selector;#1 matched selectors
# LOCALIZATION NOTE (property.numberOfUnmatchedSelectors): For each style
# property the panel shows the number of selectors which do not match the
# currently selected element, counted from all stylesheets in the web page
# inspected.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
property.numberOfUnmatchedSelectors=1 unmatched selector;#1 unmatched selectors
# LOCALIZATION NOTE (rule.status): For each style property the panel shows
# the rules which hold that specific property. For every rule, the rule status
# is also displayed: a rule can be the best match, a match, a parent match, or a

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

@ -53,7 +53,7 @@
<!ENTITY netInterrupt.longDesc "&sharedLongDesc;">
<!ENTITY notCached.title "Document Expired">
<!ENTITY notCached.longDesc "<p>The requested document is not available in Firefox's cache.</p><ul><li>As a security precaution, Firefox does not automatically re-request sensitive documents.</li><li>Click Try Again to re-request the document from the website.</li></ul>">
<!ENTITY notCached.longDesc "<p>The requested document is not available in &brandShortName;'s cache.</p><ul><li>As a security precaution, &brandShortName; does not automatically re-request sensitive documents.</li><li>Click Try Again to re-request the document from the website.</li></ul>">
<!ENTITY netOffline.title "Offline mode">
<!ENTITY netOffline.longDesc2 "

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

@ -86,6 +86,7 @@ browser.jar:
skin/classic/browser/devtools/arrows.png (devtools/arrows.png)
skin/classic/browser/devtools/search.png (devtools/search.png)
skin/classic/browser/devtools/csshtmltree.css (devtools/csshtmltree.css)
skin/classic/browser/devtools/gcli.css (devtools/gcli.css)
#ifdef MOZ_SERVICES_SYNC
skin/classic/browser/sync-16-throbber.png
skin/classic/browser/sync-16.png

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

@ -125,6 +125,7 @@ browser.jar:
skin/classic/browser/devtools/arrows.png (devtools/arrows.png)
skin/classic/browser/devtools/search.png (devtools/search.png)
skin/classic/browser/devtools/csshtmltree.css (devtools/csshtmltree.css)
skin/classic/browser/devtools/gcli.css (devtools/gcli.css)
#ifdef MOZ_SERVICES_SYNC
skin/classic/browser/sync-throbber.png
skin/classic/browser/sync-16.png

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

@ -294,7 +294,7 @@ NS_CP_GetDocShellFromContext(nsISupports *aContext)
// hopefully
nsCOMPtr<nsIContent> content = do_QueryInterface(aContext);
if (content) {
doc = content->GetOwnerDoc();
doc = content->OwnerDoc();
}
}

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

@ -278,9 +278,7 @@ public:
*/
inline bool IsInHTMLDocument() const
{
nsIDocument* doc = GetOwnerDoc();
return doc && // XXX clean up after bug 335998 lands
doc->IsHTML();
return OwnerDoc()->IsHTML();
}
/**

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

@ -1883,7 +1883,7 @@ NS_NewPluginDocument(nsIDocument** aInstancePtrResult);
inline nsIDocument*
nsINode::GetOwnerDocument() const
{
nsIDocument* ownerDoc = GetOwnerDoc();
nsIDocument* ownerDoc = OwnerDoc();
return ownerDoc != this ? ownerDoc : nsnull;
}

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

@ -283,8 +283,8 @@ private:
// IID for the nsINode interface
#define NS_INODE_IID \
{ 0x38f966a0, 0xd652, 0x4979, \
{ 0xae, 0x37, 0xc8, 0x75, 0x84, 0xfc, 0xf8, 0x43 } }
{ 0x20d16be2, 0x3c58, 0x4099, \
{ 0xbf, 0xa6, 0xd0, 0xe7, 0x6b, 0xb1, 0x3d, 0xc5 } }
/**
* An internal interface that abstracts some DOMNode-related parts that both
@ -415,7 +415,7 @@ public:
* nsIDocument GetOwnerDocument returns the document itself. For nsIContent
* implementations the two are the same.
*/
nsIDocument *GetOwnerDoc() const
nsIDocument *OwnerDoc() const
{
return mNodeInfo->GetDocument();
}
@ -438,7 +438,7 @@ public:
*/
nsIDocument *GetCurrentDoc() const
{
return IsInDoc() ? GetOwnerDoc() : nsnull;
return IsInDoc() ? OwnerDoc() : nsnull;
}
/**

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

@ -847,9 +847,8 @@ nsContentList::Match(Element *aElement)
if (toReturn)
return toReturn;
nsIDocument* doc = aElement->GetOwnerDoc();
bool matchHTML = aElement->GetNameSpaceID() == kNameSpaceID_XHTML &&
doc && doc->IsHTML();
aElement->OwnerDoc()->IsHTML();
if (unknown) {
return matchHTML ? ni->QualifiedNameEquals(mHTMLMatchAtom) :

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

@ -133,7 +133,7 @@ nsContentPolicy::CheckPolicy(CPMethod policyMethod,
nsCOMPtr<nsIDocument> doc;
nsCOMPtr<nsIContent> node = do_QueryInterface(requestingContext);
if (node) {
doc = node->GetOwnerDoc();
doc = node->OwnerDoc();
}
if (!doc) {
doc = do_QueryInterface(requestingContext);

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

@ -3247,10 +3247,7 @@ nsContentUtils::HasMutationListeners(nsINode* aNode,
PRUint32 aType,
nsINode* aTargetForSubtreeModified)
{
nsIDocument* doc = aNode->GetOwnerDoc();
if (!doc) {
return false;
}
nsIDocument* doc = aNode->OwnerDoc();
// global object will be null for documents that don't have windows.
nsPIDOMWindow* window = doc->GetInnerWindow();
@ -3321,7 +3318,7 @@ nsContentUtils::MaybeFireNodeRemoved(nsINode* aChild, nsINode* aParent,
{
NS_PRECONDITION(aChild, "Missing child");
NS_PRECONDITION(aChild->GetNodeParent() == aParent, "Wrong parent");
NS_PRECONDITION(aChild->GetOwnerDoc() == aOwnerDoc, "Wrong owner-doc");
NS_PRECONDITION(aChild->OwnerDoc() == aOwnerDoc, "Wrong owner-doc");
// This checks that IsSafeToRunScript is true since we don't want to fire
// events when that is false. We can't rely on nsEventDispatcher to assert
@ -3493,9 +3490,7 @@ nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
// If we don't have a document here, we can't get the right security context
// for compiling event handlers... so just bail out.
nsCOMPtr<nsIDocument> document = aContextNode->GetOwnerDoc();
NS_ENSURE_TRUE(document, NS_ERROR_NOT_AVAILABLE);
nsCOMPtr<nsIDocument> document = aContextNode->OwnerDoc();
bool isHTML = document->IsHTML();
#ifdef DEBUG
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(document);
@ -3736,7 +3731,7 @@ nsContentUtils::SetNodeTextContent(nsIContent* aContent,
{
// We're relying on mozAutoSubtreeModified to keep a strong reference if
// needed.
nsIDocument* doc = aContent->GetOwnerDoc();
nsIDocument* doc = aContent->OwnerDoc();
// Optimize the common case of there being no observers
if (HasMutationListeners(doc, NS_EVENT_BITS_MUTATION_NODEREMOVED)) {
@ -3885,7 +3880,7 @@ public:
AnonymousContentDestroyer(nsCOMPtr<nsIContent>* aContent) {
mContent.swap(*aContent);
mParent = mContent->GetParent();
mDoc = mContent->GetOwnerDoc();
mDoc = mContent->OwnerDoc();
}
NS_IMETHOD Run() {
mContent->UnbindFromTree();
@ -4736,15 +4731,9 @@ nsContentUtils::GetContextForEventHandlers(nsINode* aNode,
nsresult* aRv)
{
*aRv = NS_OK;
nsIDocument* ownerDoc = aNode->GetOwnerDoc();
if (!ownerDoc) {
*aRv = NS_ERROR_UNEXPECTED;
return nsnull;
}
bool hasHadScriptObject = true;
nsIScriptGlobalObject* sgo =
ownerDoc->GetScriptHandlingObject(hasHadScriptObject);
aNode->OwnerDoc()->GetScriptHandlingObject(hasHadScriptObject);
// It is bad if the document doesn't have event handling context,
// but it used to have one.
if (!sgo && hasHadScriptObject) {
@ -5185,7 +5174,7 @@ nsContentUtils::DispatchXULCommand(nsIContent* aTarget,
bool aMeta)
{
NS_ENSURE_STATE(aTarget);
nsIDocument* doc = aTarget->GetOwnerDoc();
nsIDocument* doc = aTarget->OwnerDoc();
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(doc);
NS_ENSURE_STATE(domDoc);
nsCOMPtr<nsIDOMEvent> event;
@ -5354,8 +5343,7 @@ AllocClassMatchingInfo(nsINode* aRootNode,
}
info->mCaseTreatment =
aRootNode->GetOwnerDoc() &&
aRootNode->GetOwnerDoc()->GetCompatibilityMode() == eCompatibility_NavQuirks ?
aRootNode->OwnerDoc()->GetCompatibilityMode() == eCompatibility_NavQuirks ?
eIgnoreCase : eCaseMatters;
return info;
}
@ -5482,7 +5470,7 @@ nsContentUtils::IsSubDocumentTabbable(nsIContent* aContent)
return false;
}
// XXXbz should this use GetOwnerDoc() for GetSubDocumentFor?
// XXXbz should this use OwnerDoc() for GetSubDocumentFor?
// sXBL/XBL2 issue!
nsIDocument* subDoc = doc->GetSubDocumentFor(aContent);
if (!subDoc) {

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

@ -179,11 +179,9 @@ nsDOMAttribute::SetOwnerDocument(nsIDocument* aDocument)
{
NS_ASSERTION(aDocument, "Missing document");
nsIDocument *doc = GetOwnerDoc();
nsIDocument *doc = OwnerDoc();
NS_ASSERTION(doc != aDocument, "bad call to nsDOMAttribute::SetOwnerDocument");
if (doc) {
doc->DeleteAllPropertiesFor(this);
}
doc->DeleteAllPropertiesFor(this);
nsCOMPtr<nsINodeInfo> newNodeInfo;
newNodeInfo = aDocument->NodeInfoManager()->
@ -275,10 +273,8 @@ NS_IMETHODIMP
nsDOMAttribute::GetSpecified(bool* aSpecified)
{
NS_ENSURE_ARG_POINTER(aSpecified);
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eSpecified);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eSpecified);
*aSpecified = true;
return NS_OK;
}
@ -287,11 +283,7 @@ NS_IMETHODIMP
nsDOMAttribute::GetOwnerElement(nsIDOMElement** aOwnerElement)
{
NS_ENSURE_ARG_POINTER(aOwnerElement);
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eOwnerElement);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eOwnerElement);
nsIContent* content = GetContentInternal();
if (content) {
@ -306,10 +298,7 @@ nsDOMAttribute::GetOwnerElement(nsIDOMElement** aOwnerElement)
NS_IMETHODIMP
nsDOMAttribute::GetNodeName(nsAString& aNodeName)
{
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eNodeName);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeName);
return GetName(aNodeName);
}
@ -317,10 +306,7 @@ nsDOMAttribute::GetNodeName(nsAString& aNodeName)
NS_IMETHODIMP
nsDOMAttribute::GetNodeValue(nsAString& aNodeValue)
{
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eNodeValue);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeValue);
return GetValue(aNodeValue);
}
@ -328,10 +314,7 @@ nsDOMAttribute::GetNodeValue(nsAString& aNodeValue)
NS_IMETHODIMP
nsDOMAttribute::SetNodeValue(const nsAString& aNodeValue)
{
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eNodeValue);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeValue);
return SetValue(aNodeValue);
}
@ -340,11 +323,7 @@ NS_IMETHODIMP
nsDOMAttribute::GetNodeType(PRUint16* aNodeType)
{
NS_ENSURE_ARG_POINTER(aNodeType);
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eNodeType);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeType);
*aNodeType = (PRUint16)nsIDOMNode::ATTRIBUTE_NODE;
return NS_OK;
@ -354,11 +333,7 @@ NS_IMETHODIMP
nsDOMAttribute::GetParentNode(nsIDOMNode** aParentNode)
{
NS_ENSURE_ARG_POINTER(aParentNode);
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eParentNode);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eParentNode);
*aParentNode = nsnull;
return NS_OK;
@ -374,10 +349,7 @@ nsDOMAttribute::GetParentElement(nsIDOMElement** aParentElement)
NS_IMETHODIMP
nsDOMAttribute::GetChildNodes(nsIDOMNodeList** aChildNodes)
{
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eChildNodes);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eChildNodes);
return nsINode::GetChildNodes(aChildNodes);
}
@ -385,10 +357,7 @@ nsDOMAttribute::GetChildNodes(nsIDOMNodeList** aChildNodes)
NS_IMETHODIMP
nsDOMAttribute::HasChildNodes(bool* aHasChildNodes)
{
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eHasChildNodes);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eHasChildNodes);
*aHasChildNodes = mFirstChild != nsnull;
@ -399,11 +368,7 @@ NS_IMETHODIMP
nsDOMAttribute::HasAttributes(bool* aHasAttributes)
{
NS_ENSURE_ARG_POINTER(aHasAttributes);
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eHasAttributes);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eHasAttributes);
*aHasAttributes = false;
@ -415,10 +380,7 @@ nsDOMAttribute::GetFirstChild(nsIDOMNode** aFirstChild)
{
*aFirstChild = nsnull;
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eFirstChild);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eFirstChild);
if (mFirstChild) {
CallQueryInterface(mFirstChild, aFirstChild);
@ -430,10 +392,8 @@ nsDOMAttribute::GetFirstChild(nsIDOMNode** aFirstChild)
NS_IMETHODIMP
nsDOMAttribute::GetLastChild(nsIDOMNode** aLastChild)
{
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eLastChild);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eLastChild);
return GetFirstChild(aLastChild);
}
@ -442,10 +402,7 @@ nsDOMAttribute::GetPreviousSibling(nsIDOMNode** aPreviousSibling)
{
NS_ENSURE_ARG_POINTER(aPreviousSibling);
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::ePreviousSibling);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::ePreviousSibling);
*aPreviousSibling = nsnull;
return NS_OK;
@ -456,10 +413,7 @@ nsDOMAttribute::GetNextSibling(nsIDOMNode** aNextSibling)
{
NS_ENSURE_ARG_POINTER(aNextSibling);
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eNextSibling);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eNextSibling);
*aNextSibling = nsnull;
return NS_OK;
@ -470,10 +424,7 @@ nsDOMAttribute::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
{
NS_ENSURE_ARG_POINTER(aAttributes);
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eAttributes);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eAttributes);
*aAttributes = nsnull;
return NS_OK;
@ -482,10 +433,7 @@ nsDOMAttribute::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
NS_IMETHODIMP
nsDOMAttribute::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn)
{
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eInsertBefore);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eInsertBefore);
return ReplaceOrInsertBefore(false, aNewChild, aRefChild, aReturn);
}
@ -493,10 +441,7 @@ nsDOMAttribute::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDO
NS_IMETHODIMP
nsDOMAttribute::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
{
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eReplaceChild);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eReplaceChild);
return ReplaceOrInsertBefore(true, aNewChild, aOldChild, aReturn);
}
@ -504,10 +449,7 @@ nsDOMAttribute::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDO
NS_IMETHODIMP
nsDOMAttribute::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
{
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eRemoveChild);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eRemoveChild);
return nsINode::RemoveChild(aOldChild, aReturn);
}
@ -515,10 +457,7 @@ nsDOMAttribute::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
NS_IMETHODIMP
nsDOMAttribute::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
{
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eAppendChild);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eAppendChild);
return InsertBefore(aNewChild, nsnull, aReturn);
}
@ -543,10 +482,7 @@ nsDOMAttribute::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
NS_IMETHODIMP
nsDOMAttribute::CloneNode(bool aDeep, nsIDOMNode** aResult)
{
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eCloneNode);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eCloneNode);
return nsNodeUtils::CloneNodeImpl(this, aDeep, true, aResult);
}
@ -554,10 +490,7 @@ nsDOMAttribute::CloneNode(bool aDeep, nsIDOMNode** aResult)
NS_IMETHODIMP
nsDOMAttribute::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
{
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eOwnerDocument);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eOwnerDocument);
return nsINode::GetOwnerDocument(aOwnerDocument);
}
@ -585,10 +518,7 @@ nsDOMAttribute::GetLocalName(nsAString& aLocalName)
NS_IMETHODIMP
nsDOMAttribute::Normalize()
{
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eNormalize);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eNormalize);
// Nothing to do here
return NS_OK;
@ -599,10 +529,8 @@ nsDOMAttribute::IsSupported(const nsAString& aFeature,
const nsAString& aVersion,
bool* aReturn)
{
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eIsSupported);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eIsSupported);
return nsGenericElement::InternalIsSupported(static_cast<nsIDOMAttr*>(this),
aFeature, aVersion, aReturn);
}
@ -631,40 +559,31 @@ nsDOMAttribute::CompareDocumentPosition(nsIDOMNode *other,
NS_IMETHODIMP
nsDOMAttribute::IsEqualNode(nsIDOMNode* aOther, bool* aResult)
{
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eIsEqualNode);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eIsEqualNode);
return nsINode::IsEqualNode(aOther, aResult);
}
NS_IMETHODIMP
nsDOMAttribute::GetTextContent(nsAString &aTextContent)
{
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eTextContent);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eTextContent);
return GetNodeValue(aTextContent);
}
NS_IMETHODIMP
nsDOMAttribute::SetTextContent(const nsAString& aTextContent)
{
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eTextContent);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eTextContent);
return SetNodeValue(aTextContent);
}
NS_IMETHODIMP
nsDOMAttribute::IsSameNode(nsIDOMNode *other, bool *aResult)
{
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eIsSameNode);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eIsSameNode);
*aResult = other == this;
return NS_OK;
@ -793,7 +712,7 @@ nsDOMAttribute::RemoveChildAt(PRUint32 aIndex, bool aNotify)
{
nsCOMPtr<nsIContent> child = mChild;
nsMutationGuard::DidMutate();
mozAutoDocUpdate updateBatch(GetOwnerDoc(), UPDATE_CONTENT_MODEL, aNotify);
mozAutoDocUpdate updateBatch(OwnerDoc(), UPDATE_CONTENT_MODEL, aNotify);
doRemoveChild(aNotify);
}

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

@ -299,7 +299,7 @@ nsDOMAttributeMap::SetNamedItemInternal(nsIDOMNode *aNode,
if (!mContent->HasSameOwnerDoc(iAttribute)) {
nsCOMPtr<nsIDOMDocument> domDoc =
do_QueryInterface(mContent->GetOwnerDoc(), &rv);
do_QueryInterface(mContent->OwnerDoc(), &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMNode> adoptedNode;

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

@ -65,7 +65,7 @@ nsDataDocumentContentPolicy::ShouldLoad(PRUint32 aContentType,
nsCOMPtr<nsIDocument> doc;
nsCOMPtr<nsINode> node = do_QueryInterface(aRequestingContext);
if (node) {
doc = node->GetOwnerDoc();
doc = node->OwnerDoc();
} else {
nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(aRequestingContext);
if (window) {

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

@ -400,8 +400,7 @@ nsIdentifierMapEntry::RemoveIdElement(Element* aElement)
// This could fire in OOM situations
// Only assert this in HTML documents for now as XUL does all sorts of weird
// crap.
NS_ASSERTION(!aElement->GetOwnerDoc() ||
!aElement->GetOwnerDoc()->IsHTML() ||
NS_ASSERTION(!aElement->OwnerDoc()->IsHTML() ||
mIdContentList.IndexOf(aElement) >= 0,
"Removing id entry that doesn't exist");
@ -1128,10 +1127,7 @@ nsExternalResourceMap::PendingLoad::StartLoad(nsIURI* aURI,
return NS_ERROR_CONTENT_BLOCKED;
}
nsIDocument* doc = aRequestingNode->GetOwnerDoc();
if (!doc) {
return NS_ERROR_NOT_AVAILABLE;
}
nsIDocument* doc = aRequestingNode->OwnerDoc();
nsCOMPtr<nsIInterfaceRequestor> req = nsContentUtils::GetSameOriginChecker();
NS_ENSURE_TRUE(req, NS_ERROR_OUT_OF_MEMORY);
@ -2007,7 +2003,7 @@ nsDocument::Init()
NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_NODE,
"Bad NodeType in aNodeInfo");
NS_ASSERTION(GetOwnerDoc() == this, "Our nodeinfo is busted!");
NS_ASSERTION(OwnerDoc() == this, "Our nodeinfo is busted!");
mScriptLoader = new nsScriptLoader(this);
NS_ENSURE_TRUE(mScriptLoader, NS_ERROR_OUT_OF_MEMORY);
@ -2726,7 +2722,7 @@ nsDocument::GetActiveElement(nsIDOMElement **aElement)
nsFocusManager::GetFocusedDescendant(window, false,
getter_AddRefs(focusedWindow));
// be safe and make sure the element is from this document
if (focusedContent && focusedContent->GetOwnerDoc() == this) {
if (focusedContent && focusedContent->OwnerDoc() == this) {
CallQueryInterface(focusedContent, aElement);
return NS_OK;
}
@ -4815,13 +4811,11 @@ nsDocument::ImportNode(nsIDOMNode* aImportedNode,
nodesWithProperties, getter_AddRefs(newNode));
NS_ENSURE_SUCCESS(rv, rv);
nsIDocument *ownerDoc = imported->GetOwnerDoc();
if (ownerDoc) {
rv = nsNodeUtils::CallUserDataHandlers(nodesWithProperties, ownerDoc,
nsIDOMUserDataHandler::NODE_IMPORTED,
true);
NS_ENSURE_SUCCESS(rv, rv);
}
nsIDocument *ownerDoc = imported->OwnerDoc();
rv = nsNodeUtils::CallUserDataHandlers(nodesWithProperties, ownerDoc,
nsIDOMUserDataHandler::NODE_IMPORTED,
true);
NS_ENSURE_SUCCESS(rv, rv);
newNode.swap(*aResult);
@ -5292,7 +5286,7 @@ nsDocument::GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult)
nsCOMPtr<nsIContent> content(do_QueryInterface(aElement));
NS_ENSURE_TRUE(content, NS_ERROR_UNEXPECTED);
nsIDocument* doc = content->GetOwnerDoc();
nsIDocument* doc = content->OwnerDoc();
NS_ENSURE_TRUE(doc == this, NS_ERROR_DOM_WRONG_DOCUMENT_ERR);
if (!mHasWarnedAboutBoxObjects && !content->IsXUL()) {
@ -6020,7 +6014,7 @@ nsDocument::AdoptNode(nsIDOMNode *aAdoptedNode, nsIDOMNode **aResult)
nsINode* parent = adoptedNode->GetNodeParent();
if (parent) {
nsContentUtils::MaybeFireNodeRemoved(adoptedNode, parent,
adoptedNode->GetOwnerDoc());
adoptedNode->OwnerDoc());
}
}
@ -6102,7 +6096,7 @@ nsDocument::AdoptNode(nsIDOMNode *aAdoptedNode, nsIDOMNode **aResult)
}
}
nsIDocument *oldDocument = adoptedNode->GetOwnerDoc();
nsIDocument *oldDocument = adoptedNode->OwnerDoc();
bool sameDocument = oldDocument == this;
JSContext *cx = nsnull;
@ -6162,7 +6156,7 @@ nsDocument::AdoptNode(nsIDOMNode *aAdoptedNode, nsIDOMNode **aResult)
this));
}
NS_ASSERTION(adoptedNode->GetOwnerDoc() == this,
NS_ASSERTION(adoptedNode->OwnerDoc() == this,
"Should still be in the document we just got adopted into");
return CallQueryInterface(adoptedNode, aResult);

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

@ -339,8 +339,8 @@ nsFrameLoader*
nsFrameLoader::Create(Element* aOwner, bool aNetworkCreated)
{
NS_ENSURE_TRUE(aOwner, nsnull);
nsIDocument* doc = aOwner->GetOwnerDoc();
NS_ENSURE_TRUE(doc && !doc->GetDisplayDocument() &&
nsIDocument* doc = aOwner->OwnerDoc();
NS_ENSURE_TRUE(!doc->GetDisplayDocument() &&
((!doc->IsLoadedAsData() && aOwner->GetCurrentDoc()) ||
doc->IsStaticDocument()),
nsnull);
@ -362,8 +362,8 @@ nsFrameLoader::LoadFrame()
src.AssignLiteral("about:blank");
}
nsIDocument* doc = mOwnerContent->GetOwnerDoc();
if (!doc || doc->IsStaticDocument()) {
nsIDocument* doc = mOwnerContent->OwnerDoc();
if (doc->IsStaticDocument()) {
return NS_OK;
}
@ -411,10 +411,7 @@ nsFrameLoader::LoadURI(nsIURI* aURI)
return NS_ERROR_INVALID_POINTER;
NS_ENSURE_STATE(!mDestroyCalled && mOwnerContent);
nsCOMPtr<nsIDocument> doc = mOwnerContent->GetOwnerDoc();
if (!doc) {
return NS_OK;
}
nsCOMPtr<nsIDocument> doc = mOwnerContent->OwnerDoc();
nsresult rv = CheckURILoad(aURI);
NS_ENSURE_SUCCESS(rv, rv);
@ -1274,12 +1271,9 @@ nsFrameLoader::Destroy()
nsCOMPtr<nsIDocument> doc;
bool dynamicSubframeRemoval = false;
if (mOwnerContent) {
doc = mOwnerContent->GetOwnerDoc();
if (doc) {
dynamicSubframeRemoval = !mIsTopLevelContent && !doc->InUnlinkOrDeletion();
doc->SetSubDocumentFor(mOwnerContent, nsnull);
}
doc = mOwnerContent->OwnerDoc();
dynamicSubframeRemoval = !mIsTopLevelContent && !doc->InUnlinkOrDeletion();
doc->SetSubDocumentFor(mOwnerContent, nsnull);
SetOwnerContent(nsnull);
}
@ -1382,8 +1376,8 @@ nsFrameLoader::MaybeCreateDocShell()
// Get our parent docshell off the document of mOwnerContent
// XXXbz this is such a total hack.... We really need to have a
// better setup for doing this.
nsIDocument* doc = mOwnerContent->GetOwnerDoc();
if (!doc || !(doc->IsStaticDocument() || mOwnerContent->IsInDoc())) {
nsIDocument* doc = mOwnerContent->OwnerDoc();
if (!(doc->IsStaticDocument() || mOwnerContent->IsInDoc())) {
return NS_ERROR_UNEXPECTED;
}
@ -2074,7 +2068,7 @@ nsFrameLoader::EnsureMessageManager()
NS_ENSURE_STATE(cx);
nsCOMPtr<nsIDOMChromeWindow> chromeWindow =
do_QueryInterface(mOwnerContent->GetOwnerDoc()->GetWindow());
do_QueryInterface(mOwnerContent->OwnerDoc()->GetWindow());
NS_ENSURE_STATE(chromeWindow);
nsCOMPtr<nsIChromeFrameMessageManager> parentManager;
chromeWindow->GetMessageManager(getter_AddRefs(parentManager));

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

@ -245,8 +245,8 @@ public:
* Return the document that owns this, or null if we don't have
* an owner.
*/
nsIDocument* GetOwnerDoc() const
{ return mOwnerContent ? mOwnerContent->GetOwnerDoc() : nsnull; }
nsIDocument* OwnerDoc() const
{ return mOwnerContent ? mOwnerContent->OwnerDoc() : nsnull; }
PBrowserParent* GetRemoteBrowser();

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

@ -106,10 +106,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGenericDOMDataNode)
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
}
nsIDocument* ownerDoc = tmp->GetOwnerDoc();
if (ownerDoc) {
ownerDoc->BindingManager()->Traverse(tmp, cb);
}
tmp->OwnerDoc()->BindingManager()->Traverse(tmp, cb);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericDOMDataNode)
@ -389,7 +386,7 @@ nsGenericDOMDataNode::SetTextInternal(PRUint32 aOffset, PRUint32 aCount,
mutation.mNewAttrValue = do_GetAtom(val);
}
mozAutoSubtreeModified subtree(GetOwnerDoc(), this);
mozAutoSubtreeModified subtree(OwnerDoc(), this);
(new nsPLDOMEvent(this, mutation))->RunDOMEventWhenSafe();
}
}

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

@ -182,7 +182,7 @@ public:
NS_IMETHOD SetTextContent(const nsAString& aTextContent)
{
// Batch possible DOMSubtreeModified events.
mozAutoSubtreeModified subtree(GetOwnerDoc(), nsnull);
mozAutoSubtreeModified subtree(OwnerDoc(), nsnull);
return SetNodeValue(aTextContent);
}

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

@ -217,12 +217,8 @@ void*
nsINode::GetProperty(PRUint16 aCategory, nsIAtom *aPropertyName,
nsresult *aStatus) const
{
nsIDocument *doc = GetOwnerDoc();
if (!doc)
return nsnull;
return doc->PropertyTable(aCategory)->GetProperty(this, aPropertyName,
aStatus);
return OwnerDoc()->PropertyTable(aCategory)->GetProperty(this, aPropertyName,
aStatus);
}
nsresult
@ -230,13 +226,12 @@ nsINode::SetProperty(PRUint16 aCategory, nsIAtom *aPropertyName, void *aValue,
NSPropertyDtorFunc aDtor, bool aTransfer,
void **aOldValue)
{
nsIDocument *doc = GetOwnerDoc();
if (!doc)
return NS_ERROR_FAILURE;
nsresult rv = doc->PropertyTable(aCategory)->SetProperty(this,
aPropertyName, aValue, aDtor,
nsnull, aTransfer, aOldValue);
nsresult rv = OwnerDoc()->PropertyTable(aCategory)->SetProperty(this,
aPropertyName,
aValue, aDtor,
nsnull,
aTransfer,
aOldValue);
if (NS_SUCCEEDED(rv)) {
SetFlags(NODE_HAS_PROPERTIES);
}
@ -247,21 +242,16 @@ nsINode::SetProperty(PRUint16 aCategory, nsIAtom *aPropertyName, void *aValue,
void
nsINode::DeleteProperty(PRUint16 aCategory, nsIAtom *aPropertyName)
{
nsIDocument *doc = GetOwnerDoc();
if (doc)
doc->PropertyTable(aCategory)->DeleteProperty(this, aPropertyName);
OwnerDoc()->PropertyTable(aCategory)->DeleteProperty(this, aPropertyName);
}
void*
nsINode::UnsetProperty(PRUint16 aCategory, nsIAtom *aPropertyName,
nsresult *aStatus)
{
nsIDocument *doc = GetOwnerDoc();
if (!doc)
return nsnull;
return doc->PropertyTable(aCategory)->UnsetProperty(this, aPropertyName,
aStatus);
return OwnerDoc()->PropertyTable(aCategory)->UnsetProperty(this,
aPropertyName,
aStatus);
}
nsINode::nsSlots*
@ -539,7 +529,7 @@ nsINode::RemoveChild(nsINode *aOldChild)
}
if (aOldChild && aOldChild->GetNodeParent() == this) {
nsContentUtils::MaybeFireNodeRemoved(aOldChild, this, GetOwnerDoc());
nsContentUtils::MaybeFireNodeRemoved(aOldChild, this, OwnerDoc());
}
PRInt32 index = IndexOf(aOldChild);
@ -617,7 +607,7 @@ nsINode::Normalize()
}
// We're relying on mozAutoSubtreeModified to keep the doc alive here.
nsIDocument* doc = GetOwnerDoc();
nsIDocument* doc = OwnerDoc();
// Batch possible DOMSubtreeModified events.
mozAutoSubtreeModified subtree(doc, nsnull);
@ -1095,7 +1085,7 @@ nsINode::AddEventListener(const nsAString& aType,
if (!aWantsUntrusted &&
(aOptionalArgc < 2 &&
!nsContentUtils::IsChromeDoc(GetOwnerDoc()))) {
!nsContentUtils::IsChromeDoc(OwnerDoc()))) {
aWantsUntrusted = true;
}
@ -1131,7 +1121,7 @@ nsINode::DispatchEvent(nsIDOMEvent *aEvent, bool* aRetVal)
{
// XXX sXBL/XBL2 issue -- do we really want the owner here? What
// if that's the XBL document? Would we want its presshell? Or what?
nsCOMPtr<nsIDocument> document = GetOwnerDoc();
nsCOMPtr<nsIDocument> document = OwnerDoc();
// Do nothing if the element does not belong to a document
if (!document) {
@ -1344,13 +1334,11 @@ nsIContent::GetFlattenedTreeParent() const
{
nsIContent *parent = GetParent();
if (parent && parent->HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
nsIDocument *doc = parent->GetOwnerDoc();
if (doc) {
nsIContent* insertionElement =
doc->BindingManager()->GetNestedInsertionPoint(parent, this);
if (insertionElement) {
parent = insertionElement;
}
nsIDocument *doc = parent->OwnerDoc();
nsIContent* insertionElement =
doc->BindingManager()->GetNestedInsertionPoint(parent, this);
if (insertionElement) {
parent = insertionElement;
}
}
return parent;
@ -1462,14 +1450,7 @@ nsIContent::LookupNamespaceURI(const nsAString& aNamespacePrefix,
already_AddRefed<nsIURI>
nsIContent::GetBaseURI() const
{
nsIDocument* doc = GetOwnerDoc();
if (!doc) {
// We won't be able to do security checks, etc. So don't go any
// further. That said, this really shouldn't happen...
NS_ERROR("Element without owner document");
return nsnull;
}
nsIDocument* doc = OwnerDoc();
// Start with document base
nsCOMPtr<nsIURI> base = doc->GetDocBaseURI();
@ -1486,18 +1467,15 @@ nsIContent::GetBaseURI() const
if (elem->IsSVG()) {
nsIContent* bindingParent = elem->GetBindingParent();
if (bindingParent) {
nsIDocument* bindingDoc = bindingParent->GetOwnerDoc();
if (bindingDoc) {
nsXBLBinding* binding =
bindingDoc->BindingManager()->GetBinding(bindingParent);
if (binding) {
// XXX sXBL/XBL2 issue
// If this is an anonymous XBL element use the binding
// document for the base URI.
// XXX Will fail with xml:base
base = binding->PrototypeBinding()->DocURI();
break;
}
nsXBLBinding* binding =
bindingParent->OwnerDoc()->BindingManager()->GetBinding(bindingParent);
if (binding) {
// XXX sXBL/XBL2 issue
// If this is an anonymous XBL element use the binding
// document for the base URI.
// XXX Will fail with xml:base
base = binding->PrototypeBinding()->DocURI();
break;
}
}
}
@ -1935,7 +1913,7 @@ nsGenericElement::GetScrollFrame(nsIFrame **aStyledFrame)
return scrollFrame;
}
nsIDocument* doc = GetOwnerDoc();
nsIDocument* doc = OwnerDoc();
bool quirksMode = doc->GetCompatibilityMode() == eCompatibility_NavQuirks;
Element* elementWithRootScrollInfo =
quirksMode ? doc->GetBodyElement() : doc->GetRootElement();
@ -2613,7 +2591,7 @@ nsGenericElement::GetAttributeNode(const nsAString& aName,
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
nsIDocument* document = GetOwnerDoc();
nsIDocument* document = OwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eGetAttributeNode);
}
@ -2641,10 +2619,7 @@ nsGenericElement::SetAttributeNode(nsIDOMAttr* aAttribute,
*aReturn = nsnull;
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eSetAttributeNode);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eSetAttributeNode);
nsCOMPtr<nsIDOMNamedNodeMap> map;
nsresult rv = GetAttributes(getter_AddRefs(map));
@ -2670,10 +2645,7 @@ nsGenericElement::RemoveAttributeNode(nsIDOMAttr* aAttribute,
*aReturn = nsnull;
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eRemoveAttributeNode);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eRemoveAttributeNode);
nsCOMPtr<nsIDOMNamedNodeMap> map;
nsresult rv = GetAttributes(getter_AddRefs(map));
@ -2772,10 +2744,7 @@ nsGenericElement::GetAttributeNodeNS(const nsAString& aNamespaceURI,
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eGetAttributeNodeNS);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eGetAttributeNodeNS);
nsCOMPtr<nsIDOMNamedNodeMap> map;
nsresult rv = GetAttributes(getter_AddRefs(map));
@ -2799,10 +2768,7 @@ nsGenericElement::SetAttributeNodeNS(nsIDOMAttr* aNewAttr,
NS_ENSURE_ARG_POINTER(aNewAttr);
*aReturn = nsnull;
nsIDocument* document = GetOwnerDoc();
if (document) {
document->WarnOnceAbout(nsIDocument::eSetAttributeNodeNS);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eSetAttributeNodeNS);
nsCOMPtr<nsIDOMNamedNodeMap> map;
nsresult rv = GetAttributes(getter_AddRefs(map));
@ -3035,37 +3001,34 @@ nsGenericElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
// that also need to be told that they are moving.
nsresult rv;
if (hadForceXBL) {
nsIDocument* ownerDoc = GetOwnerDoc();
if (ownerDoc) {
nsBindingManager* bmgr = ownerDoc->BindingManager();
nsBindingManager* bmgr = OwnerDoc()->BindingManager();
// First check if we have a binding...
nsXBLBinding* contBinding =
GetFirstBindingWithContent(bmgr, this);
if (contBinding) {
nsCOMPtr<nsIContent> anonRoot = contBinding->GetAnonymousContent();
bool allowScripts = contBinding->AllowScripts();
for (nsCOMPtr<nsIContent> child = anonRoot->GetFirstChild();
child;
child = child->GetNextSibling()) {
rv = child->BindToTree(aDocument, this, this, allowScripts);
NS_ENSURE_SUCCESS(rv, rv);
}
// ...then check if we have content in insertion points that are
// direct children of the <content>
rv = BindNodesInInsertPoints(contBinding, this, aDocument);
// First check if we have a binding...
nsXBLBinding* contBinding =
GetFirstBindingWithContent(bmgr, this);
if (contBinding) {
nsCOMPtr<nsIContent> anonRoot = contBinding->GetAnonymousContent();
bool allowScripts = contBinding->AllowScripts();
for (nsCOMPtr<nsIContent> child = anonRoot->GetFirstChild();
child;
child = child->GetNextSibling()) {
rv = child->BindToTree(aDocument, this, this, allowScripts);
NS_ENSURE_SUCCESS(rv, rv);
}
// ...and finally check if we're in a binding where we have content in
// insertion points.
if (aBindingParent) {
nsXBLBinding* binding = bmgr->GetBinding(aBindingParent);
if (binding) {
rv = BindNodesInInsertPoints(binding, this, aDocument);
NS_ENSURE_SUCCESS(rv, rv);
}
// ...then check if we have content in insertion points that are
// direct children of the <content>
rv = BindNodesInInsertPoints(contBinding, this, aDocument);
NS_ENSURE_SUCCESS(rv, rv);
}
// ...and finally check if we're in a binding where we have content in
// insertion points.
if (aBindingParent) {
nsXBLBinding* binding = bmgr->GetBinding(aBindingParent);
if (binding) {
rv = BindNodesInInsertPoints(binding, this, aDocument);
NS_ENSURE_SUCCESS(rv, rv);
}
}
}
@ -3101,7 +3064,7 @@ nsGenericElement::UnbindFromTree(bool aDeep, bool aNullParent)
"kids!");
// Make sure to unbind this node before doing the kids
nsIDocument *document =
HasFlag(NODE_FORCE_XBL_BINDINGS) ? GetOwnerDoc() : GetCurrentDoc();
HasFlag(NODE_FORCE_XBL_BINDINGS) ? OwnerDoc() : GetCurrentDoc();
if (aNullParent) {
if (GetParent()) {
@ -3192,19 +3155,15 @@ nsGenericElement::GetChildren(PRUint32 aFilter)
// insertion point if any.
nsINodeList *childList = nsnull;
nsIDocument* document = GetOwnerDoc();
if (document) {
if (!(aFilter & eAllButXBL)) {
childList = document->BindingManager()->GetXBLChildNodesFor(this);
if (!childList) {
childList = GetChildNodesList();
}
} else {
childList = document->BindingManager()->GetContentListFor(this);
nsIDocument* document = OwnerDoc();
if (!(aFilter & eAllButXBL)) {
childList = document->BindingManager()->GetXBLChildNodesFor(this);
if (!childList) {
childList = GetChildNodesList();
}
} else {
childList = GetChildNodesList();
childList = document->BindingManager()->GetContentListFor(this);
}
if (childList) {
@ -3269,7 +3228,7 @@ nsIContent::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
do_QueryInterface(static_cast<nsMouseEvent*>
(aVisitor.mEvent)->relatedTarget);
if (relatedTarget &&
relatedTarget->GetOwnerDoc() == GetOwnerDoc()) {
relatedTarget->OwnerDoc() == OwnerDoc()) {
// If current target is anonymous for events or we know that related
// target is descendant of an element which is anonymous for events,
@ -3352,16 +3311,13 @@ nsIContent::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
// check for an anonymous parent
// XXX XBL2/sXBL issue
if (HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
nsIDocument* ownerDoc = GetOwnerDoc();
if (ownerDoc) {
nsIContent* insertionParent = ownerDoc->BindingManager()->
GetInsertionParent(this);
NS_ASSERTION(!(aVisitor.mEventTargetAtParent && insertionParent &&
aVisitor.mEventTargetAtParent != insertionParent),
"Retargeting and having insertion parent!");
if (insertionParent) {
parent = insertionParent;
}
nsIContent* insertionParent = OwnerDoc()->BindingManager()->
GetInsertionParent(this);
NS_ASSERTION(!(aVisitor.mEventTargetAtParent && insertionParent &&
aVisitor.mEventTargetAtParent != insertionParent),
"Retargeting and having insertion parent!");
if (insertionParent) {
parent = insertionParent;
}
}
@ -3591,7 +3547,7 @@ AdoptNodeIntoOwnerDoc(nsINode *aParent, nsINode *aNode)
NS_ASSERTION(!aNode->GetNodeParent(),
"Should have removed from parent already");
nsIDocument *doc = aParent->GetOwnerDoc();
nsIDocument *doc = aParent->OwnerDoc();
nsresult rv;
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(doc, &rv);
@ -3604,7 +3560,7 @@ AdoptNodeIntoOwnerDoc(nsINode *aParent, nsINode *aNode)
rv = domDoc->AdoptNode(node, getter_AddRefs(adoptedNode));
NS_ENSURE_SUCCESS(rv, rv);
NS_ASSERTION(aParent->GetOwnerDoc() == doc,
NS_ASSERTION(aParent->OwnerDoc() == doc,
"ownerDoc chainged while adopting");
NS_ASSERTION(adoptedNode == node, "Uh, adopt node changed nodes?");
NS_ASSERTION(aParent->HasSameOwnerDoc(aNode),
@ -3674,7 +3630,7 @@ nsINode::doInsertChildAt(nsIContent* aKid, PRUint32 aIndex,
nsMutationEvent mutation(true, NS_MUTATION_NODEINSERTED);
mutation.mRelatedNode = do_QueryInterface(this);
mozAutoSubtreeModified subtree(GetOwnerDoc(), this);
mozAutoSubtreeModified subtree(OwnerDoc(), this);
(new nsPLDOMEvent(aKid, mutation))->RunDOMEventWhenSafe();
}
}
@ -3823,11 +3779,9 @@ nsGenericElement::GetPrimaryFrame(mozFlushType aType)
void
nsGenericElement::DestroyContent()
{
nsIDocument *document = GetOwnerDoc();
if (document) {
document->BindingManager()->RemovedFromDocument(this, document);
document->ClearBoxObjectFor(this);
}
nsIDocument *document = OwnerDoc();
document->BindingManager()->RemovedFromDocument(this, document);
document->ClearBoxObjectFor(this);
// XXX We really should let cycle collection do this, but that currently still
// leaks (see https://bugzilla.mozilla.org/show_bug.cgi?id=406684).
@ -4062,7 +4016,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
// If we're replacing, fire for node-to-be-replaced.
// If aRefChild == aNewChild then we'll fire for it in check below
if (aReplace && aRefChild != aNewChild) {
nsContentUtils::MaybeFireNodeRemoved(aRefChild, this, GetOwnerDoc());
nsContentUtils::MaybeFireNodeRemoved(aRefChild, this, OwnerDoc());
}
// If the new node already has a parent, fire for removing from old
@ -4070,7 +4024,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
nsINode* oldParent = aNewChild->GetNodeParent();
if (oldParent) {
nsContentUtils::MaybeFireNodeRemoved(aNewChild, oldParent,
aNewChild->GetOwnerDoc());
aNewChild->OwnerDoc());
}
// If we're inserting a fragment, fire for all the children of the
@ -4080,7 +4034,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
}
}
nsIDocument* doc = GetOwnerDoc();
nsIDocument* doc = OwnerDoc();
nsIContent* newContent = static_cast<nsIContent*>(aNewChild);
PRInt32 insPos;
@ -4246,10 +4200,8 @@ nsINode::IsEqualNode(nsIDOMNode* aOther, bool* aReturn)
nsresult
nsINode::IsSameNode(nsIDOMNode* aOther, bool* aReturn)
{
nsIDocument* owner = GetOwnerDoc();
if (owner) {
owner->WarnOnceAbout(nsIDocument::eIsSameNode);
}
OwnerDoc()->WarnOnceAbout(nsIDocument::eIsSameNode);
nsCOMPtr<nsINode> other = do_QueryInterface(aOther);
*aReturn = other == this;
return NS_OK;
@ -4296,7 +4248,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericElement)
{
nsIDocument *doc;
if (!tmp->GetNodeParent() && (doc = tmp->GetOwnerDoc())) {
if (!tmp->GetNodeParent() && (doc = tmp->OwnerDoc())) {
doc->BindingManager()->RemovedFromDocument(tmp, doc);
}
}
@ -4348,10 +4300,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGenericElement)
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
}
nsIDocument* ownerDoc = tmp->GetOwnerDoc();
if (ownerDoc) {
ownerDoc->BindingManager()->Traverse(tmp, cb);
}
tmp->OwnerDoc()->BindingManager()->Traverse(tmp, cb);
if (tmp->HasProperties() && tmp->IsXUL()) {
nsISupports* property =
@ -4424,14 +4373,8 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(nsGenericElement,
nsresult
nsGenericElement::PostQueryInterface(REFNSIID aIID, void** aInstancePtr)
{
nsIDocument *document = GetOwnerDoc();
if (document) {
return document->BindingManager()->GetBindingImplementation(this, aIID,
return OwnerDoc()->BindingManager()->GetBindingImplementation(this, aIID,
aInstancePtr);
}
*aInstancePtr = nsnull;
return NS_ERROR_NO_INTERFACE;
}
//----------------------------------------------------------------------
@ -4451,8 +4394,8 @@ nsGenericElement::AddScriptEventListener(nsIAtom* aEventName,
const nsAString& aValue,
bool aDefer)
{
nsIDocument *ownerDoc = GetOwnerDoc();
if (!ownerDoc || ownerDoc->IsLoadedAsData()) {
nsIDocument *ownerDoc = OwnerDoc();
if (ownerDoc->IsLoadedAsData()) {
// Make this a no-op rather than throwing an error to avoid
// the error causing problems setting the attribute.
return NS_OK;
@ -4665,13 +4608,10 @@ nsGenericElement::SetAttrAndNotify(PRInt32 aNamespaceID,
NS_ENSURE_SUCCESS(rv, rv);
if (document || HasFlag(NODE_FORCE_XBL_BINDINGS)) {
nsIDocument* ownerDoc = GetOwnerDoc();
if (ownerDoc) {
nsRefPtr<nsXBLBinding> binding =
ownerDoc->BindingManager()->GetBinding(this);
if (binding) {
binding->AttributeChanged(aName, aNamespaceID, false, aNotify);
}
nsRefPtr<nsXBLBinding> binding =
OwnerDoc()->BindingManager()->GetBinding(this);
if (binding) {
binding->AttributeChanged(aName, aNamespaceID, false, aNotify);
}
}
@ -4711,7 +4651,7 @@ nsGenericElement::SetAttrAndNotify(PRInt32 aNamespaceID,
}
mutation.mAttrChange = aModType;
mozAutoSubtreeModified subtree(GetOwnerDoc(), this);
mozAutoSubtreeModified subtree(OwnerDoc(), this);
(new nsPLDOMEvent(this, mutation))->RunDOMEventWhenSafe();
}
@ -4895,13 +4835,10 @@ nsGenericElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
NS_ENSURE_SUCCESS(rv, rv);
if (document || HasFlag(NODE_FORCE_XBL_BINDINGS)) {
nsIDocument* ownerDoc = GetOwnerDoc();
if (ownerDoc) {
nsRefPtr<nsXBLBinding> binding =
ownerDoc->BindingManager()->GetBinding(this);
if (binding) {
binding->AttributeChanged(aName, aNameSpaceID, true, aNotify);
}
nsRefPtr<nsXBLBinding> binding =
OwnerDoc()->BindingManager()->GetBinding(this);
if (binding) {
binding->AttributeChanged(aName, aNameSpaceID, true, aNotify);
}
}
@ -4928,7 +4865,7 @@ nsGenericElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
mutation.mPrevAttrValue = do_GetAtom(value);
mutation.mAttrChange = nsIDOMMutationEvent::REMOVAL;
mozAutoSubtreeModified subtree(GetOwnerDoc(), this);
mozAutoSubtreeModified subtree(OwnerDoc(), this);
(new nsPLDOMEvent(this, mutation))->RunDOMEventWhenSafe();
}
@ -5058,57 +4995,56 @@ nsGenericElement::List(FILE* out, PRInt32 aIndent,
nsGenericElement* nonConstThis = const_cast<nsGenericElement*>(this);
// XXX sXBL/XBL2 issue! Owner or current document?
nsIDocument *document = GetOwnerDoc();
if (document) {
// Note: not listing nsIAnonymousContentCreator-created content...
nsIDocument *document = OwnerDoc();
nsBindingManager* bindingManager = document->BindingManager();
nsCOMPtr<nsIDOMNodeList> anonymousChildren;
bindingManager->GetAnonymousNodesFor(nonConstThis,
getter_AddRefs(anonymousChildren));
// Note: not listing nsIAnonymousContentCreator-created content...
if (anonymousChildren) {
PRUint32 length;
anonymousChildren->GetLength(&length);
if (length > 0) {
for (indent = aIndent; --indent >= 0; ) fputs(" ", out);
fputs("anonymous-children<\n", out);
nsBindingManager* bindingManager = document->BindingManager();
nsCOMPtr<nsIDOMNodeList> anonymousChildren;
bindingManager->GetAnonymousNodesFor(nonConstThis,
getter_AddRefs(anonymousChildren));
for (PRUint32 i = 0; i < length; ++i) {
nsCOMPtr<nsIDOMNode> node;
anonymousChildren->Item(i, getter_AddRefs(node));
nsCOMPtr<nsIContent> child = do_QueryInterface(node);
child->List(out, aIndent + 1);
}
if (anonymousChildren) {
PRUint32 length;
anonymousChildren->GetLength(&length);
if (length > 0) {
for (indent = aIndent; --indent >= 0; ) fputs(" ", out);
fputs("anonymous-children<\n", out);
for (indent = aIndent; --indent >= 0; ) fputs(" ", out);
fputs(">\n", out);
for (PRUint32 i = 0; i < length; ++i) {
nsCOMPtr<nsIDOMNode> node;
anonymousChildren->Item(i, getter_AddRefs(node));
nsCOMPtr<nsIContent> child = do_QueryInterface(node);
child->List(out, aIndent + 1);
}
for (indent = aIndent; --indent >= 0; ) fputs(" ", out);
fputs(">\n", out);
}
}
if (bindingManager->HasContentListFor(nonConstThis)) {
nsCOMPtr<nsIDOMNodeList> contentList;
bindingManager->GetContentListFor(nonConstThis,
getter_AddRefs(contentList));
if (bindingManager->HasContentListFor(nonConstThis)) {
nsCOMPtr<nsIDOMNodeList> contentList;
bindingManager->GetContentListFor(nonConstThis,
getter_AddRefs(contentList));
NS_ASSERTION(contentList != nsnull, "oops, binding manager lied");
PRUint32 length;
contentList->GetLength(&length);
if (length > 0) {
for (indent = aIndent; --indent >= 0; ) fputs(" ", out);
fputs("content-list<\n", out);
NS_ASSERTION(contentList != nsnull, "oops, binding manager lied");
PRUint32 length;
contentList->GetLength(&length);
if (length > 0) {
for (indent = aIndent; --indent >= 0; ) fputs(" ", out);
fputs("content-list<\n", out);
for (PRUint32 i = 0; i < length; ++i) {
nsCOMPtr<nsIDOMNode> node;
contentList->Item(i, getter_AddRefs(node));
nsCOMPtr<nsIContent> child = do_QueryInterface(node);
child->List(out, aIndent + 1);
}
for (indent = aIndent; --indent >= 0; ) fputs(" ", out);
fputs(">\n", out);
for (PRUint32 i = 0; i < length; ++i) {
nsCOMPtr<nsIDOMNode> node;
contentList->Item(i, getter_AddRefs(node));
nsCOMPtr<nsIContent> child = do_QueryInterface(node);
child->List(out, aIndent + 1);
}
for (indent = aIndent; --indent >= 0; ) fputs(" ", out);
fputs(">\n", out);
}
}
}
@ -5366,7 +5302,7 @@ nsGenericElement::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
void
nsGenericElement::FireNodeRemovedForChildren()
{
nsIDocument* doc = GetOwnerDoc();
nsIDocument* doc = OwnerDoc();
// Optimize the common case
if (!nsContentUtils::
HasMutationListeners(doc, NS_EVENT_BITS_MUTATION_NODEREMOVED)) {
@ -5399,9 +5335,7 @@ ParseSelectorList(nsINode* aNode,
{
NS_ENSURE_ARG(aNode);
nsIDocument* doc = aNode->GetOwnerDoc();
NS_ENSURE_STATE(doc);
nsIDocument* doc = aNode->OwnerDoc();
nsCSSParser parser(doc->CSSLoader());
nsCSSSelectorList* selectorList;
@ -5442,7 +5376,7 @@ nsGenericElement::doQuerySelector(nsINode* aRoot, const nsAString& aSelector,
TreeMatchContext matchingContext(false,
nsRuleWalker::eRelevantLinkUnvisited,
aRoot->GetOwnerDoc());
aRoot->OwnerDoc());
for (nsIContent* cur = aRoot->GetFirstChild();
cur;
cur = cur->GetNextNode(aRoot)) {
@ -5476,7 +5410,7 @@ nsGenericElement::doQuerySelectorAll(nsINode* aRoot,
TreeMatchContext matchingContext(false,
nsRuleWalker::eRelevantLinkUnvisited,
aRoot->GetOwnerDoc());
aRoot->OwnerDoc());
for (nsIContent* cur = aRoot->GetFirstChild();
cur;
cur = cur->GetNextNode(aRoot)) {
@ -5502,7 +5436,7 @@ nsGenericElement::MozMatchesSelector(const nsAString& aSelector, nsresult* aResu
if (NS_SUCCEEDED(*aResult)) {
TreeMatchContext matchingContext(false,
nsRuleWalker::eRelevantLinkUnvisited,
GetOwnerDoc());
OwnerDoc());
matches = nsCSSRuleProcessor::SelectorListMatches(this, matchingContext,
selectorList);
}
@ -5583,7 +5517,7 @@ nsINode::Contains(const nsINode* aOther) const
return true;
}
if (!aOther ||
GetOwnerDoc() != aOther->GetOwnerDoc() ||
OwnerDoc() != aOther->OwnerDoc() ||
IsInDoc() != aOther->IsInDoc() ||
!(aOther->IsElement() ||
aOther->IsNodeOfType(nsINode::eCONTENT)) ||
@ -5592,7 +5526,7 @@ nsINode::Contains(const nsINode* aOther) const
}
const nsIContent* other = static_cast<const nsIContent*>(aOther);
if (this == GetOwnerDoc()) {
if (this == OwnerDoc()) {
// document.contains(aOther) returns true if aOther is in the document,
// but is not in any anonymous subtree.
// IsInDoc() check is done already before this.

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

@ -903,16 +903,10 @@ protected:
}
void RegisterFreezableElement() {
nsIDocument* doc = GetOwnerDoc();
if (doc) {
doc->RegisterFreezableElement(this);
}
OwnerDoc()->RegisterFreezableElement(this);
}
void UnregisterFreezableElement() {
nsIDocument* doc = GetOwnerDoc();
if (doc) {
doc->UnregisterFreezableElement(this);
}
OwnerDoc()->UnregisterFreezableElement(this);
}
/**

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

@ -864,7 +864,7 @@ nsImageLoadingContent::GetOurDocument()
nsCOMPtr<nsIContent> thisContent = do_QueryInterface(this);
NS_ENSURE_TRUE(thisContent, nsnull);
return thisContent->GetOwnerDoc();
return thisContent->OwnerDoc();
}
nsresult

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

@ -75,7 +75,7 @@ using namespace mozilla::dom;
#define IMPL_MUTATION_NOTIFICATION(func_, content_, params_) \
PR_BEGIN_MACRO \
nsINode* node = content_; \
NS_ASSERTION(node->GetOwnerDoc() == doc, "Bogus document"); \
NS_ASSERTION(node->OwnerDoc() == doc, "Bogus document"); \
if (doc) { \
static_cast<nsIMutationObserver*>(doc->BindingManager())-> \
func_ params_; \
@ -97,7 +97,7 @@ void
nsNodeUtils::CharacterDataWillChange(nsIContent* aContent,
CharacterDataChangeInfo* aInfo)
{
nsIDocument* doc = aContent->GetOwnerDoc();
nsIDocument* doc = aContent->OwnerDoc();
IMPL_MUTATION_NOTIFICATION(CharacterDataWillChange, aContent,
(doc, aContent, aInfo));
}
@ -106,7 +106,7 @@ void
nsNodeUtils::CharacterDataChanged(nsIContent* aContent,
CharacterDataChangeInfo* aInfo)
{
nsIDocument* doc = aContent->GetOwnerDoc();
nsIDocument* doc = aContent->OwnerDoc();
IMPL_MUTATION_NOTIFICATION(CharacterDataChanged, aContent,
(doc, aContent, aInfo));
}
@ -117,7 +117,7 @@ nsNodeUtils::AttributeWillChange(Element* aElement,
nsIAtom* aAttribute,
PRInt32 aModType)
{
nsIDocument* doc = aElement->GetOwnerDoc();
nsIDocument* doc = aElement->OwnerDoc();
IMPL_MUTATION_NOTIFICATION(AttributeWillChange, aElement,
(doc, aElement, aNameSpaceID, aAttribute,
aModType));
@ -129,7 +129,7 @@ nsNodeUtils::AttributeChanged(Element* aElement,
nsIAtom* aAttribute,
PRInt32 aModType)
{
nsIDocument* doc = aElement->GetOwnerDoc();
nsIDocument* doc = aElement->OwnerDoc();
IMPL_MUTATION_NOTIFICATION(AttributeChanged, aElement,
(doc, aElement, aNameSpaceID, aAttribute,
aModType));
@ -140,7 +140,7 @@ nsNodeUtils::ContentAppended(nsIContent* aContainer,
nsIContent* aFirstNewContent,
PRInt32 aNewIndexInContainer)
{
nsIDocument* doc = aContainer->GetOwnerDoc();
nsIDocument* doc = aContainer->OwnerDoc();
IMPL_MUTATION_NOTIFICATION(ContentAppended, aContainer,
(doc, aContainer, aFirstNewContent,
@ -156,7 +156,7 @@ nsNodeUtils::ContentInserted(nsINode* aContainer,
aContainer->IsNodeOfType(nsINode::eDOCUMENT),
"container must be an nsIContent or an nsIDocument");
nsIContent* container;
nsIDocument* doc = aContainer->GetOwnerDoc();
nsIDocument* doc = aContainer->OwnerDoc();
nsIDocument* document;
if (aContainer->IsNodeOfType(nsINode::eCONTENT)) {
container = static_cast<nsIContent*>(aContainer);
@ -181,7 +181,7 @@ nsNodeUtils::ContentRemoved(nsINode* aContainer,
aContainer->IsNodeOfType(nsINode::eDOCUMENT),
"container must be an nsIContent or an nsIDocument");
nsIContent* container;
nsIDocument* doc = aContainer->GetOwnerDoc();
nsIDocument* doc = aContainer->OwnerDoc();
nsIDocument* document;
if (aContainer->IsNodeOfType(nsINode::eCONTENT)) {
container = static_cast<nsIContent*>(aContainer);
@ -267,10 +267,8 @@ nsNodeUtils::LastRelease(nsINode* aNode)
if (aNode->HasProperties()) {
// Strong reference to the document so that deleting properties can't
// delete the document.
nsCOMPtr<nsIDocument> document = aNode->GetOwnerDoc();
if (document) {
document->DeleteAllPropertiesFor(aNode);
}
nsCOMPtr<nsIDocument> document = aNode->OwnerDoc();
document->DeleteAllPropertiesFor(aNode);
}
// I wonder whether it's faster to do the HasFlag check first....
@ -300,14 +298,11 @@ nsNodeUtils::LastRelease(nsINode* aNode)
}
if (aNode->IsElement()) {
nsIDocument* ownerDoc = aNode->GetOwnerDoc();
nsIDocument* ownerDoc = aNode->OwnerDoc();
Element* elem = aNode->AsElement();
if (ownerDoc) {
ownerDoc->ClearBoxObjectFor(elem);
}
ownerDoc->ClearBoxObjectFor(elem);
NS_ASSERTION(aNode->HasFlag(NODE_FORCE_XBL_BINDINGS) ||
!ownerDoc ||
!ownerDoc->BindingManager() ||
!ownerDoc->BindingManager()->GetBinding(elem),
"Non-forced node has binding on destruction");
@ -315,7 +310,7 @@ nsNodeUtils::LastRelease(nsINode* aNode)
// if NODE_FORCE_XBL_BINDINGS is set, the node might still have a binding
// attached
if (aNode->HasFlag(NODE_FORCE_XBL_BINDINGS) &&
ownerDoc && ownerDoc->BindingManager()) {
ownerDoc->BindingManager()) {
ownerDoc->BindingManager()->RemovedFromDocument(elem, ownerDoc);
}
}
@ -415,11 +410,7 @@ void
nsNodeUtils::TraverseUserData(nsINode* aNode,
nsCycleCollectionTraversalCallback &aCb)
{
nsIDocument* ownerDoc = aNode->GetOwnerDoc();
if (!ownerDoc) {
return;
}
nsIDocument* ownerDoc = aNode->OwnerDoc();
ownerDoc->PropertyTable(DOM_USER_DATA)->Enumerate(aNode, NoteUserData, &aCb);
ownerDoc->PropertyTable(DOM_USER_DATA_HANDLER)->Enumerate(aNode, NoteUserData, &aCb);
}
@ -438,9 +429,8 @@ nsNodeUtils::CloneNodeImpl(nsINode *aNode, bool aDeep,
getter_AddRefs(newNode));
NS_ENSURE_SUCCESS(rv, rv);
nsIDocument *ownerDoc = aNode->GetOwnerDoc();
if (ownerDoc && aCallUserDataHandlers) {
rv = CallUserDataHandlers(nodesWithProperties, ownerDoc,
if (aCallUserDataHandlers) {
rv = CallUserDataHandlers(nodesWithProperties, aNode->OwnerDoc(),
nsIDOMUserDataHandler::NODE_CLONED, true);
NS_ENSURE_SUCCESS(rv, rv);
}
@ -492,9 +482,8 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
bool hasHadScriptHandlingObject = false;
if (!newDoc->GetScriptHandlingObject(hasHadScriptHandlingObject) &&
!hasHadScriptHandlingObject) {
nsIDocument* currentDoc = aNode->GetOwnerDoc();
NS_ENSURE_STATE(currentDoc &&
(nsContentUtils::IsChromeDoc(currentDoc) ||
nsIDocument* currentDoc = aNode->OwnerDoc();
NS_ENSURE_STATE((nsContentUtils::IsChromeDoc(currentDoc) ||
(!currentDoc->GetScriptHandlingObject(hasHadScriptHandlingObject) &&
!hasHadScriptHandlingObject)));
}
@ -533,9 +522,9 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
}
}
else if (nodeInfoManager) {
nsIDocument* oldDoc = aNode->GetOwnerDoc();
nsIDocument* oldDoc = aNode->OwnerDoc();
bool wasRegistered = false;
if (oldDoc && aNode->IsElement()) {
if (aNode->IsElement()) {
Element* element = aNode->AsElement();
oldDoc->ClearBoxObjectFor(element);
wasRegistered = oldDoc->UnregisterFreezableElement(element);
@ -546,7 +535,7 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
elem->NodeInfoChanged(newNodeInfo);
}
nsIDocument* newDoc = aNode->GetOwnerDoc();
nsIDocument* newDoc = aNode->OwnerDoc();
if (newDoc) {
// XXX what if oldDoc is null, we don't know if this should be
// registered or not! Can that really happen?
@ -716,9 +705,7 @@ nsNodeUtils::UnlinkUserData(nsINode *aNode)
// Strong reference to the document so that deleting properties can't
// delete the document.
nsCOMPtr<nsIDocument> document = aNode->GetOwnerDoc();
if (document) {
document->PropertyTable(DOM_USER_DATA)->DeleteAllPropertiesFor(aNode);
document->PropertyTable(DOM_USER_DATA_HANDLER)->DeleteAllPropertiesFor(aNode);
}
nsCOMPtr<nsIDocument> document = aNode->OwnerDoc();
document->PropertyTable(DOM_USER_DATA)->DeleteAllPropertiesFor(aNode);
document->PropertyTable(DOM_USER_DATA_HANDLER)->DeleteAllPropertiesFor(aNode);
}

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

@ -603,11 +603,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
NS_ASSERTION(thisContent, "must be a content");
nsIDocument* doc = thisContent->GetOwnerDoc();
if (!doc) {
Fallback(false);
return NS_BINDING_ABORTED;
}
nsIDocument* doc = thisContent->OwnerDoc();
PRInt16 shouldProcess = nsIContentPolicy::ACCEPT;
rv =
@ -945,8 +941,8 @@ nsObjectLoadingContent::HasNewFrame(nsIObjectFrame* aFrame)
nsCOMPtr<nsIContent> thisContent =
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
NS_ASSERTION(thisContent, "must be a content");
nsIDocument* doc = thisContent->GetOwnerDoc();
if (!doc || doc->IsStaticDocument() || doc->IsBeingUsedAsImage()) {
nsIDocument* doc = thisContent->OwnerDoc();
if (doc->IsStaticDocument() || doc->IsBeingUsedAsImage()) {
return NS_OK;
}
@ -1124,7 +1120,7 @@ nsObjectLoadingContent::LoadObject(const nsAString& aURI,
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
NS_ASSERTION(thisContent, "must be a content");
nsIDocument* doc = thisContent->GetOwnerDoc();
nsIDocument* doc = thisContent->OwnerDoc();
nsCOMPtr<nsIURI> baseURI;
GetObjectBaseURI(thisContent, getter_AddRefs(baseURI));
@ -1199,8 +1195,8 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
NS_ASSERTION(thisContent, "must be a content");
nsIDocument* doc = thisContent->GetOwnerDoc();
if (!doc || doc->IsBeingUsedAsImage()) {
nsIDocument* doc = thisContent->OwnerDoc();
if (doc->IsBeingUsedAsImage()) {
return NS_OK;
}
@ -1769,7 +1765,7 @@ nsObjectLoadingContent::GetObjectBaseURI(nsIContent* thisContent, nsIURI** aURI)
codebase);
if (!codebase.IsEmpty()) {
nsContentUtils::NewURIWithDocumentCharset(aURI, codebase,
thisContent->GetOwnerDoc(),
thisContent->OwnerDoc(),
baseURI);
} else {
baseURI.swap(*aURI);

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

@ -1295,9 +1295,7 @@ nsresult nsRange::CutContents(nsIDOMDocumentFragment** aFragment)
nsresult rv;
nsCOMPtr<nsIDocument> doc =
do_QueryInterface(mStartParent->GetOwnerDoc());
if (!doc) return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsIDocument> doc = mStartParent->OwnerDoc();
nsCOMPtr<nsIDOMNode> commonAncestor;
rv = GetCommonAncestorContainer(getter_AddRefs(commonAncestor));
@ -1313,7 +1311,7 @@ nsresult nsRange::CutContents(nsIDOMDocumentFragment** aFragment)
nsCOMPtr<nsIDOMNode> commonCloneAncestor(do_QueryInterface(retval));
// Batch possible DOMSubtreeModified events.
mozAutoSubtreeModified subtree(mRoot ? mRoot->GetOwnerDoc(): nsnull, nsnull);
mozAutoSubtreeModified subtree(mRoot ? mRoot->OwnerDoc(): nsnull, nsnull);
// Save the range end points locally to avoid interference
// of Range gravity during our edits!
@ -1662,7 +1660,7 @@ nsRange::CloneContents(nsIDOMDocumentFragment** aReturn)
if (NS_FAILED(res)) return res;
nsCOMPtr<nsIDOMDocument> document =
do_QueryInterface(mStartParent->GetOwnerDoc());
do_QueryInterface(mStartParent->OwnerDoc());
NS_ASSERTION(document, "CloneContents needs a document to continue.");
if (!document) return NS_ERROR_FAILURE;
@ -2323,7 +2321,7 @@ nsRange::GetUsedFontFaces(nsIDOMFontFaceList** aResult)
nsCOMPtr<nsIDOMNode> endContainer = do_QueryInterface(mEndParent);
// Flush out layout so our frames are up to date.
nsIDocument* doc = mStartParent->GetOwnerDoc();
nsIDocument* doc = mStartParent->OwnerDoc();
NS_ENSURE_TRUE(doc, NS_ERROR_UNEXPECTED);
doc->FlushPendingNotifications(Flush_Frames);

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

@ -165,7 +165,7 @@ nsScriptElement::MaybeProcessScript()
mAlreadyStarted = true;
nsIDocument* ownerDoc = cont->GetOwnerDoc();
nsIDocument* ownerDoc = cont->OwnerDoc();
nsCOMPtr<nsIParser> parser = ((nsIScriptElement*) this)->GetCreatorParser();
if (parser) {
nsCOMPtr<nsIContentSink> sink = parser->GetContentSink();

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

@ -772,7 +772,7 @@ nsScriptLoader::ProcessRequest(nsScriptLoadRequest* aRequest)
else {
script = &aRequest->mScriptText;
doc = scriptElem->GetOwnerDoc();
doc = scriptElem->OwnerDoc();
}
nsCOMPtr<nsIScriptElement> oldParserInsertedScript;
@ -785,7 +785,7 @@ nsScriptLoader::ProcessRequest(nsScriptLoadRequest* aRequest)
FireScriptAvailable(NS_OK, aRequest);
bool runScript = true;
nsContentUtils::DispatchTrustedEvent(scriptElem->GetOwnerDoc(),
nsContentUtils::DispatchTrustedEvent(scriptElem->OwnerDoc(),
scriptElem,
NS_LITERAL_STRING("beforescriptexecute"),
true, true, &runScript);
@ -802,7 +802,7 @@ nsScriptLoader::ProcessRequest(nsScriptLoadRequest* aRequest)
doc->EndEvaluatingExternalScript();
}
nsContentUtils::DispatchTrustedEvent(scriptElem->GetOwnerDoc(),
nsContentUtils::DispatchTrustedEvent(scriptElem->OwnerDoc(),
scriptElem,
NS_LITERAL_STRING("afterscriptexecute"),
true, false);
@ -856,7 +856,7 @@ nsScriptLoader::EvaluateScript(nsScriptLoadRequest* aRequest,
}
nsCOMPtr<nsIContent> scriptContent(do_QueryInterface(aRequest->mElement));
nsIDocument* ownerDoc = scriptContent->GetOwnerDoc();
nsIDocument* ownerDoc = scriptContent->OwnerDoc();
if (ownerDoc != mDocument) {
// Willful violation of HTML5 as of 2010-12-01
return NS_ERROR_FAILURE;

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

@ -310,11 +310,11 @@ nsStyledElementNotElementCSSInlineStyle::ParseStyleAttribute(const nsAString& aV
nsAttrValue& aResult,
bool aForceInDataDoc)
{
nsIDocument* doc = GetOwnerDoc();
nsIDocument* doc = OwnerDoc();
if (doc && (aForceInDataDoc ||
!doc->IsLoadedAsData() ||
doc->IsStaticDocument())) {
if (aForceInDataDoc ||
!doc->IsLoadedAsData() ||
doc->IsStaticDocument()) {
bool isCSS = true; // assume CSS until proven otherwise
if (!IsInNativeAnonymousSubtree()) { // native anonymous content

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

@ -1206,7 +1206,7 @@ nsTreeSanitizer::SanitizeAttributes(mozilla::dom::Element* aElement,
if (kNameSpaceID_None == attrNs) {
if (aAllowStyle && nsGkAtoms::style == attrLocal) {
nsCOMPtr<nsIURI> baseURI = aElement->GetBaseURI();
nsIDocument* document = aElement->GetOwnerDoc();
nsIDocument* document = aElement->OwnerDoc();
// Pass the CSS Loader object to the parser, to allow parser error
// reports to include the outer window ID.
nsCSSParser parser(document->CSSLoader());
@ -1375,7 +1375,7 @@ nsTreeSanitizer::Sanitize(nsIContent* aFragment) {
nsCOMPtr<nsIURI> baseURI = node->GetBaseURI();
if (SanitizeStyleSheet(styleText,
sanitizedStyle,
aFragment->GetOwnerDoc(),
aFragment->OwnerDoc(),
baseURI)) {
nsContentUtils::SetNodeTextContent(node, sanitizedStyle, true);
} else {

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

@ -619,8 +619,7 @@ protected:
nsIPresShell *GetPresShell() {
nsCOMPtr<nsIContent> content = do_QueryObject(mCanvasElement);
if (content) {
nsIDocument* ownerDoc = content->GetOwnerDoc();
return ownerDoc ? ownerDoc->GetShell() : nsnull;
return content->OwnerDoc()->GetShell();
}
if (mDocShell) {
nsCOMPtr<nsIPresShell> shell;
@ -873,7 +872,7 @@ nsCanvasRenderingContext2D::SetStyleFromStringOrInterface(const nsAString& aStr,
if (!aStr.IsVoid()) {
nsIDocument* document = mCanvasElement ?
HTMLCanvasElement()->GetOwnerDoc() : nsnull;
HTMLCanvasElement()->OwnerDoc() : nsnull;
// Pass the CSS Loader object to the parser, to allow parser error
// reports to include the outer window ID.
@ -914,7 +913,7 @@ nsCanvasRenderingContext2D::SetStyleFromStringOrInterface(const nsAString& aStr,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"Canvas",
mCanvasElement ? HTMLCanvasElement()->GetOwnerDoc() : nsnull);
mCanvasElement ? HTMLCanvasElement()->OwnerDoc() : nsnull);
return NS_OK;
}
@ -1187,7 +1186,7 @@ nsCanvasRenderingContext2D::EnsureSurface()
nsCOMPtr<nsIContent> content = do_QueryObject(mCanvasElement);
nsIDocument* ownerDoc = nsnull;
if (content)
ownerDoc = content->GetOwnerDoc();
ownerDoc = content->OwnerDoc();
nsRefPtr<LayerManager> layerManager = nsnull;
if (ownerDoc)
@ -1920,7 +1919,7 @@ NS_IMETHODIMP
nsCanvasRenderingContext2D::SetShadowColor(const nsAString& colorstr)
{
nsIDocument* document = mCanvasElement ?
HTMLCanvasElement()->GetOwnerDoc() : nsnull;
HTMLCanvasElement()->OwnerDoc() : nsnull;
// Pass the CSS Loader object to the parser, to allow parser error reports
// to include the outer window ID.
@ -2427,7 +2426,7 @@ CreateFontStyleRule(const nsAString& aFont,
bool changed;
nsIPrincipal* principal = aNode->NodePrincipal();
nsIDocument* document = aNode->GetOwnerDoc();
nsIDocument* document = aNode->OwnerDoc();
nsIURI* docURL = document->GetDocumentURI();
nsIURI* baseURL = document->GetDocBaseURI();
@ -3692,7 +3691,7 @@ nsCanvasRenderingContext2D::DrawWindow(nsIDOMWindow* aWindow, float aX, float aY
nscolor bgColor;
nsIDocument* elementDoc = mCanvasElement ?
HTMLCanvasElement()->GetOwnerDoc() : nsnull;
HTMLCanvasElement()->OwnerDoc() : nsnull;
// Pass the CSS Loader object to the parser, to allow parser error reports
// to include the outer window ID.

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

@ -610,8 +610,7 @@ protected:
nsIPresShell *GetPresShell() {
nsCOMPtr<nsIContent> content = do_QueryObject(mCanvasElement);
if (content) {
nsIDocument* ownerDoc = content->GetOwnerDoc();
return ownerDoc ? ownerDoc->GetShell() : nsnull;
return content->OwnerDoc()->GetShell();
}
if (mDocShell) {
nsCOMPtr<nsIPresShell> shell;
@ -1066,7 +1065,7 @@ nsCanvasRenderingContext2DAzure::SetStyleFromStringOrInterface(const nsAString&
if (!aStr.IsVoid()) {
nsIDocument* document = mCanvasElement ?
HTMLCanvasElement()->GetOwnerDoc() : nsnull;
HTMLCanvasElement()->OwnerDoc() : nsnull;
// Pass the CSS Loader object to the parser, to allow parser error
// reports to include the outer window ID.
@ -1103,7 +1102,7 @@ nsCanvasRenderingContext2DAzure::SetStyleFromStringOrInterface(const nsAString&
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"Canvas",
mCanvasElement ? HTMLCanvasElement()->GetOwnerDoc() : nsnull);
mCanvasElement ? HTMLCanvasElement()->OwnerDoc() : nsnull);
return NS_OK;
}
@ -1241,7 +1240,7 @@ nsCanvasRenderingContext2DAzure::SetDimensions(PRInt32 width, PRInt32 height)
nsCOMPtr<nsIContent> content = do_QueryObject(mCanvasElement);
nsIDocument* ownerDoc = nsnull;
if (content) {
ownerDoc = content->GetOwnerDoc();
ownerDoc = content->OwnerDoc();
}
nsRefPtr<LayerManager> layerManager = nsnull;
@ -2020,7 +2019,7 @@ NS_IMETHODIMP
nsCanvasRenderingContext2DAzure::SetShadowColor(const nsAString& colorstr)
{
nsIDocument* document = mCanvasElement ?
HTMLCanvasElement()->GetOwnerDoc() : nsnull;
HTMLCanvasElement()->OwnerDoc() : nsnull;
// Pass the CSS Loader object to the parser, to allow parser error reports
// to include the outer window ID.
@ -2675,7 +2674,7 @@ CreateFontStyleRule(const nsAString& aFont,
bool changed;
nsIPrincipal* principal = aNode->NodePrincipal();
nsIDocument* document = aNode->GetOwnerDoc();
nsIDocument* document = aNode->OwnerDoc();
nsIURI* docURL = document->GetDocumentURI();
nsIURI* baseURL = document->GetDocBaseURI();
@ -3905,7 +3904,7 @@ nsCanvasRenderingContext2DAzure::DrawWindow(nsIDOMWindow* aWindow, float aX, flo
nscolor bgColor;
nsIDocument* elementDoc = mCanvasElement ?
HTMLCanvasElement()->GetOwnerDoc() : nsnull;
HTMLCanvasElement()->OwnerDoc() : nsnull;
// Pass the CSS Loader object to the parser, to allow parser error reports
// to include the outer window ID.

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

@ -87,7 +87,7 @@ public:
nsLoadBlockingPLDOMEvent(nsINode *aEventNode, const nsAString& aEventType,
bool aBubbles, bool aDispatchChromeOnly)
: nsPLDOMEvent(aEventNode, aEventType, aBubbles, aDispatchChromeOnly),
mBlockedDoc(aEventNode->GetOwnerDoc())
mBlockedDoc(aEventNode->OwnerDoc())
{
if (mBlockedDoc) {
mBlockedDoc->BlockOnload();
@ -96,7 +96,7 @@ public:
nsLoadBlockingPLDOMEvent(nsINode *aEventNode, nsIDOMEvent *aEvent)
: nsPLDOMEvent(aEventNode, aEvent),
mBlockedDoc(aEventNode->GetOwnerDoc())
mBlockedDoc(aEventNode->OwnerDoc())
{
if (mBlockedDoc) {
mBlockedDoc->BlockOnload();

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

@ -425,7 +425,7 @@ static nsIDocument* GetDocumentForReport(nsEvent* aEvent)
{
nsCOMPtr<nsINode> node = do_QueryInterface(aEvent->currentTarget);
if (node)
return node->GetOwnerDoc();
return node->OwnerDoc();
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aEvent->currentTarget);
if (!window)
@ -491,7 +491,7 @@ nsDOMEvent::PreventDefault()
node = do_QueryInterface(win->GetExtantDocument());
}
}
if (node && !nsContentUtils::IsChromeDoc(node->GetOwnerDoc())) {
if (node && !nsContentUtils::IsChromeDoc(node->OwnerDoc())) {
mEvent->flags |= NS_EVENT_FLAG_NO_DEFAULT_CALLED_IN_CONTENT;
}
}

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

@ -514,7 +514,7 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget,
}
NS_ENSURE_STATE(node);
nsIDocument* doc = node->GetOwnerDoc();
nsIDocument* doc = node->OwnerDoc();
if (!nsContentUtils::IsChromeDoc(doc)) {
nsPIDOMWindow* win = doc ? doc->GetInnerWindow() : nsnull;
// If we can't dispatch the event to chrome, do nothing.
@ -543,7 +543,7 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget,
if (target->GetContextForEventHandlers(&rv) ||
NS_FAILED(rv)) {
nsCOMPtr<nsINode> node = do_QueryInterface(target);
if (node && nsContentUtils::IsChromeDoc(node->GetOwnerDoc())) {
if (node && nsContentUtils::IsChromeDoc(node->OwnerDoc())) {
NS_WARNING("Fix the caller!");
} else {
NS_ERROR("This is unsafe! Fix the caller!");

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

@ -196,9 +196,7 @@ nsEventListenerManager::GetInnerWindowForTarget()
if (node) {
// XXX sXBL/XBL2 issue -- do we really want the owner here? What
// if that's the XBL document?
nsIDocument* document = node->GetOwnerDoc();
if (document)
return document->GetInnerWindow();
return node->OwnerDoc()->GetInnerWindow();
}
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(mTarget);
@ -467,9 +465,7 @@ nsEventListenerManager::AddScriptEventListener(nsIAtom *aName,
// Try to get context from doc
// XXX sXBL/XBL2 issue -- do we really want the owner here? What
// if that's the XBL document?
doc = node->GetOwnerDoc();
if (doc)
global = doc->GetScriptGlobalObject();
global = node->OwnerDoc()->GetScriptGlobalObject();
} else {
nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(mTarget));
if (win) {
@ -646,7 +642,7 @@ nsEventListenerManager::CompileEventHandlerInternal(nsListenerStruct *aListenerS
nsCAutoString url (NS_LITERAL_CSTRING("-moz-evil:lying-event-listener"));
nsCOMPtr<nsIDocument> doc;
if (content) {
doc = content->GetOwnerDoc();
doc = content->OwnerDoc();
} else {
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(mTarget);
if (win) {

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

@ -574,7 +574,7 @@ nsMouseWheelTransaction::OnFailToScrollTarget()
if (Preferences::GetBool("test.mousescroll", false)) {
// This event is used for automated tests, see bug 442774.
nsContentUtils::DispatchTrustedEvent(
sTargetFrame->GetContent()->GetOwnerDoc(),
sTargetFrame->GetContent()->OwnerDoc(),
sTargetFrame->GetContent(),
NS_LITERAL_STRING("MozMouseScrollFailed"),
true, true);
@ -602,7 +602,7 @@ nsMouseWheelTransaction::OnTimeout(nsITimer* aTimer, void* aClosure)
if (Preferences::GetBool("test.mousescroll", false)) {
// This event is used for automated tests, see bug 442774.
nsContentUtils::DispatchTrustedEvent(
frame->GetContent()->GetOwnerDoc(),
frame->GetContent()->OwnerDoc(),
frame->GetContent(),
NS_LITERAL_STRING("MozMouseScrollTransactionTimeout"),
true, true);
@ -891,7 +891,7 @@ nsEventStateManager::~nsEventStateManager()
}
}
if (sDragOverContent && sDragOverContent->GetOwnerDoc() == mDocument) {
if (sDragOverContent && sDragOverContent->OwnerDoc() == mDocument) {
sDragOverContent = nsnull;
}
@ -1431,7 +1431,7 @@ IsAccessKeyTarget(nsIContent* aContent, nsIFrame* aFrame, nsAString& aKey)
return false;
nsCOMPtr<nsIDOMXULDocument> xulDoc =
do_QueryInterface(aContent->GetOwnerDoc());
do_QueryInterface(aContent->OwnerDoc());
if (!xulDoc && !aContent->IsXUL())
return true;
@ -3856,7 +3856,7 @@ public:
: mESM(aESM), mEvent(aEvent), mType(aType)
{
nsPIDOMWindow* win =
aTarget ? aTarget->GetOwnerDoc()->GetInnerWindow() : nsnull;
aTarget ? aTarget->OwnerDoc()->GetInnerWindow() : nsnull;
if (win && win->HasMouseEnterLeaveEventListeners()) {
mRelatedTarget = aRelatedTarget ?
aRelatedTarget->FindFirstNonNativeAnonymous() : nsnull;
@ -4647,7 +4647,7 @@ nsEventStateManager::ContentRemoved(nsIDocument* aDocument, nsIContent* aContent
}
if (sDragOverContent &&
sDragOverContent->GetOwnerDoc() == aContent->GetOwnerDoc() &&
sDragOverContent->OwnerDoc() == aContent->OwnerDoc() &&
nsContentUtils::ContentIsDescendantOf(sDragOverContent, aContent)) {
sDragOverContent = nsnull;
}

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

@ -69,15 +69,13 @@ NS_IMETHODIMP nsPLDOMEvent::Run()
bool defaultActionEnabled; // This is not used because the caller is async
target->DispatchEvent(mEvent, &defaultActionEnabled);
} else {
nsIDocument* doc = mEventNode->GetOwnerDoc();
if (doc) {
if (mDispatchChromeOnly) {
nsContentUtils::DispatchChromeEvent(doc, mEventNode, mEventType,
mBubbles, false);
} else {
nsContentUtils::DispatchTrustedEvent(doc, mEventNode, mEventType,
mBubbles, false);
}
nsIDocument* doc = mEventNode->OwnerDoc();
if (mDispatchChromeOnly) {
nsContentUtils::DispatchChromeEvent(doc, mEventNode, mEventType,
mBubbles, false);
} else {
nsContentUtils::DispatchTrustedEvent(doc, mEventNode, mEventType,
mBubbles, false);
}
}

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

@ -868,7 +868,7 @@ GetSubmissionFromForm(nsGenericHTMLElement* aForm,
enctype == NS_FORM_ENCTYPE_TEXTPLAIN) {
*aFormSubmission = new nsFSTextPlain(charset, aOriginatingElement);
} else {
nsIDocument* doc = aForm->GetOwnerDoc();
nsIDocument* doc = aForm->OwnerDoc();
if (enctype == NS_FORM_ENCTYPE_MULTIPART ||
enctype == NS_FORM_ENCTYPE_TEXTPLAIN) {
nsAutoString enctypeStr;

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

@ -199,10 +199,7 @@ public:
return NS_ERROR_NULL_POINTER;
}
nsIDocument* document = mElement->GetOwnerDoc();
if (!document) {
return NS_OK;
}
nsIDocument* document = mElement->OwnerDoc();
nsPIDOMWindow* window = document->GetWindow();
if (!window) {
@ -227,7 +224,7 @@ public:
// If something is focused in the same document, ignore autofocus.
if (!fm->GetFocusedContent() ||
fm->GetFocusedContent()->GetOwnerDoc() != document) {
fm->GetFocusedContent()->OwnerDoc() != document) {
return mElement->Focus();
}
@ -677,10 +674,7 @@ nsGenericHTMLElement::GetInnerHTML(nsAString& aInnerHTML)
{
aInnerHTML.Truncate();
nsIDocument* doc = GetOwnerDoc();
if (!doc) {
return NS_OK; // We rely on the document for doing HTML conversion
}
nsIDocument* doc = OwnerDoc();
nsresult rv = NS_OK;
@ -748,8 +742,7 @@ nsGenericHTMLElement::FireMutationEventsForDirectParsing(nsIDocument* aDoc,
nsresult
nsGenericHTMLElement::SetInnerHTML(const nsAString& aInnerHTML)
{
nsIDocument* doc = GetOwnerDoc();
NS_ENSURE_STATE(doc);
nsIDocument* doc = OwnerDoc();
nsresult rv = NS_OK;
@ -834,8 +827,7 @@ nsGenericHTMLElement::InsertAdjacentHTML(const nsAString& aPosition,
destination = this;
}
nsIDocument* doc = GetOwnerDoc();
NS_ENSURE_STATE(doc);
nsIDocument* doc = OwnerDoc();
// Needed when insertAdjacentHTML is used in combination with contenteditable
mozAutoDocUpdate updateBatch(doc, UPDATE_CONTENT_MODEL, true);
@ -958,7 +950,7 @@ nsGenericHTMLElement::GetSpellcheck(bool* aSpellcheck)
}
// Is this a chrome element?
if (nsContentUtils::IsChromeDoc(GetOwnerDoc())) {
if (nsContentUtils::IsChromeDoc(OwnerDoc())) {
return NS_OK; // Not spellchecked by default
}
@ -1264,7 +1256,7 @@ nsGenericHTMLElement::GetEventListenerManagerForAttr(nsIAtom* aAttrName,
// normal.
// XXXbz sXBL/XBL2 issue: should we instead use GetCurrentDoc() here,
// override BindToTree for those classes and munge event listeners there?
nsIDocument *document = GetOwnerDoc();
nsIDocument *document = OwnerDoc();
// FIXME (https://bugzilla.mozilla.org/show_bug.cgi?id=431767)
// nsDocument::GetInnerWindow can return an outer window in some cases,
@ -1272,8 +1264,7 @@ nsGenericHTMLElement::GetEventListenerManagerForAttr(nsIAtom* aAttrName,
// bail if it does. See similar code in nsHTMLBodyElement and
// nsHTMLFramesetElement
*aDefer = false;
if (document &&
(win = document->GetInnerWindow()) && win->IsInnerWindow()) {
if ((win = document->GetInnerWindow()) && win->IsInnerWindow()) {
nsCOMPtr<nsIDOMEventTarget> piTarget(do_QueryInterface(win));
return piTarget->GetListenerManager(true);
@ -1378,12 +1369,7 @@ nsGenericHTMLElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
void
nsGenericHTMLElement::GetBaseTarget(nsAString& aBaseTarget) const
{
nsIDocument* ownerDoc = GetOwnerDoc();
if (ownerDoc) {
ownerDoc->GetBaseTarget(aBaseTarget);
} else {
aBaseTarget.Truncate();
}
OwnerDoc()->GetBaseTarget(aBaseTarget);
}
//----------------------------------------------------------------------
@ -2342,7 +2328,7 @@ nsGenericHTMLElement::GetURIAttr(nsIAtom* aAttr, nsIAtom* aBaseAttr, nsIURI** aU
nsCOMPtr<nsIURI> baseAttrURI;
nsresult rv =
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(baseAttrURI),
baseAttrValue, GetOwnerDoc(),
baseAttrValue, OwnerDoc(),
baseURI);
if (NS_FAILED(rv)) {
return true;
@ -2355,7 +2341,7 @@ nsGenericHTMLElement::GetURIAttr(nsIAtom* aAttr, nsIAtom* aBaseAttr, nsIURI** aU
// return true, and *aURI will be null.
nsContentUtils::NewURIWithDocumentCharset(aURI,
attr->GetStringValue(),
GetOwnerDoc(), baseURI);
OwnerDoc(), baseURI);
return true;
}
@ -2368,7 +2354,7 @@ nsGenericHTMLElement::GetURIListAttr(nsIAtom* aAttr, nsAString& aResult)
if (!GetAttr(kNameSpaceID_None, aAttr, value))
return NS_OK;
nsIDocument* doc = GetOwnerDoc();
nsIDocument* doc = OwnerDoc();
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
// Value contains relative URIs split on spaces (U+0020)
@ -2973,7 +2959,7 @@ nsGenericHTMLFormElement::AddFormIdObserver()
"we should be in a document!");
nsAutoString formId;
nsIDocument* doc = GetOwnerDoc();
nsIDocument* doc = OwnerDoc();
GetAttr(kNameSpaceID_None, nsGkAtoms::form, formId);
NS_ASSERTION(!formId.IsEmpty(),
"@form value should not be the empty string!");
@ -2986,7 +2972,7 @@ void
nsGenericHTMLFormElement::RemoveFormIdObserver()
{
/**
* We are using GetOwnerDoc() because we don't really care about having the
* We are using OwnerDoc() because we don't really care about having the
* 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
@ -2994,7 +2980,7 @@ nsGenericHTMLFormElement::RemoveFormIdObserver()
* complex for nothing.
*/
nsIDocument* doc = GetOwnerDoc();
nsIDocument* doc = OwnerDoc();
// At this point, we may not have a document anymore. In that case, we can't
// remove the observer. The document did that for us.
@ -3365,7 +3351,7 @@ nsGenericHTMLFrameElement::CopyInnerTo(nsGenericElement* aDest) const
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest);
NS_ENSURE_SUCCESS(rv, rv);
nsIDocument* doc = aDest->GetOwnerDoc();
nsIDocument* doc = aDest->OwnerDoc();
if (doc->IsStaticDocument() && mFrameLoader) {
nsGenericHTMLFrameElement* dest =
static_cast<nsGenericHTMLFrameElement*>(aDest);
@ -3426,8 +3412,7 @@ nsresult nsGenericHTMLElement::MozRequestFullScreen()
return NS_OK;
}
nsIDocument* doc = GetOwnerDoc();
NS_ENSURE_STATE(doc);
nsIDocument* doc = OwnerDoc();
nsCOMPtr<nsIDOMDocument> domDocument(do_QueryInterface(doc));
NS_ENSURE_STATE(domDocument);
bool fullScreenEnabled;

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

@ -204,7 +204,7 @@ nsHTMLAnchorElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
NS_ENSURE_SUCCESS(rv, rv);
// Prefetch links
if (aDocument && nsHTMLDNSPrefetch::IsAllowed(GetOwnerDoc())) {
if (aDocument && nsHTMLDNSPrefetch::IsAllowed(OwnerDoc())) {
nsHTMLDNSPrefetch::PrefetchLow(this);
}
return rv;

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

@ -439,7 +439,7 @@ nsHTMLBodyElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
nsGenericHTMLElement::WalkContentStyleRules(aRuleWalker);
if (!mContentStyleRule && IsInDoc()) {
// XXXbz should this use GetOwnerDoc() or GetCurrentDoc()?
// XXXbz should this use OwnerDoc() or GetCurrentDoc()?
// sXBL/XBL2 issue!
mContentStyleRule = new BodyRule(this);
NS_IF_ADDREF(mContentStyleRule);
@ -516,7 +516,7 @@ nsHTMLBodyElement::GetAssociatedEditor()
NS_IMETHODIMP nsHTMLBodyElement::GetOn##name_(JSContext *cx, \
jsval *vp) { \
/* XXXbz note to self: add tests for this! */ \
nsPIDOMWindow* win = GetOwnerDoc()->GetInnerWindow(); \
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
if (win && win->IsInnerWindow()) { \
nsCOMPtr<nsIInlineEventHandlers> ev = do_QueryInterface(win); \
return ev->GetOn##name_(cx, vp); \
@ -526,7 +526,7 @@ nsHTMLBodyElement::GetAssociatedEditor()
} \
NS_IMETHODIMP nsHTMLBodyElement::SetOn##name_(JSContext *cx, \
const jsval &v) { \
nsPIDOMWindow* win = GetOwnerDoc()->GetInnerWindow(); \
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
if (win && win->IsInnerWindow()) { \
nsCOMPtr<nsIInlineEventHandlers> ev = do_QueryInterface(win); \
return ev->SetOn##name_(cx, v); \
@ -536,7 +536,7 @@ nsHTMLBodyElement::GetAssociatedEditor()
#define WINDOW_EVENT(name_, id_, type_, struct_) \
NS_IMETHODIMP nsHTMLBodyElement::GetOn##name_(JSContext *cx, \
jsval *vp) { \
nsPIDOMWindow* win = GetOwnerDoc()->GetInnerWindow(); \
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
if (win && win->IsInnerWindow()) { \
return win->GetOn##name_(cx, vp); \
} \
@ -545,7 +545,7 @@ nsHTMLBodyElement::GetAssociatedEditor()
} \
NS_IMETHODIMP nsHTMLBodyElement::SetOn##name_(JSContext *cx, \
const jsval &v) { \
nsPIDOMWindow* win = GetOwnerDoc()->GetInnerWindow(); \
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
if (win && win->IsInnerWindow()) { \
return win->SetOn##name_(cx, v); \
} \

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

@ -156,7 +156,7 @@ nsHTMLCanvasElement::CopyInnerTo(nsGenericElement* aDest) const
{
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest);
NS_ENSURE_SUCCESS(rv, rv);
if (aDest->GetOwnerDoc()->IsStaticDocument()) {
if (aDest->OwnerDoc()->IsStaticDocument()) {
nsHTMLCanvasElement* dest = static_cast<nsHTMLCanvasElement*>(aDest);
nsCOMPtr<nsISupports> cxt;
dest->GetContext(NS_LITERAL_STRING("2d"), JSVAL_VOID, getter_AddRefs(cxt));

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

@ -292,7 +292,7 @@ nsHTMLDNSPrefetch::nsDeferrals::SubmitQueue()
while (mHead != mTail) {
nsCOMPtr<nsIContent> content = do_QueryReferent(mEntries[mTail].mElement);
if (content && content->GetOwnerDoc()) {
if (content) {
nsCOMPtr<Link> link = do_QueryInterface(content);
nsCOMPtr<nsIURI> hrefURI(link ? link->GetURI() : nsnull);
if (hrefURI)

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

@ -742,7 +742,7 @@ nsHTMLFormElement::DoSubmit(nsEvent* aEvent)
// XXXbz if the script global is that for an sXBL/XBL2 doc, it won't
// be a window...
nsPIDOMWindow *window = GetOwnerDoc()->GetWindow();
nsPIDOMWindow *window = OwnerDoc()->GetWindow();
if (window) {
mSubmitPopupState = window->GetPopupControlState();
@ -973,7 +973,7 @@ nsHTMLFormElement::NotifySubmitObservers(nsIURI* aActionURL,
// XXXbz what do the submit observers actually want? The window
// of the document this is shown in? Or something else?
// sXBL/XBL2 issue
nsCOMPtr<nsPIDOMWindow> window = GetOwnerDoc()->GetWindow();
nsCOMPtr<nsPIDOMWindow> window = OwnerDoc()->GetWindow();
bool loop = true;
while (NS_SUCCEEDED(theEnum->HasMoreElements(&loop)) && loop) {
@ -1464,7 +1464,7 @@ nsHTMLFormElement::GetActionURL(nsIURI** aActionURL,
}
// Get base URL
nsIDocument *document = GetOwnerDoc();
nsIDocument *document = OwnerDoc();
nsIURI *docURI = document->GetDocumentURI();
NS_ENSURE_TRUE(docURI, NS_ERROR_UNEXPECTED);
@ -1635,7 +1635,7 @@ nsHTMLFormElement::CheckFormValidity(nsIMutableArray* aInvalidElements) const
!cvElmt->IsValid()) {
ret = false;
bool defaultAction = true;
nsContentUtils::DispatchTrustedEvent(sortedControls[i]->GetOwnerDoc(),
nsContentUtils::DispatchTrustedEvent(sortedControls[i]->OwnerDoc(),
static_cast<nsIContent*>(sortedControls[i]),
NS_LITERAL_STRING("invalid"),
false, true, &defaultAction);

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

@ -258,7 +258,7 @@ nsHTMLFrameSetElement::ParseRowCol(const nsAString & aValue,
}
// Pre-grab the compat mode; we may need it later in the loop.
bool isInQuirks = InNavQuirksMode(GetOwnerDoc());
bool isInQuirks = InNavQuirksMode(OwnerDoc());
// Parse each comma separated token
@ -360,7 +360,7 @@ nsHTMLFrameSetElement::ParseRowCol(const nsAString & aValue,
NS_IMETHODIMP nsHTMLFrameSetElement::GetOn##name_(JSContext *cx, \
jsval *vp) { \
/* XXXbz note to self: add tests for this! */ \
nsPIDOMWindow* win = GetOwnerDoc()->GetInnerWindow(); \
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
if (win && win->IsInnerWindow()) { \
nsCOMPtr<nsIInlineEventHandlers> ev = do_QueryInterface(win); \
return ev->GetOn##name_(cx, vp); \
@ -370,7 +370,7 @@ nsHTMLFrameSetElement::ParseRowCol(const nsAString & aValue,
} \
NS_IMETHODIMP nsHTMLFrameSetElement::SetOn##name_(JSContext *cx, \
const jsval &v) { \
nsPIDOMWindow* win = GetOwnerDoc()->GetInnerWindow(); \
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
if (win && win->IsInnerWindow()) { \
nsCOMPtr<nsIInlineEventHandlers> ev = do_QueryInterface(win); \
return ev->SetOn##name_(cx, v); \
@ -381,7 +381,7 @@ nsHTMLFrameSetElement::ParseRowCol(const nsAString & aValue,
NS_IMETHODIMP nsHTMLFrameSetElement::GetOn##name_(JSContext *cx, \
jsval *vp) { \
/* XXXbz note to self: add tests for this! */ \
nsPIDOMWindow* win = GetOwnerDoc()->GetInnerWindow(); \
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
if (win && win->IsInnerWindow()) { \
return win->GetOn##name_(cx, vp); \
} \
@ -390,7 +390,7 @@ nsHTMLFrameSetElement::ParseRowCol(const nsAString & aValue,
} \
NS_IMETHODIMP nsHTMLFrameSetElement::SetOn##name_(JSContext *cx, \
const jsval &v) { \
nsPIDOMWindow* win = GetOwnerDoc()->GetInnerWindow(); \
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
if (win && win->IsInnerWindow()) { \
return win->SetOn##name_(cx, v); \
} \

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

@ -445,9 +445,9 @@ nsHTMLImageElement::IsHTMLFocusable(bool aWithMouse,
nsAutoString usemap;
GetUseMap(usemap);
// XXXbz which document should this be using? sXBL/XBL2 issue! I
// think that GetOwnerDoc() is right, since we don't want to
// think that OwnerDoc() is right, since we don't want to
// assume stuff about the document we're bound to.
if (GetOwnerDoc() && GetOwnerDoc()->FindImageMap(usemap)) {
if (OwnerDoc()->FindImageMap(usemap)) {
if (aTabIndex) {
// Use tab index on individual map areas
*aTabIndex = (sTabFocusModel & eTabFocus_linksMask)? 0 : -1;
@ -650,7 +650,7 @@ nsHTMLImageElement::GetNaturalWidth(PRUint32* aNaturalWidth)
nsresult
nsHTMLImageElement::CopyInnerTo(nsGenericElement* aDest) const
{
if (aDest->GetOwnerDoc()->IsStaticDocument()) {
if (aDest->OwnerDoc()->IsStaticDocument()) {
CreateStaticImageClone(static_cast<nsHTMLImageElement*>(aDest));
}
return nsGenericHTMLElement::CopyInnerTo(aDest);

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

@ -241,11 +241,9 @@ public:
AsyncClickHandler(nsHTMLInputElement* aInput)
: mInput(aInput) {
nsIDocument* doc = aInput->GetOwnerDoc();
if (doc) {
nsPIDOMWindow* win = doc->GetWindow();
if (win)
mPopupControlState = win->GetPopupControlState();
nsPIDOMWindow* win = aInput->OwnerDoc()->GetWindow();
if (win) {
mPopupControlState = win->GetPopupControlState();
}
};
@ -262,9 +260,7 @@ AsyncClickHandler::Run()
nsresult rv;
// Get parent nsPIDOMWindow object.
nsCOMPtr<nsIDocument> doc = mInput->GetOwnerDoc();
if (!doc)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDocument> doc = mInput->OwnerDoc();
nsPIDOMWindow* win = doc->GetWindow();
if (!win) {
@ -432,7 +428,7 @@ AsyncClickHandler::Run()
// event because it will think this is done by a script.
// So, we can safely send one by ourself.
mInput->SetFiles(newFiles, true);
nsContentUtils::DispatchTrustedEvent(mInput->GetOwnerDoc(),
nsContentUtils::DispatchTrustedEvent(mInput->OwnerDoc(),
static_cast<nsIDOMHTMLInputElement*>(mInput.get()),
NS_LITERAL_STRING("change"), true,
false);
@ -690,7 +686,7 @@ nsHTMLInputElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
}
break;
case NS_FORM_INPUT_FILE:
if (it->GetOwnerDoc()->IsStaticDocument()) {
if (it->OwnerDoc()->IsStaticDocument()) {
// We're going to be used in print preview. Since the doc is static
// we can just grab the pretty string and use it as wallpaper
GetDisplayFileName(it->mStaticDocFileList);
@ -708,7 +704,7 @@ nsHTMLInputElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
}
break;
case NS_FORM_INPUT_IMAGE:
if (it->GetOwnerDoc()->IsStaticDocument()) {
if (it->OwnerDoc()->IsStaticDocument()) {
CreateStaticImageClone(it);
}
break;
@ -1124,7 +1120,7 @@ nsHTMLInputElement::SetUserInput(const nsAString& aValue)
SetValueInternal(aValue, true, true);
}
return nsContentUtils::DispatchTrustedEvent(GetOwnerDoc(),
return nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
static_cast<nsIDOMHTMLInputElement*>(this),
NS_LITERAL_STRING("input"), true,
true);
@ -1241,7 +1237,7 @@ nsHTMLInputElement::SetPlaceholderClass(bool aVisible, bool aNotify)
void
nsHTMLInputElement::GetDisplayFileName(nsAString& aValue) const
{
if (GetOwnerDoc()->IsStaticDocument()) {
if (OwnerDoc()->IsStaticDocument()) {
aValue = mStaticDocFileList;
return;
}
@ -2042,7 +2038,7 @@ nsHTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
DoSetChecked(originalCheckedValue, true, true);
}
} else {
nsContentUtils::DispatchTrustedEvent(GetOwnerDoc(),
nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
static_cast<nsIDOMHTMLInputElement*>(this),
NS_LITERAL_STRING("change"), true,
false);
@ -3737,10 +3733,7 @@ nsHTMLInputElement::HasPatternMismatch() const
return false;
}
nsIDocument* doc = GetOwnerDoc();
if (!doc) {
return false;
}
nsIDocument* doc = OwnerDoc();
return !nsContentUtils::IsPatternMatching(value, pattern, doc);
}

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

@ -225,14 +225,14 @@ nsHTMLLinkElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
NS_IMETHODIMP
nsHTMLLinkElement::LinkAdded()
{
CreateAndDispatchEvent(GetOwnerDoc(), NS_LITERAL_STRING("DOMLinkAdded"));
CreateAndDispatchEvent(OwnerDoc(), NS_LITERAL_STRING("DOMLinkAdded"));
return NS_OK;
}
NS_IMETHODIMP
nsHTMLLinkElement::LinkRemoved()
{
CreateAndDispatchEvent(GetOwnerDoc(), NS_LITERAL_STRING("DOMLinkRemoved"));
CreateAndDispatchEvent(OwnerDoc(), NS_LITERAL_STRING("DOMLinkRemoved"));
return NS_OK;
}

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

@ -226,7 +226,7 @@ public:
if (IsCancelled())
return NS_OK;
LOG_EVENT(PR_LOG_DEBUG, ("%p Dispatching simple event source error", mElement.get()));
return nsContentUtils::DispatchTrustedEvent(mElement->GetOwnerDoc(),
return nsContentUtils::DispatchTrustedEvent(mElement->OwnerDoc(),
mSource,
NS_LITERAL_STRING("error"),
false,
@ -1910,10 +1910,7 @@ nsresult nsHTMLMediaElement::NewURIFromString(const nsAutoString& aURISpec, nsIU
*aURI = nsnull;
nsCOMPtr<nsIDocument> doc = GetOwnerDoc();
if (!doc) {
return NS_ERROR_DOM_INVALID_STATE_ERR;
}
nsCOMPtr<nsIDocument> doc = OwnerDoc();
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
nsresult rv = nsContentUtils::NewURIWithDocumentCharset(aURI,
@ -2254,7 +2251,7 @@ ImageContainer* nsHTMLMediaElement::GetImageContainer()
return nsnull;
nsRefPtr<LayerManager> manager =
nsContentUtils::PersistentLayerManagerForDocument(GetOwnerDoc());
nsContentUtils::PersistentLayerManagerForDocument(OwnerDoc());
if (!manager)
return nsnull;
@ -2275,7 +2272,7 @@ nsresult nsHTMLMediaElement::DispatchAudioAvailableEvent(float* aFrameBuffer,
// which frees the memory when it's destroyed.
nsAutoArrayPtr<float> frameBuffer(aFrameBuffer);
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(GetOwnerDoc());
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(OwnerDoc());
nsCOMPtr<nsIDOMEventTarget> target(do_QueryObject(this));
NS_ENSURE_TRUE(domDoc && target, NS_ERROR_INVALID_ARG);
@ -2306,7 +2303,7 @@ nsresult nsHTMLMediaElement::DispatchEvent(const nsAString& aName)
return NS_OK;
}
return nsContentUtils::DispatchTrustedEvent(GetOwnerDoc(),
return nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
static_cast<nsIContent*>(this),
aName,
false,
@ -2373,11 +2370,11 @@ void nsHTMLMediaElement::UpdateMediaSize(nsIntSize size)
void nsHTMLMediaElement::NotifyOwnerDocumentActivityChanged()
{
nsIDocument* ownerDoc = GetOwnerDoc();
nsIDocument* ownerDoc = OwnerDoc();
// Don't pause if we have no ownerDoc. Something native must have created
// us and be expecting us to work without a document.
bool pauseForInactiveDocument =
ownerDoc && (!ownerDoc->IsActive() || !ownerDoc->IsVisible());
!ownerDoc->IsActive() || !ownerDoc->IsVisible();
if (pauseForInactiveDocument != mPausedForInactiveDocument) {
mPausedForInactiveDocument = pauseForInactiveDocument;
@ -2405,12 +2402,12 @@ void nsHTMLMediaElement::AddRemoveSelfReference()
// potential listener for every event. We would also have to keep the
// element alive if it was playing and producing audio output --- right now
// that's covered by the !mPaused check.
nsIDocument* ownerDoc = GetOwnerDoc();
nsIDocument* ownerDoc = OwnerDoc();
// See the comment at the top of this file for the explanation of this
// boolean expression.
bool needSelfReference = !mShuttingDown &&
(!ownerDoc || ownerDoc->IsActive()) &&
ownerDoc->IsActive() &&
(mDelayingLoadEvent ||
(!mPaused && mDecoder && !mDecoder->IsEnded()) ||
(mDecoder && mDecoder->IsSeeking()) ||
@ -2544,7 +2541,7 @@ void nsHTMLMediaElement::ChangeDelayLoadStatus(bool aDelay) {
mDelayingLoadEvent = aDelay;
if (aDelay) {
mLoadBlockedDoc = GetOwnerDoc();
mLoadBlockedDoc = OwnerDoc();
mLoadBlockedDoc->BlockOnload();
LOG(PR_LOG_DEBUG, ("%p ChangeDelayLoadStatus(%d) doc=0x%p", this, aDelay, mLoadBlockedDoc.get()));
} else {
@ -2565,8 +2562,7 @@ void nsHTMLMediaElement::ChangeDelayLoadStatus(bool aDelay) {
already_AddRefed<nsILoadGroup> nsHTMLMediaElement::GetDocumentLoadGroup()
{
nsIDocument* doc = GetOwnerDoc();
return doc ? doc->GetDocumentLoadGroup() : nsnull;
return OwnerDoc()->GetDocumentLoadGroup();
}
nsresult
@ -2574,7 +2570,7 @@ nsHTMLMediaElement::CopyInnerTo(nsGenericElement* aDest) const
{
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest);
NS_ENSURE_SUCCESS(rv, rv);
if (aDest->GetOwnerDoc()->IsStaticDocument()) {
if (aDest->OwnerDoc()->IsStaticDocument()) {
nsHTMLMediaElement* dest = static_cast<nsHTMLMediaElement*>(aDest);
if (mPrintSurface) {
dest->mPrintSurface = mPrintSurface;
@ -2627,10 +2623,7 @@ void nsHTMLMediaElement::SetRequestHeaders(nsIHttpChannel* aChannel)
NS_LITERAL_CSTRING(""), false);
// Set the Referer header
nsIDocument* doc = GetOwnerDoc();
if (doc) {
aChannel->SetReferrer(doc->GetDocumentURI());
}
aChannel->SetReferrer(OwnerDoc()->GetDocumentURI());
}
void nsHTMLMediaElement::FireTimeUpdate(bool aPeriodic)

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

@ -207,10 +207,7 @@ nsHTMLMenuElement::CanLoadIcon(nsIContent* aContent, const nsAString& aIcon)
return false;
}
nsIDocument* doc = aContent->GetOwnerDoc();
if (!doc) {
return false;
}
nsIDocument* doc = aContent->OwnerDoc();
nsCOMPtr<nsIURI> baseURI = aContent->GetBaseURI();
nsCOMPtr<nsIURI> uri;

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

@ -438,7 +438,7 @@ nsHTMLObjectElement::GetContentDocument(nsIDOMDocument **aContentDocument)
}
// XXXbz should this use GetCurrentDoc()? sXBL/XBL2 issue!
nsIDocument *sub_doc = GetOwnerDoc()->GetSubDocumentFor(this);
nsIDocument *sub_doc = OwnerDoc()->GetSubDocumentFor(this);
if (!sub_doc) {
return NS_OK;
}
@ -547,7 +547,7 @@ nsHTMLObjectElement::CopyInnerTo(nsGenericElement* aDest) const
nsresult rv = nsGenericHTMLFormElement::CopyInnerTo(aDest);
NS_ENSURE_SUCCESS(rv, rv);
if (aDest->GetOwnerDoc()->IsStaticDocument()) {
if (aDest->OwnerDoc()->IsStaticDocument()) {
CreateStaticClone(static_cast<nsHTMLObjectElement*>(aDest));
}

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

@ -456,7 +456,7 @@ nsHTMLOptionElement::CopyInnerTo(nsGenericElement* aDest) const
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest);
NS_ENSURE_SUCCESS(rv, rv);
if (aDest->GetOwnerDoc()->IsStaticDocument()) {
if (aDest->OwnerDoc()->IsStaticDocument()) {
static_cast<nsHTMLOptionElement*>(aDest)->SetSelected(Selected());
}
return NS_OK;

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

@ -234,11 +234,10 @@ nsHTMLSharedElement::GetHref(nsAString& aValue)
GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
nsCOMPtr<nsIURI> uri;
nsIDocument* doc = GetOwnerDoc();
if (doc) {
nsContentUtils::NewURIWithDocumentCharset(
getter_AddRefs(uri), href, doc, doc->GetDocumentURI());
}
nsIDocument* doc = OwnerDoc();
nsContentUtils::NewURIWithDocumentCharset(
getter_AddRefs(uri), href, doc, doc->GetDocumentURI());
if (!uri) {
aValue = href;
return NS_OK;

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

@ -378,7 +378,7 @@ nsHTMLSharedObjectElement::GetSVGDocument(nsIDOMDocument **aResult)
}
// XXXbz should this use GetCurrentDoc()? sXBL/XBL2 issue!
nsIDocument *sub_doc = GetOwnerDoc()->GetSubDocumentFor(this);
nsIDocument *sub_doc = OwnerDoc()->GetSubDocumentFor(this);
if (!sub_doc) {
return NS_OK;
}
@ -504,7 +504,7 @@ nsHTMLSharedObjectElement::CopyInnerTo(nsGenericElement* aDest) const
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest);
NS_ENSURE_SUCCESS(rv, rv);
if (aDest->GetOwnerDoc()->IsStaticDocument()) {
if (aDest->OwnerDoc()->IsStaticDocument()) {
CreateStaticClone(static_cast<nsHTMLSharedObjectElement*>(aDest));
}

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

@ -290,7 +290,7 @@ nsHTMLTableCellElement::ParseAttribute(PRInt32 aNamespaceID,
// reset large colspan values as IE and opera do
// quirks mode does not honor the special html 4 value of 0
if (val > MAX_COLSPAN || val < 0 ||
(0 == val && InNavQuirksMode(GetOwnerDoc()))) {
(0 == val && InNavQuirksMode(OwnerDoc()))) {
aResult.SetTo(1);
}
}
@ -301,7 +301,7 @@ nsHTMLTableCellElement::ParseAttribute(PRInt32 aNamespaceID,
if (res) {
PRInt32 val = aResult.GetIntegerValue();
// quirks mode does not honor the special html 4 value of 0
if (val < 0 || (0 == val && InNavQuirksMode(GetOwnerDoc()))) {
if (val < 0 || (0 == val && InNavQuirksMode(OwnerDoc()))) {
aResult.SetTo(1);
}
}

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

@ -1290,7 +1290,7 @@ nsHTMLTextAreaElement::CopyInnerTo(nsGenericElement* aDest) const
nsresult rv = nsGenericHTMLFormElement::CopyInnerTo(aDest);
NS_ENSURE_SUCCESS(rv, rv);
if (aDest->GetOwnerDoc()->IsStaticDocument()) {
if (aDest->OwnerDoc()->IsStaticDocument()) {
nsAutoString value;
const_cast<nsHTMLTextAreaElement*>(this)->GetValue(value);
static_cast<nsHTMLTextAreaElement*>(aDest)->SetValue(value);

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

@ -131,7 +131,7 @@ nsIConstraintValidation::CheckValidity(bool* aValidity)
nsCOMPtr<nsIContent> content = do_QueryInterface(this);
NS_ASSERTION(content, "This class should be inherited by HTML elements only!");
return nsContentUtils::DispatchTrustedEvent(content->GetOwnerDoc(), content,
return nsContentUtils::DispatchTrustedEvent(content->OwnerDoc(), content,
NS_LITERAL_STRING("invalid"),
false, true);
}

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

@ -2533,7 +2533,7 @@ public:
}
NS_IMETHOD Run() {
if (mElement && mElement->GetOwnerDoc() == mDoc) {
if (mElement && mElement->OwnerDoc() == mDoc) {
mDoc->DeferredContentEditableCountChange(mElement);
}
return NS_OK;

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

@ -581,7 +581,7 @@ nsMathMLElement::IsLink(nsIURI** aURI) const
nsAutoString hrefStr;
href->ToString(hrefStr);
nsContentUtils::NewURIWithDocumentCharset(aURI, hrefStr,
GetOwnerDoc(), baseURI);
OwnerDoc(), baseURI);
// must promise out param is non-null if we return true
return !!*aURI;
}
@ -612,10 +612,7 @@ nsMathMLElement::GetLinkTarget(nsAString& aTarget)
case 1:
return;
}
nsIDocument* ownerDoc = GetOwnerDoc();
if (ownerDoc) {
ownerDoc->GetBaseTarget(aTarget);
}
OwnerDoc()->GetBaseTarget(aTarget);
}
}

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

@ -255,7 +255,7 @@ nsSVGAElement::IsLink(nsIURI** aURI) const
nsAutoString str;
mStringAttributes[HREF].GetAnimValue(str, this);
nsContentUtils::NewURIWithDocumentCharset(aURI, str,
GetOwnerDoc(), baseURI);
OwnerDoc(), baseURI);
// must promise out param is non-null if we return true
return !!*aURI;
}
@ -281,7 +281,7 @@ nsSVGAElement::GetLinkTarget(nsAString& aTarget)
case 1:
return;
}
nsIDocument* ownerDoc = GetOwnerDoc();
nsIDocument* ownerDoc = OwnerDoc();
if (ownerDoc) {
ownerDoc->GetBaseTarget(aTarget);
}

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

@ -123,7 +123,7 @@ nsSVGAnimateTransformElement::ParseAttribute(PRInt32 aNamespaceID,
atom != nsGkAtoms::rotate &&
atom != nsGkAtoms::skewX &&
atom != nsGkAtoms::skewY) {
ReportAttributeParseFailure(GetOwnerDoc(), aAttribute, aValue);
ReportAttributeParseFailure(OwnerDoc(), aAttribute, aValue);
}
return true;
}

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

@ -310,12 +310,9 @@ nsSVGAnimationElement::BindToTree(nsIDocument* aDocument,
void
nsSVGAnimationElement::UnbindFromTree(bool aDeep, bool aNullParent)
{
nsIDocument *doc = GetOwnerDoc();
if (doc) {
nsSMILAnimationController *controller = doc->GetAnimationController();
if (controller) {
controller->UnregisterAnimationElement(this);
}
nsSMILAnimationController *controller = OwnerDoc()->GetAnimationController();
if (controller) {
controller->UnregisterAnimationElement(this);
}
mHrefTarget.Unlink();
@ -357,7 +354,7 @@ nsSVGAnimationElement::ParseAttribute(PRInt32 aNamespaceID,
if (foundMatch) {
AnimationNeedsResample();
if (NS_FAILED(rv)) {
ReportAttributeParseFailure(GetOwnerDoc(), aAttribute, aValue);
ReportAttributeParseFailure(OwnerDoc(), aAttribute, aValue);
return false;
}
return true;
@ -500,7 +497,7 @@ nsSVGAnimationElement::UpdateHrefTarget(nsIContent* aNodeForContext,
nsCOMPtr<nsIURI> targetURI;
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI),
aHrefStr, GetOwnerDoc(), baseURI);
aHrefStr, OwnerDoc(), baseURI);
mHrefTarget.Reset(aNodeForContext, targetURI);
AnimationTargetChanged();
}

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

@ -534,7 +534,7 @@ nsSVGElement::ParseAttribute(PRInt32 aNamespaceID,
if (foundMatch) {
if (NS_FAILED(rv)) {
ReportAttributeParseFailure(GetOwnerDoc(), aAttribute, aValue);
ReportAttributeParseFailure(OwnerDoc(), aAttribute, aValue);
return false;
}
aResult.SetTo(aValue);
@ -793,30 +793,27 @@ nsSVGElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
// whether this is a "no-animation restyle". (This should match the check
// in nsHTMLCSSStyleSheet::RulesMatching(), where we determine whether to
// apply the SMILOverrideStyle.)
nsIDocument* doc = GetOwnerDoc();
NS_ASSERTION(doc, "SVG element without doc");
if (doc) {
nsIPresShell* shell = doc->GetShell();
nsPresContext* context = shell ? shell->GetPresContext() : nsnull;
if (context && context->IsProcessingRestyles() &&
!context->IsProcessingAnimationStyleChange()) {
// Any style changes right now could trigger CSS Transitions. We don't
// want that to happen from SMIL-animated value of mapped attrs, so
// ignore animated value for now, and request an animation restyle to
// get our animated value noticed.
shell->RestyleForAnimation(this, eRestyle_Self);
} else {
// Ok, this is an animation restyle -- go ahead and update/walk the
// animated content style rule.
css::StyleRule* animContentStyleRule = GetAnimatedContentStyleRule();
if (!animContentStyleRule) {
UpdateAnimatedContentStyleRule();
animContentStyleRule = GetAnimatedContentStyleRule();
}
if (animContentStyleRule) {
animContentStyleRule->RuleMatched();
aRuleWalker->Forward(animContentStyleRule);
}
nsIDocument* doc = OwnerDoc();
nsIPresShell* shell = doc->GetShell();
nsPresContext* context = shell ? shell->GetPresContext() : nsnull;
if (context && context->IsProcessingRestyles() &&
!context->IsProcessingAnimationStyleChange()) {
// Any style changes right now could trigger CSS Transitions. We don't
// want that to happen from SMIL-animated value of mapped attrs, so
// ignore animated value for now, and request an animation restyle to
// get our animated value noticed.
shell->RestyleForAnimation(this, eRestyle_Self);
} else {
// Ok, this is an animation restyle -- go ahead and update/walk the
// animated content style rule.
css::StyleRule* animContentStyleRule = GetAnimatedContentStyleRule();
if (!animContentStyleRule) {
UpdateAnimatedContentStyleRule();
animContentStyleRule = GetAnimatedContentStyleRule();
}
if (animContentStyleRule) {
animContentStyleRule->RuleMatched();
aRuleWalker->Forward(animContentStyleRule);
}
}
#endif // MOZ_SMIL
@ -1110,12 +1107,7 @@ nsSVGElement::UpdateContentStyleRule()
return;
}
nsIDocument* doc = GetOwnerDoc();
if (!doc) {
NS_ERROR("SVG element without owner document");
return;
}
nsIDocument* doc = OwnerDoc();
MappedAttrParser mappedAttrParser(doc->CSSLoader(), doc->GetDocumentURI(),
GetBaseURI(), NodePrincipal());
@ -1174,7 +1166,7 @@ nsSVGElement::UpdateAnimatedContentStyleRule()
NS_ABORT_IF_FALSE(!GetAnimatedContentStyleRule(),
"Animated content style rule already set");
nsIDocument* doc = GetOwnerDoc();
nsIDocument* doc = OwnerDoc();
if (!doc) {
NS_ERROR("SVG element without owner document");
return;

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

@ -5437,15 +5437,13 @@ nsSVGFEImageElement::LoadSVGImage(bool aForce, bool aNotify)
NS_MakeAbsoluteURI(href, href, baseURI);
// Make sure we don't get in a recursive death-spiral
nsIDocument* doc = GetOwnerDoc();
if (doc) {
nsCOMPtr<nsIURI> hrefAsURI;
if (NS_SUCCEEDED(StringToURI(href, doc, getter_AddRefs(hrefAsURI)))) {
bool isEqual;
if (NS_SUCCEEDED(hrefAsURI->Equals(baseURI, &isEqual)) && isEqual) {
// Image URI matches our URI exactly! Bail out.
return NS_OK;
}
nsIDocument* doc = OwnerDoc();
nsCOMPtr<nsIURI> hrefAsURI;
if (NS_SUCCEEDED(StringToURI(href, doc, getter_AddRefs(hrefAsURI)))) {
bool isEqual;
if (NS_SUCCEEDED(hrefAsURI->Equals(baseURI, &isEqual)) && isEqual) {
// Image URI matches our URI exactly! Bail out.
return NS_OK;
}
}

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

@ -295,7 +295,7 @@ nsSVGImageElement::DidAnimateString(PRUint8 aAttrEnum)
nsresult
nsSVGImageElement::CopyInnerTo(nsGenericElement* aDest) const
{
if (aDest->GetOwnerDoc()->IsStaticDocument()) {
if (aDest->OwnerDoc()->IsStaticDocument()) {
CreateStaticImageClone(static_cast<nsSVGImageElement*>(aDest));
}
return nsSVGImageElementBase::CopyInnerTo(aDest);

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

@ -245,7 +245,7 @@ nsSVGMpathElement::UpdateHrefTarget(nsIContent* aParent,
nsCOMPtr<nsIURI> targetURI;
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI),
aHrefStr, GetOwnerDoc(), baseURI);
aHrefStr, OwnerDoc(), baseURI);
// Stop observing old target (if any)
if (mHrefTarget.get()) {

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

@ -248,7 +248,7 @@ protected:
bool IsRoot() const {
NS_ASSERTION((IsInDoc() && !GetParent()) ==
(GetOwnerDoc() && (GetOwnerDoc()->GetRootElement() == this)),
(OwnerDoc() && (OwnerDoc()->GetRootElement() == this)),
"Can't determine if we're root");
return IsInDoc() && !GetParent();
}

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

@ -143,13 +143,9 @@ nsSVGStylableElement::DidAnimateClass()
}
mClassAnimAttr->ParseAtomArray(src);
nsIDocument* doc = GetOwnerDoc();
NS_ASSERTION(doc, "If we're animating we should have an owner");
if (doc) {
nsIPresShell* shell = doc->GetShell();
if (shell) {
shell->RestyleForAnimation(this, eRestyle_Self);
}
nsIPresShell* shell = OwnerDoc()->GetShell();
if (shell) {
shell->RestyleForAnimation(this, eRestyle_Self);
}
}

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

@ -318,8 +318,8 @@ nsSVGUseElement::CreateAnonymousContent()
nsCOMPtr<nsIDOMNode> newnode;
nsCOMArray<nsINode> unused;
nsNodeInfoManager* nodeInfoManager =
targetContent->GetOwnerDoc() == GetOwnerDoc() ?
nsnull : GetOwnerDoc()->NodeInfoManager();
targetContent->OwnerDoc() == OwnerDoc() ?
nsnull : OwnerDoc()->NodeInfoManager();
nsNodeUtils::Clone(targetContent, true, nodeInfoManager, unused,
getter_AddRefs(newnode));

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

@ -932,8 +932,7 @@ nsBindingManager::RemoveLayeredBinding(nsIContent* aContent, nsIURI* aURL)
// XXXbz should that be ownerdoc? Wouldn't we need a ref to the
// currentdoc too? What's the one that should be passed to
// ChangeDocument?
nsCOMPtr<nsIDocument> doc = aContent->GetOwnerDoc();
NS_ASSERTION(doc, "No owner document?");
nsCOMPtr<nsIDocument> doc = aContent->OwnerDoc();
// Finally remove the binding...
// XXXbz this doesn't remove the implementation! Should fix! Until
@ -1251,9 +1250,7 @@ nsBindingManager::GetBindingImplementation(nsIContent* aContent, REFNSIID aIID,
// We have never made a wrapper for this implementation.
// Create an XPC wrapper for the script object and hand it back.
nsIDocument* doc = aContent->GetOwnerDoc();
if (!doc)
return NS_NOINTERFACE;
nsIDocument* doc = aContent->OwnerDoc();
nsIScriptGlobalObject *global = doc->GetScriptGlobalObject();
if (!global)

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше