Merge the last PGO-green inbound changeset to m-c.

This commit is contained in:
Ryan VanderMeulen 2012-10-19 21:43:03 -04:00
Родитель 7ce9e0fcc9 87844c69b0
Коммит 7ae7108be8
333 изменённых файлов: 3416 добавлений и 2339 удалений

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

@ -684,7 +684,7 @@ logging::Node(const char* aDescr, nsINode* aNode)
return;
}
nsINode* parentNode = aNode->GetNodeParent();
nsINode* parentNode = aNode->GetParentNode();
int32_t idxInParent = parentNode ? parentNode->IndexOf(aNode) : - 1;
if (aNode->IsNodeOfType(nsINode::eTEXT)) {

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

@ -424,8 +424,8 @@ NotificationController::CoalesceEvents()
// Coalesce events by sibling targets (this is a case for reorder
// events).
if (thisEvent->mNode->GetNodeParent() ==
tailEvent->mNode->GetNodeParent()) {
if (thisEvent->mNode->GetParentNode() ==
tailEvent->mNode->GetParentNode()) {
tailEvent->mEventRule = thisEvent->mEventRule;
return;
}
@ -521,7 +521,7 @@ NotificationController::ApplyToSiblings(uint32_t aStart, uint32_t aEnd,
AccEvent* accEvent = mEvents[index];
if (accEvent->mEventType == aEventType &&
accEvent->mEventRule != AccEvent::eDoNotEmit && accEvent->mNode &&
accEvent->mNode->GetNodeParent() == aNode->GetNodeParent()) {
accEvent->mNode->GetParentNode() == aNode->GetParentNode()) {
accEvent->mEventRule = aEventRule;
}
}
@ -705,7 +705,7 @@ NotificationController::TextEnumerator(nsCOMPtrHashKey<nsIContent>* aEntry,
// If the text node is not in tree or doesn't have frame then this case should
// have been handled already by content removal notifications.
nsINode* containerNode = textNode->GetNodeParent();
nsINode* containerNode = textNode->GetParentNode();
if (!containerNode) {
NS_ASSERTION(!textAcc,
"Text node was removed but accessible is kept alive!");

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

@ -381,8 +381,9 @@ nsAccUtils::GetScreenCoordsForParent(nsAccessNode *aAccessNode)
if (!parentFrame)
return nsIntPoint(0, 0);
nsIntRect parentRect = parentFrame->GetScreenRectExternal();
return nsIntPoint(parentRect.x, parentRect.y);
nsRect rect = parentFrame->GetScreenRectInAppUnits();
return nsPoint(rect.x, rect.y).
ToNearestPixels(parentFrame->PresContext()->AppUnitsPerDevPixel());
}
uint8_t

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

@ -9,6 +9,8 @@
#include "nsAccessNode.h"
#include "nsIBaseWindow.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMHTMLDocument.h"
@ -248,7 +250,7 @@ nsCoreUtils::IsAncestorOf(nsINode *aPossibleAncestorNode,
NS_ENSURE_TRUE(aPossibleAncestorNode && aPossibleDescendantNode, false);
nsINode *parentNode = aPossibleDescendantNode;
while ((parentNode = parentNode->GetNodeParent()) &&
while ((parentNode = parentNode->GetParentNode()) &&
parentNode != aRootNode) {
if (parentNode == aPossibleAncestorNode)
return true;
@ -303,19 +305,14 @@ nsCoreUtils::ScrollFrameToPoint(nsIFrame *aScrollableFrame,
nsIFrame *aFrame,
const nsIntPoint& aPoint)
{
nsIScrollableFrame *scrollableFrame = do_QueryFrame(aScrollableFrame);
nsIScrollableFrame* scrollableFrame = do_QueryFrame(aScrollableFrame);
if (!scrollableFrame)
return;
nsPresContext *presContext = aFrame->PresContext();
nsIntRect frameRect = aFrame->GetScreenRectExternal();
int32_t devDeltaX = aPoint.x - frameRect.x;
int32_t devDeltaY = aPoint.y - frameRect.y;
nsPoint deltaPoint;
deltaPoint.x = presContext->DevPixelsToAppUnits(devDeltaX);
deltaPoint.y = presContext->DevPixelsToAppUnits(devDeltaY);
nsPoint point =
aPoint.ToAppUnits(aFrame->PresContext()->AppUnitsPerDevPixel());
nsRect frameRect = aFrame->GetScreenRectInAppUnits();
nsPoint deltaPoint(point.x - frameRect.x, point.y - frameRect.y);
nsPoint scrollPoint = scrollableFrame->GetScrollPosition();
scrollPoint -= deltaPoint;
@ -386,19 +383,15 @@ nsCoreUtils::GetScreenCoordsForWindow(nsINode *aNode)
if (!treeItem)
return coords;
nsCOMPtr<nsIDocShellTreeItem> rootTreeItem;
treeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem));
nsCOMPtr<nsIDOMDocument> domDoc = do_GetInterface(rootTreeItem);
if (!domDoc)
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
treeItem->GetTreeOwner(getter_AddRefs(treeOwner));
if (!treeOwner)
return coords;
nsCOMPtr<nsIDOMWindow> window;
domDoc->GetDefaultView(getter_AddRefs(window));
if (!window)
return coords;
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(treeOwner);
if (baseWindow)
baseWindow->GetPosition(&coords.x, &coords.y); // in device pixels
window->GetScreenX(&coords.x);
window->GetScreenY(&coords.y);
return coords;
}

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

@ -168,7 +168,8 @@ public:
nsIPresShell::ScrollAxis *aHorizontal);
/**
* Returns coordinates relative screen for the top level window.
* Returns coordinates in device pixels relative screen for the top level
* window.
*
* @param aNode the DOM node hosted in the window.
*/

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

@ -1394,7 +1394,7 @@ DocAccessible::GetAccessibleOrContainer(nsINode* aNode)
nsINode* currNode = aNode;
Accessible* accessible = nullptr;
while (!(accessible = GetAccessible(currNode)) &&
(currNode = currNode->GetNodeParent()));
(currNode = currNode->GetParentNode()));
return accessible;
}

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

@ -269,7 +269,7 @@ public:
*/
Accessible* GetContainerAccessible(nsINode* aNode)
{
return aNode ? GetAccessibleOrContainer(aNode->GetNodeParent()) : nullptr;
return aNode ? GetAccessibleOrContainer(aNode->GetParentNode()) : nullptr;
}
/**

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

@ -959,7 +959,7 @@ HTMLTableAccessible::HasDescendant(const nsAString& aTagName, bool aAllowEmpty)
nsCOMPtr<nsIDOMElement> tableElt(do_QueryInterface(mContent));
NS_ENSURE_TRUE(tableElt, false);
nsCOMPtr<nsIDOMNodeList> nodeList;
nsCOMPtr<nsIDOMHTMLCollection> nodeList;
tableElt->GetElementsByTagName(aTagName, getter_AddRefs(nodeList));
NS_ENSURE_TRUE(nodeList, false);

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

@ -98,8 +98,9 @@ var AccessFu = {
Services.obs.addObserver(this, 'remote-browser-frame-shown', false);
Services.obs.addObserver(this, 'Accessibility:NextObject', false);
Services.obs.addObserver(this, 'Accessibility:PreviousObject', false);
Services.obs.addObserver(this, 'Accessibility:CurrentObject', false);
Services.obs.addObserver(this, 'Accessibility:Focus', false);
this.chromeWin.addEventListener('TabOpen', this);
this.chromeWin.addEventListener('TabSelect', this);
},
/**
@ -120,11 +121,12 @@ var AccessFu = {
Input.detach();
this.chromeWin.removeEventListener('TabOpen', this);
this.chromeWin.removeEventListener('TabSelect', this);
Services.obs.removeObserver(this, 'remote-browser-frame-shown');
Services.obs.removeObserver(this, 'Accessibility:NextObject');
Services.obs.removeObserver(this, 'Accessibility:PreviousObject');
Services.obs.removeObserver(this, 'Accessibility:CurrentObject');
Services.obs.removeObserver(this, 'Accessibility:Focus');
},
_enableOrDisable: function _enableOrDisable() {
@ -135,7 +137,7 @@ var AccessFu = {
else
this._disable();
} catch (x) {
Logger.error(x);
Logger.logException(x);
}
},
@ -155,7 +157,7 @@ var AccessFu = {
Output[presenter.type](presenter.details, aMessage.target);
}
} catch (x) {
Logger.error(x);
Logger.logException(x);
}
break;
case 'AccessFu:Input':
@ -186,11 +188,13 @@ var AccessFu = {
case 'Accessibility:PreviousObject':
Input.moveCursor('movePrevious', 'Simple', 'gesture');
break;
case 'Accessibility:CurrentObject':
let mm = Utils.getCurrentBrowser(this.chromeWin).
frameLoader.messageManager;
mm.sendAsyncMessage('AccessFu:VirtualCursor',
{action: 'presentLastPivot'});
case 'Accessibility:Focus':
this._focused = JSON.parse(aData);
if (this._focused) {
let mm = Utils.getMessageManager(Utils.getCurrentBrowser(this.chromeWin));
mm.sendAsyncMessage('AccessFu:VirtualCursor',
{action: 'whereIsIt', move: true});
}
break;
case 'nsPref:changed':
if (aData == 'activate') {
@ -222,11 +226,28 @@ var AccessFu = {
this._loadFrameScript(Utils.getMessageManager(aEvent.target));
break;
}
case 'TabSelect':
{
if (this._focused) {
let mm = Utils.getMessageManager(Utils.getCurrentBrowser(this.chromeWin));
// We delay this for half a second so the awesomebar could close,
// and we could use the current coordinates for the content item.
// XXX TODO figure out how to avoid magic wait here.
this.chromeWin.setTimeout(
function () {
mm.sendAsyncMessage('AccessFu:VirtualCursor', {action: 'whereIsIt'});
}, 500);
}
break;
}
}
},
// So we don't enable/disable twice
_enabled: false
_enabled: false,
// Layerview is focused
_focused: false
};
var Output = {
@ -320,7 +341,7 @@ var Input = {
break;
}
} catch (x) {
Logger.error(x);
Logger.logException(x);
}
},

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

@ -42,7 +42,8 @@ var EventManager = {
}
);
} catch (x) {
Logger.error('Failed to start EventManager:', x);
Logger.error('Failed to start EventManager');
Logger.logException(x);
}
},
@ -77,16 +78,25 @@ var EventManager = {
case 'scroll':
case 'resize':
{
// the target could be an element, document or window
let window = null;
if (aEvent.target instanceof Ci.nsIDOMWindow)
window = aEvent.target;
else if (aEvent.target instanceof Ci.nsIDOMDocument)
window = aEvent.target.defaultView;
else if (aEvent.target instanceof Ci.nsIDOMElement)
window = aEvent.target.ownerDocument.defaultView;
this.present(
function(p) {
return p.viewportChanged();;
return p.viewportChanged(window);
}
);
break;
}
}
} catch (x) {
Logger.error('Error handling DOM event:', x);
Logger.error('Error handling DOM event');
Logger.logException(x);
}
},
@ -98,20 +108,13 @@ var EventManager = {
event = aSubject.QueryInterface(Ci.nsIAccessibleEvent);
this.handleAccEvent(event);
} catch (x) {
Logger.error('Error handing accessible event:', x);
Logger.error('Error handing accessible event');
Logger.logException(x);
return;
}
}
},
presentLastPivot: function presentLastPivot() {
this.present(
function(p) {
return p.presentLastPivot();
}
);
},
handleAccEvent: function handleAccEvent(aEvent) {
if (Logger.logLevel >= Logger.DEBUG)
Logger.debug('A11yEvent', Logger.eventToString(aEvent),
@ -248,10 +251,21 @@ var EventManager = {
[aPresenterFunc(p) for each (p in this.presenters)].
filter(function(d) {return !!d;}));
} catch (x) {
Logger.error(x);
Logger.logException(x);
}
},
presentVirtualCursorPosition: function presentVirtualCursorPosition(aVirtualCursor) {
let presenterContext =
new PresenterContext(aVirtualCursor.position, null);
this.present(
function(p) {
return p.pivotChanged(presenterContext, Ci.nsIAccessiblePivot.REASON_NONE);
}
);
},
onStateChange: function onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
let tabstate = '';

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

@ -104,12 +104,7 @@ Presenter.prototype = {
/**
* We have entered or left text editing mode.
*/
editingModeChanged: function editingModeChanged(aIsEditing) {},
/**
* Re-present the last pivot change.
*/
presentLastPivot: function AndroidPresenter_presentLastPivot() {}
editingModeChanged: function editingModeChanged(aIsEditing) {}
};
/**
@ -208,8 +203,6 @@ AndroidPresenter.prototype = {
if (!aContext.accessible)
return null;
this._currentContext = aContext;
let androidEvents = [];
let isExploreByTouch = (aReason == Ci.nsIAccessiblePivot.REASON_POINT &&
@ -275,28 +268,25 @@ AndroidPresenter.prototype = {
textChanged: function AndroidPresenter_textChanged(aIsInserted, aStart,
aLength, aText,
aModifiedText) {
let androidEvent = {
type: this.type,
details: [{
eventType: this.ANDROID_VIEW_TEXT_CHANGED,
text: [aText],
fromIndex: aStart,
removedCount: 0,
addedCount: 0
}]
let eventDetails = {
eventType: this.ANDROID_VIEW_TEXT_CHANGED,
text: [aText],
fromIndex: aStart,
removedCount: 0,
addedCount: 0
};
if (aIsInserted) {
androidEvent.addedCount = aLength;
androidEvent.beforeText =
eventDetails.addedCount = aLength;
eventDetails.beforeText =
aText.substring(0, aStart) + aText.substring(aStart + aLength);
} else {
androidEvent.removedCount = aLength;
androidEvent.beforeText =
eventDetails.removedCount = aLength;
eventDetails.beforeText =
aText.substring(0, aStart) + aModifiedText + aText.substring(aStart);
}
return androidEvent;
return {type: this.type, details: [eventDetails]};
},
viewportChanged: function AndroidPresenter_viewportChanged(aWindow) {
@ -335,13 +325,6 @@ AndroidPresenter.prototype = {
fromIndex: 0
}]
};
},
presentLastPivot: function AndroidPresenter_presentLastPivot() {
if (this._currentContext)
return this.pivotChanged(this._currentContext);
else
return null;
}
};

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

@ -89,7 +89,8 @@ var Utils = {
},
getCurrentContentDoc: function getCurrentContentDoc(aWindow) {
return this.getCurrentBrowser(aWindow).contentDocument;
let browser = this.getCurrentBrowser(aWindow);
return browser ? browser.contentDocument : null;
},
getMessageManager: function getMessageManager(aBrowser) {
@ -97,7 +98,7 @@ var Utils = {
return aBrowser.QueryInterface(Ci.nsIFrameLoaderOwner).
frameLoader.messageManager;
} catch (x) {
Logger.error(x);
Logger.logException(x);
return null;
}
},
@ -108,13 +109,14 @@ var Utils = {
for (let i = 0; i < aWindow.messageManager.childCount; i++)
messageManagers.push(aWindow.messageManager.getChildAt(i));
let remoteframes = this.getCurrentContentDoc(aWindow).
querySelectorAll('iframe[remote=true]');
let document = this.getCurrentContentDoc(aWindow);
for (let i = 0; i < remoteframes.length; ++i)
messageManagers.push(this.getMessageManager(remoteframes[i]));
if (document) {
let remoteframes = document.querySelectorAll('iframe[remote=true]');
Logger.info(messageManagers.length);
for (let i = 0; i < remoteframes.length; ++i)
messageManagers.push(this.getMessageManager(remoteframes[i]));
}
return messageManagers;
},
@ -192,6 +194,16 @@ var Logger = {
this, [this.ERROR].concat(Array.prototype.slice.call(arguments)));
},
logException: function logException(aException) {
try {
this.error(
aException.message,
'(' + aException.fileName + ':' + aException.lineNumber + ')');
} catch (x) {
this.error(x);
}
},
accessibleToString: function accessibleToString(aAccessible) {
let str = '[ defunct ]';
try {

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

@ -54,8 +54,14 @@ function virtualCursorControl(aMessage) {
case 'moveToPoint':
moved = vc.moveToPoint(rule, details.x, details.y, true);
break;
case 'presentLastPivot':
EventManager.presentLastPivot();
case 'whereIsIt':
if (!forwardMessage(vc, aMessage)) {
if (!vc.position && aMessage.json.move)
vc.moveFirst(TraversalRules.Simple);
else
EventManager.presentVirtualCursorPosition(vc);
}
break;
default:
break;

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

@ -18,8 +18,7 @@
nsAutoString title;
// XXX use the flattening API when there are available
// see bug 768298
nsresult rv = mGeckoAccessible->GetContent()->GetTextContent(title);
NS_ENSURE_SUCCESS(rv, nil);
mGeckoAccessible->GetContent()->GetTextContent(title);
return nsCocoaUtils::ToNSString(title);
}

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

@ -409,7 +409,7 @@ __try {
if (!node)
return E_FAIL;
*aNode = MakeAccessNode(node->GetNodeParent());
*aNode = MakeAccessNode(node->GetParentNode());
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }

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

@ -60,8 +60,7 @@ nsXFormsAccessible::GetBoundChildElementValue(const nsAString& aTagName,
if (IsDefunct())
return NS_ERROR_FAILURE;
nsINodeList* nodes = mContent->GetChildNodesList();
NS_ENSURE_STATE(nodes);
nsINodeList* nodes = mContent->ChildNodes();
uint32_t length;
nsresult rv = nodes->GetLength(&length);
@ -545,7 +544,7 @@ nsXFormsSelectableItemAccessible::IsSelected()
nsresult rv;
nsINode* parent = mContent;
while ((parent = parent->GetNodeParent())) {
while ((parent = parent->GetParentNode())) {
nsCOMPtr<nsIContent> content(do_QueryInterface(parent));
if (!content)
return false;

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

@ -156,7 +156,7 @@ nsXFormsComboboxPopupWidgetAccessible::Value(nsString& aValue)
void
nsXFormsComboboxPopupWidgetAccessible::CacheChildren()
{
nsCOMPtr<nsIDOMNode> parent = do_QueryInterface(mContent->GetNodeParent());
nsCOMPtr<nsIDOMNode> parent = do_QueryInterface(mContent->GetParentNode());
// Parent node must be an xforms:select1 element.
CacheSelectChildren(parent);
}

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

@ -24,6 +24,7 @@ DIRS = \
pivot \
relations \
role \
scroll \
selectable \
states \
table \

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

@ -73,6 +73,10 @@ const STATE_BUSY = nsIAccessibleStates.STATE_BUSY;
const SCROLL_TYPE_ANYWHERE = nsIAccessibleScrollType.SCROLL_TYPE_ANYWHERE;
const COORDTYPE_SCREEN_RELATIVE = nsIAccessibleCoordinateType.COORDTYPE_SCREEN_RELATIVE;
const COORDTYPE_WINDOW_RELATIVE = nsIAccessibleCoordinateType.COORDTYPE_WINDOW_RELATIVE;
const COORDTYPE_PARENT_RELATIVE = nsIAccessibleCoordinateType.COORDTYPE_PARENT_RELATIVE;
const kEmbedChar = String.fromCharCode(0xfffc);
const kDiscBulletText = String.fromCharCode(0x2022) + " ";

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

@ -91,6 +91,19 @@ function getChildAtPoint(aIdentifier, aX, aY, aFindDeepestChild)
return null;
}
/**
* Test the accessible position.
*/
function testPos(aID, aPoint)
{
var [expectedX, expectedY] =
(aPoint != undefined) ? aPoint : getBoundsForDOMElm(aID);
var [x, y] = getBounds(aID);
is(x, expectedX, "Wrong x coordinate of " + prettyName(aID));
is(y, expectedY, "Wrong y coordinate of " + prettyName(aID));
}
/**
* Test the accessible boundaries.
*/
@ -107,7 +120,19 @@ function testBounds(aID, aRect)
}
/**
* Return the accessible coordinates and size relative to the screen.
* Return the accessible coordinates relative to the screen in device pixels.
*/
function getPos(aID)
{
var accessible = getAccessible(aID);
var x = {}, y = {};
accessible.getBounds(x, y, {}, {});
return [x.value, y.value];
}
/**
* Return the accessible coordinates and size relative to the screen in device
* pixels.
*/
function getBounds(aID)
{

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

@ -0,0 +1,18 @@
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = accessible/scroll
include $(DEPTH)/config/autoconf.mk
MOCHITEST_A11Y_FILES =\
test_zoom.html \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -0,0 +1,147 @@
<!DOCTYPE html>
<html>
<head>
<title>Test scrollToPoint when page is zoomed</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../role.js"></script>
<script type="application/javascript"
src="../layout.js"></script>
<script type="application/javascript">
function testScrollToPoint()
{
// scrollToPoint relative screen
var anchor = getAccessible("bottom1");
var [x, y] = getPos(anchor);
var [docX, docY] = getPos(document);
anchor.scrollToPoint(COORDTYPE_SCREEN_RELATIVE, docX, docY);
testPos(anchor, [x, docY]);
// scrollToPoint relative window
anchor = getAccessible("bottom2");
var [x, y] = getPos(anchor);
var wnd = getRootAccessible().DOMDocument.defaultView;
var scrollToX = docX - wnd.screenX, scrollToY = docY - wnd.screenY;
anchor.scrollToPoint(COORDTYPE_WINDOW_RELATIVE, scrollToX, scrollToY);
testPos(anchor, [x, docY]);
// scrollToPoint relative parent
anchor = getAccessible("bottom3");
var [x, y] = getPos(anchor);
var [parentX, parentY] = getPos(anchor.parent);
var scrollToX = parentX - docX, scrollToY = parentY - docY;
anchor.scrollToPoint(COORDTYPE_PARENT_RELATIVE, scrollToX, scrollToY);
testPos(anchor, [x, docY]);
}
function doTest()
{
testScrollToPoint();
zoomDocument(document, 2.0);
testScrollToPoint(); // zoom and test again
zoomDocument(document, 1.0);
SimpleTest.finish();
}
addA11yLoadEvent(doTest);
SimpleTest.waitForExplicitFinish();
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=727942"
title="scrollToPoint is broken when page is zoomed">
Mozilla Bug 727942
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<h1>Below there is a bunch of named anchors</h1>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
This is in the middle anchor #1<a id="bottom1"></a>
<br><br><br><br><br><br><br><br><br><br>
This is in the middle anchor #2<a id="bottom2"></a>
<br><br><br><br><br><br><br><br><br><br>
This is in the middle anchor #3<a id="bottom3"></a>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
</body>
</html>

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

@ -251,6 +251,7 @@ Section "Uninstall"
${MUI_INSTALLOPTIONS_READ} $0 "unconfirm.ini" "Field 3" "State"
${If} "$0" == "1"
${un.DeleteRelativeProfiles} "Mozilla\Firefox"
${un.DeleteRelativeProfiles} "Mozilla\MetroFirefox"
RmDir "$APPDATA\Mozilla\Extensions\{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
RmDir "$APPDATA\Mozilla\Extensions"
RmDir "$APPDATA\Mozilla"

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

@ -438,6 +438,8 @@ user_pref("extensions.update.url", "http://%(server)s/extensions-dummy/updateURL
user_pref("extensions.update.background.url", "http://%(server)s/extensions-dummy/updateBackgroundURL");
user_pref("extensions.blocklist.url", "http://%(server)s/extensions-dummy/blocklistURL");
user_pref("extensions.hotfix.url", "http://%(server)s/extensions-dummy/hotfixURL");
// Turn off extension updates so they don't bother tests
user_pref("extensions.update.enabled", false);
// Make sure opening about:addons won't hit the network
user_pref("extensions.webservice.discoverURL", "http://%(server)s/extensions-dummy/discoveryURL");
// Make sure AddonRepository won't hit the network

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

@ -823,3 +823,5 @@ export CL_INCLUDES_PREFIX
ifeq ($(MOZ_WIDGET_GTK),2)
MOZ_GTK2_CFLAGS := -I$(topsrcdir)/widget/gtk2/compat $(MOZ_GTK2_CFLAGS)
endif
DEFINES += -DNO_NSPR_10_SUPPORT

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

@ -63,7 +63,7 @@ dnl ========================================================
GLIB_VERSION=1.2.0
PERL_VERSION=5.006
PYTHON_VERSION_MAJOR=2
PYTHON_VERSION_MINOR=5
PYTHON_VERSION_MINOR=6
CAIRO_VERSION=1.10
PANGO_VERSION=1.14.0
GTK2_VERSION=2.10.0
@ -803,7 +803,7 @@ else
AC_MSG_RESULT([yes])
fi
MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python)
if test -z "$PYTHON"; then
AC_MSG_ERROR([python was not found in \$PATH])
fi
@ -1839,7 +1839,7 @@ case "$host" in
;;
esac
dnl We require version 2.5 or newer of Python to build.
dnl We require version 2.6 or newer of Python to build.
AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR but not 3.x])
changequote(:)

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

