зеркало из https://github.com/mozilla/gecko-dev.git
Backing out changesets 2ea77fa990af, 7d2d8869e73c, 93441e4f521e, 43d2ee100f3b, a2d84821ea71 to see whether they're causing the Windows Txul or Mac Tp regressions
This commit is contained in:
Родитель
f86486c059
Коммит
9599df476b
|
@ -807,13 +807,6 @@ public:
|
|||
*/
|
||||
static PRBool IsChromeDoc(nsIDocument *aDocument);
|
||||
|
||||
/**
|
||||
* Returns true if aDocument belongs to a chrome docshell for
|
||||
* display purposes. Returns false for null documents or documents
|
||||
* which do not belong to a docshell.
|
||||
*/
|
||||
static PRBool IsInChromeDocshell(nsIDocument *aDocument);
|
||||
|
||||
/**
|
||||
* Release *aSupportsPtr when the shutdown notification is received
|
||||
*/
|
||||
|
|
|
@ -52,13 +52,13 @@
|
|||
#include "nsCompatibility.h"
|
||||
#include "nsTObserverArray.h"
|
||||
#include "nsNodeInfoManager.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIObserver.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsPresContext;
|
||||
class nsIPresShell;
|
||||
class nsIDocShell;
|
||||
class nsIStreamListener;
|
||||
class nsIStreamObserver;
|
||||
class nsStyleSet;
|
||||
class nsIStyleSheet;
|
||||
class nsIStyleRule;
|
||||
|
@ -77,6 +77,7 @@ class nsIChannel;
|
|||
class nsIPrincipal;
|
||||
class nsIDOMDocument;
|
||||
class nsIDOMDocumentType;
|
||||
class nsIObserver;
|
||||
class nsScriptLoader;
|
||||
class nsIContentSink;
|
||||
class nsIScriptEventManager;
|
||||
|
@ -96,8 +97,8 @@ class nsFrameLoader;
|
|||
|
||||
// IID for the nsIDocument interface
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0x189ebc9e, 0x779b, 0x4c49, \
|
||||
{ 0x90, 0x8b, 0x9a, 0x80, 0x25, 0x9b, 0xaf, 0xa7 } }
|
||||
{ 0xd5b1e3c5, 0x85dc, 0x403e, \
|
||||
{ 0xbb, 0x4a, 0x54, 0x66, 0xdc, 0xbe, 0x15, 0x69 } }
|
||||
|
||||
// Flag for AddStyleSheet().
|
||||
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
|
||||
|
@ -1003,98 +1004,6 @@ public:
|
|||
virtual void TryCancelFrameLoaderInitialization(nsIDocShell* aShell) = 0;
|
||||
// Returns true if the frame loader of aShell is in the finalization list.
|
||||
virtual PRBool FrameLoaderScheduledToBeFinalized(nsIDocShell* aShell) = 0;
|
||||
|
||||
/**
|
||||
* Check whether this document is a root document that is not an
|
||||
* external resource.
|
||||
*/
|
||||
PRBool IsRootDisplayDocument() const
|
||||
{
|
||||
return !mParentDocument && !mDisplayDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the document for which this document is an external resource. This
|
||||
* will be null if this document is not an external resource. Otherwise,
|
||||
* GetDisplayDocument() will return a non-null document, and
|
||||
* GetDisplayDocument()->GetDisplayDocument() is guaranteed to be null.
|
||||
*/
|
||||
nsIDocument* GetDisplayDocument() const
|
||||
{
|
||||
return mDisplayDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the display document for this document. aDisplayDocument must not be
|
||||
* null.
|
||||
*/
|
||||
void SetDisplayDocument(nsIDocument* aDisplayDocument)
|
||||
{
|
||||
NS_PRECONDITION(!GetPrimaryShell() &&
|
||||
!nsCOMPtr<nsISupports>(GetContainer()) &&
|
||||
!GetWindow() &&
|
||||
!GetScriptGlobalObject(),
|
||||
"Shouldn't set mDisplayDocument on documents that already "
|
||||
"have a presentation or a docshell or a window");
|
||||
NS_PRECONDITION(aDisplayDocument != this, "Should be different document");
|
||||
NS_PRECONDITION(!aDisplayDocument->GetDisplayDocument(),
|
||||
"Display documents should not nest");
|
||||
mDisplayDocument = aDisplayDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* A class that represents an external resource load that has begun but
|
||||
* doesn't have a document yet. Observers can be registered on this object,
|
||||
* and will be notified after the document is created. Observers registered
|
||||
* after the document has been created will NOT be notified. When observers
|
||||
* are notified, the subject will be the newly-created document, the topic
|
||||
* will be "external-resource-document-created", and the data will be null.
|
||||
* If document creation fails for some reason, observers will still be
|
||||
* notified, with a null document pointer.
|
||||
*/
|
||||
class ExternalResourceLoad : public nsISupports
|
||||
{
|
||||
public:
|
||||
virtual ~ExternalResourceLoad() {}
|
||||
|
||||
void AddObserver(nsIObserver* aObserver) {
|
||||
NS_PRECONDITION(aObserver, "Must have observer");
|
||||
mObservers.AppendElement(aObserver);
|
||||
}
|
||||
|
||||
const nsTArray< nsCOMPtr<nsIObserver> > & Observers() {
|
||||
return mObservers;
|
||||
}
|
||||
protected:
|
||||
nsAutoTArray< nsCOMPtr<nsIObserver>, 8 > mObservers;
|
||||
};
|
||||
|
||||
/**
|
||||
* Request an external resource document for aURI. This will return the
|
||||
* resource document if available. If one is not available yet, it will
|
||||
* start loading as needed, and the pending load object will be returned in
|
||||
* aPendingLoad so that the caller can register an observer to wait for the
|
||||
* load. If this function returns null and doesn't return a pending load,
|
||||
* that means that there is no resource document for this URI and won't be
|
||||
* one in the future.
|
||||
*
|
||||
* @param aURI the URI to get
|
||||
* @param aRequestingNode the node making the request
|
||||
* @param aPendingLoad the pending load for this request, if any
|
||||
*/
|
||||
virtual nsIDocument*
|
||||
RequestExternalResource(nsIURI* aURI,
|
||||
nsINode* aRequestingNode,
|
||||
ExternalResourceLoad** aPendingLoad) = 0;
|
||||
|
||||
/**
|
||||
* Enumerate the external resource documents associated with this document.
|
||||
* The enumerator callback should return PR_TRUE to continue enumerating, or
|
||||
* PR_FALSE to stop.
|
||||
*/
|
||||
virtual void EnumerateExternalResources(nsSubDocEnumFunc aCallback,
|
||||
void* aData) = 0;
|
||||
|
||||
protected:
|
||||
~nsIDocument()
|
||||
{
|
||||
|
@ -1191,11 +1100,6 @@ protected:
|
|||
nsCOMArray<nsINode> mSubtreeModifiedTargets;
|
||||
PRUint32 mSubtreeModifiedDepth;
|
||||
|
||||
// If we're an external resource document, this will be non-null and will
|
||||
// point to our "display document": the one that all resource lookups should
|
||||
// go to.
|
||||
nsCOMPtr<nsIDocument> mDisplayDocument;
|
||||
|
||||
private:
|
||||
// JSObject cache. Only to be used for performance
|
||||
// optimizations. This will be set once this document is touched
|
||||
|
|
|
@ -70,6 +70,9 @@ public:
|
|||
nsReferencedElement() {}
|
||||
~nsReferencedElement() {
|
||||
Unlink();
|
||||
if (mPendingNotification) {
|
||||
mPendingNotification->Clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -111,42 +114,15 @@ protected:
|
|||
* a persistent notification.
|
||||
*/
|
||||
virtual PRBool IsPersistent() { return PR_FALSE; }
|
||||
|
||||
/**
|
||||
* Set ourselves up with our new document. Note that aDocument might be
|
||||
* null. Either aWatch must be false or aRef must be empty.
|
||||
*/
|
||||
void HaveNewDocument(nsIDocument* aDocument, PRBool aWatch,
|
||||
const nsString& aRef);
|
||||
|
||||
private:
|
||||
static PRBool Observe(nsIContent* aOldContent,
|
||||
nsIContent* aNewContent, void* aData);
|
||||
|
||||
class Notification : public nsISupports {
|
||||
class Notification : public nsRunnable {
|
||||
public:
|
||||
virtual void SetTo(nsIContent* aTo) = 0;
|
||||
virtual void Clear() { mTarget = nsnull; }
|
||||
virtual ~Notification() {}
|
||||
protected:
|
||||
Notification(nsReferencedElement* aTarget)
|
||||
: mTarget(aTarget)
|
||||
{
|
||||
NS_PRECONDITION(aTarget, "Must have a target");
|
||||
}
|
||||
nsReferencedElement* mTarget;
|
||||
};
|
||||
|
||||
class ChangeNotification : public nsRunnable,
|
||||
public Notification
|
||||
{
|
||||
public:
|
||||
ChangeNotification(nsReferencedElement* aTarget, nsIContent* aFrom, nsIContent* aTo)
|
||||
: Notification(aTarget), mFrom(aFrom), mTo(aTo)
|
||||
{}
|
||||
virtual ~ChangeNotification() {}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
Notification(nsReferencedElement* aTarget, nsIContent* aFrom, nsIContent* aTo)
|
||||
: mTarget(aTarget), mFrom(aFrom), mTo(aTo) {}
|
||||
NS_IMETHOD Run() {
|
||||
if (mTarget) {
|
||||
mTarget->mPendingNotification = nsnull;
|
||||
|
@ -154,40 +130,15 @@ private:
|
|||
}
|
||||
return NS_OK;
|
||||
}
|
||||
virtual void SetTo(nsIContent* aTo) { mTo = aTo; }
|
||||
virtual void Clear()
|
||||
{
|
||||
Notification::Clear(); mFrom = nsnull; mTo = nsnull;
|
||||
}
|
||||
protected:
|
||||
void SetTo(nsIContent* aTo) { mTo = aTo; }
|
||||
void Clear() { mTarget = nsnull; mFrom = nsnull; mTo = nsnull; }
|
||||
private:
|
||||
nsReferencedElement* mTarget;
|
||||
nsCOMPtr<nsIContent> mFrom;
|
||||
nsCOMPtr<nsIContent> mTo;
|
||||
};
|
||||
friend class ChangeNotification;
|
||||
friend class Notification;
|
||||
|
||||
class DocumentLoadNotification : public Notification,
|
||||
public nsIObserver
|
||||
{
|
||||
public:
|
||||
DocumentLoadNotification(nsReferencedElement* aTarget,
|
||||
const nsString& aRef) :
|
||||
Notification(aTarget)
|
||||
{
|
||||
if (!mTarget->IsPersistent()) {
|
||||
mRef = aRef;
|
||||
}
|
||||
}
|
||||
virtual ~DocumentLoadNotification() {}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
private:
|
||||
virtual void SetTo(nsIContent* aTo) { }
|
||||
|
||||
nsString mRef;
|
||||
};
|
||||
friend class DocumentLoadNotification;
|
||||
|
||||
nsCOMPtr<nsIAtom> mWatchID;
|
||||
nsCOMPtr<nsIDocument> mWatchDocument;
|
||||
nsCOMPtr<nsIContent> mContent;
|
||||
|
|
|
@ -2903,28 +2903,6 @@ nsContentUtils::IsChromeDoc(nsIDocument *aDocument)
|
|||
return aDocument->NodePrincipal() == systemPrincipal;
|
||||
}
|
||||
|
||||
// static
|
||||
PRBool
|
||||
nsContentUtils::IsInChromeDocshell(nsIDocument *aDocument)
|
||||
{
|
||||
if (!aDocument) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
if (aDocument->GetDisplayDocument()) {
|
||||
return IsInChromeDocshell(aDocument->GetDisplayDocument());
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> docContainer = aDocument->GetContainer();
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShell(do_QueryInterface(docContainer));
|
||||
PRInt32 itemType = nsIDocShellTreeItem::typeContent;
|
||||
if (docShell) {
|
||||
docShell->GetItemType(&itemType);
|
||||
}
|
||||
|
||||
return itemType == nsIDocShellTreeItem::typeChrome;
|
||||
}
|
||||
|
||||
// static
|
||||
nsIContentPolicy*
|
||||
nsContentUtils::GetContentPolicy()
|
||||
|
|
|
@ -72,28 +72,7 @@ nsDataDocumentContentPolicy::ShouldLoad(PRUint32 aContentType,
|
|||
doc = do_QueryInterface(domDoc);
|
||||
}
|
||||
}
|
||||
|
||||
// DTDs are always OK to load
|
||||
if (!doc || aContentType == nsIContentPolicy::TYPE_DTD) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Nothing else is OK to load for data documents
|
||||
if (doc->IsLoadedAsData()) {
|
||||
*aDecision = nsIContentPolicy::REJECT_TYPE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Allow all loads for non-external-resource documents
|
||||
if (!doc->GetDisplayDocument()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// For external resources, blacklist some load types
|
||||
if (aContentType == nsIContentPolicy::TYPE_OBJECT ||
|
||||
aContentType == nsIContentPolicy::TYPE_DOCUMENT ||
|
||||
aContentType == nsIContentPolicy::TYPE_SUBDOCUMENT ||
|
||||
aContentType == nsIContentPolicy::TYPE_SCRIPT) {
|
||||
if (aContentType != nsIContentPolicy::TYPE_DTD && doc && doc->IsLoadedAsData()) {
|
||||
*aDecision = nsIContentPolicy::REJECT_TYPE;
|
||||
}
|
||||
|
||||
|
|
|
@ -157,23 +157,11 @@ static NS_DEFINE_CID(kDOMEventGroupCID, NS_DOMEVENTGROUP_CID);
|
|||
#include "nsCycleCollector.h"
|
||||
#include "nsCCUncollectableMarker.h"
|
||||
#include "nsIContentPolicy.h"
|
||||
#include "nsContentPolicyUtils.h"
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsIDocumentLoaderFactory.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIXMLContentSink.h"
|
||||
#include "nsIChannelEventSink.h"
|
||||
#include "nsContentErrors.h"
|
||||
#include "nsIXULDocument.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
#include "nsISecurityEventSink.h"
|
||||
#include "nsIPrompt.h"
|
||||
|
||||
#include "nsFrameLoader.h"
|
||||
|
||||
#include "mozAutoDocUpdate.h"
|
||||
|
||||
|
||||
#ifdef MOZ_LOGGING
|
||||
// so we can get logging even in release builds
|
||||
#define FORCE_PR_LOG 1
|
||||
|
@ -730,433 +718,6 @@ nsOnloadBlocker::SetLoadFlags(nsLoadFlags aLoadFlags)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// ==================================================================
|
||||
|
||||
nsExternalResourceMap::nsExternalResourceMap()
|
||||
: mHaveShutDown(PR_FALSE)
|
||||
{
|
||||
mMap.Init();
|
||||
mPendingLoads.Init();
|
||||
}
|
||||
|
||||
nsIDocument*
|
||||
nsExternalResourceMap::RequestResource(nsIURI* aURI,
|
||||
nsINode* aRequestingNode,
|
||||
nsDocument* aDisplayDocument,
|
||||
ExternalResourceLoad** aPendingLoad)
|
||||
{
|
||||
// If we ever start allowing non-same-origin loads here, we might need to do
|
||||
// something interesting with aRequestingPrincipal even for the hashtable
|
||||
// gets.
|
||||
NS_PRECONDITION(aURI, "Must have a URI");
|
||||
NS_PRECONDITION(aRequestingNode, "Must have a node");
|
||||
*aPendingLoad = nsnull;
|
||||
if (mHaveShutDown) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// First, make sure we strip the ref from aURI.
|
||||
nsCOMPtr<nsIURI> clone;
|
||||
aURI->Clone(getter_AddRefs(clone));
|
||||
if (!clone) {
|
||||
return nsnull;
|
||||
}
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(clone));
|
||||
if (url) {
|
||||
url->SetRef(EmptyCString());
|
||||
}
|
||||
|
||||
ExternalResource* resource;
|
||||
mMap.Get(clone, &resource);
|
||||
if (resource) {
|
||||
return resource->mDocument;
|
||||
}
|
||||
|
||||
nsRefPtr<PendingLoad> load;
|
||||
mPendingLoads.Get(clone, getter_AddRefs(load));
|
||||
if (load) {
|
||||
NS_ADDREF(*aPendingLoad = load);
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
load = new PendingLoad(aDisplayDocument);
|
||||
if (!load) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (!mPendingLoads.Put(clone, load)) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (NS_FAILED(load->StartLoad(clone, aRequestingNode))) {
|
||||
// Make sure we don't thrash things by trying this load again, since
|
||||
// chances are it failed for good reasons (security check, etc).
|
||||
AddExternalResource(clone, nsnull, nsnull, aDisplayDocument);
|
||||
} else {
|
||||
NS_ADDREF(*aPendingLoad = load);
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
struct
|
||||
nsExternalResourceEnumArgs
|
||||
{
|
||||
nsIDocument::nsSubDocEnumFunc callback;
|
||||
void *data;
|
||||
};
|
||||
|
||||
PR_STATIC_CALLBACK(PLDHashOperator)
|
||||
ExternalResourceEnumerator(nsIURI* aKey,
|
||||
nsExternalResourceMap::ExternalResource* aData,
|
||||
void* aClosure)
|
||||
{
|
||||
nsExternalResourceEnumArgs* args =
|
||||
static_cast<nsExternalResourceEnumArgs*>(aClosure);
|
||||
PRBool next = args->callback(aData->mDocument, args->data);
|
||||
return next ? PL_DHASH_NEXT : PL_DHASH_STOP;
|
||||
}
|
||||
|
||||
void
|
||||
nsExternalResourceMap::EnumerateResources(nsIDocument::nsSubDocEnumFunc aCallback,
|
||||
void* aData)
|
||||
{
|
||||
nsExternalResourceEnumArgs args = { aCallback, aData };
|
||||
mMap.EnumerateRead(ExternalResourceEnumerator, &args);
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(PLDHashOperator)
|
||||
ExternalResourceTraverser(nsIURI* aKey,
|
||||
nsExternalResourceMap::ExternalResource* aData,
|
||||
void* aClosure)
|
||||
{
|
||||
nsCycleCollectionTraversalCallback *cb =
|
||||
static_cast<nsCycleCollectionTraversalCallback*>(aClosure);
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb,
|
||||
"mExternalResourceMap.mMap entry"
|
||||
"->mDocument");
|
||||
cb->NoteXPCOMChild(aData->mDocument);
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb,
|
||||
"mExternalResourceMap.mMap entry"
|
||||
"->mViewer");
|
||||
cb->NoteXPCOMChild(aData->mViewer);
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb,
|
||||
"mExternalResourceMap.mMap entry"
|
||||
"->mLoadGroup");
|
||||
cb->NoteXPCOMChild(aData->mLoadGroup);
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
void
|
||||
nsExternalResourceMap::Traverse(nsCycleCollectionTraversalCallback* aCallback) const
|
||||
{
|
||||
// mPendingLoads will get cleared out as the requests complete, so
|
||||
// no need to worry about those here.
|
||||
mMap.EnumerateRead(ExternalResourceTraverser, aCallback);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsExternalResourceMap::AddExternalResource(nsIURI* aURI,
|
||||
nsIDocumentViewer* aViewer,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
nsIDocument* aDisplayDocument)
|
||||
{
|
||||
NS_PRECONDITION(aURI, "Unexpected call");
|
||||
NS_PRECONDITION((aViewer && aLoadGroup) || (!aViewer && !aLoadGroup),
|
||||
"Must have both or neither");
|
||||
|
||||
nsRefPtr<PendingLoad> load;
|
||||
mPendingLoads.Get(aURI, getter_AddRefs(load));
|
||||
mPendingLoads.Remove(aURI);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
if (aViewer) {
|
||||
aViewer->GetDocument(getter_AddRefs(doc));
|
||||
NS_ASSERTION(doc, "Must have a document");
|
||||
|
||||
nsCOMPtr<nsIXULDocument> xulDoc = do_QueryInterface(doc);
|
||||
if (xulDoc) {
|
||||
// We don't handle XUL stuff here yet.
|
||||
rv = NS_ERROR_NOT_AVAILABLE;
|
||||
} else {
|
||||
doc->SetDisplayDocument(aDisplayDocument);
|
||||
|
||||
rv = aViewer->Init(nsnull, nsRect(0, 0, 0, 0));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = aViewer->Open(nsnull, nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
doc = nsnull;
|
||||
aViewer = nsnull;
|
||||
aLoadGroup = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
ExternalResource* newResource = new ExternalResource();
|
||||
if (newResource && !mMap.Put(aURI, newResource)) {
|
||||
delete newResource;
|
||||
newResource = nsnull;
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
if (newResource) {
|
||||
newResource->mDocument = doc;
|
||||
newResource->mViewer = aViewer;
|
||||
newResource->mLoadGroup = aLoadGroup;
|
||||
}
|
||||
|
||||
const nsTArray< nsCOMPtr<nsIObserver> > & obs = load->Observers();
|
||||
for (PRUint32 i = 0; i < obs.Length(); ++i) {
|
||||
obs[i]->Observe(doc, "external-resource-document-created", nsnull);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsExternalResourceMap::PendingLoad,
|
||||
nsIStreamListener,
|
||||
nsIRequestObserver)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExternalResourceMap::PendingLoad::OnStartRequest(nsIRequest *aRequest,
|
||||
nsISupports *aContext)
|
||||
{
|
||||
nsExternalResourceMap& map = mDisplayDocument->ExternalResourceMap();
|
||||
if (map.HaveShutDown()) {
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocumentViewer> viewer;
|
||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||
nsresult rv = SetupViewer(aRequest, getter_AddRefs(viewer),
|
||||
getter_AddRefs(loadGroup));
|
||||
|
||||
// Make sure to do this no matter what
|
||||
nsresult rv2 = map.AddExternalResource(mURI, viewer, loadGroup,
|
||||
mDisplayDocument);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
if (NS_FAILED(rv2)) {
|
||||
mTargetListener = nsnull;
|
||||
return rv2;
|
||||
}
|
||||
|
||||
return mTargetListener->OnStartRequest(aRequest, aContext);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsExternalResourceMap::PendingLoad::SetupViewer(nsIRequest* aRequest,
|
||||
nsIDocumentViewer** aViewer,
|
||||
nsILoadGroup** aLoadGroup)
|
||||
{
|
||||
NS_PRECONDITION(!mTargetListener, "Unexpected call to OnStartRequest");
|
||||
*aViewer = nsnull;
|
||||
*aLoadGroup = nsnull;
|
||||
|
||||
nsCOMPtr<nsIChannel> chan(do_QueryInterface(aRequest));
|
||||
NS_ENSURE_TRUE(chan, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(aRequest));
|
||||
if (httpChannel) {
|
||||
PRBool requestSucceeded;
|
||||
if (NS_FAILED(httpChannel->GetRequestSucceeded(&requestSucceeded)) ||
|
||||
!requestSucceeded) {
|
||||
// Bail out on this load, since it looks like we have an HTTP error page
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
}
|
||||
|
||||
nsCAutoString type;
|
||||
chan->GetContentType(type);
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||
chan->GetLoadGroup(getter_AddRefs(loadGroup));
|
||||
|
||||
// Give this document its own loadgroup
|
||||
nsCOMPtr<nsILoadGroup> newLoadGroup =
|
||||
do_CreateInstance(NS_LOADGROUP_CONTRACTID);
|
||||
NS_ENSURE_TRUE(newLoadGroup, NS_ERROR_OUT_OF_MEMORY);
|
||||
newLoadGroup->SetLoadGroup(loadGroup);
|
||||
|
||||
nsCOMPtr<nsIInterfaceRequestor> callbacks;
|
||||
loadGroup->GetNotificationCallbacks(getter_AddRefs(callbacks));
|
||||
|
||||
nsCOMPtr<nsIInterfaceRequestor> newCallbacks =
|
||||
new LoadgroupCallbacks(callbacks);
|
||||
newLoadGroup->SetNotificationCallbacks(newCallbacks);
|
||||
|
||||
// This is some serious hackery cribbed from docshell
|
||||
nsCOMPtr<nsICategoryManager> catMan =
|
||||
do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
|
||||
NS_ENSURE_TRUE(catMan, NS_ERROR_NOT_AVAILABLE);
|
||||
nsXPIDLCString contractId;
|
||||
nsresult rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", type.get(),
|
||||
getter_Copies(contractId));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIDocumentLoaderFactory> docLoaderFactory =
|
||||
do_GetService(contractId);
|
||||
NS_ENSURE_TRUE(docLoaderFactory, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
nsCOMPtr<nsIContentViewer> viewer;
|
||||
nsCOMPtr<nsIStreamListener> listener;
|
||||
rv = docLoaderFactory->CreateInstance("external-resource", chan, newLoadGroup,
|
||||
type.get(), nsnull, nsnull,
|
||||
getter_AddRefs(listener),
|
||||
getter_AddRefs(viewer));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDocumentViewer> docViewer = do_QueryInterface(viewer);
|
||||
NS_ENSURE_TRUE(docViewer, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsCOMPtr<nsIParser> parser = do_QueryInterface(listener);
|
||||
if (!parser) {
|
||||
/// We don't want to deal with the various fake documents yet
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// We can't handle HTML and other weird things here yet.
|
||||
nsIContentSink* sink = parser->GetContentSink();
|
||||
nsCOMPtr<nsIXMLContentSink> xmlSink = do_QueryInterface(sink);
|
||||
if (!xmlSink) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
listener.swap(mTargetListener);
|
||||
docViewer.swap(*aViewer);
|
||||
newLoadGroup.swap(*aLoadGroup);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExternalResourceMap::PendingLoad::OnDataAvailable(nsIRequest* aRequest,
|
||||
nsISupports* aContext,
|
||||
nsIInputStream* aStream,
|
||||
PRUint32 aOffset,
|
||||
PRUint32 aCount)
|
||||
{
|
||||
NS_PRECONDITION(mTargetListener, "Shouldn't be getting called!");
|
||||
if (mDisplayDocument->ExternalResourceMap().HaveShutDown()) {
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
return mTargetListener->OnDataAvailable(aRequest, aContext, aStream, aOffset,
|
||||
aCount);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExternalResourceMap::PendingLoad::OnStopRequest(nsIRequest* aRequest,
|
||||
nsISupports* aContext,
|
||||
nsresult aStatus)
|
||||
{
|
||||
// mTargetListener might be null if SetupViewer or AddExternalResource failed
|
||||
if (mTargetListener) {
|
||||
nsCOMPtr<nsIStreamListener> listener;
|
||||
mTargetListener.swap(listener);
|
||||
return listener->OnStopRequest(aRequest, aContext, aStatus);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsExternalResourceMap::PendingLoad::StartLoad(nsIURI* aURI,
|
||||
nsINode* aRequestingNode)
|
||||
{
|
||||
NS_PRECONDITION(aURI, "Must have a URI");
|
||||
NS_PRECONDITION(aRequestingNode, "Must have a node");
|
||||
|
||||
// Time to start a load. First, the security checks.
|
||||
|
||||
nsIPrincipal* requestingPrincipal = aRequestingNode->NodePrincipal();
|
||||
|
||||
nsresult rv = nsContentUtils::GetSecurityManager()->
|
||||
CheckLoadURIWithPrincipal(requestingPrincipal, aURI,
|
||||
nsIScriptSecurityManager::STANDARD);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = requestingPrincipal->CheckMayLoad(aURI, PR_TRUE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt16 shouldLoad = nsIContentPolicy::ACCEPT;
|
||||
rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_OTHER,
|
||||
aURI,
|
||||
requestingPrincipal,
|
||||
aRequestingNode,
|
||||
EmptyCString(), //mime guess
|
||||
nsnull, //extra
|
||||
&shouldLoad,
|
||||
nsContentUtils::GetContentPolicy(),
|
||||
nsContentUtils::GetSecurityManager());
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (NS_CP_REJECTED(shouldLoad)) {
|
||||
// Disallowed by content policy
|
||||
return NS_ERROR_CONTENT_BLOCKED;
|
||||
}
|
||||
|
||||
nsIDocument* doc = aRequestingNode->GetOwnerDoc();
|
||||
if (!doc) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup = doc->GetDocumentLoadGroup();
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
rv = NS_NewChannel(getter_AddRefs(channel), aURI, nsnull, loadGroup);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mURI = aURI;
|
||||
|
||||
nsCOMPtr<nsIInterfaceRequestor> req = nsContentUtils::GetSameOriginChecker();
|
||||
NS_ENSURE_TRUE(req, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
channel->SetNotificationCallbacks(req);
|
||||
return channel->AsyncOpen(this, nsnull);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsExternalResourceMap::LoadgroupCallbacks,
|
||||
nsIInterfaceRequestor)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExternalResourceMap::LoadgroupCallbacks::GetInterface(const nsIID & aIID,
|
||||
void **aSink)
|
||||
{
|
||||
#define IID_IS(_i) aIID.Equals(NS_GET_IID(_i))
|
||||
if (mCallbacks &&
|
||||
(IID_IS(nsIProgressEventSink) ||
|
||||
IID_IS(nsIChannelEventSink) ||
|
||||
IID_IS(nsISecurityEventSink) ||
|
||||
IID_IS(nsIPrompt) ||
|
||||
IID_IS(nsIAuthPrompt) ||
|
||||
IID_IS(nsIAuthPrompt2) ||
|
||||
IID_IS(nsIApplicationCacheContainer) ||
|
||||
// XXXbz evil hack for cookies for now
|
||||
IID_IS(nsIDOMWindow) ||
|
||||
IID_IS(nsIDocShellTreeItem))) {
|
||||
return mCallbacks->GetInterface(aIID, aSink);
|
||||
}
|
||||
#undef IID_IS
|
||||
|
||||
*aSink = nsnull;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsExternalResourceMap::ExternalResource::~ExternalResource()
|
||||
{
|
||||
if (mViewer) {
|
||||
mViewer->Close(nsnull);
|
||||
mViewer->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
// ==================================================================
|
||||
// =
|
||||
// ==================================================================
|
||||
|
@ -1633,8 +1194,7 @@ SubDocTraverser(PLDHashTable *table, PLDHashEntryHdr *hdr, PRUint32 number,
|
|||
}
|
||||
|
||||
PR_STATIC_CALLBACK(PLDHashOperator)
|
||||
RadioGroupsTraverser(const nsAString& aKey, nsRadioGroupStruct* aData,
|
||||
void* aClosure)
|
||||
RadioGroupsTraverser(const nsAString& aKey, nsAutoPtr<nsRadioGroupStruct>& aData, void* aClosure)
|
||||
{
|
||||
nsCycleCollectionTraversalCallback *cb =
|
||||
static_cast<nsCycleCollectionTraversalCallback*>(aClosure);
|
||||
|
@ -1701,8 +1261,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDocument)
|
|||
|
||||
tmp->mIdentifierMap.EnumerateEntries(IdentifierMapEntryTraverse, &cb);
|
||||
|
||||
tmp->mExternalResourceMap.Traverse(&cb);
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNodeInfo)
|
||||
|
||||
// Traverse the mChildren nsAttrAndChildArray.
|
||||
|
@ -1718,7 +1276,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDocument)
|
|||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mNodeInfoManager,
|
||||
nsNodeInfoManager)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mSecurityInfo)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDisplayDocument)
|
||||
|
||||
// Traverse all nsDocument nsCOMPtrs.
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mParser)
|
||||
|
@ -1727,7 +1284,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDocument)
|
|||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDOMStyleSheets)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mScriptLoader)
|
||||
|
||||
tmp->mRadioGroups.EnumerateRead(RadioGroupsTraverser, &cb);
|
||||
tmp->mRadioGroups.Enumerate(RadioGroupsTraverser, &cb);
|
||||
|
||||
// The boxobject for an element will only exist as long as it's in the
|
||||
// document, so we'll traverse the table here instead of from the element.
|
||||
|
@ -1769,9 +1326,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
|
|||
// from the doc.
|
||||
tmp->DestroyLinkMap();
|
||||
|
||||
// Clear out our external resources
|
||||
tmp->mExternalResourceMap.Shutdown();
|
||||
|
||||
nsAutoScriptBlocker scriptBlocker;
|
||||
|
||||
// Unlink the mChildren nsAttrAndChildArray.
|
||||
|
@ -1782,7 +1336,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
|
|||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCachedRootContent)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDisplayDocument)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA
|
||||
|
||||
|
@ -2158,9 +1711,6 @@ nsDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel,
|
|||
|
||||
// styles
|
||||
CSSLoader()->SetEnabled(PR_FALSE); // Do not load/process styles when loading as data
|
||||
} else if (nsCRT::strcmp("external-resource", aCommand) == 0) {
|
||||
// Allow CSS, but not scripts
|
||||
ScriptLoader()->SetEnabled(PR_FALSE);
|
||||
}
|
||||
|
||||
mMayStartLayout = PR_FALSE;
|
||||
|
@ -5153,29 +4703,6 @@ nsDocument::FrameLoaderScheduledToBeFinalized(nsIDocShell* aShell)
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsIDocument*
|
||||
nsDocument::RequestExternalResource(nsIURI* aURI,
|
||||
nsINode* aRequestingNode,
|
||||
ExternalResourceLoad** aPendingLoad)
|
||||
{
|
||||
NS_PRECONDITION(aURI, "Must have a URI");
|
||||
NS_PRECONDITION(aRequestingNode, "Must have a node");
|
||||
if (mDisplayDocument) {
|
||||
return mDisplayDocument->RequestExternalResource(aURI,
|
||||
aRequestingNode,
|
||||
aPendingLoad);
|
||||
}
|
||||
|
||||
return mExternalResourceMap.RequestResource(aURI, aRequestingNode,
|
||||
this, aPendingLoad);
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::EnumerateExternalResources(nsSubDocEnumFunc aCallback, void* aData)
|
||||
{
|
||||
mExternalResourceMap.EnumerateResources(aCallback, aData);
|
||||
}
|
||||
|
||||
struct DirTable {
|
||||
const char* mName;
|
||||
PRUint8 mValue;
|
||||
|
@ -6200,7 +5727,9 @@ nsDocument::FlushPendingNotifications(mozFlushType aType)
|
|||
|
||||
// Should we be flushing pending binding constructors in here?
|
||||
|
||||
if (aType <= Flush_ContentAndNotify) {
|
||||
nsPIDOMWindow *window = GetWindow();
|
||||
|
||||
if (aType <= Flush_ContentAndNotify || !window) {
|
||||
// Nothing to do here
|
||||
return;
|
||||
}
|
||||
|
@ -6333,20 +5862,20 @@ PRBool
|
|||
nsDocument::IsScriptEnabled()
|
||||
{
|
||||
nsCOMPtr<nsIScriptSecurityManager> sm(do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID));
|
||||
NS_ENSURE_TRUE(sm, PR_FALSE);
|
||||
NS_ENSURE_TRUE(sm, PR_TRUE);
|
||||
|
||||
nsIScriptGlobalObject* globalObject = GetScriptGlobalObject();
|
||||
NS_ENSURE_TRUE(globalObject, PR_FALSE);
|
||||
NS_ENSURE_TRUE(globalObject, PR_TRUE);
|
||||
|
||||
nsIScriptContext *scriptContext = globalObject->GetContext();
|
||||
NS_ENSURE_TRUE(scriptContext, PR_FALSE);
|
||||
NS_ENSURE_TRUE(scriptContext, PR_TRUE);
|
||||
|
||||
JSContext* cx = (JSContext *) scriptContext->GetNativeContext();
|
||||
NS_ENSURE_TRUE(cx, PR_FALSE);
|
||||
NS_ENSURE_TRUE(cx, PR_TRUE);
|
||||
|
||||
PRBool enabled;
|
||||
nsresult rv = sm->CanExecuteScripts(cx, NodePrincipal(), &enabled);
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, PR_TRUE);
|
||||
return enabled;
|
||||
}
|
||||
|
||||
|
@ -6869,11 +6398,6 @@ nsDocument::Destroy()
|
|||
|
||||
nsContentList::OnDocumentDestroy(this);
|
||||
|
||||
// Shut down our external resource map. We might not need this for
|
||||
// leak-fixing if we fix DocumentViewerImpl to do cycle-collection, but
|
||||
// tearing down all those frame trees right now is the right thing to do.
|
||||
mExternalResourceMap.Shutdown();
|
||||
|
||||
// XXX We really should let cycle collection do this, but that currently still
|
||||
// leaks (see https://bugzilla.mozilla.org/show_bug.cgi?id=406684).
|
||||
// When we start relying on cycle collection again we should remove the
|
||||
|
@ -6915,11 +6439,6 @@ nsDocument::GetLayoutHistoryState() const
|
|||
void
|
||||
nsDocument::BlockOnload()
|
||||
{
|
||||
if (mDisplayDocument) {
|
||||
mDisplayDocument->BlockOnload();
|
||||
return;
|
||||
}
|
||||
|
||||
// If mScriptGlobalObject is null, we shouldn't be messing with the loadgroup
|
||||
// -- it's not ours.
|
||||
if (mOnloadBlockCount == 0 && mScriptGlobalObject) {
|
||||
|
@ -6934,11 +6453,6 @@ nsDocument::BlockOnload()
|
|||
void
|
||||
nsDocument::UnblockOnload(PRBool aFireSync)
|
||||
{
|
||||
if (mDisplayDocument) {
|
||||
mDisplayDocument->UnblockOnload(aFireSync);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mOnloadBlockCount == 0) {
|
||||
NS_NOTREACHED("More UnblockOnload() calls than BlockOnload() calls; dropping call");
|
||||
return;
|
||||
|
@ -6986,14 +6500,12 @@ nsDocument::PostUnblockOnloadEvent()
|
|||
void
|
||||
nsDocument::DoUnblockOnload()
|
||||
{
|
||||
NS_PRECONDITION(!mDisplayDocument,
|
||||
"Shouldn't get here for resource document");
|
||||
NS_PRECONDITION(mOnloadBlockCount != 0,
|
||||
"Shouldn't have a count of zero here, since we stabilized in "
|
||||
"PostUnblockOnloadEvent");
|
||||
NS_ASSERTION(mOnloadBlockCount != 0,
|
||||
"Shouldn't have a count of zero here, since we stabilized in "
|
||||
"PostUnblockOnloadEvent");
|
||||
|
||||
--mOnloadBlockCount;
|
||||
|
||||
|
||||
if (mOnloadBlockCount != 0) {
|
||||
// We blocked again after the last unblock. Nothing to do here. We'll
|
||||
// post a new event when we unblock again.
|
||||
|
|
|
@ -108,8 +108,6 @@
|
|||
#include "nsPresShellIterator.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
|
||||
#define XML_DECLARATION_BITS_DECLARATION_EXISTS (1 << 0)
|
||||
#define XML_DECLARATION_BITS_ENCODING_EXISTS (1 << 1)
|
||||
|
@ -385,117 +383,6 @@ private:
|
|||
~nsOnloadBlocker() {}
|
||||
};
|
||||
|
||||
class nsExternalResourceMap
|
||||
{
|
||||
public:
|
||||
typedef nsIDocument::ExternalResourceLoad ExternalResourceLoad;
|
||||
nsExternalResourceMap();
|
||||
|
||||
/**
|
||||
* Request an external resource document. This does exactly what
|
||||
* nsIDocument::RequestExternalResource is documented to do.
|
||||
*/
|
||||
nsIDocument* RequestResource(nsIURI* aURI,
|
||||
nsINode* aRequestingNode,
|
||||
nsDocument* aDisplayDocument,
|
||||
ExternalResourceLoad** aPendingLoad);
|
||||
|
||||
/**
|
||||
* Enumerate the resource documents. See
|
||||
* nsIDocument::EnumerateExternalResources.
|
||||
*/
|
||||
void EnumerateResources(nsIDocument::nsSubDocEnumFunc aCallback, void* aData);
|
||||
|
||||
/**
|
||||
* Traverse ourselves for cycle-collection
|
||||
*/
|
||||
void Traverse(nsCycleCollectionTraversalCallback* aCallback) const;
|
||||
|
||||
/**
|
||||
* Shut ourselves down (used for cycle-collection unlink), as well
|
||||
* as for document destruction.
|
||||
*/
|
||||
void Shutdown()
|
||||
{
|
||||
mPendingLoads.Clear();
|
||||
mMap.Clear();
|
||||
mHaveShutDown = PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool HaveShutDown() const
|
||||
{
|
||||
return mHaveShutDown;
|
||||
}
|
||||
|
||||
// Needs to be public so we can traverse them sanely
|
||||
struct ExternalResource
|
||||
{
|
||||
~ExternalResource();
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
nsCOMPtr<nsIContentViewer> mViewer;
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
};
|
||||
|
||||
protected:
|
||||
class PendingLoad : public ExternalResourceLoad,
|
||||
public nsIStreamListener
|
||||
{
|
||||
public:
|
||||
PendingLoad(nsDocument* aDisplayDocument) :
|
||||
mDisplayDocument(aDisplayDocument)
|
||||
{}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
NS_DECL_NSIREQUESTOBSERVER
|
||||
|
||||
/**
|
||||
* Start aURI loading. This will perform the necessary security checks and
|
||||
* so forth.
|
||||
*/
|
||||
nsresult StartLoad(nsIURI* aURI, nsINode* aRequestingNode);
|
||||
|
||||
/**
|
||||
* Set up an nsIDocumentViewer based on aRequest. This is guaranteed to
|
||||
* put null in *aViewer and *aLoadGroup on all failures.
|
||||
*/
|
||||
nsresult SetupViewer(nsIRequest* aRequest, nsIDocumentViewer** aViewer,
|
||||
nsILoadGroup** aLoadGroup);
|
||||
|
||||
private:
|
||||
nsRefPtr<nsDocument> mDisplayDocument;
|
||||
nsCOMPtr<nsIStreamListener> mTargetListener;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
};
|
||||
friend class PendingLoad;
|
||||
|
||||
class LoadgroupCallbacks : public nsIInterfaceRequestor
|
||||
{
|
||||
public:
|
||||
LoadgroupCallbacks(nsIInterfaceRequestor* aOtherCallbacks)
|
||||
: mCallbacks(aOtherCallbacks)
|
||||
{}
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
private:
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
};
|
||||
|
||||
/**
|
||||
* Add an ExternalResource for aURI. aViewer and aLoadGroup might be null
|
||||
* when this is called if the URI didn't result in an XML document. This
|
||||
* function makes sure to remove the pending load for aURI, if any, from our
|
||||
* hashtable, and to notify its observers, if any.
|
||||
*/
|
||||
nsresult AddExternalResource(nsIURI* aURI, nsIDocumentViewer* aViewer,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
nsIDocument* aDisplayDocument);
|
||||
|
||||
nsClassHashtable<nsURIHashKey, ExternalResource> mMap;
|
||||
nsRefPtrHashtable<nsURIHashKey, PendingLoad> mPendingLoads;
|
||||
PRPackedBool mHaveShutDown;
|
||||
};
|
||||
|
||||
// Base class for our document implementations.
|
||||
//
|
||||
// Note that this class *implements* nsIDOMXMLDocument, but it's not
|
||||
|
@ -915,12 +802,6 @@ public:
|
|||
virtual NS_HIDDEN_(nsresult) FinalizeFrameLoader(nsFrameLoader* aLoader);
|
||||
virtual NS_HIDDEN_(void) TryCancelFrameLoaderInitialization(nsIDocShell* aShell);
|
||||
virtual NS_HIDDEN_(PRBool) FrameLoaderScheduledToBeFinalized(nsIDocShell* aShell);
|
||||
virtual NS_HIDDEN_(nsIDocument*)
|
||||
RequestExternalResource(nsIURI* aURI,
|
||||
nsINode* aRequestingNode,
|
||||
ExternalResourceLoad** aPendingLoad);
|
||||
virtual NS_HIDDEN_(void)
|
||||
EnumerateExternalResources(nsSubDocEnumFunc aCallback, void* aData);
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsDocument, nsIDocument)
|
||||
|
||||
|
@ -934,11 +815,6 @@ public:
|
|||
|
||||
void DoNotifyPossibleTitleChange();
|
||||
|
||||
nsExternalResourceMap& ExternalResourceMap()
|
||||
{
|
||||
return mExternalResourceMap;
|
||||
}
|
||||
|
||||
void SetLoadedAsData(PRBool aLoadedAsData) { mLoadedAsData = aLoadedAsData; }
|
||||
|
||||
nsresult CloneDocHelper(nsDocument* clone) const;
|
||||
|
@ -1211,8 +1087,6 @@ private:
|
|||
nsTArray<nsRefPtr<nsFrameLoader> > mFinalizableFrameLoaders;
|
||||
|
||||
nsRevocableEventPtr<nsRunnableMethod<nsDocument> > mPendingTitleChangeEvent;
|
||||
|
||||
nsExternalResourceMap mExternalResourceMap;
|
||||
};
|
||||
|
||||
#endif /* nsDocument_h___ */
|
||||
|
|
|
@ -727,11 +727,6 @@ nsFrameLoader::EnsureDocShell()
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (doc->GetDisplayDocument()) {
|
||||
// Don't allow subframe loads in external reference documents
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> parentAsWebNav =
|
||||
do_GetInterface(doc->GetScriptGlobalObject());
|
||||
|
||||
|
|
|
@ -128,26 +128,8 @@ nsReferencedElement::Reset(nsIContent* aFromContent, nsIURI* aURI, PRBool aWatch
|
|||
return;
|
||||
|
||||
if (!EqualExceptRef(url, documentURL)) {
|
||||
// Don't take the XBL codepath here, since we'll want to just
|
||||
// normally set up our external resource document and then watch
|
||||
// it as needed.
|
||||
isXBL = PR_FALSE;
|
||||
nsRefPtr<nsIDocument::ExternalResourceLoad> load;
|
||||
doc = doc->RequestExternalResource(url, aFromContent, getter_AddRefs(load));
|
||||
if (!doc) {
|
||||
if (!load || !aWatch) {
|
||||
// Nothing will ever happen here
|
||||
return;
|
||||
}
|
||||
|
||||
DocumentLoadNotification* observer =
|
||||
new DocumentLoadNotification(this, ref);
|
||||
mPendingNotification = observer;
|
||||
if (observer) {
|
||||
load->AddObserver(observer);
|
||||
}
|
||||
// Keep going so we set up our watching stuff a bit
|
||||
}
|
||||
// Oops -- we don't support off-document references
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the element
|
||||
|
@ -168,8 +150,6 @@ nsReferencedElement::Reset(nsIContent* aFromContent, nsIURI* aURI, PRBool aWatch
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We don't have watching working yet for XBL, so bail out here.
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -178,31 +158,16 @@ nsReferencedElement::Reset(nsIContent* aFromContent, nsIURI* aURI, PRBool aWatch
|
|||
if (!atom)
|
||||
return;
|
||||
atom.swap(mWatchID);
|
||||
}
|
||||
|
||||
HaveNewDocument(doc, aWatch, ref);
|
||||
}
|
||||
|
||||
void
|
||||
nsReferencedElement::HaveNewDocument(nsIDocument* aDocument, PRBool aWatch,
|
||||
const nsString& aRef)
|
||||
{
|
||||
if (aWatch) {
|
||||
mWatchDocument = aDocument;
|
||||
if (mWatchDocument) {
|
||||
mContent = mWatchDocument->AddIDTargetObserver(mWatchID, Observe, this);
|
||||
}
|
||||
mWatchDocument = doc;
|
||||
mContent = mWatchDocument->AddIDTargetObserver(mWatchID, Observe, this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!aDocument) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(aDocument);
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(doc);
|
||||
NS_ASSERTION(domDoc, "Content doesn't reference a dom Document");
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
domDoc->GetElementById(aRef, getter_AddRefs(element));
|
||||
rv = domDoc->GetElementById(ref, getter_AddRefs(element));
|
||||
if (element) {
|
||||
mContent = do_QueryInterface(element);
|
||||
}
|
||||
|
@ -221,9 +186,6 @@ nsReferencedElement::Unlink()
|
|||
if (mWatchDocument && mWatchID) {
|
||||
mWatchDocument->RemoveIDTargetObserver(mWatchID, Observe, this);
|
||||
}
|
||||
if (mPendingNotification) {
|
||||
mPendingNotification->Clear();
|
||||
}
|
||||
mWatchDocument = nsnull;
|
||||
mWatchID = nsnull;
|
||||
mContent = nsnull;
|
||||
|
@ -238,10 +200,8 @@ nsReferencedElement::Observe(nsIContent* aOldContent,
|
|||
p->mPendingNotification->SetTo(aNewContent);
|
||||
} else {
|
||||
NS_ASSERTION(aOldContent == p->mContent, "Failed to track content!");
|
||||
ChangeNotification* watcher =
|
||||
new ChangeNotification(p, aOldContent, aNewContent);
|
||||
p->mPendingNotification = watcher;
|
||||
nsContentUtils::AddScriptRunner(watcher);
|
||||
p->mPendingNotification = new Notification(p, aOldContent, aNewContent);
|
||||
nsContentUtils::AddScriptRunner(p->mPendingNotification);
|
||||
}
|
||||
PRBool keepTracking = p->IsPersistent();
|
||||
if (!keepTracking) {
|
||||
|
@ -250,28 +210,3 @@ nsReferencedElement::Observe(nsIContent* aOldContent,
|
|||
}
|
||||
return keepTracking;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsReferencedElement::ChangeNotification,
|
||||
nsRunnable)
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsReferencedElement::DocumentLoadNotification,
|
||||
nsIObserver)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsReferencedElement::DocumentLoadNotification::Observe(nsISupports* aSubject,
|
||||
const char* aTopic,
|
||||
const PRUnichar* aData)
|
||||
{
|
||||
NS_ASSERTION(PL_strcmp(aTopic, "external-resource-document-created") == 0,
|
||||
"Unexpected topic");
|
||||
if (mTarget) {
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aSubject);
|
||||
mTarget->mPendingNotification = nsnull;
|
||||
NS_ASSERTION(!mTarget->mContent, "Why do we have content here?");
|
||||
// If we got here, that means we had Reset() called with aWatch ==
|
||||
// PR_TRUE. So keep watching if IsPersistent().
|
||||
mTarget->HaveNewDocument(doc, mTarget->IsPersistent(), mRef);
|
||||
mTarget->ContentChanged(nsnull, mTarget->mContent);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -314,12 +314,8 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument *aOldDocument,
|
|||
rv = doc->CSSLoader()->
|
||||
LoadStyleLink(thisContent, uri, title, media, isAlternate, aObserver,
|
||||
&isAlternate);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Don't propagate LoadStyleLink() errors further than this, since some
|
||||
// consumers (e.g. nsXMLContentSink) will completely abort on innocuous
|
||||
// things like a stylesheet load being blocked by the security system.
|
||||
if (rv == NS_ERROR_FILE_NOT_FOUND) {
|
||||
doneLoading = PR_TRUE;
|
||||
isAlternate = PR_FALSE;
|
||||
rv = NS_OK;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6282,9 +6282,6 @@ nsEventStateManager::ShiftFocusByDoc(PRBool aForward)
|
|||
|
||||
nsCOMPtr<nsISupports> pcContainer = mPresContext->GetContainer();
|
||||
nsCOMPtr<nsIDocShellTreeNode> curNode = do_QueryInterface(pcContainer);
|
||||
if (!curNode) {
|
||||
return;
|
||||
}
|
||||
|
||||
// perform a depth first search (preorder) of the docshell tree
|
||||
// looking for an HTML Frame or a chrome document
|
||||
|
|
|
@ -709,6 +709,10 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aContainer));
|
||||
|
||||
nsCOMPtr<nsIDocumentCharsetInfo> dcInfo;
|
||||
docShell->GetDocumentCharsetInfo(getter_AddRefs(dcInfo));
|
||||
PRInt32 textType = GET_BIDI_OPTION_TEXTTYPE(GetBidiOptions());
|
||||
|
||||
// Look for the parent document. Note that at this point we don't have our
|
||||
|
@ -718,17 +722,11 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
|||
// in this block of code, if we get an error result, we return it
|
||||
// but if we get a null pointer, that's perfectly legal for parent
|
||||
// and parentContentViewer
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aContainer));
|
||||
|
||||
// No support yet for docshell-less HTML
|
||||
NS_ENSURE_TRUE(docShell || IsXHTML(), NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(docShell));
|
||||
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentAsItem;
|
||||
if (docShellAsItem) {
|
||||
docShellAsItem->GetSameTypeParent(getter_AddRefs(parentAsItem));
|
||||
}
|
||||
docShellAsItem->GetSameTypeParent(getter_AddRefs(parentAsItem));
|
||||
|
||||
nsCOMPtr<nsIDocShell> parent(do_QueryInterface(parentAsItem));
|
||||
nsCOMPtr<nsIDocument> parentDocument;
|
||||
|
@ -749,9 +747,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
|||
nsCOMPtr<nsIMarkupDocumentViewer> muCV;
|
||||
PRBool muCVIsParent = PR_FALSE;
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
if (docShell) {
|
||||
docShell->GetContentViewer(getter_AddRefs(cv));
|
||||
}
|
||||
docShell->GetContentViewer(getter_AddRefs(cv));
|
||||
if (cv) {
|
||||
muCV = do_QueryInterface(cv);
|
||||
} else {
|
||||
|
@ -788,11 +784,6 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
|||
parserCharsetSource = charsetSource;
|
||||
parserCharset = charset;
|
||||
} else {
|
||||
NS_ASSERTION(docShell && docShellAsItem, "Unexpected null value");
|
||||
|
||||
nsCOMPtr<nsIDocumentCharsetInfo> dcInfo;
|
||||
docShell->GetDocumentCharsetInfo(getter_AddRefs(dcInfo));
|
||||
|
||||
charsetSource = kCharsetUninitialized;
|
||||
wyciwygChannel = do_QueryInterface(aChannel);
|
||||
|
||||
|
|
|
@ -300,10 +300,7 @@ nsSVGUseElement::CreateAnonymousContent()
|
|||
|
||||
nsCOMPtr<nsIDOMNode> newnode;
|
||||
nsCOMArray<nsINode> unused;
|
||||
nsNodeInfoManager* nodeInfoManager =
|
||||
targetContent->GetOwnerDoc() == GetOwnerDoc() ?
|
||||
nsnull : GetOwnerDoc()->NodeInfoManager();
|
||||
nsNodeUtils::Clone(targetContent, PR_TRUE, nodeInfoManager, unused,
|
||||
nsNodeUtils::Clone(targetContent, PR_TRUE, nsnull, unused,
|
||||
getter_AddRefs(newnode));
|
||||
|
||||
nsCOMPtr<nsIContent> newcontent = do_QueryInterface(newnode);
|
||||
|
@ -377,15 +374,6 @@ nsSVGUseElement::CreateAnonymousContent()
|
|||
}
|
||||
}
|
||||
|
||||
// Set up its base URI correctly
|
||||
nsCOMPtr<nsIURI> baseURI = targetContent->GetBaseURI();
|
||||
if (!baseURI)
|
||||
return nsnull;
|
||||
nsCAutoString spec;
|
||||
baseURI->GetSpec(spec);
|
||||
newcontent->SetAttr(kNameSpaceID_XML, nsGkAtoms::base,
|
||||
NS_ConvertUTF8toUTF16(spec), PR_FALSE);
|
||||
|
||||
targetContent->AddMutationObserver(this);
|
||||
mClone = newcontent;
|
||||
return mClone;
|
||||
|
@ -428,8 +416,7 @@ nsSVGUseElement::LookupHref()
|
|||
if (href.IsEmpty())
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIURI> targetURI;
|
||||
nsCOMPtr<nsIURI> baseURI = mOriginal ? mOriginal->GetBaseURI() : GetBaseURI();
|
||||
nsCOMPtr<nsIURI> targetURI, baseURI = GetBaseURI();
|
||||
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI), href,
|
||||
GetCurrentDoc(), baseURI);
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ REQUIRES = \
|
|||
thebes \
|
||||
dom \
|
||||
webshell \
|
||||
docshell \
|
||||
htmlparser \
|
||||
necko \
|
||||
pref \
|
||||
|
|
|
@ -2488,7 +2488,7 @@ nsXULElement::HideWindowChrome(PRBool aShouldHide)
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
// only top level chrome documents can hide the window chrome
|
||||
if (!doc->IsRootDisplayDocument())
|
||||
if (doc->GetParentDocument())
|
||||
return NS_OK;
|
||||
|
||||
nsIPresShell *shell = doc->GetPrimaryShell();
|
||||
|
@ -2522,7 +2522,7 @@ nsXULElement::SetTitlebarColor(nscolor aColor, PRBool aActive)
|
|||
}
|
||||
|
||||
// only top level chrome documents can set the titlebar color
|
||||
if (doc->IsRootDisplayDocument()) {
|
||||
if (!doc->GetParentDocument()) {
|
||||
nsCOMPtr<nsISupports> container = doc->GetContainer();
|
||||
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(container);
|
||||
if (baseWindow) {
|
||||
|
|
|
@ -423,7 +423,7 @@ nsFocusController::GetWindowFromDocument(nsIDOMDocument* aDocument)
|
|||
{
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDocument);
|
||||
if (!doc)
|
||||
return nsnull;
|
||||
return NS_OK;
|
||||
|
||||
return doc->GetWindow();
|
||||
}
|
||||
|
|
|
@ -137,10 +137,9 @@ nsIScriptGlobalObject* GetGlobalObject(nsIChannel* aChannel)
|
|||
// Get the global object owner from the channel
|
||||
nsCOMPtr<nsIScriptGlobalObjectOwner> globalOwner;
|
||||
NS_QueryNotificationCallbacks(aChannel, globalOwner);
|
||||
if (!globalOwner) {
|
||||
NS_WARNING("Unable to get an nsIScriptGlobalObjectOwner from the "
|
||||
"channel!");
|
||||
}
|
||||
NS_ASSERTION(globalOwner,
|
||||
"Unable to get an nsIScriptGlobalObjectOwner from the "
|
||||
"channel!");
|
||||
if (!globalOwner) {
|
||||
return nsnull;
|
||||
}
|
||||
|
|
|
@ -433,7 +433,7 @@ protected:
|
|||
nsCOMPtr<nsIContentViewer> mPreviousViewer;
|
||||
nsCOMPtr<nsISHEntry> mSHEntry;
|
||||
|
||||
nsIWidget* mParentWidget; // purposely won't be ref counted. May be null
|
||||
nsIWidget* mParentWidget; // purposely won't be ref counted
|
||||
|
||||
// mTextZoom/mPageZoom record the textzoom/pagezoom of the first (galley)
|
||||
// presshell only.
|
||||
|
@ -817,11 +817,7 @@ DocumentViewerImpl::InitInternal(nsIWidget* aParentWidget,
|
|||
|
||||
PRBool makeCX = PR_FALSE;
|
||||
if (aDoCreation) {
|
||||
// XXXbz this is a nasty hack to do with the fact that we create
|
||||
// presentations both in Init() and in Show()... Ideally we would only do
|
||||
// it in one place (Show()) and require that callers call init(), open(),
|
||||
// show() in that order or something.
|
||||
if ((aParentWidget || mDocument->GetDisplayDocument()) && !mPresContext) {
|
||||
if (aParentWidget && !mPresContext) {
|
||||
// Create presentation context
|
||||
if (mIsPageMode) {
|
||||
//Presentation context already created in SetPageMode which is calling this method
|
||||
|
@ -962,11 +958,14 @@ DocumentViewerImpl::LoadComplete(nsresult aStatus)
|
|||
// First, get the window from the document...
|
||||
nsPIDOMWindow *window = mDocument->GetWindow();
|
||||
|
||||
// Fail if no window is available...
|
||||
NS_ENSURE_TRUE(window, NS_ERROR_NULL_POINTER);
|
||||
|
||||
mLoaded = PR_TRUE;
|
||||
|
||||
// Now, fire either an OnLoad or OnError event to the document...
|
||||
PRBool restoring = PR_FALSE;
|
||||
if(NS_SUCCEEDED(aStatus) && window) {
|
||||
if(NS_SUCCEEDED(aStatus)) {
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsEvent event(PR_TRUE, NS_LOAD);
|
||||
event.flags |= NS_EVENT_FLAG_CANT_BUBBLE;
|
||||
|
@ -1242,28 +1241,32 @@ DocumentViewerImpl::Open(nsISupports *aState, nsISHEntry *aSHEntry)
|
|||
{
|
||||
NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
// Our container might have gone away while we were closed.
|
||||
// If this is the case, we must fail to open so we don't crash.
|
||||
nsCOMPtr<nsISupports> container = do_QueryReferent(mContainer);
|
||||
if (!container)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
nsRect bounds;
|
||||
mWindow->GetBounds(bounds);
|
||||
|
||||
if (mDocument)
|
||||
mDocument->SetContainer(nsCOMPtr<nsISupports>(do_QueryReferent(mContainer)));
|
||||
|
||||
nsresult rv = InitInternal(mParentWidget, aState, bounds, PR_FALSE, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mDocument)
|
||||
mDocument->SetContainer(nsCOMPtr<nsISupports>(do_QueryReferent(mContainer)));
|
||||
|
||||
if (mPresShell)
|
||||
mPresShell->SetForwardingContainer(nsnull);
|
||||
|
||||
// Rehook the child presentations. The child shells are still in
|
||||
// session history, so get them from there.
|
||||
|
||||
if (aSHEntry) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> item;
|
||||
PRInt32 itemIndex = 0;
|
||||
while (NS_SUCCEEDED(aSHEntry->ChildShellAt(itemIndex++,
|
||||
getter_AddRefs(item))) && item) {
|
||||
AttachContainerRecurse(nsCOMPtr<nsIDocShell>(do_QueryInterface(item)));
|
||||
}
|
||||
nsCOMPtr<nsIDocShellTreeItem> item;
|
||||
PRInt32 itemIndex = 0;
|
||||
while (NS_SUCCEEDED(aSHEntry->ChildShellAt(itemIndex++,
|
||||
getter_AddRefs(item))) && item) {
|
||||
AttachContainerRecurse(nsCOMPtr<nsIDocShell>(do_QueryInterface(item)));
|
||||
}
|
||||
|
||||
SyncParentSubDocMap();
|
||||
|
@ -1870,11 +1873,11 @@ DocumentViewerImpl::Show(void)
|
|||
|
||||
if (mDocument && !mPresShell && !mWindow) {
|
||||
nsCOMPtr<nsIBaseWindow> base_win(do_QueryReferent(mContainer));
|
||||
if (base_win) {
|
||||
base_win->GetParentWidget(&mParentWidget);
|
||||
NS_ENSURE_TRUE(mParentWidget, NS_ERROR_UNEXPECTED);
|
||||
mParentWidget->Release(); // GetParentWidget AddRefs, but mParentWidget is weak
|
||||
}
|
||||
NS_ENSURE_TRUE(base_win, NS_ERROR_UNEXPECTED);
|
||||
|
||||
base_win->GetParentWidget(&mParentWidget);
|
||||
NS_ENSURE_TRUE(mParentWidget, NS_ERROR_UNEXPECTED);
|
||||
mParentWidget->Release(); // GetParentWidget AddRefs, but mParentWidget is weak
|
||||
|
||||
nsresult rv = CreateDeviceContext(mParentWidget);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -1891,12 +1894,7 @@ DocumentViewerImpl::Show(void)
|
|||
}
|
||||
|
||||
nsRect tbounds;
|
||||
if (mParentWidget) {
|
||||
mParentWidget->GetBounds(tbounds);
|
||||
} else {
|
||||
// No good default size; just size to 0 by 0 for lack of anything better.
|
||||
tbounds = nsRect(0, 0, 0, 0);
|
||||
}
|
||||
mParentWidget->GetBounds(tbounds);
|
||||
|
||||
rv = MakeWindow(nsSize(mPresContext->DevPixelsToAppUnits(tbounds.width),
|
||||
mPresContext->DevPixelsToAppUnits(tbounds.height)));
|
||||
|
@ -2100,14 +2098,11 @@ DocumentViewerImpl::CreateStyleSet(nsIDocument* aDocument,
|
|||
// The document will fill in the document sheets when we create the presshell
|
||||
|
||||
// Handle the user sheets.
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<nsISupports> debugDocContainer = aDocument->GetContainer();
|
||||
nsCOMPtr<nsIDocShellTreeItem> debugDocShell(do_QueryReferent(mContainer));
|
||||
NS_ASSERTION(SameCOMIdentity(debugDocContainer, debugDocShell),
|
||||
"Unexpected containers");
|
||||
#endif
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShell(do_QueryReferent(mContainer));
|
||||
PRInt32 shellType;
|
||||
docShell->GetItemType(&shellType);
|
||||
nsICSSStyleSheet* sheet = nsnull;
|
||||
if (nsContentUtils::IsInChromeDocshell(aDocument)) {
|
||||
if (shellType == nsIDocShellTreeItem::typeChrome) {
|
||||
sheet = nsLayoutStylesheetCache::UserChromeSheet();
|
||||
}
|
||||
else {
|
||||
|
@ -2119,16 +2114,12 @@ DocumentViewerImpl::CreateStyleSet(nsIDocument* aDocument,
|
|||
|
||||
// Append chrome sheets (scrollbars + forms).
|
||||
PRBool shouldOverride = PR_FALSE;
|
||||
// We don't want a docshell here for external resource docs, so just
|
||||
// look at mContainer.
|
||||
nsCOMPtr<nsIDocShell> ds(do_QueryReferent(mContainer));
|
||||
nsCOMPtr<nsIDocShell> ds(do_QueryInterface(docShell));
|
||||
nsCOMPtr<nsIDOMEventTarget> chromeHandler;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsCOMPtr<nsICSSStyleSheet> csssheet;
|
||||
|
||||
if (ds) {
|
||||
ds->GetChromeEventHandler(getter_AddRefs(chromeHandler));
|
||||
}
|
||||
ds->GetChromeEventHandler(getter_AddRefs(chromeHandler));
|
||||
if (chromeHandler) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(chromeHandler));
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(elt));
|
||||
|
@ -2218,8 +2209,7 @@ DocumentViewerImpl::MakeWindow(const nsSize& aSize)
|
|||
|
||||
// Create a child window of the parent that is our "root view/window"
|
||||
// if aParentWidget has a view, we'll hook our view manager up to its view tree
|
||||
nsIView* containerView =
|
||||
mParentWidget ? nsIView::GetViewFor(mParentWidget) : nsnull;
|
||||
nsIView* containerView = nsIView::GetViewFor(mParentWidget);
|
||||
|
||||
if (containerView) {
|
||||
// see if the containerView has already been hooked into a foreign view manager hierarchy
|
||||
|
@ -2261,21 +2251,8 @@ DocumentViewerImpl::MakeWindow(const nsSize& aSize)
|
|||
// pass in a native widget to be the parent widget ONLY if the view hierarchy will stand alone.
|
||||
// otherwise the view will find its own parent widget and "do the right thing" to
|
||||
// establish a parent/child widget relationship
|
||||
nsWidgetInitData initData;
|
||||
nsWidgetInitData* initDataPtr;
|
||||
if (!mParentWidget) {
|
||||
initDataPtr = &initData;
|
||||
initData.mWindowType = eWindowType_invisible;
|
||||
|
||||
initData.mContentType =
|
||||
nsContentUtils::IsInChromeDocshell(mDocument) ?
|
||||
eContentTypeUI : eContentTypeContent;
|
||||
} else {
|
||||
initDataPtr = nsnull;
|
||||
}
|
||||
rv = view->CreateWidget(kWidgetCID, initDataPtr,
|
||||
(containerView != nsnull || !mParentWidget) ?
|
||||
nsnull : mParentWidget->GetNativeData(NS_NATIVE_WIDGET),
|
||||
rv = view->CreateWidget(kWidgetCID, nsnull,
|
||||
containerView != nsnull ? nsnull : mParentWidget->GetNativeData(NS_NATIVE_WIDGET),
|
||||
PR_TRUE, PR_FALSE);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -2296,31 +2273,12 @@ DocumentViewerImpl::MakeWindow(const nsSize& aSize)
|
|||
nsresult
|
||||
DocumentViewerImpl::CreateDeviceContext(nsIWidget* aWidget)
|
||||
{
|
||||
NS_PRECONDITION(!mPresShell && !mPresContext && !mWindow,
|
||||
"This will screw up our existing presentation");
|
||||
NS_PRECONDITION(mDocument, "Gotta have a document here");
|
||||
|
||||
nsIDocument* doc = mDocument->GetDisplayDocument();
|
||||
if (doc) {
|
||||
NS_ASSERTION(!aWidget, "Shouldn't have a widget here");
|
||||
|
||||
// We want to use our display document's device context if possible
|
||||
nsIPresShell* shell = doc->GetPrimaryShell();
|
||||
if (shell) {
|
||||
nsPresContext* ctx = shell->GetPresContext();
|
||||
if (ctx) {
|
||||
mDeviceContext = ctx->DeviceContext();
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
NS_PRECONDITION(!mDeviceContext, "How come we're calling this?");
|
||||
if (aWidget) {
|
||||
mDeviceContext = do_CreateInstance(kDeviceContextCID);
|
||||
NS_ENSURE_TRUE(mDeviceContext, NS_ERROR_FAILURE);
|
||||
mDeviceContext->Init(aWidget->GetNativeData(NS_NATIVE_WIDGET));
|
||||
}
|
||||
|
||||
// Create a device context even if we already have one, since our widget
|
||||
// might have changed.
|
||||
mDeviceContext = do_CreateInstance(kDeviceContextCID);
|
||||
NS_ENSURE_TRUE(mDeviceContext, NS_ERROR_FAILURE);
|
||||
mDeviceContext->Init(aWidget ?
|
||||
aWidget->GetNativeData(NS_NATIVE_WIDGET) : nsnull);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2703,38 +2661,6 @@ SetChildFullZoom(nsIMarkupDocumentViewer* aChild, void* aClosure)
|
|||
aChild->SetFullZoom(ZoomInfo->mZoom);
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(PRBool)
|
||||
SetExtResourceTextZoom(nsIDocument* aDocument, void* aClosure)
|
||||
{
|
||||
// Would it be better to enumerate external resource viewers instead?
|
||||
nsIPresShell* shell = aDocument->GetPrimaryShell();
|
||||
if (shell) {
|
||||
nsPresContext* ctxt = shell->GetPresContext();
|
||||
if (ctxt) {
|
||||
struct ZoomInfo* ZoomInfo = static_cast<struct ZoomInfo*>(aClosure);
|
||||
ctxt->SetTextZoom(ZoomInfo->mZoom);
|
||||
}
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(PRBool)
|
||||
SetExtResourceFullZoom(nsIDocument* aDocument, void* aClosure)
|
||||
{
|
||||
// Would it be better to enumerate external resource viewers instead?
|
||||
nsIPresShell* shell = aDocument->GetPrimaryShell();
|
||||
if (shell) {
|
||||
nsPresContext* ctxt = shell->GetPresContext();
|
||||
if (ctxt) {
|
||||
struct ZoomInfo* ZoomInfo = static_cast<struct ZoomInfo*>(aClosure);
|
||||
ctxt->SetFullZoom(ZoomInfo->mZoom);
|
||||
}
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::SetTextZoom(float aTextZoom)
|
||||
{
|
||||
|
@ -2757,9 +2683,6 @@ DocumentViewerImpl::SetTextZoom(float aTextZoom)
|
|||
pc->SetTextZoom(aTextZoom);
|
||||
}
|
||||
|
||||
// And do the external resources
|
||||
mDocument->EnumerateExternalResources(SetExtResourceTextZoom, &ZoomInfo);
|
||||
|
||||
batch.EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -2791,9 +2714,6 @@ DocumentViewerImpl::SetFullZoom(float aFullZoom)
|
|||
pc->SetFullZoom(aFullZoom);
|
||||
}
|
||||
|
||||
// And do the external resources
|
||||
mDocument->EnumerateExternalResources(SetExtResourceFullZoom, &ZoomInfo);
|
||||
|
||||
batch.EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -2842,6 +2762,8 @@ DocumentViewerImpl::GetAuthorStyleDisabled(PRBool* aStyleDisabled)
|
|||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::GetDefaultCharacterSet(nsACString& aDefaultCharacterSet)
|
||||
{
|
||||
NS_ENSURE_STATE(nsCOMPtr<nsISupports>(do_QueryReferent(mContainer)));
|
||||
|
||||
if (mDefaultCharacterSet.IsEmpty())
|
||||
{
|
||||
const nsAdoptingString& defCharset =
|
||||
|
@ -3136,10 +3058,9 @@ NS_IMETHODIMP DocumentViewerImpl::SizeToContent()
|
|||
{
|
||||
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
// Skip doing this on docshell-less documents for now
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryReferent(mContainer));
|
||||
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellParent;
|
||||
docShellAsItem->GetSameTypeParent(getter_AddRefs(docShellParent));
|
||||
|
||||
|
|
|
@ -1804,35 +1804,49 @@ PresShell::SetPreferenceStyleRules(PRBool aForceReflow)
|
|||
|
||||
NS_PRECONDITION(mPresContext, "presContext cannot be null");
|
||||
if (mPresContext) {
|
||||
// first, make sure this is not a chrome shell
|
||||
if (nsContentUtils::IsInChromeDocshell(mDocument)) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult result = NS_OK;
|
||||
|
||||
#ifdef DEBUG_attinasi
|
||||
printf("Setting Preference Style Rules:\n");
|
||||
#endif
|
||||
// if here, we need to create rules for the prefs
|
||||
// - this includes the background-color, the text-color,
|
||||
// the link color, the visited link color and the link-underlining
|
||||
// first, make sure this is not a chrome shell
|
||||
nsCOMPtr<nsISupports> container = mPresContext->GetContainer();
|
||||
if (container) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShell(do_QueryInterface(container, &result));
|
||||
if (NS_SUCCEEDED(result) && docShell){
|
||||
PRInt32 docShellType;
|
||||
result = docShell->GetItemType(&docShellType);
|
||||
if (NS_SUCCEEDED(result)){
|
||||
if (nsIDocShellTreeItem::typeChrome == docShellType){
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
|
||||
// first clear any exising rules
|
||||
nsresult result = ClearPreferenceStyleRules();
|
||||
#ifdef DEBUG_attinasi
|
||||
printf("Setting Preference Style Rules:\n");
|
||||
#endif
|
||||
// if here, we need to create rules for the prefs
|
||||
// - this includes the background-color, the text-color,
|
||||
// the link color, the visited link color and the link-underlining
|
||||
|
||||
// first clear any exising rules
|
||||
result = ClearPreferenceStyleRules();
|
||||
|
||||
// now the link rules (must come after the color rules, or links will not be correct color!)
|
||||
// XXX - when there is both an override and agent pref stylesheet this won't matter,
|
||||
// as the color rules will be overrides and the links rules will be agent
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = SetPrefLinkRules();
|
||||
}
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = SetPrefFocusRules();
|
||||
}
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = SetPrefNoScriptRule();
|
||||
}
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = SetPrefNoFramesRule();
|
||||
// now the link rules (must come after the color rules, or links will not be correct color!)
|
||||
// XXX - when there is both an override and agent pref stylesheet this won't matter,
|
||||
// as the color rules will be overrides and the links rules will be agent
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = SetPrefLinkRules();
|
||||
}
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = SetPrefFocusRules();
|
||||
}
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = SetPrefNoScriptRule();
|
||||
}
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = SetPrefNoFramesRule();
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG_attinasi
|
||||
printf( "Preference Style Rules set: error=%ld\n", (long)result);
|
||||
|
@ -5474,11 +5488,7 @@ nsresult PresShell::RetargetEventToParent(nsGUIEvent* aEvent,
|
|||
// Now, find the parent pres shell and send the event there
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem =
|
||||
do_QueryInterface(container);
|
||||
if (!treeItem) {
|
||||
// Might have gone away, or never been around to start with
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_ASSERTION(treeItem, "No tree item for container.");
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
|
||||
treeItem->GetParent(getter_AddRefs(parentTreeItem));
|
||||
nsCOMPtr<nsIDocShell> parentDocShell =
|
||||
|
|
|
@ -306,12 +306,7 @@ nsFileControlFrame::MouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
|
|||
if (!filePicker)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsPIDOMWindow* win = doc->GetWindow();
|
||||
if (!win) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
result = filePicker->Init(win, title, nsIFilePicker::modeOpen);
|
||||
result = filePicker->Init(doc->GetWindow(), title, nsIFilePicker::modeOpen);
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
|
|
|
@ -555,11 +555,9 @@ nsSubDocumentFrame::Reflow(nsPresContext* aPresContext,
|
|||
innerSize.height -= aReflowState.mComputedBorderPadding.TopBottom();
|
||||
}
|
||||
|
||||
if (mInnerView) {
|
||||
nsIViewManager* vm = mInnerView->GetViewManager();
|
||||
vm->MoveViewTo(mInnerView, offset.x, offset.y);
|
||||
vm->ResizeView(mInnerView, nsRect(nsPoint(0, 0), innerSize), PR_TRUE);
|
||||
}
|
||||
nsIViewManager* vm = mInnerView->GetViewManager();
|
||||
vm->MoveViewTo(mInnerView, offset.x, offset.y);
|
||||
vm->ResizeView(mInnerView, nsRect(nsPoint(0, 0), innerSize), PR_TRUE);
|
||||
|
||||
// Determine if we need to repaint our border, background or outline
|
||||
CheckInvalidateSizeChange(aDesiredSize);
|
||||
|
|
|
@ -609,9 +609,7 @@ nsObjectFrame::Init(nsIContent* aContent,
|
|||
nsIFrame* aParent,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
NS_PRECONDITION(aContent, "How did that happen?");
|
||||
mPreventInstantiation =
|
||||
(aContent->GetCurrentDoc()->GetDisplayDocument() != nsnull);
|
||||
mPreventInstantiation = PR_FALSE;
|
||||
|
||||
PR_LOG(nsObjectFrameLM, PR_LOG_DEBUG,
|
||||
("Initializing nsObjectFrame %p for content %p\n", this, aContent));
|
||||
|
@ -622,9 +620,7 @@ nsObjectFrame::Init(nsIContent* aContent,
|
|||
void
|
||||
nsObjectFrame::Destroy()
|
||||
{
|
||||
NS_ASSERTION(!mPreventInstantiation ||
|
||||
mContent && mContent->GetCurrentDoc()->GetDisplayDocument(),
|
||||
"about to crash due to bug 136927");
|
||||
NS_ASSERTION(!mPreventInstantiation, "about to crash due to bug 136927");
|
||||
|
||||
// we need to finish with the plugin before native window is destroyed
|
||||
// doing this in the destructor is too late.
|
||||
|
@ -1722,7 +1718,6 @@ nsObjectFrame::Instantiate(const char* aMimeType, nsIURI* aURI)
|
|||
return rv;
|
||||
mInstanceOwner->SetPluginHost(pluginHost);
|
||||
|
||||
NS_ASSERTION(!mPreventInstantiation, "Say what?");
|
||||
mPreventInstantiation = PR_TRUE;
|
||||
|
||||
rv = InstantiatePlugin(pluginHost, aMimeType, aURI);
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<body style="margin:0">
|
||||
<div style="position:absolute; top:0; left:0; clip-path: url(clipPath-html-01.xhtml#c1); width:500px; height:500px; background:lime;"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,14 +0,0 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<body style="margin:0">
|
||||
<div style="clip-path: url(clipPath-html-02.xhtml#c1); width:500px; height:200px; background:lime;">
|
||||
<div style="height:200px;"/>
|
||||
<div style="height:200px; background:blue;"/>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,14 +0,0 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<body style="margin:0">
|
||||
<div style="clip-path: url(clipPath-html-03.xhtml#c1); width:500px; height:200px; background:lime;">
|
||||
<div style="height:200px;"/>
|
||||
<div style="height:200px; background:blue;"/>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,18 +0,0 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<head>
|
||||
<style>
|
||||
.unit { display:inline-block; width:100px; height:1px; }
|
||||
</style>
|
||||
</head>
|
||||
<body style="margin:0; width:350px; line-height:100px;">
|
||||
<span class="unit"/><span class="unit"
|
||||
/><span style="clip-path:url(clipPath-html-04.xhtml#c1); background:lime;"><span class="unit"/><span class="unit"
|
||||
/></span>
|
||||
</body>
|
||||
</html>
|
|
@ -1,18 +0,0 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<head>
|
||||
<style>
|
||||
.unit { display:inline-block; width:100px; height:1px; }
|
||||
</style>
|
||||
</head>
|
||||
<body style="margin:0; width:350px; line-height:100px;">
|
||||
<span class="unit"/><span class="unit"
|
||||
/><span style="clip-path:url(clipPath-html-05.xhtml#c1); background:lime;"><span class="unit"/><span class="unit"
|
||||
/></span>
|
||||
</body>
|
||||
</html>
|
|
@ -1,20 +0,0 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<head>
|
||||
<style>
|
||||
.unit { display:inline-block; width:100px; height:10px; }
|
||||
</style>
|
||||
</head>
|
||||
<body style="margin:0">
|
||||
<span style="clip-path: url(clipPath-html-06.xhtml#c1);">
|
||||
<span class="unit" style="background:lime;"></span>
|
||||
<div style="height:200px; width:100px;"/>
|
||||
<span class="unit" style="background:lime;"></span>
|
||||
</span>
|
||||
</body>
|
||||
</html>
|
|
@ -1,11 +0,0 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<body style="margin:0">
|
||||
<div style="background:lime; width:200px; height:200px; margin:50px; filter:url(filter-html-01.xhtml#f1)"/>
|
||||
</body>
|
||||
</html>
|
|
@ -1,11 +0,0 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<body style="margin:0">
|
||||
<div style="mask: url(mask-html-01.xhtml#m1); width:500px; height:500px; background:lime;"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,11 +0,0 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<body style="margin:0">
|
||||
<div style="mask: url(mask-html-01-resource.svg#m1); width:500px; height:500px; background:lime;"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,30 +0,0 @@
|
|||
<?xml-stylesheet
|
||||
type="text/css"
|
||||
href="data:text/css,circle { fill: white }" ?>
|
||||
<!-- test for javascript: execution: shouldn't happen -->
|
||||
<?xml-stylesheet
|
||||
type="text/css"
|
||||
href="javascript:'circle { fill: black }'" ?>
|
||||
<svg height="0" xmlns="http://www.w3.org/2000/svg">
|
||||
<style type="text/css">
|
||||
/* XXXbz this should really be an external reference to mask-html-01.xhtml
|
||||
but there's the little problem of "fill" not using nsReferencedElement
|
||||
yet, so that's broken */
|
||||
/* Test that media queries work on resource documents while we're here */
|
||||
@media (min-resolution: 1dpi) {
|
||||
rect { fill: url(#g); }
|
||||
}
|
||||
</style>
|
||||
<mask id="m1" maskUnits="objectBoundingBox" maskContentUnits="objectBoundingBox">
|
||||
<linearGradient id="g" gradientUnits="objectBoundingBox" x2="0" y2="1">
|
||||
<stop stop-color="white" offset="0"/>
|
||||
<stop stop-color="white" stop-opacity="0" offset="1"/>
|
||||
</linearGradient>
|
||||
<circle cx="0.25" cy="0.25" r="0.25" id="circle" fill="black"/>
|
||||
<rect x="0.5" y="0" width="0.5" height="1" fill="black"/>
|
||||
</mask>
|
||||
<script type="application/ecmascript">
|
||||
// Make sure scripts don't run
|
||||
document.getElementById("m1").textContent = "";
|
||||
</script>
|
||||
</svg>
|
До Ширина: | Высота: | Размер: 1.2 KiB |
|
@ -1,18 +1,9 @@
|
|||
== clipPath-html-01.xhtml clipPath-html-01-ref.svg
|
||||
== clipPath-html-01-extref.xhtml clipPath-html-01-ref.svg
|
||||
== clipPath-html-02.xhtml clipPath-html-02-ref.svg
|
||||
== clipPath-html-02-extref.xhtml clipPath-html-02-ref.svg
|
||||
== clipPath-html-03.xhtml clipPath-html-03-ref.svg
|
||||
== clipPath-html-03-extref.xhtml clipPath-html-03-ref.svg
|
||||
== clipPath-html-04.xhtml clipPath-html-04-ref.xhtml
|
||||
== clipPath-html-04-extref.xhtml clipPath-html-04-ref.xhtml
|
||||
== clipPath-html-05.xhtml clipPath-html-05-ref.xhtml
|
||||
== clipPath-html-05-extref.xhtml clipPath-html-05-ref.xhtml
|
||||
== clipPath-html-06.xhtml clipPath-html-06-ref.xhtml
|
||||
== clipPath-html-06-extref.xhtml clipPath-html-06-ref.xhtml
|
||||
== filter-html-01.xhtml filter-html-01-ref.svg
|
||||
== filter-html-01-extref.xhtml filter-html-01-ref.svg
|
||||
== mask-html-01.xhtml mask-html-01-ref.svg
|
||||
== mask-html-01-extref-01.xhtml mask-html-01-ref.svg
|
||||
== mask-html-01-extref-02.xhtml mask-html-01-ref.svg
|
||||
|
||||
|
|
|
@ -30,8 +30,6 @@ include moz-only/reftest.list
|
|||
== dynamic-text-02.svg dynamic-text-02-ref.svg
|
||||
== dynamic-text-03.svg dynamic-text-03-ref.svg
|
||||
== dynamic-use-01.svg pass.svg
|
||||
== use-01-extref.svg pass.svg
|
||||
== use-02-extref.svg use-02-extref-ref.svg
|
||||
== fallback-color-01a.svg pass.svg
|
||||
== fallback-color-01b.svg pass.svg
|
||||
== fallback-color-02a.svg fallback-color-02-ref.svg
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="g3">
|
||||
<rect width="11%" height="100%" fill="lime" id="r1"/>
|
||||
</g>
|
||||
<g id="g4">
|
||||
<rect width="11%" height="100%" fill="lime"/>
|
||||
<use x="10%" xlink:href="#r1"/>
|
||||
<use x="20%" xlink:href="use-01-extref.svg#r2"/>
|
||||
<use x="10%" xlink:href="use-01-extref.svg#g1"/>
|
||||
</g>
|
||||
<g id="g5">
|
||||
<use xlink:href="#r1"/>
|
||||
<use x="-60%" xlink:href="use-01-extref.svg#g2"/>
|
||||
</g>
|
||||
<g id="g6">
|
||||
<use xlink:href="#r1"/>
|
||||
<use x="10%" xlink:href="#g7"/>
|
||||
</g>
|
||||
<g id="g7">
|
||||
<use xlink:href="#g6"/>
|
||||
</g>
|
||||
</svg>
|
До Ширина: | Высота: | Размер: 757 B |
|
@ -1,24 +0,0 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Testing that dynamic changes to the element for a given ID are reflected in 'use'</title>
|
||||
|
||||
<use x="10%" xlink:href="use-01-extref-resource.svg#r1"/>
|
||||
|
||||
<g id="g1">
|
||||
<use x="20%" xlink:href="use-01-extref-resource.svg#g3"/>
|
||||
</g>
|
||||
|
||||
<use x="30%" xlink:href="use-01-extref-resource.svg#g4"/>
|
||||
|
||||
<g id="g2">
|
||||
<use x="70%" xlink:href="use-01-extref-resource.svg#g5"/>
|
||||
</g>
|
||||
|
||||
<use x="80%" xlink:href="use-01-extref-resource.svg#g6"/>
|
||||
|
||||
<rect width="11%" height="100%" fill="lime" id="r2"/>
|
||||
</svg>
|
До Ширина: | Высота: | Размер: 735 B |
|
@ -1,30 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="testContent" color="forestgreen">
|
||||
<defs>
|
||||
<linearGradient id="linearGrad" gradientUnits="objectBoundingBox" y1="0" x1="0" y2="1" x2="1">
|
||||
<stop offset="0%" stop-color="royalblue"/>
|
||||
<stop offset="33%" stop-color="white"/>
|
||||
<stop offset="50%" stop-color="darkblue"/>
|
||||
<stop offset="66%" stop-color="white"/>
|
||||
<stop offset="100%" stop-color="royalblue"/>
|
||||
</linearGradient>
|
||||
|
||||
<radialGradient id="radialGrad" gradientUnits="objectBoundingBox" cx="0.5" cy="0.5" r="0.5" fx="0.15" fy="0.15">
|
||||
<stop offset="000%" stop-color="orange" />
|
||||
<stop offset="033%" stop-color="red" />
|
||||
<stop offset="050%" stop-color="gold" />
|
||||
<stop offset="066%" stop-color="red" />
|
||||
<stop offset="100%" stop-color="orange" />
|
||||
</radialGradient>
|
||||
</defs>
|
||||
|
||||
<rect x="0" y="0" width="200" height="125" stroke="none"
|
||||
fill="url(#linearGrad)"/>
|
||||
<rect x="200" y="0" width="200" height="125" stroke="none"
|
||||
fill="currentColor"/>
|
||||
<rect x="0" y="125" width="200" height="125" stroke="none"
|
||||
fill="currentColor"/>
|
||||
<rect x="200" y="125" width="200" height="125" stroke="none" fill="url(#radialGrad)" />
|
||||
</g>
|
||||
</svg>
|
До Ширина: | Высота: | Размер: 1.2 KiB |
|
@ -1,29 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<g color="ghostwhite">
|
||||
<defs>
|
||||
<linearGradient id="linearGrad1" gradientUnits="objectBoundingBox" y1="0" x1="0" y2="1" x2="1" >
|
||||
<stop offset="000%" stop-color="orange" />
|
||||
<stop offset="033%" stop-color="red" />
|
||||
<stop offset="050%" stop-color="gold" />
|
||||
<stop offset="066%" stop-color="red" />
|
||||
<stop offset="100%" stop-color="orange" />
|
||||
</linearGradient>
|
||||
|
||||
<radialGradient id="radialGrad1" gradientUnits="objectBoundingBox" cx="0.5" cy="0.5" r="0.5" fx="0.15" fy="0.15" >
|
||||
<stop offset="000%" stop-color="orange" />
|
||||
<stop offset="033%" stop-color="red" />
|
||||
<stop offset="050%" stop-color="gold" />
|
||||
<stop offset="066%" stop-color="red" />
|
||||
<stop offset="100%" stop-color="orange" />
|
||||
</radialGradient>
|
||||
</defs>
|
||||
|
||||
<g>
|
||||
<rect id="rect1" x="0" y="0" width="200" height="125" stroke="none" />
|
||||
<rect id="rect2" x="200" y="0" width="200" height="125" stroke="none" />
|
||||
<rect id="rect3" x="0" y="125" width="200" height="125" stroke="none" fill="currentColor"/>
|
||||
<rect id="rect4" x="200" y="125" width="200" height="125" stroke="none" fill="url(#radialGrad1)" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
До Ширина: | Высота: | Размер: 1.2 KiB |
|
@ -1,28 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g color="forestgreen">
|
||||
<defs>
|
||||
<linearGradient id="linearGrad1" gradientUnits="objectBoundingBox" y1="0" x1="0" y2="1" x2="1">
|
||||
<stop offset="0%" stop-color="royalblue"/>
|
||||
<stop offset="33%" stop-color="white"/>
|
||||
<stop offset="50%" stop-color="darkblue"/>
|
||||
<stop offset="66%" stop-color="white"/>
|
||||
<stop offset="100%" stop-color="royalblue"/>
|
||||
</linearGradient>
|
||||
|
||||
<radialGradient id="radialGrad1" gradientUnits="objectBoundingBox" cx="0.5" cy="0.5" r="0.5" fx="0.15" fy="0.15">
|
||||
<stop offset="00%" stop-color="royalblue"/>
|
||||
<stop offset="33%" stop-color="white"/>
|
||||
<stop offset="50%" stop-color="darkblue"/>
|
||||
<stop offset="66%" stop-color="white"/>
|
||||
<stop offset="100%" stop-color="royalblue"/>
|
||||
</radialGradient>
|
||||
</defs>
|
||||
|
||||
<use xlink:href="use-02-extref-resource.svg#rect1" fill="url(#linearGrad1)"/>
|
||||
<use xlink:href="use-02-extref-resource.svg#rect2" fill="currentColor"/>
|
||||
<use xlink:href="use-02-extref-resource.svg#rect3"/>
|
||||
<use xlink:href="use-02-extref-resource.svg#rect4"/>
|
||||
</g>
|
||||
</svg>
|
До Ширина: | Высота: | Размер: 1.2 KiB |
|
@ -84,13 +84,9 @@ GetDeviceContextFor(nsPresContext* aPresContext)
|
|||
// things right in multi-monitor situations.
|
||||
// (It's not clear if this is really needed for GetDepth and GetColor,
|
||||
// but do it anyway.)
|
||||
nsIDeviceContext* ctx = nsLayoutUtils::GetDeviceContextForScreenInfo(
|
||||
return nsLayoutUtils::GetDeviceContextForScreenInfo(
|
||||
nsCOMPtr<nsIDocShell>(do_QueryInterface(
|
||||
nsCOMPtr<nsISupports>(aPresContext->GetContainer()))));
|
||||
if (!ctx) {
|
||||
ctx = aPresContext->DeviceContext();
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(nsresult)
|
||||
|
|
|
@ -408,22 +408,8 @@ nsresult nsSVGUtils::GetReferencedFrame(nsIFrame **aRefFrame, nsIURI* aURI, nsIC
|
|||
if (!content)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIDocument* doc = content->GetCurrentDoc();
|
||||
if (!doc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (aPresShell->GetDocument() != doc) {
|
||||
// External reference; switch to the right presshell
|
||||
aPresShell = doc->GetPrimaryShell();
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else {
|
||||
// Get the Primary Frame
|
||||
NS_ASSERTION(aPresShell,
|
||||
"Get referenced SVG frame -- no pres shell provided");
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get the Primary Frame
|
||||
NS_ASSERTION(aPresShell, "Get referenced SVG frame -- no pres shell provided");
|
||||
if (!aPresShell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
|
|
@ -53,4 +53,3 @@ load 409565-1.xhtml
|
|||
load 409573-1.svg
|
||||
load 429774-1.svg
|
||||
load 441368-1.svg
|
||||
load extref-test-1.xhtml
|
||||
|
|
|
@ -178,9 +178,7 @@ nsTitleBarFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
else {
|
||||
nsIPresShell* presShell = aPresContext->PresShell();
|
||||
nsPIDOMWindow *window = presShell->GetDocument()->GetWindow();
|
||||
if (window) {
|
||||
window->MoveBy(nsMoveBy.x, nsMoveBy.y);
|
||||
}
|
||||
window->MoveBy(nsMoveBy.x, nsMoveBy.y);
|
||||
}
|
||||
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
|
|
Загрузка…
Ссылка в новой задаче