Bug 1447889 part 13. Remove unused nsIDOMRange bits. r=mystor

MozReview-Commit-ID: CjtfHTtcviJ
This commit is contained in:
Boris Zbarsky 2018-03-27 00:35:22 -04:00
Родитель 2367e5d3ff
Коммит f803b0085b
3 изменённых файлов: 2 добавлений и 199 удалений

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

@ -843,25 +843,6 @@ nsRange::ParentChainChanged(nsIContent *aContent)
DoSetRange(mStart.AsRaw(), mEnd.AsRaw(), newRoot);
}
/******************************************************
* Utilities for comparing points: API from nsIDOMRange
******************************************************/
NS_IMETHODIMP
nsRange::IsPointInRange(nsIDOMNode* aContainer, uint32_t aOffset, bool* aResult)
{
nsCOMPtr<nsINode> container = do_QueryInterface(aContainer);
if (!container) {
return NS_ERROR_DOM_NOT_OBJECT_ERR;
}
if (NS_WARN_IF(!IsValidOffset(aOffset))) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
ErrorResult rv;
*aResult = IsPointInRange(RawRangeBoundary(container, aOffset), rv);
return rv.StealNSResult();
}
bool
nsRange::IsPointInRange(const RawRangeBoundary& aPoint, ErrorResult& aRv)
{
@ -875,20 +856,6 @@ nsRange::IsPointInRange(const RawRangeBoundary& aPoint, ErrorResult& aRv)
return compareResult == 0;
}
// returns -1 if point is before range, 0 if point is in range,
// 1 if point is after range.
NS_IMETHODIMP
nsRange::ComparePoint(nsIDOMNode* aContainer, uint32_t aOffset,
int16_t* aResult)
{
nsCOMPtr<nsINode> container = do_QueryInterface(aContainer);
NS_ENSURE_TRUE(container, NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
ErrorResult rv;
*aResult = ComparePoint(RawRangeBoundary(container, aOffset), rv);
return rv.StealNSResult();
}
int16_t
nsRange::ComparePoint(const RawRangeBoundary& aPoint, ErrorResult& aRv)
{
@ -931,20 +898,6 @@ nsRange::ComparePoint(const RawRangeBoundary& aPoint, ErrorResult& aRv)
return 0;
}
NS_IMETHODIMP
nsRange::IntersectsNode(nsIDOMNode* aNode, bool* aResult)
{
*aResult = false;
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
// TODO: This should throw a TypeError.
NS_ENSURE_ARG(node);
ErrorResult rv;
*aResult = IntersectsNode(*node, rv);
return rv.StealNSResult();
}
bool
nsRange::IntersectsNode(nsINode& aNode, ErrorResult& aRv)
{
@ -1197,17 +1150,6 @@ nsRange::GetEndOffset(ErrorResult& aRv) const
return mEnd.Offset();
}
NS_IMETHODIMP
nsRange::GetCollapsed(bool* aIsCollapsed)
{
if (!mIsPositioned)
return NS_ERROR_NOT_INITIALIZED;
*aIsCollapsed = Collapsed();
return NS_OK;
}
nsINode*
nsRange::GetCommonAncestorContainer(ErrorResult& aRv) const
{
@ -1381,19 +1323,6 @@ nsRange::SetStartBefore(nsINode& aNode, ErrorResult& aRv)
aRv = SetStart(container, offset);
}
NS_IMETHODIMP
nsRange::SetStartBefore(nsIDOMNode* aSibling)
{
nsCOMPtr<nsINode> sibling = do_QueryInterface(aSibling);
if (!sibling) {
return NS_ERROR_DOM_NOT_OBJECT_ERR;
}
ErrorResult rv;
SetStartBefore(*sibling, rv);
return rv.StealNSResult();
}
void
nsRange::SetStartAfterJS(nsINode& aNode, ErrorResult& aErr)
{
@ -1420,19 +1349,6 @@ nsRange::SetStartAfter(nsINode& aNode, ErrorResult& aRv)
aRv = SetStart(container, offset);
}
NS_IMETHODIMP
nsRange::SetStartAfter(nsIDOMNode* aSibling)
{
nsCOMPtr<nsINode> sibling = do_QueryInterface(aSibling);
if (!sibling) {
return NS_ERROR_DOM_NOT_OBJECT_ERR;
}
ErrorResult rv;
SetStartAfter(*sibling, rv);
return rv.StealNSResult();
}
void
nsRange::SetEndJS(nsINode& aNode, uint32_t aOffset, ErrorResult& aErr)
{
@ -1583,19 +1499,6 @@ nsRange::SetEndBefore(nsINode& aNode, ErrorResult& aRv)
aRv = SetEnd(container, offset);
}
NS_IMETHODIMP
nsRange::SetEndBefore(nsIDOMNode* aSibling)
{
nsCOMPtr<nsINode> sibling = do_QueryInterface(aSibling);
if (!sibling) {
return NS_ERROR_DOM_NOT_OBJECT_ERR;
}
ErrorResult rv;
SetEndBefore(*sibling, rv);
return rv.StealNSResult();
}
void
nsRange::SetEndAfterJS(nsINode& aNode, ErrorResult& aErr)
{
@ -1622,19 +1525,6 @@ nsRange::SetEndAfter(nsINode& aNode, ErrorResult& aRv)
aRv = SetEnd(container, offset);
}
NS_IMETHODIMP
nsRange::SetEndAfter(nsIDOMNode* aSibling)
{
nsCOMPtr<nsINode> sibling = do_QueryInterface(aSibling);
if (!sibling) {
return NS_ERROR_DOM_NOT_OBJECT_ERR;
}
ErrorResult rv;
SetEndAfter(*sibling, rv);
return rv.StealNSResult();
}
void
nsRange::Collapse(bool aToStart)
{
@ -2407,16 +2297,6 @@ nsRange::DeleteContents(ErrorResult& aRv)
aRv = CutContents(nullptr);
}
NS_IMETHODIMP
nsRange::ExtractContents(nsIDOMDocumentFragment** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
RefPtr<DocumentFragment> fragment;
nsresult rv = CutContents(getter_AddRefs(fragment));
fragment.forget(aReturn);
return rv;
}
already_AddRefed<DocumentFragment>
nsRange::ExtractContents(ErrorResult& rv)
{
@ -2529,14 +2409,6 @@ nsRange::CloneParentsBetween(nsINode *aAncestor,
return NS_OK;
}
NS_IMETHODIMP
nsRange::CloneContents(nsIDOMDocumentFragment** aReturn)
{
ErrorResult rv;
*aReturn = CloneContents(rv).take();
return rv.StealNSResult();
}
already_AddRefed<DocumentFragment>
nsRange::CloneContents(ErrorResult& aRv)
{
@ -2743,19 +2615,6 @@ nsRange::CloneRange() const
return range.forget();
}
NS_IMETHODIMP
nsRange::InsertNode(nsIDOMNode* aNode)
{
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
if (!node) {
return NS_ERROR_DOM_NOT_OBJECT_ERR;
}
ErrorResult rv;
InsertNode(*node, rv);
return rv.StealNSResult();
}
void
nsRange::InsertNode(nsINode& aNode, ErrorResult& aRv)
{
@ -2849,18 +2708,6 @@ nsRange::InsertNode(nsINode& aNode, ErrorResult& aRv)
}
}
NS_IMETHODIMP
nsRange::SurroundContents(nsIDOMNode* aNewParent)
{
nsCOMPtr<nsINode> node = do_QueryInterface(aNewParent);
if (!node) {
return NS_ERROR_DOM_NOT_OBJECT_ERR;
}
ErrorResult rv;
SurroundContents(*node, rv);
return rv.StealNSResult();
}
void
nsRange::SurroundContents(nsINode& aNewParent, ErrorResult& aRv)
{
@ -3043,21 +2890,9 @@ nsRange::ToString(nsAString& aReturn, ErrorResult& aErr)
#endif /* DEBUG */
}
NS_IMETHODIMP
void
nsRange::Detach()
{
return NS_OK;
}
NS_IMETHODIMP
nsRange::CreateContextualFragment(const nsAString& aFragment,
nsIDOMDocumentFragment** aReturn)
{
if (mIsPositioned) {
return nsContentUtils::CreateContextualFragment(mStart.Container(), aFragment,
false, aReturn);
}
return NS_ERROR_FAILURE;
}
already_AddRefed<DocumentFragment>

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

@ -333,6 +333,7 @@ public:
}
bool IsPointInRange(const RawRangeBoundary& aPoint, ErrorResult& aErr);
void ToString(nsAString& aReturn, ErrorResult& aErr);
void Detach();
// *JS() methods are mapped to Range.*() of DOM.
// They may move focus only when the range represents normal selection.

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