@ -348,4 +348,9 @@ inline const mozilla::dom::Element* nsINode::AsElement() const
return static_cast<const mozilla::dom::Element*>(this);
}
inline bool nsINode::HasAttributes() const
{
return IsElement() && AsElement()->GetAttrCount() > 0;
}
#endif // mozilla_dom_Element_h__

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

@ -191,8 +191,9 @@ public:
virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
bool aNotify);
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify);
NS_IMETHOD GetTextContent(nsAString &aTextContent);
NS_IMETHOD SetTextContent(const nsAString& aTextContent);
virtual void GetTextContentInternal(nsAString& aTextContent);
virtual void SetTextContentInternal(const nsAString& aTextContent,
mozilla::ErrorResult& aError);
// nsIContent interface methods
virtual already_AddRefed<nsINodeList> GetChildren(uint32_t aFilter);
@ -219,49 +220,6 @@ public:
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
public:
// nsIDOMNode method implementation
NS_IMETHOD GetNodeName(nsAString& aNodeName);
NS_IMETHOD GetLocalName(nsAString& aLocalName);
NS_IMETHOD GetNodeValue(nsAString& aNodeValue);
NS_IMETHOD SetNodeValue(const nsAString& aNodeValue);
NS_IMETHOD GetNodeType(uint16_t* aNodeType);
NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes);
NS_IMETHOD GetNamespaceURI(nsAString& aNamespaceURI);
NS_IMETHOD GetPrefix(nsAString& aPrefix);
NS_IMETHOD IsSupported(const nsAString& aFeature,
const nsAString& aVersion, bool* aReturn);
NS_IMETHOD HasAttributes(bool* aHasAttributes);
NS_IMETHOD HasChildNodes(bool* aHasChildNodes);
nsresult InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild,
nsIDOMNode** aReturn)
{
return ReplaceOrInsertBefore(false, aNewChild, aRefChild, aReturn);
}
nsresult ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild,
nsIDOMNode** aReturn)
{
return ReplaceOrInsertBefore(true, aNewChild, aOldChild, aReturn);
}
nsresult RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
{
return nsINode::RemoveChild(aOldChild, aReturn);
}
nsresult AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
{
return InsertBefore(aNewChild, nullptr, aReturn);
}
nsresult CloneNode(bool aDeep, uint8_t aOptionalArgc, nsIDOMNode **aResult)
{
if (!aOptionalArgc) {
aDeep = true;
}
return nsNodeUtils::CloneNodeImpl(this, aDeep, true, aResult);
}
//----------------------------------------
/**
* If there are listeners for DOMNodeInserted event, fires the event on all
* aNodes

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

@ -37,6 +37,7 @@
#include "nsCharSeparatedTokenizer.h"
#include "gfxContext.h"
#include "gfxFont.h"
#include "nsContentList.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/GuardObjects.h"
@ -281,10 +282,9 @@ public:
* Returns true if aNode1 is before aNode2 in the same connected
* tree.
*/
static bool PositionIsBefore(nsINode* aNode1,
nsINode* aNode2)
static bool PositionIsBefore(nsINode* aNode1, nsINode* aNode2)
{
return (aNode2->CompareDocPosition(aNode1) &
return (aNode2->CompareDocumentPosition(*aNode1) &
(nsIDOMNode::DOCUMENT_POSITION_PRECEDING |
nsIDOMNode::DOCUMENT_POSITION_DISCONNECTED)) ==
nsIDOMNode::DOCUMENT_POSITION_PRECEDING;
@ -1814,9 +1814,16 @@ public:
* Utility method for getElementsByClassName. aRootNode is the node (either
* document or element), which getElementsByClassName was called on.
*/
static nsresult GetElementsByClassName(nsINode* aRootNode,
const nsAString& aClasses,
nsIDOMNodeList** aReturn);
static already_AddRefed<nsContentList>
GetElementsByClassName(nsINode* aRootNode, const nsAString& aClasses)
{
NS_PRECONDITION(aRootNode, "Must have root node");
return NS_GetFuncStringHTMLCollection(aRootNode, MatchClassNames,
DestroyClassNameArray,
AllocClassMatchingInfo,
aClasses);
}
/**
* Returns a presshell for this document, if there is one. This will be
@ -2180,6 +2187,12 @@ private:
static void DropFragmentParsers();
static bool MatchClassNames(nsIContent* aContent, int32_t aNamespaceID,
nsIAtom* aAtom, void* aData);
static void DestroyClassNameArray(void* aData);
static void* AllocClassMatchingInfo(nsINode* aRootNode,
const nsString* aClasses);
static nsIDOMScriptObjectFactory *sDOMScriptObjectFactory;
static nsIXPConnect *sXPConnect;

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

@ -16,27 +16,7 @@ DEPRECATED_OPERATION(CreateAttribute)
DEPRECATED_OPERATION(CreateAttributeNS)
DEPRECATED_OPERATION(Specified)
DEPRECATED_OPERATION(OwnerElement)
DEPRECATED_OPERATION(NodeName)
DEPRECATED_OPERATION(NodeValue)
DEPRECATED_OPERATION(NodeType)
DEPRECATED_OPERATION(ParentNode)
DEPRECATED_OPERATION(ChildNodes)
DEPRECATED_OPERATION(HasChildNodes)
DEPRECATED_OPERATION(HasAttributes)
DEPRECATED_OPERATION(FirstChild)
DEPRECATED_OPERATION(LastChild)
DEPRECATED_OPERATION(PreviousSibling)
DEPRECATED_OPERATION(NextSibling)
DEPRECATED_OPERATION(Attributes)
DEPRECATED_OPERATION(InsertBefore)
DEPRECATED_OPERATION(ReplaceChild)
DEPRECATED_OPERATION(RemoveChild)
DEPRECATED_OPERATION(AppendChild)
DEPRECATED_OPERATION(CloneNode)
DEPRECATED_OPERATION(OwnerDocument)
DEPRECATED_OPERATION(Normalize)
DEPRECATED_OPERATION(IsSupported)
DEPRECATED_OPERATION(IsEqualNode)
DEPRECATED_OPERATION(TextContent)
DEPRECATED_OPERATION(EnablePrivilege)
DEPRECATED_OPERATION(Position)

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

@ -27,7 +27,7 @@ public:
return mAttrMap;
}
nsINodeInfo *NodeInfo()
nsINodeInfo *NodeInfo() const
{
return mNodeInfo;
}

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

@ -1721,6 +1721,11 @@ public:
}
}
bool CreatingStaticClone() const
{
return mCreatingStaticClone;
}
private:
uint64_t mWarnedAbout;

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

@ -6,9 +6,11 @@
#ifndef nsINode_h___
#define nsINode_h___
#include "mozilla/ErrorResult.h"
#include "nsCOMPtr.h" // for member, local
#include "nsGkAtoms.h" // for nsGkAtoms::baseURIProperty
#include "nsIDOMEventTarget.h" // for base class
#include "nsIDOMNode.h"
#include "nsIDOMNodeSelector.h" // base class
#include "nsINodeInfo.h" // member (in nsCOMPtr)
#include "nsIVariant.h" // for use in GetUserData()
@ -27,10 +29,10 @@
class nsAttrAndChildArray;
class nsChildContentList;
class nsDOMAttributeMap;
class nsIContent;
class nsIDocument;
class nsIDOMElement;
class nsIDOMNode;
class nsIDOMNodeList;
class nsIDOMUserDataHandler;
class nsIEditor;
@ -43,10 +45,12 @@ class nsIURI;
class nsNodeSupportsWeakRefTearoff;
class nsNodeWeakReference;
class nsXPCClassInfo;
class nsGenericElement;
namespace mozilla {
namespace dom {
class Element;
template<typename T> class Optional;
} // namespace dom
} // namespace mozilla
@ -243,8 +247,8 @@ private:
// IID for the nsINode interface
#define NS_INODE_IID \
{ 0x9aede57e, 0xe39e, 0x42e8, \
{ 0x8d, 0x33, 0x7a, 0xc3, 0xd0, 0xbb, 0x5b, 0xf9 } }
{ 0xb3ee8053, 0x43b0, 0x44bc, \
{ 0xa0, 0x97, 0x18, 0x24, 0xd2, 0xac, 0x65, 0xb6 } }
/**
* An internal interface that abstracts some DOMNode-related parts that both
@ -361,6 +365,34 @@ public:
*/
virtual bool IsNodeOfType(uint32_t aFlags) const = 0;
virtual JSObject* WrapObject(JSContext *aCx, JSObject *aScope,
bool *aTriedToWrap);
protected:
/**
* WrapNode is called from WrapObject to actually wrap this node, WrapObject
* does some additional checks and fix-up that's common to all nodes. WrapNode
* should just call the DOM binding's Wrap function.
*/
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
bool *aTriedToWrap)
{
*aTriedToWrap = false;
return nullptr;
}
public:
nsIDocument* GetParentObject() const
{
// Make sure that we get the owner document of the content node, in case
// we're in document teardown. If we are, it's important to *not* use
// globalObj as the node's parent since that would give the node the
// principal of globalObj (i.e. the principal of the document that's being
// loaded) and not the principal of the document that's being unloaded.
// See http://bugzilla.mozilla.org/show_bug.cgi?id=227417
return OwnerDoc();
}
/**
* Return whether the node is an Element node
*/
@ -488,23 +520,6 @@ public:
return mNodeInfo->NameAtom();
}
nsINode*
InsertBefore(nsINode *aNewChild, nsINode *aRefChild, nsresult *aReturn)
{
return ReplaceOrInsertBefore(false, aNewChild, aRefChild, aReturn);
}
nsINode*
ReplaceChild(nsINode *aNewChild, nsINode *aOldChild, nsresult *aReturn)
{
return ReplaceOrInsertBefore(true, aNewChild, aOldChild, aReturn);
}
nsINode*
AppendChild(nsINode *aNewChild, nsresult *aReturn)
{
return InsertBefore(aNewChild, nullptr, aReturn);
}
nsresult RemoveChild(nsINode *aOldChild);
/**
* Insert a content node at a particular index. This method handles calling
* BindToTree on the child appropriately.
@ -732,7 +747,7 @@ public:
* an nsIDocument or an nsIAttribute.
* @return the parent node
*/
nsINode* GetNodeParent() const
nsINode* GetParentNode() const
{
return mParent;
}
@ -765,7 +780,7 @@ public:
{
const nsINode* slowNode = this;
const nsINode* iter = slowNode;
while ((iter = iter->GetNodeParent())) {
while ((iter = iter->GetParentNode())) {
slowNode = iter;
}
@ -1003,7 +1018,7 @@ public:
*/
nsIContent* GetSelectionRootContent(nsIPresShell* aPresShell);
virtual nsINodeList* GetChildNodesList();
virtual nsINodeList* ChildNodes();
nsIContent* GetFirstChild() const { return mFirstChild; }
nsIContent* GetLastChild() const
{
@ -1019,7 +1034,7 @@ public:
*/
nsIDocument* GetOwnerDocument() const;
nsresult Normalize();
void Normalize();
/**
* Get the base URI for any relative URIs within this piece of
@ -1030,6 +1045,10 @@ public:
* @return the base URI
*/
virtual already_AddRefed<nsIURI> GetBaseURI() const = 0;
already_AddRefed<nsIURI> GetBaseURIObject() const
{
return GetBaseURI();
}
/**
* Facility for explicitly setting a base URI on a node.
@ -1047,18 +1066,14 @@ protected:
}
public:
nsresult GetDOMBaseURI(nsAString &aURI) const;
// Note! This function must never fail. It only return an nsresult so that
// we can use it to implement nsIDOMNode
NS_IMETHOD GetTextContent(nsAString &aTextContent)
void GetTextContent(nsAString& aTextContent)
{
SetDOMStringToNull(aTextContent);
return NS_OK;
GetTextContentInternal(aTextContent);
}
NS_IMETHOD SetTextContent(const nsAString& aTextContent)
void SetTextContent(const nsAString& aTextContent,
mozilla::ErrorResult& aError)
{
return NS_OK;
SetTextContentInternal(aTextContent, aError);
}
/**
@ -1111,41 +1126,17 @@ public:
return NS_OK;
}
/**
* Compares the document position of a node to this node.
*
* @param aOtherNode The node whose position is being compared to this node
*
* @return The document position flags of the nodes. aOtherNode is compared
* to this node, i.e. if aOtherNode is before this node then
* DOCUMENT_POSITION_PRECEDING will be set.
*
* @see nsIDOMNode
*/
uint16_t CompareDocPosition(nsINode* aOtherNode);
nsresult CompareDocPosition(nsINode* aOtherNode, uint16_t* aReturn)
{
NS_ENSURE_ARG(aOtherNode);
*aReturn = CompareDocPosition(aOtherNode);
return NS_OK;
}
nsresult CompareDocumentPosition(nsIDOMNode* aOther,
uint16_t* aReturn);
nsresult LookupPrefix(const nsAString& aNamespaceURI, nsAString& aPrefix);
nsresult IsDefaultNamespace(const nsAString& aNamespaceURI, bool* aResult)
void LookupPrefix(const nsAString& aNamespace, nsAString& aResult);
bool IsDefaultNamespace(const nsAString& aNamespaceURI)
{
nsAutoString defaultNamespace;
LookupNamespaceURI(EmptyString(), defaultNamespace);
*aResult = aNamespaceURI.Equals(defaultNamespace);
return NS_OK;
return aNamespaceURI.Equals(defaultNamespace);
}
nsresult LookupNamespaceURI(const nsAString& aNamespacePrefix,
nsAString& aNamespaceURI);
void LookupNamespaceURI(const nsAString& aNamespacePrefix,
nsAString& aNamespaceURI);
nsresult IsEqualNode(nsIDOMNode* aOther, bool* aReturn);
bool IsEqualTo(nsINode* aOther);
nsIContent* GetNextSibling() const { return mNextSibling; }
nsIContent* GetPreviousSibling() const { return mPreviousSibling; }
@ -1194,7 +1185,7 @@ private:
#ifdef DEBUG
if (aRoot) {
const nsINode* cur = this;
for (; cur; cur = cur->GetNodeParent())
for (; cur; cur = cur->GetParentNode())
if (cur == aRoot) break;
NS_ASSERTION(cur, "aRoot not an ancestor of |this|?");
}
@ -1214,7 +1205,7 @@ private:
if (next) {
return next;
}
nsINode* parent = cur->GetNodeParent();
nsINode* parent = cur->GetParentNode();
if (parent == aRoot) {
return nullptr;
}
@ -1239,7 +1230,7 @@ public:
#ifdef DEBUG
if (aRoot) {
const nsINode* cur = this;
for (; cur; cur = cur->GetNodeParent())
for (; cur; cur = cur->GetParentNode())
if (cur == aRoot) break;
NS_ASSERTION(cur, "aRoot not an ancestor of |this|?");
}
@ -1425,6 +1416,88 @@ public:
*/
uint32_t Length() const;
void GetNodeName(nsAString& aNodeName) const
{
aNodeName = NodeName();
}
void GetBaseURI(nsAString& aBaseURI) const;
nsGenericElement* GetParentElement() const;
bool HasChildNodes() const
{
return HasChildren();
}
uint16_t CompareDocumentPosition(nsINode& aOther) const;
void GetNodeValue(nsAString& aNodeValue)
{
GetNodeValueInternal(aNodeValue);
}
void SetNodeValue(const nsAString& aNodeValue,
mozilla::ErrorResult& aError)
{
SetNodeValueInternal(aNodeValue, aError);
}
virtual void GetNodeValueInternal(nsAString& aNodeValue)
{
SetDOMStringToNull(aNodeValue);
}
virtual void SetNodeValueInternal(const nsAString& aNodeValue,
mozilla::ErrorResult& aError)
{
// The DOM spec says that when nodeValue is defined to be null "setting it
// has no effect", so we don't throw an exception.
}
nsINode* InsertBefore(nsINode& aNode, nsINode* aChild,
mozilla::ErrorResult& aError)
{
return ReplaceOrInsertBefore(false, &aNode, aChild, aError);
}
nsINode* AppendChild(nsINode& aNode, mozilla::ErrorResult& aError)
{
return InsertBefore(aNode, nullptr, aError);
}
nsINode* ReplaceChild(nsINode& aNode, nsINode& aChild,
mozilla::ErrorResult& aError)
{
return ReplaceOrInsertBefore(true, &aNode, &aChild, aError);
}
nsINode* RemoveChild(nsINode& aChild, mozilla::ErrorResult& aError);
already_AddRefed<nsINode> CloneNode(bool aDeep, mozilla::ErrorResult& aError);
bool IsEqualNode(nsINode* aNode);
bool IsSupported(const nsAString& aFeature, const nsAString& aVersion);
void GetNamespaceURI(nsAString& aNamespaceURI, mozilla::ErrorResult& aError) const
{
aError = mNodeInfo->GetNamespaceURI(aNamespaceURI);
}
#ifdef MOZILLA_INTERNAL_API
void GetPrefix(nsAString& aPrefix)
{
mNodeInfo->GetPrefix(aPrefix);
}
#endif
void GetLocalName(nsAString& aLocalName)
{
aLocalName = mNodeInfo->LocalName();
}
// HasAttributes is defined inline in Element.h.
bool HasAttributes() const;
nsDOMAttributeMap* GetAttributes();
JS::Value SetUserData(JSContext* aCx, const nsAString& aKey, JS::Value aData,
nsIDOMUserDataHandler* aHandler,
mozilla::ErrorResult& aError);
JS::Value GetUserData(JSContext* aCx, const nsAString& aKey,
mozilla::ErrorResult& aError);
// Helper method to remove this node from its parent. This is not exposed
// through WebIDL.
// Only call this if the node has a parent node.
nsresult RemoveFromParent()
{
nsINode* parent = GetParentNode();
mozilla::ErrorResult rv;
parent->RemoveChild(*this, rv);
return rv.ErrorCode();
}
protected:
// Override this function to create a custom slots class.
@ -1461,12 +1534,23 @@ protected:
return IsEditableInternal();
}
virtual void GetTextContentInternal(nsAString& aTextContent)
{
SetDOMStringToNull(aTextContent);
}
virtual void SetTextContentInternal(const nsAString& aTextContent,
mozilla::ErrorResult& aError)
{
}
#ifdef DEBUG
// Note: virtual so that IsInNativeAnonymousSubtree can be called accross
// module boundaries.
virtual void CheckNotNativeAnonymous() const;
#endif
// These are just used to implement nsIDOMNode using
// NS_FORWARD_NSIDOMNODE_TO_NSINODE_HELPER and for quickstubs.
nsresult GetParentNode(nsIDOMNode** aParentNode);
nsresult GetParentElement(nsIDOMElement** aParentElement);
nsresult GetChildNodes(nsIDOMNodeList** aChildNodes);
@ -1475,21 +1559,15 @@ protected:
nsresult GetPreviousSibling(nsIDOMNode** aPrevSibling);
nsresult GetNextSibling(nsIDOMNode** aNextSibling);
nsresult GetOwnerDocument(nsIDOMDocument** aOwnerDocument);
nsresult CompareDocumentPosition(nsIDOMNode* aOther,
uint16_t* aReturn);
nsresult GetAttributes(nsIDOMNamedNodeMap** aAttributes);
nsresult ReplaceOrInsertBefore(bool aReplace, nsIDOMNode *aNewChild,
nsIDOMNode *aRefChild, nsIDOMNode **aReturn);
nsINode* ReplaceOrInsertBefore(bool aReplace, nsINode *aNewChild,
nsINode *aRefChild, nsresult *aReturn)
{
*aReturn = ReplaceOrInsertBefore(aReplace, aNewChild, aRefChild);
if (NS_FAILED(*aReturn)) {
return nullptr;
}
return aReplace ? aRefChild : aNewChild;
}
virtual nsresult ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
nsINode* aRefChild);
nsINode* ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
nsINode* aRefChild,
mozilla::ErrorResult& aError);
nsresult RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
/**
@ -1732,5 +1810,186 @@ extern const nsIID kThisPtrOffsetsSID;
NS_DEFINE_STATIC_IID_ACCESSOR(nsINode, NS_INODE_IID)
#define NS_FORWARD_NSIDOMNODE_TO_NSINODE_HELPER(_final) \
NS_IMETHOD GetNodeName(nsAString& aNodeName) _final \
{ \
nsINode::GetNodeName(aNodeName); \
return NS_OK; \
} \
NS_IMETHOD GetNodeValue(nsAString& aNodeValue) _final \
{ \
nsINode::GetNodeValue(aNodeValue); \
return NS_OK; \
} \
NS_IMETHOD SetNodeValue(const nsAString& aNodeValue) _final \
{ \
mozilla::ErrorResult rv; \
nsINode::SetNodeValue(aNodeValue, rv); \
return rv.ErrorCode(); \
} \
NS_IMETHOD GetNodeType(uint16_t* aNodeType) _final \
{ \
*aNodeType = nsINode::NodeType(); \
return NS_OK; \
} \
NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode) _final \
{ \
return nsINode::GetParentNode(aParentNode); \
} \
NS_IMETHOD GetParentElement(nsIDOMElement** aParentElement) _final \
{ \
return nsINode::GetParentElement(aParentElement); \
} \
NS_IMETHOD GetChildNodes(nsIDOMNodeList** aChildNodes) _final \
{ \
return nsINode::GetChildNodes(aChildNodes); \
} \
NS_IMETHOD GetFirstChild(nsIDOMNode** aFirstChild) _final \
{ \
return nsINode::GetFirstChild(aFirstChild); \
} \
NS_IMETHOD GetLastChild(nsIDOMNode** aLastChild) _final \
{ \
return nsINode::GetLastChild(aLastChild); \
} \
NS_IMETHOD GetPreviousSibling(nsIDOMNode** aPreviousSibling) _final \
{ \
return nsINode::GetPreviousSibling(aPreviousSibling); \
} \
NS_IMETHOD GetNextSibling(nsIDOMNode** aNextSibling) _final \
{ \
return nsINode::GetNextSibling(aNextSibling); \
} \
NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes) _final \
{ \
return nsINode::GetAttributes(aAttributes); \
} \
NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument) _final \
{ \
return nsINode::GetOwnerDocument(aOwnerDocument); \
} \
NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aResult) _final \
{ \
return ReplaceOrInsertBefore(false, aNewChild, aRefChild, aResult); \
} \
NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aResult) _final \
{ \
return ReplaceOrInsertBefore(true, aNewChild, aOldChild, aResult); \
} \
NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aResult) _final \
{ \
return nsINode::RemoveChild(aOldChild, aResult); \
} \
NS_IMETHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aResult) _final \
{ \
return InsertBefore(aNewChild, nullptr, aResult); \
} \
NS_IMETHOD HasChildNodes(bool* aResult) _final \
{ \
*aResult = nsINode::HasChildNodes(); \
return NS_OK; \
} \
NS_IMETHOD CloneNode(bool aDeep, uint8_t aArgc, nsIDOMNode** aResult) _final \
{ \
if (aArgc == 0) { \
aDeep = true; \
} \
mozilla::ErrorResult rv; \
nsCOMPtr<nsINode> clone = nsINode::CloneNode(aDeep, rv); \
if (rv.Failed()) { \
return rv.ErrorCode(); \
} \
*aResult = clone.forget().get()->AsDOMNode(); \
return NS_OK; \
} \
NS_IMETHOD Normalize() _final \
{ \
nsINode::Normalize(); \
return NS_OK; \
} \
NS_IMETHOD IsSupported(const nsAString& aFeature, const nsAString& aVersion, bool* aResult) _final \
{ \
*aResult = nsINode::IsSupported(aFeature, aVersion); \
return NS_OK; \
} \
NS_IMETHOD GetNamespaceURI(nsAString& aNamespaceURI) _final \
{ \
mozilla::ErrorResult rv; \
nsINode::GetNamespaceURI(aNamespaceURI, rv); \
return rv.ErrorCode(); \
} \
NS_IMETHOD GetPrefix(nsAString& aPrefix) _final \
{ \
nsINode::GetPrefix(aPrefix); \
return NS_OK; \
} \
NS_IMETHOD GetLocalName(nsAString& aLocalName) _final \
{ \
nsINode::GetLocalName(aLocalName); \
return NS_OK; \
} \
using nsINode::HasAttributes; \
NS_IMETHOD HasAttributes(bool* aResult) _final \
{ \
*aResult = nsINode::HasAttributes(); \
return NS_OK; \
} \
NS_IMETHOD GetDOMBaseURI(nsAString& aBaseURI) _final \
{ \
nsINode::GetBaseURI(aBaseURI); \
return NS_OK; \
} \
NS_IMETHOD CompareDocumentPosition(nsIDOMNode* aOther, uint16_t* aResult) _final \
{ \
return nsINode::CompareDocumentPosition(aOther, aResult); \
} \
NS_IMETHOD GetTextContent(nsAString& aTextContent) _final \
{ \
nsINode::GetTextContent(aTextContent); \
return NS_OK; \
} \
NS_IMETHOD SetTextContent(const nsAString& aTextContent) _final \
{ \
mozilla::ErrorResult rv; \
nsINode::SetTextContent(aTextContent, rv); \
return rv.ErrorCode(); \
} \
NS_IMETHOD LookupPrefix(const nsAString& aNamespaceURI, nsAString& aResult) _final \
{ \
nsINode::LookupPrefix(aNamespaceURI, aResult); \
return NS_OK; \
} \
NS_IMETHOD IsDefaultNamespace(const nsAString& aNamespaceURI, bool* aResult) _final \
{ \
*aResult = nsINode::IsDefaultNamespace(aNamespaceURI); \
return NS_OK; \
} \
NS_IMETHOD LookupNamespaceURI(const nsAString& aPrefix, nsAString& aResult) _final \
{ \
nsINode::LookupNamespaceURI(aPrefix, aResult); \
return NS_OK; \
} \
NS_IMETHOD IsEqualNode(nsIDOMNode* aArg, bool* aResult) _final \
{ \
return nsINode::IsEqualNode(aArg, aResult); \
} \
NS_IMETHOD SetUserData(const nsAString& aKey, nsIVariant* aData, nsIDOMUserDataHandler* aHandler, nsIVariant** aResult) _final \
{ \
return nsINode::SetUserData(aKey, aData, aHandler, aResult); \
} \
NS_IMETHOD GetUserData(const nsAString& aKey, nsIVariant** aResult) _final \
{ \
return nsINode::GetUserData(aKey, aResult); \
} \
NS_IMETHOD Contains(nsIDOMNode* aOther, bool* aResult) _final \
{ \
return nsINode::Contains(aOther, aResult); \
}
#define NS_FORWARD_NSIDOMNODE_TO_NSINODE \
NS_FORWARD_NSIDOMNODE_TO_NSINODE_HELPER(MOZ_FINAL)
#define NS_FORWARD_NSIDOMNODE_TO_NSINODE_OVERRIDABLE \
NS_FORWARD_NSIDOMNODE_TO_NSINODE_HELPER()
#endif /* nsINode_h___ */

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

