Merge last green changeset on mozilla-central to mozilla-inbound

This commit is contained in:
Ed Morley 2011-09-19 12:27:35 +01:00
commit 848e923aa5
91 changed files with 659 additions and 503 deletions

View File

@ -72,7 +72,4 @@ LOCAL_INCLUDES = \
-I$(srcdir) \
-I$(srcdir)/../base \
-I$(srcdir)/../html \
-I$(srcdir)/../../../layout/html/base/src \
-I$(srcdir)/../../../layout/html/forms/src \
-I$(srcdir)/../../../layout/html/forms/public \
$(NULL)

View File

@ -320,12 +320,12 @@ static JSFunctionSpec PrivilegeManager_static_methods[] = {
/*
* "Steal" calls to netscape.security.PrivilegeManager.enablePrivilege,
* et. al. so that code that worked with 4.0 can still work.
* et al. so that code that worked with 4.0 can still work.
*/
NS_IMETHODIMP
nsSecurityNameSet::InitializeNameSet(nsIScriptContext* aScriptContext)
{
JSContext *cx = (JSContext *) aScriptContext->GetNativeContext();
JSContext* cx = aScriptContext->GetNativeContext();
JSObject *global = JS_GetGlobalObject(cx);
OBJ_TO_INNER_OBJECT(cx, global);

View File

@ -121,10 +121,6 @@
#define NS_XBLSERVICE_CID \
{ 0x64f300a1, 0xc88c, 0x11d3, { 0x97, 0xfb, 0x0, 0x40, 0x5, 0x53, 0xee, 0xf0 } }
// 3a9cd622-264d-11d4-ba06-0060b0fc76dd
#define NS_DOM_IMPLEMENTATION_CID \
{ 0x3a9cd622, 0x264d, 0x11d4, {0xba, 0x06, 0x00, 0x60, 0xb0, 0xfc, 0x76, 0xdd } }
// {4aef38b7-6364-4e23-a5e7-12f837fbbd9c}
#define NS_XMLCONTENTSERIALIZER_CID \
{ 0x4aef38b7, 0x6364, 0x4e23, { 0xa5, 0xe7, 0x12, 0xf8, 0x37, 0xfb, 0xbd, 0x9c } }

View File

@ -1884,7 +1884,8 @@ NS_NewDOMDocument(nsIDOMDocument** aInstancePtrResult,
nsIURI* aDocumentURI,
nsIURI* aBaseURI,
nsIPrincipal* aPrincipal,
PRBool aLoadedAsData);
PRBool aLoadedAsData,
nsIScriptGlobalObject* aEventObject);
nsresult
NS_NewPluginDocument(nsIDocument** aInstancePtrResult);

View File

@ -1,69 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsIPrivateDOMImplementation_h__
#define nsIPrivateDOMImplementation_h__
#include "nsISupports.h"
class nsIURI;
class nsIPrincipal;
/*
* Event listener manager interface.
*/
#define NS_IPRIVATEDOMIMPLEMENTATION_IID \
{ /* 87c20441-8b0d-4383-a189-52fef1dd5d8a */ \
0x87c20441, 0x8b0d, 0x4383, \
{ 0xa1, 0x89, 0x52, 0xfe, 0xf1, 0xdd, 0x5d, 0x8a } }
class nsIPrivateDOMImplementation : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPRIVATEDOMIMPLEMENTATION_IID)
NS_IMETHOD Init(nsIURI* aDocumentURI, nsIURI* aBaseURI,
nsIPrincipal* aPrincipal) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIPrivateDOMImplementation,
NS_IPRIVATEDOMIMPLEMENTATION_IID)
nsresult
NS_NewDOMImplementation(nsIDOMDOMImplementation** aInstancePtrResult);
#endif // nsIPrivateDOMImplementation_h__

View File

@ -1,7 +1,6 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: set ts=2 sw=2 et tw=78:
*
* ***** BEGIN LICENSE BLOCK *****
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 sw=2 et tw=78: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
@ -1286,11 +1285,10 @@ nsContentUtils::GetContextFromDocument(nsIDocument *aDocument)
nsIScriptContext *scx = sgo->GetContext();
if (!scx) {
// No context left in the scope...
return nsnull;
}
return (JSContext *)scx->GetNativeContext();
return scx->GetNativeContext();
}
// static
@ -2559,7 +2557,7 @@ nsCxPusher::Push(nsIDOMEventTarget *aCurrentTarget)
JSContext* cx = nsnull;
if (scx) {
cx = static_cast<JSContext*>(scx->GetNativeContext());
cx = scx->GetNativeContext();
// Bad, no JSContext from script context!
NS_ENSURE_TRUE(cx, PR_FALSE);
}
@ -3688,11 +3686,10 @@ nsContentUtils::CreateDocument(const nsAString& aNamespaceURI,
{
nsresult rv = NS_NewDOMDocument(aResult, aNamespaceURI, aQualifiedName,
aDoctype, aDocumentURI, aBaseURI, aPrincipal,
PR_TRUE);
PR_TRUE, aEventObject);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocument> document = do_QueryInterface(*aResult);
document->SetScriptHandlingObject(aEventObject);
// created documents are immediately "complete" (ready to use)
document->SetReadyStateInternal(nsIDocument::READYSTATE_COMPLETE);

View File

@ -55,34 +55,19 @@
nsresult
NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
nsNodeInfoManager *aNodeInfoManager,
nsIPrincipal *aPrincipal,
nsIAtom *aName,
const nsAString& aPublicId,
const nsAString& aSystemId,
const nsAString& aInternalSubset)
{
NS_PRECONDITION(aNodeInfoManager || aPrincipal,
"Must have a principal if no nodeinfo manager.");
NS_ENSURE_ARG_POINTER(aDocType);
NS_ENSURE_ARG_POINTER(aName);
nsRefPtr<nsNodeInfoManager> nimgr;
if (aNodeInfoManager) {
nimgr = aNodeInfoManager;
}
else {
nimgr = new nsNodeInfoManager();
nsresult rv = nimgr->Init(nsnull);
NS_ENSURE_SUCCESS(rv, rv);
nimgr->SetDocumentPrincipal(aPrincipal);
}
nsCOMPtr<nsINodeInfo> ni =
nimgr->GetNodeInfo(nsGkAtoms::documentTypeNodeName, nsnull,
kNameSpaceID_None,
nsIDOMNode::DOCUMENT_TYPE_NODE,
aName);
aNodeInfoManager->GetNodeInfo(nsGkAtoms::documentTypeNodeName, nsnull,
kNameSpaceID_None,
nsIDOMNode::DOCUMENT_TYPE_NODE,
aName);
NS_ENSURE_TRUE(ni, NS_ERROR_OUT_OF_MEMORY);
*aDocType = new nsDOMDocumentType(ni.forget(), aPublicId, aSystemId,
@ -176,59 +161,3 @@ nsDOMDocumentType::CloneDataNode(nsINodeInfo *aNodeInfo, PRBool aCloneText) cons
mInternalSubset);
}
nsresult
nsDOMDocumentType::BindToTree(nsIDocument *aDocument, nsIContent *aParent,
nsIContent *aBindingParent,
PRBool aCompileEventHandlers)
{
if (!HasSameOwnerDoc(NODE_FROM(aParent, aDocument))) {
NS_ASSERTION(!GetOwnerDoc(), "Need to adopt or import first!");
// DocumentType nodes are the only nodes that can have a null ownerDocument
// according to the DOM spec, so we need to give them a new nodeinfo in that
// case.
// XXX We may want to move this to nsDOMImplementation::CreateDocument if
// we want to rely on the nodeinfo and wrappers being right before
// getting into ReplaceOrInsertBefore or doInsertChildAt. That would
// break inserting DOMDocumentType nodes through other DOM methods
// though.
nsNodeInfoManager *nimgr = aParent ?
aParent->NodeInfo()->NodeInfoManager() :
aDocument->NodeInfoManager();
nsCOMPtr<nsINodeInfo> newNodeInfo;
newNodeInfo = nimgr->GetNodeInfo(mNodeInfo->NameAtom(),
mNodeInfo->GetPrefixAtom(),
mNodeInfo->NamespaceID(),
nsIDOMNode::DOCUMENT_TYPE_NODE,
mNodeInfo->GetExtraName());
NS_ENSURE_TRUE(newNodeInfo, NS_ERROR_OUT_OF_MEMORY);
mNodeInfo.swap(newNodeInfo);
JSObject *oldScope = GetWrapper();
if (oldScope) {
nsIXPConnect *xpc = nsContentUtils::XPConnect();
JSContext *cx = nsnull;
JSObject *newScope = nsnull;
nsresult rv = nsContentUtils::GetContextAndScope(nsnull,
nimgr->GetDocument(),
&cx, &newScope);
if (cx && xpc) {
nsISupports *node = NS_ISUPPORTS_CAST(nsIContent*, this);
nsCOMPtr<nsIXPConnectJSObjectHolder> oldWrapper;
rv = xpc->ReparentWrappedNativeIfFound(cx, oldScope, newScope, node,
getter_AddRefs(oldWrapper));
}
if (NS_FAILED(rv)) {
mNodeInfo.swap(newNodeInfo);
return rv;
}
}
}
return nsGenericDOMDataNode::BindToTree(aDocument, aParent, aBindingParent,
aCompileEventHandlers);
}

View File

@ -101,9 +101,6 @@ public:
// nsIContent overrides
virtual const nsTextFragment* GetText();
virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
nsIContent *aBindingParent,
PRBool aCompileEventHandlers);
virtual nsGenericDOMDataNode* CloneDataNode(nsINodeInfo *aNodeInfo,
PRBool aCloneText) const;
@ -117,8 +114,7 @@ protected:
nsresult
NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
nsNodeInfoManager *aOwnerDoc,
nsIPrincipal *aPrincipal,
nsNodeInfoManager* aNodeInfoManager,
nsIAtom *aName,
const nsAString& aPublicId,
const nsAString& aSystemId,

View File

