From 52f1883f5bcd5dddb53a043a913436dfb776b45e Mon Sep 17 00:00:00 2001 From: "anthonyd%netscape.com" Date: Thu, 24 Aug 2000 03:54:30 +0000 Subject: [PATCH] fix for bug 48624 (hidden selection issues with plain text widgets) fix for bug 45662 (updating range impl to dom spec) fix for some edge case selection issues invloving multiple windows, no bug # but saari knows about this. r: sfraser, jfrancis, mjudge, saari a: beppe --- content/base/src/nsCommentNode.cpp | 4 +- content/base/src/nsContentIterator.cpp | 12 +-- content/base/src/nsGeneratedIterator.cpp | 12 +-- content/base/src/nsGenericDOMDataNode.cpp | 4 +- content/base/src/nsRange.cpp | 37 ++++--- content/base/src/nsRange.h | 14 +-- content/base/src/nsSelection.cpp | 42 ++++---- content/events/src/nsEventStateManager.cpp | 2 +- dom/public/idl/range/Range.idl | 14 +-- dom/public/nsDOMPropEnums.h | 13 +-- dom/public/nsDOMPropNames.h | 13 +-- dom/public/range/nsIDOMRange.h | 40 ++++---- dom/src/range/nsJSRange.cpp | 96 +++++++++++++------ editor/base/DeleteRangeTxn.cpp | 6 +- editor/base/nsEditor.cpp | 22 ++--- editor/base/nsEditorEventListeners.cpp | 3 +- editor/base/nsHTMLEditRules.cpp | 24 ++--- editor/base/nsHTMLEditor.cpp | 30 +++--- editor/base/nsHTMLEditorLog.cpp | 4 +- editor/base/nsTableEditor.cpp | 4 +- editor/libeditor/base/DeleteRangeTxn.cpp | 6 +- editor/libeditor/base/nsEditor.cpp | 22 ++--- editor/libeditor/html/nsHTMLEditRules.cpp | 24 ++--- editor/libeditor/html/nsHTMLEditor.cpp | 30 +++--- editor/libeditor/html/nsHTMLEditorLog.cpp | 4 +- editor/libeditor/html/nsTableEditor.cpp | 4 +- .../libeditor/text/nsEditorEventListeners.cpp | 3 +- .../txtsvc/nsTextServicesDocument.cpp | 18 ++-- editor/public/nsIHTMLEditor.h | 6 +- editor/txtsvc/src/nsTextServicesDocument.cpp | 18 ++-- layout/base/src/nsCommentNode.cpp | 4 +- layout/base/src/nsContentIterator.cpp | 12 +-- layout/base/src/nsGeneratedIterator.cpp | 12 +-- layout/base/src/nsGenericDOMDataNode.cpp | 4 +- layout/base/src/nsRange.cpp | 37 ++++--- layout/base/src/nsRange.h | 14 +-- layout/base/src/nsSelection.cpp | 42 ++++---- layout/events/src/nsEventStateManager.cpp | 2 +- layout/generic/nsSelection.cpp | 42 ++++---- layout/generic/nsTextFrame.cpp | 4 +- layout/html/base/src/nsTextFrame.cpp | 4 +- .../html/forms/src/nsGfxTextControlFrame2.cpp | 3 + 42 files changed, 390 insertions(+), 321 deletions(-) diff --git a/content/base/src/nsCommentNode.cpp b/content/base/src/nsCommentNode.cpp index 29d13fe201e..21a7f7b4c4d 100644 --- a/content/base/src/nsCommentNode.cpp +++ b/content/base/src/nsCommentNode.cpp @@ -441,8 +441,8 @@ nsCommentNode::ConvertContentToXIF(nsIXIFConverter* aConverter) const PRInt32 startOffset = 0; PRInt32 endOffset = 0; - range->GetStartParent(getter_AddRefs(startNode)); - range->GetEndParent(getter_AddRefs(endNode)); + range->GetStartContainer(getter_AddRefs(startNode)); + range->GetEndContainer(getter_AddRefs(endNode)); range->GetStartOffset(&startOffset); range->GetEndOffset(&endOffset); diff --git a/content/base/src/nsContentIterator.cpp b/content/base/src/nsContentIterator.cpp index d71286c2ac0..768682b1a91 100644 --- a/content/base/src/nsContentIterator.cpp +++ b/content/base/src/nsContentIterator.cpp @@ -269,12 +269,12 @@ nsresult nsContentIterator::Init(nsIDOMRange* aRange) mIsDone = PR_FALSE; // get common content parent - if (NS_FAILED(aRange->GetCommonParent(getter_AddRefs(dN))) || !dN) + if (NS_FAILED(aRange->GetCommonAncestorContainer(getter_AddRefs(dN))) || !dN) return NS_ERROR_FAILURE; mCommonParent = do_QueryInterface(dN); // get the start node and offset, convert to nsIContent - aRange->GetStartParent(getter_AddRefs(startDOM)); + aRange->GetStartContainer(getter_AddRefs(startDOM)); if (!startDOM) return NS_ERROR_ILLEGAL_VALUE; startCon = do_QueryInterface(startDOM); @@ -284,7 +284,7 @@ nsresult nsContentIterator::Init(nsIDOMRange* aRange) aRange->GetStartOffset(&startIndx); // get the end node and offset, convert to nsIContent - aRange->GetEndParent(getter_AddRefs(endDOM)); + aRange->GetEndContainer(getter_AddRefs(endDOM)); if (!endDOM) return NS_ERROR_ILLEGAL_VALUE; endCon = do_QueryInterface(endDOM); @@ -834,18 +834,18 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange) PRInt32 numChildren; // get common content parent - if (NS_FAILED(aRange->GetCommonParent(getter_AddRefs(commonParent))) || !commonParent) + if (NS_FAILED(aRange->GetCommonAncestorContainer(getter_AddRefs(commonParent))) || !commonParent) return NS_ERROR_FAILURE; mCommonParent = do_QueryInterface(commonParent); // get start content parent - if (NS_FAILED(aRange->GetStartParent(getter_AddRefs(startParent))) || !startParent) + if (NS_FAILED(aRange->GetStartContainer(getter_AddRefs(startParent))) || !startParent) return NS_ERROR_FAILURE; cStartP = do_QueryInterface(startParent); aRange->GetStartOffset(&startIndx); // get end content parent - if (NS_FAILED(aRange->GetEndParent(getter_AddRefs(endParent))) || !endParent) + if (NS_FAILED(aRange->GetEndContainer(getter_AddRefs(endParent))) || !endParent) return NS_ERROR_FAILURE; cEndP = do_QueryInterface(endParent); aRange->GetEndOffset(&endIndx); diff --git a/content/base/src/nsGeneratedIterator.cpp b/content/base/src/nsGeneratedIterator.cpp index 8bb59e3b2c5..8be41d72a6d 100644 --- a/content/base/src/nsGeneratedIterator.cpp +++ b/content/base/src/nsGeneratedIterator.cpp @@ -299,12 +299,12 @@ nsresult nsGeneratedContentIterator::Init(nsIDOMRange* aRange) mIsDone = PR_FALSE; // get common content parent - if (NS_FAILED(aRange->GetCommonParent(getter_AddRefs(dN))) || !dN) + if (NS_FAILED(aRange->GetCommonAncestorContainer(getter_AddRefs(dN))) || !dN) return NS_ERROR_FAILURE; mCommonParent = do_QueryInterface(dN); // get the start node and offset, convert to nsIContent - aRange->GetStartParent(getter_AddRefs(startDOM)); + aRange->GetStartContainer(getter_AddRefs(startDOM)); if (!startDOM) return NS_ERROR_ILLEGAL_VALUE; startCon = do_QueryInterface(startDOM); @@ -314,7 +314,7 @@ nsresult nsGeneratedContentIterator::Init(nsIDOMRange* aRange) aRange->GetStartOffset(&startIndx); // get the end node and offset, convert to nsIContent - aRange->GetEndParent(getter_AddRefs(endDOM)); + aRange->GetEndContainer(getter_AddRefs(endDOM)); if (!endDOM) return NS_ERROR_ILLEGAL_VALUE; endCon = do_QueryInterface(endDOM); @@ -968,18 +968,18 @@ nsresult nsGeneratedSubtreeIterator::Init(nsIDOMRange* aRange) PRInt32 numChildren; // get common content parent - if (NS_FAILED(aRange->GetCommonParent(getter_AddRefs(commonParent))) || !commonParent) + if (NS_FAILED(aRange->GetCommonAncestorContainer(getter_AddRefs(commonParent))) || !commonParent) return NS_ERROR_FAILURE; mCommonParent = do_QueryInterface(commonParent); // get start content parent - if (NS_FAILED(aRange->GetStartParent(getter_AddRefs(startParent))) || !startParent) + if (NS_FAILED(aRange->GetStartContainer(getter_AddRefs(startParent))) || !startParent) return NS_ERROR_FAILURE; cStartP = do_QueryInterface(startParent); aRange->GetStartOffset(&startIndx); // get end content parent - if (NS_FAILED(aRange->GetEndParent(getter_AddRefs(endParent))) || !endParent) + if (NS_FAILED(aRange->GetEndContainer(getter_AddRefs(endParent))) || !endParent) return NS_ERROR_FAILURE; cEndP = do_QueryInterface(endParent); aRange->GetEndOffset(&endIndx); diff --git a/content/base/src/nsGenericDOMDataNode.cpp b/content/base/src/nsGenericDOMDataNode.cpp index badbdaef568..0df161a2206 100644 --- a/content/base/src/nsGenericDOMDataNode.cpp +++ b/content/base/src/nsGenericDOMDataNode.cpp @@ -603,8 +603,8 @@ nsGenericDOMDataNode::ConvertContentToXIF(const nsIContent *aOuterContent, PRInt32 startOffset = 0; PRInt32 endOffset = 0; - range->GetStartParent(getter_AddRefs(startNode)); - range->GetEndParent(getter_AddRefs(endNode)); + range->GetStartContainer(getter_AddRefs(startNode)); + range->GetEndContainer(getter_AddRefs(endNode)); range->GetStartOffset(&startOffset); range->GetEndOffset(&endOffset); diff --git a/content/base/src/nsRange.cpp b/content/base/src/nsRange.cpp index c115374aa1a..b3d693f83eb 100644 --- a/content/base/src/nsRange.cpp +++ b/content/base/src/nsRange.cpp @@ -126,13 +126,13 @@ PRBool IsNodeIntersectsRange(nsIContent* aNode, nsIDOMRange* aRange) if (!GetNodeBracketPoints(aNode, &parent, &nodeStart, &nodeEnd)) return PR_FALSE; - if (NS_FAILED(aRange->GetStartParent(getter_AddRefs(rangeStartParent)))) + if (NS_FAILED(aRange->GetStartContainer(getter_AddRefs(rangeStartParent)))) return PR_FALSE; if (NS_FAILED(aRange->GetStartOffset(&rangeStartOffset))) return PR_FALSE; - if (NS_FAILED(aRange->GetEndParent(getter_AddRefs(rangeEndParent)))) + if (NS_FAILED(aRange->GetEndContainer(getter_AddRefs(rangeEndParent)))) return PR_FALSE; if (NS_FAILED(aRange->GetEndOffset(&rangeEndOffset))) @@ -198,13 +198,13 @@ nsresult CompareNodeToRange(nsIContent* aNode, if (!GetNodeBracketPoints(aNode, &parent, &nodeStart, &nodeEnd)) return NS_ERROR_FAILURE; - if (NS_FAILED(aRange->GetStartParent(getter_AddRefs(rangeStartParent)))) + if (NS_FAILED(aRange->GetStartContainer(getter_AddRefs(rangeStartParent)))) return NS_ERROR_FAILURE; if (NS_FAILED(aRange->GetStartOffset(&rangeStartOffset))) return NS_ERROR_FAILURE; - if (NS_FAILED(aRange->GetEndParent(getter_AddRefs(rangeEndParent)))) + if (NS_FAILED(aRange->GetEndContainer(getter_AddRefs(rangeEndParent)))) return NS_ERROR_FAILURE; if (NS_FAILED(aRange->GetEndOffset(&rangeEndOffset))) @@ -934,7 +934,7 @@ nsresult nsRange::GetIsPositioned(PRBool* aIsPositioned) return NS_OK; } -nsresult nsRange::GetStartParent(nsIDOMNode** aStartParent) +nsresult nsRange::GetStartContainer(nsIDOMNode** aStartParent) { if (!mIsPositioned) return NS_ERROR_NOT_INITIALIZED; @@ -956,7 +956,7 @@ nsresult nsRange::GetStartOffset(PRInt32* aStartOffset) return NS_OK; } -nsresult nsRange::GetEndParent(nsIDOMNode** aEndParent) +nsresult nsRange::GetEndContainer(nsIDOMNode** aEndParent) { if (!mIsPositioned) return NS_ERROR_NOT_INITIALIZED; @@ -978,7 +978,7 @@ nsresult nsRange::GetEndOffset(PRInt32* aEndOffset) return NS_OK; } -nsresult nsRange::GetIsCollapsed(PRBool* aIsCollapsed) +nsresult nsRange::GetCollapsed(PRBool* aIsCollapsed) { if (!mIsPositioned) return NS_ERROR_NOT_INITIALIZED; @@ -990,7 +990,7 @@ nsresult nsRange::GetIsCollapsed(PRBool* aIsCollapsed) return NS_OK; } -nsresult nsRange::GetCommonParent(nsIDOMNode** aCommonParent) +nsresult nsRange::GetCommonAncestorContainer(nsIDOMNode** aCommonParent) { *aCommonParent = CommonParent(mStartParent,mEndParent); NS_IF_ADDREF(*aCommonParent); @@ -1313,7 +1313,7 @@ nsresult nsRange::DeleteContents() return NS_OK; } -nsresult nsRange::CompareEndPoints(PRUint16 how, nsIDOMRange* srcRange, +nsresult nsRange::CompareBoundaryPoints(PRUint16 how, nsIDOMRange* srcRange, PRInt32* aCmpRet) { nsresult res; @@ -1330,28 +1330,28 @@ nsresult nsRange::CompareEndPoints(PRUint16 how, nsIDOMRange* srcRange, case nsIDOMRange::START_TO_START: node1 = mStartParent; offset1 = mStartOffset; - res = srcRange->GetStartParent(getter_AddRefs(node2)); + res = srcRange->GetStartContainer(getter_AddRefs(node2)); if (NS_SUCCEEDED(res)) res = srcRange->GetStartOffset(&offset2); break; case nsIDOMRange::START_TO_END: node1 = mStartParent; offset1 = mStartOffset; - res = srcRange->GetEndParent(getter_AddRefs(node2)); + res = srcRange->GetEndContainer(getter_AddRefs(node2)); if (NS_SUCCEEDED(res)) res = srcRange->GetEndOffset(&offset2); break; case nsIDOMRange::END_TO_START: node1 = mEndParent; offset1 = mEndOffset; - res = srcRange->GetStartParent(getter_AddRefs(node2)); + res = srcRange->GetStartContainer(getter_AddRefs(node2)); if (NS_SUCCEEDED(res)) res = srcRange->GetStartOffset(&offset2); break; case nsIDOMRange::END_TO_END: node1 = mEndParent; offset1 = mEndOffset; - res = srcRange->GetEndParent(getter_AddRefs(node2)); + res = srcRange->GetEndContainer(getter_AddRefs(node2)); if (NS_SUCCEEDED(res)) res = srcRange->GetEndOffset(&offset2); break; @@ -1536,7 +1536,7 @@ return NS_ERROR_NOT_IMPLEMENTED; #endif } -nsresult nsRange::Clone(nsIDOMRange** aReturn) +nsresult nsRange::CloneRange(nsIDOMRange** aReturn) { if (aReturn == 0) return NS_ERROR_NULL_POINTER; @@ -1654,6 +1654,15 @@ nsresult nsRange::ToString(nsAWritableString& aReturn) } + +nsresult +nsRange::Detach() +{ + return DoSetRange(nsnull,0,nsnull,0); +} + + + nsresult nsRange::OwnerGone(nsIContent* aDyingNode) { // nothing for now - should be impossible to getter here diff --git a/content/base/src/nsRange.h b/content/base/src/nsRange.h index c9089e13c7b..255b785345a 100644 --- a/content/base/src/nsRange.h +++ b/content/base/src/nsRange.h @@ -51,15 +51,15 @@ public: NS_IMETHOD GetIsPositioned(PRBool* aIsPositioned); - NS_IMETHOD GetStartParent(nsIDOMNode** aStartParent); + NS_IMETHOD GetStartContainer(nsIDOMNode** aStartParent); NS_IMETHOD GetStartOffset(PRInt32* aStartOffset); - NS_IMETHOD GetEndParent(nsIDOMNode** aEndParent); + NS_IMETHOD GetEndContainer(nsIDOMNode** aEndParent); NS_IMETHOD GetEndOffset(PRInt32* aEndOffset); - NS_IMETHOD GetIsCollapsed(PRBool* aIsCollapsed); + NS_IMETHOD GetCollapsed(PRBool* aIsCollapsed); - NS_IMETHOD GetCommonParent(nsIDOMNode** aCommonParent); + NS_IMETHOD GetCommonAncestorContainer(nsIDOMNode** aCommonParent); NS_IMETHOD SetStart(nsIDOMNode* aParent, PRInt32 aOffset); NS_IMETHOD SetStartBefore(nsIDOMNode* aSibling); @@ -76,7 +76,7 @@ public: NS_IMETHOD SelectNode(nsIDOMNode* aN); NS_IMETHOD SelectNodeContents(nsIDOMNode* aN); - NS_IMETHOD CompareEndPoints(PRUint16 how, nsIDOMRange* srcRange, PRInt32* ret); + NS_IMETHOD CompareBoundaryPoints(PRUint16 how, nsIDOMRange* srcRange, PRInt32* ret); NS_IMETHOD DeleteContents(); @@ -86,7 +86,9 @@ public: NS_IMETHOD InsertNode(nsIDOMNode* aN); NS_IMETHOD SurroundContents(nsIDOMNode* aN); - NS_IMETHOD Clone(nsIDOMRange** aReturn); + NS_IMETHOD CloneRange(nsIDOMRange** aReturn); + + NS_IMETHOD Detach(); NS_IMETHOD ToString(nsAWritableString& aReturn); diff --git a/content/base/src/nsSelection.cpp b/content/base/src/nsSelection.cpp index 04d32e04d11..449db9b088d 100644 --- a/content/base/src/nsSelection.cpp +++ b/content/base/src/nsSelection.cpp @@ -2404,7 +2404,7 @@ printf("HandleTableSelection: Unselecting mUnselectCellOnMouseUp; rangeCount=%d\ if (!range) return NS_ERROR_NULL_POINTER; nsCOMPtr parent; - result = range->GetStartParent(getter_AddRefs(parent)); + result = range->GetStartContainer(getter_AddRefs(parent)); if (NS_FAILED(result)) return result; if (!parent) return NS_ERROR_NULL_POINTER; @@ -2718,7 +2718,7 @@ nsSelection::GetFirstCellNodeInRange(nsIDOMRange *aRange, nsIDOMNode **aCellNode *aCellNode = nsnull; nsCOMPtr startParent; - nsresult result = aRange->GetStartParent(getter_AddRefs(startParent)); + nsresult result = aRange->GetStartContainer(getter_AddRefs(startParent)); if (NS_FAILED(result)) return result; if (!startParent) return NS_ERROR_FAILURE; @@ -3260,10 +3260,10 @@ nsDOMSelection::GetAnchorNode(nsIDOMNode** aAnchorNode) return NS_ERROR_NULL_POINTER; nsresult result; if (GetDirection() == eDirNext){ - result = mAnchorFocusRange->GetStartParent(aAnchorNode); + result = mAnchorFocusRange->GetStartContainer(aAnchorNode); } else{ - result = mAnchorFocusRange->GetEndParent(aAnchorNode); + result = mAnchorFocusRange->GetEndContainer(aAnchorNode); } return result; } @@ -3291,10 +3291,10 @@ nsDOMSelection::GetFocusNode(nsIDOMNode** aFocusNode) return NS_ERROR_NULL_POINTER; nsresult result; if (GetDirection() == eDirNext){ - result = mAnchorFocusRange->GetEndParent(aFocusNode); + result = mAnchorFocusRange->GetEndContainer(aFocusNode); } else{ - result = mAnchorFocusRange->GetStartParent(aFocusNode); + result = mAnchorFocusRange->GetStartContainer(aFocusNode); } return result; @@ -3405,7 +3405,7 @@ nsDOMSelection::FetchStartParent(nsIDOMRange *aRange) //skip all the com stuff if (!aRange) return nsnull; nsCOMPtr returnval; - aRange->GetStartParent(getter_AddRefs(returnval)); + aRange->GetStartContainer(getter_AddRefs(returnval)); return returnval; } @@ -3430,7 +3430,7 @@ nsDOMSelection::FetchEndParent(nsIDOMRange *aRange) //skip all the com stuff if (!aRange) return nsnull; nsCOMPtr returnval; - aRange->GetEndParent(getter_AddRefs(returnval)); + aRange->GetEndContainer(getter_AddRefs(returnval)); return returnval; } @@ -3771,9 +3771,9 @@ nsDOMSelection::LookUpSelection(nsIContent *aContent, PRInt32 aContentOffset, PR nsCOMPtr endNode; PRInt32 startOffset; PRInt32 endOffset; - range->GetStartParent(getter_AddRefs(startNode)); + range->GetStartContainer(getter_AddRefs(startNode)); range->GetStartOffset(&startOffset); - range->GetEndParent(getter_AddRefs(endNode)); + range->GetEndContainer(getter_AddRefs(endNode)); range->GetEndOffset(&endOffset); if (passedInNode == startNode && passedInNode == endNode){ if (startOffset < (aContentOffset + aContentLength) && @@ -4216,11 +4216,11 @@ nsDOMSelection::AddRange(nsIDOMRange* aRange) if(mFrameSelection)// don't assume we have a FrameSelection { nsCOMPtr startNode; - result = aRange->GetStartParent(getter_AddRefs(startNode)); + result = aRange->GetStartContainer(getter_AddRefs(startNode)); if (NS_SUCCEEDED(result)) { nsCOMPtr endNode; - result = aRange->GetEndParent(getter_AddRefs(endNode)); + result = aRange->GetEndContainer(getter_AddRefs(endNode)); if (NS_SUCCEEDED(result)) { if (startNode == endNode) @@ -4384,7 +4384,7 @@ nsDOMSelection::CollapseToStart() return NS_ERROR_FAILURE; nsCOMPtr parent; - rv = firstRange->GetStartParent(getter_AddRefs(parent)); + rv = firstRange->GetStartContainer(getter_AddRefs(parent)); if (NS_SUCCEEDED(rv)) { if (parent) @@ -4419,7 +4419,7 @@ nsDOMSelection::CollapseToEnd() return NS_ERROR_FAILURE; nsCOMPtr parent; - rv = lastRange->GetEndParent(getter_AddRefs(parent)); + rv = lastRange->GetEndContainer(getter_AddRefs(parent)); if (NS_SUCCEEDED(rv)) { if (parent) @@ -4470,7 +4470,7 @@ nsDOMSelection::GetIsCollapsed(PRBool* aIsCollapsed) return rv; } - return (range->GetIsCollapsed(aIsCollapsed)); + return (range->GetCollapsed(aIsCollapsed)); } NS_IMETHODIMP @@ -4790,7 +4790,7 @@ nsDOMSelection::GetOriginalAnchorPoint(nsIDOMNode **aNode, PRInt32 *aOffset) if (!aNode || !aOffset || !mOriginalAnchorRange) return NS_ERROR_NULL_POINTER; nsresult result; - result = mOriginalAnchorRange->GetStartParent(aNode); + result = mOriginalAnchorRange->GetStartContainer(aNode); if (NS_FAILED(result)) return result; result = mOriginalAnchorRange->GetStartOffset(aOffset); @@ -4808,8 +4808,8 @@ nsDOMSelection::CopyRangeToAnchorFocus(nsIDOMRange *aRange) nsCOMPtr endNode; PRInt32 startOffset; PRInt32 endOffset; - aRange->GetStartParent(getter_AddRefs(startNode)); - aRange->GetEndParent(getter_AddRefs(endNode)); + aRange->GetStartContainer(getter_AddRefs(startNode)); + aRange->GetEndContainer(getter_AddRefs(endNode)); aRange->GetStartOffset(&startOffset); aRange->GetEndOffset(&endOffset); if (NS_FAILED(mAnchorFocusRange->SetStart(startNode,startOffset))) @@ -4871,7 +4871,7 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) if (FetchFocusNode() == aParentNode && FetchFocusOffset() == aOffset) return NS_ERROR_FAILURE;//same node nothing to do! - res = mAnchorFocusRange->Clone(getter_AddRefs(range)); + res = mAnchorFocusRange->CloneRange(getter_AddRefs(range)); //range = mAnchorFocusRange; nsCOMPtr startNode; @@ -4879,8 +4879,8 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) PRInt32 startOffset; PRInt32 endOffset; - range->GetStartParent(getter_AddRefs(startNode)); - range->GetEndParent(getter_AddRefs(endNode)); + range->GetStartContainer(getter_AddRefs(startNode)); + range->GetEndContainer(getter_AddRefs(endNode)); range->GetStartOffset(&startOffset); range->GetEndOffset(&endOffset); diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 5aa66386af3..91306793198 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -566,7 +566,7 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext, nsCOMPtr globalObject; if(gLastFocusedDocument) { gLastFocusedDocument->GetScriptGlobalObject(getter_AddRefs(globalObject)); - //gLastFocusedDocument->HandleDOMEvent(gLastFocusedPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status); + gLastFocusedDocument->HandleDOMEvent(gLastFocusedPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status); if(globalObject) globalObject->HandleDOMEvent(gLastFocusedPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status); } diff --git a/dom/public/idl/range/Range.idl b/dom/public/idl/range/Range.idl index 1c566056b78..bbdae5ab2ac 100644 --- a/dom/public/idl/range/Range.idl +++ b/dom/public/idl/range/Range.idl @@ -7,13 +7,13 @@ interface Range { const unsigned short END_TO_START = 2; const unsigned short END_TO_END = 3; - readonly attribute Node startParent; + readonly attribute Node startContainer; readonly attribute long startOffset; - readonly attribute Node endParent; + readonly attribute Node endContainer; readonly attribute long endOffset; - readonly attribute boolean isCollapsed; - readonly attribute Node commonParent; + readonly attribute boolean collapsed; + readonly attribute Node commonAncestorContainer; void setStart(in Node parent, in long offset); void setStartBefore(in Node sibling); @@ -27,7 +27,7 @@ interface Range { void selectNode(in Node n); void selectNodeContents(in Node n); - int compareEndPoints(in unsigned short how, in Range srcRange); + int compareBoundaryPoints(in unsigned short how, in Range srcRange); void deleteContents(); @@ -37,7 +37,9 @@ interface Range { void insertNode(in Node n); void surroundContents(in Node n); - Range clone(); + Range cloneRange(); + + void detach(); DOMString toString(); }; diff --git a/dom/public/nsDOMPropEnums.h b/dom/public/nsDOMPropEnums.h index f9bf7fb9d60..036e58a8c15 100644 --- a/dom/public/nsDOMPropEnums.h +++ b/dom/public/nsDOMPropEnums.h @@ -842,17 +842,18 @@ enum nsDOMProp { NS_DOM_PROP_PLUGINARRAY_REFRESH, NS_DOM_PROP_PROCESSINGINSTRUCTION_DATA, NS_DOM_PROP_PROCESSINGINSTRUCTION_TARGET, - NS_DOM_PROP_RANGE_CLONE, NS_DOM_PROP_RANGE_CLONECONTENTS, + NS_DOM_PROP_RANGE_CLONERANGE, NS_DOM_PROP_RANGE_COLLAPSE, - NS_DOM_PROP_RANGE_COMMONPARENT, - NS_DOM_PROP_RANGE_COMPAREENDPOINTS, + NS_DOM_PROP_RANGE_COLLAPSED, + NS_DOM_PROP_RANGE_COMMONANCESTORCONTAINER, + NS_DOM_PROP_RANGE_COMPAREBOUNDARYPOINTS, NS_DOM_PROP_RANGE_DELETECONTENTS, + NS_DOM_PROP_RANGE_DETACH, + NS_DOM_PROP_RANGE_ENDCONTAINER, NS_DOM_PROP_RANGE_ENDOFFSET, - NS_DOM_PROP_RANGE_ENDPARENT, NS_DOM_PROP_RANGE_EXTRACTCONTENTS, NS_DOM_PROP_RANGE_INSERTNODE, - NS_DOM_PROP_RANGE_ISCOLLAPSED, NS_DOM_PROP_RANGE_SELECTNODE, NS_DOM_PROP_RANGE_SELECTNODECONTENTS, NS_DOM_PROP_RANGE_SETEND, @@ -861,8 +862,8 @@ enum nsDOMProp { NS_DOM_PROP_RANGE_SETSTART, NS_DOM_PROP_RANGE_SETSTARTAFTER, NS_DOM_PROP_RANGE_SETSTARTBEFORE, + NS_DOM_PROP_RANGE_STARTCONTAINER, NS_DOM_PROP_RANGE_STARTOFFSET, - NS_DOM_PROP_RANGE_STARTPARENT, NS_DOM_PROP_RANGE_SURROUNDCONTENTS, NS_DOM_PROP_RANGE_TOSTRING, NS_DOM_PROP_RECT_BOTTOM, diff --git a/dom/public/nsDOMPropNames.h b/dom/public/nsDOMPropNames.h index a3e65e24328..892d96c7705 100644 --- a/dom/public/nsDOMPropNames.h +++ b/dom/public/nsDOMPropNames.h @@ -840,17 +840,18 @@ "pluginarray.refresh", \ "processinginstruction.data", \ "processinginstruction.target", \ - "range.clone", \ "range.clonecontents", \ + "range.clonerange", \ "range.collapse", \ - "range.commonparent", \ - "range.compareendpoints", \ + "range.collapsed", \ + "range.commonancestorcontainer", \ + "range.compareboundarypoints", \ "range.deletecontents", \ + "range.detach", \ + "range.endcontainer", \ "range.endoffset", \ - "range.endparent", \ "range.extractcontents", \ "range.insertnode", \ - "range.iscollapsed", \ "range.selectnode", \ "range.selectnodecontents", \ "range.setend", \ @@ -859,8 +860,8 @@ "range.setstart", \ "range.setstartafter", \ "range.setstartbefore", \ + "range.startcontainer", \ "range.startoffset", \ - "range.startparent", \ "range.surroundcontents", \ "range.tostring", \ "rect.bottom", \ diff --git a/dom/public/range/nsIDOMRange.h b/dom/public/range/nsIDOMRange.h index 2d7535ee6f2..1cbb71de101 100644 --- a/dom/public/range/nsIDOMRange.h +++ b/dom/public/range/nsIDOMRange.h @@ -46,17 +46,17 @@ public: END_TO_END = 3 }; - NS_IMETHOD GetStartParent(nsIDOMNode** aStartParent)=0; + NS_IMETHOD GetStartContainer(nsIDOMNode** aStartContainer)=0; NS_IMETHOD GetStartOffset(PRInt32* aStartOffset)=0; - NS_IMETHOD GetEndParent(nsIDOMNode** aEndParent)=0; + NS_IMETHOD GetEndContainer(nsIDOMNode** aEndContainer)=0; NS_IMETHOD GetEndOffset(PRInt32* aEndOffset)=0; - NS_IMETHOD GetIsCollapsed(PRBool* aIsCollapsed)=0; + NS_IMETHOD GetCollapsed(PRBool* aCollapsed)=0; - NS_IMETHOD GetCommonParent(nsIDOMNode** aCommonParent)=0; + NS_IMETHOD GetCommonAncestorContainer(nsIDOMNode** aCommonAncestorContainer)=0; NS_IMETHOD SetStart(nsIDOMNode* aParent, PRInt32 aOffset)=0; @@ -76,7 +76,7 @@ public: NS_IMETHOD SelectNodeContents(nsIDOMNode* aN)=0; - NS_IMETHOD CompareEndPoints(PRUint16 aHow, nsIDOMRange* aSrcRange, PRInt32* aReturn)=0; + NS_IMETHOD CompareBoundaryPoints(PRUint16 aHow, nsIDOMRange* aSrcRange, PRInt32* aReturn)=0; NS_IMETHOD DeleteContents()=0; @@ -88,19 +88,21 @@ public: NS_IMETHOD SurroundContents(nsIDOMNode* aN)=0; - NS_IMETHOD Clone(nsIDOMRange** aReturn)=0; + NS_IMETHOD CloneRange(nsIDOMRange** aReturn)=0; + + NS_IMETHOD Detach()=0; NS_IMETHOD ToString(nsAWritableString& aReturn)=0; }; #define NS_DECL_IDOMRANGE \ - NS_IMETHOD GetStartParent(nsIDOMNode** aStartParent); \ + NS_IMETHOD GetStartContainer(nsIDOMNode** aStartContainer); \ NS_IMETHOD GetStartOffset(PRInt32* aStartOffset); \ - NS_IMETHOD GetEndParent(nsIDOMNode** aEndParent); \ + NS_IMETHOD GetEndContainer(nsIDOMNode** aEndContainer); \ NS_IMETHOD GetEndOffset(PRInt32* aEndOffset); \ - NS_IMETHOD GetIsCollapsed(PRBool* aIsCollapsed); \ - NS_IMETHOD GetCommonParent(nsIDOMNode** aCommonParent); \ + NS_IMETHOD GetCollapsed(PRBool* aCollapsed); \ + NS_IMETHOD GetCommonAncestorContainer(nsIDOMNode** aCommonAncestorContainer); \ NS_IMETHOD SetStart(nsIDOMNode* aParent, PRInt32 aOffset); \ NS_IMETHOD SetStartBefore(nsIDOMNode* aSibling); \ NS_IMETHOD SetStartAfter(nsIDOMNode* aSibling); \ @@ -110,24 +112,25 @@ public: NS_IMETHOD Collapse(PRBool aToStart); \ NS_IMETHOD SelectNode(nsIDOMNode* aN); \ NS_IMETHOD SelectNodeContents(nsIDOMNode* aN); \ - NS_IMETHOD CompareEndPoints(PRUint16 aHow, nsIDOMRange* aSrcRange, PRInt32* aReturn); \ + NS_IMETHOD CompareBoundaryPoints(PRUint16 aHow, nsIDOMRange* aSrcRange, PRInt32* aReturn); \ NS_IMETHOD DeleteContents(); \ NS_IMETHOD ExtractContents(nsIDOMDocumentFragment** aReturn); \ NS_IMETHOD CloneContents(nsIDOMDocumentFragment** aReturn); \ NS_IMETHOD InsertNode(nsIDOMNode* aN); \ NS_IMETHOD SurroundContents(nsIDOMNode* aN); \ - NS_IMETHOD Clone(nsIDOMRange** aReturn); \ + NS_IMETHOD CloneRange(nsIDOMRange** aReturn); \ + NS_IMETHOD Detach(); \ NS_IMETHOD ToString(nsAWritableString& aReturn); \ #define NS_FORWARD_IDOMRANGE(_to) \ - NS_IMETHOD GetStartParent(nsIDOMNode** aStartParent) { return _to GetStartParent(aStartParent); } \ + NS_IMETHOD GetStartContainer(nsIDOMNode** aStartContainer) { return _to GetStartContainer(aStartContainer); } \ NS_IMETHOD GetStartOffset(PRInt32* aStartOffset) { return _to GetStartOffset(aStartOffset); } \ - NS_IMETHOD GetEndParent(nsIDOMNode** aEndParent) { return _to GetEndParent(aEndParent); } \ + NS_IMETHOD GetEndContainer(nsIDOMNode** aEndContainer) { return _to GetEndContainer(aEndContainer); } \ NS_IMETHOD GetEndOffset(PRInt32* aEndOffset) { return _to GetEndOffset(aEndOffset); } \ - NS_IMETHOD GetIsCollapsed(PRBool* aIsCollapsed) { return _to GetIsCollapsed(aIsCollapsed); } \ - NS_IMETHOD GetCommonParent(nsIDOMNode** aCommonParent) { return _to GetCommonParent(aCommonParent); } \ + NS_IMETHOD GetCollapsed(PRBool* aCollapsed) { return _to GetCollapsed(aCollapsed); } \ + NS_IMETHOD GetCommonAncestorContainer(nsIDOMNode** aCommonAncestorContainer) { return _to GetCommonAncestorContainer(aCommonAncestorContainer); } \ NS_IMETHOD SetStart(nsIDOMNode* aParent, PRInt32 aOffset) { return _to SetStart(aParent, aOffset); } \ NS_IMETHOD SetStartBefore(nsIDOMNode* aSibling) { return _to SetStartBefore(aSibling); } \ NS_IMETHOD SetStartAfter(nsIDOMNode* aSibling) { return _to SetStartAfter(aSibling); } \ @@ -137,13 +140,14 @@ public: NS_IMETHOD Collapse(PRBool aToStart) { return _to Collapse(aToStart); } \ NS_IMETHOD SelectNode(nsIDOMNode* aN) { return _to SelectNode(aN); } \ NS_IMETHOD SelectNodeContents(nsIDOMNode* aN) { return _to SelectNodeContents(aN); } \ - NS_IMETHOD CompareEndPoints(PRUint16 aHow, nsIDOMRange* aSrcRange, PRInt32* aReturn) { return _to CompareEndPoints(aHow, aSrcRange, aReturn); } \ + NS_IMETHOD CompareBoundaryPoints(PRUint16 aHow, nsIDOMRange* aSrcRange, PRInt32* aReturn) { return _to CompareBoundaryPoints(aHow, aSrcRange, aReturn); } \ NS_IMETHOD DeleteContents() { return _to DeleteContents(); } \ NS_IMETHOD ExtractContents(nsIDOMDocumentFragment** aReturn) { return _to ExtractContents(aReturn); } \ NS_IMETHOD CloneContents(nsIDOMDocumentFragment** aReturn) { return _to CloneContents(aReturn); } \ NS_IMETHOD InsertNode(nsIDOMNode* aN) { return _to InsertNode(aN); } \ NS_IMETHOD SurroundContents(nsIDOMNode* aN) { return _to SurroundContents(aN); } \ - NS_IMETHOD Clone(nsIDOMRange** aReturn) { return _to Clone(aReturn); } \ + NS_IMETHOD CloneRange(nsIDOMRange** aReturn) { return _to CloneRange(aReturn); } \ + NS_IMETHOD Detach() { return _to Detach(); } \ NS_IMETHOD ToString(nsAWritableString& aReturn) { return _to ToString(aReturn); } \ diff --git a/dom/src/range/nsJSRange.cpp b/dom/src/range/nsJSRange.cpp index 643794d3605..319a4a1f4d4 100644 --- a/dom/src/range/nsJSRange.cpp +++ b/dom/src/range/nsJSRange.cpp @@ -52,12 +52,12 @@ static NS_DEFINE_IID(kIRangeIID, NS_IDOMRANGE_IID); // Range property ids // enum Range_slots { - RANGE_STARTPARENT = -1, + RANGE_STARTCONTAINER = -1, RANGE_STARTOFFSET = -2, - RANGE_ENDPARENT = -3, + RANGE_ENDCONTAINER = -3, RANGE_ENDOFFSET = -4, - RANGE_ISCOLLAPSED = -5, - RANGE_COMMONPARENT = -6 + RANGE_COLLAPSED = -5, + RANGE_COMMONANCESTORCONTAINER = -6 }; /***********************************************************************/ @@ -80,12 +80,12 @@ GetRangeProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) if (!secMan) return PR_FALSE; switch(JSVAL_TO_INT(id)) { - case RANGE_STARTPARENT: + case RANGE_STARTCONTAINER: { - rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_RANGE_STARTPARENT, PR_FALSE); + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_RANGE_STARTCONTAINER, PR_FALSE); if (NS_SUCCEEDED(rv)) { nsIDOMNode* prop; - rv = a->GetStartParent(&prop); + rv = a->GetStartContainer(&prop); if (NS_SUCCEEDED(rv)) { // get the js object nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp); @@ -105,12 +105,12 @@ GetRangeProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) } break; } - case RANGE_ENDPARENT: + case RANGE_ENDCONTAINER: { - rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_RANGE_ENDPARENT, PR_FALSE); + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_RANGE_ENDCONTAINER, PR_FALSE); if (NS_SUCCEEDED(rv)) { nsIDOMNode* prop; - rv = a->GetEndParent(&prop); + rv = a->GetEndContainer(&prop); if (NS_SUCCEEDED(rv)) { // get the js object nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp); @@ -130,24 +130,24 @@ GetRangeProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) } break; } - case RANGE_ISCOLLAPSED: + case RANGE_COLLAPSED: { - rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_RANGE_ISCOLLAPSED, PR_FALSE); + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_RANGE_COLLAPSED, PR_FALSE); if (NS_SUCCEEDED(rv)) { PRBool prop; - rv = a->GetIsCollapsed(&prop); + rv = a->GetCollapsed(&prop); if (NS_SUCCEEDED(rv)) { *vp = BOOLEAN_TO_JSVAL(prop); } } break; } - case RANGE_COMMONPARENT: + case RANGE_COMMONANCESTORCONTAINER: { - rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_RANGE_COMMONPARENT, PR_FALSE); + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_RANGE_COMMONANCESTORCONTAINER, PR_FALSE); if (NS_SUCCEEDED(rv)) { nsIDOMNode* prop; - rv = a->GetCommonParent(&prop); + rv = a->GetCommonAncestorContainer(&prop); if (NS_SUCCEEDED(rv)) { // get the js object nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp); @@ -661,10 +661,10 @@ RangeSelectNodeContents(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j // -// Native method CompareEndPoints +// Native method CompareBoundaryPoints // PR_STATIC_CALLBACK(JSBool) -RangeCompareEndPoints(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +RangeCompareBoundaryPoints(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { nsIDOMRange *nativeThis = (nsIDOMRange*)nsJSUtils::nsGetNativeThis(cx, obj); nsresult result = NS_OK; @@ -681,7 +681,7 @@ RangeCompareEndPoints(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj); if (!secMan) return PR_FALSE; - result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_RANGE_COMPAREENDPOINTS, PR_FALSE); + result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_RANGE_COMPAREBOUNDARYPOINTS, PR_FALSE); if (NS_FAILED(result)) { return nsJSUtils::nsReportError(cx, obj, result); } @@ -700,7 +700,7 @@ RangeCompareEndPoints(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_OBJECT_ERR); } - result = nativeThis->CompareEndPoints(b0, b1, &nativeRet); + result = nativeThis->CompareBoundaryPoints(b0, b1, &nativeRet); if (NS_FAILED(result)) { return nsJSUtils::nsReportError(cx, obj, result); } @@ -914,10 +914,10 @@ RangeSurroundContents(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv // -// Native method Clone +// Native method CloneRange // PR_STATIC_CALLBACK(JSBool) -RangeClone(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +RangeCloneRange(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { nsIDOMRange *nativeThis = (nsIDOMRange*)nsJSUtils::nsGetNativeThis(cx, obj); nsresult result = NS_OK; @@ -932,12 +932,12 @@ RangeClone(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj); if (!secMan) return PR_FALSE; - result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_RANGE_CLONE, PR_FALSE); + result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_RANGE_CLONERANGE, PR_FALSE); if (NS_FAILED(result)) { return nsJSUtils::nsReportError(cx, obj, result); } - result = nativeThis->Clone(&nativeRet); + result = nativeThis->CloneRange(&nativeRet); if (NS_FAILED(result)) { return nsJSUtils::nsReportError(cx, obj, result); } @@ -949,6 +949,41 @@ RangeClone(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) } +// +// Native method Detach +// +PR_STATIC_CALLBACK(JSBool) +RangeDetach(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +{ + nsIDOMRange *nativeThis = (nsIDOMRange*)nsJSUtils::nsGetNativeThis(cx, obj); + nsresult result = NS_OK; + // If there's no private data, this must be the prototype, so ignore + if (nsnull == nativeThis) { + return JS_TRUE; + } + + { + *rval = JSVAL_NULL; + nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj); + if (!secMan) + return PR_FALSE; + result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_RANGE_DETACH, PR_FALSE); + if (NS_FAILED(result)) { + return nsJSUtils::nsReportError(cx, obj, result); + } + + result = nativeThis->Detach(); + if (NS_FAILED(result)) { + return nsJSUtils::nsReportError(cx, obj, result); + } + + *rval = JSVAL_VOID; + } + + return JS_TRUE; +} + + // // Native method ToString // @@ -1324,12 +1359,12 @@ JSClass RangeClass = { // static JSPropertySpec RangeProperties[] = { - {"startParent", RANGE_STARTPARENT, JSPROP_ENUMERATE | JSPROP_READONLY}, + {"startContainer", RANGE_STARTCONTAINER, JSPROP_ENUMERATE | JSPROP_READONLY}, {"startOffset", RANGE_STARTOFFSET, JSPROP_ENUMERATE | JSPROP_READONLY}, - {"endParent", RANGE_ENDPARENT, JSPROP_ENUMERATE | JSPROP_READONLY}, + {"endContainer", RANGE_ENDCONTAINER, JSPROP_ENUMERATE | JSPROP_READONLY}, {"endOffset", RANGE_ENDOFFSET, JSPROP_ENUMERATE | JSPROP_READONLY}, - {"isCollapsed", RANGE_ISCOLLAPSED, JSPROP_ENUMERATE | JSPROP_READONLY}, - {"commonParent", RANGE_COMMONPARENT, JSPROP_ENUMERATE | JSPROP_READONLY}, + {"collapsed", RANGE_COLLAPSED, JSPROP_ENUMERATE | JSPROP_READONLY}, + {"commonAncestorContainer", RANGE_COMMONANCESTORCONTAINER, JSPROP_ENUMERATE | JSPROP_READONLY}, {0} }; @@ -1348,13 +1383,14 @@ static JSFunctionSpec RangeMethods[] = {"collapse", RangeCollapse, 1}, {"selectNode", RangeSelectNode, 1}, {"selectNodeContents", RangeSelectNodeContents, 1}, - {"compareEndPoints", RangeCompareEndPoints, 2}, + {"compareBoundaryPoints", RangeCompareBoundaryPoints, 2}, {"deleteContents", RangeDeleteContents, 0}, {"extractContents", RangeExtractContents, 0}, {"cloneContents", RangeCloneContents, 0}, {"insertNode", RangeInsertNode, 1}, {"surroundContents", RangeSurroundContents, 1}, - {"clone", RangeClone, 0}, + {"cloneRange", RangeCloneRange, 0}, + {"detach", RangeDetach, 0}, {"toString", RangeToString, 0}, {"createContextualFragment", NSRangeCreateContextualFragment, 1}, {"isValidFragment", NSRangeIsValidFragment, 1}, diff --git a/editor/base/DeleteRangeTxn.cpp b/editor/base/DeleteRangeTxn.cpp index 9a3c9b7e93c..3c6eb9895e5 100644 --- a/editor/base/DeleteRangeTxn.cpp +++ b/editor/base/DeleteRangeTxn.cpp @@ -59,15 +59,15 @@ NS_IMETHODIMP DeleteRangeTxn::Init(nsIEditor *aEditor, nsIDOMRange *aRange) mEditor = aEditor; mRange = do_QueryInterface(aRange); - nsresult result = aRange->GetStartParent(getter_AddRefs(mStartParent)); + nsresult result = aRange->GetStartContainer(getter_AddRefs(mStartParent)); NS_ASSERTION((NS_SUCCEEDED(result)), "GetStartParent failed."); - result = aRange->GetEndParent(getter_AddRefs(mEndParent)); + result = aRange->GetEndContainer(getter_AddRefs(mEndParent)); NS_ASSERTION((NS_SUCCEEDED(result)), "GetEndParent failed."); result = aRange->GetStartOffset(&mStartOffset); NS_ASSERTION((NS_SUCCEEDED(result)), "GetStartOffset failed."); result = aRange->GetEndOffset(&mEndOffset); NS_ASSERTION((NS_SUCCEEDED(result)), "GetEndOffset failed."); - result = aRange->GetCommonParent(getter_AddRefs(mCommonParent)); + result = aRange->GetCommonAncestorContainer(getter_AddRefs(mCommonParent)); NS_ASSERTION((NS_SUCCEEDED(result)), "GetCommonParent failed."); #ifdef NS_DEBUG diff --git a/editor/base/nsEditor.cpp b/editor/base/nsEditor.cpp index 126b4693135..354a8c2b113 100644 --- a/editor/base/nsEditor.cpp +++ b/editor/base/nsEditor.cpp @@ -246,7 +246,7 @@ nsSelectionState::IsCollapsed() item->GetRange(&range); if (!range) return PR_FALSE; PRBool bIsCollapsed; - range->GetIsCollapsed(&bIsCollapsed); + range->GetCollapsed(&bIsCollapsed); return bIsCollapsed; } @@ -272,9 +272,9 @@ nsSelectionState::IsEqual(nsSelectionState *aSelState) if (!myRange || !itsRange) return PR_FALSE; PRInt32 compResult; - myRange->CompareEndPoints(nsIDOMRange::START_TO_START, itsRange, &compResult); + myRange->CompareBoundaryPoints(nsIDOMRange::START_TO_START, itsRange, &compResult); if (compResult) return PR_FALSE; - myRange->CompareEndPoints(nsIDOMRange::END_TO_END, itsRange, &compResult); + myRange->CompareBoundaryPoints(nsIDOMRange::END_TO_END, itsRange, &compResult); if (compResult) return PR_FALSE; } // if we got here, they are equal @@ -613,8 +613,8 @@ nsSelectionState::DidMoveNode(nsIDOMNode *aOldParent, PRInt32 aOldOffset, nsIDOM nsresult SelRangeStore::StoreRange(nsIDOMRange *aRange) { if (!aRange) return NS_ERROR_NULL_POINTER; - aRange->GetStartParent(getter_AddRefs(startNode)); - aRange->GetEndParent(getter_AddRefs(endNode)); + aRange->GetStartContainer(getter_AddRefs(startNode)); + aRange->GetEndContainer(getter_AddRefs(endNode)); aRange->GetStartOffset(&startOffset); aRange->GetEndOffset(&endOffset); return NS_OK; @@ -4523,7 +4523,7 @@ nsEditor::GetBlockSectionsForRange(nsIDOMRange *aRange, nsISupportsArray *aSecti { nsCOMPtr lastStartNode; nsCOMPtr blockParentOfLastStartNode; - lastRange->GetStartParent(getter_AddRefs(lastStartNode)); + lastRange->GetStartContainer(getter_AddRefs(lastStartNode)); blockParentOfLastStartNode = do_QueryInterface(GetBlockNodeParent(lastStartNode)); if (blockParentOfLastStartNode) { @@ -4740,7 +4740,7 @@ nsEditor::GetStartNodeAndOffset(nsIDOMSelection *aSelection, if (!range) return NS_ERROR_FAILURE; - if (NS_FAILED(range->GetStartParent(getter_AddRefs(*outStartNode)))) + if (NS_FAILED(range->GetStartContainer(getter_AddRefs(*outStartNode)))) return NS_ERROR_FAILURE; if (NS_FAILED(range->GetStartOffset(outStartOffset))) @@ -4775,7 +4775,7 @@ nsEditor::GetEndNodeAndOffset(nsIDOMSelection *aSelection, if (!range) return NS_ERROR_FAILURE; - if (NS_FAILED(range->GetEndParent(getter_AddRefs(*outEndNode)))) + if (NS_FAILED(range->GetEndContainer(getter_AddRefs(*outEndNode)))) return NS_ERROR_FAILURE; if (NS_FAILED(range->GetEndOffset(outEndOffset))) @@ -5569,7 +5569,7 @@ nsEditor::CreateTxnForDeleteSelection(nsIEditor::EDirection aAction, if ((NS_SUCCEEDED(result)) && (currentItem)) { nsCOMPtr range( do_QueryInterface(currentItem) ); - range->GetIsCollapsed(&isCollapsed); + range->GetCollapsed(&isCollapsed); if (PR_FALSE==isCollapsed) { DeleteRangeTxn *txn; @@ -5615,7 +5615,7 @@ nsEditor::CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange, PRInt32 offset; // get the node and offset of the insertion point - nsresult result = aRange->GetStartParent(getter_AddRefs(node)); + nsresult result = aRange->GetStartContainer(getter_AddRefs(node)); if (NS_FAILED(result)) return result; result = aRange->GetStartOffset(&offset); @@ -5830,7 +5830,7 @@ nsEditor::GetFirstNodeInRange(nsIDOMRange *aRange, nsIDOMNode **aNode) *aNode = nsnull; nsCOMPtr startParent; - nsresult res = aRange->GetStartParent(getter_AddRefs(startParent)); + nsresult res = aRange->GetStartContainer(getter_AddRefs(startParent)); if (NS_FAILED(res)) return res; if (!startParent) return NS_ERROR_FAILURE; diff --git a/editor/base/nsEditorEventListeners.cpp b/editor/base/nsEditorEventListeners.cpp index 65db4ea834f..7332d135c31 100644 --- a/editor/base/nsEditorEventListeners.cpp +++ b/editor/base/nsEditorEventListeners.cpp @@ -1088,8 +1088,7 @@ nsTextEditorFocusListener::Blur(nsIDOMEvent* aEvent) if (selCon) { selCon->SetCaretEnabled(PR_FALSE); - if((flags & nsIHTMLEditor::eEditorSingleLineMask) || - (flags & nsIHTMLEditor::eEditorPlaintextMask) || + if((flags & nsIHTMLEditor::eEditorWidgetMask) || (flags & nsIHTMLEditor::eEditorPasswordMask) || (flags & nsIHTMLEditor::eEditorReadonlyMask) || (flags & nsIHTMLEditor::eEditorDisabledMask) || diff --git a/editor/base/nsHTMLEditRules.cpp b/editor/base/nsHTMLEditRules.cpp index 07eff2f71b8..258f1811360 100644 --- a/editor/base/nsHTMLEditRules.cpp +++ b/editor/base/nsHTMLEditRules.cpp @@ -2982,7 +2982,7 @@ nsHTMLEditRules::GetPromotedRanges(nsIDOMSelection *inSelection, if (NS_FAILED(res)) return res; // clone range so we dont muck with actual selection ranges - res = selectionRange->Clone(getter_AddRefs(opRange)); + res = selectionRange->CloneRange(getter_AddRefs(opRange)); if (NS_FAILED(res)) return res; // make a new adjusted range to represent the appropriate block content. @@ -3013,11 +3013,11 @@ nsHTMLEditRules::PromoteRange(nsIDOMRange *inRange, nsCOMPtr startNode, endNode; PRInt32 startOffset, endOffset; - res = inRange->GetStartParent(getter_AddRefs(startNode)); + res = inRange->GetStartContainer(getter_AddRefs(startNode)); if (NS_FAILED(res)) return res; res = inRange->GetStartOffset(&startOffset); if (NS_FAILED(res)) return res; - res = inRange->GetEndParent(getter_AddRefs(endNode)); + res = inRange->GetEndContainer(getter_AddRefs(endNode)); if (NS_FAILED(res)) return res; res = inRange->GetEndOffset(&endOffset); if (NS_FAILED(res)) return res; @@ -4381,11 +4381,11 @@ nsHTMLEditRules::AdjustWhitespace(nsIDOMSelection *aSelection) // This is an efficiency hack for normal typing in the editor. nsCOMPtr startNode, endNode; PRInt32 startOffset, endOffset; - res = mDocChangeRange->GetStartParent(getter_AddRefs(startNode)); + res = mDocChangeRange->GetStartContainer(getter_AddRefs(startNode)); if (NS_FAILED(res)) return res; res = mDocChangeRange->GetStartOffset(&startOffset); if (NS_FAILED(res)) return res; - res = mDocChangeRange->GetEndParent(getter_AddRefs(endNode)); + res = mDocChangeRange->GetEndContainer(getter_AddRefs(endNode)); if (NS_FAILED(res)) return res; res = mDocChangeRange->GetEndOffset(&endOffset); if (NS_FAILED(res)) return res; @@ -4781,7 +4781,7 @@ nsHTMLEditRules::SelectionEndpointInNode(nsIDOMNode *aNode, PRBool *aResult) nsCOMPtr range( do_QueryInterface(currentItem) ); nsCOMPtr startParent, endParent; - range->GetStartParent(getter_AddRefs(startParent)); + range->GetStartContainer(getter_AddRefs(startParent)); if (startParent) { if (aNode == startParent.get()) @@ -4795,7 +4795,7 @@ nsHTMLEditRules::SelectionEndpointInNode(nsIDOMNode *aNode, PRBool *aResult) return NS_OK; } } - range->GetEndParent(getter_AddRefs(endParent)); + range->GetEndContainer(getter_AddRefs(endParent)); if (startParent == endParent) continue; if (endParent) { @@ -5089,7 +5089,7 @@ nsHTMLEditRules::UpdateDocChangeRange(nsIDOMRange *aRange) if (!mDocChangeRange) { // clone aRange. - res = aRange->Clone(getter_AddRefs(mDocChangeRange)); + res = aRange->CloneRange(getter_AddRefs(mDocChangeRange)); return res; } else @@ -5097,13 +5097,13 @@ nsHTMLEditRules::UpdateDocChangeRange(nsIDOMRange *aRange) PRInt32 result; // compare starts of ranges - res = mDocChangeRange->CompareEndPoints(nsIDOMRange::START_TO_START, aRange, &result); + res = mDocChangeRange->CompareBoundaryPoints(nsIDOMRange::START_TO_START, aRange, &result); if (NS_FAILED(res)) return res; if (result < 0) // negative result means aRange start is before mDocChangeRange start { nsCOMPtr startNode; PRInt32 startOffset; - res = aRange->GetStartParent(getter_AddRefs(startNode)); + res = aRange->GetStartContainer(getter_AddRefs(startNode)); if (NS_FAILED(res)) return res; res = aRange->GetStartOffset(&startOffset); if (NS_FAILED(res)) return res; @@ -5112,13 +5112,13 @@ nsHTMLEditRules::UpdateDocChangeRange(nsIDOMRange *aRange) } // compare ends of ranges - res = mDocChangeRange->CompareEndPoints(nsIDOMRange::END_TO_END, aRange, &result); + res = mDocChangeRange->CompareBoundaryPoints(nsIDOMRange::END_TO_END, aRange, &result); if (NS_FAILED(res)) return res; if (result > 0) // positive result means aRange end is after mDocChangeRange end { nsCOMPtr endNode; PRInt32 endOffset; - res = aRange->GetEndParent(getter_AddRefs(endNode)); + res = aRange->GetEndContainer(getter_AddRefs(endNode)); if (NS_FAILED(res)) return res; res = aRange->GetEndOffset(&endOffset); if (NS_FAILED(res)) return res; diff --git a/editor/base/nsHTMLEditor.cpp b/editor/base/nsHTMLEditor.cpp index 3b22bc21e45..055dd6b83e4 100644 --- a/editor/base/nsHTMLEditor.cpp +++ b/editor/base/nsHTMLEditor.cpp @@ -1073,9 +1073,9 @@ NS_IMETHODIMP nsHTMLEditor::SetInlineProperty(nsIAtom *aProperty, // check for easy case: both range endpoints in same text node nsCOMPtr startNode, endNode; - res = range->GetStartParent(getter_AddRefs(startNode)); + res = range->GetStartContainer(getter_AddRefs(startNode)); if (NS_FAILED(res)) return res; - res = range->GetEndParent(getter_AddRefs(endNode)); + res = range->GetEndContainer(getter_AddRefs(endNode)); if (NS_FAILED(res)) return res; if ((startNode == endNode) && IsTextNode(startNode)) { @@ -1359,11 +1359,11 @@ nsresult nsHTMLEditor::SplitStyleAboveRange(nsIDOMRange *inRange, nsCOMPtr startNode, endNode, origStartNode; PRInt32 startOffset, endOffset, origStartOffset; - res = inRange->GetStartParent(getter_AddRefs(startNode)); + res = inRange->GetStartContainer(getter_AddRefs(startNode)); if (NS_FAILED(res)) return res; res = inRange->GetStartOffset(&startOffset); if (NS_FAILED(res)) return res; - res = inRange->GetEndParent(getter_AddRefs(endNode)); + res = inRange->GetEndContainer(getter_AddRefs(endNode)); if (NS_FAILED(res)) return res; res = inRange->GetEndOffset(&endOffset); if (NS_FAILED(res)) return res; @@ -1628,11 +1628,11 @@ nsresult nsHTMLEditor::PromoteInlineRange(nsIDOMRange *inRange) nsCOMPtr startNode, endNode, parent; PRInt32 startOffset, endOffset; - res = inRange->GetStartParent(getter_AddRefs(startNode)); + res = inRange->GetStartContainer(getter_AddRefs(startNode)); if (NS_FAILED(res)) return res; res = inRange->GetStartOffset(&startOffset); if (NS_FAILED(res)) return res; - res = inRange->GetEndParent(getter_AddRefs(endNode)); + res = inRange->GetEndContainer(getter_AddRefs(endNode)); if (NS_FAILED(res)) return res; res = inRange->GetEndOffset(&endOffset); if (NS_FAILED(res)) return res; @@ -1771,7 +1771,7 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty, // efficiency hack. we cache prior results for being collapsed in a given text node. // this speeds up typing. Note that other parts of the editor code have to clear out // this cache after certain actions. - range->GetStartParent(getter_AddRefs(collapsedNode)); + range->GetStartContainer(getter_AddRefs(collapsedNode)); if (!collapsedNode) return NS_ERROR_FAILURE; // refresh the cache if we need to if (collapsedNode != mCachedNode) CacheInlineStyles(collapsedNode); @@ -1983,9 +1983,9 @@ nsresult nsHTMLEditor::RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsStri // check for easy case: both range endpoints in same text node nsCOMPtr startNode, endNode; - res = range->GetStartParent(getter_AddRefs(startNode)); + res = range->GetStartContainer(getter_AddRefs(startNode)); if (NS_FAILED(res)) return res; - res = range->GetEndParent(getter_AddRefs(endNode)); + res = range->GetEndContainer(getter_AddRefs(endNode)); if (NS_FAILED(res)) return res; if ((startNode == endNode) && IsTextNode(startNode)) { @@ -2090,7 +2090,7 @@ nsresult nsHTMLEditor::GetTextSelectionOffsets(nsIDOMSelection *aSelection, if ((NS_SUCCEEDED(findParentResult)) && (currentItem)) { nsCOMPtr range( do_QueryInterface(currentItem) ); - range->GetCommonParent(getter_AddRefs(parentNode)); + range->GetCommonAncestorContainer(getter_AddRefs(parentNode)); } else { @@ -2984,7 +2984,7 @@ nsHTMLEditor::GetParentBlockTags(nsStringArray *aTagList, PRBool aGetLists) while (subRange) { nsCOMPtrstartParent; - res = subRange->GetStartParent(getter_AddRefs(startParent)); + res = subRange->GetStartContainer(getter_AddRefs(startParent)); if (NS_SUCCEEDED(res) && startParent) { nsCOMPtr blockParent; @@ -3646,13 +3646,13 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu nsCOMPtr startParent; PRInt32 startOffset, endOffset; - res = range->GetStartParent(getter_AddRefs(startParent)); + res = range->GetStartContainer(getter_AddRefs(startParent)); if (NS_FAILED(res)) return res; res = range->GetStartOffset(&startOffset); if (NS_FAILED(res)) return res; nsCOMPtr endParent; - res = range->GetEndParent(getter_AddRefs(endParent)); + res = range->GetEndContainer(getter_AddRefs(endParent)); if (NS_FAILED(res)) return res; res = range->GetEndOffset(&endOffset); if (NS_FAILED(res)) return res; @@ -6746,9 +6746,9 @@ nsHTMLEditor::RelativeFontChange( PRInt32 aSizeChange) // check for easy case: both range endpoints in same text node nsCOMPtr startNode, endNode; - res = range->GetStartParent(getter_AddRefs(startNode)); + res = range->GetStartContainer(getter_AddRefs(startNode)); if (NS_FAILED(res)) return res; - res = range->GetEndParent(getter_AddRefs(endNode)); + res = range->GetEndContainer(getter_AddRefs(endNode)); if (NS_FAILED(res)) return res; if ((startNode == endNode) && IsTextNode(startNode)) { diff --git a/editor/base/nsHTMLEditorLog.cpp b/editor/base/nsHTMLEditorLog.cpp index e25a6acc431..1b9244a4cd2 100644 --- a/editor/base/nsHTMLEditorLog.cpp +++ b/editor/base/nsHTMLEditorLog.cpp @@ -987,7 +987,7 @@ nsHTMLEditorLog::PrintSelection() if (NS_FAILED(result)) return result; - result = range->GetStartParent(getter_AddRefs(startNode)); + result = range->GetStartContainer(getter_AddRefs(startNode)); if (NS_FAILED(result)) return result; @@ -1000,7 +1000,7 @@ nsHTMLEditorLog::PrintSelection() if (NS_FAILED(result)) return result; - result = range->GetEndParent(getter_AddRefs(endNode)); + result = range->GetEndContainer(getter_AddRefs(endNode)); if (NS_FAILED(result)) return result; diff --git a/editor/base/nsTableEditor.cpp b/editor/base/nsTableEditor.cpp index 92801fb5fda..9018190b22c 100644 --- a/editor/base/nsTableEditor.cpp +++ b/editor/base/nsTableEditor.cpp @@ -2760,7 +2760,7 @@ nsHTMLEditor::GetCellFromRange(nsIDOMRange *aRange, nsIDOMElement **aCell) *aCell = nsnull; nsCOMPtr startParent; - nsresult res = aRange->GetStartParent(getter_AddRefs(startParent)); + nsresult res = aRange->GetStartContainer(getter_AddRefs(startParent)); if (NS_FAILED(res)) return res; if (!startParent) return NS_ERROR_FAILURE; @@ -2773,7 +2773,7 @@ nsHTMLEditor::GetCellFromRange(nsIDOMRange *aRange, nsIDOMElement **aCell) if (!childNode) return NS_ERROR_FAILURE; nsCOMPtr endParent; - res = aRange->GetEndParent(getter_AddRefs(endParent)); + res = aRange->GetEndContainer(getter_AddRefs(endParent)); if (NS_FAILED(res)) return res; if (!startParent) return NS_ERROR_FAILURE; diff --git a/editor/libeditor/base/DeleteRangeTxn.cpp b/editor/libeditor/base/DeleteRangeTxn.cpp index 9a3c9b7e93c..3c6eb9895e5 100644 --- a/editor/libeditor/base/DeleteRangeTxn.cpp +++ b/editor/libeditor/base/DeleteRangeTxn.cpp @@ -59,15 +59,15 @@ NS_IMETHODIMP DeleteRangeTxn::Init(nsIEditor *aEditor, nsIDOMRange *aRange) mEditor = aEditor; mRange = do_QueryInterface(aRange); - nsresult result = aRange->GetStartParent(getter_AddRefs(mStartParent)); + nsresult result = aRange->GetStartContainer(getter_AddRefs(mStartParent)); NS_ASSERTION((NS_SUCCEEDED(result)), "GetStartParent failed."); - result = aRange->GetEndParent(getter_AddRefs(mEndParent)); + result = aRange->GetEndContainer(getter_AddRefs(mEndParent)); NS_ASSERTION((NS_SUCCEEDED(result)), "GetEndParent failed."); result = aRange->GetStartOffset(&mStartOffset); NS_ASSERTION((NS_SUCCEEDED(result)), "GetStartOffset failed."); result = aRange->GetEndOffset(&mEndOffset); NS_ASSERTION((NS_SUCCEEDED(result)), "GetEndOffset failed."); - result = aRange->GetCommonParent(getter_AddRefs(mCommonParent)); + result = aRange->GetCommonAncestorContainer(getter_AddRefs(mCommonParent)); NS_ASSERTION((NS_SUCCEEDED(result)), "GetCommonParent failed."); #ifdef NS_DEBUG diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index 126b4693135..354a8c2b113 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -246,7 +246,7 @@ nsSelectionState::IsCollapsed() item->GetRange(&range); if (!range) return PR_FALSE; PRBool bIsCollapsed; - range->GetIsCollapsed(&bIsCollapsed); + range->GetCollapsed(&bIsCollapsed); return bIsCollapsed; } @@ -272,9 +272,9 @@ nsSelectionState::IsEqual(nsSelectionState *aSelState) if (!myRange || !itsRange) return PR_FALSE; PRInt32 compResult; - myRange->CompareEndPoints(nsIDOMRange::START_TO_START, itsRange, &compResult); + myRange->CompareBoundaryPoints(nsIDOMRange::START_TO_START, itsRange, &compResult); if (compResult) return PR_FALSE; - myRange->CompareEndPoints(nsIDOMRange::END_TO_END, itsRange, &compResult); + myRange->CompareBoundaryPoints(nsIDOMRange::END_TO_END, itsRange, &compResult); if (compResult) return PR_FALSE; } // if we got here, they are equal @@ -613,8 +613,8 @@ nsSelectionState::DidMoveNode(nsIDOMNode *aOldParent, PRInt32 aOldOffset, nsIDOM nsresult SelRangeStore::StoreRange(nsIDOMRange *aRange) { if (!aRange) return NS_ERROR_NULL_POINTER; - aRange->GetStartParent(getter_AddRefs(startNode)); - aRange->GetEndParent(getter_AddRefs(endNode)); + aRange->GetStartContainer(getter_AddRefs(startNode)); + aRange->GetEndContainer(getter_AddRefs(endNode)); aRange->GetStartOffset(&startOffset); aRange->GetEndOffset(&endOffset); return NS_OK; @@ -4523,7 +4523,7 @@ nsEditor::GetBlockSectionsForRange(nsIDOMRange *aRange, nsISupportsArray *aSecti { nsCOMPtr lastStartNode; nsCOMPtr blockParentOfLastStartNode; - lastRange->GetStartParent(getter_AddRefs(lastStartNode)); + lastRange->GetStartContainer(getter_AddRefs(lastStartNode)); blockParentOfLastStartNode = do_QueryInterface(GetBlockNodeParent(lastStartNode)); if (blockParentOfLastStartNode) { @@ -4740,7 +4740,7 @@ nsEditor::GetStartNodeAndOffset(nsIDOMSelection *aSelection, if (!range) return NS_ERROR_FAILURE; - if (NS_FAILED(range->GetStartParent(getter_AddRefs(*outStartNode)))) + if (NS_FAILED(range->GetStartContainer(getter_AddRefs(*outStartNode)))) return NS_ERROR_FAILURE; if (NS_FAILED(range->GetStartOffset(outStartOffset))) @@ -4775,7 +4775,7 @@ nsEditor::GetEndNodeAndOffset(nsIDOMSelection *aSelection, if (!range) return NS_ERROR_FAILURE; - if (NS_FAILED(range->GetEndParent(getter_AddRefs(*outEndNode)))) + if (NS_FAILED(range->GetEndContainer(getter_AddRefs(*outEndNode)))) return NS_ERROR_FAILURE; if (NS_FAILED(range->GetEndOffset(outEndOffset))) @@ -5569,7 +5569,7 @@ nsEditor::CreateTxnForDeleteSelection(nsIEditor::EDirection aAction, if ((NS_SUCCEEDED(result)) && (currentItem)) { nsCOMPtr range( do_QueryInterface(currentItem) ); - range->GetIsCollapsed(&isCollapsed); + range->GetCollapsed(&isCollapsed); if (PR_FALSE==isCollapsed) { DeleteRangeTxn *txn; @@ -5615,7 +5615,7 @@ nsEditor::CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange, PRInt32 offset; // get the node and offset of the insertion point - nsresult result = aRange->GetStartParent(getter_AddRefs(node)); + nsresult result = aRange->GetStartContainer(getter_AddRefs(node)); if (NS_FAILED(result)) return result; result = aRange->GetStartOffset(&offset); @@ -5830,7 +5830,7 @@ nsEditor::GetFirstNodeInRange(nsIDOMRange *aRange, nsIDOMNode **aNode) *aNode = nsnull; nsCOMPtr startParent; - nsresult res = aRange->GetStartParent(getter_AddRefs(startParent)); + nsresult res = aRange->GetStartContainer(getter_AddRefs(startParent)); if (NS_FAILED(res)) return res; if (!startParent) return NS_ERROR_FAILURE; diff --git a/editor/libeditor/html/nsHTMLEditRules.cpp b/editor/libeditor/html/nsHTMLEditRules.cpp index 07eff2f71b8..258f1811360 100644 --- a/editor/libeditor/html/nsHTMLEditRules.cpp +++ b/editor/libeditor/html/nsHTMLEditRules.cpp @@ -2982,7 +2982,7 @@ nsHTMLEditRules::GetPromotedRanges(nsIDOMSelection *inSelection, if (NS_FAILED(res)) return res; // clone range so we dont muck with actual selection ranges - res = selectionRange->Clone(getter_AddRefs(opRange)); + res = selectionRange->CloneRange(getter_AddRefs(opRange)); if (NS_FAILED(res)) return res; // make a new adjusted range to represent the appropriate block content. @@ -3013,11 +3013,11 @@ nsHTMLEditRules::PromoteRange(nsIDOMRange *inRange, nsCOMPtr startNode, endNode; PRInt32 startOffset, endOffset; - res = inRange->GetStartParent(getter_AddRefs(startNode)); + res = inRange->GetStartContainer(getter_AddRefs(startNode)); if (NS_FAILED(res)) return res; res = inRange->GetStartOffset(&startOffset); if (NS_FAILED(res)) return res; - res = inRange->GetEndParent(getter_AddRefs(endNode)); + res = inRange->GetEndContainer(getter_AddRefs(endNode)); if (NS_FAILED(res)) return res; res = inRange->GetEndOffset(&endOffset); if (NS_FAILED(res)) return res; @@ -4381,11 +4381,11 @@ nsHTMLEditRules::AdjustWhitespace(nsIDOMSelection *aSelection) // This is an efficiency hack for normal typing in the editor. nsCOMPtr startNode, endNode; PRInt32 startOffset, endOffset; - res = mDocChangeRange->GetStartParent(getter_AddRefs(startNode)); + res = mDocChangeRange->GetStartContainer(getter_AddRefs(startNode)); if (NS_FAILED(res)) return res; res = mDocChangeRange->GetStartOffset(&startOffset); if (NS_FAILED(res)) return res; - res = mDocChangeRange->GetEndParent(getter_AddRefs(endNode)); + res = mDocChangeRange->GetEndContainer(getter_AddRefs(endNode)); if (NS_FAILED(res)) return res; res = mDocChangeRange->GetEndOffset(&endOffset); if (NS_FAILED(res)) return res; @@ -4781,7 +4781,7 @@ nsHTMLEditRules::SelectionEndpointInNode(nsIDOMNode *aNode, PRBool *aResult) nsCOMPtr range( do_QueryInterface(currentItem) ); nsCOMPtr startParent, endParent; - range->GetStartParent(getter_AddRefs(startParent)); + range->GetStartContainer(getter_AddRefs(startParent)); if (startParent) { if (aNode == startParent.get()) @@ -4795,7 +4795,7 @@ nsHTMLEditRules::SelectionEndpointInNode(nsIDOMNode *aNode, PRBool *aResult) return NS_OK; } } - range->GetEndParent(getter_AddRefs(endParent)); + range->GetEndContainer(getter_AddRefs(endParent)); if (startParent == endParent) continue; if (endParent) { @@ -5089,7 +5089,7 @@ nsHTMLEditRules::UpdateDocChangeRange(nsIDOMRange *aRange) if (!mDocChangeRange) { // clone aRange. - res = aRange->Clone(getter_AddRefs(mDocChangeRange)); + res = aRange->CloneRange(getter_AddRefs(mDocChangeRange)); return res; } else @@ -5097,13 +5097,13 @@ nsHTMLEditRules::UpdateDocChangeRange(nsIDOMRange *aRange) PRInt32 result; // compare starts of ranges - res = mDocChangeRange->CompareEndPoints(nsIDOMRange::START_TO_START, aRange, &result); + res = mDocChangeRange->CompareBoundaryPoints(nsIDOMRange::START_TO_START, aRange, &result); if (NS_FAILED(res)) return res; if (result < 0) // negative result means aRange start is before mDocChangeRange start { nsCOMPtr startNode; PRInt32 startOffset; - res = aRange->GetStartParent(getter_AddRefs(startNode)); + res = aRange->GetStartContainer(getter_AddRefs(startNode)); if (NS_FAILED(res)) return res; res = aRange->GetStartOffset(&startOffset); if (NS_FAILED(res)) return res; @@ -5112,13 +5112,13 @@ nsHTMLEditRules::UpdateDocChangeRange(nsIDOMRange *aRange) } // compare ends of ranges - res = mDocChangeRange->CompareEndPoints(nsIDOMRange::END_TO_END, aRange, &result); + res = mDocChangeRange->CompareBoundaryPoints(nsIDOMRange::END_TO_END, aRange, &result); if (NS_FAILED(res)) return res; if (result > 0) // positive result means aRange end is after mDocChangeRange end { nsCOMPtr endNode; PRInt32 endOffset; - res = aRange->GetEndParent(getter_AddRefs(endNode)); + res = aRange->GetEndContainer(getter_AddRefs(endNode)); if (NS_FAILED(res)) return res; res = aRange->GetEndOffset(&endOffset); if (NS_FAILED(res)) return res; diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp index 3b22bc21e45..055dd6b83e4 100644 --- a/editor/libeditor/html/nsHTMLEditor.cpp +++ b/editor/libeditor/html/nsHTMLEditor.cpp @@ -1073,9 +1073,9 @@ NS_IMETHODIMP nsHTMLEditor::SetInlineProperty(nsIAtom *aProperty, // check for easy case: both range endpoints in same text node nsCOMPtr startNode, endNode; - res = range->GetStartParent(getter_AddRefs(startNode)); + res = range->GetStartContainer(getter_AddRefs(startNode)); if (NS_FAILED(res)) return res; - res = range->GetEndParent(getter_AddRefs(endNode)); + res = range->GetEndContainer(getter_AddRefs(endNode)); if (NS_FAILED(res)) return res; if ((startNode == endNode) && IsTextNode(startNode)) { @@ -1359,11 +1359,11 @@ nsresult nsHTMLEditor::SplitStyleAboveRange(nsIDOMRange *inRange, nsCOMPtr startNode, endNode, origStartNode; PRInt32 startOffset, endOffset, origStartOffset; - res = inRange->GetStartParent(getter_AddRefs(startNode)); + res = inRange->GetStartContainer(getter_AddRefs(startNode)); if (NS_FAILED(res)) return res; res = inRange->GetStartOffset(&startOffset); if (NS_FAILED(res)) return res; - res = inRange->GetEndParent(getter_AddRefs(endNode)); + res = inRange->GetEndContainer(getter_AddRefs(endNode)); if (NS_FAILED(res)) return res; res = inRange->GetEndOffset(&endOffset); if (NS_FAILED(res)) return res; @@ -1628,11 +1628,11 @@ nsresult nsHTMLEditor::PromoteInlineRange(nsIDOMRange *inRange) nsCOMPtr startNode, endNode, parent; PRInt32 startOffset, endOffset; - res = inRange->GetStartParent(getter_AddRefs(startNode)); + res = inRange->GetStartContainer(getter_AddRefs(startNode)); if (NS_FAILED(res)) return res; res = inRange->GetStartOffset(&startOffset); if (NS_FAILED(res)) return res; - res = inRange->GetEndParent(getter_AddRefs(endNode)); + res = inRange->GetEndContainer(getter_AddRefs(endNode)); if (NS_FAILED(res)) return res; res = inRange->GetEndOffset(&endOffset); if (NS_FAILED(res)) return res; @@ -1771,7 +1771,7 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty, // efficiency hack. we cache prior results for being collapsed in a given text node. // this speeds up typing. Note that other parts of the editor code have to clear out // this cache after certain actions. - range->GetStartParent(getter_AddRefs(collapsedNode)); + range->GetStartContainer(getter_AddRefs(collapsedNode)); if (!collapsedNode) return NS_ERROR_FAILURE; // refresh the cache if we need to if (collapsedNode != mCachedNode) CacheInlineStyles(collapsedNode); @@ -1983,9 +1983,9 @@ nsresult nsHTMLEditor::RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsStri // check for easy case: both range endpoints in same text node nsCOMPtr startNode, endNode; - res = range->GetStartParent(getter_AddRefs(startNode)); + res = range->GetStartContainer(getter_AddRefs(startNode)); if (NS_FAILED(res)) return res; - res = range->GetEndParent(getter_AddRefs(endNode)); + res = range->GetEndContainer(getter_AddRefs(endNode)); if (NS_FAILED(res)) return res; if ((startNode == endNode) && IsTextNode(startNode)) { @@ -2090,7 +2090,7 @@ nsresult nsHTMLEditor::GetTextSelectionOffsets(nsIDOMSelection *aSelection, if ((NS_SUCCEEDED(findParentResult)) && (currentItem)) { nsCOMPtr range( do_QueryInterface(currentItem) ); - range->GetCommonParent(getter_AddRefs(parentNode)); + range->GetCommonAncestorContainer(getter_AddRefs(parentNode)); } else { @@ -2984,7 +2984,7 @@ nsHTMLEditor::GetParentBlockTags(nsStringArray *aTagList, PRBool aGetLists) while (subRange) { nsCOMPtrstartParent; - res = subRange->GetStartParent(getter_AddRefs(startParent)); + res = subRange->GetStartContainer(getter_AddRefs(startParent)); if (NS_SUCCEEDED(res) && startParent) { nsCOMPtr blockParent; @@ -3646,13 +3646,13 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu nsCOMPtr startParent; PRInt32 startOffset, endOffset; - res = range->GetStartParent(getter_AddRefs(startParent)); + res = range->GetStartContainer(getter_AddRefs(startParent)); if (NS_FAILED(res)) return res; res = range->GetStartOffset(&startOffset); if (NS_FAILED(res)) return res; nsCOMPtr endParent; - res = range->GetEndParent(getter_AddRefs(endParent)); + res = range->GetEndContainer(getter_AddRefs(endParent)); if (NS_FAILED(res)) return res; res = range->GetEndOffset(&endOffset); if (NS_FAILED(res)) return res; @@ -6746,9 +6746,9 @@ nsHTMLEditor::RelativeFontChange( PRInt32 aSizeChange) // check for easy case: both range endpoints in same text node nsCOMPtr startNode, endNode; - res = range->GetStartParent(getter_AddRefs(startNode)); + res = range->GetStartContainer(getter_AddRefs(startNode)); if (NS_FAILED(res)) return res; - res = range->GetEndParent(getter_AddRefs(endNode)); + res = range->GetEndContainer(getter_AddRefs(endNode)); if (NS_FAILED(res)) return res; if ((startNode == endNode) && IsTextNode(startNode)) { diff --git a/editor/libeditor/html/nsHTMLEditorLog.cpp b/editor/libeditor/html/nsHTMLEditorLog.cpp index e25a6acc431..1b9244a4cd2 100644 --- a/editor/libeditor/html/nsHTMLEditorLog.cpp +++ b/editor/libeditor/html/nsHTMLEditorLog.cpp @@ -987,7 +987,7 @@ nsHTMLEditorLog::PrintSelection() if (NS_FAILED(result)) return result; - result = range->GetStartParent(getter_AddRefs(startNode)); + result = range->GetStartContainer(getter_AddRefs(startNode)); if (NS_FAILED(result)) return result; @@ -1000,7 +1000,7 @@ nsHTMLEditorLog::PrintSelection() if (NS_FAILED(result)) return result; - result = range->GetEndParent(getter_AddRefs(endNode)); + result = range->GetEndContainer(getter_AddRefs(endNode)); if (NS_FAILED(result)) return result; diff --git a/editor/libeditor/html/nsTableEditor.cpp b/editor/libeditor/html/nsTableEditor.cpp index 92801fb5fda..9018190b22c 100644 --- a/editor/libeditor/html/nsTableEditor.cpp +++ b/editor/libeditor/html/nsTableEditor.cpp @@ -2760,7 +2760,7 @@ nsHTMLEditor::GetCellFromRange(nsIDOMRange *aRange, nsIDOMElement **aCell) *aCell = nsnull; nsCOMPtr startParent; - nsresult res = aRange->GetStartParent(getter_AddRefs(startParent)); + nsresult res = aRange->GetStartContainer(getter_AddRefs(startParent)); if (NS_FAILED(res)) return res; if (!startParent) return NS_ERROR_FAILURE; @@ -2773,7 +2773,7 @@ nsHTMLEditor::GetCellFromRange(nsIDOMRange *aRange, nsIDOMElement **aCell) if (!childNode) return NS_ERROR_FAILURE; nsCOMPtr endParent; - res = aRange->GetEndParent(getter_AddRefs(endParent)); + res = aRange->GetEndContainer(getter_AddRefs(endParent)); if (NS_FAILED(res)) return res; if (!startParent) return NS_ERROR_FAILURE; diff --git a/editor/libeditor/text/nsEditorEventListeners.cpp b/editor/libeditor/text/nsEditorEventListeners.cpp index 65db4ea834f..7332d135c31 100644 --- a/editor/libeditor/text/nsEditorEventListeners.cpp +++ b/editor/libeditor/text/nsEditorEventListeners.cpp @@ -1088,8 +1088,7 @@ nsTextEditorFocusListener::Blur(nsIDOMEvent* aEvent) if (selCon) { selCon->SetCaretEnabled(PR_FALSE); - if((flags & nsIHTMLEditor::eEditorSingleLineMask) || - (flags & nsIHTMLEditor::eEditorPlaintextMask) || + if((flags & nsIHTMLEditor::eEditorWidgetMask) || (flags & nsIHTMLEditor::eEditorPasswordMask) || (flags & nsIHTMLEditor::eEditorReadonlyMask) || (flags & nsIHTMLEditor::eEditorDisabledMask) || diff --git a/editor/libeditor/txtsvc/nsTextServicesDocument.cpp b/editor/libeditor/txtsvc/nsTextServicesDocument.cpp index 84979e8b125..be360b7214b 100644 --- a/editor/libeditor/txtsvc/nsTextServicesDocument.cpp +++ b/editor/libeditor/txtsvc/nsTextServicesDocument.cpp @@ -627,7 +627,7 @@ nsTextServicesDocument::FirstSelectedBlock(TSDBlockSelectionStatus *aSelStatus, return NS_ERROR_FAILURE; } - result = range->GetStartParent(getter_AddRefs(parent)); + result = range->GetStartContainer(getter_AddRefs(parent)); if (NS_FAILED(result)) { @@ -938,7 +938,7 @@ nsTextServicesDocument::FirstSelectedBlock(TSDBlockSelectionStatus *aSelStatus, return NS_ERROR_FAILURE; } - result = range->GetStartParent(getter_AddRefs(parent)); + result = range->GetStartContainer(getter_AddRefs(parent)); if (NS_FAILED(result)) { @@ -968,7 +968,7 @@ nsTextServicesDocument::FirstSelectedBlock(TSDBlockSelectionStatus *aSelStatus, return result; } - result = range->GetIsCollapsed(&isCollapsed); + result = range->GetCollapsed(&isCollapsed); if (NS_FAILED(result)) { @@ -1135,7 +1135,7 @@ nsTextServicesDocument::LastSelectedBlock(TSDBlockSelectionStatus *aSelStatus, P return NS_ERROR_FAILURE; } - result = range->GetStartParent(getter_AddRefs(parent)); + result = range->GetStartContainer(getter_AddRefs(parent)); if (NS_FAILED(result)) { @@ -1445,7 +1445,7 @@ nsTextServicesDocument::LastSelectedBlock(TSDBlockSelectionStatus *aSelStatus, P return NS_ERROR_FAILURE; } - result = range->GetEndParent(getter_AddRefs(parent)); + result = range->GetEndContainer(getter_AddRefs(parent)); if (NS_FAILED(result)) { @@ -1475,7 +1475,7 @@ nsTextServicesDocument::LastSelectedBlock(TSDBlockSelectionStatus *aSelStatus, P return result; } - result = range->GetIsCollapsed(&isCollapsed); + result = range->GetCollapsed(&isCollapsed); if (NS_FAILED(result)) { @@ -3225,7 +3225,7 @@ nsTextServicesDocument::GetCollapsedSelection(nsITextServicesDocument::TSDBlockS if (NS_FAILED(result)) return result; - result = range->GetStartParent(getter_AddRefs(parent)); + result = range->GetStartContainer(getter_AddRefs(parent)); if (NS_FAILED(result)) return result; @@ -3905,7 +3905,7 @@ nsTextServicesDocument::GetRangeEndPoints(nsIDOMRange *aRange, if (!aRange || !aStartParent || !aStartOffset || !aEndParent || !aEndOffset) return NS_ERROR_NULL_POINTER; - result = aRange->GetStartParent(aStartParent); + result = aRange->GetStartContainer(aStartParent); if (NS_FAILED(result)) return result; @@ -3918,7 +3918,7 @@ nsTextServicesDocument::GetRangeEndPoints(nsIDOMRange *aRange, if (NS_FAILED(result)) return result; - result = aRange->GetEndParent(aEndParent); + result = aRange->GetEndContainer(aEndParent); if (NS_FAILED(result)) return result; diff --git a/editor/public/nsIHTMLEditor.h b/editor/public/nsIHTMLEditor.h index d31f74c52fe..e1ca73d3970 100644 --- a/editor/public/nsIHTMLEditor.h +++ b/editor/public/nsIHTMLEditor.h @@ -59,7 +59,8 @@ public: eEditorFilterInputBit, // text input is limited to certain character types, use mFilter eEditorMailBit, // use mail-compose editting rules eEditorDisableForcedUpdatesBit, // prevent immediate view refreshes - eEditorDisableForcedReflowsBit // prevent immediate reflows + eEditorDisableForcedReflowsBit, // prevent immediate reflows + eEditorWidgetBit // bit for widgets // max 32 bits }; @@ -73,7 +74,8 @@ public: eEditorFilterInputMask = (1 << eEditorFilterInputBit), eEditorMailMask = (1 << eEditorMailBit), eEditorDisableForcedUpdatesMask = (1 << eEditorDisableForcedUpdatesBit), - eEditorDisableForcedReflowsMask = (1 << eEditorDisableForcedReflowsBit) + eEditorDisableForcedReflowsMask = (1 << eEditorDisableForcedReflowsBit), + eEditorWidgetMask = (1 << eEditorWidgetBit) }; // below used by TypedText() diff --git a/editor/txtsvc/src/nsTextServicesDocument.cpp b/editor/txtsvc/src/nsTextServicesDocument.cpp index 84979e8b125..be360b7214b 100644 --- a/editor/txtsvc/src/nsTextServicesDocument.cpp +++ b/editor/txtsvc/src/nsTextServicesDocument.cpp @@ -627,7 +627,7 @@ nsTextServicesDocument::FirstSelectedBlock(TSDBlockSelectionStatus *aSelStatus, return NS_ERROR_FAILURE; } - result = range->GetStartParent(getter_AddRefs(parent)); + result = range->GetStartContainer(getter_AddRefs(parent)); if (NS_FAILED(result)) { @@ -938,7 +938,7 @@ nsTextServicesDocument::FirstSelectedBlock(TSDBlockSelectionStatus *aSelStatus, return NS_ERROR_FAILURE; } - result = range->GetStartParent(getter_AddRefs(parent)); + result = range->GetStartContainer(getter_AddRefs(parent)); if (NS_FAILED(result)) { @@ -968,7 +968,7 @@ nsTextServicesDocument::FirstSelectedBlock(TSDBlockSelectionStatus *aSelStatus, return result; } - result = range->GetIsCollapsed(&isCollapsed); + result = range->GetCollapsed(&isCollapsed); if (NS_FAILED(result)) { @@ -1135,7 +1135,7 @@ nsTextServicesDocument::LastSelectedBlock(TSDBlockSelectionStatus *aSelStatus, P return NS_ERROR_FAILURE; } - result = range->GetStartParent(getter_AddRefs(parent)); + result = range->GetStartContainer(getter_AddRefs(parent)); if (NS_FAILED(result)) { @@ -1445,7 +1445,7 @@ nsTextServicesDocument::LastSelectedBlock(TSDBlockSelectionStatus *aSelStatus, P return NS_ERROR_FAILURE; } - result = range->GetEndParent(getter_AddRefs(parent)); + result = range->GetEndContainer(getter_AddRefs(parent)); if (NS_FAILED(result)) { @@ -1475,7 +1475,7 @@ nsTextServicesDocument::LastSelectedBlock(TSDBlockSelectionStatus *aSelStatus, P return result; } - result = range->GetIsCollapsed(&isCollapsed); + result = range->GetCollapsed(&isCollapsed); if (NS_FAILED(result)) { @@ -3225,7 +3225,7 @@ nsTextServicesDocument::GetCollapsedSelection(nsITextServicesDocument::TSDBlockS if (NS_FAILED(result)) return result; - result = range->GetStartParent(getter_AddRefs(parent)); + result = range->GetStartContainer(getter_AddRefs(parent)); if (NS_FAILED(result)) return result; @@ -3905,7 +3905,7 @@ nsTextServicesDocument::GetRangeEndPoints(nsIDOMRange *aRange, if (!aRange || !aStartParent || !aStartOffset || !aEndParent || !aEndOffset) return NS_ERROR_NULL_POINTER; - result = aRange->GetStartParent(aStartParent); + result = aRange->GetStartContainer(aStartParent); if (NS_FAILED(result)) return result; @@ -3918,7 +3918,7 @@ nsTextServicesDocument::GetRangeEndPoints(nsIDOMRange *aRange, if (NS_FAILED(result)) return result; - result = aRange->GetEndParent(aEndParent); + result = aRange->GetEndContainer(aEndParent); if (NS_FAILED(result)) return result; diff --git a/layout/base/src/nsCommentNode.cpp b/layout/base/src/nsCommentNode.cpp index 29d13fe201e..21a7f7b4c4d 100644 --- a/layout/base/src/nsCommentNode.cpp +++ b/layout/base/src/nsCommentNode.cpp @@ -441,8 +441,8 @@ nsCommentNode::ConvertContentToXIF(nsIXIFConverter* aConverter) const PRInt32 startOffset = 0; PRInt32 endOffset = 0; - range->GetStartParent(getter_AddRefs(startNode)); - range->GetEndParent(getter_AddRefs(endNode)); + range->GetStartContainer(getter_AddRefs(startNode)); + range->GetEndContainer(getter_AddRefs(endNode)); range->GetStartOffset(&startOffset); range->GetEndOffset(&endOffset); diff --git a/layout/base/src/nsContentIterator.cpp b/layout/base/src/nsContentIterator.cpp index d71286c2ac0..768682b1a91 100644 --- a/layout/base/src/nsContentIterator.cpp +++ b/layout/base/src/nsContentIterator.cpp @@ -269,12 +269,12 @@ nsresult nsContentIterator::Init(nsIDOMRange* aRange) mIsDone = PR_FALSE; // get common content parent - if (NS_FAILED(aRange->GetCommonParent(getter_AddRefs(dN))) || !dN) + if (NS_FAILED(aRange->GetCommonAncestorContainer(getter_AddRefs(dN))) || !dN) return NS_ERROR_FAILURE; mCommonParent = do_QueryInterface(dN); // get the start node and offset, convert to nsIContent - aRange->GetStartParent(getter_AddRefs(startDOM)); + aRange->GetStartContainer(getter_AddRefs(startDOM)); if (!startDOM) return NS_ERROR_ILLEGAL_VALUE; startCon = do_QueryInterface(startDOM); @@ -284,7 +284,7 @@ nsresult nsContentIterator::Init(nsIDOMRange* aRange) aRange->GetStartOffset(&startIndx); // get the end node and offset, convert to nsIContent - aRange->GetEndParent(getter_AddRefs(endDOM)); + aRange->GetEndContainer(getter_AddRefs(endDOM)); if (!endDOM) return NS_ERROR_ILLEGAL_VALUE; endCon = do_QueryInterface(endDOM); @@ -834,18 +834,18 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange) PRInt32 numChildren; // get common content parent - if (NS_FAILED(aRange->GetCommonParent(getter_AddRefs(commonParent))) || !commonParent) + if (NS_FAILED(aRange->GetCommonAncestorContainer(getter_AddRefs(commonParent))) || !commonParent) return NS_ERROR_FAILURE; mCommonParent = do_QueryInterface(commonParent); // get start content parent - if (NS_FAILED(aRange->GetStartParent(getter_AddRefs(startParent))) || !startParent) + if (NS_FAILED(aRange->GetStartContainer(getter_AddRefs(startParent))) || !startParent) return NS_ERROR_FAILURE; cStartP = do_QueryInterface(startParent); aRange->GetStartOffset(&startIndx); // get end content parent - if (NS_FAILED(aRange->GetEndParent(getter_AddRefs(endParent))) || !endParent) + if (NS_FAILED(aRange->GetEndContainer(getter_AddRefs(endParent))) || !endParent) return NS_ERROR_FAILURE; cEndP = do_QueryInterface(endParent); aRange->GetEndOffset(&endIndx); diff --git a/layout/base/src/nsGeneratedIterator.cpp b/layout/base/src/nsGeneratedIterator.cpp index 8bb59e3b2c5..8be41d72a6d 100644 --- a/layout/base/src/nsGeneratedIterator.cpp +++ b/layout/base/src/nsGeneratedIterator.cpp @@ -299,12 +299,12 @@ nsresult nsGeneratedContentIterator::Init(nsIDOMRange* aRange) mIsDone = PR_FALSE; // get common content parent - if (NS_FAILED(aRange->GetCommonParent(getter_AddRefs(dN))) || !dN) + if (NS_FAILED(aRange->GetCommonAncestorContainer(getter_AddRefs(dN))) || !dN) return NS_ERROR_FAILURE; mCommonParent = do_QueryInterface(dN); // get the start node and offset, convert to nsIContent - aRange->GetStartParent(getter_AddRefs(startDOM)); + aRange->GetStartContainer(getter_AddRefs(startDOM)); if (!startDOM) return NS_ERROR_ILLEGAL_VALUE; startCon = do_QueryInterface(startDOM); @@ -314,7 +314,7 @@ nsresult nsGeneratedContentIterator::Init(nsIDOMRange* aRange) aRange->GetStartOffset(&startIndx); // get the end node and offset, convert to nsIContent - aRange->GetEndParent(getter_AddRefs(endDOM)); + aRange->GetEndContainer(getter_AddRefs(endDOM)); if (!endDOM) return NS_ERROR_ILLEGAL_VALUE; endCon = do_QueryInterface(endDOM); @@ -968,18 +968,18 @@ nsresult nsGeneratedSubtreeIterator::Init(nsIDOMRange* aRange) PRInt32 numChildren; // get common content parent - if (NS_FAILED(aRange->GetCommonParent(getter_AddRefs(commonParent))) || !commonParent) + if (NS_FAILED(aRange->GetCommonAncestorContainer(getter_AddRefs(commonParent))) || !commonParent) return NS_ERROR_FAILURE; mCommonParent = do_QueryInterface(commonParent); // get start content parent - if (NS_FAILED(aRange->GetStartParent(getter_AddRefs(startParent))) || !startParent) + if (NS_FAILED(aRange->GetStartContainer(getter_AddRefs(startParent))) || !startParent) return NS_ERROR_FAILURE; cStartP = do_QueryInterface(startParent); aRange->GetStartOffset(&startIndx); // get end content parent - if (NS_FAILED(aRange->GetEndParent(getter_AddRefs(endParent))) || !endParent) + if (NS_FAILED(aRange->GetEndContainer(getter_AddRefs(endParent))) || !endParent) return NS_ERROR_FAILURE; cEndP = do_QueryInterface(endParent); aRange->GetEndOffset(&endIndx); diff --git a/layout/base/src/nsGenericDOMDataNode.cpp b/layout/base/src/nsGenericDOMDataNode.cpp index badbdaef568..0df161a2206 100644 --- a/layout/base/src/nsGenericDOMDataNode.cpp +++ b/layout/base/src/nsGenericDOMDataNode.cpp @@ -603,8 +603,8 @@ nsGenericDOMDataNode::ConvertContentToXIF(const nsIContent *aOuterContent, PRInt32 startOffset = 0; PRInt32 endOffset = 0; - range->GetStartParent(getter_AddRefs(startNode)); - range->GetEndParent(getter_AddRefs(endNode)); + range->GetStartContainer(getter_AddRefs(startNode)); + range->GetEndContainer(getter_AddRefs(endNode)); range->GetStartOffset(&startOffset); range->GetEndOffset(&endOffset); diff --git a/layout/base/src/nsRange.cpp b/layout/base/src/nsRange.cpp index c115374aa1a..b3d693f83eb 100644 --- a/layout/base/src/nsRange.cpp +++ b/layout/base/src/nsRange.cpp @@ -126,13 +126,13 @@ PRBool IsNodeIntersectsRange(nsIContent* aNode, nsIDOMRange* aRange) if (!GetNodeBracketPoints(aNode, &parent, &nodeStart, &nodeEnd)) return PR_FALSE; - if (NS_FAILED(aRange->GetStartParent(getter_AddRefs(rangeStartParent)))) + if (NS_FAILED(aRange->GetStartContainer(getter_AddRefs(rangeStartParent)))) return PR_FALSE; if (NS_FAILED(aRange->GetStartOffset(&rangeStartOffset))) return PR_FALSE; - if (NS_FAILED(aRange->GetEndParent(getter_AddRefs(rangeEndParent)))) + if (NS_FAILED(aRange->GetEndContainer(getter_AddRefs(rangeEndParent)))) return PR_FALSE; if (NS_FAILED(aRange->GetEndOffset(&rangeEndOffset))) @@ -198,13 +198,13 @@ nsresult CompareNodeToRange(nsIContent* aNode, if (!GetNodeBracketPoints(aNode, &parent, &nodeStart, &nodeEnd)) return NS_ERROR_FAILURE; - if (NS_FAILED(aRange->GetStartParent(getter_AddRefs(rangeStartParent)))) + if (NS_FAILED(aRange->GetStartContainer(getter_AddRefs(rangeStartParent)))) return NS_ERROR_FAILURE; if (NS_FAILED(aRange->GetStartOffset(&rangeStartOffset))) return NS_ERROR_FAILURE; - if (NS_FAILED(aRange->GetEndParent(getter_AddRefs(rangeEndParent)))) + if (NS_FAILED(aRange->GetEndContainer(getter_AddRefs(rangeEndParent)))) return NS_ERROR_FAILURE; if (NS_FAILED(aRange->GetEndOffset(&rangeEndOffset))) @@ -934,7 +934,7 @@ nsresult nsRange::GetIsPositioned(PRBool* aIsPositioned) return NS_OK; } -nsresult nsRange::GetStartParent(nsIDOMNode** aStartParent) +nsresult nsRange::GetStartContainer(nsIDOMNode** aStartParent) { if (!mIsPositioned) return NS_ERROR_NOT_INITIALIZED; @@ -956,7 +956,7 @@ nsresult nsRange::GetStartOffset(PRInt32* aStartOffset) return NS_OK; } -nsresult nsRange::GetEndParent(nsIDOMNode** aEndParent) +nsresult nsRange::GetEndContainer(nsIDOMNode** aEndParent) { if (!mIsPositioned) return NS_ERROR_NOT_INITIALIZED; @@ -978,7 +978,7 @@ nsresult nsRange::GetEndOffset(PRInt32* aEndOffset) return NS_OK; } -nsresult nsRange::GetIsCollapsed(PRBool* aIsCollapsed) +nsresult nsRange::GetCollapsed(PRBool* aIsCollapsed) { if (!mIsPositioned) return NS_ERROR_NOT_INITIALIZED; @@ -990,7 +990,7 @@ nsresult nsRange::GetIsCollapsed(PRBool* aIsCollapsed) return NS_OK; } -nsresult nsRange::GetCommonParent(nsIDOMNode** aCommonParent) +nsresult nsRange::GetCommonAncestorContainer(nsIDOMNode** aCommonParent) { *aCommonParent = CommonParent(mStartParent,mEndParent); NS_IF_ADDREF(*aCommonParent); @@ -1313,7 +1313,7 @@ nsresult nsRange::DeleteContents() return NS_OK; } -nsresult nsRange::CompareEndPoints(PRUint16 how, nsIDOMRange* srcRange, +nsresult nsRange::CompareBoundaryPoints(PRUint16 how, nsIDOMRange* srcRange, PRInt32* aCmpRet) { nsresult res; @@ -1330,28 +1330,28 @@ nsresult nsRange::CompareEndPoints(PRUint16 how, nsIDOMRange* srcRange, case nsIDOMRange::START_TO_START: node1 = mStartParent; offset1 = mStartOffset; - res = srcRange->GetStartParent(getter_AddRefs(node2)); + res = srcRange->GetStartContainer(getter_AddRefs(node2)); if (NS_SUCCEEDED(res)) res = srcRange->GetStartOffset(&offset2); break; case nsIDOMRange::START_TO_END: node1 = mStartParent; offset1 = mStartOffset; - res = srcRange->GetEndParent(getter_AddRefs(node2)); + res = srcRange->GetEndContainer(getter_AddRefs(node2)); if (NS_SUCCEEDED(res)) res = srcRange->GetEndOffset(&offset2); break; case nsIDOMRange::END_TO_START: node1 = mEndParent; offset1 = mEndOffset; - res = srcRange->GetStartParent(getter_AddRefs(node2)); + res = srcRange->GetStartContainer(getter_AddRefs(node2)); if (NS_SUCCEEDED(res)) res = srcRange->GetStartOffset(&offset2); break; case nsIDOMRange::END_TO_END: node1 = mEndParent; offset1 = mEndOffset; - res = srcRange->GetEndParent(getter_AddRefs(node2)); + res = srcRange->GetEndContainer(getter_AddRefs(node2)); if (NS_SUCCEEDED(res)) res = srcRange->GetEndOffset(&offset2); break; @@ -1536,7 +1536,7 @@ return NS_ERROR_NOT_IMPLEMENTED; #endif } -nsresult nsRange::Clone(nsIDOMRange** aReturn) +nsresult nsRange::CloneRange(nsIDOMRange** aReturn) { if (aReturn == 0) return NS_ERROR_NULL_POINTER; @@ -1654,6 +1654,15 @@ nsresult nsRange::ToString(nsAWritableString& aReturn) } + +nsresult +nsRange::Detach() +{ + return DoSetRange(nsnull,0,nsnull,0); +} + + + nsresult nsRange::OwnerGone(nsIContent* aDyingNode) { // nothing for now - should be impossible to getter here diff --git a/layout/base/src/nsRange.h b/layout/base/src/nsRange.h index c9089e13c7b..255b785345a 100644 --- a/layout/base/src/nsRange.h +++ b/layout/base/src/nsRange.h @@ -51,15 +51,15 @@ public: NS_IMETHOD GetIsPositioned(PRBool* aIsPositioned); - NS_IMETHOD GetStartParent(nsIDOMNode** aStartParent); + NS_IMETHOD GetStartContainer(nsIDOMNode** aStartParent); NS_IMETHOD GetStartOffset(PRInt32* aStartOffset); - NS_IMETHOD GetEndParent(nsIDOMNode** aEndParent); + NS_IMETHOD GetEndContainer(nsIDOMNode** aEndParent); NS_IMETHOD GetEndOffset(PRInt32* aEndOffset); - NS_IMETHOD GetIsCollapsed(PRBool* aIsCollapsed); + NS_IMETHOD GetCollapsed(PRBool* aIsCollapsed); - NS_IMETHOD GetCommonParent(nsIDOMNode** aCommonParent); + NS_IMETHOD GetCommonAncestorContainer(nsIDOMNode** aCommonParent); NS_IMETHOD SetStart(nsIDOMNode* aParent, PRInt32 aOffset); NS_IMETHOD SetStartBefore(nsIDOMNode* aSibling); @@ -76,7 +76,7 @@ public: NS_IMETHOD SelectNode(nsIDOMNode* aN); NS_IMETHOD SelectNodeContents(nsIDOMNode* aN); - NS_IMETHOD CompareEndPoints(PRUint16 how, nsIDOMRange* srcRange, PRInt32* ret); + NS_IMETHOD CompareBoundaryPoints(PRUint16 how, nsIDOMRange* srcRange, PRInt32* ret); NS_IMETHOD DeleteContents(); @@ -86,7 +86,9 @@ public: NS_IMETHOD InsertNode(nsIDOMNode* aN); NS_IMETHOD SurroundContents(nsIDOMNode* aN); - NS_IMETHOD Clone(nsIDOMRange** aReturn); + NS_IMETHOD CloneRange(nsIDOMRange** aReturn); + + NS_IMETHOD Detach(); NS_IMETHOD ToString(nsAWritableString& aReturn); diff --git a/layout/base/src/nsSelection.cpp b/layout/base/src/nsSelection.cpp index 04d32e04d11..449db9b088d 100644 --- a/layout/base/src/nsSelection.cpp +++ b/layout/base/src/nsSelection.cpp @@ -2404,7 +2404,7 @@ printf("HandleTableSelection: Unselecting mUnselectCellOnMouseUp; rangeCount=%d\ if (!range) return NS_ERROR_NULL_POINTER; nsCOMPtr parent; - result = range->GetStartParent(getter_AddRefs(parent)); + result = range->GetStartContainer(getter_AddRefs(parent)); if (NS_FAILED(result)) return result; if (!parent) return NS_ERROR_NULL_POINTER; @@ -2718,7 +2718,7 @@ nsSelection::GetFirstCellNodeInRange(nsIDOMRange *aRange, nsIDOMNode **aCellNode *aCellNode = nsnull; nsCOMPtr startParent; - nsresult result = aRange->GetStartParent(getter_AddRefs(startParent)); + nsresult result = aRange->GetStartContainer(getter_AddRefs(startParent)); if (NS_FAILED(result)) return result; if (!startParent) return NS_ERROR_FAILURE; @@ -3260,10 +3260,10 @@ nsDOMSelection::GetAnchorNode(nsIDOMNode** aAnchorNode) return NS_ERROR_NULL_POINTER; nsresult result; if (GetDirection() == eDirNext){ - result = mAnchorFocusRange->GetStartParent(aAnchorNode); + result = mAnchorFocusRange->GetStartContainer(aAnchorNode); } else{ - result = mAnchorFocusRange->GetEndParent(aAnchorNode); + result = mAnchorFocusRange->GetEndContainer(aAnchorNode); } return result; } @@ -3291,10 +3291,10 @@ nsDOMSelection::GetFocusNode(nsIDOMNode** aFocusNode) return NS_ERROR_NULL_POINTER; nsresult result; if (GetDirection() == eDirNext){ - result = mAnchorFocusRange->GetEndParent(aFocusNode); + result = mAnchorFocusRange->GetEndContainer(aFocusNode); } else{ - result = mAnchorFocusRange->GetStartParent(aFocusNode); + result = mAnchorFocusRange->GetStartContainer(aFocusNode); } return result; @@ -3405,7 +3405,7 @@ nsDOMSelection::FetchStartParent(nsIDOMRange *aRange) //skip all the com stuff if (!aRange) return nsnull; nsCOMPtr returnval; - aRange->GetStartParent(getter_AddRefs(returnval)); + aRange->GetStartContainer(getter_AddRefs(returnval)); return returnval; } @@ -3430,7 +3430,7 @@ nsDOMSelection::FetchEndParent(nsIDOMRange *aRange) //skip all the com stuff if (!aRange) return nsnull; nsCOMPtr returnval; - aRange->GetEndParent(getter_AddRefs(returnval)); + aRange->GetEndContainer(getter_AddRefs(returnval)); return returnval; } @@ -3771,9 +3771,9 @@ nsDOMSelection::LookUpSelection(nsIContent *aContent, PRInt32 aContentOffset, PR nsCOMPtr endNode; PRInt32 startOffset; PRInt32 endOffset; - range->GetStartParent(getter_AddRefs(startNode)); + range->GetStartContainer(getter_AddRefs(startNode)); range->GetStartOffset(&startOffset); - range->GetEndParent(getter_AddRefs(endNode)); + range->GetEndContainer(getter_AddRefs(endNode)); range->GetEndOffset(&endOffset); if (passedInNode == startNode && passedInNode == endNode){ if (startOffset < (aContentOffset + aContentLength) && @@ -4216,11 +4216,11 @@ nsDOMSelection::AddRange(nsIDOMRange* aRange) if(mFrameSelection)// don't assume we have a FrameSelection { nsCOMPtr startNode; - result = aRange->GetStartParent(getter_AddRefs(startNode)); + result = aRange->GetStartContainer(getter_AddRefs(startNode)); if (NS_SUCCEEDED(result)) { nsCOMPtr endNode; - result = aRange->GetEndParent(getter_AddRefs(endNode)); + result = aRange->GetEndContainer(getter_AddRefs(endNode)); if (NS_SUCCEEDED(result)) { if (startNode == endNode) @@ -4384,7 +4384,7 @@ nsDOMSelection::CollapseToStart() return NS_ERROR_FAILURE; nsCOMPtr parent; - rv = firstRange->GetStartParent(getter_AddRefs(parent)); + rv = firstRange->GetStartContainer(getter_AddRefs(parent)); if (NS_SUCCEEDED(rv)) { if (parent) @@ -4419,7 +4419,7 @@ nsDOMSelection::CollapseToEnd() return NS_ERROR_FAILURE; nsCOMPtr parent; - rv = lastRange->GetEndParent(getter_AddRefs(parent)); + rv = lastRange->GetEndContainer(getter_AddRefs(parent)); if (NS_SUCCEEDED(rv)) { if (parent) @@ -4470,7 +4470,7 @@ nsDOMSelection::GetIsCollapsed(PRBool* aIsCollapsed) return rv; } - return (range->GetIsCollapsed(aIsCollapsed)); + return (range->GetCollapsed(aIsCollapsed)); } NS_IMETHODIMP @@ -4790,7 +4790,7 @@ nsDOMSelection::GetOriginalAnchorPoint(nsIDOMNode **aNode, PRInt32 *aOffset) if (!aNode || !aOffset || !mOriginalAnchorRange) return NS_ERROR_NULL_POINTER; nsresult result; - result = mOriginalAnchorRange->GetStartParent(aNode); + result = mOriginalAnchorRange->GetStartContainer(aNode); if (NS_FAILED(result)) return result; result = mOriginalAnchorRange->GetStartOffset(aOffset); @@ -4808,8 +4808,8 @@ nsDOMSelection::CopyRangeToAnchorFocus(nsIDOMRange *aRange) nsCOMPtr endNode; PRInt32 startOffset; PRInt32 endOffset; - aRange->GetStartParent(getter_AddRefs(startNode)); - aRange->GetEndParent(getter_AddRefs(endNode)); + aRange->GetStartContainer(getter_AddRefs(startNode)); + aRange->GetEndContainer(getter_AddRefs(endNode)); aRange->GetStartOffset(&startOffset); aRange->GetEndOffset(&endOffset); if (NS_FAILED(mAnchorFocusRange->SetStart(startNode,startOffset))) @@ -4871,7 +4871,7 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) if (FetchFocusNode() == aParentNode && FetchFocusOffset() == aOffset) return NS_ERROR_FAILURE;//same node nothing to do! - res = mAnchorFocusRange->Clone(getter_AddRefs(range)); + res = mAnchorFocusRange->CloneRange(getter_AddRefs(range)); //range = mAnchorFocusRange; nsCOMPtr startNode; @@ -4879,8 +4879,8 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) PRInt32 startOffset; PRInt32 endOffset; - range->GetStartParent(getter_AddRefs(startNode)); - range->GetEndParent(getter_AddRefs(endNode)); + range->GetStartContainer(getter_AddRefs(startNode)); + range->GetEndContainer(getter_AddRefs(endNode)); range->GetStartOffset(&startOffset); range->GetEndOffset(&endOffset); diff --git a/layout/events/src/nsEventStateManager.cpp b/layout/events/src/nsEventStateManager.cpp index 5aa66386af3..91306793198 100644 --- a/layout/events/src/nsEventStateManager.cpp +++ b/layout/events/src/nsEventStateManager.cpp @@ -566,7 +566,7 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext, nsCOMPtr globalObject; if(gLastFocusedDocument) { gLastFocusedDocument->GetScriptGlobalObject(getter_AddRefs(globalObject)); - //gLastFocusedDocument->HandleDOMEvent(gLastFocusedPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status); + gLastFocusedDocument->HandleDOMEvent(gLastFocusedPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status); if(globalObject) globalObject->HandleDOMEvent(gLastFocusedPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status); } diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index 04d32e04d11..449db9b088d 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -2404,7 +2404,7 @@ printf("HandleTableSelection: Unselecting mUnselectCellOnMouseUp; rangeCount=%d\ if (!range) return NS_ERROR_NULL_POINTER; nsCOMPtr parent; - result = range->GetStartParent(getter_AddRefs(parent)); + result = range->GetStartContainer(getter_AddRefs(parent)); if (NS_FAILED(result)) return result; if (!parent) return NS_ERROR_NULL_POINTER; @@ -2718,7 +2718,7 @@ nsSelection::GetFirstCellNodeInRange(nsIDOMRange *aRange, nsIDOMNode **aCellNode *aCellNode = nsnull; nsCOMPtr startParent; - nsresult result = aRange->GetStartParent(getter_AddRefs(startParent)); + nsresult result = aRange->GetStartContainer(getter_AddRefs(startParent)); if (NS_FAILED(result)) return result; if (!startParent) return NS_ERROR_FAILURE; @@ -3260,10 +3260,10 @@ nsDOMSelection::GetAnchorNode(nsIDOMNode** aAnchorNode) return NS_ERROR_NULL_POINTER; nsresult result; if (GetDirection() == eDirNext){ - result = mAnchorFocusRange->GetStartParent(aAnchorNode); + result = mAnchorFocusRange->GetStartContainer(aAnchorNode); } else{ - result = mAnchorFocusRange->GetEndParent(aAnchorNode); + result = mAnchorFocusRange->GetEndContainer(aAnchorNode); } return result; } @@ -3291,10 +3291,10 @@ nsDOMSelection::GetFocusNode(nsIDOMNode** aFocusNode) return NS_ERROR_NULL_POINTER; nsresult result; if (GetDirection() == eDirNext){ - result = mAnchorFocusRange->GetEndParent(aFocusNode); + result = mAnchorFocusRange->GetEndContainer(aFocusNode); } else{ - result = mAnchorFocusRange->GetStartParent(aFocusNode); + result = mAnchorFocusRange->GetStartContainer(aFocusNode); } return result; @@ -3405,7 +3405,7 @@ nsDOMSelection::FetchStartParent(nsIDOMRange *aRange) //skip all the com stuff if (!aRange) return nsnull; nsCOMPtr returnval; - aRange->GetStartParent(getter_AddRefs(returnval)); + aRange->GetStartContainer(getter_AddRefs(returnval)); return returnval; } @@ -3430,7 +3430,7 @@ nsDOMSelection::FetchEndParent(nsIDOMRange *aRange) //skip all the com stuff if (!aRange) return nsnull; nsCOMPtr returnval; - aRange->GetEndParent(getter_AddRefs(returnval)); + aRange->GetEndContainer(getter_AddRefs(returnval)); return returnval; } @@ -3771,9 +3771,9 @@ nsDOMSelection::LookUpSelection(nsIContent *aContent, PRInt32 aContentOffset, PR nsCOMPtr endNode; PRInt32 startOffset; PRInt32 endOffset; - range->GetStartParent(getter_AddRefs(startNode)); + range->GetStartContainer(getter_AddRefs(startNode)); range->GetStartOffset(&startOffset); - range->GetEndParent(getter_AddRefs(endNode)); + range->GetEndContainer(getter_AddRefs(endNode)); range->GetEndOffset(&endOffset); if (passedInNode == startNode && passedInNode == endNode){ if (startOffset < (aContentOffset + aContentLength) && @@ -4216,11 +4216,11 @@ nsDOMSelection::AddRange(nsIDOMRange* aRange) if(mFrameSelection)// don't assume we have a FrameSelection { nsCOMPtr startNode; - result = aRange->GetStartParent(getter_AddRefs(startNode)); + result = aRange->GetStartContainer(getter_AddRefs(startNode)); if (NS_SUCCEEDED(result)) { nsCOMPtr endNode; - result = aRange->GetEndParent(getter_AddRefs(endNode)); + result = aRange->GetEndContainer(getter_AddRefs(endNode)); if (NS_SUCCEEDED(result)) { if (startNode == endNode) @@ -4384,7 +4384,7 @@ nsDOMSelection::CollapseToStart() return NS_ERROR_FAILURE; nsCOMPtr parent; - rv = firstRange->GetStartParent(getter_AddRefs(parent)); + rv = firstRange->GetStartContainer(getter_AddRefs(parent)); if (NS_SUCCEEDED(rv)) { if (parent) @@ -4419,7 +4419,7 @@ nsDOMSelection::CollapseToEnd() return NS_ERROR_FAILURE; nsCOMPtr parent; - rv = lastRange->GetEndParent(getter_AddRefs(parent)); + rv = lastRange->GetEndContainer(getter_AddRefs(parent)); if (NS_SUCCEEDED(rv)) { if (parent) @@ -4470,7 +4470,7 @@ nsDOMSelection::GetIsCollapsed(PRBool* aIsCollapsed) return rv; } - return (range->GetIsCollapsed(aIsCollapsed)); + return (range->GetCollapsed(aIsCollapsed)); } NS_IMETHODIMP @@ -4790,7 +4790,7 @@ nsDOMSelection::GetOriginalAnchorPoint(nsIDOMNode **aNode, PRInt32 *aOffset) if (!aNode || !aOffset || !mOriginalAnchorRange) return NS_ERROR_NULL_POINTER; nsresult result; - result = mOriginalAnchorRange->GetStartParent(aNode); + result = mOriginalAnchorRange->GetStartContainer(aNode); if (NS_FAILED(result)) return result; result = mOriginalAnchorRange->GetStartOffset(aOffset); @@ -4808,8 +4808,8 @@ nsDOMSelection::CopyRangeToAnchorFocus(nsIDOMRange *aRange) nsCOMPtr endNode; PRInt32 startOffset; PRInt32 endOffset; - aRange->GetStartParent(getter_AddRefs(startNode)); - aRange->GetEndParent(getter_AddRefs(endNode)); + aRange->GetStartContainer(getter_AddRefs(startNode)); + aRange->GetEndContainer(getter_AddRefs(endNode)); aRange->GetStartOffset(&startOffset); aRange->GetEndOffset(&endOffset); if (NS_FAILED(mAnchorFocusRange->SetStart(startNode,startOffset))) @@ -4871,7 +4871,7 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) if (FetchFocusNode() == aParentNode && FetchFocusOffset() == aOffset) return NS_ERROR_FAILURE;//same node nothing to do! - res = mAnchorFocusRange->Clone(getter_AddRefs(range)); + res = mAnchorFocusRange->CloneRange(getter_AddRefs(range)); //range = mAnchorFocusRange; nsCOMPtr startNode; @@ -4879,8 +4879,8 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) PRInt32 startOffset; PRInt32 endOffset; - range->GetStartParent(getter_AddRefs(startNode)); - range->GetEndParent(getter_AddRefs(endNode)); + range->GetStartContainer(getter_AddRefs(startNode)); + range->GetEndContainer(getter_AddRefs(endNode)); range->GetStartOffset(&startOffset); range->GetEndOffset(&endOffset); diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 22aa0ba7863..2bc59e7bd92 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -2858,9 +2858,9 @@ nsTextFrame::SetSelected(nsIPresContext* aPresContext, PRInt32 endOffset; nsCOMPtr startNode; PRInt32 startOffset; - aRange->GetEndParent(getter_AddRefs(endNode)); + aRange->GetEndContainer(getter_AddRefs(endNode)); aRange->GetEndOffset(&endOffset); - aRange->GetStartParent(getter_AddRefs(startNode)); + aRange->GetStartContainer(getter_AddRefs(startNode)); aRange->GetStartOffset(&startOffset); nsCOMPtr content; result = GetContent(getter_AddRefs(content)); diff --git a/layout/html/base/src/nsTextFrame.cpp b/layout/html/base/src/nsTextFrame.cpp index 22aa0ba7863..2bc59e7bd92 100644 --- a/layout/html/base/src/nsTextFrame.cpp +++ b/layout/html/base/src/nsTextFrame.cpp @@ -2858,9 +2858,9 @@ nsTextFrame::SetSelected(nsIPresContext* aPresContext, PRInt32 endOffset; nsCOMPtr startNode; PRInt32 startOffset; - aRange->GetEndParent(getter_AddRefs(endNode)); + aRange->GetEndContainer(getter_AddRefs(endNode)); aRange->GetEndOffset(&endOffset); - aRange->GetStartParent(getter_AddRefs(startNode)); + aRange->GetStartContainer(getter_AddRefs(startNode)); aRange->GetStartOffset(&startOffset); nsCOMPtr content; result = GetContent(getter_AddRefs(content)); diff --git a/layout/html/forms/src/nsGfxTextControlFrame2.cpp b/layout/html/forms/src/nsGfxTextControlFrame2.cpp index 00bae6cf0c9..6616555231d 100644 --- a/layout/html/forms/src/nsGfxTextControlFrame2.cpp +++ b/layout/html/forms/src/nsGfxTextControlFrame2.cpp @@ -1578,6 +1578,9 @@ nsGfxTextControlFrame2::CreateAnonymousContent(nsIPresContext* aPresContext, if (IsPasswordTextControl()) editorFlags |= nsIHTMLEditor::eEditorPasswordMask; + //all gfxtextcontrolframe2's are widgets + editorFlags |= nsIHTMLEditor::eEditorWidgetMask; + // Now initialize the editor. // // NOTE: Conversion of '\n' to
happens inside the