@ -454,7 +454,8 @@ NS_IMETHODIMP
nsNode3Tearoff::LookupNamespaceURI(const nsAString& aNamespacePrefix,
nsAString& aNamespaceURI)
{
return mNode->LookupNamespaceURI(aNamespacePrefix, aNamespaceURI);
mNode->LookupNamespaceURI(aNamespacePrefix, aNamespaceURI);
return NS_OK;
}
nsContentList*
@ -639,90 +640,6 @@ FragmentOrElement::~FragmentOrElement()
}
}
NS_IMETHODIMP
FragmentOrElement::GetNodeName(nsAString& aNodeName)
{
aNodeName = NodeName();
return NS_OK;
}
NS_IMETHODIMP
FragmentOrElement::GetLocalName(nsAString& aLocalName)
{
aLocalName = LocalName();
return NS_OK;
}
NS_IMETHODIMP
FragmentOrElement::GetNodeValue(nsAString& aNodeValue)
{
SetDOMStringToNull(aNodeValue);
return NS_OK;
}
NS_IMETHODIMP
FragmentOrElement::SetNodeValue(const nsAString& aNodeValue)
{
// The DOM spec says that when nodeValue is defined to be null "setting it
// has no effect", so we don't throw an exception.
return NS_OK;
}
NS_IMETHODIMP
FragmentOrElement::GetNodeType(uint16_t* aNodeType)
{
*aNodeType = NodeType();
return NS_OK;
}
NS_IMETHODIMP
FragmentOrElement::GetNamespaceURI(nsAString& aNamespaceURI)
{
return mNodeInfo->GetNamespaceURI(aNamespaceURI);
}
NS_IMETHODIMP
FragmentOrElement::GetPrefix(nsAString& aPrefix)
{
mNodeInfo->GetPrefix(aPrefix);
return NS_OK;
}
NS_IMETHODIMP
FragmentOrElement::IsSupported(const nsAString& aFeature,
const nsAString& aVersion,
bool* aReturn)
{
*aReturn = nsContentUtils::InternalIsSupported(this, aFeature, aVersion);
return NS_OK;
}
NS_IMETHODIMP
FragmentOrElement::HasAttributes(bool* aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = GetAttrCount() > 0;
return NS_OK;
}
NS_IMETHODIMP
FragmentOrElement::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
{
*aAttributes = nullptr;
return NS_OK;
}
nsresult
FragmentOrElement::HasChildNodes(bool* aReturn)
{
*aReturn = mAttrsAndChildren.ChildCount() > 0;
return NS_OK;
}
already_AddRefed<nsINodeList>
FragmentOrElement::GetChildren(uint32_t aFilter)
{
@ -751,7 +668,7 @@ FragmentOrElement::GetChildren(uint32_t aFilter)
if (!(aFilter & eAllButXBL)) {
childList = document->BindingManager()->GetXBLChildNodesFor(this);
if (!childList) {
childList = GetChildNodesList();
childList = ChildNodes();
}
} else {
@ -978,17 +895,17 @@ FragmentOrElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
}
}
NS_IMETHODIMP
FragmentOrElement::GetTextContent(nsAString &aTextContent)
void
FragmentOrElement::GetTextContentInternal(nsAString& aTextContent)
{
nsContentUtils::GetNodeTextContent(this, true, aTextContent);
return NS_OK;
}
NS_IMETHODIMP
FragmentOrElement::SetTextContent(const nsAString& aTextContent)
void
FragmentOrElement::SetTextContentInternal(const nsAString& aTextContent,
ErrorResult& aError)
{
return nsContentUtils::SetNodeTextContent(this, aTextContent, false);
aError = nsContentUtils::SetNodeTextContent(this, aTextContent, false);
}
void
@ -1208,7 +1125,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FragmentOrElement)
{
nsIDocument *doc;
if (!tmp->GetNodeParent() && (doc = tmp->OwnerDoc())) {
if (!tmp->GetParentNode() && (doc = tmp->OwnerDoc())) {
doc->BindingManager()->RemovedFromDocument(tmp, doc);
}
}
@ -1259,7 +1176,7 @@ nsINode*
FindOptimizableSubtreeRoot(nsINode* aNode)
{
nsINode* p;
while ((p = aNode->GetNodeParent())) {
while ((p = aNode->GetParentNode())) {
if (aNode->UnoptimizableCCNode()) {
return nullptr;
}
@ -1888,7 +1805,7 @@ FragmentOrElement::FireNodeRemovedForChildren()
nsCOMPtr<nsINode> child;
for (child = GetFirstChild();
child && child->GetNodeParent() == this;
child && child->GetParentNode() == this;
child = child->GetNextSibling()) {
nsContentUtils::MaybeFireNodeRemoved(child, this, doc);
}

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

@ -24,7 +24,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericDOMDataNode::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMCharacterData
NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)

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

@ -25,7 +25,7 @@ NodeToParentOffset(nsINode* aNode, int32_t* aOffset)
{
*aOffset = 0;
nsINode* parent = aNode->GetNodeParent();
nsINode* parent = aNode->GetParentNode();
if (parent) {
*aOffset = parent->IndexOf(aNode);
@ -54,7 +54,7 @@ NodeIsInTraversalRange(nsINode* aNode, bool aIsPreMode,
return true;
}
nsINode* parent = aNode->GetNodeParent();
nsINode* parent = aNode->GetParentNode();
if (!parent) {
return false;
}
@ -461,7 +461,7 @@ nsContentIterator::RebuildIndexStack()
}
while (current != mCommonParent) {
parent = current->GetNodeParent();
parent = current->GetParentNode();
if (!parent) {
return NS_ERROR_FAILURE;
@ -575,7 +575,7 @@ nsContentIterator::GetNextSibling(nsINode* aNode,
return nullptr;
}
nsINode* parent = aNode->GetNodeParent();
nsINode* parent = aNode->GetParentNode();
if (!parent) {
return nullptr;
}
@ -636,7 +636,7 @@ nsContentIterator::GetPrevSibling(nsINode* aNode,
return nullptr;
}
nsINode* parent = aNode->GetNodeParent();
nsINode* parent = aNode->GetParentNode();
if (!parent) {
return nullptr;
}
@ -706,7 +706,7 @@ nsContentIterator::NextNode(nsINode* aNode, nsTArray<int32_t>* aIndexes)
}
// post-order
nsINode* parent = node->GetNodeParent();
nsINode* parent = node->GetParentNode();
nsIContent* sibling = nullptr;
int32_t indx = 0;
@ -769,7 +769,7 @@ nsContentIterator::PrevNode(nsINode* aNode, nsTArray<int32_t>* aIndexes)
// if we are a Pre-order iterator, use pre-order
if (mPre) {
nsINode* parent = node->GetNodeParent();
nsINode* parent = node->GetParentNode();
nsIContent* sibling = nullptr;
int32_t indx = 0;
@ -1004,7 +1004,7 @@ nsContentIterator::PositionAt(nsINode* aCurNode)
// Insert at head since we're walking up
oldParentStack.InsertElementAt(0, tempNode);
nsINode* parent = tempNode->GetNodeParent();
nsINode* parent = tempNode->GetParentNode();
if (!parent) {
// this node has no parent, and thus no index
@ -1024,7 +1024,7 @@ nsContentIterator::PositionAt(nsINode* aCurNode)
// Ok. We have the array of old parents. Look for a match.
while (newCurNode) {
nsINode* parent = newCurNode->GetNodeParent();
nsINode* parent = newCurNode->GetParentNode();
if (!parent) {
// this node has no parent, and thus no index
@ -1422,7 +1422,7 @@ nsContentSubtreeIterator::PositionAt(nsINode* aCurNode)
nsIContent*
nsContentSubtreeIterator::GetTopAncestorInRange(nsINode* aNode)
{
if (!aNode || !aNode->GetNodeParent()) {
if (!aNode || !aNode->GetParentNode()) {
return nullptr;
}
@ -1447,7 +1447,7 @@ nsContentSubtreeIterator::GetTopAncestorInRange(nsINode* aNode)
//
// We have to special-case this because CompareNodeToRange treats the root
// node differently -- see bug 765205.
if (!parent || !parent->GetNodeParent()) {
if (!parent || !parent->GetParentNode()) {
return content;
}
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(

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

@ -414,20 +414,9 @@ GetFuncStringContentList(nsINode* aRootNode,
// we have an entry
list = new ListType(aRootNode, aFunc, aDestroyFunc, aDataAllocator,
aString);
if (list && !list->AllocatedData()) {
// Failed to allocate the data
delete list;
list = nullptr;
}
if (entry) {
if (list)
entry->mContentList = list;
else
PL_DHashTableRawRemove(&gContentListHashTable, entry);
entry->mContentList = list;
}
NS_ENSURE_TRUE(list, nullptr);
}
NS_ADDREF(list);
@ -744,7 +733,7 @@ nsContentList::AttributeChanged(nsIDocument *aDocument, Element* aElement,
NS_PRECONDITION(aElement, "Must have a content node to work with");
if (!mFunc || !mFuncMayDependOnAttr || mState == LIST_DIRTY ||
!MayContainRelevantNodes(aElement->GetNodeParent()) ||
!MayContainRelevantNodes(aElement->GetParentNode()) ||
!nsContentUtils::IsInSameAnonymousTree(mRootNode, aElement)) {
// Either we're already dirty or this notification doesn't affect
// whether we might match aElement.
@ -943,7 +932,7 @@ bool
nsContentList::MatchSelf(nsIContent *aContent)
{
NS_PRECONDITION(aContent, "Can't match null stuff, you know");
NS_PRECONDITION(mDeep || aContent->GetNodeParent() == mRootNode,
NS_PRECONDITION(mDeep || aContent->GetParentNode() == mRootNode,
"MatchSelf called on a node that we can't possibly match");
if (!aContent->IsElement()) {

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

@ -479,6 +479,7 @@ typedef void* (*nsFuncStringContentListDataAllocator)(nsINode* aRootNode,
const nsString* aString);
// aDestroyFunc is allowed to be null
// aDataAllocator must always return a non-null pointer
class nsCacheableFuncStringContentList : public nsContentList {
public:
virtual ~nsCacheableFuncStringContentList();
@ -488,8 +489,6 @@ public:
mString == aKey->mString;
}
bool AllocatedData() const { return !!mData; }
#ifdef DEBUG
enum ContentListType {
eNodeList,
@ -508,6 +507,7 @@ protected:
mString(aString)
{
mData = (*aDataAllocator)(aRootNode, &mString);
MOZ_ASSERT(mData);
}
virtual void RemoveFromCaches() {

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

@ -44,7 +44,6 @@
#include "nsIParser.h"
#include "nsIFragmentContentSink.h"
#include "nsIContentSink.h"
#include "nsContentList.h"
#include "nsIHTMLDocument.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMHTMLElement.h"
@ -1676,7 +1675,7 @@ nsContentUtils::InProlog(nsINode *aNode)
{
NS_PRECONDITION(aNode, "missing node to nsContentUtils::InProlog");
nsINode* parent = aNode->GetNodeParent();
nsINode* parent = aNode->GetParentNode();
if (!parent || !parent->IsNodeOfType(nsINode::eDOCUMENT)) {
return false;
}
@ -1812,7 +1811,7 @@ nsContentUtils::GetCrossDocParentNode(nsINode* aChild)
{
NS_PRECONDITION(aChild, "The child is null!");
nsINode* parent = aChild->GetNodeParent();
nsINode* parent = aChild->GetParentNode();
if (parent || !aChild->IsNodeOfType(nsINode::eDOCUMENT))
return parent;
@ -1832,7 +1831,7 @@ nsContentUtils::ContentIsDescendantOf(const nsINode* aPossibleDescendant,
do {
if (aPossibleDescendant == aPossibleAncestor)
return true;
aPossibleDescendant = aPossibleDescendant->GetNodeParent();
aPossibleDescendant = aPossibleDescendant->GetParentNode();
} while (aPossibleDescendant);
return false;
@ -1863,7 +1862,7 @@ nsContentUtils::GetAncestors(nsINode* aNode,
{
while (aNode) {
aArray.AppendElement(aNode);
aNode = aNode->GetNodeParent();
aNode = aNode->GetParentNode();
}
return NS_OK;
}
@ -1942,11 +1941,11 @@ nsContentUtils::GetCommonAncestor(nsINode* aNode1,
nsAutoTArray<nsINode*, 30> parents1, parents2;
do {
parents1.AppendElement(aNode1);
aNode1 = aNode1->GetNodeParent();
aNode1 = aNode1->GetParentNode();
} while (aNode1);
do {
parents2.AppendElement(aNode2);
aNode2 = aNode2->GetNodeParent();
aNode2 = aNode2->GetParentNode();
} while (aNode2);
// Find where the parent chain differs
@ -1983,11 +1982,11 @@ nsContentUtils::ComparePoints(nsINode* aParent1, int32_t aOffset1,
nsINode* node2 = aParent2;
do {
parents1.AppendElement(node1);
node1 = node1->GetNodeParent();
node1 = node1->GetParentNode();
} while (node1);
do {
parents2.AppendElement(node2);
node2 = node2->GetNodeParent();
node2 = node2->GetParentNode();
} while (node2);
uint32_t pos1 = parents1.Length() - 1;
@ -2341,12 +2340,12 @@ nsContentUtils::GenerateStateKey(nsIContent* aContent,
// Now start at aContent and append the indices of it and all its ancestors
// in their containers. That should at least pin down its position in the
// DOM...
nsINode* parent = aContent->GetNodeParent();
nsINode* parent = aContent->GetParentNode();
nsINode* content = aContent;
while (parent) {
KeyAppendInt(parent->IndexOf(content), aKey);
content = parent;
parent = content->GetNodeParent();
parent = content->GetParentNode();
}
}
@ -3859,7 +3858,7 @@ nsContentUtils::HasMutationListeners(nsINode* aNode,
continue;
}
}
aNode = aNode->GetNodeParent();
aNode = aNode->GetParentNode();
}
return false;
@ -3883,7 +3882,7 @@ nsContentUtils::MaybeFireNodeRemoved(nsINode* aChild, nsINode* aParent,
nsIDocument* aOwnerDoc)
{
NS_PRECONDITION(aChild, "Missing child");
NS_PRECONDITION(aChild->GetNodeParent() == aParent, "Wrong parent");
NS_PRECONDITION(aChild->GetParentNode() == aParent, "Wrong parent");
NS_PRECONDITION(aChild->OwnerDoc() == aOwnerDoc, "Wrong owner-doc");
// This checks that IsSafeToRunScript is true since we don't want to fire
@ -4383,7 +4382,7 @@ nsContentUtils::SetNodeTextContent(nsIContent* aContent,
nsCOMPtr<nsINode> child;
bool skipFirst = aTryReuse;
for (child = aContent->GetFirstChild();
child && child->GetNodeParent() == aContent;
child && child->GetParentNode() == aContent;
child = child->GetNextSibling()) {
if (skipFirst && child->IsNodeOfType(nsINode::eTEXT)) {
skipFirst = false;
@ -6245,9 +6244,10 @@ struct ClassMatchingInfo {
nsCaseTreatment mCaseTreatment;
};
static bool
MatchClassNames(nsIContent* aContent, int32_t aNamespaceID, nsIAtom* aAtom,
void* aData)
// static
bool
nsContentUtils::MatchClassNames(nsIContent* aContent, int32_t aNamespaceID,
nsIAtom* aAtom, void* aData)
{
// We can't match if there are no class names
const nsAttrValue* classAttr = aContent->GetClasses();
@ -6273,23 +6273,23 @@ MatchClassNames(nsIContent* aContent, int32_t aNamespaceID, nsIAtom* aAtom,
return true;
}
static void
DestroyClassNameArray(void* aData)
// static
void
nsContentUtils::DestroyClassNameArray(void* aData)
{
ClassMatchingInfo* info = static_cast<ClassMatchingInfo*>(aData);
delete info;
}
static void*
AllocClassMatchingInfo(nsINode* aRootNode,
const nsString* aClasses)
// static
void*
nsContentUtils::AllocClassMatchingInfo(nsINode* aRootNode,
const nsString* aClasses)
{
nsAttrValue attrValue;
attrValue.ParseAtomArray(*aClasses);
// nsAttrValue::Equals is sensitive to order, so we'll send an array
ClassMatchingInfo* info = new ClassMatchingInfo;
NS_ENSURE_TRUE(info, nullptr);
if (attrValue.Type() == nsAttrValue::eAtomArray) {
info->mClasses.SwapElements(*(attrValue.GetAtomArrayValue()));
} else if (attrValue.Type() == nsAttrValue::eAtom) {
@ -6304,26 +6304,6 @@ AllocClassMatchingInfo(nsINode* aRootNode,
// static
nsresult
nsContentUtils::GetElementsByClassName(nsINode* aRootNode,
const nsAString& aClasses,
nsIDOMNodeList** aReturn)
{
NS_PRECONDITION(aRootNode, "Must have root node");
nsContentList* elements =
NS_GetFuncStringHTMLCollection(aRootNode, MatchClassNames,
DestroyClassNameArray,
AllocClassMatchingInfo,
aClasses).get();
NS_ENSURE_TRUE(elements, NS_ERROR_OUT_OF_MEMORY);
// Transfer ownership
*aReturn = elements;
return NS_OK;
}
#ifdef DEBUG
class DebugWrapperTraversalCallback : public nsCycleCollectionTraversalCallback
{

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

@ -3,6 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Assertions.h"
#include "mozilla/LinkedList.h"
#include "nsCrossSiteListenerProxy.h"
#include "nsIChannel.h"
#include "nsIHttpChannel.h"
@ -19,7 +22,6 @@
#include "nsIAsyncVerifyRedirectCallback.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsAsyncRedirectVerifyHelper.h"
#include "prclist.h"
#include "prtime.h"
#include "nsClassHashtable.h"
#include "nsHashKeys.h"
@ -45,7 +47,7 @@ public:
PRTime expirationTime;
};
struct CacheEntry : public PRCList
struct CacheEntry : public LinkedListElement<CacheEntry>
{
CacheEntry(nsCString& aKey)
: mKey(aKey)
@ -70,7 +72,6 @@ public:
nsPreflightCache()
{
MOZ_COUNT_CTOR(nsPreflightCache);
PR_INIT_CLIST(&mList);
}
~nsPreflightCache()
@ -100,7 +101,7 @@ private:
bool aWithCredentials, nsACString& _retval);
nsClassHashtable<nsCStringHashKey, CacheEntry> mTable;
PRCList mList;
LinkedList<CacheEntry> mList;
};
// Will be initialized in EnsurePreflightCache.
@ -188,8 +189,8 @@ nsPreflightCache::GetEntry(nsIURI* aURI,
// Entry already existed so just return it. Also update the LRU list.
// Move to the head of the list.
PR_REMOVE_LINK(entry);
PR_INSERT_LINK(entry, &mList);
entry->remove();
mList.insertFront(entry);
return entry;
}
@ -218,8 +219,8 @@ nsPreflightCache::GetEntry(nsIURI* aURI,
// If that didn't remove anything then kick out the least recently used
// entry.
if (mTable.Count() == PREFLIGHT_CACHE_SIZE) {
CacheEntry* lruEntry = static_cast<CacheEntry*>(PR_LIST_TAIL(&mList));
PR_REMOVE_LINK(lruEntry);
CacheEntry* lruEntry = static_cast<CacheEntry*>(mList.popLast());
MOZ_ASSERT(lruEntry);
// This will delete 'lruEntry'.
mTable.Remove(lruEntry->mKey);
@ -230,7 +231,7 @@ nsPreflightCache::GetEntry(nsIURI* aURI,
}
mTable.Put(key, entry);
PR_INSERT_LINK(entry, &mList);
mList.insertFront(entry);
return entry;
}
@ -242,13 +243,13 @@ nsPreflightCache::RemoveEntries(nsIURI* aURI, nsIPrincipal* aPrincipal)
nsCString key;
if (GetCacheKey(aURI, aPrincipal, true, key) &&
mTable.Get(key, &entry)) {
PR_REMOVE_LINK(entry);
entry->remove();
mTable.Remove(key);
}
if (GetCacheKey(aURI, aPrincipal, false, key) &&
mTable.Get(key, &entry)) {
PR_REMOVE_LINK(entry);
entry->remove();
mTable.Remove(key);
}
}
@ -256,7 +257,7 @@ nsPreflightCache::RemoveEntries(nsIURI* aURI, nsIPrincipal* aPrincipal)
void
nsPreflightCache::Clear()
{
PR_INIT_CLIST(&mList);
mList.clear();
mTable.Clear();
}
@ -272,7 +273,7 @@ nsPreflightCache::RemoveExpiredEntries(const nsACString& aKey,
if (aValue->mHeaders.IsEmpty() &&
aValue->mMethods.IsEmpty()) {
// Expired, remove from the list as well as the hash table.
PR_REMOVE_LINK(aValue);
aValue->remove();
return PL_DHASH_REMOVE;
}

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

@ -29,6 +29,7 @@
#include "nsAsyncDOMEvent.h"
#include "nsWrapperCacheInlines.h"
using namespace mozilla;
using namespace mozilla::dom;
//----------------------------------------------------------------------
@ -210,167 +211,20 @@ nsDOMAttribute::GetOwnerElement(nsIDOMElement** aOwnerElement)
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::GetNodeName(nsAString& aNodeName)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeName);
return GetName(aNodeName);
}
NS_IMETHODIMP
nsDOMAttribute::GetNodeValue(nsAString& aNodeValue)
void
nsDOMAttribute::GetNodeValueInternal(nsAString& aNodeValue)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeValue);
return GetValue(aNodeValue);
GetValue(aNodeValue);
}
NS_IMETHODIMP
nsDOMAttribute::SetNodeValue(const nsAString& aNodeValue)
void
nsDOMAttribute::SetNodeValueInternal(const nsAString& aNodeValue, ErrorResult& aError)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeValue);
return SetValue(aNodeValue);
}
NS_IMETHODIMP
nsDOMAttribute::GetNodeType(uint16_t* aNodeType)
{
NS_ENSURE_ARG_POINTER(aNodeType);
OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeType);
*aNodeType = (uint16_t)nsIDOMNode::ATTRIBUTE_NODE;
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::GetParentNode(nsIDOMNode** aParentNode)
{
NS_ENSURE_ARG_POINTER(aParentNode);
OwnerDoc()->WarnOnceAbout(nsIDocument::eParentNode);
*aParentNode = nullptr;
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::GetParentElement(nsIDOMElement** aParentElement)
{
*aParentElement = nullptr;
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::GetChildNodes(nsIDOMNodeList** aChildNodes)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eChildNodes);
return nsINode::GetChildNodes(aChildNodes);
}
NS_IMETHODIMP
nsDOMAttribute::HasChildNodes(bool* aHasChildNodes)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eHasChildNodes);
*aHasChildNodes = false;
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::HasAttributes(bool* aHasAttributes)
{
NS_ENSURE_ARG_POINTER(aHasAttributes);
OwnerDoc()->WarnOnceAbout(nsIDocument::eHasAttributes);
*aHasAttributes = false;
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::GetFirstChild(nsIDOMNode** aFirstChild)
{
*aFirstChild = nullptr;
OwnerDoc()->WarnOnceAbout(nsIDocument::eFirstChild);
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::GetLastChild(nsIDOMNode** aLastChild)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eLastChild);
return GetFirstChild(aLastChild);
}
NS_IMETHODIMP
nsDOMAttribute::GetPreviousSibling(nsIDOMNode** aPreviousSibling)
{
NS_ENSURE_ARG_POINTER(aPreviousSibling);
OwnerDoc()->WarnOnceAbout(nsIDocument::ePreviousSibling);
*aPreviousSibling = nullptr;
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::GetNextSibling(nsIDOMNode** aNextSibling)
{
NS_ENSURE_ARG_POINTER(aNextSibling);
OwnerDoc()->WarnOnceAbout(nsIDocument::eNextSibling);
*aNextSibling = nullptr;
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
{
NS_ENSURE_ARG_POINTER(aAttributes);
OwnerDoc()->WarnOnceAbout(nsIDocument::eAttributes);
*aAttributes = nullptr;
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eInsertBefore);
return ReplaceOrInsertBefore(false, aNewChild, aRefChild, aReturn);
}
NS_IMETHODIMP
nsDOMAttribute::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eReplaceChild);
return ReplaceOrInsertBefore(true, aNewChild, aOldChild, aReturn);
}
NS_IMETHODIMP
nsDOMAttribute::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eRemoveChild);
return nsINode::RemoveChild(aOldChild, aReturn);
}
NS_IMETHODIMP
nsDOMAttribute::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eAppendChild);
return InsertBefore(aNewChild, nullptr, aReturn);
aError = SetValue(aNodeValue);
}
nsresult
@ -390,67 +244,6 @@ nsDOMAttribute::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::CloneNode(bool aDeep, uint8_t aOptionalArgc, nsIDOMNode** aResult)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eCloneNode);
if (!aOptionalArgc) {
aDeep = true;
}
return nsNodeUtils::CloneNodeImpl(this, aDeep, true, aResult);
}
NS_IMETHODIMP
nsDOMAttribute::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eOwnerDocument);
return nsINode::GetOwnerDocument(aOwnerDocument);
}
NS_IMETHODIMP
nsDOMAttribute::GetNamespaceURI(nsAString& aNamespaceURI)
{
return mNodeInfo->GetNamespaceURI(aNamespaceURI);
}
NS_IMETHODIMP
nsDOMAttribute::GetPrefix(nsAString& aPrefix)
{
mNodeInfo->GetPrefix(aPrefix);
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::GetLocalName(nsAString& aLocalName)
{
mNodeInfo->GetName(aLocalName);
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::Normalize()
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eNormalize);
// Nothing to do here
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::IsSupported(const nsAString& aFeature,
const nsAString& aVersion,
bool* aReturn)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eIsSupported);
*aReturn = nsContentUtils::InternalIsSupported(static_cast<nsIDOMAttr*>(this),
aFeature, aVersion);
return NS_OK;
}
already_AddRefed<nsIURI>
nsDOMAttribute::GetBaseURI() const
{
@ -459,85 +252,21 @@ nsDOMAttribute::GetBaseURI() const
return parent ? parent->GetBaseURI() : nullptr;
}
NS_IMETHODIMP
nsDOMAttribute::GetDOMBaseURI(nsAString &aURI)
{
return nsINode::GetDOMBaseURI(aURI);
}
NS_IMETHODIMP
nsDOMAttribute::CompareDocumentPosition(nsIDOMNode *other,
uint16_t *aResult)
{
return nsINode::CompareDocumentPosition(other, aResult);
}
NS_IMETHODIMP
nsDOMAttribute::IsEqualNode(nsIDOMNode* aOther, bool* aResult)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eIsEqualNode);
return nsINode::IsEqualNode(aOther, aResult);
}
NS_IMETHODIMP
nsDOMAttribute::GetTextContent(nsAString &aTextContent)
void
nsDOMAttribute::GetTextContentInternal(nsAString& aTextContent)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eTextContent);
return GetNodeValue(aTextContent);
GetValue(aTextContent);
}
NS_IMETHODIMP
nsDOMAttribute::SetTextContent(const nsAString& aTextContent)
void
nsDOMAttribute::SetTextContentInternal(const nsAString& aTextContent,
ErrorResult& aError)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eTextContent);
return SetNodeValue(aTextContent);
}
NS_IMETHODIMP
nsDOMAttribute::Contains(nsIDOMNode* aOther, bool* aReturn)
{
return nsINode::Contains(aOther, aReturn);
}
NS_IMETHODIMP
nsDOMAttribute::LookupPrefix(const nsAString & namespaceURI,
nsAString & aResult)
{
SetDOMStringToNull(aResult);
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::IsDefaultNamespace(const nsAString & namespaceURI,
bool *aResult)
{
*aResult = namespaceURI.IsEmpty();
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::LookupNamespaceURI(const nsAString & prefix,
nsAString & aResult)
{
SetDOMStringToNull(aResult);
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::SetUserData(const nsAString & key,
nsIVariant *data, nsIDOMUserDataHandler *handler,
nsIVariant **aResult)
{
return nsINode::SetUserData(key, data, handler, aResult);
}
NS_IMETHODIMP
nsDOMAttribute::GetUserData(const nsAString & key, nsIVariant **aResult)
{
return nsINode::GetUserData(key, aResult);
SetNodeValueInternal(aTextContent, aError);
}
NS_IMETHODIMP

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

@ -36,7 +36,13 @@ public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
// nsIDOMNode interface
NS_DECL_NSIDOMNODE
NS_FORWARD_NSIDOMNODE_TO_NSINODE
virtual void GetTextContentInternal(nsAString& aTextContent);
virtual void SetTextContentInternal(const nsAString& aTextContent,
mozilla::ErrorResult& aError);
virtual void GetNodeValueInternal(nsAString& aNodeValue);
virtual void SetNodeValueInternal(const nsAString& aNodeValue,
mozilla::ErrorResult& aError);
// nsIDOMAttr interface
NS_DECL_NSIDOMATTR

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

@ -31,7 +31,7 @@ public:
}
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericDOMDataNode::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
};
class nsDOMDocumentType : public nsDOMDocumentTypeForward
@ -53,19 +53,16 @@ public:
// nsIDOMDocumentType
NS_DECL_NSIDOMDOCUMENTTYPE
NS_IMETHODIMP GetNodeValue(nsAString& aNodeValue)
{
SetDOMStringToNull(aNodeValue);
return NS_OK;
}
NS_IMETHODIMP SetNodeValue(const nsAString& aNodeValue)
{
return NS_OK;
}
// nsINode
virtual bool IsNodeOfType(uint32_t aFlags) const;
virtual void GetNodeValueInternal(nsAString& aNodeValue)
{
SetDOMStringToNull(aNodeValue);
}
virtual void SetNodeValueInternal(const nsAString& aNodeValue,
mozilla::ErrorResult& aError)
{
}
// nsIContent overrides
virtual const nsTextFragment* GetText();

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

@ -485,7 +485,7 @@ nsDOMMutationObserver::GetAllSubtreeObserversFor(nsINode* aNode,
}
}
}
n = n->GetNodeParent();
n = n->GetParentNode();
}
}

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

@ -3034,7 +3034,8 @@ NS_IMETHODIMP
nsDocument::GetElementsByClassName(const nsAString& aClasses,
nsIDOMNodeList** aReturn)
{
return nsContentUtils::GetElementsByClassName(this, aClasses, aReturn);
*aReturn = nsContentUtils::GetElementsByClassName(this, aClasses).get();
return NS_OK;
}
NS_IMETHODIMP
@ -3495,7 +3496,7 @@ nsDocument::IsNodeOfType(uint32_t aFlags) const
Element*
nsIDocument::GetRootElement() const
{
return (mCachedRootElement && mCachedRootElement->GetNodeParent() == this) ?
return (mCachedRootElement && mCachedRootElement->GetParentNode() == this) ?
mCachedRootElement : GetRootElementInternal();
}
@ -4980,7 +4981,7 @@ nsDocument::ImportNode(nsIDOMNode* aImportedNode,
case nsIDOMNode::COMMENT_NODE:
case nsIDOMNode::DOCUMENT_TYPE_NODE:
{
nsCOMPtr<nsIDOMNode> newNode;
nsCOMPtr<nsINode> newNode;
nsCOMArray<nsINode> nodesWithProperties;
rv = nsNodeUtils::Clone(imported, aDeep, mNodeInfoManager,
nodesWithProperties, getter_AddRefs(newNode));
@ -4992,8 +4993,7 @@ nsDocument::ImportNode(nsIDOMNode* aImportedNode,
true);
NS_ENSURE_SUCCESS(rv, rv);
newNode.swap(*aResult);
*aResult = newNode.forget().get()->AsDOMNode();
return NS_OK;
}
default:
@ -5795,267 +5795,6 @@ nsDocument::SetDir(const nsAString& aDirection)
return NS_OK;
}
//
// nsIDOMNode methods
//
NS_IMETHODIMP
nsDocument::GetNodeName(nsAString& aNodeName)
{
aNodeName.AssignLiteral("#document");
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetNodeValue(nsAString& aNodeValue)
{
SetDOMStringToNull(aNodeValue);
return NS_OK;
}
NS_IMETHODIMP
nsDocument::SetNodeValue(const nsAString& aNodeValue)
{
// The DOM spec says that when nodeValue is defined to be null "setting it
// has no effect", so we don't throw an exception.
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetNodeType(uint16_t* aNodeType)
{
*aNodeType = nsIDOMNode::DOCUMENT_NODE;
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetParentNode(nsIDOMNode** aParentNode)
{
*aParentNode = nullptr;
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetParentElement(nsIDOMElement** aParentElement)
{
*aParentElement = nullptr;
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetChildNodes(nsIDOMNodeList** aChildNodes)
{
return nsINode::GetChildNodes(aChildNodes);
}
NS_IMETHODIMP
nsDocument::HasChildNodes(bool* aHasChildNodes)
{
NS_ENSURE_ARG(aHasChildNodes);
*aHasChildNodes = (mChildren.ChildCount() != 0);
return NS_OK;
}
NS_IMETHODIMP
nsDocument::HasAttributes(bool* aHasAttributes)
{
NS_ENSURE_ARG(aHasAttributes);
*aHasAttributes = false;
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetFirstChild(nsIDOMNode** aFirstChild)
{
return nsINode::GetFirstChild(aFirstChild);
}
NS_IMETHODIMP
nsDocument::GetLastChild(nsIDOMNode** aLastChild)
{
return nsINode::GetLastChild(aLastChild);
}
NS_IMETHODIMP
nsDocument::GetPreviousSibling(nsIDOMNode** aPreviousSibling)
{
*aPreviousSibling = nullptr;
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetNextSibling(nsIDOMNode** aNextSibling)
{
*aNextSibling = nullptr;
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
{
*aAttributes = nullptr;
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetNamespaceURI(nsAString& aNamespaceURI)
{
SetDOMStringToNull(aNamespaceURI);
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetPrefix(nsAString& aPrefix)
{
SetDOMStringToNull(aPrefix);
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetLocalName(nsAString& aLocalName)
{
SetDOMStringToNull(aLocalName);
return NS_OK;
}
NS_IMETHODIMP
nsDocument::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild,
nsIDOMNode** aReturn)
{
return ReplaceOrInsertBefore(false, aNewChild, aRefChild, aReturn);
}
NS_IMETHODIMP
nsDocument::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild,
nsIDOMNode** aReturn)
{
return ReplaceOrInsertBefore(true, aNewChild, aOldChild, aReturn);
}
NS_IMETHODIMP
nsDocument::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
{
return nsINode::RemoveChild(aOldChild, aReturn);
}
NS_IMETHODIMP
nsDocument::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
{
return nsDocument::InsertBefore(aNewChild, nullptr, aReturn);
}
NS_IMETHODIMP
nsDocument::CloneNode(bool aDeep, uint8_t aOptionalArgc, nsIDOMNode** aReturn)
{
if (!aOptionalArgc) {
aDeep = true;
}
return nsNodeUtils::CloneNodeImpl(this, aDeep, !mCreatingStaticClone, aReturn);
}
NS_IMETHODIMP
nsDocument::Normalize()
{
return nsIDocument::Normalize();
}
NS_IMETHODIMP
nsDocument::IsSupported(const nsAString& aFeature, const nsAString& aVersion,
bool* aReturn)
{
*aReturn = nsContentUtils::InternalIsSupported(static_cast<nsIDOMDocument*>(this),
aFeature, aVersion);
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetDOMBaseURI(nsAString &aURI)
{
return nsIDocument::GetDOMBaseURI(aURI);
}
NS_IMETHODIMP
nsDocument::GetTextContent(nsAString &aTextContent)
{
SetDOMStringToNull(aTextContent);
return NS_OK;
}
NS_IMETHODIMP
nsDocument::IsEqualNode(nsIDOMNode* aOther, bool* aResult)
{
return nsINode::IsEqualNode(aOther, aResult);
}
NS_IMETHODIMP
nsDocument::CompareDocumentPosition(nsIDOMNode *other,
uint16_t *aResult)
{
return nsINode::CompareDocumentPosition(other, aResult);
}
NS_IMETHODIMP
nsDocument::SetTextContent(const nsAString & aTextContent)
{
return nsINode::SetTextContent(aTextContent);
}
NS_IMETHODIMP
nsDocument::LookupPrefix(const nsAString & namespaceURI, nsAString & aResult)
{
return nsINode::LookupPrefix(namespaceURI, aResult);
}
NS_IMETHODIMP
nsDocument::IsDefaultNamespace(const nsAString & namespaceURI,
bool *aResult)
{
return nsINode::IsDefaultNamespace(namespaceURI, aResult);
}
NS_IMETHODIMP
nsDocument::LookupNamespaceURI(const nsAString & prefix,
nsAString & aResult)
{
return nsINode::LookupNamespaceURI(prefix, aResult);
}
NS_IMETHODIMP
nsDocument::SetUserData(const nsAString & key,
nsIVariant *data, nsIDOMUserDataHandler *handler,
nsIVariant **aResult)
{
return nsINode::SetUserData(key, data, handler, aResult);
}
NS_IMETHODIMP
nsDocument::GetUserData(const nsAString & key,
nsIVariant **aResult)
{
return nsINode::GetUserData(key, aResult);
}
NS_IMETHODIMP
nsDocument::Contains(nsIDOMNode* aOther, bool* aReturn)
{
return nsINode::Contains(aOther, aReturn);
}
NS_IMETHODIMP
nsDocument::GetInputEncoding(nsAString& aInputEncoding)
{
@ -6273,7 +6012,7 @@ nsDocument::AdoptNode(nsIDOMNode *aAdoptedNode, nsIDOMNode **aResult)
// Scope firing mutation events so that we don't carry any state that
// might be stale
{
nsINode* parent = adoptedNode->GetNodeParent();
nsINode* parent = adoptedNode->GetParentNode();
if (parent) {
nsContentUtils::MaybeFireNodeRemoved(adoptedNode, parent,
adoptedNode->OwnerDoc());
@ -6330,7 +6069,7 @@ nsDocument::AdoptNode(nsIDOMNode *aAdoptedNode, nsIDOMNode **aResult)
} while ((doc = doc->GetParentDocument()));
// Remove from parent.
nsCOMPtr<nsINode> parent = adoptedNode->GetNodeParent();
nsCOMPtr<nsINode> parent = adoptedNode->GetParentNode();
if (parent) {
parent->RemoveChildAt(parent->IndexOf(adoptedNode), true);
}
@ -6416,12 +6155,6 @@ nsDocument::AdoptNode(nsIDOMNode *aAdoptedNode, nsIDOMNode **aResult)
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
{
return nsINode::GetOwnerDocument(aOwnerDocument);
}
nsEventListenerManager*
nsDocument::GetListenerManager(bool aCreateIfNotFound)
{

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

@ -735,7 +735,7 @@ private:
public:
// nsIDOMNode
NS_DECL_NSIDOMNODE
NS_FORWARD_NSIDOMNODE_TO_NSINODE_OVERRIDABLE
// nsIDOMDocument
NS_DECL_NSIDOMDOCUMENT

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

@ -535,7 +535,7 @@ nsDocumentEncoder::SerializeToStringIterative(nsINode* aNode,
node = current->GetNextSibling();
if (!node) {
// Perhaps parent node has siblings.
current = current->GetNodeParent();
current = current->GetParentNode();
}
}
}
@ -1091,7 +1091,7 @@ nsDocumentEncoder::EncodeToString(nsAString& aOutputString)
if (!prevNode) {
// Went from a non-<tr> to a <tr>
mCommonAncestors.Clear();
nsContentUtils::GetAncestors(n->GetNodeParent(), mCommonAncestors);
nsContentUtils::GetAncestors(n->GetParentNode(), mCommonAncestors);
rv = SerializeRangeContextStart(mCommonAncestors, output);
NS_ENSURE_SUCCESS(rv, rv);
// Don't let SerializeRangeToString serialize the context again
@ -1104,7 +1104,7 @@ nsDocumentEncoder::EncodeToString(nsAString& aOutputString)
} else if (prevNode) {
// Went from a <tr> to a non-<tr>
mCommonAncestors.Clear();
nsContentUtils::GetAncestors(p->GetNodeParent(), mCommonAncestors);
nsContentUtils::GetAncestors(p->GetParentNode(), mCommonAncestors);
mDisableContextSerialize = false;
rv = SerializeRangeContextEnd(mCommonAncestors, output);
NS_ENSURE_SUCCESS(rv, rv);
@ -1122,7 +1122,7 @@ nsDocumentEncoder::EncodeToString(nsAString& aOutputString)
rv = SerializeNodeEnd(p, output);
NS_ENSURE_SUCCESS(rv, rv);
mCommonAncestors.Clear();
nsContentUtils::GetAncestors(p->GetNodeParent(), mCommonAncestors);
nsContentUtils::GetAncestors(p->GetParentNode(), mCommonAncestors);
mDisableContextSerialize = false;
rv = SerializeRangeContextEnd(mCommonAncestors, output);
NS_ENSURE_SUCCESS(rv, rv);

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

@ -31,7 +31,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// interface nsIDOMNode
NS_FORWARD_NSIDOMNODE(FragmentOrElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// interface nsIDOMDocumentFragment
// NS_DECL_NSIDOCUMENTFRAGMENT Empty

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

@ -114,43 +114,19 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(nsGenericDOMDataNode,
nsNodeUtils::LastRelease(this))
nsresult
nsGenericDOMDataNode::GetNodeValue(nsAString& aNodeValue)
void
nsGenericDOMDataNode::GetNodeValueInternal(nsAString& aNodeValue)
{
return GetData(aNodeValue);
DebugOnly<nsresult> rv = GetData(aNodeValue);
NS_ASSERTION(NS_SUCCEEDED(rv), "GetData() failed!");
}
nsresult
nsGenericDOMDataNode::SetNodeValue(const nsAString& aNodeValue)
void
nsGenericDOMDataNode::SetNodeValueInternal(const nsAString& aNodeValue,
ErrorResult& aError)
{
return SetTextInternal(0, mText.GetLength(), aNodeValue.BeginReading(),
aNodeValue.Length(), true);
}
nsresult
nsGenericDOMDataNode::GetNamespaceURI(nsAString& aNamespaceURI)
{
SetDOMStringToNull(aNamespaceURI);
return NS_OK;
}
nsresult
nsGenericDOMDataNode::GetPrefix(nsAString& aPrefix)
{
SetDOMStringToNull(aPrefix);
return NS_OK;
}
nsresult
nsGenericDOMDataNode::IsSupported(const nsAString& aFeature,
const nsAString& aVersion,
bool* aReturn)
{
*aReturn = nsContentUtils::InternalIsSupported(static_cast<nsIContent*>(this),
aFeature, aVersion);
return NS_OK;
aError = SetTextInternal(0, mText.GetLength(), aNodeValue.BeginReading(),
aNodeValue.Length(), true);
}
//----------------------------------------------------------------------
@ -746,7 +722,7 @@ nsGenericDOMDataNode::SplitData(uint32_t aOffset, nsIContent** aReturn,
return rv;
}
nsCOMPtr<nsINode> parent = GetNodeParent();
nsCOMPtr<nsINode> parent = GetParentNode();
if (parent) {
int32_t insertionIndex = parent->IndexOf(this);
if (aCloneAfterOriginal) {

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

@ -58,73 +58,9 @@ public:
nsGenericDOMDataNode(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~nsGenericDOMDataNode();
// Implementation for nsIDOMNode
nsresult GetNodeName(nsAString& aNodeName)
{
aNodeName = NodeName();
return NS_OK;
}
nsresult GetNodeType(uint16_t* aNodeType)
{
*aNodeType = NodeType();
return NS_OK;
}
nsresult GetNodeValue(nsAString& aNodeValue);
nsresult SetNodeValue(const nsAString& aNodeValue);
nsresult GetAttributes(nsIDOMNamedNodeMap** aAttributes)
{
NS_ENSURE_ARG_POINTER(aAttributes);
*aAttributes = nullptr;
return NS_OK;
}
nsresult HasChildNodes(bool* aHasChildNodes)
{
NS_ENSURE_ARG_POINTER(aHasChildNodes);
*aHasChildNodes = false;
return NS_OK;
}
nsresult HasAttributes(bool* aHasAttributes)
{
NS_ENSURE_ARG_POINTER(aHasAttributes);
*aHasAttributes = false;
return NS_OK;
}
nsresult InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild,
nsIDOMNode** aReturn)
{
return ReplaceOrInsertBefore(false, aNewChild, aRefChild, aReturn);
}
nsresult ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild,
nsIDOMNode** aReturn)
{
return ReplaceOrInsertBefore(true, aNewChild, aOldChild, aReturn);
}
nsresult RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
{
return nsINode::RemoveChild(aOldChild, aReturn);
}
nsresult AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
{
return InsertBefore(aNewChild, nullptr, aReturn);
}
nsresult GetNamespaceURI(nsAString& aNamespaceURI);
nsresult GetLocalName(nsAString& aLocalName)
{
aLocalName = LocalName();
return NS_OK;
}
nsresult GetPrefix(nsAString& aPrefix);
nsresult IsSupported(const nsAString& aFeature,
const nsAString& aVersion,
bool* aReturn);
nsresult CloneNode(bool aDeep, uint8_t aOptionalArgc, nsIDOMNode** aReturn)
{
if (!aOptionalArgc) {
aDeep = true;
}
return nsNodeUtils::CloneNodeImpl(this, aDeep, true, aReturn);
}
virtual void GetNodeValueInternal(nsAString& aNodeValue);
virtual void SetNodeValueInternal(const nsAString& aNodeValue,
mozilla::ErrorResult& aError);
// Implementation for nsIDOMCharacterData
nsresult GetData(nsAString& aData) const;
@ -142,21 +78,20 @@ public:
virtual uint32_t GetChildCount() const;
virtual nsIContent *GetChildAt(uint32_t aIndex) const;
virtual nsIContent * const * GetChildArray(uint32_t* aChildCount) const;
virtual int32_t IndexOf(const nsINode* aPossibleChild) const MOZ_OVERRIDE;
virtual int32_t IndexOf(const nsINode* aPossibleChild) const;
virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
bool aNotify);
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify);
NS_IMETHOD GetTextContent(nsAString &aTextContent)
virtual void GetTextContentInternal(nsAString& aTextContent)
{
nsresult rv = GetNodeValue(aTextContent);
NS_ASSERTION(NS_SUCCEEDED(rv), "GetNodeValue() failed?");
return rv;
GetNodeValue(aTextContent);
}
NS_IMETHOD SetTextContent(const nsAString& aTextContent)
virtual void SetTextContentInternal(const nsAString& aTextContent,
mozilla::ErrorResult& aError)
{
// Batch possible DOMSubtreeModified events.
mozAutoSubtreeModified subtree(OwnerDoc(), nullptr);
return SetNodeValue(aTextContent);
return SetNodeValue(aTextContent, aError);
}
// Implementation for nsIContent
@ -244,7 +179,7 @@ public:
protected:
virtual mozilla::dom::Element* GetNameSpaceElement()
{
nsINode *parent = GetNodeParent();
nsINode *parent = GetParentNode();
return parent && parent->IsElement() ? parent->AsElement() : nullptr;
}

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

@ -809,9 +809,10 @@ nsGenericElement::GetBoundingClientRect(nsIDOMClientRect** aResult)
NS_IMETHODIMP
nsGenericElement::GetElementsByClassName(const nsAString& aClasses,
nsIDOMNodeList** aReturn)
nsIDOMHTMLCollection** aReturn)
{
return nsContentUtils::GetElementsByClassName(this, aClasses, aReturn);
*aReturn = nsContentUtils::GetElementsByClassName(this, aClasses).get();
return NS_OK;
}
NS_IMETHODIMP
@ -933,12 +934,11 @@ nsGenericElement::GetAttributeNode(const nsAString& aName,
document->WarnOnceAbout(nsIDocument::eGetAttributeNode);
}
nsCOMPtr<nsIDOMNamedNodeMap> map;
nsresult rv = GetAttributes(getter_AddRefs(map));
NS_ENSURE_SUCCESS(rv, rv);
nsDOMAttributeMap* map = GetAttributes();
NS_ENSURE_TRUE(map, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMNode> node;
rv = map->GetNamedItem(aName, getter_AddRefs(node));
nsresult rv = map->GetNamedItem(aName, getter_AddRefs(node));
if (NS_SUCCEEDED(rv) && node) {
rv = CallQueryInterface(node, aReturn);
@ -958,12 +958,11 @@ nsGenericElement::SetAttributeNode(nsIDOMAttr* aAttribute,
OwnerDoc()->WarnOnceAbout(nsIDocument::eSetAttributeNode);
nsCOMPtr<nsIDOMNamedNodeMap> map;
nsresult rv = GetAttributes(getter_AddRefs(map));
NS_ENSURE_SUCCESS(rv, rv);
nsDOMAttributeMap* map = GetAttributes();
NS_ENSURE_TRUE(map, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMNode> returnNode;
rv = map->SetNamedItem(aAttribute, getter_AddRefs(returnNode));
nsresult rv = map->SetNamedItem(aAttribute, getter_AddRefs(returnNode));
NS_ENSURE_SUCCESS(rv, rv);
if (returnNode) {
@ -984,13 +983,12 @@ nsGenericElement::RemoveAttributeNode(nsIDOMAttr* aAttribute,
OwnerDoc()->WarnOnceAbout(nsIDocument::eRemoveAttributeNode);
nsCOMPtr<nsIDOMNamedNodeMap> map;
nsresult rv = GetAttributes(getter_AddRefs(map));
NS_ENSURE_SUCCESS(rv, rv);
nsDOMAttributeMap* map = GetAttributes();
NS_ENSURE_TRUE(map, NS_ERROR_FAILURE);
nsAutoString name;
rv = aAttribute->GetName(name);
nsresult rv = aAttribute->GetName(name);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIDOMNode> node;
rv = map->RemoveNamedItem(name, getter_AddRefs(node));
@ -1005,7 +1003,7 @@ nsGenericElement::RemoveAttributeNode(nsIDOMAttr* aAttribute,
nsresult
nsGenericElement::GetElementsByTagName(const nsAString& aTagname,
nsIDOMNodeList** aReturn)
nsIDOMHTMLCollection** aReturn)
{
nsContentList *list = NS_GetContentList(this, kNameSpaceID_Unknown,
aTagname).get();
@ -1093,12 +1091,12 @@ nsGenericElement::GetAttributeNodeNSInternal(const nsAString& aNamespaceURI,
const nsAString& aLocalName,
nsIDOMAttr** aReturn)
{
nsCOMPtr<nsIDOMNamedNodeMap> map;
nsresult rv = GetAttributes(getter_AddRefs(map));
NS_ENSURE_SUCCESS(rv, rv);
nsDOMAttributeMap* map = GetAttributes();
NS_ENSURE_TRUE(map, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMNode> node;
rv = map->GetNamedItemNS(aNamespaceURI, aLocalName, getter_AddRefs(node));
nsresult rv = map->GetNamedItemNS(aNamespaceURI, aLocalName,
getter_AddRefs(node));
if (NS_SUCCEEDED(rv) && node) {
rv = CallQueryInterface(node, aReturn);
@ -1117,12 +1115,11 @@ nsGenericElement::SetAttributeNodeNS(nsIDOMAttr* aNewAttr,
OwnerDoc()->WarnOnceAbout(nsIDocument::eSetAttributeNodeNS);
nsCOMPtr<nsIDOMNamedNodeMap> map;
nsresult rv = GetAttributes(getter_AddRefs(map));
NS_ENSURE_SUCCESS(rv, rv);
nsDOMAttributeMap* map = GetAttributes();
NS_ENSURE_TRUE(map, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMNode> returnNode;
rv = map->SetNamedItemNS(aNewAttr, getter_AddRefs(returnNode));
nsresult rv = map->SetNamedItemNS(aNewAttr, getter_AddRefs(returnNode));
NS_ENSURE_SUCCESS(rv, rv);
if (returnNode) {
@ -1135,7 +1132,7 @@ nsGenericElement::SetAttributeNodeNS(nsIDOMAttr* aNewAttr,
nsresult
nsGenericElement::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
const nsAString& aLocalName,
nsIDOMNodeList** aReturn)
nsIDOMHTMLCollection** aReturn)
{
int32_t nameSpaceId = kNameSpaceID_Wildcard;

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

@ -201,6 +201,15 @@ private:
public:
// nsIDOMElement method implementation
NS_DECL_NSIDOMELEMENT
nsDOMAttributeMap* GetAttributes()
{
nsDOMSlots *slots = DOMSlots();
if (!slots->mAttributeMap) {
slots->mAttributeMap = new nsDOMAttributeMap(this);
}
return slots->mAttributeMap;
}
//----------------------------------------

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

@ -99,6 +99,7 @@
#include "xpcpublic.h"
#include "nsCSSRuleProcessor.h"
#include "nsCSSParser.h"
#include "nsHTMLLegendElement.h"
#include "nsWrapperCacheInlines.h"
using namespace mozilla;
@ -214,7 +215,7 @@ nsINode::GetTextEditorRootContent(nsIEditor** aEditor)
{
if (aEditor)
*aEditor = nullptr;
for (nsINode* node = this; node; node = node->GetNodeParent()) {
for (nsINode* node = this; node; node = node->GetParentNode()) {
if (!node->IsElement() ||
!node->AsElement()->IsHTML())
continue;
@ -309,7 +310,7 @@ nsINode::GetSelectionRootContent(nsIPresShell* aPresShell)
}
nsINodeList*
nsINode::GetChildNodesList()
nsINode::ChildNodes()
{
nsSlots* slots = Slots();
if (!slots->mChildNodes) {
@ -344,7 +345,7 @@ nsINode::GetParentNode(nsIDOMNode** aParentNode)
{
*aParentNode = nullptr;
nsINode *parent = GetNodeParent();
nsINode *parent = GetParentNode();
return parent ? CallQueryInterface(parent, aParentNode) : NS_OK;
}
@ -360,12 +361,7 @@ nsINode::GetParentElement(nsIDOMElement** aParentElement)
nsresult
nsINode::GetChildNodes(nsIDOMNodeList** aChildNodes)
{
*aChildNodes = GetChildNodesList();
if (!*aChildNodes) {
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(*aChildNodes);
NS_ADDREF(*aChildNodes = ChildNodes());
return NS_OK;
}
@ -426,65 +422,47 @@ nsINode::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
return ownerDoc ? CallQueryInterface(ownerDoc, aOwnerDocument) : NS_OK;
}
nsresult
nsINode::RemoveChild(nsINode *aOldChild)
nsINode*
nsINode::RemoveChild(nsINode& aOldChild, ErrorResult& aError)
{
if (!aOldChild) {
return NS_ERROR_NULL_POINTER;
}
if (IsNodeOfType(eDATA_NODE)) {
// aOldChild can't be one of our children.
return NS_ERROR_DOM_NOT_FOUND_ERR;
aError.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
return nullptr;
}
if (aOldChild->GetNodeParent() == this) {
nsContentUtils::MaybeFireNodeRemoved(aOldChild, this, OwnerDoc());
if (aOldChild.GetParentNode() == this) {
nsContentUtils::MaybeFireNodeRemoved(&aOldChild, this, OwnerDoc());
}
int32_t index = IndexOf(aOldChild);
int32_t index = IndexOf(&aOldChild);
if (index == -1) {
// aOldChild isn't one of our children.
return NS_ERROR_DOM_NOT_FOUND_ERR;
aError.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
return nullptr;
}
RemoveChildAt(index, true);
return NS_OK;
}
nsresult
nsINode::ReplaceOrInsertBefore(bool aReplace, nsIDOMNode* aNewChild,
nsIDOMNode* aRefChild, nsIDOMNode** aReturn)
{
nsCOMPtr<nsINode> newChild = do_QueryInterface(aNewChild);
nsresult rv;
nsCOMPtr<nsINode> refChild;
if (aRefChild) {
refChild = do_QueryInterface(aRefChild, &rv);
NS_ENSURE_SUCCESS(rv, rv);
}
rv = ReplaceOrInsertBefore(aReplace, newChild, refChild);
if (NS_SUCCEEDED(rv)) {
NS_ADDREF(*aReturn = aReplace ? aRefChild : aNewChild);
}
return rv;
return &aOldChild;
}
nsresult
nsINode::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
{
nsCOMPtr<nsIContent> oldChild = do_QueryInterface(aOldChild);
nsresult rv = RemoveChild(oldChild);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsINode> oldChild = do_QueryInterface(aOldChild);
if (!oldChild) {
return NS_ERROR_NULL_POINTER;
}
ErrorResult rv;
RemoveChild(*oldChild, rv);
if (!rv.Failed()) {
NS_ADDREF(*aReturn = aOldChild);
}
return rv;
return rv.ErrorCode();
}
nsresult
void
nsINode::Normalize()
{
// First collect list of nodes to be removed
@ -514,7 +492,7 @@ nsINode::Normalize()
}
if (nodes.IsEmpty()) {
return NS_OK;
return;
}
// We're relying on mozAutoSubtreeModified to keep the doc alive here.
@ -529,7 +507,7 @@ nsINode::Normalize()
HasMutationListeners(doc, NS_EVENT_BITS_MUTATION_NODEREMOVED);
if (hasRemoveListeners) {
for (uint32_t i = 0; i < nodes.Length(); ++i) {
nsContentUtils::MaybeFireNodeRemoved(nodes[i], nodes[i]->GetNodeParent(),
nsContentUtils::MaybeFireNodeRemoved(nodes[i], nodes[i]->GetParentNode(),
doc);
}
}
@ -563,7 +541,7 @@ nsINode::Normalize()
}
// Remove node
nsCOMPtr<nsINode> parent = node->GetNodeParent();
nsCOMPtr<nsINode> parent = node->GetParentNode();
NS_ASSERTION(parent || hasRemoveListeners,
"Should always have a parent unless "
"mutation events messed us up");
@ -571,12 +549,10 @@ nsINode::Normalize()
parent->RemoveChildAt(parent->IndexOf(node), true);
}
}
return NS_OK;
}
nsresult
nsINode::GetDOMBaseURI(nsAString &aURI) const
void
nsINode::GetBaseURI(nsAString &aURI) const
{
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
@ -586,11 +562,9 @@ nsINode::GetDOMBaseURI(nsAString &aURI) const
}
CopyUTF8toUTF16(spec, aURI);
return NS_OK;
}
nsresult
void
nsINode::LookupPrefix(const nsAString& aNamespaceURI, nsAString& aPrefix)
{
Element *element = GetNameSpaceElement();
@ -620,15 +594,13 @@ nsINode::LookupPrefix(const nsAString& aNamespaceURI, nsAString& aPrefix)
else {
SetDOMStringToNull(aPrefix);
}
return NS_OK;
return;
}
}
}
}
SetDOMStringToNull(aPrefix);
return NS_OK;
}
static nsresult
@ -690,34 +662,73 @@ nsINode::SetUserData(const nsAString &aKey, nsIVariant *aData,
return NS_OK;
}
uint16_t
nsINode::CompareDocPosition(nsINode* aOtherNode)
JS::Value
nsINode::SetUserData(JSContext* aCx, const nsAString& aKey, JS::Value aData,
nsIDOMUserDataHandler* aHandler, ErrorResult& aError)
{
NS_PRECONDITION(aOtherNode, "don't pass null");
nsCOMPtr<nsIVariant> data;
aError = nsContentUtils::XPConnect()->JSValToVariant(aCx, &aData,
getter_AddRefs(data));
if (aError.Failed()) {
return JS::UndefinedValue();
}
if (this == aOtherNode) {
nsCOMPtr<nsIVariant> oldData;
aError = SetUserData(aKey, data, aHandler, getter_AddRefs(oldData));
if (aError.Failed()) {
return JS::UndefinedValue();
}
if (!oldData) {
return JS::NullValue();
}
JS::Value result;
aError = nsContentUtils::XPConnect()->VariantToJS(aCx, GetWrapper(), oldData,
&result);
return result;
}
JS::Value
nsINode::GetUserData(JSContext* aCx, const nsAString& aKey, ErrorResult& aError)
{
nsIVariant* data = GetUserData(aKey);
if (!data) {
return JS::NullValue();
}
JS::Value result;
aError = nsContentUtils::XPConnect()->VariantToJS(aCx, GetWrapper(), data,
&result);
return result;
}
uint16_t
nsINode::CompareDocumentPosition(nsINode& aOtherNode) const
{
if (this == &aOtherNode) {
return 0;
}
nsAutoTArray<nsINode*, 32> parents1, parents2;
nsAutoTArray<const nsINode*, 32> parents1, parents2;
nsINode *node1 = aOtherNode, *node2 = this;
const nsINode *node1 = &aOtherNode, *node2 = this;
// Check if either node is an attribute
nsIAttribute* attr1 = nullptr;
const nsIAttribute* attr1 = nullptr;
if (node1->IsNodeOfType(nsINode::eATTRIBUTE)) {
attr1 = static_cast<nsIAttribute*>(node1);
nsIContent* elem = attr1->GetContent();
attr1 = static_cast<const nsIAttribute*>(node1);
const nsIContent* elem = attr1->GetContent();
// If there is an owner element add the attribute
// to the chain and walk up to the element
if (elem) {
node1 = elem;
parents1.AppendElement(static_cast<nsINode*>(attr1));
parents1.AppendElement(attr1);
}
}
if (node2->IsNodeOfType(nsINode::eATTRIBUTE)) {
nsIAttribute* attr2 = static_cast<nsIAttribute*>(node2);
nsIContent* elem = attr2->GetContent();
const nsIAttribute* attr2 = static_cast<const nsIAttribute*>(node2);
const nsIContent* elem = attr2->GetContent();
if (elem == node1 && attr1) {
// Both nodes are attributes on the same element.
// Compare position between the attributes.
@ -742,7 +753,7 @@ nsINode::CompareDocPosition(nsINode* aOtherNode)
if (elem) {
node2 = elem;
parents2.AppendElement(static_cast<nsINode*>(attr2));
parents2.AppendElement(attr2);
}
}
@ -754,18 +765,18 @@ nsINode::CompareDocPosition(nsINode* aOtherNode)
// Build the chain of parents
do {
parents1.AppendElement(node1);
node1 = node1->GetNodeParent();
node1 = node1->GetParentNode();
} while (node1);
do {
parents2.AppendElement(node2);
node2 = node2->GetNodeParent();
node2 = node2->GetParentNode();
} while (node2);
// Check if the nodes are disconnected.
uint32_t pos1 = parents1.Length();
uint32_t pos2 = parents2.Length();
nsINode* top1 = parents1.ElementAt(--pos1);
nsINode* top2 = parents2.ElementAt(--pos2);
const nsINode* top1 = parents1.ElementAt(--pos1);
const nsINode* top2 = parents2.ElementAt(--pos2);
if (top1 != top2) {
return top1 < top2 ?
(nsIDOMNode::DOCUMENT_POSITION_PRECEDING |
@ -777,11 +788,11 @@ nsINode::CompareDocPosition(nsINode* aOtherNode)
}
// Find where the parent chain differs and check indices in the parent.
nsINode* parent = top1;
const nsINode* parent = top1;
uint32_t len;
for (len = NS_MIN(pos1, pos2); len > 0; --len) {
nsINode* child1 = parents1.ElementAt(--pos1);
nsINode* child2 = parents2.ElementAt(--pos2);
const nsINode* child1 = parents1.ElementAt(--pos1);
const nsINode* child2 = parents2.ElementAt(--pos2);
if (child1 != child2) {
// child1 or child2 can be an attribute here. This will work fine since
// IndexOf will return -1 for the attribute making the attribute be
@ -804,7 +815,7 @@ nsINode::CompareDocPosition(nsINode* aOtherNode)
}
bool
nsINode::IsEqualTo(nsINode* aOther)
nsINode::IsEqualNode(nsINode* aOther)
{
if (!aOther) {
return false;
@ -882,10 +893,8 @@ nsINode::IsEqualTo(nsINode* aOther)
NS_ASSERTION(node1 == this && node2 == aOther,
"Did we come upon an attribute node while walking a "
"subtree?");
nsCOMPtr<nsIDOMNode> domNode1 = do_QueryInterface(node1);
nsCOMPtr<nsIDOMNode> domNode2 = do_QueryInterface(node2);
domNode1->GetNodeValue(string1);
domNode2->GetNodeValue(string2);
node1->GetNodeValue(string1);
node2->GetNodeValue(string2);
// Returning here as to not bother walking subtree. And there is no
// risk that we're half way through walking some other subtree since
@ -957,8 +966,8 @@ nsINode::IsEqualTo(nsINode* aOther)
return false;
}
node1 = node1->GetNodeParent();
node2 = node2->GetNodeParent();
node1 = node1->GetParentNode();
node2 = node2->GetParentNode();
NS_ASSERTION(node1 && node2, "no parent while walking subtree");
}
}
@ -967,7 +976,7 @@ nsINode::IsEqualTo(nsINode* aOther)
return false;
}
nsresult
void
nsINode::LookupNamespaceURI(const nsAString& aNamespacePrefix,
nsAString& aNamespaceURI)
{
@ -977,8 +986,6 @@ nsINode::LookupNamespaceURI(const nsAString& aNamespacePrefix,
aNamespaceURI))) {
SetDOMStringToNull(aNamespaceURI);
}
return NS_OK;
}
NS_IMPL_DOMTARGET_DEFAULTS(nsINode)
@ -1238,7 +1245,7 @@ nsINode::SetExplicitBaseURI(nsIURI* aURI)
static nsresult
AdoptNodeIntoOwnerDoc(nsINode *aParent, nsINode *aNode)
{
NS_ASSERTION(!aNode->GetNodeParent(),
NS_ASSERTION(!aNode->GetParentNode(),
"Should have removed from parent already");
nsIDocument *doc = aParent->OwnerDoc();
@ -1267,7 +1274,7 @@ nsresult
nsINode::doInsertChildAt(nsIContent* aKid, uint32_t aIndex,
bool aNotify, nsAttrAndChildArray& aChildArray)
{
NS_PRECONDITION(!aKid->GetNodeParent(),
NS_PRECONDITION(!aKid->GetParentNode(),
"Inserting node that already has parent");
nsresult rv;
@ -1309,7 +1316,7 @@ nsINode::doInsertChildAt(nsIContent* aKid, uint32_t aIndex,
return rv;
}
NS_ASSERTION(aKid->GetNodeParent() == this,
NS_ASSERTION(aKid->GetParentNode() == this,
"Did we run script inappropriately?");
if (aNotify) {
@ -1338,7 +1345,7 @@ void
nsINode::doRemoveChildAt(uint32_t aIndex, bool aNotify,
nsIContent* aKid, nsAttrAndChildArray& aChildArray)
{
NS_PRECONDITION(aKid && aKid->GetNodeParent() == this &&
NS_PRECONDITION(aKid && aKid->GetParentNode() == this &&
aKid == GetChildAt(aIndex) &&
IndexOf(aKid) == (int32_t)aIndex, "Bogus aKid");
@ -1515,24 +1522,23 @@ bool IsAllowedAsChild(nsIContent* aNewChild, nsINode* aParent,
return false;
}
nsresult
nsINode*
nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
nsINode* aRefChild)
nsINode* aRefChild, ErrorResult& aError)
{
// XXXbz I wish I could assert that nsContentUtils::IsSafeToRunScript() so we
// could rely on scriptblockers going out of scope to actually run XBL
// teardown, but various crud adds nodes under scriptblockers (e.g. native
// anonymous content). The only good news is those insertions can't trigger
// the bad XBL cases.
if (!aNewChild || (aReplace && !aRefChild)) {
return NS_ERROR_NULL_POINTER;
}
MOZ_ASSERT_IF(aReplace, aRefChild);
if ((!IsNodeOfType(eDOCUMENT) &&
!IsNodeOfType(eDOCUMENT_FRAGMENT) &&
!IsElement()) ||
!aNewChild->IsNodeOfType(eCONTENT)){
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
!aNewChild->IsNodeOfType(eCONTENT)) {
aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
return nullptr;
}
uint16_t nodeType = aNewChild->NodeType();
@ -1548,8 +1554,9 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
// none should be fired.
// It's ok that we do the check twice in the case when firing mutation
// events as we need to recheck after running script anyway.
if (aRefChild && aRefChild->GetNodeParent() != this) {
return NS_ERROR_DOM_NOT_FOUND_ERR;
if (aRefChild && aRefChild->GetParentNode() != this) {
aError.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
return nullptr;
}
// If we're replacing, fire for node-to-be-replaced.
@ -1560,7 +1567,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
// If the new node already has a parent, fire for removing from old
// parent
nsINode* oldParent = aNewChild->GetNodeParent();
nsINode* oldParent = aNewChild->GetParentNode();
if (oldParent) {
nsContentUtils::MaybeFireNodeRemoved(aNewChild, oldParent,
aNewChild->OwnerDoc());
@ -1572,8 +1579,9 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
static_cast<nsGenericElement*>(aNewChild)->FireNodeRemovedForChildren();
}
// Verify that our aRefChild is still sensible
if (aRefChild && aRefChild->GetNodeParent() != this) {
return NS_ERROR_DOM_NOT_FOUND_ERR;
if (aRefChild && aRefChild->GetParentNode() != this) {
aError.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
return nullptr;
}
}
@ -1583,12 +1591,14 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
// This is anonymous content. Don't allow its insertion
// anywhere, since it might have UnbindFromTree calls coming
// its way.
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
aError.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return nullptr;
}
// Make sure that the inserted node is allowed as a child of its new parent.
if (!IsAllowedAsChild(newContent, this, aReplace, aRefChild)) {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
return nullptr;
}
// Record the node to insert before, if any
@ -1607,13 +1617,14 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
Maybe<nsAutoTArray<nsCOMPtr<nsIContent>, 50> > fragChildren;
// Remove the new child from the old parent if one exists
nsCOMPtr<nsINode> oldParent = newContent->GetNodeParent();
nsCOMPtr<nsINode> oldParent = newContent->GetParentNode();
if (oldParent) {
int32_t removeIndex = oldParent->IndexOf(newContent);
if (removeIndex < 0) {
// newContent is anonymous. We can't deal with this, so just bail
NS_ERROR("How come our flags didn't catch this?");
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
aError.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return nullptr;
}
// Hold a strong ref to nodeToInsertBefore across the removal of newContent
@ -1643,12 +1654,14 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
// Verify that nodeToInsertBefore, if non-null, is still our child. If
// it's not, there's no way we can do this insert sanely; just bail out.
if (nodeToInsertBefore && nodeToInsertBefore->GetParent() != this) {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
return nullptr;
}
// Verify that newContent has no parent.
if (newContent->GetParent()) {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
return nullptr;
}
// And verify that newContent is still allowed as our child.
@ -1656,12 +1669,14 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
// We've already removed aRefChild. So even if we were doing a replace,
// now we're doing a simple insert before nodeToInsertBefore.
if (!IsAllowedAsChild(newContent, this, false, nodeToInsertBefore)) {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
return nullptr;
}
} else {
if ((aRefChild && aRefChild->GetParent() != this) ||
!IsAllowedAsChild(newContent, this, aReplace, aRefChild)) {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
return nullptr;
}
// And recompute nodeToInsertBefore, just in case.
if (aReplace) {
@ -1715,13 +1730,15 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
// Verify that nodeToInsertBefore, if non-null, is still our child. If
// it's not, there's no way we can do this insert sanely; just bail out.
if (nodeToInsertBefore && nodeToInsertBefore->GetParent() != this) {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
return nullptr;
}
// Verify that all the things in fragChildren have no parent.
for (uint32_t i = 0; i < count; ++i) {
if (fragChildren.ref().ElementAt(i)->GetParent()) {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
return nullptr;
}
}
@ -1732,7 +1749,8 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
// Verify that our aRefChild is still sensible
if (aRefChild && aRefChild->GetParent() != this) {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
return nullptr;
}
// Recompute nodeToInsertBefore, just in case.
@ -1753,12 +1771,14 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
if (child->IsElement()) {
if (sawElement) {
// No good
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
return nullptr;
}
sawElement = true;
}
if (!IsAllowedAsChild(child, this, aReplace, aRefChild)) {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
return nullptr;
}
}
}
@ -1777,7 +1797,8 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
insPos = IndexOf(nodeToInsertBefore);
if (insPos < 0) {
// XXXbz How the heck would _that_ happen, exactly?
return NS_ERROR_DOM_NOT_FOUND_ERR;
aError.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
return nullptr;
}
}
else {
@ -1800,15 +1821,16 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
--insPos;
}
nsresult res = NS_OK;
// Move new child over to our document if needed. Do this after removing
// it from its parent so that AdoptNode doesn't fire DOMNodeRemoved
// DocumentType nodes are the only nodes that can have a null
// ownerDocument according to the DOM spec, and we need to allow
// inserting them w/o calling AdoptNode().
if (!HasSameOwnerDoc(newContent)) {
res = AdoptNodeIntoOwnerDoc(this, aNewChild);
NS_ENSURE_SUCCESS(res, res);
aError = AdoptNodeIntoOwnerDoc(this, aNewChild);
if (aError.Failed()) {
return nullptr;
}
}
/*
@ -1816,6 +1838,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
* to actually add its children individually (i.e. we don't add the
* actual document fragment).
*/
nsINode* result = aReplace ? aRefChild : aNewChild;
if (nodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE) {
if (!aReplace) {
mb.Init(this, true, true);
@ -1829,7 +1852,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
uint32_t count = fragChildren.ref().Length();
if (!count) {
return NS_OK;
return result;
}
bool appending =
@ -1842,15 +1865,16 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
for (uint32_t i = 0; i < count; ++i, ++insPos) {
// XXXbz how come no reparenting here? That seems odd...
// Insert the child.
res = InsertChildAt(fragChildren.ref().ElementAt(i), insPos, !appending);
if (NS_FAILED(res)) {
aError = InsertChildAt(fragChildren.ref().ElementAt(i), insPos,
!appending);
if (aError.Failed()) {
// Make sure to notify on any children that we did succeed to insert
if (appending && i != 0) {
nsNodeUtils::ContentAppended(static_cast<nsIContent*>(this),
firstInsertedContent,
firstInsPos);
}
return res;
return nullptr;
}
}
@ -1885,21 +1909,47 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
mb.SetPrevSibling(GetChildAt(insPos - 1));
mb.SetNextSibling(GetChildAt(insPos));
}
res = InsertChildAt(newContent, insPos, true);
NS_ENSURE_SUCCESS(res, res);
aError = InsertChildAt(newContent, insPos, true);
if (aError.Failed()) {
return nullptr;
}
}
return NS_OK;
return result;
}
nsresult
nsINode::ReplaceOrInsertBefore(bool aReplace, nsIDOMNode *aNewChild,
nsIDOMNode *aRefChild, nsIDOMNode **aReturn)
{
nsCOMPtr<nsINode> newChild = do_QueryInterface(aNewChild);
if (!newChild) {
return NS_ERROR_NULL_POINTER;
}
if (aReplace && !aRefChild) {
return NS_ERROR_NULL_POINTER;
}
nsCOMPtr<nsINode> refChild = do_QueryInterface(aRefChild);
if (aRefChild && !refChild) {
return NS_NOINTERFACE;
}
ErrorResult rv;
nsINode* result = ReplaceOrInsertBefore(aReplace, newChild, refChild, rv);
if (result) {
NS_ADDREF(*aReturn = result->AsDOMNode());
}
return rv.ErrorCode();
}
nsresult
nsINode::CompareDocumentPosition(nsIDOMNode* aOther, uint16_t* aReturn)
{
nsCOMPtr<nsINode> other = do_QueryInterface(aOther);
if (!other) {
return NS_ERROR_NULL_POINTER;
}
*aReturn = CompareDocPosition(other);
NS_ENSURE_ARG(other);
*aReturn = CompareDocumentPosition(*other);
return NS_OK;
}
@ -1907,7 +1957,7 @@ nsresult
nsINode::IsEqualNode(nsIDOMNode* aOther, bool* aReturn)
{
nsCOMPtr<nsINode> other = do_QueryInterface(aOther);
*aReturn = IsEqualTo(other);
*aReturn = IsEqualNode(other);
return NS_OK;
}
@ -2241,3 +2291,80 @@ nsINode::QuerySelectorAll(const nsAString& aSelector,
return FindMatchingElements<false>(this, aSelector, *contentList);
}
JSObject*
nsINode::WrapObject(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
{
// Not all nodes have been converted
if (!IsDOMBinding()) {
*aTriedToWrap = false;
return nullptr;
}
// Make sure one of these is true
// (1) our owner document has a script handling object,
// (2) Our owner document has had a script handling object, or has been marked
// to have had one,
// (3) we are running a privileged script.
// Event handling is possible only if (1). If (2) event handling is
// prevented.
// If the document has never had a script handling object, untrusted
// scripts (3) shouldn't touch it!
bool hasHadScriptHandlingObject = false;
bool enabled;
nsIScriptSecurityManager* securityManager;
if (!OwnerDoc()->GetScriptHandlingObject(hasHadScriptHandlingObject) &&
!hasHadScriptHandlingObject &&
!((securityManager = nsContentUtils::GetSecurityManager()) &&
NS_SUCCEEDED(securityManager->IsCapabilityEnabled("UniversalXPConnect",
&enabled)) &&
enabled)) {
Throw<true>(aCx, NS_ERROR_UNEXPECTED);
*aTriedToWrap = true;
return nullptr;
}
return WrapNode(aCx, aScope, aTriedToWrap);
}
bool
nsINode::IsSupported(const nsAString& aFeature, const nsAString& aVersion)
{
return nsContentUtils::InternalIsSupported(this, aFeature, aVersion);
}
nsGenericElement*
nsINode::GetParentElement() const
{
return static_cast<nsGenericElement*>(GetElementParent());
}
already_AddRefed<nsINode>
nsINode::CloneNode(bool aDeep, ErrorResult& aError)
{
bool callUserDataHandlers = NodeType() != nsIDOMNode::DOCUMENT_NODE ||
!static_cast<nsIDocument*>(this)->CreatingStaticClone();
nsCOMPtr<nsINode> result;
aError = nsNodeUtils::CloneNodeImpl(this, aDeep, callUserDataHandlers,
getter_AddRefs(result));
return result.forget();
}
nsDOMAttributeMap*
nsINode::GetAttributes()
{
if (!IsElement()) {
return nullptr;
}
return static_cast<nsGenericElement*>(nsINode::AsElement())->GetAttributes();
}
nsresult
nsINode::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
{
if (!IsElement()) {
*aAttributes = nullptr;
return NS_OK;
}
return CallQueryInterface(GetAttributes(), aAttributes);
}

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

@ -107,6 +107,11 @@ nsNodeInfo::nsNodeInfo(nsIAtom *aName, nsIAtom *aPrefix, int32_t aNamespaceID,
mInner.mName->ToString(mQualifiedName);
}
MOZ_ASSERT_IF(aNodeType != nsIDOMNode::ELEMENT_NODE &&
aNodeType != nsIDOMNode::ATTRIBUTE_NODE &&
aNodeType != UINT16_MAX,
aNamespaceID == kNameSpaceID_None && !aPrefix);
switch (aNodeType) {
case nsIDOMNode::ELEMENT_NODE:
case nsIDOMNode::ATTRIBUTE_NODE:

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

@ -62,7 +62,7 @@ bool nsNodeIterator::NodePointer::MoveToPrevious(nsINode *aRoot)
if (mNode == aRoot)
return false;
MoveBackward(mNode->GetNodeParent(), mNode->GetPreviousSibling());
MoveBackward(mNode->GetParentNode(), mNode->GetPreviousSibling());
return true;
}
@ -113,7 +113,7 @@ bool nsNodeIterator::NodePointer::MoveForward(nsINode *aRoot, nsINode *aNode)
mNode = sibling;
return true;
}
aNode = aNode->GetNodeParent();
aNode = aNode->GetParentNode();
}
return false;

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

@ -58,7 +58,7 @@ using namespace mozilla::dom;
slots->mMutationObservers, nsIMutationObserver, \
func_, params_); \
} \
node = node->GetNodeParent(); \
node = node->GetParentNode(); \
} while (node); \
if (needsEnterLeave) { \
nsDOMMutationObserver::LeaveMutationHandling(); \
@ -359,11 +359,11 @@ nsNodeUtils::TraverseUserData(nsINode* aNode,
nsresult
nsNodeUtils::CloneNodeImpl(nsINode *aNode, bool aDeep,
bool aCallUserDataHandlers,
nsIDOMNode **aResult)
nsINode **aResult)
{
*aResult = nullptr;
nsCOMPtr<nsIDOMNode> newNode;
nsCOMPtr<nsINode> newNode;
nsCOMArray<nsINode> nodesWithProperties;
nsresult rv = Clone(aNode, aDeep, nullptr, nodesWithProperties,
getter_AddRefs(newNode));

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

@ -150,10 +150,10 @@ public:
static nsresult Clone(nsINode *aNode, bool aDeep,
nsNodeInfoManager *aNewNodeInfoManager,
nsCOMArray<nsINode> &aNodesWithProperties,
nsIDOMNode **aResult)
nsINode **aResult)
{
return CloneAndAdopt(aNode, true, aDeep, aNewNodeInfoManager, nullptr,
nullptr, aNodesWithProperties, aResult);
nullptr, aNodesWithProperties, nullptr, aResult);
}
/**
@ -179,9 +179,10 @@ public:
JSContext *aCx, JSObject *aNewScope,
nsCOMArray<nsINode> &aNodesWithProperties)
{
nsCOMPtr<nsINode> node;
nsresult rv = CloneAndAdopt(aNode, false, true, aNewNodeInfoManager,
aCx, aNewScope, aNodesWithProperties,
nullptr);
nullptr, getter_AddRefs(node));
nsMutationGuard::DidMutate();
@ -228,7 +229,7 @@ public:
*/
static nsresult CloneNodeImpl(nsINode *aNode, bool aDeep,
bool aCallUserDataHandlers,
nsIDOMNode **aResult);
nsINode **aResult);
/**
* Release the UserData and UserDataHandlers for aNode.
@ -263,31 +264,6 @@ private:
* descendants) with properties. If aClone is
* true every node will be followed by its
* clone.
* @param aResult If aClone is false then aResult must be null, else
* *aResult will contain the cloned node.
*/
static nsresult CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
nsNodeInfoManager *aNewNodeInfoManager,
JSContext *aCx, JSObject *aNewScope,
nsCOMArray<nsINode> &aNodesWithProperties,
nsIDOMNode **aResult)
{
NS_ASSERTION(!aClone == !aResult,
"aResult must be null when adopting and non-null when "
"cloning");
nsCOMPtr<nsINode> clone;
nsresult rv = CloneAndAdopt(aNode, aClone, aDeep, aNewNodeInfoManager,
aCx, aNewScope, aNodesWithProperties,
nullptr, getter_AddRefs(clone));
NS_ENSURE_SUCCESS(rv, rv);
return clone ? CallQueryInterface(clone, aResult) : NS_OK;
}
/**
* See above for arguments that aren't described here.
*
* @param aParent If aClone is true the cloned node will be appended to
* aParent's children. May be null. If not null then aNode
* must be an nsIContent.

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

@ -1673,7 +1673,7 @@ nsObjectLoadingContent::LoadObject(bool aNotify,
fallbackType = clickToPlayReason;
}
if (!mActivated && mType != eType_Null) {
if (!mActivated && mType == eType_Plugin) {
// Object passed ShouldPlay and !ShouldPreview, so it should be considered
// activated until it changes content type
LOG(("OBJLC [%p]: Object implicitly activated", this));

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

@ -100,7 +100,7 @@ nsRange::CompareNodeToRange(nsINode* aNode, nsRange* aRange,
// gather up the dom point info
int32_t nodeStart, nodeEnd;
nsINode* parent = aNode->GetNodeParent();
nsINode* parent = aNode->GetParentNode();
if (!parent) {
// can't make a parent/offset pair to represent start or
// end of the root node, because it has no parent.
@ -173,7 +173,7 @@ GetNextRangeCommonAncestor(nsINode* aNode)
if (!aNode->IsDescendantOfCommonAncestorForRangeInSelection()) {
return nullptr;
}
aNode = aNode->GetNodeParent();
aNode = aNode->GetParentNode();
}
return aNode;
}
@ -188,7 +188,7 @@ nsRange::IsNodeSelected(nsINode* aNode, uint32_t aStartOffset,
nsINode* n = GetNextRangeCommonAncestor(aNode);
NS_ASSERTION(n || !aNode->IsSelectionDescendant(),
"orphan selection descendant");
for (; n; n = GetNextRangeCommonAncestor(n->GetNodeParent())) {
for (; n; n = GetNextRangeCommonAncestor(n->GetParentNode())) {
RangeHashTable* ranges =
static_cast<RangeHashTable*>(n->GetProperty(nsGkAtoms::range));
ranges->EnumerateEntries(FindSelectedRange, &data);
@ -422,7 +422,7 @@ nsRange::CharacterDataChanged(nsIDocument* aDocument,
// did so too (otherwise the range would end up with disconnected nodes).
if (aContent == mEndParent &&
aInfo->mChangeStart < static_cast<uint32_t>(mEndOffset)) {
if (aInfo->mDetails && (aContent->GetNodeParent() || newStartNode)) {
if (aInfo->mDetails && (aContent->GetParentNode() || newStartNode)) {
// splitText(), aInfo->mDetails->mNextSibling is the new text node
NS_ASSERTION(aInfo->mDetails->mType ==
CharacterDataChangeInfo::Details::eSplit,
@ -436,7 +436,7 @@ nsRange::CharacterDataChanged(nsIDocument* aDocument,
if (isCommonAncestor && !newStartNode) {
// The split occurs inside the range.
UnregisterCommonAncestor(mStartParent);
RegisterCommonAncestor(mStartParent->GetNodeParent());
RegisterCommonAncestor(mStartParent->GetParentNode());
newEndNode->SetDescendantOfCommonAncestorForRangeInSelection();
} else if (mEndParent->IsDescendantOfCommonAncestorForRangeInSelection()) {
newEndNode->SetDescendantOfCommonAncestorForRangeInSelection();
@ -480,7 +480,7 @@ nsRange::CharacterDataChanged(nsIDocument* aDocument,
}
DoSetRange(newStartNode, newStartOffset, newEndNode, newEndOffset,
newRoot ? newRoot : mRoot.get(),
!newEndNode->GetNodeParent() || !newStartNode->GetNodeParent());
!newEndNode->GetParentNode() || !newStartNode->GetParentNode());
}
}
@ -662,7 +662,7 @@ nsRange::IntersectsNode(nsIDOMNode* aNode, bool* aResult)
NS_ENSURE_TRUE(mIsPositioned, NS_ERROR_NOT_INITIALIZED);
// Step 3.
nsINode* parent = node->GetNodeParent();
nsINode* parent = node->GetParentNode();
if (!parent) {
// Steps 2 and 4.
// |parent| is null, so |node|'s root is |node| itself.
@ -720,7 +720,7 @@ nsRange::DoSetRange(nsINode* aStartN, int32_t aStartOffset,
static_cast<nsIContent*>(aStartN)->GetBindingParent() &&
aRoot ==
static_cast<nsIContent*>(aEndN)->GetBindingParent()) ||
(!aRoot->GetNodeParent() &&
(!aRoot->GetParentNode() &&
(aRoot->IsNodeOfType(nsINode::eDOCUMENT) ||
aRoot->IsNodeOfType(nsINode::eATTRIBUTE) ||
aRoot->IsNodeOfType(nsINode::eDOCUMENT_FRAGMENT) ||
@ -774,7 +774,7 @@ IndexOf(nsIDOMNode* aChildNode)
return -1;
}
nsINode *parent = child->GetNodeParent();
nsINode *parent = child->GetParentNode();
// finally we get the index
return parent ? parent->IndexOf(child) : -1;
@ -895,7 +895,7 @@ nsRange::IsValidBoundary(nsINode* aNode)
}
root = aNode;
while ((aNode = aNode->GetNodeParent())) {
while ((aNode = aNode->GetParentNode())) {
root = aNode;
}
@ -1062,7 +1062,7 @@ nsRange::SelectNode(nsIDOMNode* aN)
nsCOMPtr<nsINode> node = do_QueryInterface(aN);
NS_ENSURE_TRUE(node, NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
nsINode* parent = node->GetNodeParent();
nsINode* parent = node->GetParentNode();
nsINode* newRoot = IsValidBoundary(parent);
NS_ENSURE_TRUE(newRoot, NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
@ -1439,19 +1439,6 @@ CollapseRangeAfterDelete(nsIDOMRange *aRange)
return aRange->Collapse(false);
}
/**
* Remove a node from the DOM entirely.
*
* @param aNode The node to remove.
*/
static nsresult
RemoveNode(nsIDOMNode* aNode)
{
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
nsCOMPtr<nsINode> parent = node->GetNodeParent();
return parent ? parent->RemoveChild(node) : NS_OK;
}
/**
* Split a data node into two parts.
*
@ -1760,8 +1747,13 @@ nsresult nsRange::CutContents(nsIDOMDocumentFragment** aFragment)
ValidateCurrentNode(this, iter));
} else if (nodeToResult) {
nsMutationGuard guard;
rv = RemoveNode(nodeToResult);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsINode> node = do_QueryInterface(nodeToResult);
nsINode* parent = node->GetParentNode();
if (parent) {
mozilla::ErrorResult error;
parent->RemoveChild(*node, error);
NS_ENSURE_FALSE(error.Failed(), error.ErrorCode());
}
NS_ENSURE_STATE(!guard.Mutated(1) ||
ValidateCurrentNode(this, iter));
}
@ -2195,8 +2187,8 @@ nsRange::SurroundContents(nsIDOMNode* aNewParent)
if (mStartParent != mEndParent) {
bool startIsText = mStartParent->IsNodeOfType(nsINode::eTEXT);
bool endIsText = mEndParent->IsNodeOfType(nsINode::eTEXT);
nsINode* startGrandParent = mStartParent->GetNodeParent();
nsINode* endGrandParent = mEndParent->GetNodeParent();
nsINode* startGrandParent = mStartParent->GetParentNode();
nsINode* endGrandParent = mEndParent->GetParentNode();
NS_ENSURE_TRUE((startIsText && endIsText &&
startGrandParent &&
startGrandParent == endGrandParent) ||
@ -2630,7 +2622,7 @@ nsRange::GetRegisteredCommonAncestor()
if (ranges->GetEntry(this)) {
break;
}
ancestor = GetNextRangeCommonAncestor(ancestor->GetNodeParent());
ancestor = GetNextRangeCommonAncestor(ancestor->GetParentNode());
}
NS_ASSERTION(ancestor, "can't find common ancestor for selected range");
return ancestor;

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

@ -24,7 +24,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericDOMDataNode::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMCharacterData
NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)

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

@ -1413,7 +1413,7 @@ nsTreeSanitizer::SanitizeChildren(nsINode* aRoot)
RemoveAllAttributes(descendant);
}
nsIContent* next = node->GetNextNonChildNode(aRoot);
node->GetParent()->RemoveChild(node);
node->RemoveFromParent();
node = next;
continue;
}
@ -1459,14 +1459,14 @@ nsTreeSanitizer::SanitizeChildren(nsINode* aRoot)
nsIContent* next = node->GetNextNode(aRoot);
nsIContent* parent = node->GetParent();
nsCOMPtr<nsIContent> child; // Must keep the child alive during move
nsresult rv;
ErrorResult rv;
while ((child = node->GetFirstChild())) {
parent->InsertBefore(child, node, &rv);
if (NS_FAILED(rv)) {
parent->InsertBefore(*child, node, rv);
if (rv.Failed()) {
break;
}
}
parent->RemoveChild(node);
node->RemoveFromParent();
node = next;
continue;
}
@ -1502,7 +1502,7 @@ nsTreeSanitizer::SanitizeChildren(nsINode* aRoot)
NS_ASSERTION(!node->GetFirstChild(), "How come non-element node had kids?");
nsIContent* next = node->GetNextNonChildNode(aRoot);
if (!mAllowComments && node->IsNodeOfType(nsINode::eCOMMENT)) {
node->GetNodeParent()->RemoveChild(node);
node->RemoveFromParent();
}
node = next;
}

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

@ -135,7 +135,7 @@ NS_IMETHODIMP nsTreeWalker::ParentNode(nsIDOMNode **_retval)
nsCOMPtr<nsINode> node = mCurrentNode;
while (node && node != mRoot) {
node = node->GetNodeParent();
node = node->GetParentNode();
if (node) {
int16_t filtered;
@ -209,7 +209,7 @@ NS_IMETHODIMP nsTreeWalker::PreviousNode(nsIDOMNode **_retval)
if (node == mRoot)
break;
node = node->GetNodeParent();
node = node->GetParentNode();
if (!node)
break;
@ -262,7 +262,7 @@ NS_IMETHODIMP nsTreeWalker::NextNode(nsIDOMNode **_retval)
if (sibling)
break;
temp = temp->GetNodeParent();
temp = temp->GetParentNode();
} while (temp);
if (!sibling)
@ -336,7 +336,7 @@ nsresult nsTreeWalker::FirstChildInternal(bool aReversed, nsIDOMNode **_retval)
break;
}
nsINode *parent = node->GetNodeParent();
nsINode *parent = node->GetParentNode();
if (!parent || parent == mRoot || parent == mCurrentNode) {
return NS_OK;
@ -394,7 +394,7 @@ nsresult nsTreeWalker::NextSiblingInternal(bool aReversed, nsIDOMNode **_retval)
}
}
node = node->GetNodeParent();
node = node->GetParentNode();
if (!node || node == mRoot)
return NS_OK;

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

@ -1214,7 +1214,7 @@ nsXMLContentSerializer::MaybeAddNewlineForRootNode(nsAString& aStr)
void
nsXMLContentSerializer::MaybeFlagNewlineForRootNode(nsINode* aNode)
{
nsINode* parent = aNode->GetNodeParent();
nsINode* parent = aNode->GetParentNode();
if (parent) {
mAddNewlineForRootNode = parent->IsNodeOfType(nsINode::eDOCUMENT);
}

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

@ -375,7 +375,7 @@ nsContentEventHandler::SetRangeFromFlatTextOffset(
uint32_t nativeOffset = 0;
uint32_t nativeEndOffset = aNativeOffset + aNativeLength;
nsCOMPtr<nsIContent> content;
bool startSet = false;
for (; !iter->IsDone(); iter->Next()) {
nsINode* node = iter->GetCurrentNode();
if (!node)
@ -405,6 +405,7 @@ nsContentEventHandler::SetRangeFromFlatTextOffset(
rv = aRange->SetStart(domNode, int32_t(xpOffset));
NS_ENSURE_SUCCESS(rv, rv);
startSet = true;
if (aNativeLength == 0) {
// Ensure that the end offset and the start offset are same.
rv = aRange->SetEnd(domNode, int32_t(xpOffset));
@ -446,8 +447,9 @@ nsContentEventHandler::SetRangeFromFlatTextOffset(
nsCOMPtr<nsIDOMNode> domNode(do_QueryInterface(mRootContent));
NS_ASSERTION(domNode, "lastContent doesn't have nsIDOMNode!");
if (!content) {
rv = aRange->SetStart(domNode, 0);
if (!startSet) {
MOZ_ASSERT(!mRootContent->IsNodeOfType(nsINode::eTEXT));
rv = aRange->SetStart(domNode, int32_t(mRootContent->GetChildCount()));
NS_ENSURE_SUCCESS(rv, rv);
}
rv = aRange->SetEnd(domNode, int32_t(mRootContent->GetChildCount()));

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

@ -901,7 +901,7 @@ static nsINode* GetRootEditableNode(nsPresContext* aPresContext,
nsINode* node = aContent;
while (node && IsEditable(node)) {
root = node;
node = node->GetNodeParent();
node = node->GetParentNode();
}
return root;
}

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

@ -11,7 +11,6 @@ class nsXMLEventsElement : public nsXMLElement {
public:
nsXMLEventsElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~nsXMLEventsElement();
NS_FORWARD_NSIDOMNODE(nsXMLElement::)
virtual nsIAtom *GetIDAttributeName() const;
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,

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

@ -25,7 +25,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsHTMLMediaElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsHTMLMediaElement::)

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

@ -51,7 +51,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -28,7 +28,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsHTMLMediaElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsHTMLMediaElement::)

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

@ -1241,7 +1241,7 @@ Serialize(Element* aRoot, bool aDescendentsOnly, nsAString& aOut)
break;
}
current = current->GetNodeParent();
current = current->GetParentNode();
if (aDescendentsOnly && current == aRoot) {
return builder.ToString(aOut);
}
@ -1392,9 +1392,7 @@ nsGenericHTMLElement::SetInnerHTML(const nsAString& aInnerHTML,
// listeners on the fragment that comes from the parser.
nsAutoScriptBlockerSuppressNodeRemoved scriptBlocker;
nsresult rv = NS_OK;
static_cast<nsINode*>(this)->AppendChild(fragment, &rv);
aError = rv;
static_cast<nsINode*>(this)->AppendChild(*fragment, aError);
mb.NodesAdded();
}
}
@ -1403,7 +1401,7 @@ nsGenericHTMLElement::SetInnerHTML(const nsAString& aInnerHTML,
NS_IMETHODIMP
nsGenericHTMLElement::SetOuterHTML(const nsAString& aOuterHTML)
{
nsCOMPtr<nsINode> parent = GetNodeParent();
nsCOMPtr<nsINode> parent = GetParentNode();
if (!parent) {
return NS_OK;
}
@ -1437,8 +1435,9 @@ nsGenericHTMLElement::SetOuterHTML(const nsAString& aOuterHTML)
eCompatibility_NavQuirks,
true);
nsAutoMutationBatch mb(parent, true, false);
parent->ReplaceChild(fragment, this, &rv);
return rv;
ErrorResult error;
parent->ReplaceChild(*fragment, *this, error);
return error.ErrorCode();
}
nsCOMPtr<nsINode> context;
@ -1463,8 +1462,9 @@ nsGenericHTMLElement::SetOuterHTML(const nsAString& aOuterHTML)
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsINode> fragment = do_QueryInterface(df);
nsAutoMutationBatch mb(parent, true, false);
parent->ReplaceChild(fragment, this, &rv);
return rv;
ErrorResult error;
parent->ReplaceChild(*fragment, *this, error);
return error.ErrorCode();
}
enum nsAdjacentPosition {
@ -1551,22 +1551,23 @@ nsGenericHTMLElement::InsertAdjacentHTML(const nsAString& aPosition,
// listeners on the fragment that comes from the parser.
nsAutoScriptBlockerSuppressNodeRemoved scriptBlocker;
ErrorResult error;
nsAutoMutationBatch mb(destination, true, false);
switch (position) {
case eBeforeBegin:
destination->InsertBefore(fragment, this, &rv);
destination->InsertBefore(*fragment, this, error);
break;
case eAfterBegin:
static_cast<nsINode*>(this)->InsertBefore(fragment, GetFirstChild(), &rv);
static_cast<nsINode*>(this)->InsertBefore(*fragment, GetFirstChild(), error);
break;
case eBeforeEnd:
static_cast<nsINode*>(this)->AppendChild(fragment, &rv);
static_cast<nsINode*>(this)->AppendChild(*fragment, error);
break;
case eAfterEnd:
destination->InsertBefore(fragment, GetNextSibling(), &rv);
destination->InsertBefore(*fragment, GetNextSibling(), error);
break;
}
return rv;
return error.ErrorCode();
}
nsresult
@ -4232,13 +4233,14 @@ nsGenericHTMLElement::SetItemValue(nsIVariant* aValue)
void
nsGenericHTMLElement::GetItemValueText(nsAString& text)
{
GetTextContent(text);
GetTextContentInternal(text);
}
void
nsGenericHTMLElement::SetItemValueText(const nsAString& text)
{
SetTextContent(text);
mozilla::ErrorResult rv;
SetTextContentInternal(text, rv);
}
static void

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

@ -35,7 +35,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -29,7 +29,7 @@ public:
NS_DECL_SIZEOF_EXCLUDING_THIS
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -27,7 +27,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -62,7 +62,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -63,7 +63,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)

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

@ -22,7 +22,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -25,7 +25,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -22,7 +22,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -34,7 +34,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)

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

@ -31,7 +31,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -526,7 +526,7 @@ nsHTMLFormElement::UnbindFromTree(bool aDeep, bool aNullParent)
nsINode* ancestor = this;
nsINode* cur;
do {
cur = ancestor->GetNodeParent();
cur = ancestor->GetParentNode();
if (!cur) {
break;
}

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

@ -40,7 +40,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -27,7 +27,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFrameElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFrameElement::)

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

@ -51,7 +51,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -30,7 +30,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -27,7 +27,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -21,7 +21,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFrameElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFrameElement::)

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

@ -24,7 +24,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -69,7 +69,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)

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

@ -27,7 +27,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -32,7 +32,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)

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

@ -27,7 +27,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -46,7 +46,7 @@ public:
nsGenericHTMLElement)
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -21,7 +21,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -27,7 +27,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -31,7 +31,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -22,7 +22,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -22,7 +22,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
/* nsIDOMNode */
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
/* nsIDOMElement */
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -20,7 +20,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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

@ -31,7 +31,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

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