Backed out 6 changesets (bug 832920, bug 825341, bug 838582, bug 842726, bug 629801, bug 842561) for Linux32 debug mochitest-2 and Windows/OSX mochitest-browser-chrome failures on a CLOSED TREE.

This commit is contained in:
Ryan VanderMeulen 2013-02-22 15:30:06 -05:00
Родитель 0c6df5ec0e
Коммит b30facb288
83 изменённых файлов: 643 добавлений и 1738 удалений

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

@ -1824,7 +1824,7 @@ HyperTextAccessible::SetSelectionBounds(int32_t aSelectionNum,
nsRefPtr<nsRange> range;
if (aSelectionNum == rangeCount)
range = new nsRange(mContent);
range = new nsRange();
else
range = domSel->GetRangeAt(aSelectionNum);
@ -1886,7 +1886,7 @@ HyperTextAccessible::ScrollSubstringTo(int32_t aStartIndex, int32_t aEndIndex,
if (IsDefunct())
return NS_ERROR_FAILURE;
nsRefPtr<nsRange> range = new nsRange(mContent);
nsRefPtr<nsRange> range = new nsRange();
nsresult rv = HypertextOffsetsToDOMRange(aStartIndex, aEndIndex, range);
NS_ENSURE_SUCCESS(rv, rv);
@ -1910,7 +1910,7 @@ HyperTextAccessible::ScrollSubstringToPoint(int32_t aStartIndex,
nsIntPoint coords = nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordinateType,
this);
nsRefPtr<nsRange> range = new nsRange(mContent);
nsRefPtr<nsRange> range = new nsRange();
nsresult rv = HypertextOffsetsToDOMRange(aStartIndex, aEndIndex, range);
NS_ENSURE_SUCCESS(rv, rv);

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

@ -158,7 +158,7 @@ TextLeafAccessibleWrap::scrollToSubstring(
if (IsDefunct())
return E_FAIL;
nsRefPtr<nsRange> range = new nsRange(mContent);
nsRefPtr<nsRange> range = new nsRange();
if (NS_FAILED(range->SetStart(mContent, aStartIndex)))
return E_FAIL;

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

@ -465,7 +465,6 @@ Toolbox.prototype = {
iframe.className = "toolbox-panel-iframe";
iframe.id = "toolbox-panel-iframe-" + id;
iframe.setAttribute("flex", 1);
iframe.setAttribute("forceOwnRefreshDriver", "");
let vbox = this.doc.getElementById("toolbox-panel-" + id);
vbox.appendChild(iframe);

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

@ -29,5 +29,5 @@
modifiers="accel"/>
</keyset>
<iframe id="toolbox-iframe" flex="1" forceOwnRefreshDriver=""></iframe>
<iframe id="toolbox-iframe" flex="1"></iframe>
</window>

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

@ -112,7 +112,6 @@ namespace layers {
} // namespace layers
namespace dom {
class DocumentFragment;
class Element;
} // namespace dom
@ -367,7 +366,6 @@ public:
// Check if the (JS) caller can access aNode.
static bool CanCallerAccess(nsIDOMNode *aNode);
static bool CanCallerAccess(nsINode* aNode);
// Check if the (JS) caller can access aWindow.
// aWindow can be either outer or inner window.
@ -1086,10 +1084,6 @@ public:
const nsAString& aFragment,
bool aPreventScriptExecution,
nsIDOMDocumentFragment** aReturn);
static already_AddRefed<mozilla::dom::DocumentFragment>
CreateContextualFragment(nsINode* aContextNode, const nsAString& aFragment,
bool aPreventScriptExecution,
mozilla::ErrorResult& aRv);
/**
* Invoke the fragment parsing algorithm (innerHTML) using the HTML parser.

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

@ -1939,10 +1939,6 @@ public:
void ReleaseCapture() const;
virtual void MozSetImageElement(const nsAString& aImageElementId,
Element* aElement) = 0;
nsIURI* GetDocumentURIObject()
{
return GetDocumentURI();
}
// Not const because all the full-screen goop is not const
virtual bool MozFullScreenEnabled() = 0;
virtual Element* GetMozFullScreenElement(mozilla::ErrorResult& rv) = 0;
@ -2412,10 +2408,6 @@ nsresult
NS_NewVideoDocument(nsIDocument** aInstancePtrResult);
#endif
already_AddRefed<mozilla::dom::DocumentFragment>
NS_NewDocumentFragment(nsNodeInfoManager* aNodeInfoManager,
mozilla::ErrorResult& aRv);
nsresult
NS_NewDocumentFragment(nsIDOMDocumentFragment** aInstancePtrResult,
nsNodeInfoManager *aNodeInfoManager);

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

@ -21,34 +21,21 @@
nsresult
NS_NewDocumentFragment(nsIDOMDocumentFragment** aInstancePtrResult,
nsNodeInfoManager *aNodeInfoManager)
{
mozilla::ErrorResult rv;
*aInstancePtrResult = NS_NewDocumentFragment(aNodeInfoManager, rv).get();
return rv.ErrorCode();
}
already_AddRefed<mozilla::dom::DocumentFragment>
NS_NewDocumentFragment(nsNodeInfoManager* aNodeInfoManager,
mozilla::ErrorResult& aRv)
{
using namespace mozilla::dom;
if (!aNodeInfoManager) {
aRv.Throw(NS_ERROR_INVALID_ARG);
return nullptr;
}
NS_ENSURE_ARG(aNodeInfoManager);
nsCOMPtr<nsINodeInfo> nodeInfo =
aNodeInfoManager->GetNodeInfo(nsGkAtoms::documentFragmentNodeName,
nullptr, kNameSpaceID_None,
nsIDOMNode::DOCUMENT_FRAGMENT_NODE);
if (!nodeInfo) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return nullptr;
}
nsCOMPtr<nsINodeInfo> nodeInfo;
nodeInfo = aNodeInfoManager->GetNodeInfo(nsGkAtoms::documentFragmentNodeName,
nullptr, kNameSpaceID_None,
nsIDOMNode::DOCUMENT_FRAGMENT_NODE);
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
nsRefPtr<DocumentFragment> it = new DocumentFragment(nodeInfo.forget());
return it.forget();
DocumentFragment *it = new DocumentFragment(nodeInfo.forget());
NS_ADDREF(*aInstancePtrResult = it);
return NS_OK;
}
DOMCI_NODE_DATA(DocumentFragment, mozilla::dom::DocumentFragment)

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

@ -51,7 +51,6 @@ EXPORTS_mozilla/dom = \
DOMImplementation.h \
EventSource.h \
Link.h \
Text.h \
$(NULL)
CPPSRCS = \
@ -121,7 +120,6 @@ CPPSRCS = \
nsStyledElement.cpp \
nsStyleLinkElement.cpp \
nsSyncLoadService.cpp \
Text.cpp \
nsTextFragment.cpp \
nsTextNode.cpp \
nsTraversal.cpp \

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

@ -1,23 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/Text.h"
namespace mozilla {
namespace dom {
already_AddRefed<Text>
Text::SplitText(uint32_t aOffset, ErrorResult& rv)
{
nsCOMPtr<nsIContent> newChild;
rv = SplitData(aOffset, getter_AddRefs(newChild));
if (rv.Failed()) {
return nullptr;
}
return static_cast<Text*>(newChild.forget().get());
}
} // namespace dom
} // namespace mozilla

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

@ -1,35 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_Text_h
#define mozilla_dom_Text_h
#include "nsGenericDOMDataNode.h"
#include "mozilla/ErrorResult.h"
namespace mozilla {
namespace dom {
class Text : public nsGenericDOMDataNode
{
public:
Text(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericDOMDataNode(aNodeInfo)
{}
using nsGenericDOMDataNode::GetWholeText;
// WebIDL API
already_AddRefed<Text> SplitText(uint32_t aOffset, ErrorResult& rv);
void GetWholeText(nsAString& aWholeText, ErrorResult& rv)
{
rv = GetWholeText(aWholeText);
}
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_Text_h

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

@ -168,7 +168,6 @@
#include "nsSVGFeatures.h"
#include "MediaDecoder.h"
#include "DecoderTraits.h"
#include "mozilla/dom/DocumentFragment.h"
#include "nsWrapperCacheInlines.h"
#include "nsViewportInfo.h"
@ -1582,15 +1581,6 @@ nsContentUtils::CanCallerAccess(nsIPrincipal* aSubjectPrincipal,
// static
bool
nsContentUtils::CanCallerAccess(nsIDOMNode *aNode)
{
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
NS_ENSURE_TRUE(node, false);
return CanCallerAccess(node);
}
// static
bool
nsContentUtils::CanCallerAccess(nsINode* aNode)
{
// XXXbz why not check the IsCapabilityEnabled thing up front, and not bother
// with the system principal games? But really, there should be a simpler
@ -1605,7 +1595,10 @@ nsContentUtils::CanCallerAccess(nsINode* aNode)
return true;
}
return CanCallerAccess(subjectPrincipal, aNode->NodePrincipal());
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
NS_ENSURE_TRUE(node, false);
return CanCallerAccess(subjectPrincipal, node->NodePrincipal());
}
// static
@ -4062,22 +4055,8 @@ nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
bool aPreventScriptExecution,
nsIDOMDocumentFragment** aReturn)
{
ErrorResult rv;
*aReturn = CreateContextualFragment(aContextNode, aFragment,
aPreventScriptExecution, rv).get();
return rv.ErrorCode();
}
already_AddRefed<DocumentFragment>
nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
const nsAString& aFragment,
bool aPreventScriptExecution,
ErrorResult& aRv)
{
if (!aContextNode) {
aRv.Throw(NS_ERROR_INVALID_ARG);
return nullptr;
}
*aReturn = nullptr;
NS_ENSURE_ARG(aContextNode);
// If we don't have a document here, we can't get the right security context
// for compiling event handlers... so just bail out.
@ -4089,8 +4068,8 @@ nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
#endif
if (isHTML) {
nsRefPtr<DocumentFragment> frag =
NS_NewDocumentFragment(document->NodeInfoManager(), aRv);
nsCOMPtr<nsIDOMDocumentFragment> frag;
NS_NewDocumentFragment(getter_AddRefs(frag), document->NodeInfoManager());
nsCOMPtr<nsIContent> contextAsContent = do_QueryInterface(aContextNode);
if (contextAsContent && !contextAsContent->IsElement()) {
@ -4101,23 +4080,28 @@ nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
}
}
nsresult rv;
nsCOMPtr<nsIContent> fragment = do_QueryInterface(frag);
if (contextAsContent && !contextAsContent->IsHTML(nsGkAtoms::html)) {
aRv = ParseFragmentHTML(aFragment, frag,
contextAsContent->Tag(),
contextAsContent->GetNameSpaceID(),
(document->GetCompatibilityMode() ==
rv = ParseFragmentHTML(aFragment,
fragment,
contextAsContent->Tag(),
contextAsContent->GetNameSpaceID(),
(document->GetCompatibilityMode() ==
eCompatibility_NavQuirks),
aPreventScriptExecution);
aPreventScriptExecution);
} else {
aRv = ParseFragmentHTML(aFragment, frag,
nsGkAtoms::body,
kNameSpaceID_XHTML,
(document->GetCompatibilityMode() ==
rv = ParseFragmentHTML(aFragment,
fragment,
nsGkAtoms::body,
kNameSpaceID_XHTML,
(document->GetCompatibilityMode() ==
eCompatibility_NavQuirks),
aPreventScriptExecution);
aPreventScriptExecution);
}
return frag.forget();
frag.forget(aReturn);
return rv;
}
nsAutoTArray<nsString, 32> tagStack;
@ -4129,10 +4113,7 @@ nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
while (content && content->IsElement()) {
nsString& tagName = *tagStack.AppendElement();
if (!&tagName) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return nullptr;
}
NS_ENSURE_TRUE(&tagName, NS_ERROR_OUT_OF_MEMORY);
tagName = content->NodeInfo()->QualifiedName();
@ -4178,10 +4159,11 @@ nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
content = content->GetParent();
}
nsCOMPtr<nsIDOMDocumentFragment> frag;
aRv = ParseFragmentXML(aFragment, document, tagStack,
aPreventScriptExecution, getter_AddRefs(frag));
return static_cast<DocumentFragment*>(frag.forget().get());
return ParseFragmentXML(aFragment,
document,
tagStack,
aPreventScriptExecution,
aReturn);
}
/* static */

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

@ -293,7 +293,7 @@ nsCopySupport::GetTransferableForNode(nsINode* aNode,
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aNode);
NS_ENSURE_TRUE(node, NS_ERROR_FAILURE);
nsRefPtr<nsRange> range = new nsRange(aNode);
nsRefPtr<nsRange> range = new nsRange();
rv = range->SelectNode(node);
NS_ENSURE_SUCCESS(rv, rv);
rv = selection->AddRange(range);

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

@ -5341,7 +5341,7 @@ nsDocument::CreateRange(nsIDOMRange** aReturn)
already_AddRefed<nsRange>
nsIDocument::CreateRange(ErrorResult& rv)
{
nsRefPtr<nsRange> range = new nsRange(this);
nsRefPtr<nsRange> range = new nsRange();
nsresult res = range->Set(this, 0, this, 0);
if (NS_FAILED(res)) {
rv.Throw(res);

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

@ -372,7 +372,6 @@ GK_ATOM(fontpicker, "fontpicker")
GK_ATOM(footer, "footer")
GK_ATOM(_for, "for")
GK_ATOM(forEach, "for-each")
GK_ATOM(forceOwnRefreshDriver, "forceOwnRefreshDriver")
GK_ATOM(form, "form")
GK_ATOM(formaction, "formaction")
GK_ATOM(format, "format")

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -12,32 +12,17 @@
#include "nsIDOMRange.h"
#include "nsCOMPtr.h"
#include "nsIDOMDocumentFragment.h"
#include "nsINode.h"
#include "nsIDocument.h"
#include "nsIDOMNode.h"
#include "prmon.h"
#include "nsStubMutationObserver.h"
#include "nsWrapperCache.h"
#include "mozilla/Attributes.h"
class nsClientRectList;
class nsIDOMDocumentFragment;
namespace mozilla {
class ErrorResult;
namespace dom {
class DocumentFragment;
}
}
class nsRange MOZ_FINAL : public nsIDOMRange,
public nsStubMutationObserver,
public nsWrapperCache
class nsRange : public nsIDOMRange,
public nsStubMutationObserver
{
typedef mozilla::ErrorResult ErrorResult;
public:
nsRange(nsINode* aNode)
nsRange()
: mRoot(nullptr)
, mStartOffset(0)
, mEndOffset(0)
@ -51,11 +36,7 @@ public:
, mAssertNextInsertOrAppendIndex(-1)
, mAssertNextInsertOrAppendNode(nullptr)
#endif
{
SetIsDOMBinding();
MOZ_ASSERT(aNode, "range isn't in a document!");
mOwner = aNode->OwnerDoc();
}
{}
virtual ~nsRange();
static nsresult CreateRange(nsIDOMNode* aStartParent, int32_t aStartOffset,
@ -66,7 +47,7 @@ public:
nsIDOMRange** aRange);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsRange, nsIDOMRange)
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsRange, nsIDOMRange)
// nsIDOMRange interface
NS_DECL_NSIDOMRANGE
@ -101,6 +82,12 @@ public:
return mIsPositioned;
}
bool Collapsed() const
{
return mIsPositioned && mStartParent == mEndParent &&
mStartOffset == mEndOffset;
}
void SetMaySpanAnonymousSubtrees(bool aMaySpanAnonymousSubtrees)
{
mMaySpanAnonymousSubtrees = aMaySpanAnonymousSubtrees;
@ -159,46 +146,6 @@ public:
NS_DECL_NSIMUTATIONOBSERVER_PARENTCHAINCHANGED
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
// WebIDL
bool Collapsed() const
{
return mIsPositioned && mStartParent == mEndParent &&
mStartOffset == mEndOffset;
}
already_AddRefed<mozilla::dom::DocumentFragment>
CreateContextualFragment(const nsAString& aString, ErrorResult& aError);
already_AddRefed<mozilla::dom::DocumentFragment>
CloneContents(ErrorResult& aErr);
int16_t CompareBoundaryPoints(uint16_t aHow, nsRange& aOther,
ErrorResult& aErr);
int16_t ComparePoint(nsINode& aParent, uint32_t aOffset, ErrorResult& aErr);
void DeleteContents(ErrorResult& aRv);
already_AddRefed<mozilla::dom::DocumentFragment>
ExtractContents(ErrorResult& aErr);
nsINode* GetCommonAncestorContainer(ErrorResult& aRv) const;
nsINode* GetStartContainer(ErrorResult& aRv) const;
uint32_t GetStartOffset(ErrorResult& aRv) const;
nsINode* GetEndContainer(ErrorResult& aRv) const;
uint32_t GetEndOffset(ErrorResult& aRv) const;
void InsertNode(nsINode& aNode, ErrorResult& aErr);
bool IntersectsNode(nsINode& aNode, ErrorResult& aRv);
bool IsPointInRange(nsINode& aParent, uint32_t aOffset, ErrorResult& aErr);
void SelectNode(nsINode& aNode, ErrorResult& aErr);
void SelectNodeContents(nsINode& aNode, ErrorResult& aErr);
void SetEnd(nsINode& aNode, uint32_t aOffset, ErrorResult& aErr);
void SetEndAfter(nsINode& aNode, ErrorResult& aErr);
void SetEndBefore(nsINode& aNode, ErrorResult& aErr);
void SetStart(nsINode& aNode, uint32_t aOffset, ErrorResult& aErr);
void SetStartAfter(nsINode& aNode, ErrorResult& aErr);
void SetStartBefore(nsINode& aNode, ErrorResult& aErr);
void SurroundContents(nsINode& aNode, ErrorResult& aErr);
already_AddRefed<nsIDOMClientRect> GetBoundingClientRect();
already_AddRefed<nsClientRectList> GetClientRects(ErrorResult& aErr);
nsINode* GetParentObject() const { return mOwner; }
virtual JSObject* WrapObject(JSContext* cx, JSObject* scope, bool* tried)
MOZ_OVERRIDE MOZ_FINAL;
private:
// no copy's or assigns
nsRange(const nsRange&);
@ -210,7 +157,7 @@ private:
* @param aFragment nsIDOMDocumentFragment containing the nodes.
* May be null to indicate the caller doesn't want a fragment.
*/
nsresult CutContents(mozilla::dom::DocumentFragment** frag);
nsresult CutContents(nsIDOMDocumentFragment** frag);
static nsresult CloneParentsBetween(nsIDOMNode *aAncestor,
nsIDOMNode *aNode,
@ -277,8 +224,7 @@ protected:
#endif
static bool mIsNested;
};
nsCOMPtr<nsIDocument> mOwner;
nsCOMPtr<nsINode> mRoot;
nsCOMPtr<nsINode> mStartParent;
nsCOMPtr<nsINode> mEndParent;

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

@ -185,6 +185,17 @@ void nsTextNode::UnbindFromTree(bool aDeep, bool aNullParent)
nsGenericDOMDataNode::UnbindFromTree(aDeep, aNullParent);
}
already_AddRefed<nsTextNode>
nsTextNode::SplitText(uint32_t aOffset, ErrorResult& rv)
{
nsCOMPtr<nsIContent> newChild;
rv = SplitData(aOffset, getter_AddRefs(newChild));
if (rv.Failed()) {
return nullptr;
}
return static_cast<nsTextNode*>(newChild.forget().get());
}
#ifdef DEBUG
void
nsTextNode::List(FILE* out, int32_t aIndent) const

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

@ -10,19 +10,19 @@
* Implementation of DOM Core's nsIDOMText node.
*/
#include "mozilla/dom/Text.h"
#include "nsGenericDOMDataNode.h"
#include "nsIDOMText.h"
#include "nsDebug.h"
/**
* Class used to implement DOM text nodes
*/
class nsTextNode : public mozilla::dom::Text,
class nsTextNode : public nsGenericDOMDataNode,
public nsIDOMText
{
public:
nsTextNode(already_AddRefed<nsINodeInfo> aNodeInfo)
: mozilla::dom::Text(aNodeInfo)
: nsGenericDOMDataNode(aNodeInfo)
{
NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::TEXT_NODE,
"Bad NodeType in aNodeInfo");
@ -62,6 +62,14 @@ public:
virtual nsIDOMNode* AsDOMNode() { return this; }
// WebIDL API
already_AddRefed<nsTextNode> SplitText(uint32_t aOffset,
mozilla::ErrorResult& rv);
void GetWholeText(nsAString& aWholeText, mozilla::ErrorResult& rv)
{
rv = GetWholeText(aWholeText);
}
#ifdef DEBUG
virtual void List(FILE* out, int32_t aIndent) const;
virtual void DumpContent(FILE* out, int32_t aIndent, bool aDumpAll) const;

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

@ -40,7 +40,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=816298
var clipboard = Cc["@mozilla.org/widget/clipboard;1"]
.getService(SpecialPowers.Ci.nsIClipboard);
var textarea = SpecialPowers.wrap(document.getElementById('input'));
var textarea = SpecialPowers.wrap(document).getElementById('input');
function getLoadContext() {
return SpecialPowers.wrap(window).QueryInterface(Ci.nsIInterfaceRequestor)
@ -78,7 +78,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=816298
function testPasteText(expected, test) {
textarea.value="";
textarea.focus();
textarea.editor.paste(1);
textarea.QueryInterface(SpecialPowers.Ci.nsIDOMNSEditableElement)
.editor.paste(1);
is(textarea.value, expected, test + ": textarea paste");
}
function testInnerHTML(id, expected) {

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

@ -56,7 +56,7 @@ function testCopyPaste () {
var clipboard = Components.classes["@mozilla.org/widget/clipboard;1"]
.getService(Components.interfaces.nsIClipboard);
var textarea = SpecialPowers.wrap(document.getElementById('input'));
var textarea = document.getElementById('input');
function copySelectionToClipboard() {
documentViewer.copySelection();
@ -111,7 +111,8 @@ function testCopyPaste () {
function testPasteText(expected) {
textarea.value="";
textarea.focus();
textarea.editor.paste(1);
textarea.QueryInterface(Components.interfaces.nsIDOMNSEditableElement)
.editor.paste(1);
is(textarea.value, expected, "value of the textarea after the paste");
}
function testSelectionToString(expected) {

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

@ -515,7 +515,7 @@ nsContentEventHandler::OnQueryTextContent(nsQueryContentEvent* aEvent)
NS_ASSERTION(aEvent->mReply.mString.IsEmpty(),
"The reply string must be empty");
nsRefPtr<nsRange> range = new nsRange(mRootContent);
nsRefPtr<nsRange> range = new nsRange();
rv = SetRangeFromFlatTextOffset(range, aEvent->mInput.mOffset,
aEvent->mInput.mLength, false);
NS_ENSURE_SUCCESS(rv, rv);
@ -572,7 +572,7 @@ nsContentEventHandler::OnQueryTextRect(nsQueryContentEvent* aEvent)
if (NS_FAILED(rv))
return rv;
nsRefPtr<nsRange> range = new nsRange(mRootContent);
nsRefPtr<nsRange> range = new nsRange();
rv = SetRangeFromFlatTextOffset(range, aEvent->mInput.mOffset,
aEvent->mInput.mLength, true);
NS_ENSURE_SUCCESS(rv, rv);
@ -716,7 +716,7 @@ nsContentEventHandler::OnQueryCaretRect(nsQueryContentEvent* aEvent)
}
// Otherwise, we should set the guessed caret rect.
nsRefPtr<nsRange> range = new nsRange(mRootContent);
nsRefPtr<nsRange> range = new nsRange();
rv = SetRangeFromFlatTextOffset(range, aEvent->mInput.mOffset, 0, true);
NS_ENSURE_SUCCESS(rv, rv);
@ -899,10 +899,9 @@ nsContentEventHandler::GetFlatTextOffsetOfRange(nsIContent* aRootContent,
int32_t aNodeOffset,
uint32_t* aNativeOffset)
{
NS_ENSURE_STATE(aRootContent);
NS_ASSERTION(aNativeOffset, "param is invalid");
nsRefPtr<nsRange> prev = new nsRange(aRootContent);
nsRefPtr<nsRange> prev = new nsRange();
nsCOMPtr<nsIDOMNode> rootDOMNode(do_QueryInterface(aRootContent));
prev->SetStart(rootDOMNode, 0);
@ -1034,7 +1033,7 @@ nsContentEventHandler::OnSelectionEvent(nsSelectionEvent* aEvent)
}
// Get range from offset and length
nsRefPtr<nsRange> range = new nsRange(mRootContent);
nsRefPtr<nsRange> range = new nsRange();
NS_ENSURE_TRUE(range, NS_ERROR_OUT_OF_MEMORY);
rv = SetRangeFromFlatTextOffset(range, aEvent->mOffset, aEvent->mLength,
aEvent->mExpandToClusterBoundary);

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

@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/HTMLTextAreaElement.h"
#include "mozilla/dom/HTMLTextAreaElementBinding.h"
#include "mozilla/Util.h"
#include "nsIControllers.h"
@ -19,6 +18,7 @@
#include "nsFormSubmission.h"
#include "nsIDOMEventTarget.h"
#include "nsAttrValueInlines.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
#include "nsPresContext.h"
#include "nsMappedAttributes.h"
@ -73,8 +73,6 @@ HTMLTextAreaElement::HTMLTextAreaElement(already_AddRefed<nsINodeInfo> aNodeInfo
AddStatesSilently(NS_EVENT_STATE_ENABLED |
NS_EVENT_STATE_OPTIONAL |
NS_EVENT_STATE_VALID);
SetIsDOMBinding();
}
@ -238,7 +236,7 @@ HTMLTextAreaElement::GetValueInternal(nsAString& aValue, bool aIgnoreWrap) const
NS_IMETHODIMP_(nsIEditor*)
HTMLTextAreaElement::GetTextEditor()
{
return GetEditor();
return mState.GetEditor();
}
NS_IMETHODIMP_(nsISelectionController*)
@ -372,22 +370,12 @@ HTMLTextAreaElement::GetDefaultValue(nsAString& aDefaultValue)
NS_IMETHODIMP
HTMLTextAreaElement::SetDefaultValue(const nsAString& aDefaultValue)
{
ErrorResult error;
SetDefaultValue(aDefaultValue, error);
return error.ErrorCode();
}
void
HTMLTextAreaElement::SetDefaultValue(const nsAString& aDefaultValue, ErrorResult& aError)
{
nsresult rv = nsContentUtils::SetNodeTextContent(this, aDefaultValue, true);
if (NS_SUCCEEDED(rv) && !mValueChanged) {
Reset();
}
if (NS_FAILED(rv)) {
aError.Throw(rv);
}
return rv;
}
bool
@ -575,65 +563,45 @@ HTMLTextAreaElement::IsDoneAddingChildren()
// Controllers Methods
nsIControllers*
HTMLTextAreaElement::GetControllers(ErrorResult& aError)
{
if (!mControllers)
{
nsresult rv;
mControllers = do_CreateInstance(kXULControllersCID, &rv);
if (NS_FAILED(rv)) {
aError.Throw(rv);
return nullptr;
}
nsCOMPtr<nsIController> controller = do_CreateInstance("@mozilla.org/editor/editorcontroller;1", &rv);
if (NS_FAILED(rv)) {
aError.Throw(rv);
return nullptr;
}
mControllers->AppendController(controller);
controller = do_CreateInstance("@mozilla.org/editor/editingcontroller;1", &rv);
if (NS_FAILED(rv)) {
aError.Throw(rv);
return nullptr;
}
mControllers->AppendController(controller);
}
return mControllers;
}
NS_IMETHODIMP
HTMLTextAreaElement::GetControllers(nsIControllers** aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
ErrorResult error;
*aResult = GetControllers(error);
if (!mControllers)
{
nsresult rv;
mControllers = do_CreateInstance(kXULControllersCID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIController> controller = do_CreateInstance("@mozilla.org/editor/editorcontroller;1", &rv);
if (NS_FAILED(rv))
return rv;
mControllers->AppendController(controller);
controller = do_CreateInstance("@mozilla.org/editor/editingcontroller;1", &rv);
if (NS_FAILED(rv))
return rv;
mControllers->AppendController(controller);
}
*aResult = mControllers;
NS_IF_ADDREF(*aResult);
return error.ErrorCode();
}
uint32_t
HTMLTextAreaElement::GetTextLength()
{
nsAutoString val;
GetValue(val);
return val.Length();
return NS_OK;
}
NS_IMETHODIMP
HTMLTextAreaElement::GetTextLength(int32_t *aTextLength)
{
NS_ENSURE_ARG_POINTER(aTextLength);
*aTextLength = GetTextLength();
nsAutoString val;
nsresult rv = GetValue(val);
*aTextLength = val.Length();
return NS_OK;
return rv;
}
NS_IMETHODIMP
@ -641,62 +609,35 @@ HTMLTextAreaElement::GetSelectionStart(int32_t *aSelectionStart)
{
NS_ENSURE_ARG_POINTER(aSelectionStart);
ErrorResult error;
*aSelectionStart = GetSelectionStart(error);
return error.ErrorCode();
}
uint32_t
HTMLTextAreaElement::GetSelectionStart(ErrorResult& aError)
{
int32_t selStart, selEnd;
nsresult rv = GetSelectionRange(&selStart, &selEnd);
int32_t selEnd;
nsresult rv = GetSelectionRange(aSelectionStart, &selEnd);
if (NS_FAILED(rv) && mState.IsSelectionCached()) {
return mState.GetSelectionProperties().mStart;
*aSelectionStart = mState.GetSelectionProperties().mStart;
return NS_OK;
}
if (NS_FAILED(rv)) {
aError.Throw(rv);
}
return selStart;
return rv;
}
NS_IMETHODIMP
HTMLTextAreaElement::SetSelectionStart(int32_t aSelectionStart)
{
ErrorResult error;
SetSelectionStart(aSelectionStart, error);
return error.ErrorCode();
}
void
HTMLTextAreaElement::SetSelectionStart(uint32_t aSelectionStart, ErrorResult& aError)
{
if (mState.IsSelectionCached()) {
mState.GetSelectionProperties().mStart = aSelectionStart;
return;
return NS_OK;
}
nsAutoString direction;
nsresult rv = GetSelectionDirection(direction);
if (NS_FAILED(rv)) {
aError.Throw(rv);
return;
}
NS_ENSURE_SUCCESS(rv, rv);
int32_t start, end;
rv = GetSelectionRange(&start, &end);
if (NS_FAILED(rv)) {
aError.Throw(rv);
return;
}
NS_ENSURE_SUCCESS(rv, rv);
start = aSelectionStart;
if (end < start) {
end = start;
}
rv = SetSelectionRange(start, end, direction);
if (NS_FAILED(rv)) {
aError.Throw(rv);
}
return SetSelectionRange(start, end, direction);
}
NS_IMETHODIMP
@ -704,62 +645,35 @@ HTMLTextAreaElement::GetSelectionEnd(int32_t *aSelectionEnd)
{
NS_ENSURE_ARG_POINTER(aSelectionEnd);
ErrorResult error;
*aSelectionEnd = GetSelectionEnd(error);
return error.ErrorCode();
}
uint32_t
HTMLTextAreaElement::GetSelectionEnd(ErrorResult& aError)
{
int32_t selStart, selEnd;
nsresult rv = GetSelectionRange(&selStart, &selEnd);
int32_t selStart;
nsresult rv = GetSelectionRange(&selStart, aSelectionEnd);
if (NS_FAILED(rv) && mState.IsSelectionCached()) {
return mState.GetSelectionProperties().mEnd;
*aSelectionEnd = mState.GetSelectionProperties().mEnd;
return NS_OK;
}
if (NS_FAILED(rv)) {
aError.Throw(rv);
}
return selEnd;
return rv;
}
NS_IMETHODIMP
HTMLTextAreaElement::SetSelectionEnd(int32_t aSelectionEnd)
{
ErrorResult error;
SetSelectionEnd(aSelectionEnd, error);
return error.ErrorCode();
}
void
HTMLTextAreaElement::SetSelectionEnd(uint32_t aSelectionEnd, ErrorResult& aError)
{
if (mState.IsSelectionCached()) {
mState.GetSelectionProperties().mEnd = aSelectionEnd;
return;
return NS_OK;
}
nsAutoString direction;
nsresult rv = GetSelectionDirection(direction);
if (NS_FAILED(rv)) {
aError.Throw(rv);
return;
}
NS_ENSURE_SUCCESS(rv, rv);
int32_t start, end;
rv = GetSelectionRange(&start, &end);
if (NS_FAILED(rv)) {
aError.Throw(rv);
return;
}
NS_ENSURE_SUCCESS(rv, rv);
end = aSelectionEnd;
if (start > end) {
start = end;
}
rv = SetSelectionRange(start, end, direction);
if (NS_FAILED(rv)) {
aError.Throw(rv);
}
return SetSelectionRange(start, end, direction);
}
nsresult
@ -794,14 +708,6 @@ DirectionToName(nsITextControlFrame::SelectionDirection dir, nsAString& aDirecti
nsresult
HTMLTextAreaElement::GetSelectionDirection(nsAString& aDirection)
{
ErrorResult error;
GetSelectionDirection(aDirection, error);
return error.ErrorCode();
}
void
HTMLTextAreaElement::GetSelectionDirection(nsAString& aDirection, ErrorResult& aError)
{
nsresult rv = NS_ERROR_FAILURE;
nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
@ -820,23 +726,15 @@ HTMLTextAreaElement::GetSelectionDirection(nsAString& aDirection, ErrorResult& a
if (NS_FAILED(rv)) {
if (mState.IsSelectionCached()) {
DirectionToName(mState.GetSelectionProperties().mDirection, aDirection);
return;
return NS_OK;
}
aError.Throw(rv);
}
return rv;
}
NS_IMETHODIMP
HTMLTextAreaElement::SetSelectionDirection(const nsAString& aDirection)
{
ErrorResult error;
SetSelectionDirection(aDirection, error);
return error.ErrorCode();
}
void
HTMLTextAreaElement::SetSelectionDirection(const nsAString& aDirection, ErrorResult& aError)
{
HTMLTextAreaElement::SetSelectionDirection(const nsAString& aDirection) {
if (mState.IsSelectionCached()) {
nsITextControlFrame::SelectionDirection dir = nsITextControlFrame::eNone;
if (aDirection.EqualsLiteral("forward")) {
@ -845,7 +743,7 @@ HTMLTextAreaElement::SetSelectionDirection(const nsAString& aDirection, ErrorRes
dir = nsITextControlFrame::eBackward;
}
mState.GetSelectionProperties().mDirection = dir;
return;
return NS_OK;
}
int32_t start, end;
@ -853,29 +751,15 @@ HTMLTextAreaElement::SetSelectionDirection(const nsAString& aDirection, ErrorRes
if (NS_SUCCEEDED(rv)) {
rv = SetSelectionRange(start, end, aDirection);
}
if (NS_FAILED(rv)) {
aError.Throw(rv);
}
return rv;
}
NS_IMETHODIMP
HTMLTextAreaElement::SetSelectionRange(int32_t aSelectionStart,
int32_t aSelectionEnd,
const nsAString& aDirection)
{
ErrorResult error;
Optional<nsAString> dir;
dir = &aDirection;
SetSelectionRange(aSelectionStart, aSelectionEnd, dir, error);
return error.ErrorCode();
}
void
HTMLTextAreaElement::SetSelectionRange(uint32_t aSelectionStart,
uint32_t aSelectionEnd,
const Optional<nsAString>& aDirection,
ErrorResult& aError)
{
{
nsresult rv = NS_ERROR_FAILURE;
nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
@ -886,7 +770,7 @@ HTMLTextAreaElement::SetSelectionRange(uint32_t aSelectionStart,
// Note that we don't currently support directionless selections, so
// "none" is treated like "forward".
nsITextControlFrame::SelectionDirection dir = nsITextControlFrame::eForward;
if (aDirection.WasPassed() && aDirection.Value().EqualsLiteral("backward")) {
if (aDirection.EqualsLiteral("backward")) {
dir = nsITextControlFrame::eBackward;
}
@ -897,10 +781,8 @@ HTMLTextAreaElement::SetSelectionRange(uint32_t aSelectionStart,
}
}
if (NS_FAILED(rv)) {
aError.Throw(rv);
}
}
return rv;
}
nsresult
HTMLTextAreaElement::Reset()
@ -1428,12 +1310,5 @@ HTMLTextAreaElement::FieldSetDisabledChanged(bool aNotify)
nsGenericHTMLFormElement::FieldSetDisabledChanged(aNotify);
}
JSObject*
HTMLTextAreaElement::WrapNode(JSContext* aCx, JSObject* aScope,
bool* aTriedToWrap)
{
return HTMLTextAreaElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
} // namespace dom
} // namespace mozilla

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

@ -16,7 +16,6 @@
#include "nsStubMutationObserver.h"
#include "nsIConstraintValidation.h"
#include "nsHTMLFormElement.h"
#include "nsGkAtoms.h"
#include "nsTextEditorState.h"
@ -160,123 +159,9 @@ public:
nsresult GetValidationMessage(nsAString& aValidationMessage,
ValidityStateType aType);
// Web IDL binding methods
bool Autofocus()
{
return GetBoolAttr(nsGkAtoms::autofocus);
}
void SetAutofocus(bool aAutoFocus, ErrorResult& aError)
{
SetHTMLBoolAttr(nsGkAtoms::autofocus, aAutoFocus, aError);
}
uint32_t Cols()
{
return GetIntAttr(nsGkAtoms::cols, DEFAULT_COLS);
}
void SetCols(uint32_t aCols, ErrorResult& aError)
{
if (aCols == 0) {
aError.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
} else {
SetHTMLUnsignedIntAttr(nsGkAtoms::cols, aCols, aError);
}
}
bool Disabled()
{
return GetBoolAttr(nsGkAtoms::disabled);
}
void SetDisabled(bool aDisabled, ErrorResult& aError)
{
SetHTMLBoolAttr(nsGkAtoms::disabled, aDisabled, aError);
}
// nsGenericHTMLFormElement::GetForm is fine
using nsGenericHTMLFormElement::GetForm;
int32_t MaxLength()
{
return GetIntAttr(nsGkAtoms::maxlength, -1);
}
void SetMaxLength(int32_t aMaxLength, ErrorResult& aError)
{
if (aMaxLength < 0) {
aError.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
} else {
SetHTMLIntAttr(nsGkAtoms::maxlength, aMaxLength, aError);
}
}
// XPCOM GetName is fine
void SetName(const nsAString& aName, ErrorResult& aError)
{
SetHTMLAttr(nsGkAtoms::name, aName, aError);
}
// XPCOM GetPlaceholder is fine
void SetPlaceholder(const nsAString& aPlaceholder, ErrorResult& aError)
{
SetHTMLAttr(nsGkAtoms::placeholder, aPlaceholder, aError);
}
bool ReadOnly()
{
return GetBoolAttr(nsGkAtoms::readonly);
}
void SetReadOnly(bool aReadOnly, ErrorResult& aError)
{
SetHTMLBoolAttr(nsGkAtoms::readonly, aReadOnly, aError);
}
bool Required()
{
return GetBoolAttr(nsGkAtoms::required);
}
void SetRequired(bool aRequired, ErrorResult& aError)
{
SetHTMLBoolAttr(nsGkAtoms::required, aRequired, aError);
}
uint32_t Rows()
{
return GetIntAttr(nsGkAtoms::rows, DEFAULT_ROWS_TEXTAREA);
}
void SetRows(uint32_t aRows, ErrorResult& aError)
{
if (aRows == 0) {
aError.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
} else {
SetHTMLUnsignedIntAttr(nsGkAtoms::rows, aRows, aError);
}
}
// XPCOM GetWrap is fine
void SetWrap(const nsAString& aWrap, ErrorResult& aError)
{
SetHTMLAttr(nsGkAtoms::wrap, aWrap, aError);
}
// XPCOM GetType is fine
// XPCOM GetDefaultValue is fine
void SetDefaultValue(const nsAString& aDefaultValue, ErrorResult& aError);
// XPCOM GetValue/SetValue are fine
uint32_t GetTextLength();
// nsIConstraintValidation::WillValidate is fine.
// nsIConstraintValidation::Validity() is fine.
// nsIConstraintValidation::GetValidationMessage() is fine.
// nsIConstraintValidation::CheckValidity() is fine.
using nsIConstraintValidation::CheckValidity;
// nsIConstraintValidation::SetCustomValidity() is fine.
// XPCOM Select is fine
uint32_t GetSelectionStart(ErrorResult& aError);
void SetSelectionStart(uint32_t aSelectionStart, ErrorResult& aError);
uint32_t GetSelectionEnd(ErrorResult& aError);
void SetSelectionEnd(uint32_t aSelectionEnd, ErrorResult& aError);
void GetSelectionDirection(nsAString& aDirection, ErrorResult& aError);
void SetSelectionDirection(const nsAString& aDirection, ErrorResult& aError);
void SetSelectionRange(uint32_t aSelectionStart, uint32_t aSelectionEnd, const Optional<nsAString>& aDirecton, ErrorResult& aError);
nsIControllers* GetControllers(ErrorResult& aError);
nsIEditor* GetEditor()
{
return mState.GetEditor();
}
protected:
using nsGenericHTMLFormElement::IsSingleLineTextControl; // get rid of the compiler warning
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
bool *aTriedToWrap) MOZ_OVERRIDE;
nsCOMPtr<nsIControllers> mControllers;
/** Whether or not the value has changed since its default value was given. */
bool mValueChanged;

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

@ -1,63 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "HTMLTimeElement.h"
#include "mozilla/dom/HTMLTimeElementBinding.h"
#include "nsContentUtils.h"
#include "nsGenericHTMLElement.h"
#include "nsVariant.h"
#include "nsGkAtoms.h"
NS_IMPL_NS_NEW_HTML_ELEMENT(Time)
namespace mozilla {
namespace dom {
HTMLTimeElement::HTMLTimeElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{
SetIsDOMBinding();
}
HTMLTimeElement::~HTMLTimeElement()
{
}
NS_IMPL_ADDREF_INHERITED(HTMLTimeElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLTimeElement, Element)
NS_INTERFACE_TABLE_HEAD(HTMLTimeElement)
NS_HTML_CONTENT_INTERFACE_TABLE0(HTMLTimeElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLTimeElement,
nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_ELEMENT_CLONE(HTMLTimeElement)
JSObject*
HTMLTimeElement::WrapNode(JSContext* cx, JSObject* scope, bool* triedToWrap)
{
return HTMLTimeElementBinding::Wrap(cx, scope, this, triedToWrap);
}
void
HTMLTimeElement::GetItemValueText(nsAString& text)
{
if (HasAttr(kNameSpaceID_None, nsGkAtoms::datetime)) {
GetDateTime(text);
} else {
GetTextContentInternal(text);
}
}
void
HTMLTimeElement::SetItemValueText(const nsAString& text)
{
ErrorResult rv;
SetDateTime(text, rv);
}
} // namespace dom
} // namespace mozilla

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

@ -1,59 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_HTMLTimeElement_h
#define mozilla_dom_HTMLTimeElement_h
#include "nsIDOMHTMLElement.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
namespace mozilla {
namespace dom {
class HTMLTimeElement MOZ_FINAL : public nsGenericHTMLElement,
public nsIDOMHTMLElement
{
public:
HTMLTimeElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~HTMLTimeElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// HTMLTimeElement WebIDL
void GetDateTime(nsAString& aDateTime)
{
GetHTMLAttr(nsGkAtoms::datetime, aDateTime);
}
void SetDateTime(const nsAString& aDateTime, ErrorResult& aError)
{
SetHTMLAttr(nsGkAtoms::datetime, aDateTime, aError);
}
virtual void GetItemValueText(nsAString& text);
virtual void SetItemValueText(const nsAString& text);
virtual nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const;
virtual nsIDOMNode* AsDOMNode() { return this; }
protected:
virtual JSObject* WrapNode(JSContext* aCx, JSObject* aScope,
bool* aTriedToWrap) MOZ_OVERRIDE;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_HTMLTimeElement_h

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

@ -72,7 +72,6 @@ EXPORTS_mozilla/dom = \
HTMLTableRowElement.h \
HTMLTableSectionElement.h \
HTMLTextAreaElement.h \
HTMLTimeElement.h \
HTMLTitleElement.h \
HTMLUnknownElement.h \
UndoManager.h \
@ -137,7 +136,6 @@ CPPSRCS = \
HTMLTableRowElement.cpp \
HTMLTableSectionElement.cpp \
HTMLTextAreaElement.cpp \
HTMLTimeElement.cpp \
HTMLTitleElement.cpp \
HTMLUnknownElement.cpp \
ValidityState.cpp \

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

@ -1962,7 +1962,6 @@ NS_DECLARE_NS_NEW_HTML_ELEMENT(Tbody)
NS_DECLARE_NS_NEW_HTML_ELEMENT(TextArea)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Tfoot)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Thead)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Time)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Title)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Unknown)
#if defined(MOZ_MEDIA)

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

@ -3291,7 +3291,7 @@ nsIContent* nsHTMLMediaElement::GetNextSource()
nsresult rv = NS_OK;
if (!mSourcePointer) {
// First time this has been run, create a selection to cover children.
mSourcePointer = new nsRange(this);
mSourcePointer = new nsRange();
rv = mSourcePointer->SelectNodeContents(thisDomNode);
if (NS_FAILED(rv)) return nullptr;

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

@ -279,7 +279,6 @@ MOCHITEST_FILES = \
test_bug803677.html \
test_bug827126.html \
test_bug827426.html \
test_bug838582.html \
test_bug841466.html \
test_iframe_sandbox_inheritance.html \
file_iframe_sandbox_a_if1.html \
@ -350,7 +349,6 @@ MOCHITEST_FILES = \
test_mod_attributes_reflection.html \
test_mozaudiochannel.html \
test_style_attributes_reflection.html \
test_bug629801.html \
$(NULL)

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

@ -58,7 +58,8 @@ function reflectString(aParameters)
// TODO: remove this ugly hack when null stringification will work as expected.
var todoAttrs = {
form: [ "acceptCharset", "name", "target" ],
input: [ "accept", "alt", "formTarget", "max", "min", "name", "pattern", "placeholder", "step", "defaultValue" ]
input: [ "accept", "alt", "formTarget", "max", "min", "name", "pattern", "placeholder", "step", "defaultValue" ],
textarea: [ "name", "placeholder" ]
};
if (!(element.localName in todoAttrs) || todoAttrs[element.localName].indexOf(idlAttr) == -1) {
is(element.getAttribute(contentAttr), "null",

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

@ -25,7 +25,7 @@ var textareaChange = 0;
function testUserInput() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var input = document.getElementById("input");
var textarea = SpecialPowers.wrap(document.getElementById("textarea"));
var textarea = document.getElementById("textarea");
input.focus();
input.QueryInterface(Components.interfaces.nsIDOMNSEditableElement).setUserInput("foo");
@ -47,7 +47,7 @@ function testUserInput() {
"Change event dispatched when input element doesn't have focus.");
textarea.focus();
textarea.setUserInput("foo");
textarea.QueryInterface(Components.interfaces.nsIDOMNSEditableElement).setUserInput("foo");
textarea.blur();
is(textareaChange, 1, "Textarea element should have got one change event.");
@ -61,7 +61,7 @@ function testUserInput() {
is(textareaChange, 1,
"Change event dispatched when setting the value of the textarea element (2).");
textarea.setUserInput("foo");
textarea.QueryInterface(Components.interfaces.nsIDOMNSEditableElement).setUserInput("foo");
is(textareaChange, 1,
"Change event dispatched when textarea element doesn't have focus.");
}

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

@ -213,7 +213,6 @@ HTML_TAG("textarea", "TextArea", [], [ "nsIDOMNSEditableElement" ]);
HTML_TAG("tfoot", "TableSection");
HTML_TAG("th", "TableCell");
HTML_TAG("thead", "TableSection");
HTML_TAG("time", "Time");
HTML_TAG("title", "Title");
HTML_TAG("tr", "TableRow");
HTML_TAG("tt", "");
@ -255,6 +254,28 @@ for (var tag of allTags) {
is(node instanceof SpecialPowers.Ci[iface], true,
tagName(tag) + " does not QI to " + iface);
}
// Now see what classinfo reports
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var nodeClassInfo = SpecialPowers.wrap(node).QueryInterface(SpecialPowers.Ci.nsIClassInfo);
var count = {};
var classInfoInterfaces =
nodeClassInfo.getInterfaces(count).
map(function(id) { return SpecialPowers.Components.interfacesByID[id].toString(); });
// Make sure that we know about all the things classinfo claims
for (var classInfoInterface of classInfoInterfaces) {
isnot(interfaces[tag].indexOf(classInfoInterface), -1,
"Should know about " + tagName(tag) + " implementing " +
classInfoInterface);
}
// And make sure classinfo claims all the things we know about
for (iface of interfaces[tag]) {
isnot(classInfoInterfaces.indexOf(iface), -1,
"Classinfo for " + tagName(tag) + " should claim to implement " +
iface);
}
}
</script>
</pre>

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

@ -1,60 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=629801
-->
<head>
<title>Test for Bug 629801</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="reflect.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=629801">Mozilla Bug 629801</a>
<p id="display"></p>
<div id="content" style="display: none">
<div itemscope>
This tests itemValue on time elements, first with no datetime attribute, then with no text content,
then with both.
<time id="t1" itemprop="a">May 10th 2009</time>
<time id="t2" itemprop="b" datetime="2009-05-10"></time>
<time id="t3" itemprop="c" datetime="2009-05-10">May 10th 2009</time>
</div>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 629801 **/
var t1 = document.getElementById("t1"),
t2 = document.getElementById("t2"),
t3 = document.getElementById("t3"),
t4 = document.createElement("time");
// .dateTime IDL
is(t1.dateTime, "", "dateTime is properly set to empty string if datetime attributeis absent");
is(t2.dateTime, "2009-05-10", "dateTime is properly set to datetime attribute with datetime and no text content");
is(t3.dateTime, "2009-05-10", "dateTime is properly set to datetime attribute with datetime and text content");
// .itemValue getter for <time>'s microdata
var times = document.getItems()[0];
is(times.properties["a"][0].itemValue, "May 10th 2009", "itemValue getter with no datetime uses text content");
is(times.properties["b"][0].itemValue, "2009-05-10", "itemValue getter with no text content uses datetime");
is(times.properties["c"][0].itemValue, "2009-05-10", "itemValue getter with datetime and text content uses datetime");
// .itemValue setter uses datetime vs. text content
times.properties["a"][0].itemValue = "2009-05-10";
is(times.properties["a"][0].dateTime, "2009-05-10", "setting itemValue updates datetime");
// dateTime reflects datetime attribute
reflectString({
element: t4,
attribute: "dateTime"
});
</script>
</pre>
</body>
</html>

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

@ -1,35 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=838582
-->
<head>
<title>Test for Bug 838582</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="reflect.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=838582">Mozilla Bug 838582</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<textarea id="t">abc</textarea>
<script type="application/javascript">
/** Test for Bug 838582 **/
var textarea = document.getElementById("t");
is(t.textLength, 3, "Correct textLength for defaultValue");
t.value = "abcdef";
is(t.textLength, 6, "Correct textLength for value");
ok(!("controllers" in t), "Don't have web-visible controllers property");
ok("controllers" in SpecialPowers.wrap(t), "Have chrome-visible controllers property");
</script>
</pre>
</body>
</html>

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

@ -2612,7 +2612,7 @@ nsHTMLDocument::DeferredContentEditableCountChange(nsIContent *aElement)
nsCOMPtr<nsIEditor> editor;
docshell->GetEditor(getter_AddRefs(editor));
if (editor) {
nsRefPtr<nsRange> range = new nsRange(aElement);
nsRefPtr<nsRange> range = new nsRange();
rv = range->SelectNode(node);
if (NS_FAILED(rv)) {
// The node might be detached from the document at this point,

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

@ -363,7 +363,7 @@ function run_miscellaneous_tests() {
baseRange.setStart(null, 0);
do_throw("Should have thrown NOT_OBJECT_ERR!");
} catch (e) {
do_check_eq(e instanceof TypeError, true);
do_check_eq(e.name, "NS_ERROR_DOM_NOT_OBJECT_ERR");
}
// Invalid start node
@ -371,7 +371,7 @@ function run_miscellaneous_tests() {
baseRange.setStart({}, 0);
do_throw("Should have thrown SecurityError!");
} catch (e) {
do_check_true(e instanceof TypeError);
do_check_eq(e.name, "SecurityError");
}
// Invalid index

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

@ -7,17 +7,17 @@
#define mozilla_dom_CDATASection_h
#include "nsIDOMCDATASection.h"
#include "mozilla/dom/Text.h"
#include "nsGenericDOMDataNode.h"
namespace mozilla {
namespace dom {
class CDATASection : public Text,
class CDATASection : public nsGenericDOMDataNode,
public nsIDOMCDATASection
{
public:
CDATASection(already_AddRefed<nsINodeInfo> aNodeInfo)
: Text(aNodeInfo)
: nsGenericDOMDataNode(aNodeInfo)
{
NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::CDATA_SECTION_NODE,
"Bad NodeType in aNodeInfo");

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

@ -6667,6 +6667,19 @@ nsNavigatorSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
// DOM Node helper
template<nsresult (*func)(JSContext *cx, JSObject *obj, jsval *vp)>
static JSBool
GetterShim(JSContext *cx, JSHandleObject obj, JSHandleId /* unused */, JSMutableHandleValue vp)
{
nsresult rv = (*func)(cx, obj, vp.address());
if (NS_FAILED(rv)) {
xpc::Throw(cx, rv);
return JS_FALSE;
}
return JS_TRUE;
}
NS_IMETHODIMP
nsNodeSH::PreCreate(nsISupports *nativeObj, JSContext *cx, JSObject *globalObj,
JSObject **parentObj)
@ -7379,6 +7392,42 @@ nsNamedNodeMapSH::GetNamedItem(nsISupports *aNative, const nsAString& aName,
return attr;
}
// Can't be static so GetterShim will compile
nsresult
DocumentURIObjectGetter(JSContext *cx, JSObject *obj, jsval *vp)
{
// This function duplicates some of the logic in XPC_WN_HelperGetProperty
XPCWrappedNative *wrapper =
XPCWrappedNative::GetWrappedNativeOfJSObject(cx, obj);
// The error checks duplicate code in THROW_AND_RETURN_IF_BAD_WRAPPER
NS_ENSURE_TRUE(!wrapper || wrapper->IsValid(), NS_ERROR_XPC_HAS_BEEN_SHUTDOWN);
nsCOMPtr<nsIDocument> doc = do_QueryWrappedNative(wrapper, obj);
NS_ENSURE_TRUE(doc, NS_ERROR_UNEXPECTED);
return WrapNative(cx, JS_GetGlobalForScopeChain(cx), doc->GetDocumentURI(),
&NS_GET_IID(nsIURI), true, vp);
}
NS_IMETHODIMP
nsDocumentSH::PostCreatePrototype(JSContext * cx, JSObject * proto)
{
// XXXbz when this goes away, kill GetterShim as well.
// set up our proto first
nsresult rv = nsNodeSH::PostCreatePrototype(cx, proto);
if (xpc::AccessCheck::isChrome(js::GetObjectCompartment(proto))) {
// Stick a documentURIObject property on there
JS_DefinePropertyById(cx, proto, sDocumentURIObject_id,
JSVAL_VOID, GetterShim<DocumentURIObjectGetter>,
nullptr,
JSPROP_READONLY | JSPROP_SHARED);
}
return rv;
}
NS_IMETHODIMP
nsDocumentSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, jsid id, uint32_t flags,

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

@ -634,6 +634,7 @@ public:
}
public:
NS_IMETHOD PostCreatePrototype(JSContext * cx, JSObject * proto);
NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, jsid id, uint32_t flags,
JSObject **objp, bool *_retval);

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

@ -430,15 +430,6 @@ DOMInterfaces = {
]
},
'HTMLTextAreaElement': {
'resultNotAddRefed': [
'form', 'controllers', 'editor'
],
'binaryNames': {
'textLength': 'getTextLength'
}
},
'HTMLStyleElement': {
'resultNotAddRefed': [
'sheet'
@ -582,14 +573,6 @@ DOMInterfaces = {
'resultNotAddRefed': [ 'item' ]
},
'Range': {
'nativeType': 'nsRange',
'resultNotAddRefed': [ 'startContainer', 'endContainer', 'commonAncestorContainer' ],
'binaryNames': {
'__stringifier': 'ToString'
}
},
'Rect': {
"nativeType": "nsDOMCSSRect",
'resultNotAddRefed': [ "top", "right", "bottom", "left" ]
@ -833,9 +816,7 @@ DOMInterfaces = {
},
'Text': {
# Total hack to allow binding code to realize that nsTextNode can
# in fact be cast to Text.
'headerFile': 'nsTextNode.h',
'nativeType': 'nsTextNode',
},
'TextDecoder': [
@ -1223,11 +1204,11 @@ addExternalIface('NamedNodeMap')
addExternalIface('NodeIterator')
addExternalIface('nsIStreamListener', nativeType='nsIStreamListener', notflattened=True)
addExternalIface('nsISupports', nativeType='nsISupports')
addExternalIface('nsIEditor', nativeType='nsIEditor', notflattened=True)
addExternalIface('OutputStream', nativeType='nsIOutputStream',
notflattened=True)
addExternalIface('Principal', nativeType='nsIPrincipal',
headerFile='nsIPrincipal.h', notflattened=True)
addExternalIface('Range', nativeType='nsRange')
addExternalIface('Selection', nativeType='nsISelection')
addExternalIface('StyleSheet', nativeType='nsIStyleSheet')
addExternalIface('StyleSheetList')

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

@ -1819,18 +1819,6 @@ def InitUnforgeableProperties(descriptor, properties):
"// finalizer trying to drop its ownership of the C++ object.\n"),
post="\n")).define() if len(unforgeables) > 0 else ""
def AssertInheritanceChain(descriptor):
asserts = ""
iface = descriptor.interface
while iface:
desc = descriptor.getDescriptor(iface.identifier.name)
asserts += (
" MOZ_ASSERT(static_cast<%s*>(aObject) == \n"
" reinterpret_cast<%s*>(aObject));\n" %
(desc.nativeType, desc.nativeType))
iface = iface.parent
return asserts
class CGWrapWithCacheMethod(CGAbstractMethod):
"""
Create a wrapper JSObject for a given native that implements nsWrapperCache.
@ -1851,8 +1839,7 @@ class CGWrapWithCacheMethod(CGAbstractMethod):
return """ *aTriedToWrap = true;
return aObject->GetJSObject();"""
return """%s
*aTriedToWrap = true;
return """ *aTriedToWrap = true;
JSObject* parent = WrapNativeParent(aCx, aScope, aObject->GetParentObject());
if (!parent) {
@ -1881,8 +1868,7 @@ class CGWrapWithCacheMethod(CGAbstractMethod):
%s
aCache->SetWrapper(obj);
return obj;""" % (AssertInheritanceChain(self.descriptor),
CheckPref(self.descriptor, "global", "*aTriedToWrap", "NULL", "aCache"),
return obj;""" % (CheckPref(self.descriptor, "global", "*aTriedToWrap", "NULL", "aCache"),
CreateBindingJSObject(self.descriptor, "parent"),
InitUnforgeableProperties(self.descriptor, self.properties))
@ -1913,7 +1899,7 @@ class CGWrapNonWrapperCacheMethod(CGAbstractMethod):
self.properties = properties
def definition_body(self):
return """%s
return """
JSObject* global = JS_GetGlobalForObject(aCx, aScope);
JSObject* proto = GetProtoObject(aCx, global);
if (!proto) {
@ -1922,8 +1908,7 @@ class CGWrapNonWrapperCacheMethod(CGAbstractMethod):
%s
%s
return obj;""" % (AssertInheritanceChain(self.descriptor),
CreateBindingJSObject(self.descriptor, "global"),
return obj;""" % (CreateBindingJSObject(self.descriptor, "global"),
InitUnforgeableProperties(self.descriptor, self.properties))
builtinNames = {

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

@ -1,3 +1,5 @@
{
"itemValue must reflect the src attribute on track elements": true
"itemValue must reflect the src attribute on track elements": true,
"itemValue must reflect the dateTime attribute of time elements with no datetime attribute": true,
"itemValue must reflect the datetime attribute of time elements with a datetime attribute": true
}

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

@ -92,6 +92,45 @@
"CharacterData interface: document.createTextNode(\"abc\") must inherit property \"remove\" with the proper type (7)": true,
"CharacterData interface: xmlDoc.createProcessingInstruction(\"abc\", \"def\") must inherit property \"remove\" with the proper type (7)": true,
"CharacterData interface: document.createComment(\"abc\") must inherit property \"remove\" with the proper type (7)": true,
"Range interface: existence and properties of interface object": true,
"Range interface: existence and properties of interface prototype object": true,
"Range interface: existence and properties of interface prototype object's \"constructor\" property": true,
"Range interface: attribute startContainer": true,
"Range interface: attribute startOffset": true,
"Range interface: attribute endContainer": true,
"Range interface: attribute endOffset": true,
"Range interface: attribute collapsed": true,
"Range interface: attribute commonAncestorContainer": true,
"Range interface: calling setStart(Node,unsigned long) on document.createRange() with too few arguments must throw TypeError": true,
"Range interface: calling setEnd(Node,unsigned long) on document.createRange() with too few arguments must throw TypeError": true,
"Range interface: calling setStartBefore(Node) on document.createRange() with too few arguments must throw TypeError": true,
"Range interface: calling setStartAfter(Node) on document.createRange() with too few arguments must throw TypeError": true,
"Range interface: calling setEndBefore(Node) on document.createRange() with too few arguments must throw TypeError": true,
"Range interface: calling setEndAfter(Node) on document.createRange() with too few arguments must throw TypeError": true,
"Range interface: calling collapse(boolean) on document.createRange() with too few arguments must throw TypeError": true,
"Range interface: calling selectNode(Node) on document.createRange() with too few arguments must throw TypeError": true,
"Range interface: calling selectNodeContents(Node) on document.createRange() with too few arguments must throw TypeError": true,
"Range interface: calling compareBoundaryPoints(unsigned short,Range) on document.createRange() with too few arguments must throw TypeError": true,
"Range interface: calling insertNode(Node) on document.createRange() with too few arguments must throw TypeError": true,
"Range interface: calling surroundContents(Node) on document.createRange() with too few arguments must throw TypeError": true,
"Range interface: calling isPointInRange(Node,unsigned long) on document.createRange() with too few arguments must throw TypeError": true,
"Range interface: calling comparePoint(Node,unsigned long) on document.createRange() with too few arguments must throw TypeError": true,
"Range interface: calling intersectsNode(Node) on document.createRange() with too few arguments must throw TypeError": true,
"Range interface: calling setStart(Node,unsigned long) on detachedRange with too few arguments must throw TypeError": true,
"Range interface: calling setEnd(Node,unsigned long) on detachedRange with too few arguments must throw TypeError": true,
"Range interface: calling setStartBefore(Node) on detachedRange with too few arguments must throw TypeError": true,
"Range interface: calling setStartAfter(Node) on detachedRange with too few arguments must throw TypeError": true,
"Range interface: calling setEndBefore(Node) on detachedRange with too few arguments must throw TypeError": true,
"Range interface: calling setEndAfter(Node) on detachedRange with too few arguments must throw TypeError": true,
"Range interface: calling collapse(boolean) on detachedRange with too few arguments must throw TypeError": true,
"Range interface: calling selectNode(Node) on detachedRange with too few arguments must throw TypeError": true,
"Range interface: calling selectNodeContents(Node) on detachedRange with too few arguments must throw TypeError": true,
"Range interface: calling compareBoundaryPoints(unsigned short,Range) on detachedRange with too few arguments must throw TypeError": true,
"Range interface: calling insertNode(Node) on detachedRange with too few arguments must throw TypeError": true,
"Range interface: calling surroundContents(Node) on detachedRange with too few arguments must throw TypeError": true,
"Range interface: calling isPointInRange(Node,unsigned long) on detachedRange with too few arguments must throw TypeError": true,
"Range interface: calling comparePoint(Node,unsigned long) on detachedRange with too few arguments must throw TypeError": true,
"Range interface: calling intersectsNode(Node) on detachedRange with too few arguments must throw TypeError": true,
"NodeIterator interface: existence and properties of interface object": true,
"NodeIterator interface: existence and properties of interface prototype object": true,
"NodeIterator interface: existence and properties of interface prototype object's \"constructor\" property": true,

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

@ -29,6 +29,7 @@ MOCHITEST_FILES := \
test_Range-commonAncestorContainer.html.json \
test_Range-comparePoint.html.json \
test_Range-detach.html.json \
test_Range-intersectsNode-binding.html.json \
test_attributes.html.json \
test_case.html.json \
test_historical.html.json \

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

@ -1,3 +1,4 @@
{
"Range.comparePoint": true
"Range.comparePoint": true,
"Range.comparePoint 1": true
}

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

@ -0,0 +1,3 @@
{
"Calling intersectsNode without an argument or with an invalid argument should throw a TypeError.": true
}

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

@ -14,7 +14,7 @@
* http://www.w3.org/TR/DOM-Level-2-Core/
*/
[scriptable, builtinclass, uuid(4a15eb0c-d5bc-4902-9d50-21b12cab47e7)]
[scriptable, uuid(4a15eb0c-d5bc-4902-9d50-21b12cab47e7)]
interface nsIDOMDocumentFragment : nsIDOMNode
{
};

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

@ -9,11 +9,8 @@ interface nsIEditor;
/**
* This interface is implemented by elements which have inner editable content,
* such as HTML input and textarea.
*
* Please make sure to update the HTMLTextAreaElement Web IDL interface to
* mirror this interface when changing it.
*/
* such as HTML input and textarea.
*/
[scriptable, uuid(b33eb56c-3120-418c-892b-774b00c7dde8)]
interface nsIDOMNSEditableElement : nsISupports

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

@ -60,7 +60,5 @@ interface nsIDOMHTMLTextAreaElement : nsIDOMHTMLElement
// Mozilla extensions
// Please make sure to update the HTMLTextAreaElement Web IDL interface to
// mirror the list of Mozilla extensions here when changing it.
readonly attribute nsIControllers controllers;
};

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

@ -15,7 +15,8 @@ function runTests() {
textElt.focus();
textElt.value = text;
textElt.select();
SpecialPowers.wrap(textElt).editor.copy();
textElt.QueryInterface(Components.interfaces.nsIDOMNSEditableElement)
.editor.copy();
is(plugin.getClipboardText(), text);

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

@ -18,6 +18,7 @@
interface Attr;
interface Comment;
interface NodeIterator;
interface Range;
interface StyleSheetList;
interface Touch;
interface TouchList;
@ -203,9 +204,6 @@ partial interface Document {
void mozSetImageElement(DOMString aImageElementId,
Element? aImageElement);
[ChromeOnly]
readonly attribute URI? documentURIObject;
};
// http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#api

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

@ -1,93 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://www.whatwg.org/specs/web-apps/current-work/#the-textarea-element
* http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
* Opera Software ASA. You are granted a license to use, reproduce
* and create derivative works of this document.
*/
interface nsIEditor;
interface MozControllers;
interface HTMLTextAreaElement : HTMLElement {
// attribute DOMString autocomplete;
[SetterThrows, Pure]
attribute boolean autofocus;
[SetterThrows, Pure]
attribute unsigned long cols;
// attribute DOMString dirName;
[SetterThrows, Pure]
attribute boolean disabled;
[Pure]
readonly attribute HTMLFormElement? form;
// attribute DOMString inputMode;
[SetterThrows, Pure]
attribute long maxLength;
[SetterThrows, Pure]
attribute DOMString name;
[SetterThrows, Pure]
attribute DOMString placeholder;
[SetterThrows, Pure]
attribute boolean readOnly;
[SetterThrows, Pure]
attribute boolean required;
[SetterThrows, Pure]
attribute unsigned long rows;
[SetterThrows, Pure]
attribute DOMString wrap;
[Constant]
readonly attribute DOMString type;
[SetterThrows, Pure]
attribute DOMString defaultValue;
[TreatNullAs=EmptyString] attribute DOMString value;
readonly attribute unsigned long textLength;
readonly attribute boolean willValidate;
readonly attribute ValidityState validity;
readonly attribute DOMString validationMessage;
boolean checkValidity();
void setCustomValidity(DOMString error);
// readonly attribute NodeList labels;
void select();
[Throws]
attribute unsigned long selectionStart;
[Throws]
attribute unsigned long selectionEnd;
[Throws]
attribute DOMString selectionDirection;
// void setRangeText(DOMString replacement);
// void setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode);
[Throws]
void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction);
};
partial interface HTMLTextAreaElement {
// Mirrored chrome-only Mozilla extensions to nsIDOMHTMLTextAreaElement.
// Please make sure to update this list of nsIDOMHTMLTextAreaElement changes.
[Throws, ChromeOnly]
readonly attribute MozControllers controllers;
};
partial interface HTMLTextAreaElement {
// Mirrored chrome-only nsIDOMNSEditableElement methods. Please make sure
// to update this list if nsIDOMNSEditableElement changes.
[ChromeOnly]
readonly attribute nsIEditor? editor;
// This is similar to set .value on nsIDOMInput/TextAreaElements, but
// handling of the value change is closer to the normal user input, so
// 'change' event for example will be dispatched when focusing out the
// element.
[ChromeOnly]
void setUserInput(DOMString input);
};

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

@ -1,13 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-time-element
*/
interface HTMLTimeElement : HTMLElement {
[SetterThrows]
attribute DOMString dateTime;
};

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

@ -4,87 +4,49 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://dom.spec.whatwg.org/#range
* http://domparsing.spec.whatwg.org/#dom-range-createcontextualfragment
* http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-view/Overview.html#extensions-to-the-range-interface
* http://www.w3.org/TR/2012/WD-dom-20120105/
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
interface ClientRect;
interface Range {
[Throws]
readonly attribute Node startContainer;
[Throws]
readonly attribute unsigned long startOffset;
[Throws]
readonly attribute Node endContainer;
[Throws]
readonly attribute unsigned long endOffset;
readonly attribute boolean collapsed;
[Throws]
readonly attribute Node commonAncestorContainer;
[Throws]
void setStart(Node refNode, unsigned long offset);
[Throws]
void setEnd(Node refNode, unsigned long offset);
[Throws]
void setStartBefore(Node refNode);
[Throws]
void setStartAfter(Node refNode);
[Throws]
void setEndBefore(Node refNode);
[Throws]
void setEndAfter(Node refNode);
void collapse(boolean toStart);
[Throws]
void selectNode(Node refNode);
[Throws]
void selectNodeContents(Node refNode);
const unsigned short START_TO_START = 0;
const unsigned short START_TO_END = 1;
const unsigned short END_TO_END = 2;
const unsigned short END_TO_START = 3;
[Throws]
short compareBoundaryPoints(unsigned short how, Range sourceRange);
[Throws]
void deleteContents();
[Throws]
DocumentFragment extractContents();
[Throws]
DocumentFragment cloneContents();
[Throws]
void insertNode(Node node);
[Throws]
void surroundContents(Node newParent);
Range cloneRange();
void detach();
[Throws]
boolean isPointInRange(Node node, unsigned long offset);
[Throws]
short comparePoint(Node node, unsigned long offset);
[Throws]
boolean intersectsNode(Node node);
stringifier;
};
// http://domparsing.spec.whatwg.org/#dom-range-createcontextualfragment
partial interface Range {
[Throws]
DocumentFragment createContextualFragment(DOMString fragment);
};
// http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-view/Overview.html#extensions-to-the-range-interface
partial interface Range {
[Throws]
ClientRectList getClientRects();
ClientRect getBoundingClientRect();
};

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

@ -108,8 +108,6 @@ webidl_files = \
HTMLTableElement.webidl \
HTMLTableRowElement.webidl \
HTMLTableSectionElement.webidl \
HTMLTextAreaElement.webidl \
HTMLTimeElement.webidl \
HTMLTitleElement.webidl \
HTMLUListElement.webidl \
ImageData.webidl \
@ -128,7 +126,6 @@ webidl_files = \
PerformanceNavigation.webidl \
PerformanceTiming.webidl \
ProcessingInstruction.webidl \
Range.webidl \
Rect.webidl \
RGBColor.webidl \
RTCConfiguration.webidl \

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

@ -21,7 +21,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338427
/** Test for Bug 338427 **/
function init() {
var textarea = document.getElementById("editor");
var editor = textarea.editor;
var editor = textarea.QueryInterface(Components.interfaces.nsIDOMNSEditableElement).editor;
var spellchecker = editor.getInlineSpellChecker(true);
spellchecker.enableRealTimeSpell = true;

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

@ -314,13 +314,8 @@ NS_IMETHODIMP IMETextTxn::CollapseTextSelection(void)
if(NS_FAILED(result))
break;
nsCOMPtr<nsIContent> content = do_QueryInterface(mElement);
if (!content) {
break;
}
nsRefPtr<nsRange> newRange = new nsRange(content);
result = newRange->SetStart(content, mOffset+selectionStart);
nsRefPtr<nsRange> newRange = new nsRange();
result = newRange->SetStart(mElement,mOffset+selectionStart);
NS_ASSERTION(NS_SUCCEEDED(result), "Cannot SetStart");
if(NS_FAILED(result))
break;

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

@ -150,7 +150,6 @@ EDITOR_ATOM(textarea, "textarea")
EDITOR_ATOM(tfoot, "tfoot")
EDITOR_ATOM(thead, "thead")
EDITOR_ATOM(th, "th")
EDITOR_ATOM(time, "time")
EDITOR_ATOM(tr, "tr")
EDITOR_ATOM(tt, "tt")
EDITOR_ATOM(ul, "ul")

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

@ -248,26 +248,20 @@ nsHTMLEditRules::Init(nsPlaintextEditor *aEditor)
mReturnInEmptyLIKillsList = !returnInEmptyLIKillsList.EqualsLiteral("false");
// make a utility range for use by the listenter
nsCOMPtr<nsINode> node = mHTMLEditor->GetRoot();
if (!node) {
node = mHTMLEditor->GetDocument();
}
NS_ENSURE_STATE(node);
mUtilRange = new nsRange(node);
mUtilRange = new nsRange();
// set up mDocChangeRange to be whole doc
// temporarily turn off rules sniffing
nsAutoLockRulesSniffing lockIt((nsTextEditRules*)this);
if (!mDocChangeRange) {
mDocChangeRange = new nsRange(node);
}
if (node->IsElement()) {
ErrorResult rv;
mDocChangeRange->SelectNode(*node, rv);
res = AdjustSpecialBreaks(node);
nsCOMPtr<nsIDOMElement> rootElem = do_QueryInterface(mHTMLEditor->GetRoot());
if (rootElem)
{
// temporarily turn off rules sniffing
nsAutoLockRulesSniffing lockIt((nsTextEditRules*)this);
if (!mDocChangeRange)
{
mDocChangeRange = new nsRange();
}
mDocChangeRange->SelectNode(rootElem);
res = AdjustSpecialBreaks();
NS_ENSURE_SUCCESS(res, res);
}
@ -1447,9 +1441,7 @@ nsHTMLEditRules::WillInsertText(EditAction aAction,
// the correct portion of the document.
if (!mDocChangeRange)
{
nsCOMPtr<nsINode> node = do_QueryInterface(selNode);
NS_ENSURE_STATE(node);
mDocChangeRange = new nsRange(node);
mDocChangeRange = new nsRange();
}
res = mDocChangeRange->SetStart(selNode, selOffset);
NS_ENSURE_SUCCESS(res, res);
@ -5078,9 +5070,7 @@ nsHTMLEditRules::ExpandSelectionForDeletion(nsISelection *aSelection)
bool nodeBefore=false, nodeAfter=false;
// create a range that represents expanded selection
nsCOMPtr<nsINode> node = do_QueryInterface(selStartNode);
NS_ENSURE_STATE(node);
nsRefPtr<nsRange> range = new nsRange(node);
nsRefPtr<nsRange> range = new nsRange();
res = range->SetStart(selStartNode, selStartOffset);
NS_ENSURE_SUCCESS(res, res);
res = range->SetEnd(selEndNode, selEndOffset);
@ -6127,9 +6117,7 @@ nsHTMLEditRules::GetNodesFromPoint(DOMPoint point,
point.GetPoint(node, offset);
// use it to make a range
nsCOMPtr<nsINode> nativeNode = do_QueryInterface(node);
NS_ENSURE_STATE(nativeNode);
nsRefPtr<nsRange> range = new nsRange(nativeNode);
nsRefPtr<nsRange> range = new nsRange();
res = range->SetStart(node, offset);
NS_ENSURE_SUCCESS(res, res);
/* SetStart() will also set the end for this new range
@ -7309,9 +7297,7 @@ nsHTMLEditRules::PinSelectionToNewBlock(nsISelection *aSelection)
temp = selNode;
// use ranges and sRangeHelper to compare sel point to new block
nsCOMPtr<nsINode> node = do_QueryInterface(selNode);
NS_ENSURE_STATE(node);
nsRefPtr<nsRange> range = new nsRange(node);
nsRefPtr<nsRange> range = new nsRange();
res = range->SetStart(selNode, selOffset);
NS_ENSURE_SUCCESS(res, res);
res = range->SetEnd(selNode, selOffset);

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

@ -750,7 +750,6 @@ static const nsElementInfo kElements[eHTMLTag_userdefined] = {
ELEM(tfoot, true, false, GROUP_NONE, GROUP_TBODY_CONTENT),
ELEM(th, true, false, GROUP_TR_CONTENT, GROUP_FLOW_ELEMENT),
ELEM(thead, true, false, GROUP_NONE, GROUP_TBODY_CONTENT),
ELEM(time, true, false, GROUP_PHRASE, GROUP_INLINE_ELEMENT),
ELEM(title, true, false, GROUP_HEAD_CONTENT, GROUP_LEAF),
ELEM(tr, true, false, GROUP_TBODY_CONTENT, GROUP_TR_CONTENT),
ELEM(tt, true, true, GROUP_FONTSTYLE, GROUP_INLINE_ELEMENT),

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

@ -3254,7 +3254,7 @@ nsHTMLEditor::ContentInserted(nsIDocument *aDocument, nsIContent* aContainer,
// Update spellcheck for only the newly-inserted node (bug 743819)
if (mInlineSpellChecker) {
nsRefPtr<nsRange> range = new nsRange(aChild);
nsRefPtr<nsRange> range = new nsRange();
nsresult res = range->Set(aContainer, aIndexInContainer,
aContainer, aIndexInContainer + 1);
if (NS_SUCCEEDED(res)) {

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

@ -1484,10 +1484,8 @@ nsWSRunObject::DeleteChars(nsIDOMNode *aStartNode, int32_t aStartOffset,
{
if (!range)
{
nsCOMPtr<nsINode> startNode = do_QueryInterface(aStartNode);
NS_ENSURE_STATE(startNode);
range = new nsRange(startNode);
res = range->SetStart(startNode, aStartOffset);
range = new nsRange();
res = range->SetStart(aStartNode, aStartOffset);
NS_ENSURE_SUCCESS(res, res);
res = range->SetEnd(aEndNode, aEndOffset);
NS_ENSURE_SUCCESS(res, res);

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

@ -26,12 +26,10 @@ function command(aName)
{
var frame = document.getElementsByTagName('iframe')[0];
is(frame.contentDocument.designMode, "on", "design mode should be on!");
var caught = false;
try {
frame.contentDocument.execCommand(aName, false, null);
} catch (e) {
ok(false, "exception " + e + " was thrown");
caught = true;
}

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

@ -27,7 +27,9 @@ addLoadEvent(function() SimpleTest.executeSoon(runTest));
var gMisspeltWords;
function getEditor() {
return SpecialPowers.wrap(document.getElementById("edit")).editor;
return document.getElementById("edit")
.QueryInterface(Ci.nsIDOMNSEditableElement)
.editor;
}
function getSpellCheckSelection() {

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

@ -427,7 +427,7 @@ function runTests()
textarea.removeAttribute("readonly");
const nsIPlaintextEditor = Components.interfaces.nsIPlaintextEditor;
const nsIDOMNSEditableElement = Components.interfaces.nsIDOMNSEditableElement;
var editor = SpecialPowers.wrap(textarea).editor;
var editor = textarea.QueryInterface(nsIDOMNSEditableElement).editor;
var flags = editor.flags;
editor.flags = flags & ~(nsIPlaintextEditor.eEditorWidgetMask |
nsIPlaintextEditor.eEditorAllowInteraction);

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

@ -57,14 +57,13 @@ NS_IMPL_CYCLE_COLLECTION_5(nsFilteredContentIterator,
nsresult
nsFilteredContentIterator::Init(nsINode* aRoot)
{
NS_ENSURE_ARG_POINTER(aRoot);
NS_ENSURE_TRUE(mPreIterator, NS_ERROR_FAILURE);
NS_ENSURE_TRUE(mIterator, NS_ERROR_FAILURE);
mIsOutOfRange = false;
mDirection = eForward;
mCurrentIterator = mPreIterator;
mRange = new nsRange(aRoot);
mRange = new nsRange();
nsCOMPtr<nsIDOMNode> domNode(do_QueryInterface(aRoot));
if (domNode) {
mRange->SelectNode(domNode);

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

@ -2070,10 +2070,7 @@ nsTextServicesDocument::CreateDocumentContentRange(nsIDOMRange **aRange)
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(node, NS_ERROR_NULL_POINTER);
nsCOMPtr<nsINode> nativeNode = do_QueryInterface(node);
NS_ENSURE_STATE(nativeNode);
nsRefPtr<nsRange> range = new nsRange(nativeNode);
nsRefPtr<nsRange> range = new nsRange();
rv = range->SelectNodeContents(node);
NS_ENSURE_SUCCESS(rv, rv);

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

@ -147,8 +147,6 @@ nsresult
nsFindContentIterator::Init(nsIDOMNode* aStartNode, int32_t aStartOffset,
nsIDOMNode* aEndNode, int32_t aEndOffset)
{
NS_ENSURE_ARG_POINTER(aStartNode);
NS_ENSURE_ARG_POINTER(aEndNode);
if (!mOuterIterator) {
if (mFindBackward) {
// Use post-order in the reverse case, so we get parents
@ -276,10 +274,7 @@ nsFindContentIterator::Reset()
// Note: OK to just set up the outer iterator here; if our range has a native
// anonymous endpoint we'll end up setting up an inner iterator, and
// reset the outer one in the process.
nsCOMPtr<nsINode> node = do_QueryInterface(mStartNode);
NS_ENSURE_TRUE_VOID(node);
nsCOMPtr<nsIDOMRange> range = nsFind::CreateRange(node);
nsCOMPtr<nsIDOMRange> range = nsFind::CreateRange();
range->SetStart(mStartNode, mStartOffset);
range->SetEnd(mEndNode, mEndOffset);
mOuterIterator->Init(range);
@ -371,9 +366,10 @@ nsFindContentIterator::SetupInnerIterator(nsIContent* aContent)
nsCOMPtr<nsIDOMElement> rootElement;
editor->GetRootElement(getter_AddRefs(rootElement));
nsCOMPtr<nsIContent> rootContent(do_QueryInterface(rootElement));
nsCOMPtr<nsIDOMRange> innerRange = nsFind::CreateRange(aContent);
nsCOMPtr<nsIDOMRange> outerRange = nsFind::CreateRange(aContent);
nsCOMPtr<nsIDOMRange> innerRange = nsFind::CreateRange();
nsCOMPtr<nsIDOMRange> outerRange = nsFind::CreateRange();
if (!innerRange || !outerRange) {
return;
}
@ -1145,7 +1141,7 @@ nsFind::Find(const PRUnichar *aPatText, nsIDOMRange* aSearchRange,
// Make the range:
nsCOMPtr<nsIDOMNode> startParent;
nsCOMPtr<nsIDOMNode> endParent;
nsCOMPtr<nsIDOMRange> range = CreateRange(tc);
nsCOMPtr<nsIDOMRange> range = CreateRange();
if (range)
{
int32_t matchStartOffset, matchEndOffset;
@ -1259,9 +1255,9 @@ nsFind::Find(const PRUnichar *aPatText, nsIDOMRange* aSearchRange,
/* static */
already_AddRefed<nsIDOMRange>
nsFind::CreateRange(nsINode* aNode)
nsFind::CreateRange()
{
nsRefPtr<nsRange> range = new nsRange(aNode);
nsRefPtr<nsRange> range = new nsRange();
range->SetMaySpanAnonymousSubtrees(true);
return range.forget();
}

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

@ -35,7 +35,7 @@ public:
nsFind();
virtual ~nsFind();
static already_AddRefed<nsIDOMRange> CreateRange(nsINode* aNode);
static already_AddRefed<nsIDOMRange> CreateRange();
protected:
// Parameters set from the interface:

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

@ -727,11 +727,11 @@ nsresult nsWebBrowserFind::SearchInFrame(nsIDOMWindow* aWindow,
GetFrameSelection(aWindow, getter_AddRefs(sel));
NS_ENSURE_ARG_POINTER(sel);
nsCOMPtr<nsIDOMRange> searchRange = nsFind::CreateRange(theDoc);
nsCOMPtr<nsIDOMRange> searchRange = nsFind::CreateRange();
NS_ENSURE_ARG_POINTER(searchRange);
nsCOMPtr<nsIDOMRange> startPt = nsFind::CreateRange(theDoc);
nsCOMPtr<nsIDOMRange> startPt = nsFind::CreateRange();
NS_ENSURE_ARG_POINTER(startPt);
nsCOMPtr<nsIDOMRange> endPt = nsFind::CreateRange(theDoc);
nsCOMPtr<nsIDOMRange> endPt = nsFind::CreateRange();
NS_ENSURE_ARG_POINTER(endPt);
nsCOMPtr<nsIDOMRange> foundRange;

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

@ -132,10 +132,7 @@ mozInlineSpellStatus::InitForEditorChange(
mOp = eOpChange;
// range to check
nsCOMPtr<nsINode> prevNode = do_QueryInterface(aPreviousNode);
NS_ENSURE_STATE(prevNode);
mRange = new nsRange(prevNode);
mRange = new nsRange();
// ...we need to put the start and end in the correct order
int16_t cmpResult;

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

@ -317,11 +317,10 @@ nsresult
mozInlineSpellWordUtil::MakeRange(NodeOffset aBegin, NodeOffset aEnd,
nsRange** aRange)
{
NS_ENSURE_ARG_POINTER(aBegin.mNode);
if (!mDOMDocument)
return NS_ERROR_NOT_INITIALIZED;
nsRefPtr<nsRange> range = new nsRange(aBegin.mNode);
nsRefPtr<nsRange> range = new nsRange();
nsresult rv = range->Set(aBegin.mNode, aBegin.mOffset,
aEnd.mNode, aEnd.mOffset);
NS_ENSURE_SUCCESS(rv, rv);

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

@ -948,14 +948,7 @@ nsPresContext::Init(nsDeviceContext* aDeviceContext)
nsCOMPtr<nsIDocShellTreeItem> parentItem;
ourItem->GetSameTypeParent(getter_AddRefs(parentItem));
if (parentItem) {
Element* containingElement =
parent->FindContentForSubDocument(mDocument);
if (!containingElement->IsXUL() ||
!containingElement->
HasAttr(kNameSpaceID_None,
nsGkAtoms::forceOwnRefreshDriver)) {
mRefreshDriver = parent->GetShell()->GetPresContext()->RefreshDriver();
}
mRefreshDriver = parent->GetShell()->GetPresContext()->RefreshDriver();
}
}
}

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

@ -2903,7 +2903,7 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll)
// Even if select anchor pref is false, we must still move the
// caret there. That way tabbing will start from the new
// location
nsRefPtr<nsIDOMRange> jumpToRange = new nsRange(mDocument);
nsRefPtr<nsIDOMRange> jumpToRange = new nsRange();
while (content && content->GetFirstChild()) {
content = content->GetFirstChild();
}
@ -4804,7 +4804,7 @@ PresShell::RenderNode(nsIDOMNode* aNode,
if (!node->IsInDoc())
return nullptr;
nsRefPtr<nsRange> range = new nsRange(node);
nsRefPtr<nsRange> range = new nsRange();
if (NS_FAILED(range->SelectNode(aNode)))
return nullptr;

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

@ -778,7 +778,7 @@ nsTextControlFrame::SetSelectionInternal(nsIDOMNode *aStartNode,
// Note that we use a new range to avoid having to do
// isIncreasing checks to avoid possible errors.
nsRefPtr<nsRange> range = new nsRange(mContent);
nsRefPtr<nsRange> range = new nsRange();
nsresult rv = range->SetStart(aStartNode, aStartOffset);
NS_ENSURE_SUCCESS(rv, rv);

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

@ -30,7 +30,7 @@ addLoadEvent(function() {
var content = document.getElementById('content');
var i = document.getElementById('i');
var t = SpecialPowers.wrap(document.getElementById('t'));
var t = document.getElementById('t');
i.value = ""; i.placeholder = "foo";
t.value = ""; t.placeholder = "foo";

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

@ -1469,7 +1469,7 @@ nsFrameSelection::TakeFocus(nsIContent *aNewFocus,
// non-anchor/focus collapsed ranges.
mDomSelections[index]->RemoveCollapsedRanges();
nsRefPtr<nsRange> newRange = new nsRange(aNewFocus);
nsRefPtr<nsRange> newRange = new nsRange();
newRange->SetStart(aNewFocus, aContentOffset);
newRange->SetEnd(aNewFocus, aContentOffset);
@ -2869,7 +2869,7 @@ nsFrameSelection::CreateAndAddRange(nsINode *aParentNode, int32_t aOffset)
{
if (!aParentNode) return NS_ERROR_NULL_POINTER;
nsRefPtr<nsRange> range = new nsRange(aParentNode);
nsRefPtr<nsRange> range = new nsRange();
// Set range around child at given offset
nsresult result = range->SetStart(aParentNode, aOffset);
@ -3279,7 +3279,7 @@ Selection::SubtractRange(RangeData* aRange, nsRange* aSubtract,
if (cmp2 > 0) {
// We need to add a new RangeData to the output, running from
// the end of aSubtract to the end of range
nsRefPtr<nsRange> postOverlap = new nsRange(aSubtract->GetEndParent());
nsRefPtr<nsRange> postOverlap = new nsRange();
rv =
postOverlap->SetStart(aSubtract->GetEndParent(), aSubtract->EndOffset());
@ -3297,7 +3297,7 @@ Selection::SubtractRange(RangeData* aRange, nsRange* aSubtract,
if (cmp < 0) {
// We need to add a new RangeData to the output, running from
// the start of the range to the start of aSubtract
nsRefPtr<nsRange> preOverlap = new nsRange(range->GetStartParent());
nsRefPtr<nsRange> preOverlap = new nsRange();
nsresult rv =
preOverlap->SetStart(range->GetStartParent(), range->StartOffset());
@ -4409,7 +4409,7 @@ Selection::Collapse(nsINode* aParentNode, int32_t aOffset)
// Turn off signal for table selection
mFrameSelection->ClearTableCellSelection();
nsRefPtr<nsRange> range = new nsRange(aParentNode);
nsRefPtr<nsRange> range = new nsRange();
result = range->SetEnd(aParentNode, aOffset);
if (NS_FAILED(result))
return result;
@ -4665,7 +4665,7 @@ Selection::Extend(nsINode* aParentNode, int32_t aOffset)
&disconnected);
nsRefPtr<nsPresContext> presContext = GetPresContext();
nsRefPtr<nsRange> difRange = new nsRange(aParentNode);
nsRefPtr<nsRange> difRange = new nsRange();
if ((result1 == 0 && result3 < 0) || (result1 <= 0 && result2 < 0)){//a1,2 a,1,2
//select from 1 to 2 unless they are collapsed
res = range->SetEnd(aParentNode, aOffset);

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

@ -75,7 +75,7 @@ var fixedDiv1 = document.getElementById("fixedDiv1");
var fixedDiv2 = document.getElementById("fixedDiv2");
var iframe = document.getElementById("iframe");
var input = document.getElementById("input");
var textarea = SpecialPowers.wrap(document.getElementById("textarea"));
var textarea = document.getElementById("textarea");
function test()
{
@ -409,4 +409,4 @@ SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>
</html>

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

@ -2441,11 +2441,8 @@ CloneRangeToSelection(nsRange* aRange, nsIDocument* aDoc,
nsCOMPtr<nsIDOMNode> newEnd = GetEqualNodeInCloneTree(endContainer, aDoc);
NS_ENSURE_TRUE_VOID(newStart && newEnd);
nsCOMPtr<nsINode> newStartNode = do_QueryInterface(newStart);
NS_ENSURE_TRUE_VOID(newStartNode);
nsRefPtr<nsRange> range = new nsRange(newStartNode);
nsresult rv = range->SetStart(newStartNode, startOffset);
nsRefPtr<nsRange> range = new nsRange();
nsresult rv = range->SetStart(newStart, startOffset);
NS_ENSURE_SUCCESS_VOID(rv);
rv = range->SetEnd(newEnd, endOffset);
NS_ENSURE_SUCCESS_VOID(rv);

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

@ -153,7 +153,6 @@ HTML_TAG(textarea, TextArea)
HTML_TAG(tfoot, TableSection)
HTML_TAG(th, TableCell)
HTML_TAG(thead, TableSection)
HTML_TAG(time, Time)
HTML_TAG(title, Title)
HTML_TAG(tr, TableRow)
HTML_HTMLELEMENT_TAG(tt)

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

@ -1201,15 +1201,6 @@ const nsHTMLElement gHTMLElements[] = {
/*special props, prop-range*/ (kNoPropagate|kBadContentWatch|kNoStyleLeaksIn|kNoStyleLeaksOut), kNoPropRange,
/*special parents,kids*/ &gInTable,&gTableElemKids,
},
{
/*tag*/ eHTMLTag_time,
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
/*parent,incl,exclgroups*/ kPhrase, (kSelf|kInlineEntity), kNone,
/*special props, prop-range*/ 0, kDefaultPropRange,
/*special parents,kids*/ 0,0,
},
{
/*tag*/ eHTMLTag_title,
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,

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

@ -255,8 +255,6 @@ static const PRUnichar sHTMLTagUnicodeName_th[] =
{'t', 'h', '\0'};
static const PRUnichar sHTMLTagUnicodeName_thead[] =
{'t', 'h', 'e', 'a', 'd', '\0'};
static const PRUnichar sHTMLTagUnicodeName_time[] =
{'t', 'i', 'm', 'e', '\0'};
static const PRUnichar sHTMLTagUnicodeName_title[] =
{'t', 'i', 't', 'l', 'e', '\0'};
static const PRUnichar sHTMLTagUnicodeName_tr[] =

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

@ -94,12 +94,9 @@ nsresult
nsTypeAheadFind::Init(nsIDocShell* aDocShell)
{
nsCOMPtr<nsIPrefBranch> prefInternal(do_GetService(NS_PREFSERVICE_CONTRACTID));
nsIPresShell* presShell = aDocShell->GetPresShell();
NS_ENSURE_STATE(presShell);
mSearchRange = nullptr;
mStartPointRange = nullptr;
mEndPointRange = nullptr;
mSearchRange = new nsRange();
mStartPointRange = new nsRange();
mEndPointRange = new nsRange();
if (!prefInternal || !EnsureFind())
return NS_ERROR_FAILURE;
@ -169,12 +166,12 @@ nsTypeAheadFind::SetDocShell(nsIDocShell* aDocShell)
nsCOMPtr<nsIPresShell> presShell;
presShell = aDocShell->GetPresShell();
mPresShell = do_GetWeakReference(presShell);
mPresShell = do_GetWeakReference(presShell);
mStartFindRange = nullptr;
mStartPointRange = nullptr;
mSearchRange = nullptr;
mEndPointRange = nullptr;
mStartPointRange = new nsRange();
mSearchRange = new nsRange();
mEndPointRange = new nsRange();
mFoundLink = nullptr;
mFoundEditable = nullptr;
@ -364,10 +361,6 @@ nsTypeAheadFind::FindItNow(nsIPresShell *aPresShell, bool aIsLinksOnly,
}
int16_t rangeCompareResult = 0;
if (!mStartPointRange) {
mStartPointRange = new nsRange(presShell->GetDocument());
}
mStartPointRange->CompareBoundaryPoints(nsIDOMRange::START_TO_START, mSearchRange, &rangeCompareResult);
// No need to wrap find in doc if starting at beginning
bool hasWrapped = (rangeCompareResult < 0);
@ -628,10 +621,6 @@ nsTypeAheadFind::FindItNow(nsIPresShell *aPresShell, bool aIsLinksOnly,
// at end of document and go to beginning
nsCOMPtr<nsIDOMRange> tempRange;
mStartPointRange->CloneRange(getter_AddRefs(tempRange));
if (!mEndPointRange) {
mEndPointRange = new nsRange(presShell->GetDocument());
}
mStartPointRange = mEndPointRange;
mEndPointRange = tempRange;
}
@ -730,14 +719,6 @@ nsTypeAheadFind::GetSearchContainers(nsISupports *aContainer,
uint32_t childCount = rootContent->GetChildCount();
if (!mSearchRange) {
mSearchRange = new nsRange(rootContent);
}
if (!mEndPointRange) {
mEndPointRange = new nsRange(rootContent);
}
mSearchRange->SelectNodeContents(rootNode);
mEndPointRange->SetEnd(rootNode, childCount);
@ -755,10 +736,6 @@ nsTypeAheadFind::GetSearchContainers(nsISupports *aContainer,
selection->GetRangeAt(0, getter_AddRefs(currentSelectionRange));
}
if (!mStartPointRange) {
mStartPointRange = new nsRange(doc);
}
if (!currentSelectionRange) {
// Ensure visible range, move forward if necessary
// This uses ignores the return value, but usese the side effect of