@ -1321,46 +1321,33 @@ nsDOMStyleSheetSetList::GetSets(nsTArray<nsString>& aStyleSets)
class nsDOMImplementation : public nsIDOMDOMImplementation
{
public:
nsDOMImplementation(nsIScriptGlobalObject* aScriptObject,
nsDOMImplementation(nsIDocument* aOwner,
nsIScriptGlobalObject* aScriptObject,
nsIURI* aDocumentURI,
nsIURI* aBaseURI,
nsIPrincipal* aPrincipal);
nsIURI* aBaseURI);
virtual ~nsDOMImplementation();
NS_DECL_ISUPPORTS
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(nsDOMImplementation)
// nsIDOMDOMImplementation
NS_DECL_NSIDOMDOMIMPLEMENTATION
protected:
nsCOMPtr<nsIDocument> mOwner;
nsWeakPtr mScriptObject;
nsCOMPtr<nsIURI> mDocumentURI;
nsCOMPtr<nsIURI> mBaseURI;
nsCOMPtr<nsIPrincipal> mPrincipal;
};
nsresult
NS_NewDOMImplementation(nsIDOMDOMImplementation** aInstancePtrResult)
{
*aInstancePtrResult = new nsDOMImplementation(nsnull, nsnull, nsnull, nsnull);
if (!*aInstancePtrResult) {
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(*aInstancePtrResult);
return NS_OK;
}
nsDOMImplementation::nsDOMImplementation(nsIScriptGlobalObject* aScriptObject,
nsDOMImplementation::nsDOMImplementation(nsIDocument* aOwner,
nsIScriptGlobalObject* aScriptObject,
nsIURI* aDocumentURI,
nsIURI* aBaseURI,
nsIPrincipal* aPrincipal)
: mScriptObject(do_GetWeakReference(aScriptObject)),
nsIURI* aBaseURI)
: mOwner(aOwner),
mScriptObject(do_GetWeakReference(aScriptObject)),
mDocumentURI(aDocumentURI),
mBaseURI(aBaseURI),
mPrincipal(aPrincipal)
mBaseURI(aBaseURI)
{
}
@ -1371,15 +1358,16 @@ nsDOMImplementation::~nsDOMImplementation()
DOMCI_DATA(DOMImplementation, nsDOMImplementation)
// QueryInterface implementation for nsDOMImplementation
NS_INTERFACE_MAP_BEGIN(nsDOMImplementation)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMImplementation)
NS_INTERFACE_MAP_ENTRY(nsIDOMDOMImplementation)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMDOMImplementation)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DOMImplementation)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_1(nsDOMImplementation, mOwner)
NS_IMPL_ADDREF(nsDOMImplementation)
NS_IMPL_RELEASE(nsDOMImplementation)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMImplementation)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMImplementation)
NS_IMETHODIMP
@ -1399,6 +1387,7 @@ nsDOMImplementation::CreateDocumentType(const nsAString& aQualifiedName,
nsIDOMDocumentType** aReturn)
{
*aReturn = nsnull;
NS_ENSURE_STATE(mOwner);
nsresult rv = nsContentUtils::CheckQName(aQualifiedName);
NS_ENSURE_SUCCESS(rv, rv);
@ -1409,7 +1398,8 @@ nsDOMImplementation::CreateDocumentType(const nsAString& aQualifiedName,
// Indicate that there is no internal subset (not just an empty one)
nsAutoString voidString;
voidString.SetIsVoid(PR_TRUE);
return NS_NewDOMDocumentType(aReturn, nsnull, mPrincipal, name, aPublicId,
return NS_NewDOMDocumentType(aReturn, mOwner->NodeInfoManager(),
name, aPublicId,
aSystemId, voidString);
}
@ -1443,21 +1433,14 @@ nsDOMImplementation::CreateDocument(const nsAString& aNamespaceURI,
return NS_ERROR_DOM_NAMESPACE_ERR;
}
if (aDoctype) {
nsCOMPtr<nsIDOMDocument> owner;
aDoctype->GetOwnerDocument(getter_AddRefs(owner));
if (owner) {
return NS_ERROR_DOM_WRONG_DOCUMENT_ERR;
}
}
nsCOMPtr<nsIScriptGlobalObject> scriptHandlingObject =
do_QueryReferent(mScriptObject);
NS_ENSURE_STATE(!mScriptObject || scriptHandlingObject);
return nsContentUtils::CreateDocument(aNamespaceURI, aQualifiedName, aDoctype,
mDocumentURI, mBaseURI, mPrincipal,
mDocumentURI, mBaseURI,
mOwner->NodePrincipal(),
scriptHandlingObject, aReturn);
}
@ -1465,15 +1448,15 @@ NS_IMETHODIMP
nsDOMImplementation::CreateHTMLDocument(const nsAString& aTitle,
nsIDOMDocument** aReturn)
{
*aReturn = NULL;
*aReturn = nsnull;
NS_ENSURE_STATE(mOwner);
nsCOMPtr<nsIDOMDocumentType> doctype;
// Indicate that there is no internal subset (not just an empty one)
nsAutoString voidString;
voidString.SetIsVoid(true);
nsresult rv = NS_NewDOMDocumentType(getter_AddRefs(doctype),
NULL, // aNodeInfoManager
mPrincipal, // aPrincipal
mOwner->NodeInfoManager(),
nsGkAtoms::html, // aName
EmptyString(), // aPublicId
EmptyString(), // aSystemId
@ -1489,7 +1472,8 @@ nsDOMImplementation::CreateHTMLDocument(const nsAString& aTitle,
nsCOMPtr<nsIDOMDocument> document;
rv = nsContentUtils::CreateDocument(EmptyString(), EmptyString(),
doctype, mDocumentURI, mBaseURI,
mPrincipal, scriptHandlingObject,
mOwner->NodePrincipal(),
scriptHandlingObject,
getter_AddRefs(document));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocument> doc = do_QueryInterface(document);
@ -3813,7 +3797,7 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
if (obj) {
JSObject *newScope = aScriptGlobalObject->GetGlobalJSObject();
nsIScriptContext *scx = aScriptGlobalObject->GetContext();
JSContext *cx = scx ? (JSContext *)scx->GetNativeContext() : nsnull;
JSContext *cx = scx ? scx->GetNativeContext() : nsnull;
if (!cx) {
nsContentUtils::ThreadJSContextStack()->Peek(&cx);
if (!cx) {
@ -4315,8 +4299,7 @@ nsDocument::GetImplementation(nsIDOMDOMImplementation** aImplementation)
nsIScriptGlobalObject* scriptObject =
GetScriptHandlingObject(hasHadScriptObject);
NS_ENSURE_STATE(scriptObject || !hasHadScriptObject);
mDOMImplementation = new nsDOMImplementation(scriptObject, uri, uri,
NodePrincipal());
mDOMImplementation = new nsDOMImplementation(this, scriptObject, uri, uri);
if (!mDOMImplementation) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -4806,6 +4789,7 @@ nsDocument::ImportNode(nsIDOMNode* aImportedNode,
case nsIDOMNode::TEXT_NODE:
case nsIDOMNode::CDATA_SECTION_NODE:
case nsIDOMNode::COMMENT_NODE:
case nsIDOMNode::DOCUMENT_TYPE_NODE:
{
nsCOMPtr<nsINode> imported = do_QueryInterface(aImportedNode);
NS_ENSURE_TRUE(imported, NS_ERROR_FAILURE);
@ -6119,6 +6103,7 @@ nsDocument::AdoptNode(nsIDOMNode *aAdoptedNode, nsIDOMNode **aResult)
case nsIDOMNode::TEXT_NODE:
case nsIDOMNode::CDATA_SECTION_NODE:
case nsIDOMNode::COMMENT_NODE:
case nsIDOMNode::DOCUMENT_TYPE_NODE:
{
// We don't want to adopt an element into its own contentDocument or into
// a descendant contentDocument, so we check if the frameElement of this
@ -6151,7 +6136,6 @@ nsDocument::AdoptNode(nsIDOMNode *aAdoptedNode, nsIDOMNode **aResult)
return NS_ERROR_NOT_IMPLEMENTED;
}
case nsIDOMNode::DOCUMENT_NODE:
case nsIDOMNode::DOCUMENT_TYPE_NODE:
case nsIDOMNode::ENTITY_NODE:
case nsIDOMNode::NOTATION_NODE:
{
@ -6423,7 +6407,7 @@ nsDocument::IsScriptEnabled()
nsIScriptContext *scriptContext = globalObject->GetContext();
NS_ENSURE_TRUE(scriptContext, PR_FALSE);
JSContext* cx = (JSContext *) scriptContext->GetNativeContext();
JSContext* cx = scriptContext->GetNativeContext();
NS_ENSURE_TRUE(cx, PR_FALSE);
PRBool enabled;

View File

@ -1350,7 +1350,7 @@ nsEventSource::DispatchAllMessageEvents()
nsIScriptContext* scriptContext = sgo->GetContext();
NS_ENSURE_TRUE(scriptContext,);
JSContext* cx = (JSContext*)scriptContext->GetNativeContext();
JSContext* cx = scriptContext->GetNativeContext();
NS_ENSURE_TRUE(cx,);
while (mMessagesToDispatch.GetSize() > 0) {

View File

@ -2070,7 +2070,7 @@ nsFrameLoader::EnsureMessageManager()
nsIScriptContext* sctx = mOwnerContent->GetContextForEventHandlers(&rv);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_STATE(sctx);
JSContext* cx = static_cast<JSContext*>(sctx->GetNativeContext());
JSContext* cx = sctx->GetNativeContext();
NS_ENSURE_STATE(cx);
nsCOMPtr<nsIDOMChromeWindow> chromeWindow =

View File

@ -3594,14 +3594,8 @@ nsINode::doInsertChildAt(nsIContent* aKid, PRUint32 aIndex,
mozAutoDocUpdate updateBatch(doc, UPDATE_CONTENT_MODEL, aNotify);
if (!HasSameOwnerDoc(aKid)) {
// DocumentType nodes are the only nodes that can have a null
// ownerDocument according to the DOM spec, and we need to allow
// inserting them w/o calling AdoptNode().
if (aKid->NodeType() != nsIDOMNode::DOCUMENT_TYPE_NODE ||
aKid->GetOwnerDoc()) {
rv = AdoptNodeIntoOwnerDoc(this, aKid);
NS_ENSURE_SUCCESS(rv, rv);
}
rv = AdoptNodeIntoOwnerDoc(this, aKid);
NS_ENSURE_SUCCESS(rv, rv);
}
PRUint32 childCount = aChildArray.ChildCount();
@ -4113,9 +4107,7 @@ nsINode::ReplaceOrInsertBefore(PRBool aReplace, nsINode* aNewChild,
// DocumentType nodes are the only nodes that can have a null
// ownerDocument according to the DOM spec, and we need to allow
// inserting them w/o calling AdoptNode().
if (!HasSameOwnerDoc(newContent) &&
(nodeType != nsIDOMNode::DOCUMENT_TYPE_NODE ||
newContent->GetOwnerDoc())) {
if (!HasSameOwnerDoc(newContent)) {
res = AdoptNodeIntoOwnerDoc(this, aNewChild);
NS_ENSURE_SUCCESS(res, res);
}

View File

@ -690,6 +690,8 @@ GK_ATOM(onpopstate, "onpopstate")
GK_ATOM(only, "only") // this one is not an event
GK_ATOM(onmessage, "onmessage")
GK_ATOM(onmousedown, "onmousedown")
GK_ATOM(onmouseenter, "onmouseenter")
GK_ATOM(onmouseleave, "onmouseleave")
GK_ATOM(onmousemove, "onmousemove")
GK_ATOM(onmouseout, "onmouseout")
GK_ATOM(onmouseover, "onmouseover")

View File

@ -139,7 +139,6 @@ protected:
friend class nsXULPrototypeDocument;
friend nsresult NS_NewDOMDocumentType(nsIDOMDocumentType** ,
nsNodeInfoManager *,
nsIPrincipal *,
nsIAtom *,
const nsAString& ,
const nsAString& ,

View File

@ -571,6 +571,9 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, PRBool aClone, PRBool aDeep,
if (elm->MayHaveTouchEventListener()) {
window->SetHasTouchEventListeners();
}
if (elm->MayHaveMouseEnterLeaveEventListener()) {
window->SetHasMouseEnterLeaveEventListeners();
}
}
}
}

View File

@ -910,7 +910,7 @@ nsScriptLoader::EvaluateScript(nsScriptLoadRequest* aRequest,
JSContext *cx = nsnull; // Initialize this to keep GCC happy.
if (stid == nsIProgrammingLanguage::JAVASCRIPT) {
cx = (JSContext *)context->GetNativeContext();
cx = context->GetNativeContext();
::JS_BeginRequest(cx);
NS_ASSERTION(!::JS_IsExceptionPending(cx),
"JS_ReportPendingException wasn't called in EvaluateString");

View File

@ -901,7 +901,7 @@ nsWebSocket::CreateAndDispatchMessageEvent(const nsACString& aData)
nsIScriptContext* scriptContext = sgo->GetContext();
NS_ENSURE_TRUE(scriptContext, NS_ERROR_FAILURE);
JSContext* cx = (JSContext*)scriptContext->GetNativeContext();
JSContext* cx = scriptContext->GetNativeContext();
NS_ENSURE_TRUE(cx, NS_ERROR_FAILURE);
// Now we can turn our string into a jsval

View File

@ -506,6 +506,7 @@ _TEST_FILES2 = \
test_bug675121.html \
file_bug675121.sjs \
test_bug654352.html \
test_bug675166.html \
test_bug682592.html \
bug682592-subframe.html \
bug682592-subframe-ref.html \

View File

@ -27,7 +27,7 @@ function testHTMLDocuments(ids, isXHTML) {
ids[i],
null);
ok(docType1, "No doctype?");
ok(!docType1.ownerDocument, "docType shouldn't have ownerDocument!");
ok(docType1.ownerDocument, "docType should have ownerDocument!");
var doc1 = document.implementation.createDocument(null, null, docType1);
is(docType1.ownerDocument, doc1, "docType should have ownerDocument!");
ok(!doc1.documentElement, "Document shouldn't have document element!");
@ -64,7 +64,7 @@ function testSVGDocument() {
"-//W3C//DTD SVG 1.1//EN",
null);
ok(docType1, "No doctype?");
ok(!docType1.ownerDocument, "docType shouldn't have ownerDocument!");
ok(docType1.ownerDocument, "docType should have ownerDocument!");
var doc1 = document.implementation.createDocument(null, null, docType1);
is(docType1.ownerDocument, doc1, "docType should have ownerDocument!");
ok(!doc1.documentElement, "Document shouldn't have document element!");
@ -91,7 +91,7 @@ function testFooBarDocument() {
var docType1 =
document.implementation.createDocumentType("FooBar", "FooBar", null);
ok(docType1, "No doctype?");
ok(!docType1.ownerDocument, "docType shouldn't have ownerDocument!");
ok(docType1.ownerDocument, "docType should have ownerDocument!");
var doc1 = document.implementation.createDocument(null, null, docType1);
is(docType1.ownerDocument, doc1, "docType should have ownerDocument!");
ok(!doc1.documentElement, "Document shouldn't have document element!");

View File

@ -0,0 +1,57 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=675166
-->
<head>
<title>Test for Bug 675166</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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=675166">Mozilla Bug 675166</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 675166 **/
var dt = document.implementation.createDocumentType("html", null, null);
isnot(dt.ownerDocument, null, "DocumentType should have ownerDocument");
var d = document.implementation.createDocument(null, null, dt);
is(dt.ownerDocument, d, "DocumentType shouldn't have null ownerDocument");
try {
document.implementation.createDocument(null, null, dt);
ok(true, "Creating document using already bound document type shouldn't throw!");
} catch(ex) {
ok(false, "Creating document using already bound document type shouldn't throw!");
}
var d2 = document.implementation.createDocument(null, null, null);
var dt2 = document.implementation.createDocumentType("html", null, null);
d2.appendChild(dt2);
is(dt2.ownerDocument, d2, "DocumentType shouldn't have null ownerDocument");
is(document.ownerDocument, null, "Document's ownerDocument should be null!");
is(document.documentElement.ownerDocument, document,
"Element should have ownerDocument!")
is(dt2.parentNode, d2, "parentNode should be document!");
d2.removeChild(dt2);
is(dt2.parentNode, null, "parentNode should be null!");
d.adoptNode(dt2);
d2.adoptNode(dt2);
d2.appendChild(dt2);
is(dt2.parentNode, d2, "parentNode should be document!");
</script>
</pre>
</body>
</html>

View File

@ -227,6 +227,14 @@ EVENT(mousedown,
NS_MOUSE_BUTTON_DOWN,
EventNameType_All,
NS_MOUSE_EVENT)
EVENT(mouseenter,
NS_MOUSEENTER,
EventNameType_All,
NS_MOUSE_EVENT)
EVENT(mouseleave,
NS_MOUSELEAVE,
EventNameType_All,
NS_MOUSE_EVENT)
EVENT(mousemove,
NS_MOUSE_MOVE,
EventNameType_All,

View File

@ -61,7 +61,7 @@
using namespace mozilla;
static const char* const sEventNames[] = {
"mousedown", "mouseup", "click", "dblclick", "mouseover",
"mousedown", "mouseup", "click", "dblclick", "mouseenter", "mouseleave", "mouseover",
"mouseout", "MozMouseHittest", "mousemove", "contextmenu", "keydown", "keyup", "keypress",
"focus", "blur", "load", "popstate", "beforescriptexecute",
"afterscriptexecute", "beforeunload", "unload",
@ -1109,6 +1109,10 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
return sEventNames[eDOMEvents_click];
case NS_MOUSE_DOUBLECLICK:
return sEventNames[eDOMEvents_dblclick];
case NS_MOUSEENTER:
return sEventNames[eDOMEvents_mouseenter];
case NS_MOUSELEAVE:
return sEventNames[eDOMEvents_mouseleave];
case NS_MOUSE_ENTER_SYNTH:
return sEventNames[eDOMEvents_mouseover];
case NS_MOUSE_EXIT_SYNTH:

View File

@ -65,6 +65,8 @@ public:
eDOMEvents_mouseup,
eDOMEvents_click,
eDOMEvents_dblclick,
eDOMEvents_mouseenter,
eDOMEvents_mouseleave,
eDOMEvents_mouseover,
eDOMEvents_mouseout,
eDOMEvents_MozMouseHittest,

View File

@ -134,6 +134,7 @@ nsEventListenerManager::nsEventListenerManager(nsISupports* aTarget) :
mMayHaveSystemGroupListeners(PR_FALSE),
mMayHaveAudioAvailableEventListener(PR_FALSE),
mMayHaveTouchEventListener(PR_FALSE),
mMayHaveMouseEnterLeaveEventListener(PR_FALSE),
mNoListenerForEvent(0),
mTarget(aTarget)
{
@ -293,6 +294,19 @@ nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener,
nsPIDOMWindow* window = GetInnerWindowForTarget();
if (window)
window->SetHasTouchEventListeners();
} else if (aTypeAtom == nsGkAtoms::onmouseenter ||
aTypeAtom == nsGkAtoms::onmouseleave) {
mMayHaveMouseEnterLeaveEventListener = PR_TRUE;
nsPIDOMWindow* window = GetInnerWindowForTarget();
if (window) {
#ifdef DEBUG
nsCOMPtr<nsIDocument> d = do_QueryInterface(window->GetExtantDocument());
NS_WARN_IF_FALSE(!nsContentUtils::IsChromeDoc(d),
"Please do not use mouseenter/leave events in chrome. "
"They are slower than mouseover/out!");
#endif
window->SetHasMouseEnterLeaveEventListeners();
}
}
}
@ -644,8 +658,7 @@ nsEventListenerManager::CompileEventHandlerInternal(nsListenerStruct *aListenerS
}
nsCxPusher pusher;
if (aNeedsCxPush &&
!pusher.Push((JSContext*)context->GetNativeContext())) {
if (aNeedsCxPush && !pusher.Push(context->GetNativeContext())) {
return NS_ERROR_FAILURE;
}

View File

@ -232,6 +232,8 @@ public:
*/
PRBool MayHaveTouchEventListener() { return mMayHaveTouchEventListener; }
PRBool MayHaveMouseEnterLeaveEventListener() { return mMayHaveMouseEnterLeaveEventListener; }
PRInt64 SizeOf() const;
protected:
nsresult HandleEventSubType(nsListenerStruct* aListenerStruct,
@ -302,7 +304,8 @@ protected:
PRUint32 mMayHaveSystemGroupListeners : 1;
PRUint32 mMayHaveAudioAvailableEventListener : 1;
PRUint32 mMayHaveTouchEventListener : 1;
PRUint32 mNoListenerForEvent : 26;
PRUint32 mMayHaveMouseEnterLeaveEventListener : 1;
PRUint32 mNoListenerForEvent : 25;
nsAutoTObserverArray<nsListenerStruct, 2> mListeners;
nsISupports* mTarget; //WEAK

View File

@ -3839,6 +3839,50 @@ nsEventStateManager::DispatchMouseEvent(nsGUIEvent* aEvent, PRUint32 aMessage,
return targetFrame;
}
class MouseEnterLeaveDispatcher
{
public:
MouseEnterLeaveDispatcher(nsEventStateManager* aESM,
nsIContent* aTarget, nsIContent* aRelatedTarget,
nsGUIEvent* aEvent, PRUint32 aType)
: mESM(aESM), mEvent(aEvent), mType(aType)
{
nsPIDOMWindow* win =
aTarget ? aTarget->GetOwnerDoc()->GetInnerWindow() : nsnull;
if (win && win->HasMouseEnterLeaveEventListeners()) {
mRelatedTarget = aRelatedTarget ?
aRelatedTarget->FindFirstNonNativeAnonymous() : nsnull;
nsINode* commonParent = nsnull;
if (aTarget && aRelatedTarget) {
commonParent =
nsContentUtils::GetCommonAncestor(aTarget, aRelatedTarget);
}
nsIContent* current = aTarget;
// Note, it is ok if commonParent is null!
while (current && current != commonParent) {
if (!current->IsInNativeAnonymousSubtree()) {
mTargets.AppendObject(current);
}
// mouseenter/leave is fired only on elements.
current = current->GetParent();
}
}
}
~MouseEnterLeaveDispatcher()
{
for (PRInt32 i = 0; i < mTargets.Count(); ++i) {
mESM->DispatchMouseEvent(mEvent, mType, mTargets[i], mRelatedTarget);
}
}
nsEventStateManager* mESM;
nsCOMArray<nsIContent> mTargets;
nsCOMPtr<nsIContent> mRelatedTarget;
nsGUIEvent* mEvent;
PRUint32 mType;
};
void
nsEventStateManager::NotifyMouseOut(nsGUIEvent* aEvent, nsIContent* aMovingInto)
{
@ -3884,7 +3928,10 @@ nsEventStateManager::NotifyMouseOut(nsGUIEvent* aEvent, nsIContent* aMovingInto)
// Unset :hover
SetContentState(nsnull, NS_EVENT_STATE_HOVER);
}
MouseEnterLeaveDispatcher leaveDispatcher(this, mLastMouseOverElement, aMovingInto,
aEvent, NS_MOUSELEAVE);
// Fire mouseout
DispatchMouseEvent(aEvent, NS_MOUSE_EXIT_SYNTH,
mLastMouseOverElement, aMovingInto);
@ -3932,6 +3979,9 @@ nsEventStateManager::NotifyMouseOver(nsGUIEvent* aEvent, nsIContent* aContent)
// DispatchMouseEvent() call below, since NotifyMouseOut() resets it, bug 298477.
nsCOMPtr<nsIContent> lastMouseOverElement = mLastMouseOverElement;
MouseEnterLeaveDispatcher enterDispatcher(this, aContent, lastMouseOverElement,
aEvent, NS_MOUSEENTER);
NotifyMouseOut(aEvent, aContent);
// Store the first mouseOver event we fire and don't refire mouseOver

View File

@ -66,6 +66,7 @@ class nsIDocShellTreeNode;
class nsIDocShellTreeItem;
class imgIContainer;
class nsDOMDataTransfer;
class MouseEnterLeaveDispatcher;
namespace mozilla {
namespace dom {
@ -228,6 +229,8 @@ public:
static void SetFullScreenState(mozilla::dom::Element* aElement, PRBool aIsFullScreen);
protected:
friend class MouseEnterLeaveDispatcher;
void UpdateCursor(nsPresContext* aPresContext, nsEvent* aEvent, nsIFrame* aTargetFrame, nsEventStatus* aStatus);
/**
* Turn a GUI mouse event into a mouse event targeted at the specified

View File

@ -71,6 +71,7 @@ _TEST_FILES = \
test_bug412567.html \
test_bug426082.html \
test_bug427537.html \
test_bug432698.html \
test_bug443985.html \
test_bug447736.html \
test_bug450876.html \

View File

@ -0,0 +1,190 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=432698
-->
<head>
<title>Test for Bug 432698</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.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=432698">Mozilla Bug 432698</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 432698 **/
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(runTests);
var outer;
var middle;
var inner;
var outside;
var container;
var file;
var iframe;
var checkRelatedTarget = false;
var expectedRelatedEnter = null;
var expectedRelatedLeave = null;
var mouseentercount = 0;
var mouseleavecount = 0;
var mouseovercount = 0;
var mouseoutcount = 0;
function sendMouseEvent(t, elem) {
var r = elem.getBoundingClientRect();
synthesizeMouse(elem, r.width / 2, r.height / 2, {type: t});
}
function runTests() {
outer = document.getElementById("outertest");
middle = document.getElementById("middletest");
inner = document.getElementById("innertest");
outside = document.getElementById("outside");
container = document.getElementById("container");
file = document.getElementById("file");
iframe = document.getElementById("iframe");
// Make sure ESM thinks mouse is outside the test elements.
sendMouseEvent("mousemove", outside);
mouseentercount = 0;
mouseleavecount = 0;
mouseovercount = 0;
mouseoutcount = 0;
checkRelatedTarget = true;
expectedRelatedEnter = outside;
expectedRelatedLeave = inner;
sendMouseEvent("mousemove", inner);
is(mouseentercount, 3, "Unexpected mouseenter event count!");
is(mouseovercount, 1, "Unexpected mouseover event count!");
is(mouseoutcount, 0, "Unexpected mouseout event count!");
is(mouseleavecount, 0, "Unexpected mouseleave event count!");
expectedRelatedEnter = inner;
expectedRelatedLeave = outside;
sendMouseEvent("mousemove", outside);
is(mouseentercount, 3, "Unexpected mouseenter event count!");
is(mouseovercount, 1, "Unexpected mouseover event count!");
is(mouseoutcount, 1, "Unexpected mouseout event count!");
is(mouseleavecount, 3, "Unexpected mouseleave event count!");
// Event handling over native anonymous content.
var r = file.getBoundingClientRect();
expectedRelatedEnter = outside;
expectedRelatedLeave = file;
synthesizeMouse(file, r.width / 6, r.height / 2, {type: "mousemove"});
is(mouseentercount, 4, "Unexpected mouseenter event count!");
is(mouseovercount, 2, "Unexpected mouseover event count!");
is(mouseoutcount, 1, "Unexpected mouseout event count!");
is(mouseleavecount, 3, "Unexpected mouseleave event count!");
// Moving mouse over type="file" shouldn't cause mouseover/out/enter/leave events
synthesizeMouse(file, r.width - (r.width / 6), r.height / 2, {type: "mousemove"});
is(mouseentercount, 4, "Unexpected mouseenter event count!");
is(mouseovercount, 2, "Unexpected mouseover event count!");
is(mouseoutcount, 1, "Unexpected mouseout event count!");
is(mouseleavecount, 3, "Unexpected mouseleave event count!");
expectedRelatedEnter = file;
expectedRelatedLeave = outside;
sendMouseEvent("mousemove", outside);
is(mouseentercount, 4, "Unexpected mouseenter event count!");
is(mouseovercount, 2, "Unexpected mouseover event count!");
is(mouseoutcount, 2, "Unexpected mouseout event count!");
is(mouseleavecount, 4, "Unexpected mouseleave event count!");
// Initialize iframe
iframe.contentDocument.documentElement.style.overflow = "hidden";
iframe.contentDocument.body.style.margin = "0px";
iframe.contentDocument.body.style.width = "100%";
iframe.contentDocument.body.style.height = "100%";
iframe.contentDocument.body.innerHTML =
"<div style='width: 100%; height: 50%; border: 1px solid black;'></div>" +
"<div style='width: 100%; height: 50%; border: 1px solid black;'></div>";
iframe.contentDocument.body.offsetLeft; // flush
iframe.contentDocument.body.firstChild.onmouseenter = menter;
iframe.contentDocument.body.firstChild.onmouseleave = mleave;
iframe.contentDocument.body.lastChild.onmouseenter = menter;
iframe.contentDocument.body.lastChild.onmouseleave = mleave;
r = iframe.getBoundingClientRect();
expectedRelatedEnter = outside;
expectedRelatedLeave = iframe;
// Move mouse inside the iframe.
synthesizeMouse(iframe.contentDocument.body, r.width / 2, r.height / 4, {type: "mousemove"},
iframe.contentWindow);
synthesizeMouse(iframe.contentDocument.body, r.width / 2, r.height - (r.height / 4), {type: "mousemove"},
iframe.contentWindow);
is(mouseentercount, 7, "Unexpected mouseenter event count!");
expectedRelatedEnter = iframe;
expectedRelatedLeave = outside;
sendMouseEvent("mousemove", outside);
is(mouseleavecount, 7, "Unexpected mouseleave event count!");
SimpleTest.finish();
}
function menter(evt) {
++mouseentercount;
evt.stopPropagation();
is(evt.bubbles, false, evt.type + " should not bubble!");
is(evt.cancelable, false, evt.type + " is not cancelable!");
is(evt.target, evt.currentTarget, "Wrong event target!");
ok(!evt.relatedTarget || evt.target.ownerDocument == evt.relatedTarget.ownerDocument,
"Leaking nodes to another document?");
if (checkRelatedTarget && evt.target.ownerDocument == document) {
is(evt.relatedTarget, expectedRelatedEnter, "Wrong related target (mouseenter)");
}
}
function mleave(evt) {
++mouseleavecount;
evt.stopPropagation();
is(evt.bubbles, false, evt.type + " should not bubble!");
is(evt.cancelable, false, evt.type + " is not cancelable!");
is(evt.target, evt.currentTarget, "Wrong event target!");
ok(!evt.relatedTarget || evt.target.ownerDocument == evt.relatedTarget.ownerDocument,
"Leaking nodes to another document?");
if (checkRelatedTarget && evt.target.ownerDocument == document) {
is(evt.relatedTarget, expectedRelatedLeave, "Wrong related target (mouseleave)");
}
}
function mover(evt) {
++mouseovercount;
evt.stopPropagation();
}
function mout(evt) {
++mouseoutcount;
evt.stopPropagation();
}
</script>
</pre>
<div id="container" onmouseenter="menter(event)" onmouseleave="mleave(event)"
onmouseout="mout(event)" onmouseover="mover(event)">
<div id="outside" onmouseout="event.stopPropagation()" onmouseover="event.stopPropagation()">foo</div>
<div id="outertest" onmouseenter="menter(event)" onmouseleave="mleave(event)"
onmouseout="mout(event)" onmouseover="mover(event)">
<div id="middletest" onmouseenter="menter(event)" onmouseleave="mleave(event)"
onmouseout="mout(event)" onmouseover="mover(event)">
<div id="innertest" onmouseenter="menter(event)" onmouseleave="mleave(event)"
onmouseout="mout(event)" onmouseover="mover(event)">foo</div>
</div>
</div>
<input type="file" id="file"
onmouseenter="menter(event)" onmouseleave="mleave(event)"
onmouseout="mout(event)" onmouseover="mover(event)">
<br>
<iframe id="iframe" width="50px" height="50px"
onmouseenter="menter(event)" onmouseleave="mleave(event)"
onmouseout="mout(event)" onmouseover="mover(event)"></iframe>
</div>
</body>
</html>

View File

@ -50,8 +50,7 @@ class nsHTMLAudioElement : public nsHTMLMediaElement,
public nsIJSNativeInitializer
{
public:
nsHTMLAudioElement(already_AddRefed<nsINodeInfo> aNodeInfo,
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
nsHTMLAudioElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~nsHTMLAudioElement();
// nsISupports

View File

@ -73,8 +73,7 @@ public:
CANPLAY_YES
};
nsHTMLMediaElement(already_AddRefed<nsINodeInfo> aNodeInfo,
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
nsHTMLMediaElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~nsHTMLMediaElement();
/**

View File

@ -45,8 +45,7 @@ class nsHTMLVideoElement : public nsHTMLMediaElement,
public nsIDOMHTMLVideoElement
{
public:
nsHTMLVideoElement(already_AddRefed<nsINodeInfo> aNodeInfo,
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
nsHTMLVideoElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~nsHTMLVideoElement();
// nsISupports

View File

@ -2505,7 +2505,7 @@ nsGenericHTMLFormElement::nsGenericHTMLFormElement(already_AddRefed<nsINodeInfo>
nsGenericHTMLFormElement::~nsGenericHTMLFormElement()
{
if (mFieldSet) {
static_cast<nsHTMLFieldSetElement*>(mFieldSet)->RemoveElement(this);
mFieldSet->RemoveElement(this);
}
// Check that this element doesn't know anything about its form at this point.
@ -2842,6 +2842,22 @@ nsGenericHTMLFormElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
return nsGenericHTMLElement::PreHandleEvent(aVisitor);
}
/* virtual */
bool
nsGenericHTMLFormElement::IsDisabled() const
{
return HasAttr(kNameSpaceID_None, nsGkAtoms::disabled) ||
(mFieldSet && mFieldSet->IsDisabled());
}
void
nsGenericHTMLFormElement::ForgetFieldSet(nsIContent* aFieldset)
{
if (mFieldSet == aFieldset) {
mFieldSet = nsnull;
}
}
PRBool
nsGenericHTMLFormElement::CanBeDisabled() const
{
@ -3092,32 +3108,30 @@ nsGenericHTMLFormElement::UpdateFieldSet(PRBool aNotify)
for (parent = GetParent(); parent;
prev = parent, parent = parent->GetParent()) {
if (parent->IsHTML(nsGkAtoms::fieldset)) {
nsHTMLFieldSetElement* fieldset =
static_cast<nsHTMLFieldSetElement*>(parent);
if (!prev || fieldset->GetFirstLegend() != prev) {
if (mFieldSet == fieldset) {
// We already have the right fieldset;
return;
}
if (mFieldSet) {
static_cast<nsHTMLFieldSetElement*>(mFieldSet)->RemoveElement(this);
}
mFieldSet = fieldset;
fieldset->AddElement(this);
// The disabled state may have changed
FieldSetDisabledChanged(aNotify);
nsHTMLFieldSetElement* fieldset =
nsHTMLFieldSetElement::FromContent(parent);
if (fieldset &&
(!prev || fieldset->GetFirstLegend() != prev)) {
if (mFieldSet == fieldset) {
// We already have the right fieldset;
return;
}
if (mFieldSet) {
mFieldSet->RemoveElement(this);
}
mFieldSet = fieldset;
fieldset->AddElement(this);
// The disabled state may have changed
FieldSetDisabledChanged(aNotify);
return;
}
}
// No fieldset found.
if (mFieldSet) {
static_cast<nsHTMLFieldSetElement*>(mFieldSet)->RemoveElement(this);
mFieldSet->RemoveElement(this);
mFieldSet = nsnull;
// The disabled state may have changed
FieldSetDisabledChanged(aNotify);

View File

@ -835,6 +835,8 @@ private:
//----------------------------------------------------------------------
class nsHTMLFieldSetElement;
/**
* A helper class for form elements that can contain children
*/
@ -885,10 +887,7 @@ public:
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
virtual bool IsDisabled() const {
return HasAttr(kNameSpaceID_None, nsGkAtoms::disabled) ||
(mFieldSet && mFieldSet->IsDisabled());
}
virtual bool IsDisabled() const;
/**
* This callback is called by a fieldest on all its elements whenever its
@ -912,11 +911,7 @@ public:
*
* @param aFieldSet The fieldset being removed.
*/
void ForgetFieldSet(nsIContent* aFieldset) {
if (mFieldSet == aFieldset) {
mFieldSet = nsnull;
}
}
void ForgetFieldSet(nsIContent* aFieldset);
/**
* Returns if the control can be disabled.
@ -994,7 +989,7 @@ protected:
nsHTMLFormElement* mForm;
/* This is a pointer to our closest fieldset parent if any */
nsGenericHTMLFormElement* mFieldSet;
nsHTMLFieldSetElement* mFieldSet;
};
// If this flag is set on an nsGenericHTMLFormElement, that means that we have

View File

@ -90,7 +90,7 @@ NS_NewHTMLAudioElement(already_AddRefed<nsINodeInfo> aNodeInfo,
NS_ENSURE_TRUE(nodeInfo, nsnull);
}
return new nsHTMLAudioElement(nodeInfo.forget(), aFromParser);
return new nsHTMLAudioElement(nodeInfo.forget());
}
NS_IMPL_ADDREF_INHERITED(nsHTMLAudioElement, nsHTMLMediaElement)
@ -108,9 +108,8 @@ NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLAudioElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLAudioElement)
nsHTMLAudioElement::nsHTMLAudioElement(already_AddRefed<nsINodeInfo> aNodeInfo,
FromParser aFromParser)
: nsHTMLMediaElement(aNodeInfo, aFromParser)
nsHTMLAudioElement::nsHTMLAudioElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsHTMLMediaElement(aNodeInfo)
{
}

View File

@ -53,6 +53,15 @@ public:
nsHTMLFieldSetElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~nsHTMLFieldSetElement();
/** Typesafe, non-refcounting cast from nsIContent. Cheaper than QI. **/
static nsHTMLFieldSetElement* FromContent(nsIContent* aContent)
{
if (!aContent || !aContent->IsHTML(nsGkAtoms::fieldset)) {
return nsnull;
}
return static_cast<nsHTMLFieldSetElement*>(aContent);
}
// nsISupports
NS_DECL_ISUPPORTS_INHERITED

View File

@ -50,12 +50,8 @@
#include "nsIDOMDocument.h"
#include "nsDOMError.h"
#include "nsNodeInfoManager.h"
#include "plbase64.h"
#include "nsNetUtil.h"
#include "prmem.h"
#include "nsNetUtil.h"
#include "nsXPCOMStrings.h"
#include "prlock.h"
#include "nsThreadUtils.h"
#include "nsIThreadInternal.h"
#include "nsContentUtils.h"
@ -1269,8 +1265,7 @@ NS_IMETHODIMP nsHTMLMediaElement::SetMuted(PRBool aMuted)
return NS_OK;
}
nsHTMLMediaElement::nsHTMLMediaElement(already_AddRefed<nsINodeInfo> aNodeInfo,
FromParser aFromParser)
nsHTMLMediaElement::nsHTMLMediaElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericHTMLElement(aNodeInfo),
mCurrentLoadID(0),
mNetworkState(nsIDOMHTMLMediaElement::NETWORK_EMPTY),

View File

@ -66,7 +66,7 @@
using namespace mozilla::dom;
NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Video)
NS_IMPL_NS_NEW_HTML_ELEMENT(Video)
NS_IMPL_ADDREF_INHERITED(nsHTMLVideoElement, nsHTMLMediaElement)
NS_IMPL_RELEASE_INHERITED(nsHTMLVideoElement, nsHTMLMediaElement)
@ -100,9 +100,8 @@ NS_IMETHODIMP nsHTMLVideoElement::GetVideoHeight(PRUint32 *aVideoHeight)
return NS_OK;
}
nsHTMLVideoElement::nsHTMLVideoElement(already_AddRefed<nsINodeInfo> aNodeInfo,
FromParser aFromParser)
: nsHTMLMediaElement(aNodeInfo, aFromParser)
nsHTMLVideoElement::nsHTMLVideoElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsHTMLMediaElement(aNodeInfo)
{
}

View File

@ -1544,7 +1544,7 @@ IsScriptEnabled(nsIDocument *aDoc, nsIDocShell *aContainer)
nsIScriptContext *scriptContext = globalObject->GetContext();
NS_ENSURE_TRUE(scriptContext, PR_TRUE);
JSContext* cx = (JSContext *) scriptContext->GetNativeContext();
JSContext* cx = scriptContext->GetNativeContext();
NS_ENSURE_TRUE(cx, PR_TRUE);
PRBool enabled = PR_TRUE;
@ -2452,7 +2452,7 @@ HTMLContentSink::AddDocTypeDecl(const nsIParserNode& aNode)
nsAutoString voidString;
voidString.SetIsVoid(PR_TRUE);
rv = NS_NewDOMDocumentType(getter_AddRefs(docType),
mDocument->NodeInfoManager(), nsnull, nameAtom,
mDocument->NodeInfoManager(), nameAtom,
publicId, systemId, voidString);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -189,6 +189,13 @@ nsSVGGraphicElement::PrependLocalTransformTo(const gfxMatrix &aMatrix) const
{
gfxMatrix result(aMatrix);
// animateMotion's resulting transform is supposed to apply *on top of*
// any transformations from the |transform| attribute. So since we're
// PRE-multiplying, we need to apply the animateMotion transform *first*.
if (mAnimateMotionTransform) {
result.PreMultiply(*mAnimateMotionTransform);
}
if (mTransforms) {
nsresult rv;
nsCOMPtr<nsIDOMSVGTransformList> transforms;
@ -203,13 +210,6 @@ nsSVGGraphicElement::PrependLocalTransformTo(const gfxMatrix &aMatrix) const
}
}
// <animateMotion>'s transformation is *supplemental* to the |transform|
// attribute and any transformations on ancestors. So, we apply it
// (pre-multiply it) last.
if (mAnimateMotionTransform) {
result.PreMultiply(*mAnimateMotionTransform);
}
return result;
}

View File

@ -1248,7 +1248,7 @@ nsBindingManager::GetBindingImplementation(nsIContent* aContent, REFNSIID aIID,
if (!context)
return NS_NOINTERFACE;
JSContext* jscontext = (JSContext*)context->GetNativeContext();
JSContext* jscontext = context->GetNativeContext();
if (!jscontext)
return NS_NOINTERFACE;

View File

@ -1062,7 +1062,7 @@ nsXBLBinding::ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocumen
nsCOMPtr<nsIScriptContext> context = global->GetContext();
if (context && scope) {
JSContext *cx = (JSContext *)context->GetNativeContext();
JSContext *cx = context->GetNativeContext();
nsCxPusher pusher;
pusher.Push(cx);
@ -1395,7 +1395,7 @@ nsXBLBinding::AllowScripts()
return PR_FALSE;
}
JSContext* cx = (JSContext*) context->GetNativeContext();
JSContext* cx = context->GetNativeContext();
nsCOMPtr<nsIDocument> ourDocument =
mPrototypeBinding->XBLDocumentInfo()->GetDocument();

View File

@ -318,7 +318,7 @@ nsXBLDocGlobalObject::EnsureScriptEnvironment(PRUint32 aLangID)
NS_ENSURE_SUCCESS(rv, rv);
rv = SetScriptContext(aLangID, newCtx);
JSContext *cx = (JSContext *)mScriptContext->GetNativeContext();
JSContext *cx = mScriptContext->GetNativeContext();
JSAutoRequest ar(cx);
// nsJSEnvironment set the error reporter to NS_ScriptErrorReporter so
@ -372,8 +372,7 @@ nsXBLDocGlobalObject::GetGlobalJSObject()
if (!mScriptContext)
return nsnull;
JSContext* cx = static_cast<JSContext*>
(mScriptContext->GetNativeContext());
JSContext* cx = mScriptContext->GetNativeContext();
if (!cx)
return nsnull;

View File

@ -103,7 +103,7 @@ nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aBinding, nsIConten
JSObject * targetScriptObject;
holder->GetJSObject(&targetScriptObject);
JSContext *cx = (JSContext *)context->GetNativeContext();
JSContext *cx = context->GetNativeContext();
AutoVersionChecker avc(cx);
@ -147,7 +147,7 @@ nsXBLProtoImpl::InitTargetObjects(nsXBLPrototypeBinding* aBinding,
// Because our prototype implementation has a class, we need to build up a corresponding
// class for the concrete implementation in the bound document.
JSContext* jscontext = (JSContext*)aContext->GetNativeContext();
JSContext* jscontext = aContext->GetNativeContext();
JSObject* global = sgo->GetGlobalJSObject();
nsCOMPtr<nsIXPConnectJSObjectHolder> wrapper;
jsval v;
@ -185,7 +185,7 @@ nsXBLProtoImpl::CompilePrototypeMembers(nsXBLPrototypeBinding* aBinding)
nsIScriptContext *context = globalObject->GetContext();
NS_ENSURE_TRUE(context, NS_ERROR_OUT_OF_MEMORY);
JSContext *cx = (JSContext *)context->GetNativeContext();
JSContext *cx = context->GetNativeContext();
JSObject *global = globalObject->GetGlobalJSObject();

View File

@ -117,7 +117,7 @@ nsXBLProtoImplField::InstallField(nsIScriptContext* aContext,
nsCAutoString uriSpec;
aBindingDocURI->GetSpec(uriSpec);
JSContext* cx = (JSContext*) aContext->GetNativeContext();
JSContext* cx = aContext->GetNativeContext();
NS_ASSERTION(!::JS_IsExceptionPending(cx),
"Shouldn't get here when an exception is pending!");

View File

@ -128,7 +128,7 @@ nsXBLProtoImplMethod::InstallMember(nsIScriptContext* aContext,
{
NS_PRECONDITION(IsCompiled(),
"Should not be installing an uncompiled method");
JSContext* cx = (JSContext*) aContext->GetNativeContext();
JSContext* cx = aContext->GetNativeContext();
nsIDocument *ownerDoc = aBoundElement->GetOwnerDoc();
nsIScriptGlobalObject *sgo;
@ -294,7 +294,7 @@ nsXBLProtoImplAnonymousMethod::Execute(nsIContent* aBoundElement)
return NS_OK;
}
JSContext* cx = (JSContext*) context->GetNativeContext();
JSContext* cx = context->GetNativeContext();
JSObject* globalObject = global->GetGlobalJSObject();

View File

@ -155,7 +155,7 @@ nsXBLProtoImplProperty::InstallMember(nsIScriptContext* aContext,
{
NS_PRECONDITION(mIsCompiled,
"Should not be installing an uncompiled property");
JSContext* cx = (JSContext*) aContext->GetNativeContext();
JSContext* cx = aContext->GetNativeContext();
nsIDocument *ownerDoc = aBoundElement->GetOwnerDoc();
nsIScriptGlobalObject *sgo;

View File

@ -1245,7 +1245,7 @@ nsXMLContentSink::HandleDoctypeDecl(const nsAString & aSubset,
// Create a new doctype node
nsCOMPtr<nsIDOMDocumentType> docType;
rv = NS_NewDOMDocumentType(getter_AddRefs(docType), mNodeInfoManager, nsnull,
rv = NS_NewDOMDocumentType(getter_AddRefs(docType), mNodeInfoManager,
name, aPublicId, aSystemId, aSubset);
if (NS_FAILED(rv) || !docType) {
return rv;

View File

@ -103,7 +103,8 @@ NS_NewDOMDocument(nsIDOMDocument** aInstancePtrResult,
nsIURI* aDocumentURI,
nsIURI* aBaseURI,
nsIPrincipal* aPrincipal,
PRBool aLoadedAsData)
PRBool aLoadedAsData,
nsIScriptGlobalObject* aEventObject)
{
// Note: can't require that aDocumentURI/aBaseURI/aPrincipal be non-null,
// since at least one caller (XMLHttpRequest) doesn't have decent args to
@ -153,6 +154,8 @@ NS_NewDOMDocument(nsIDOMDocument** aInstancePtrResult,
return rv;
}
d->SetScriptHandlingObject(aEventObject);
if (isHTML) {
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(d);
NS_ASSERTION(htmlDoc, "HTML Document doesn't implement nsIHTMLDocument?");

View File

@ -943,7 +943,7 @@ txMozillaXMLOutput::createResultDocument(const nsSubstring& aName, PRInt32 aNsID
nsAutoString voidString;
voidString.SetIsVoid(PR_TRUE);
rv = NS_NewDOMDocumentType(getter_AddRefs(documentType),
mNodeInfoManager, nsnull,
mNodeInfoManager,
doctypeName,
mOutputFormat.mPublicId,
mOutputFormat.mSystemId,

View File

@ -67,12 +67,9 @@ EXPORTS = \
include $(topsrcdir)/config/rules.mk
INCLUDES += \
-I$(srcdir)/../../shared/public \
-I$(srcdir)/../../html/base/src \
-I$(srcdir)/../../xml/content/src \
-I$(srcdir)/../../../dom \
-I$(srcdir)/../../base/src \
-I$(srcdir)/../../../layout/html/base/src \
-I$(topsrcdir)/dom \
$(NULL)
DEFINES += -D_IMPL_NS_LAYOUT

View File

@ -797,7 +797,7 @@ nsScriptEventHandlerOwnerTearoff::CompileEventHandler(
&argNames);
nsCxPusher pusher;
if (!pusher.Push((JSContext*)context->GetNativeContext())) {
if (!pusher.Push(context->GetNativeContext())) {
return NS_ERROR_FAILURE;
}

View File

@ -728,7 +728,7 @@ nsXULPDGlobalObject::EnsureScriptEnvironment(PRUint32 lang_id)
// attach it as the global for this context. Then, ::SetScriptContext
// will re-fetch the global and set it up in our language globals array.
{
JSContext *cx = (JSContext *)ctxNew->GetNativeContext();
JSContext *cx = ctxNew->GetNativeContext();
JSAutoRequest ar(cx);
nsIPrincipal *principal = GetPrincipal();

View File

@ -1420,7 +1420,7 @@ nsXULTemplateBuilder::InitHTMLTemplateRoot()
if (! context)
return NS_ERROR_UNEXPECTED;
JSContext* jscontext = reinterpret_cast<JSContext*>(context->GetNativeContext());
JSContext* jscontext = context->GetNativeContext();
NS_ASSERTION(context != nsnull, "no jscontext");
if (! jscontext)
return NS_ERROR_UNEXPECTED;

View File

@ -6492,7 +6492,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
if (!my_context) {
my_cx = cx;
} else {
my_cx = (JSContext *)my_context->GetNativeContext();
my_cx = my_context->GetNativeContext();
if (my_cx != cx) {
if (!ac.enter(my_cx, obj)) {
@ -9340,7 +9340,7 @@ public:
{
JSContext* cx = nsnull;
if (mContext) {
cx = (JSContext*)mContext->GetNativeContext();
cx = mContext->GetNativeContext();
} else {
nsCOMPtr<nsIThreadJSContextStack> stack =
do_GetService("@mozilla.org/js/xpc/ContextStack;1");

View File

@ -774,7 +774,9 @@ nsPIDOMWindow::nsPIDOMWindow(nsPIDOMWindow *aOuterWindow)
mRunningTimeout(nsnull), mMutationBits(0), mIsDocumentLoaded(PR_FALSE),
mIsHandlingResizeEvent(PR_FALSE), mIsInnerWindow(aOuterWindow != nsnull),
mMayHavePaintEventListener(PR_FALSE), mMayHaveTouchEventListener(PR_FALSE),
mMayHaveAudioAvailableEventListener(PR_FALSE), mIsModalContentWindow(PR_FALSE),
mMayHaveAudioAvailableEventListener(PR_FALSE),
mMayHaveMouseEnterLeaveEventListener(PR_FALSE),
mIsModalContentWindow(PR_FALSE),
mIsActive(PR_FALSE), mIsBackground(PR_FALSE),
mInnerWindow(nsnull), mOuterWindow(aOuterWindow),
// Make sure no actual window ends up with mWindowID == 0
@ -1261,9 +1263,7 @@ nsGlobalWindow::FreeInnerObjects(PRBool aClearScope)
// Kill all of the workers for this window.
nsIScriptContext *scx = GetContextInternal();
JSContext *cx = scx ?
static_cast<JSContext*>(scx->GetNativeContext()) :
nsnull;
JSContext *cx = scx ? scx->GetNativeContext() : nsnull;
mozilla::dom::workers::CancelWorkersForWindow(cx, this);
// Close all IndexedDB databases for this window.
@ -1864,7 +1864,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
nsIScriptContext *scx = GetContextInternal();
NS_ENSURE_TRUE(scx, NS_ERROR_NOT_INITIALIZED);
JSContext *cx = (JSContext *)scx->GetNativeContext();
JSContext *cx = scx->GetNativeContext();
#ifndef MOZ_DISABLE_DOMCRYPTO
// clear smartcard events, our document has gone away.
if (mCrypto) {
@ -2860,7 +2860,7 @@ nsGlobalWindow::DefineArgumentsProperty(nsIArray *aArguments)
JSContext *cx;
nsIScriptContext *ctx = GetOuterWindowInternal()->mContext;
NS_ENSURE_TRUE(aArguments && ctx &&
(cx = (JSContext *)ctx->GetNativeContext()),
(cx = ctx->GetNativeContext()),
NS_ERROR_NOT_INITIALIZED);
if (mIsModalContentWindow) {
@ -6100,7 +6100,7 @@ PostMessageEvent::Run()
JSContext* cx = nsnull;
nsIScriptContext* scriptContext = mTargetWindow->GetContext();
if (scriptContext) {
cx = (JSContext*)scriptContext->GetNativeContext();
cx = scriptContext->GetNativeContext();
}
if (!cx) {
@ -9804,7 +9804,7 @@ nsGlobalWindow::BuildURIfromBase(const char *aURL, nsIURI **aBuiltURI,
// such a way. This also makes us get the appropriate base URI for
// the below URI resolution code.
cx = (JSContext *)scx->GetNativeContext();
cx = scx->GetNativeContext();
} else {
// get the JSContext from the call stack
nsCOMPtr<nsIThreadJSContextStack> stack(do_GetService(sJSStackContractID));
@ -9907,7 +9907,7 @@ nsGlobalWindow::SaveWindowState(nsISupports **aState)
inner->Freeze();
// Remember the outer window's prototype.
JSContext *cx = (JSContext *)mContext->GetNativeContext();
JSContext *cx = mContext->GetNativeContext();
JSAutoRequest req(cx);
nsIXPConnect *xpc = nsContentUtils::XPConnect();
@ -10000,9 +10000,7 @@ nsGlobalWindow::SuspendTimeouts(PRUint32 aIncrease,
// Suspend all of the workers for this window.
nsIScriptContext *scx = GetContextInternal();
JSContext *cx = scx ?
static_cast<JSContext*>(scx->GetNativeContext()) :
nsnull;
JSContext *cx = scx ? scx->GetNativeContext() : nsnull;
mozilla::dom::workers::SuspendWorkersForWindow(cx, this);
TimeStamp now = TimeStamp::Now();
@ -10078,9 +10076,7 @@ nsGlobalWindow::ResumeTimeouts(PRBool aThawChildren)
// Resume all of the workers for this window.
nsIScriptContext *scx = GetContextInternal();
JSContext *cx = scx ?
static_cast<JSContext*>(scx->GetNativeContext()) :
nsnull;
JSContext *cx = scx ? scx->GetNativeContext() : nsnull;
mozilla::dom::workers::ResumeWorkersForWindow(cx, this);
// Restore all of the timeouts, using the stored time remaining
@ -10528,7 +10524,7 @@ nsGlobalChromeWindow::GetMessageManager(nsIChromeFrameMessageManager** aManager)
if (!mMessageManager) {
nsIScriptContext* scx = GetContextInternal();
NS_ENSURE_STATE(scx);
JSContext* cx = (JSContext *)scx->GetNativeContext();
JSContext* cx = scx->GetNativeContext();
NS_ENSURE_STATE(cx);
nsCOMPtr<nsIChromeFrameMessageManager> globalMM =
do_GetService("@mozilla.org/globalmessagemanager;1");

View File

@ -43,6 +43,7 @@
#include "nsISupports.h"
#include "nsCOMPtr.h"
#include "nsIProgrammingLanguage.h"
#include "jspubtd.h"
class nsIScriptGlobalObject;
class nsIScriptSecurityManager;
@ -73,8 +74,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptContextPrincipal,
NS_ISCRIPTCONTEXTPRINCIPAL_IID)
#define NS_ISCRIPTCONTEXT_IID \
{ 0xad76079b, 0xd408, 0x4159, \
{0xb7, 0x3f, 0x41, 0x08, 0x77, 0xff, 0x9b, 0x47 } }
{ 0x827d1e82, 0x5aab, 0x4e3a, \
{ 0x88, 0x76, 0x53, 0xf7, 0xed, 0x1e, 0x3f, 0xbe } }
/* This MUST match JSVERSION_DEFAULT. This version stuff if we don't
know what language we have is a little silly... */
@ -83,9 +84,6 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptContextPrincipal,
/**
* It is used by the application to initialize a runtime and run scripts.
* A script runtime would implement this interface.
* <P><I>It does have a bit too much java script information now, that
* should be removed in a short time. Ideally this interface will be
* language neutral</I>
*/
class nsIScriptContext : public nsIScriptContextPrincipal
{
@ -292,7 +290,7 @@ public:
* Return the native script context
*
**/
virtual void *GetNativeContext() = 0;
virtual JSContext* GetNativeContext() = 0;
/**
* Return the native global object for this context.

View File

@ -2242,7 +2242,7 @@ nsJSContext::ConnectToInner(nsIScriptGlobalObject *aNewInner, void *aOuterGlobal
return NS_OK;
}
void *
JSContext*
nsJSContext::GetNativeContext()
{
return mContext;

View File

@ -34,8 +34,8 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsJSEnvironment_h___
#define nsJSEnvironment_h___
#ifndef nsJSEnvironment_h
#define nsJSEnvironment_h
#include "nsIScriptContext.h"
#include "nsIScriptRuntime.h"
@ -129,7 +129,7 @@ public:
virtual void SetDefaultLanguageVersion(PRUint32 aVersion);
virtual nsIScriptGlobalObject *GetGlobalObject();
virtual void *GetNativeContext();
virtual JSContext* GetNativeContext();
virtual void *GetNativeGlobal();
virtual nsresult CreateNativeGlobalForInner(
nsIScriptGlobalObject *aGlobal,
@ -370,4 +370,4 @@ JSBool NS_DOMWriteStructuredClone(JSContext* cx,
void NS_DOMStructuredCloneError(JSContext* cx, uint32 errorid);
#endif /* nsJSEnvironment_h___ */
#endif /* nsJSEnvironment_h */

View File

@ -80,8 +80,8 @@ class nsIArray;
class nsPIWindowRoot;
#define NS_PIDOMWINDOW_IID \
{ 0xeee816d2, 0x2f08, 0x4b34, \
{ 0x97, 0x47, 0x5e, 0x5a, 0xcd, 0xc3, 0x56, 0xfa } }
{ 0x8ce567b5, 0xcc8d, 0x410b, \
{ 0xa2, 0x7b, 0x07, 0xaf, 0x31, 0xc0, 0x33, 0xb8 } }
class nsPIDOMWindow : public nsIDOMWindowInternal
{
@ -467,6 +467,24 @@ public:
mMayHaveAudioAvailableEventListener = PR_TRUE;
}
/**
* Call this to check whether some node (this window, its document,
* or content in that document) has a mouseenter/leave event listener.
*/
PRBool HasMouseEnterLeaveEventListeners()
{
return mMayHaveMouseEnterLeaveEventListener;
}
/**
* Call this to indicate that some node (this window, its document,
* or content in that document) has a mouseenter/leave event listener.
*/
void SetHasMouseEnterLeaveEventListeners()
{
mMayHaveMouseEnterLeaveEventListener = PR_TRUE;
}
/**
* Initialize window.java and window.Packages.
*/
@ -627,6 +645,7 @@ protected:
PRPackedBool mMayHavePaintEventListener;
PRPackedBool mMayHaveTouchEventListener;
PRPackedBool mMayHaveAudioAvailableEventListener;
PRPackedBool mMayHaveMouseEnterLeaveEventListener;
// This variable is used on both inner and outer windows (and they
// should match).

View File

@ -143,7 +143,7 @@ IDBRequest::SetDone(AsyncConnectionHelper* aHelper)
}
// Otherwise we need to get the result from the helper.
JSContext* cx = static_cast<JSContext*>(mScriptContext->GetNativeContext());
JSContext* cx = mScriptContext->GetNativeContext();
NS_ASSERTION(cx, "Failed to get a context!");
JSObject* global = static_cast<JSObject*>(mScriptContext->GetNativeGlobal());

View File

@ -39,7 +39,7 @@
#include "jspubtd.h"
%}
[scriptable, uuid(c3cc4504-1eaf-42e9-8b1b-a3020f6d3a28)]
[scriptable, uuid(790ad9f7-167a-4f5f-a5c1-8cfb3697104d)]
interface nsIInlineEventHandlers : nsISupports
{
[implicit_jscontext] attribute jsval onabort;
@ -77,6 +77,8 @@ interface nsIInlineEventHandlers : nsISupports
[implicit_jscontext] attribute jsval onmousemove;
[implicit_jscontext] attribute jsval onmouseout;
[implicit_jscontext] attribute jsval onmouseover;
[implicit_jscontext] attribute jsval onmouseenter;
[implicit_jscontext] attribute jsval onmouseleave;
[implicit_jscontext] attribute jsval onmouseup;
// Not supported yet
// [implicit_jscontext] attribute jsval onmousewheel;

View File

@ -361,7 +361,7 @@ GetJSContext(NPP npp)
nsIScriptContext *scx = sgo->GetContext();
NS_ENSURE_TRUE(scx, nsnull);
return (JSContext *)scx->GetNativeContext();
return scx->GetNativeContext();
}
}

View File

@ -725,7 +725,7 @@ GetJSContextFromDoc(nsIDocument *doc)
nsIScriptContext *scx = sgo->GetContext();
NS_ENSURE_TRUE(scx, nsnull);
return (JSContext *)scx->GetNativeContext();
return scx->GetNativeContext();
}
static JSContext *

View File

@ -1371,7 +1371,7 @@ nsNPAPIPluginInstance::GetJSContext(JSContext* *outContext)
nsIScriptContext *context = global->GetContext();
if (context) {
*outContext = (JSContext*) context->GetNativeContext();
*outContext = context->GetNativeContext();
}
}
}

View File

@ -267,7 +267,7 @@ nsresult nsJSThunk::EvaluateScript(nsIChannel *aChannel,
// principal of the context.
nsCOMPtr<nsIPrincipal> objectPrincipal;
rv = securityManager->
GetObjectPrincipal((JSContext*)scriptContext->GetNativeContext(),
GetObjectPrincipal(scriptContext->GetNativeContext(),
globalJSObject,
getter_AddRefs(objectPrincipal));
if (NS_FAILED(rv))
@ -294,7 +294,7 @@ nsresult nsJSThunk::EvaluateScript(nsIChannel *aChannel,
// First check to make sure it's OK to evaluate this script to
// start with. For example, script could be disabled.
JSContext *cx = (JSContext*)scriptContext->GetNativeContext();
JSContext *cx = scriptContext->GetNativeContext();
JSAutoRequest ar(cx);
PRBool ok;
@ -373,7 +373,7 @@ nsresult nsJSThunk::EvaluateScript(nsIChannel *aChannel,
// lose the error), or it might be JS that then proceeds to
// cause an error of its own (which will also make us lose
// this error).
JSContext *cx = (JSContext*)scriptContext->GetNativeContext();
JSContext *cx = scriptContext->GetNativeContext();
JSAutoRequest ar(cx);
::JS_ReportPendingException(cx);
}

View File

@ -77,6 +77,8 @@ var docName = 'createDocument03';
DOMImplementation should raise WRONG_DOCUMENT_ERR DOMException
if parameter doctype has been used with a different document.
The specification has changed! No exception should be thrown.
Invoke method createDocument(namespaceURI,qualifiedName,doctype) on
this domimplementation where doctype is the type of this document.
Method should raise WRONG_DOCUMENT_ERR DOMException.
@ -110,11 +112,12 @@ function createDocument03() {
success = false;
try {
aNewDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType);
success = true;
}
catch(ex) {
success = (typeof(ex.code) != 'undefined' && ex.code == 4);
success = false;
}
assertTrue("throw_WRONG_DOCUMENT_ERR",success);
//assertTrue("no_throw_WRONG_DOCUMENT_ERR",success);
}
}

View File

@ -83,6 +83,8 @@ var docName = 'createDocument04';
DOMImplementation should raise WRONG_DOCUMENT_ERR DOMException
if parameter doctype was created from a different implementation.
The specification has changed! No exception should be thrown.
Invoke method createDocument(namespaceURI,qualifiedName,doctype) on
a domimplementation that is different from this domimplementation.
Doctype is the type of this document.
@ -123,11 +125,12 @@ function createDocument04() {
success = false;
try {
aNewDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType);
success = true;
}
catch(ex) {
success = (typeof(ex.code) != 'undefined' && ex.code == 4);
success = false;
}
assertTrue("throw_WRONG_DOCUMENT_ERR",success);
assertTrue("no_throw_WRONG_DOCUMENT_ERR",success);
}
}

View File

@ -82,6 +82,8 @@ var docName = 'documentimportnode07';
DocumentType object. Since DocumentType nodes cannot be imported, a
NOT_SUPPORTED_ERR should be raised.
The specification has changed! No exception should be thrown.
* @author IBM
* @author Neil Delima
* @see http://www.w3.org/TR/DOM-Level-2-Core/core
@ -106,11 +108,12 @@ function documentimportnode07() {
success = false;
try {
imported = doc.importNode(docType,true);
success = true;
}
catch(ex) {
success = (typeof(ex.code) != 'undefined' && ex.code == 9);
success = false;
}
assertTrue("throw_NOT_SUPPORTED_ERR",success);
assertTrue("no_throw_NOT_SUPPORTED_ERR",success);
}
}

View File

@ -81,6 +81,8 @@ var docName = 'documentimportnode08';
Using the method importNode with deep=true, try to import a newly created DOcumentType
node. Since DocumentType nodes cannot be imported, a NOT_SUPPORTED_ERR should be raised.
The specification has changed! No exception should be thrown.
* @author IBM
* @author Neil Delima
* @see http://www.w3.org/TR/DOM-Level-2-Core/core
@ -109,11 +111,12 @@ docType = domImpl.createDocumentType("test:root",nullNS,nullNS);
success = false;
try {
imported = doc.importNode(docType,true);
success = true;
}
catch(ex) {
success = (typeof(ex.code) != 'undefined' && ex.code == 9);
success = false;
}
assertTrue("throw_NOT_SUPPORTED_ERR",success);
assertTrue("no_throw_NOT_SUPPORTED_ERR",success);
}
}

View File

@ -80,6 +80,8 @@ var docName = 'domimplementationcreatedocumenttype01';
publicIds and systemIds. Check if the the DocumentType node was created with its
ownerDocument attribute set to null.
The specification has changed! ownerDocument should not be null.
* @author IBM
* @author Neil Delima
* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument
@ -117,7 +119,7 @@ for(var indexN65629 = 0;indexN65629 < publicIds.length; indexN65629++) {
assertNotNull("domimplementationcreatedocumenttype01_newDocType",newDocType);
ownerDocument = newDocType.ownerDocument;
assertNull("domimplementationcreatedocumenttype01_ownerDocument",ownerDocument);
assertNotNull("domimplementationcreatedocumenttype01_ownerDocument",ownerDocument);
}

View File

@ -80,6 +80,8 @@ var docName = 'domimplementationcreatedocumenttype02';
and a valid publicId and systemId. Check if the the DocumentType node was created
with its ownerDocument attribute set to null.
The specification has changed! ownerDocument should not be null.
* @author IBM
* @author Neil Delima
* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType
@ -123,7 +125,7 @@ for(var indexN65655 = 0;indexN65655 < qualifiedNames.length; indexN65655++) {
assertNotNull("domimplementationcreatedocumenttype02_newDocType",newDocType);
ownerDocument = newDocType.ownerDocument;
assertNull("domimplementationcreatedocumenttype02_ownerDocument",ownerDocument);
assertNotNull("domimplementationcreatedocumenttype02_ownerDocument",ownerDocument);
}

View File

@ -82,6 +82,8 @@ var docName = 'importNode16';
The "importNode(importedNode,deep)" method for a
Document should raise NOT_SUPPORTED_ERR DOMException if
the type of node being imported is DocumentType.
The specification has changed! No exception should be thrown.
Retrieve document staff.xml and get its type.
Invoke method importNode(importedNode,deep) where importedNode
@ -120,11 +122,12 @@ function importNode16() {
success = false;
try {
node = doc.importNode(docType,false);
success = true;
}
catch(ex) {
success = (typeof(ex.code) != 'undefined' && ex.code == 9);
success = false;
}
assertTrue("throw_NOT_SUPPORTED_ERR",success);
assertTrue("no_throw_NOT_SUPPORTED_ERR",success);
}
}

View File

@ -79,6 +79,8 @@ var docName = 'nodegetownerdocument01';
Create a new DocumentType node. Since this node is not used with any Document yet
verify if the ownerDocument is null.
The specification has changed! ownerDocument should not be null.
* @author IBM
* @author Neil Delima
* @see http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc
@ -103,7 +105,7 @@ function nodegetownerdocument01() {
docType = domImpl.createDocumentType("mydoc",nullID,nullID);
ownerDoc = docType.ownerDocument;
assertNull("nodegetownerdocument01",ownerDoc);
assertNotNull("nodegetownerdocument01",ownerDoc);
}

View File

@ -2176,8 +2176,7 @@ WorkerPrivateParent<Derived>::ParentJSContext() const
return RuntimeService::AutoSafeJSContext::GetSafeContext();
}
NS_ASSERTION(mParentJSContext ==
static_cast<JSContext*>(mScriptContext->GetNativeContext()),
NS_ASSERTION(mParentJSContext == mScriptContext->GetNativeContext(),
"Native context has changed!");
}
@ -2289,8 +2288,7 @@ WorkerPrivate::Create(JSContext* aCx, JSObject* aObj, WorkerPrivate* aParent,
return nsnull;
}
parentContext =
static_cast<JSContext*>(scriptContext->GetNativeContext());
parentContext = scriptContext->GetNativeContext();
// If we're called from a window then we can dig out the principal and URI
// from the document.

View File

@ -141,34 +141,28 @@ nsPrintingPromptService::ShowProgress(nsIDOMWindow* parent,
*notifyOnOpen = PR_FALSE;
nsPrintProgress* prtProgress = new nsPrintProgress();
nsresult rv = prtProgress->QueryInterface(NS_GET_IID(nsIPrintProgress), (void**)getter_AddRefs(mPrintProgress));
NS_ENSURE_SUCCESS(rv, rv);
mPrintProgress = prtProgress;
mWebProgressListener = prtProgress;
rv = prtProgress->QueryInterface(NS_GET_IID(nsIWebProgressListener), (void**)getter_AddRefs(mWebProgressListener));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrintProgressParams> prtProgressParams = new nsPrintProgressParams();
nsCOMPtr<nsIDOMWindow> parentWindow = parent;
nsPrintProgressParams* prtProgressParams = new nsPrintProgressParams();
rv = prtProgressParams->QueryInterface(NS_GET_IID(nsIPrintProgressParams), (void**)printProgressParams);
NS_ENSURE_SUCCESS(rv, rv);
if (printProgressParams) {
nsCOMPtr<nsIDOMWindow> parentDOMIntl = parent;
if (mWatcher && !parentDOMIntl) {
mWatcher->GetActiveWindow(getter_AddRefs(parentDOMIntl));
}
if (parentDOMIntl) {
mPrintProgress->OpenProgressDialog(parentDOMIntl,
isForPrinting?kPrintProgressDialogURL:kPrtPrvProgressDialogURL,
*printProgressParams, openDialogObserver, notifyOnOpen);
}
if (mWatcher && !parentWindow) {
mWatcher->GetActiveWindow(getter_AddRefs(parentWindow));
}
*webProgressListener = static_cast<nsIWebProgressListener*>(this);
NS_ADDREF(*webProgressListener);
if (parentWindow) {
mPrintProgress->OpenProgressDialog(parentWindow,
isForPrinting ? kPrintProgressDialogURL : kPrtPrvProgressDialogURL,
prtProgressParams, openDialogObserver, notifyOnOpen);
}
return rv;
prtProgressParams.forget(printProgressParams);
nsCOMPtr<nsIWebProgressListener> myWebProgressListener = this;
myWebProgressListener.forget(webProgressListener);
return NS_OK;
}
/* void showPageSetup (in nsIDOMWindow parent, in nsIPrintSettings printSettings); */

View File

@ -144,34 +144,27 @@ nsPrintingPromptService::ShowProgress(nsIDOMWindow* parent,
*notifyOnOpen = PR_FALSE;
nsPrintProgress* prtProgress = new nsPrintProgress(printSettings);
nsresult rv = prtProgress->QueryInterface(NS_GET_IID(nsIPrintProgress), (void**)getter_AddRefs(mPrintProgress));
NS_ENSURE_SUCCESS(rv, rv);
mPrintProgress = prtProgress;
mWebProgressListener = prtProgress;
rv = prtProgress->QueryInterface(NS_GET_IID(nsIWebProgressListener), (void**)getter_AddRefs(mWebProgressListener));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrintProgressParams> prtProgressParams = new nsPrintProgressParams();
nsPrintProgressParams* prtProgressParams = new nsPrintProgressParams();
rv = prtProgressParams->QueryInterface(NS_GET_IID(nsIPrintProgressParams), (void**)printProgressParams);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMWindow> parentWindow = parent;
if (printProgressParams) {
nsCOMPtr<nsIDOMWindow> parentDOMIntl = parent;
if (mWatcher && !parentDOMIntl) {
mWatcher->GetActiveWindow(getter_AddRefs(parentDOMIntl));
}
if (parentDOMIntl) {
mPrintProgress->OpenProgressDialog(parentDOMIntl,
isForPrinting?kPrintProgressDialogURL:kPrtPrvProgressDialogURL,
*printProgressParams, openDialogObserver, notifyOnOpen);
}
if (mWatcher && !parentWindow) {
mWatcher->GetActiveWindow(getter_AddRefs(parentWindow));
}
*webProgressListener = static_cast<nsIWebProgressListener*>(this);
NS_ADDREF(*webProgressListener);
if (parentWindow) {
mPrintProgress->OpenProgressDialog(parentWindow,
isForPrinting ? kPrintProgressDialogURL : kPrtPrvProgressDialogURL,
prtProgressParams, openDialogObserver, notifyOnOpen);
}
return rv;
prtProgressParams.forget(printProgressParams);
NS_ADDREF(*webProgressListener = this);
return NS_OK;
}
/* void showPageSetup (in nsIDOMWindow parent, in nsIPrintSettings printSettings); */

View File

@ -209,42 +209,34 @@ nsPrintingPromptService::ShowProgress(nsIDOMWindow* parent,
NS_ENSURE_ARG(notifyOnOpen);
*notifyOnOpen = PR_FALSE;
if (mPrintProgress)
{
if (mPrintProgress) {
*webProgressListener = nsnull;
*printProgressParams = nsnull;
return NS_ERROR_FAILURE;
}
nsPrintProgress* prtProgress = new nsPrintProgress();
nsresult rv = prtProgress->QueryInterface(NS_GET_IID(nsIPrintProgress), (void**)getter_AddRefs(mPrintProgress));
NS_ENSURE_SUCCESS(rv, rv);
mPrintProgress = prtProgress;
mWebProgressListener = prtProgress;
rv = prtProgress->QueryInterface(NS_GET_IID(nsIWebProgressListener), (void**)getter_AddRefs(mWebProgressListener));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrintProgressParams> prtProgressParams = new nsPrintProgressParams();
nsPrintProgressParams* prtProgressParams = new nsPrintProgressParams();
rv = prtProgressParams->QueryInterface(NS_GET_IID(nsIPrintProgressParams), (void**)printProgressParams);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMWindow> parentWindow = parent;
if (printProgressParams) {
nsCOMPtr<nsIDOMWindow> parentDOMIntl = parent;
if (mWatcher && !parentDOMIntl) {
mWatcher->GetActiveWindow(getter_AddRefs(parentDOMIntl));
}
if (parentDOMIntl) {
mPrintProgress->OpenProgressDialog(parentDOMIntl,
isForPrinting?kPrintProgressDialogURL:kPrtPrvProgressDialogURL,
*printProgressParams, openDialogObserver, notifyOnOpen);
}
if (mWatcher && !parentWindow) {
mWatcher->GetActiveWindow(getter_AddRefs(parentWindow));
}
*webProgressListener = static_cast<nsIWebProgressListener*>(this);
NS_ADDREF(*webProgressListener);
if (parentWindow) {
mPrintProgress->OpenProgressDialog(parentWindow,
isForPrinting ? kPrintProgressDialogURL : kPrtPrvProgressDialogURL,
prtProgressParams, openDialogObserver, notifyOnOpen);
}
return rv;
prtProgressParams.forget(printProgressParams);
NS_ADDREF(*webProgressListener = this);
return NS_OK;
}
/* void showPageSetup (in nsIDOMWindow parent, in nsIPrintSettings printSettings); */

View File

@ -2116,7 +2116,7 @@ nsWindowWatcher::GetJSContextFromWindow(nsIDOMWindow *aWindow)
if (sgo) {
nsIScriptContext *scx = sgo->GetContext();
if (scx)
cx = (JSContext *) scx->GetNativeContext();
cx = scx->GetNativeContext();
}
/* (off-topic note:) the nsIScriptContext can be retrieved by
nsCOMPtr<nsIScriptContext> scx;

View File

@ -269,9 +269,6 @@ nsresult
NS_NewXULTreeBuilder(nsISupports* aOuter, REFNSIID aIID, void** aResult);
#endif
nsresult
NS_NewDOMImplementation(nsIDOMDOMImplementation**);
static void Shutdown();
#ifdef MOZ_XTF
@ -510,7 +507,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(inDOMUtils)
MAKE_CTOR(CreateNameSpaceManager, nsINameSpaceManager, NS_GetNameSpaceManager)
MAKE_CTOR(CreateDocumentViewer, nsIDocumentViewer, NS_NewDocumentViewer)
MAKE_CTOR(CreateHTMLDocument, nsIDocument, NS_NewHTMLDocument)
MAKE_CTOR(CreateDOMImplementation, nsIDOMDOMImplementation, NS_NewDOMImplementation)
MAKE_CTOR(CreateXMLDocument, nsIDocument, NS_NewXMLDocument)
MAKE_CTOR(CreateSVGDocument, nsIDocument, NS_NewSVGDocument)
MAKE_CTOR(CreateImageDocument, nsIDocument, NS_NewImageDocument)
@ -746,7 +742,6 @@ NS_DEFINE_NAMED_CID(IN_DOMUTILS_CID);
NS_DEFINE_NAMED_CID(NS_NAMESPACEMANAGER_CID);
NS_DEFINE_NAMED_CID(NS_DOCUMENT_VIEWER_CID);
NS_DEFINE_NAMED_CID(NS_HTMLDOCUMENT_CID);
NS_DEFINE_NAMED_CID(NS_DOM_IMPLEMENTATION_CID);
NS_DEFINE_NAMED_CID(NS_XMLDOCUMENT_CID);
NS_DEFINE_NAMED_CID(NS_SVGDOCUMENT_CID);
NS_DEFINE_NAMED_CID(NS_IMAGEDOCUMENT_CID);
@ -881,7 +876,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
{ &kNS_NAMESPACEMANAGER_CID, false, NULL, CreateNameSpaceManager },
{ &kNS_DOCUMENT_VIEWER_CID, false, NULL, CreateDocumentViewer },
{ &kNS_HTMLDOCUMENT_CID, false, NULL, CreateHTMLDocument },
{ &kNS_DOM_IMPLEMENTATION_CID, false, NULL, CreateDOMImplementation },
{ &kNS_XMLDOCUMENT_CID, false, NULL, CreateXMLDocument },
{ &kNS_SVGDOCUMENT_CID, false, NULL, CreateSVGDocument },
{ &kNS_IMAGEDOCUMENT_CID, false, NULL, CreateImageDocument },

View File

@ -1059,7 +1059,6 @@ void nsDisplaySelectionOverlay::Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx)
{
LookAndFeel::ColorID colorID;
nsresult result;
if (mSelectionValue == nsISelectionController::SELECTION_ON) {
colorID = LookAndFeel::eColorID_TextSelectBackground;
} else if (mSelectionValue == nsISelectionController::SELECTION_ATTENTION) {

View File

@ -2543,7 +2543,7 @@ nsObjectFrame::NotifyContentObjectWrapper()
if (!scx)
return;
JSContext *cx = (JSContext *)scx->GetNativeContext();
JSContext *cx = scx->GetNativeContext();
nsCOMPtr<nsIXPConnectWrappedNative> wrapper;
nsContentUtils::XPConnect()->

View File

@ -1,30 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
class="reftest-wait">
<!-- Tests for "rotate" interacting with the transform attribute. -->
<script xlink:href="../smil-util.js" type="text/javascript"/>
<script type="text/javascript">
function doTest() {
setTimeAndSnapshot(1, false);
}
window.addEventListener("MozReftestInvalidate", doTest, false);
</script>
<!-- Big green background to match lime.svg -->
<rect height="100%" width="100%" fill="lime"/>
<!-- A "shadow" rect (should be covered up by green rect). The only difference
between this rect and the other one is that this rect has the
|transform| attr set on its <g> parent instead of on it directly. -->
<g transform="translate(0, 50)">
<rect width="50" height="50" fill="red">
<animateMotion begin="0s" dur="1s" fill="freeze" rotate="90"
path="M50 0 h50"/>
</rect>
</g>
<rect width="50" height="50" fill="lime" transform="translate(0, 50)">
<animateMotion begin="0s" dur="1s" fill="freeze" rotate="90"
path="M50 0 h50"/>
</rect>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -8,7 +8,6 @@
== animateMotion-rotate-1a.svg lime.svg
== animateMotion-rotate-1b.svg lime.svg
== animateMotion-rotate-2.svg lime.svg
== animateMotion-rotate-3.svg lime.svg
== animateMotion-to-overridden-1.svg lime.svg
== animateMotion-values-linear-1.svg animateMotion-values-linear-1-ref.svg
== animateMotion-values-paced-1a.svg animateMotion-values-paced-1-ref.svg

View File

@ -630,7 +630,7 @@ nsHtml5TreeOpExecutor::IsScriptEnabled()
}
nsIScriptContext *scriptContext = globalObject->GetContext();
NS_ENSURE_TRUE(scriptContext, PR_TRUE);
JSContext* cx = (JSContext *) scriptContext->GetNativeContext();
JSContext* cx = scriptContext->GetNativeContext();
NS_ENSURE_TRUE(cx, PR_TRUE);
PRBool enabled = PR_TRUE;
nsContentUtils::GetSecurityManager()->

View File

@ -592,7 +592,6 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
voidString.SetIsVoid(PR_TRUE);
NS_NewDOMDocumentType(getter_AddRefs(docType),
aBuilder->GetNodeInfoManager(),
nsnull,
name,
publicId,
systemId,

View File

@ -266,7 +266,6 @@ MAKEFILES_content="
content/xslt/src/xml/Makefile
content/xslt/src/xpath/Makefile
content/xslt/src/xslt/Makefile
content/xslt/src/main/Makefile
"
MAKEFILES_layout="
@ -682,7 +681,6 @@ MAKEFILES_jsreflect="
MAKEFILES_jsductwork="
js/ductwork/Makefile
js/ductwork/debugger/Makefile
js/ductwork/debugger/tests/Makefile
"
MAKEFILES_libpr0n="

View File

@ -262,6 +262,8 @@ class nsHashKey;
#define NS_MOUSE_ENTER_SYNTH (NS_MOUSE_MESSAGE_START + 31)
#define NS_MOUSE_EXIT_SYNTH (NS_MOUSE_MESSAGE_START + 32)
#define NS_MOUSE_MOZHITTEST (NS_MOUSE_MESSAGE_START + 33)
#define NS_MOUSEENTER (NS_MOUSE_MESSAGE_START + 34)
#define NS_MOUSELEAVE (NS_MOUSE_MESSAGE_START + 35)
#define NS_CONTEXTMENU_MESSAGE_START 500
#define NS_CONTEXTMENU (NS_CONTEXTMENU_MESSAGE_START)
@ -878,8 +880,16 @@ protected:
acceptActivation(PR_FALSE), ignoreRootScrollFrame(PR_FALSE),
reason(aReason), context(eNormal), exit(eChild), clickCount(0)
{
if (msg == NS_MOUSE_MOVE) {
flags |= NS_EVENT_FLAG_CANT_CANCEL;
switch (msg) {
case NS_MOUSE_MOVE:
flags |= NS_EVENT_FLAG_CANT_CANCEL;
break;
case NS_MOUSEENTER:
case NS_MOUSELEAVE:
flags |= (NS_EVENT_FLAG_CANT_CANCEL & NS_EVENT_FLAG_CANT_BUBBLE);
break;
default:
break;
}
}
@ -891,12 +901,22 @@ public:
acceptActivation(PR_FALSE), ignoreRootScrollFrame(PR_FALSE),
reason(aReason), context(aContext), exit(eChild), clickCount(0)
{
if (msg == NS_MOUSE_MOVE) {
flags |= NS_EVENT_FLAG_CANT_CANCEL;
} else if (msg == NS_CONTEXTMENU) {
button = (context == eNormal) ? eRightButton : eLeftButton;
switch (msg) {
case NS_MOUSE_MOVE:
flags |= NS_EVENT_FLAG_CANT_CANCEL;
break;
case NS_MOUSEENTER:
case NS_MOUSELEAVE:
flags |= (NS_EVENT_FLAG_CANT_CANCEL | NS_EVENT_FLAG_CANT_BUBBLE);
break;
case NS_CONTEXTMENU:
button = (context == eNormal) ? eRightButton : eLeftButton;
break;
default:
break;
}
}
#ifdef NS_DEBUG
~nsMouseEvent() {
NS_WARN_IF_FALSE(message != NS_CONTEXTMENU ||

View File

@ -451,7 +451,7 @@ nsAppShellService::GetHiddenWindowAndJSContext(nsIDOMWindow **aWindow,
if (!scriptContext) { rv = NS_ERROR_FAILURE; break; }
// 5. Get JSContext from the script context.
JSContext *jsContext = (JSContext*)scriptContext->GetNativeContext();
JSContext *jsContext = scriptContext->GetNativeContext();
if (!jsContext) { rv = NS_ERROR_FAILURE; break; }
// Now, give results to caller.

View File

@ -198,8 +198,7 @@ nsHTTPIndex::OnFTPControlLog(PRBool server, const char *msg)
nsIScriptContext *context = scriptGlobal->GetContext();
NS_ENSURE_TRUE(context, NS_OK);
JSContext* cx = reinterpret_cast<JSContext*>
(context->GetNativeContext());
JSContext* cx = context->GetNativeContext();
NS_ENSURE_TRUE(cx, NS_OK);
JSObject* global = JS_GetGlobalObject(cx);
@ -276,8 +275,7 @@ nsHTTPIndex::OnStartRequest(nsIRequest *request, nsISupports* aContext)
nsIScriptContext *context = scriptGlobal->GetContext();
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
JSContext* cx = reinterpret_cast<JSContext*>
(context->GetNativeContext());
JSContext* cx = context->GetNativeContext();
JSObject* global = JS_GetGlobalObject(cx);
// Using XPConnect, wrap the HTTP index object...

View File

@ -744,7 +744,7 @@ nsresult InitInstallTriggerGlobalClass(JSContext *jscontext, JSObject *global, v
//
nsresult NS_InitInstallTriggerGlobalClass(nsIScriptContext *aContext, void **aPrototype)
{
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
JSContext *jscontext = aContext->GetNativeContext();
JSObject *proto = nsnull;
JSObject *constructor = nsnull;
JSObject *global = JS_GetGlobalObject(jscontext);
@ -789,7 +789,7 @@ NS_NewScriptInstallTriggerGlobal(nsIScriptContext *aContext,
JSObject *proto;
JSObject *parent = nsnull;
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
JSContext *jscontext = aContext->GetNativeContext();
nsresult result = NS_OK;
nsIDOMInstallTriggerGlobal *installTriggerGlobal;