@ -15,37 +15,4 @@
[builtinclass, uuid(1f94055c-42e7-4a30-96a1-6a804f1c2d1e)]
interface nsIDOMRange : nsISupports
{
readonly attribute boolean collapsed;
void setStartBefore(in nsIDOMNode refNode);
void setStartAfter(in nsIDOMNode refNode);
void setEndBefore(in nsIDOMNode refNode);
void setEndAfter(in nsIDOMNode refNode);
nsIDOMDocumentFragment extractContents();
nsIDOMDocumentFragment cloneContents();
void insertNode(in nsIDOMNode newNode);
void surroundContents(in nsIDOMNode newParent);
void detach();
// This method comes from
// http://html5.org/specs/dom-parsing.html#extensions-to-the-range-interface
nsIDOMDocumentFragment createContextualFragment(in DOMString fragment);
// This returns true if parent+offset equals either
// of the boundary points or is between them.
boolean isPointInRange(in nsIDOMNode parent,
in unsigned long offset);
// comparePoint returns
// -1 if point is before the start boundary point,
// 0 if point is either of the boundary points or between them,
// 1 if point is after the end boundary point.
// Sort of a strcmp for ranges.
short comparePoint(in nsIDOMNode parent, in unsigned long offset);
/**
* Returns whether the range intersects node.
*/
boolean intersectsNode(in nsIDOMNode node);
};