зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1446533
part 6. Remove nsIDOMCharacterData::GetLength r=mystor
MozReview-Commit-ID: FCBGyqPfC4B
This commit is contained in:
Родитель
bed3a0dde1
Коммит
4d10a59d53
|
@ -184,13 +184,6 @@ CharacterData::SetData(const nsAString& aData, ErrorResult& aRv)
|
|||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
CharacterData::GetLength(uint32_t* aLength)
|
||||
{
|
||||
*aLength = mText.GetLength();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
CharacterData::SubstringData(uint32_t aStart, uint32_t aCount,
|
||||
nsAString& aReturn, ErrorResult& rv)
|
||||
|
|
|
@ -96,7 +96,6 @@ public:
|
|||
ErrorResult& aError) override;
|
||||
|
||||
// Implementation for nsIDOMCharacterData
|
||||
nsresult GetLength(uint32_t* aLength);
|
||||
nsresult InsertData(uint32_t aOffset, const nsAString& aArg);
|
||||
nsresult DeleteData(uint32_t aOffset, uint32_t aCount);
|
||||
nsresult ReplaceData(uint32_t aOffset, uint32_t aCount,
|
||||
|
|
|
@ -2334,8 +2334,7 @@ nsRange::CutContents(DocumentFragment** aFragment)
|
|||
{
|
||||
// Delete or extract everything after startOffset.
|
||||
|
||||
rv = charData->GetLength(&dataLength);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
dataLength = charData->Length();
|
||||
|
||||
if (dataLength >= startOffset) {
|
||||
if (retval) {
|
||||
|
@ -2728,20 +2727,13 @@ nsRange::CloneContents(ErrorResult& aRv)
|
|||
// XXX_kin: We need to also handle ProcessingInstruction
|
||||
// XXX_kin: according to the spec.
|
||||
|
||||
nsCOMPtr<nsIDOMCharacterData> charData(do_QueryInterface(clone));
|
||||
|
||||
if (charData)
|
||||
if (auto charData = CharacterData::FromContent(clone))
|
||||
{
|
||||
if (node == mEnd.Container()) {
|
||||
// We only need the data before mEndOffset, so get rid of any
|
||||
// data after it.
|
||||
|
||||
uint32_t dataLength = 0;
|
||||
aRv = charData->GetLength(&dataLength);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32_t dataLength = charData->Length();
|
||||
if (dataLength > (uint32_t)mEnd.Offset())
|
||||
{
|
||||
aRv = charData->DeleteData(mEnd.Offset(), dataLength - mEnd.Offset());
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
[uuid(4109a2d2-e7af-445d-bb72-c7c9b875f35e)]
|
||||
interface nsIDOMCharacterData : nsIDOMNode
|
||||
{
|
||||
readonly attribute unsigned long length;
|
||||
void insertData(in unsigned long offset,
|
||||
in DOMString arg)
|
||||
raises(DOMException);
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "txExprResult.h"
|
||||
#include "txIXPathContext.h"
|
||||
#include "nsError.h"
|
||||
#include "nsIDOMCharacterData.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsINode.h"
|
||||
|
@ -17,6 +16,7 @@
|
|||
#include "txURIUtils.h"
|
||||
#include "txXPathTreeWalker.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/Text.h"
|
||||
#include "mozilla/dom/XPathResultBinding.h"
|
||||
|
||||
using mozilla::Move;
|
||||
|
@ -126,15 +126,10 @@ XPathExpression::EvaluateWithContext(nsINode& aContextNode,
|
|||
|
||||
if (nodeType == nsINode::TEXT_NODE ||
|
||||
nodeType == nsINode::CDATA_SECTION_NODE) {
|
||||
nsCOMPtr<nsIDOMCharacterData> textNode =
|
||||
do_QueryInterface(&aContextNode);
|
||||
if (!textNode) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
Text* textNode = aContextNode.GetAsText();
|
||||
MOZ_ASSERT(textNode);
|
||||
|
||||
uint32_t textLength;
|
||||
textNode->GetLength(&textLength);
|
||||
uint32_t textLength = textNode->Length();
|
||||
if (textLength == 0) {
|
||||
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
return nullptr;
|
||||
|
|
Загрузка…
Ссылка в новой задаче