84230 - DOM Inspector revival, rs=hyatt

This commit is contained in:
hewitt%netscape.com 2001-07-17 06:40:39 +00:00
parent f70ebcaecd
commit c61a75f15f
246 changed files with 11926 additions and 4914 deletions

View File

@ -13,11 +13,12 @@
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
# Joe Hewitt <hewitt@netscape.com> (original author)
DEPTH=../..
topsrcdir=@top_srcdir@
@ -26,7 +27,19 @@ VPATH=@srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS=resources base build
DIRS=base build
include $(topsrcdir)/config/rules.mk
install::
$(INSTALL) $(srcdir)/resources/content/res/viewer-registry.rdf $(DIST)/bin/res/inspector
$(INSTALL) $(srcdir)/resources/content/res/search-registry.rdf $(DIST)/bin/res/inspector
$(INSTALL) $(srcdir)/resources/content/prefs/inspector.js $(DIST)/bin/defaults/pref
install::
$(REGCHROME) content inspector inspector.jar
$(REGCHROME) locale en-US/inspector inspector.jar
$(REGCHROME) skin modern/inspector inspector.jar
$(REGCHROME) skin classic/inspector inspector.jar

View File

@ -13,11 +13,12 @@
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
# Joe Hewitt <hewitt@netscape.com> (original author)
DEPTH=../../..
topsrcdir=@top_srcdir@

View File

@ -14,10 +14,11 @@
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Joe Hewitt <hewitt@netscape.com> (original author)
DEPTH=..\..\..
include <$(DEPTH)/config/config.mak>

View File

@ -18,15 +18,19 @@
#
# Contributor(s):
# Scott Collins <scc@mozilla.org> (original author)
#
# Joe Hewitt <hewitt@netscape.com>
nsIDOMDSResource.idl
nsIInsDOMDataSource.idl
nsICSSRuleDataSource.idl
nsICSSDecDataSource.idl
nsICSSDecIntHolder.idl
inIDOMDataSource.idl
inIDOMRDFResource.idl
inIDeepTreeWalker.idl
inIFlasher.idl
inISearchProcess.idl
inISearchObserver.idl
inICSSValueSearch.idl
inIFileSearch.idl
inIDOMUtils.idl
inIScreenCapturer.idl
inIBitmap.idl
inIBitmapDepot.idl
inIBitmapURI.idl
inIPNGEncoder.idl

View File

@ -13,11 +13,12 @@
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
# Joe Hewitt <hewitt@netscape.com> (original author)
DEPTH=../../../..
topsrcdir=@top_srcdir@
@ -29,16 +30,20 @@ include $(DEPTH)/config/autoconf.mk
MODULE=inspector
XPIDL_MODULE=inspector
XPIDLSRCS = nsIDOMDSResource.idl \
nsIInsDOMDataSource.idl \
nsICSSRuleDataSource.idl \
nsICSSDecDataSource.idl \
nsICSSDecIntHolder.idl \
inIFlasher.idl \
inISearchProcess.idl \
inISearchObserver.idl \
inICSSValueSearch.idl \
inIFileSearch.idl \
XPIDLSRCS = inIDOMDataSource.idl \
inIDOMRDFResource.idl \
inIDeepTreeWalker.idl \
inIFlasher.idl \
inISearchProcess.idl \
inISearchObserver.idl \
inICSSValueSearch.idl \
inIFileSearch.idl \
inIDOMUtils.idl \
inIScreenCapturer.idl \
inIBitmap.idl \
inIBitmapDepot.idl \
inIBitmapURI.idl \
inIPNGEncoder.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,43 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "nsISupports.idl"
[ptr] native nativePRUint8(PRUint8);
[scriptable, uuid(BACF8FB9-1FE0-40f0-852C-193442B75C0F)]
interface inIBitmap : nsISupports
{
readonly attribute unsigned long width;
readonly attribute unsigned long height;
void init(in unsigned long aWidth, in unsigned long aHeight, in octet aBytesPerPixel);
wstring getPixelHex(in unsigned long aX, in unsigned long aY);
wstring putPixel(in unsigned long aX, in unsigned long aY, in octet aR, in octet aG, in octet aB);
wstring putPixelHex(in unsigned long aX, in unsigned long aY, in wstring aColor);
[noscript] void GetBits(out nativePRUint8 aBits);
};

View File

@ -0,0 +1,38 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "nsISupports.idl"
%{ C++
#include "nsString.h"
%}
interface inIBitmap;
[scriptable, uuid(9BAA65C2-2C9E-465e-9FE6-29F6C385DD38)]
interface inIBitmapDepot : nsISupports
{
void put(in inIBitmap aBitmap, in AString aName);
inIBitmap get(in AString aName);
inIBitmap remove(in AString aName);
};

View File

@ -0,0 +1,27 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*
* Contributors:
* Joe Hewitt <hewitt@netscape.com>
*/
#include "nsIURI.idl"
[scriptable, uuid(5F0D8F70-15A9-4c4d-B952-086005A8133C)]
interface inIBitmapURI : nsIURI
{
readonly attribute wstring bitmapName;
};

View File

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
/*
* The contents of this file are subject to the Netscape 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
@ -14,10 +13,11 @@
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "inISearchProcess.idl"

View File

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
/*
* The contents of this file are subject to the Netscape 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
@ -14,10 +13,11 @@
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "nsISupports.idl"
@ -26,22 +26,14 @@ interface nsIDOMDocument;
interface nsIRDFResource;
[scriptable, uuid(A029F6DD-9945-4607-850F-C8476387A52A)]
interface nsIInsDOMDataSource : nsISupports
interface inIDOMDataSource : nsISupports
{
attribute nsIDOMDocument document;
attribute boolean showAnonymousContent;
attribute boolean showSubDocuments;
void addFilterByType(in unsigned short aType, in boolean aExclusive);
void removeFilterByType(in unsigned short aType);
boolean isFiltered(in unsigned short aType);
nsIRDFResource getResourceForObject(in nsISupports aObject);
};
%{C++
/* {3AD0C13B-195E-48e7-AF29-F024E2D759EA} */
#define NS_INSDOMDATASOURCE_CID \
{ 0x3ad0c13b, 0x195e, 0x48e7, { 0xaf, 0x29, 0xf0, 0x24, 0xe2, 0xd7, 0x59, 0xea } }
%}

View File

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
/*
* The contents of this file are subject to the Netscape 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
@ -14,28 +13,16 @@
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "nsISupports.idl"
#include "domstubs.idl"
%{C++
#include "nsIDOMNode.h"
%}
[scriptable, uuid(F092D67C-0DBE-472e-82EA-BF70C9649A8A)]
interface nsIDOMDSResource : nsISupports {
interface inIDOMRDFResource : nsISupports {
attribute nsISupports object;
};
%{C++
/* {76C9161F-4C4C-4c1b-8F96-64587315C79E} */
#define NS_DOMDSRESOURCE_CID \
{ 0x76c9161f, 0x4c4c, 0x4c1b, { 0x8f, 0x96, 0x64, 0x58, 0x73, 0x15, 0xc7, 0x9e } }
%}

View File

@ -0,0 +1,45 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "nsISupports.idl"
interface nsISimpleEnumerator;
interface nsISupportsArray;
interface nsIDOMElement;
interface nsIDOMDocument;
interface nsIDOMCSSStyleRule;
[scriptable, uuid(FFFFD059-13D1-4ef7-ACB1-91188C6E31DD)]
interface inIDOMUtils : nsISupports
{
// CSS utilities
nsISupportsArray getStyleRules(in nsIDOMElement aElement);
unsigned long getRuleWeight(in nsIDOMCSSStyleRule aRule);
unsigned long getRuleLine(in nsIDOMCSSStyleRule aRule);
// XBL utilities
nsISimpleEnumerator getBindingURLs(in nsIDOMElement aElement);
// content state utilities
long getContentState(in nsIDOMElement aElement);
void setContentState(in nsIDOMElement aElement, in long aState);
};

View File

@ -0,0 +1,36 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "nsISupports.idl"
#include "nsIDOMTreeWalker.idl"
interface nsIDOMNode;
[scriptable, uuid(91FCA0E9-99D6-406b-9D78-4C96F11E9EE4)]
interface inIDeepTreeWalker : nsIDOMTreeWalker
{
attribute boolean showAnonymousContent;
attribute boolean showSubDocuments;
void init(in nsIDOMNode aRoot, in unsigned long aWhatToShow);
};

View File

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
/*
* The contents of this file are subject to the Netscape 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
@ -14,10 +13,11 @@
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "inISearchProcess.idl"

View File

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
/*
* The contents of this file are subject to the Netscape 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
@ -14,10 +13,11 @@
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "nsISupports.idl"
@ -29,7 +29,7 @@ interface nsIDOMWindowInternal;
[scriptable, uuid(7B4A099F-6F6E-4565-977B-FB622ADBFF49)]
interface inIFlasher : nsISupports
{
void drawElementOutline(in nsIDOMElement aElement, in nsIDOMWindowInternal aWindow, in wstring aColor, in long aThickness);
void repaintElement(in nsIDOMElement aElement, in nsIDOMWindowInternal aWindow);
void drawElementOutline(in nsIDOMElement aElement, in wstring aColor, in long aThickness);
void repaintElement(in nsIDOMElement aElement);
};

View File

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
@ -22,13 +22,13 @@
#include "nsISupports.idl"
interface nsIDOMDocument;
interface inIBitmap;
[scriptable, uuid(A7FC849B-A705-4da2-AF6C-989417548E6A)]
interface inISearchOrphanImages : nsISupports {
attribute wstring searchPath;
attribute wstring remotePath;
attribute boolean isSkin;
attribute nsIDOMDocument document;
[scriptable, uuid(EC4CE7FC-4268-4f6b-868A-6C0FE3863212)]
interface inIPNGEncoder : nsISupports
{
const short BIT8 = 0;
const short BIT24 = 1;
void writePNG(in inIBitmap aBitmap, in wstring aURL, in short aType);
};

View File

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
@ -22,19 +22,15 @@
#include "nsISupports.idl"
interface nsIDOMWindowInternal;
interface nsIDOMElement;
interface inIBitmap;
[scriptable, uuid(88B8B7CB-A1A0-4056-A2E1-04F4831C4C91)]
interface nsICSSRuleDataSource : nsISupports
[scriptable, uuid(18EE2F91-99F8-49c6-8638-6474D1E64F2D)]
interface inIScreenCapturer : nsISupports
{
attribute nsIDOMElement element;
inIBitmap captureElement(in nsIDOMElement aElement);
inIBitmap captureRegion(in nsIDOMWindowInternal aWindow, in long aX, in long aY, in long aWidth, in long aHeight);
};
%{C++
/* {71BCEACF-D73A-43f3-8F37-09BF916D7854} */
#define NS_CSSRULE_DATASOURCE_CID \
{ 0x71bceacf, 0xd73a, 0x43f3, { 0x8f, 0x37, 0x9, 0xbf, 0x91, 0x6d, 0x78, 0x54 } }
%}

View File

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
/*
* The contents of this file are subject to the Netscape 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
@ -14,10 +13,11 @@
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "nsISupports.idl"

View File

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
/*
* The contents of this file are subject to the Netscape 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
@ -14,10 +13,11 @@
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "nsISupports.idl"

View File

@ -14,23 +14,28 @@
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Joe Hewitt <hewitt@netscape.com> (original author)
DEPTH=..\..\..\..
XPIDLSRCS = .\nsIDOMDSResource.idl \
.\nsIInsDOMDataSource.idl \
.\nsICSSRuleDataSource.idl \
.\nsICSSDecDataSource.idl \
.\nsICSSDecIntHolder.idl \
.\inIFlasher.idl \
.\inISearchProcess.idl \
.\inISearchObserver.idl \
.\inICSSValueSearch.idl \
.\inIFileSearch.idl \
XPIDLSRCS = .\inIDOMDataSource.idl \
.\inIDOMRDFResource.idl \
.\inIDeepTreeWalker.idl \
.\inIFlasher.idl \
.\inISearchProcess.idl \
.\inISearchObserver.idl \
.\inICSSValueSearch.idl \
.\inIFileSearch.idl \
.\inIDOMUtils.idl \
.\inIScreenCapturer.idl \
.\inIBitmap.idl \
.\inIBitmapDepot.idl \
.\inIBitmapURI.idl \
.\inIPNGEncoder.idl \
$(NULL)
MODULE=inspector

View File

@ -13,7 +13,7 @@
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
@ -30,16 +30,23 @@ MODULE=inspector
LIBRARY_NAME=inspector_s
REQUIRES=xpcom string dom rdf rdfutil layout js widget locale gfx2 necko docshell view uriloader timer
CPPSRCS= \
nsDOMDSResource.cpp \
nsDOMDataSource.cpp \
nsCSSRuleDataSource.cpp \
nsCSSDecDataSource.cpp \
nsCSSDecIntHolder.cpp \
inFlasher.cpp \
inSearchLoop.cpp \
inCSSValueSearch.cpp \
inFileSearch.cpp \
CPPSRCS= \
inDOMDataSource.cpp \
inDOMRDFResource.cpp \
inDeepTreeWalker.cpp \
inFlasher.cpp \
inSearchLoop.cpp \
inCSSValueSearch.cpp \
inFileSearch.cpp \
inDOMUtils.cpp \
inLayoutUtils.cpp \
inBitmap.cpp \
inBitmapDepot.cpp \
inBitmapDecoder.cpp \
inBitmapProtocolHandler.cpp \
inBitmapChannel.cpp \
inBitmapURI.cpp \
inPNGEncoder.cpp \
$(NULL)
FORCE_STATIC_LIB = 1

View File

@ -1,27 +1,32 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
*
* 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 Communicator client code, released
* March 31, 1998.
*
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#ifndef __dsinfo_h__
#define __dsinfo_h__
#include "nsRDFCID.h"
#include "nsHashtable.h"
#define INS_NAMESPACE_URI "http://www.mozilla.org/inspector#"
#define IN_NAMESPACE_URI "http://www.mozilla.org/inspector#"
static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
@ -35,4 +40,5 @@ static NS_DEFINE_CID(kISupportsIID, NS_ISUPPORTS_IID);
// back and forth. Need to make sure this is thread-safe in the future, though.
static nsSupportsHashtable gDOMObjectTable;
#endif // __dsinfo_h__

View File

@ -0,0 +1,122 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "inBitmap.h"
#include "nsCOMPtr.h"
#include "nsString.h"
///////////////////////////////////////////////////////////////////////////////
inBitmap::inBitmap()
{
NS_INIT_REFCNT();
}
inBitmap::~inBitmap()
{
delete mBits;
}
NS_IMPL_ISUPPORTS1(inBitmap, inIBitmap);
///////////////////////////////////////////////////////////////////////////////
// inIBitmap
NS_IMETHODIMP
inBitmap::Init(PRUint32 aWidth, PRUint32 aHeight, PRUint8 aBytesPerPixel)
{
mWidth = aWidth;
mHeight = aHeight;
if (aBytesPerPixel == 8) {
mBits = new PRUint8[aWidth*aHeight];
} else if (aBytesPerPixel == 16) {
mBits = new PRUint8[aWidth*aHeight*2];
} else if (aBytesPerPixel == 32 || aBytesPerPixel == 24) {
mBits = new PRUint8[aWidth*aHeight*3];
}
return NS_OK;
}
NS_IMETHODIMP
inBitmap::GetWidth(PRUint32* aWidth)
{
*aWidth = mWidth;
return NS_OK;
}
NS_IMETHODIMP
inBitmap::GetHeight(PRUint32* aHeight)
{
*aHeight = mHeight;
return NS_OK;
}
NS_IMETHODIMP
inBitmap::GetBits(PRUint8** aBits)
{
*aBits = mBits;
return NS_OK;
}
NS_IMETHODIMP
inBitmap::GetPixelHex(PRUint32 aX, PRUint32 aY, PRUnichar **_retval)
{
if (aX < 0 || aX > mWidth || aY < 0 || aY > mHeight)
return NS_ERROR_FAILURE;
PRUint8* c = mBits + ((aX+(mWidth*aY))*3);
PRUint8 b = c[0];
PRUint8 g = c[1];
PRUint8 r = c[2];
char* s = new char[7];
sprintf(s, "#%2X%2X%2X", r, g, b);
// sprintf won't 0-pad my hex values, so I have to space-pad it
// and then replace space characters with zero characters
for (PRUint8 i = 0; i < 6; ++i)
if (s[i] == 32)
s[i] = 48;
nsAutoString str;
str.AssignWithConversion(s);
delete s;
*_retval = str.ToNewUnicode();
return NS_OK;
}
NS_IMETHODIMP
inBitmap::PutPixel(PRUint32 aX, PRUint32 aY, PRUint8 aR, PRUint8 aG, PRUint8 aB, PRUnichar **_retval)
{
return NS_OK;
}
NS_IMETHODIMP
inBitmap::PutPixelHex(PRUint32 aX, PRUint32 aY, const PRUnichar *aColor, PRUnichar **_retval)
{
return NS_OK;
}

View File

@ -0,0 +1,43 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#ifndef __inBitmap_h__
#define __inBitmap_h__
#include "inIBitmap.h"
class inBitmap : public inIBitmap
{
public:
NS_DECL_ISUPPORTS
NS_DECL_INIBITMAP
inBitmap();
~inBitmap();
protected:
PRUint32 mWidth;
PRUint32 mHeight;
PRUint8* mBits;
};
#endif // __inBitmap_h__

View File

@ -0,0 +1,278 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 Brian Ryner.
* Portions created by Brian Ryner are Copyright (C) 2000 Brian Ryner.
* All Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com>
*/
#include "inBitmapChannel.h"
#include "inIBitmapURI.h"
#include "nsIServiceManager.h"
#include "nsIInterfaceRequestor.h"
#include "nsXPIDLString.h"
#include "nsMemory.h"
#include "nsIStringStream.h"
#include "nsIURL.h"
#include "nsNetUtil.h"
#include "nsIFile.h"
#include "nsIFileChannel.h"
#include "nsIMIMEService.h"
#include "nsCExternalHandlerService.h"
#include "inIBitmap.h"
#include "inIBitmapDepot.h"
inBitmapChannel::inBitmapChannel()
{
NS_INIT_REFCNT();
mStatus = NS_OK;
}
inBitmapChannel::~inBitmapChannel()
{}
NS_IMPL_THREADSAFE_ISUPPORTS2(inBitmapChannel,
nsIChannel,
nsIRequest)
nsresult
inBitmapChannel::Init(nsIURI* uri)
{
NS_ASSERTION(uri, "no uri");
mUrl = uri;
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsIRequest
NS_IMETHODIMP
inBitmapChannel::GetName(PRUnichar* *result)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
inBitmapChannel::IsPending(PRBool *result)
{
NS_NOTREACHED("inBitmapChannel::IsPending");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
inBitmapChannel::GetStatus(nsresult *status)
{
*status = mStatus;
return NS_OK;
}
NS_IMETHODIMP
inBitmapChannel::Cancel(nsresult status)
{
NS_ASSERTION(NS_FAILED(status), "shouldn't cancel with a success code");
nsresult rv = NS_ERROR_FAILURE;
mStatus = status;
return rv;
}
NS_IMETHODIMP
inBitmapChannel::Suspend(void)
{
NS_NOTREACHED("inBitmapChannel::Suspend");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
inBitmapChannel::Resume(void)
{
NS_NOTREACHED("inBitmapChannel::Resume");
return NS_ERROR_NOT_IMPLEMENTED;
}
////////////////////////////////////////////////////////////////////////////////
// nsIChannel methods:
NS_IMETHODIMP
inBitmapChannel::GetOriginalURI(nsIURI* *aURI)
{
*aURI = mOriginalURI ? mOriginalURI : mUrl;
NS_ADDREF(*aURI);
return NS_OK;
}
NS_IMETHODIMP
inBitmapChannel::SetOriginalURI(nsIURI* aURI)
{
mOriginalURI = aURI;
return NS_OK;
}
NS_IMETHODIMP
inBitmapChannel::GetURI(nsIURI* *aURI)
{
*aURI = mUrl;
NS_IF_ADDREF(*aURI);
return NS_OK;
}
NS_IMETHODIMP
inBitmapChannel::Open(nsIInputStream **_retval)
{
printf("A OPENING BITMAP STREAM\n");
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP inBitmapChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *ctxt)
{
nsCOMPtr<inIBitmapDepot> depot(do_GetService("@mozilla.org/inspector/bitmap-depot;1"));
nsCOMPtr<inIBitmapURI> uri(do_QueryInterface(mUrl));
PRUnichar* name;
uri->GetBitmapName(&name);
nsAutoString durl;
durl.Assign(name);
nsCOMPtr<inIBitmap> bitmap;
depot->Get(durl, getter_AddRefs(bitmap));
PRUint32 w, h;
bitmap->GetWidth(&w);
bitmap->GetHeight(&h);
PRUint8* bitmapBuf;
bitmap->GetBits(&bitmapBuf);
aListener->OnStartRequest(this, ctxt);
PRUint32 length = (w*h*3) + (sizeof(PRUint32)*2);
PRUint8* buffer = new PRUint8[length];
PRUint8* bufStart = buffer;
PRUint32* wbuf = (PRUint32*) buffer;
wbuf[0] = w;
wbuf[1] = h;
buffer = (PRUint8*)(wbuf+2);
PRUint32 p = 0;
for (PRUint32 i = 0; i < w*h; ++i) {
buffer[0] = bitmapBuf[0];
buffer[1] = bitmapBuf[1];
buffer[2] = bitmapBuf[2];
buffer += 3;
bitmapBuf += 3;
}
// turn our string into a stream...and make the appropriate calls on our consumer
nsCOMPtr<nsISupports> streamSupports;
NS_NewByteInputStream(getter_AddRefs(streamSupports), (const char*)bufStart, length);
nsCOMPtr<nsIInputStream> inputStr (do_QueryInterface(streamSupports));
aListener->OnDataAvailable(this, ctxt, inputStr, 0, length);
aListener->OnStopRequest(this, ctxt, NS_OK);
return NS_OK;
}
NS_IMETHODIMP inBitmapChannel::GetLoadFlags(PRUint32 *aLoadAttributes)
{
*aLoadAttributes = mLoadAttributes;
return NS_OK;
}
NS_IMETHODIMP inBitmapChannel::SetLoadFlags(PRUint32 aLoadAttributes)
{
mLoadAttributes = aLoadAttributes;
return NS_OK;
}
NS_IMETHODIMP inBitmapChannel::GetContentType(char* *aContentType)
{
if (!aContentType) return NS_ERROR_NULL_POINTER;
*aContentType = nsCRT::strdup("image/inspector-bitmap");
if (!*aContentType) return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
NS_IMETHODIMP
inBitmapChannel::SetContentType(const char *aContentType)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP inBitmapChannel::GetContentLength(PRInt32 *aContentLength)
{
*aContentLength = mContentLength;
return NS_OK;
}
NS_IMETHODIMP
inBitmapChannel::SetContentLength(PRInt32 aContentLength)
{
NS_NOTREACHED("inBitmapChannel::SetContentLength");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
inBitmapChannel::GetLoadGroup(nsILoadGroup* *aLoadGroup)
{
*aLoadGroup = mLoadGroup;
NS_IF_ADDREF(*aLoadGroup);
return NS_OK;
}
NS_IMETHODIMP
inBitmapChannel::SetLoadGroup(nsILoadGroup* aLoadGroup)
{
mLoadGroup = aLoadGroup;
return NS_OK;
}
NS_IMETHODIMP
inBitmapChannel::GetOwner(nsISupports* *aOwner)
{
*aOwner = mOwner.get();
NS_IF_ADDREF(*aOwner);
return NS_OK;
}
NS_IMETHODIMP
inBitmapChannel::SetOwner(nsISupports* aOwner)
{
mOwner = aOwner;
return NS_OK;
}
NS_IMETHODIMP
inBitmapChannel::GetNotificationCallbacks(nsIInterfaceRequestor* *aNotificationCallbacks)
{
*aNotificationCallbacks = mCallbacks.get();
NS_IF_ADDREF(*aNotificationCallbacks);
return NS_OK;
}
NS_IMETHODIMP
inBitmapChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCallbacks)
{
mCallbacks = aNotificationCallbacks;
return NS_OK;
}
NS_IMETHODIMP
inBitmapChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
{
*aSecurityInfo = nsnull;
return NS_OK;
}

View File

@ -0,0 +1,59 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 Brian Ryner.
* Portions created by Brian Ryner are Copyright (C) 2000 Brian Ryner.
* All Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com>
*/
#ifndef __inBitmapChannel_h___
#define __inBitmapChannel_h___
#include "nsCOMPtr.h"
#include "nsXPIDLString.h"
#include "nsIChannel.h"
#include "nsILoadGroup.h"
#include "nsIInterfaceRequestor.h"
#include "nsIURI.h"
class nsIFile;
class inBitmapChannel : public nsIChannel
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIREQUEST
NS_DECL_NSICHANNEL
inBitmapChannel();
virtual ~inBitmapChannel();
nsresult Init(nsIURI* uri);
protected:
nsCOMPtr<nsIURI> mUrl;
nsCOMPtr<nsIURI> mOriginalURI;
PRUint32 mLoadAttributes;
PRInt32 mContentLength;
nsCOMPtr<nsILoadGroup> mLoadGroup;
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
nsCOMPtr<nsISupports> mOwner;
nsresult mStatus;
};
#endif // __inBitmapChannel_h___

View File

@ -0,0 +1,175 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com>
*
*/
#include "inBitmapDecoder.h"
#include "nsIInputStream.h"
#include "imgIContainer.h"
#include "imgIContainerObserver.h"
#include "nspr.h"
#include "nsIComponentManager.h"
#include "nsRect.h"
NS_IMPL_THREADSAFE_ADDREF(inBitmapDecoder);
NS_IMPL_THREADSAFE_RELEASE(inBitmapDecoder);
NS_INTERFACE_MAP_BEGIN(inBitmapDecoder)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIOutputStream)
NS_INTERFACE_MAP_ENTRY(nsIOutputStream)
NS_INTERFACE_MAP_ENTRY(imgIDecoder)
NS_INTERFACE_MAP_END_THREADSAFE
inBitmapDecoder::inBitmapDecoder()
{
NS_INIT_ISUPPORTS();
}
inBitmapDecoder::~inBitmapDecoder()
{ }
/** imgIDecoder methods **/
NS_IMETHODIMP inBitmapDecoder::Init(imgIRequest *aRequest)
{
mRequest = aRequest;
mObserver = do_QueryInterface(aRequest); // we're holding 2 strong refs to the request.
mImage = do_CreateInstance("@mozilla.org/image/container;1");
aRequest->SetImage(mImage);
mFrame = do_CreateInstance("@mozilla.org/gfx/image/frame;2");
if (!mFrame) return NS_ERROR_FAILURE;
return NS_OK;
}
/** nsIOutputStream methods **/
NS_IMETHODIMP inBitmapDecoder::Close()
{
if (mObserver)
{
mObserver->OnStopFrame(nsnull, nsnull, mFrame);
mObserver->OnStopContainer(nsnull, nsnull, mImage);
mObserver->OnStopDecode(nsnull, nsnull, NS_OK, nsnull);
}
return NS_OK;
}
NS_IMETHODIMP inBitmapDecoder::Flush()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP inBitmapDecoder::Write(const char *buf, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP inBitmapDecoder::WriteFrom(nsIInputStream *inStr, PRUint32 count, PRUint32 *_retval)
{
nsresult rv;
char *buf = (char *)PR_Malloc(count);
if (!buf) return NS_ERROR_OUT_OF_MEMORY; /* we couldn't allocate the object */
// read the data from the input stram...
PRUint32 readLen;
rv = inStr->Read(buf, count, &readLen);
char *data = buf;
if (NS_FAILED(rv)) return rv;
mObserver->OnStartDecode(nsnull, nsnull);
PRUint32* wbuf = (PRUint32*) data;
PRInt32 w, h;
w = wbuf[0];
h = wbuf[1];
data = (char*) (wbuf+2);
mImage->Init(w, h, mObserver);
if (mObserver)
mObserver->OnStartContainer(nsnull, nsnull, mImage);
mFrame->Init(0, 0, w, h, gfxIFormats::RGB);
mImage->AppendFrame(mFrame);
if (mObserver)
mObserver->OnStartFrame(nsnull, nsnull, mFrame);
PRUint32 bpr;
nscoord width, height;
mFrame->GetImageBytesPerRow(&bpr);
mFrame->GetWidth(&width);
mFrame->GetHeight(&height);
PRUint32 realBpr = width*3;
PRUint32 i = 0;
PRInt32 rownum = 0;
do
{
PRUint8 *line = (PRUint8*)data + i*realBpr;
mFrame->SetImageData(line, realBpr, (rownum++)*bpr);
nsRect r(0, rownum, width, 1);
mObserver->OnDataAvailable(nsnull, nsnull, mFrame, &r);
++i;
} while(rownum < height);
PR_FREEIF(buf);
return NS_OK;
}
NS_IMETHODIMP inBitmapDecoder::WriteSegments(nsReadSegmentFun reader, void * closure, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP inBitmapDecoder::GetNonBlocking(PRBool *aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP inBitmapDecoder::SetNonBlocking(PRBool aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP inBitmapDecoder::GetObserver(nsIOutputStreamObserver * *aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP inBitmapDecoder::SetObserver(nsIOutputStreamObserver * aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@ -0,0 +1,52 @@
/*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com>
*/
#ifndef __inBitmapDecoder_h__
#define __inBitmapDecoder_h__
#include "imgIDecoder.h"
#include "nsCOMPtr.h"
#include "imgIContainer.h"
#include "imgIDecoderObserver.h"
#include "gfxIImageFrame.h"
#include "imgIRequest.h"
class inBitmapDecoder : public imgIDecoder
{
public:
NS_DECL_ISUPPORTS
NS_DECL_IMGIDECODER
NS_DECL_NSIOUTPUTSTREAM
inBitmapDecoder();
virtual ~inBitmapDecoder();
private:
nsCOMPtr<imgIContainer> mImage;
nsCOMPtr<gfxIImageFrame> mFrame;
nsCOMPtr<imgIRequest> mRequest;
nsCOMPtr<imgIDecoderObserver> mObserver; // this is just qi'd from mRequest for speed
};
#endif // __inBitmapDecoder_h__

View File

@ -0,0 +1,80 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "inBitmapDepot.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "inIBitmap.h"
///////////////////////////////////////////////////////////////////////////////
inBitmapDepot::inBitmapDepot()
{
NS_INIT_REFCNT();
}
inBitmapDepot::~inBitmapDepot()
{
}
NS_IMPL_ISUPPORTS1(inBitmapDepot, inIBitmapDepot);
///////////////////////////////////////////////////////////////////////////////
// inIBitmapDepot
NS_IMETHODIMP
inBitmapDepot::Put(inIBitmap* aBitmap, const nsAReadableString& aName)
{
nsStringKey key(aName);
nsCOMPtr<inIBitmap> bitmap(aBitmap);
nsCOMPtr<nsISupports> supports = do_QueryInterface(bitmap);
mHash.Put(&key, supports);
return NS_OK;
}
NS_IMETHODIMP
inBitmapDepot::Get(const nsAReadableString& aName, inIBitmap** _retval)
{
nsStringKey key(aName);
nsCOMPtr<nsISupports> supports = mHash.Get(&key);
nsCOMPtr<inIBitmap> bitmap = do_QueryInterface(supports);
*_retval = bitmap;
NS_IF_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP
inBitmapDepot::Remove(const nsAReadableString& aName, inIBitmap** _retval)
{
nsStringKey key(aName);
nsCOMPtr<nsISupports> supports;
mHash.Remove(&key, getter_AddRefs(supports));
nsCOMPtr<inIBitmap> bitmap = do_QueryInterface(supports);
*_retval = bitmap;
NS_IF_ADDREF(*_retval);
return NS_OK;
}

View File

@ -0,0 +1,42 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#ifndef __inBitmapDepot_h__
#define __inBitmapDepot_h__
#include "inIBitmapDepot.h"
#include "nsHashtable.h"
class inBitmapDepot : public inIBitmapDepot
{
public:
NS_DECL_ISUPPORTS
NS_DECL_INIBITMAPDEPOT
inBitmapDepot();
~inBitmapDepot();
protected:
nsSupportsHashtable mHash;
};
#endif // __inBitmapDepot_h__

View File

@ -0,0 +1,98 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 Brian Ryner.
* Portions created by Brian Ryner are Copyright (C) 2000 Brian Ryner.
* All Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com>
*/
#include "inBitmapChannel.h"
#include "inBitmapURI.h"
#include "inBitmapProtocolHandler.h"
#include "nsIURL.h"
#include "nsCRT.h"
#include "nsCOMPtr.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsNetCID.h"
////////////////////////////////////////////////////////////////////////////////
inBitmapProtocolHandler::inBitmapProtocolHandler()
{
NS_INIT_REFCNT();
}
inBitmapProtocolHandler::~inBitmapProtocolHandler()
{}
NS_IMPL_ISUPPORTS2(inBitmapProtocolHandler, nsIProtocolHandler, nsISupportsWeakReference)
////////////////////////////////////////////////////////////////////////////////
// nsIProtocolHandler
NS_IMETHODIMP inBitmapProtocolHandler::GetScheme(char* *result)
{
*result = nsCRT::strdup("moz-bitmap");
if (!*result) return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
NS_IMETHODIMP inBitmapProtocolHandler::GetDefaultPort(PRInt32 *result)
{
*result = 0;
return NS_OK;
}
NS_IMETHODIMP inBitmapProtocolHandler::AllowPort(PRInt32 port, const char *scheme, PRBool *_retval)
{
// don't override anything.
*_retval = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP inBitmapProtocolHandler::NewURI(const char *aSpec, nsIURI *aBaseURI, nsIURI **result)
{
// no concept of a relative bitmap url
NS_ASSERTION(!aBaseURI, "base url passed into bitmap protocol handler");
nsCOMPtr<nsIURI> uri;
NS_NEWXPCOM(uri, inBitmapURI);
if (!uri) return NS_ERROR_FAILURE;
uri->SetSpec(aSpec);
*result = uri;
NS_IF_ADDREF(*result);
return NS_OK;
}
NS_IMETHODIMP inBitmapProtocolHandler::NewChannel(nsIURI* url, nsIChannel* *result)
{
nsCOMPtr<nsIChannel> channel;
NS_NEWXPCOM(channel, inBitmapChannel);
if (channel)
NS_STATIC_CAST(inBitmapChannel*,NS_STATIC_CAST(nsIChannel*, channel))->Init(url);
*result = channel;
NS_IF_ADDREF(*result);
return NS_OK;
}

View File

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
/*
* The contents of this file are subject to the Netscape 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
@ -18,23 +17,24 @@
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com>
*/
#include "nsISupports.idl"
#ifndef __inBitmapProtocolHandler_h___
#define __inBitmapProtocolHandler_h___
[scriptable, uuid(AC2EEEC0-8C36-4792-9020-3A81D9AA3110)]
interface nsICSSDecIntHolder : nsISupports
#include "nsWeakReference.h"
#include "nsIProtocolHandler.h"
class inBitmapProtocolHandler : public nsIProtocolHandler,
public nsSupportsWeakReference
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIPROTOCOLHANDLER
inBitmapProtocolHandler();
virtual ~inBitmapProtocolHandler();
};
%{C++
/* {32E9DAA2-6D24-46bc-B2A6-E97839650EDA} */
#define NS_CSSDECINTHOLDER_CID \
{ 0x32e9daa2, 0x6d24, 0x46bc, { 0xb2, 0xa6, 0xe9, 0x78, 0x39, 0x65, 0xe, 0xda } }
#define NS_CSSDECINTHOLDER_CONTRACTID \
"@mozilla.org/inspector/cssdecIntHolder;1"
%}
#endif // __inBitmapProtocolHandler_h___

View File

@ -0,0 +1,281 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*
* Contributors:
* Joe Hewitt <hewitt@netscape.com>
*/
#include "inBitmapURI.h"
#include "nsNetUtil.h"
#include "nsIIOService.h"
#include "nsIURL.h"
#include "nsCRT.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#define DEFAULT_IMAGE_SIZE 16
void extractAttributeValue(const char * searchString, const char * attributeName, char ** result);
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_THREADSAFE_ISUPPORTS2(inBitmapURI, inIBitmapURI, nsIURI)
#define NS_BITMAP_SCHEME "moz-bitmap:"
#define NS_BITMAP_DELIMITER '?'
inBitmapURI::inBitmapURI()
{
NS_INIT_REFCNT();
}
inBitmapURI::~inBitmapURI()
{
}
////////////////////////////////////////////////////////////////////////////////
// inIBitmapURI
NS_IMETHODIMP
inBitmapURI::GetBitmapName(PRUnichar** aBitmapName)
{
*aBitmapName = mBitmapName.ToNewUnicode();
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
nsresult
inBitmapURI::FormatSpec(char* *result)
{
nsresult rv = NS_OK;
nsCString spec(NS_BITMAP_SCHEME);
spec += "//";
spec += mBitmapName;
*result = nsCRT::strdup(spec);
return *result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
////////////////////////////////////////////////////////////////////////////////
// nsIURI
NS_IMETHODIMP
inBitmapURI::GetSpec(char* *aSpec)
{
return FormatSpec(aSpec);
}
// takes a string like ?size=32&contentType=text/html and returns a new string
// containing just the attribute value. i.e you could pass in this string with
// an attribute name of size, this will return 32
// Assumption: attribute pairs in the string are separated by '&'.
void extractAttributeValue(const char * searchString, const char * attributeName, char ** result)
{
//NS_ENSURE_ARG_POINTER(extractAttributeValue);
char * attributeValue = nsnull;
if (searchString && attributeName)
{
// search the string for attributeName
PRUint32 attributeNameSize = PL_strlen(attributeName);
char * startOfAttribute = PL_strcasestr(searchString, attributeName);
if (startOfAttribute)
{
startOfAttribute += attributeNameSize; // skip over the attributeName
if (startOfAttribute) // is there something after the attribute name
{
char * endofAttribute = startOfAttribute ? PL_strchr(startOfAttribute, '&') : nsnull;
if (startOfAttribute && endofAttribute) // is there text after attribute value
attributeValue = PL_strndup(startOfAttribute, endofAttribute - startOfAttribute);
else // there is nothing left so eat up rest of line.
attributeValue = PL_strdup(startOfAttribute);
} // if we have a attribute value
} // if we have a attribute name
} // if we got non-null search string and attribute name values
*result = attributeValue; // passing ownership of attributeValue into result...no need to
return;
}
NS_IMETHODIMP
inBitmapURI::SetSpec(const char* aSpec)
{
nsresult rv;
nsCOMPtr<nsIIOService> ioService (do_GetService(kIOServiceCID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
PRUint32 startPos, endPos;
rv = ioService->ExtractScheme(aSpec, &startPos, &endPos, nsnull);
NS_ENSURE_SUCCESS(rv, rv);
if (nsCRT::strncmp("moz-bitmap", &aSpec[startPos], endPos - startPos - 1) != 0)
return NS_ERROR_MALFORMED_URI;
nsCAutoString path(aSpec);
PRInt32 pos = path.FindChar(NS_BITMAP_DELIMITER);
if (pos == -1) // additional parameters
{
path.Right(mBitmapName, path.Length() - endPos);
}
else
{
path.Mid(mBitmapName, endPos, pos - endPos);
// TODO: parse out other parameters
}
return NS_OK;
}
NS_IMETHODIMP
inBitmapURI::GetPrePath(char** prePath)
{
*prePath = nsCRT::strdup(NS_BITMAP_SCHEME);
return *prePath ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
NS_IMETHODIMP
inBitmapURI::SetPrePath(const char* prePath)
{
NS_NOTREACHED("inBitmapURI::SetPrePath");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
inBitmapURI::GetScheme(char * *aScheme)
{
*aScheme = nsCRT::strdup("moz-bitmap");
return *aScheme ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
NS_IMETHODIMP
inBitmapURI::SetScheme(const char * aScheme)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
inBitmapURI::GetUsername(char * *aUsername)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
inBitmapURI::SetUsername(const char * aUsername)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
inBitmapURI::GetPassword(char * *aPassword)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
inBitmapURI::SetPassword(const char * aPassword)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
inBitmapURI::GetPreHost(char * *aPreHost)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
inBitmapURI::SetPreHost(const char * aPreHost)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
inBitmapURI::GetHost(char * *aHost)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
inBitmapURI::SetHost(const char * aHost)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
inBitmapURI::GetPort(PRInt32 *aPort)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
inBitmapURI::SetPort(PRInt32 aPort)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
inBitmapURI::GetPath(char * *aPath)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
inBitmapURI::SetPath(const char * aPath)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
inBitmapURI::Equals(nsIURI *other, PRBool *result)
{
nsXPIDLCString spec1;
nsXPIDLCString spec2;
other->GetSpec(getter_Copies(spec2));
GetSpec(getter_Copies(spec1));
if (!nsCRT::strcasecmp(spec1, spec2))
*result = PR_TRUE;
else
*result = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
inBitmapURI::SchemeIs(const char *i_Scheme, PRBool *o_Equals)
{
NS_ENSURE_ARG_POINTER(o_Equals);
if (!i_Scheme) return NS_ERROR_INVALID_ARG;
*o_Equals = PL_strcasecmp("moz-bitmap", i_Scheme) ? PR_FALSE : PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP
inBitmapURI::Clone(nsIURI **result)
{
return NS_OK;
}
NS_IMETHODIMP
inBitmapURI::Resolve(const char *relativePath, char **result)
{
return NS_OK;
}

View File

@ -0,0 +1,44 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*
* Contributors:
* Joe Hewitt <hewitt@netscape.com>
*/
#ifndef __inBitmapURI_h__
#define __inBitmapURI_h__
#include "inIBitmapURI.h"
#include "nsCOMPtr.h"
#include "nsString.h"
class inBitmapURI : public inIBitmapURI
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIURI
NS_DECL_INIBITMAPURI
inBitmapURI();
virtual ~inBitmapURI();
protected:
nsCString mBitmapName;
nsresult FormatSpec(char** result);
};
#endif // __inBitmapURI_h__

View File

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
/*
* The contents of this file are subject to the Netscape 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
@ -14,10 +13,11 @@
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "inCSSValueSearch.h"

View File

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
/*
* The contents of this file are subject to the Netscape 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
@ -14,10 +13,11 @@
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#ifndef __inCSSValueSearch_h__
@ -73,13 +73,4 @@ public:
NS_DECL_INICSSVALUESEARCH
};
//////////////////////////////////////////////////////////////
// {4D977F60-FBE7-4583-8CB7-F5ED882293EF}
#define IN_CSSVALUESEARCH_CID \
{ 0x4d977f60, 0xfbe7, 0x4583, { 0x8c, 0xb7, 0xf5, 0xed, 0x88, 0x22, 0x93, 0xef } }
#define IN_CSSVALUESEARCH_CONTRACTID \
"@mozilla.org/inspector/search;1?type=cssvalue"
#endif
#endif // __inCSSValueSearch_h__

View File

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-file-style: "stroustrup" -*-
*
/*
* The contents of this file are subject to the Netscape 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
@ -14,20 +13,31 @@
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributors:
* Joe Hewitt <hewitt@netscape.com> (Original Author)
*
* Note: This code is originally based on Alec Flett's DOM Viewer
* at /mozilla/rdf/tests/domds. I trimmed and pruned a bit to remove
* stuff I didn't need, fixed stuff that was broken, and added new stuff.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "nsDOMDataSource.h"
#include "inDOMDataSource.h"
#include "dsinfo.h"
#include "inLayoutUtils.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIDOMNode.h"
#include "nsIDOMAttr.h"
#include "nsIDOMElement.h"
#include "nsIDOMNamedNodeMap.h"
#include "nsIDOMNodeList.h"
#include "nsIDocument.h"
#include "nsIXBLBinding.h"
#include "nsIBindingManager.h"
#include "rdf.h"
#include "nsIServiceManager.h"
#include "nsEnumeratorUtils.h"
#include "prprf.h"
////////////////////////////////////////////////////////////////////////
// globals and constants
@ -36,114 +46,84 @@
#define RDFEVENT_ASSERT 1
#define RDFEVENT_UNASSERT 2
#define INS_RDF_DOMROOT "inspector:DOMRoot"
#define INS_RDF_CHILD INS_NAMESPACE_URI "Child"
#define INS_RDF_ATTRIBUTE INS_NAMESPACE_URI "Attribute"
#define INS_RDF_NODENAME INS_NAMESPACE_URI "nodeName"
#define INS_RDF_NODEVALUE INS_NAMESPACE_URI "nodeValue"
#define INS_RDF_NODETYPE INS_NAMESPACE_URI "nodeType"
#define INS_RDF_PREFIX INS_NAMESPACE_URI "prefix"
#define INS_RDF_LOCALNAME INS_NAMESPACE_URI "localName"
#define INS_RDF_NAMESPACEURI INS_NAMESPACE_URI "namespaceURI"
#define INS_RDF_ANONYMOUS INS_NAMESPACE_URI "Anonymous"
#define INS_RDF_HASCHILDREN INS_NAMESPACE_URI "HasChildren"
#define IN_RDF_DOMROOT "inspector:DOMRoot"
#define IN_RDF_CHILD IN_NAMESPACE_URI "Child"
#define IN_RDF_ATTRIBUTE IN_NAMESPACE_URI "Attribute"
#define IN_RDF_NODENAME IN_NAMESPACE_URI "nodeName"
#define IN_RDF_NODEVALUE IN_NAMESPACE_URI "nodeValue"
#define IN_RDF_NODETYPE IN_NAMESPACE_URI "nodeType"
#define IN_RDF_PREFIX IN_NAMESPACE_URI "prefix"
#define IN_RDF_LOCALNAME IN_NAMESPACE_URI "localName"
#define IN_RDF_NAMESPACEURI IN_NAMESPACE_URI "namespaceURI"
#define IN_RDF_ANONYMOUS IN_NAMESPACE_URI "Anonymous"
#define IN_RDF_HASCHILDREN IN_NAMESPACE_URI "HasChildren"
static PRInt32 gCurrentId = 0;
nsIRDFResource* kINS_DOMRoot;
nsIRDFResource* kINS_Child;
nsIRDFResource* kINS_Attribute;
nsIRDFResource* kINS_NodeName;
nsIRDFResource* kINS_NodeValue;
nsIRDFResource* kINS_NodeType;
nsIRDFResource* kINS_Prefix;
nsIRDFResource* kINS_LocalName;
nsIRDFResource* kINS_NamespaceURI;
nsIRDFResource* kINS_Anonymous;
nsIRDFResource* kINS_HasChildren;
////////////////////////////////////////////////////////////////////////
nsDOMDataSource::nsDOMDataSource() :
inDOMDataSource::inDOMDataSource() :
mDocument(nsnull),
mObservers(nsnull)
{
NS_INIT_REFCNT();
mShowAnonymousContent = new PRBool;
*mShowAnonymousContent = PR_TRUE;
mShowAnonymousContent = PR_FALSE;
mShowSubDocuments = PR_FALSE;
// show all node types by default
mFilters = new PRUint16;
*mFilters = 65535;
mFilters = 65535;
}
nsresult
nsDOMDataSource::Init()
inDOMDataSource::Init()
{
//printf("creating nsDOMDataSource (%d) *************************\n", this);
nsresult rv = nsServiceManager::GetService(kRDFServiceCID, NS_GET_IID(nsIRDFService), (nsISupports**) &mRDFService);
// printf("creating inDOMDataSource (%d) *************************\n", this);
nsresult rv = nsServiceManager::GetService(kRDFServiceCID, NS_GET_IID(nsIRDFService), getter_AddRefs(mRDFService));
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");
if (NS_FAILED(rv)) return rv;
mRDFService->GetResource(INS_RDF_DOMROOT, &kINS_DOMRoot);
mRDFService->GetResource(INS_RDF_ATTRIBUTE, &kINS_Attribute);
mRDFService->GetResource(INS_RDF_CHILD, &kINS_Child);
mRDFService->GetResource(INS_RDF_NODENAME, &kINS_NodeName);
mRDFService->GetResource(INS_RDF_NODEVALUE, &kINS_NodeValue);
mRDFService->GetResource(INS_RDF_NODETYPE, &kINS_NodeType);
mRDFService->GetResource(INS_RDF_PREFIX, &kINS_Prefix);
mRDFService->GetResource(INS_RDF_LOCALNAME, &kINS_LocalName);
mRDFService->GetResource(INS_RDF_NAMESPACEURI, &kINS_NamespaceURI);
mRDFService->GetResource(INS_RDF_ANONYMOUS, &kINS_Anonymous);
mRDFService->GetResource(INS_RDF_HASCHILDREN, &kINS_HasChildren);
mRDFService->GetResource(IN_RDF_DOMROOT, getter_AddRefs(kINS_DOMRoot));
mRDFService->GetResource(IN_RDF_ATTRIBUTE, getter_AddRefs(kINS_Attribute));
mRDFService->GetResource(IN_RDF_CHILD, getter_AddRefs(kINS_Child));
mRDFService->GetResource(IN_RDF_NODEVALUE, getter_AddRefs(kINS_NodeValue));
mRDFService->GetResource(IN_RDF_NODETYPE, getter_AddRefs(kINS_NodeType));
mRDFService->GetResource(IN_RDF_PREFIX, getter_AddRefs(kINS_Prefix));
mRDFService->GetResource(IN_RDF_LOCALNAME, getter_AddRefs(kINS_LocalName));
mRDFService->GetResource(IN_RDF_NAMESPACEURI, getter_AddRefs(kINS_NamespaceURI));
mRDFService->GetResource(IN_RDF_ANONYMOUS, getter_AddRefs(kINS_Anonymous));
mRDFService->GetResource(IN_RDF_HASCHILDREN, getter_AddRefs(kINS_HasChildren));
mRDFService->GetResource(IN_RDF_NODENAME, getter_AddRefs(kINS_NodeName));
return NS_OK;
}
nsDOMDataSource::~nsDOMDataSource()
inDOMDataSource::~inDOMDataSource()
{
//printf("destroying nsDOMDataSource (%d) *************************\n", this);
if (mRDFService) {
// printf("destroying inDOMDataSource (%d) *************************\n", this);
if (mRDFService)
nsServiceManager::ReleaseService(kRDFServiceCID, mRDFService);
mRDFService = nsnull;
}
if (mDocument) {
nsCOMPtr<nsIDocument> doc = do_QueryInterface(mDocument);
doc->RemoveObserver(this);
}
// commenting this out temporarily because it was causing crashes.
// TODO: figure out the right way to release these
/*
NS_IF_RELEASE(kINS_DOMRoot);
NS_IF_RELEASE(kINS_Attribute);
NS_IF_RELEASE(kINS_Child);
NS_IF_RELEASE(kINS_NodeName);
NS_IF_RELEASE(kINS_NodeValue);
NS_IF_RELEASE(kINS_NodeType);
NS_IF_RELEASE(kINS_LocalName);
NS_IF_RELEASE(kINS_NamespaceURI);
NS_IF_RELEASE(kINS_Anonymous);
NS_IF_RELEASE(kINS_HasChildren);
*/
}
////////////////////////////////////////////////////////////////////////
// nsISupports
NS_IMPL_ISUPPORTS3(nsDOMDataSource,
nsIInsDOMDataSource,
NS_IMPL_ISUPPORTS3(inDOMDataSource,
inIDOMDataSource,
nsIRDFDataSource,
nsIDocumentObserver);
////////////////////////////////////////////////////////////////////////
// nsIInsDOMDataSource
// inIDOMDataSource
NS_IMETHODIMP
nsDOMDataSource::GetDocument(nsIDOMDocument **aDocument)
inDOMDataSource::GetDocument(nsIDOMDocument **aDocument)
{
*aDocument = mDocument;
NS_IF_ADDREF(*aDocument);
@ -151,7 +131,7 @@ nsDOMDataSource::GetDocument(nsIDOMDocument **aDocument)
}
NS_IMETHODIMP
nsDOMDataSource::SetDocument(nsIDOMDocument* aDocument)
inDOMDataSource::SetDocument(nsIDOMDocument* aDocument)
{
nsresult rv;
@ -167,68 +147,78 @@ nsDOMDataSource::SetDocument(nsIDOMDocument* aDocument)
if (aDocument) {
doc = do_QueryInterface(mDocument, &rv);
// cache the binding manager
rv = doc->GetBindingManager(&mBindingManager);
if (NS_FAILED(rv)) return rv;
// add new document observer
doc = do_QueryInterface(mDocument, &rv);
if (NS_FAILED(rv)) return rv;
doc->AddObserver(this);
} else {
mBindingManager = nsnull;
}
return NS_OK;
}
NS_IMETHODIMP
nsDOMDataSource::GetShowAnonymousContent(PRBool *aShowAnonymousContent)
inDOMDataSource::GetShowAnonymousContent(PRBool *aShowAnonymousContent)
{
*aShowAnonymousContent = *mShowAnonymousContent;
*aShowAnonymousContent = mShowAnonymousContent;
return NS_OK;
}
NS_IMETHODIMP
nsDOMDataSource::SetShowAnonymousContent(PRBool aShowAnonymousContent)
inDOMDataSource::SetShowAnonymousContent(PRBool aShowAnonymousContent)
{
*mShowAnonymousContent = aShowAnonymousContent ? PR_TRUE : PR_FALSE;
mShowAnonymousContent = aShowAnonymousContent;
return NS_OK;
}
NS_IMETHODIMP
nsDOMDataSource::AddFilterByType(PRUint16 aType, PRBool aExclusive)
inDOMDataSource::GetShowSubDocuments(PRBool *aShowSubDocuments)
{
*aShowSubDocuments = mShowSubDocuments;
return NS_OK;
}
NS_IMETHODIMP
inDOMDataSource::SetShowSubDocuments(PRBool aShowSubDocuments)
{
mShowSubDocuments = aShowSubDocuments;
return NS_OK;
}
NS_IMETHODIMP
inDOMDataSource::AddFilterByType(PRUint16 aType, PRBool aExclusive)
{
PRUint16 key = GetNodeTypeKey(aType);
if (aExclusive) {
*mFilters = key;
mFilters = key;
} else {
*mFilters |= key;
mFilters |= key;
}
return NS_OK;
}
NS_IMETHODIMP
nsDOMDataSource::RemoveFilterByType(PRUint16 aType)
inDOMDataSource::RemoveFilterByType(PRUint16 aType)
{
PRUint16 key = GetNodeTypeKey(aType);
*mFilters -= key;
mFilters -= key;
return NS_OK;
}
NS_IMETHODIMP
nsDOMDataSource::IsFiltered(PRUint16 aType, PRBool* _retval)
inDOMDataSource::IsFiltered(PRUint16 aType, PRBool* _retval)
{
PRUint16 key = GetNodeTypeKey(aType);
*_retval = *mFilters & key;
*_retval = mFilters & key;
return NS_OK;
}
nsresult
nsDOMDataSource::GetResourceForObject(nsISupports* aObject, nsIRDFResource** _retval)
inDOMDataSource::GetResourceForObject(nsISupports* aObject, nsIRDFResource** _retval)
{
nsresult rv;
nsISupportsKey* objKey;
@ -244,7 +234,7 @@ nsDOMDataSource::GetResourceForObject(nsISupports* aObject, nsIRDFResource** _re
*_retval = res;
} else {
// it's not in the hash table, so add it.
char *uri = PR_smprintf(NS_DOMDSRESOURCE_ID "://%8.8X", gCurrentId++);
char *uri = PR_smprintf(IN_DOMRDFRESOURCE_ID "://%8.8X", gCurrentId++);
rv = GetRDFService()->GetResource(uri, _retval);
if (NS_FAILED(rv)) return rv;
@ -253,7 +243,7 @@ nsDOMDataSource::GetResourceForObject(nsISupports* aObject, nsIRDFResource** _re
gDOMObjectTable.Put(objKey, *_retval);
// now fill in the resource stuff
nsCOMPtr<nsIDOMDSResource> nodeContainer = do_QueryInterface(*_retval, &rv);
nsCOMPtr<inIDOMRDFResource> nodeContainer = do_QueryInterface(*_retval, &rv);
if (NS_FAILED(rv)) return rv;
nodeContainer->SetObject(aObject);
}
@ -262,7 +252,7 @@ nsDOMDataSource::GetResourceForObject(nsISupports* aObject, nsIRDFResource** _re
}
PRBool
nsDOMDataSource::IsObjectInCache(nsISupports* aObject)
inDOMDataSource::IsObjectInCache(nsISupports* aObject)
{
nsISupportsKey* objKey = new nsISupportsKey(aObject);
nsCOMPtr<nsISupports> supports = (nsISupports*) gDOMObjectTable.Get(objKey);
@ -279,7 +269,7 @@ nsDOMDataSource::IsObjectInCache(nsISupports* aObject)
// nsIRDFDataSource
NS_IMETHODIMP
nsDOMDataSource::GetURI(char** aURI)
inDOMDataSource::GetURI(char** aURI)
{
NS_PRECONDITION(aURI != nsnull, "null ptr");
if (!aURI) return NS_ERROR_NULL_POINTER;
@ -291,21 +281,21 @@ nsDOMDataSource::GetURI(char** aURI)
}
NS_IMETHODIMP
nsDOMDataSource::GetSource(nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue, nsIRDFResource **_retval)
inDOMDataSource::GetSource(nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue, nsIRDFResource **_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsDOMDataSource::GetSources(nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue, nsISimpleEnumerator **_retval)
inDOMDataSource::GetSources(nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue, nsISimpleEnumerator **_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsDOMDataSource::GetTarget(nsIRDFResource *aSource, nsIRDFResource *aProperty, PRBool aTruthValue, nsIRDFNode **_retval)
inDOMDataSource::GetTarget(nsIRDFResource *aSource, nsIRDFResource *aProperty, PRBool aTruthValue, nsIRDFNode **_retval)
{
*_retval = nsnull;
@ -316,7 +306,7 @@ nsDOMDataSource::GetTarget(nsIRDFResource *aSource, nsIRDFResource *aProperty, P
return CreateRootTarget(aSource, aProperty, _retval);
} else {
// It's not the root, so it's just a regular node
nsCOMPtr<nsIDOMDSResource> nodeContainer = do_QueryInterface(aSource);
nsCOMPtr<inIDOMRDFResource> nodeContainer = do_QueryInterface(aSource);
if (nodeContainer) {
nsCOMPtr<nsISupports> supports;
@ -333,7 +323,7 @@ nsDOMDataSource::GetTarget(nsIRDFResource *aSource, nsIRDFResource *aProperty, P
NS_IMETHODIMP
nsDOMDataSource::GetTargets(nsIRDFResource *aSource, nsIRDFResource *aProperty, PRBool aTruthValue, nsISimpleEnumerator **_retval)
inDOMDataSource::GetTargets(nsIRDFResource *aSource, nsIRDFResource *aProperty, PRBool aTruthValue, nsISimpleEnumerator **_retval)
{
nsresult rv;
@ -349,16 +339,16 @@ nsDOMDataSource::GetTargets(nsIRDFResource *aSource, nsIRDFResource *aProperty,
if (aSource == kINS_DOMRoot) {
// start at the root...
rv = GetTargetsForKnownObject(mDocument, aProperty, *mShowAnonymousContent, arcs);
rv = GetTargetsForKnownObject(mDocument, aProperty, mShowAnonymousContent, arcs);
} else if (aProperty == kINS_Child) {
// start with a node...
nsCOMPtr<nsIDOMDSResource> dsRes;
nsCOMPtr<inIDOMRDFResource> dsRes;
dsRes = do_QueryInterface(aSource, &rv);
if (NS_SUCCEEDED(rv) && dsRes) {
nsCOMPtr<nsISupports> supports;
dsRes->GetObject(getter_AddRefs(supports));
rv = GetTargetsForKnownObject(supports, aProperty, *mShowAnonymousContent, arcs);
rv = GetTargetsForKnownObject(supports, aProperty, mShowAnonymousContent, arcs);
}
}
@ -367,21 +357,21 @@ nsDOMDataSource::GetTargets(nsIRDFResource *aSource, nsIRDFResource *aProperty,
NS_IMETHODIMP
nsDOMDataSource::Assert(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue)
inDOMDataSource::Assert(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsDOMDataSource::Unassert(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget)
inDOMDataSource::Unassert(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsDOMDataSource::Change(nsIRDFResource *, nsIRDFResource *,
inDOMDataSource::Change(nsIRDFResource *, nsIRDFResource *,
nsIRDFNode *, nsIRDFNode*)
{
return NS_ERROR_NOT_IMPLEMENTED;
@ -389,7 +379,7 @@ nsDOMDataSource::Change(nsIRDFResource *, nsIRDFResource *,
NS_IMETHODIMP
nsDOMDataSource::Move(nsIRDFResource *, nsIRDFResource *,
inDOMDataSource::Move(nsIRDFResource *, nsIRDFResource *,
nsIRDFResource *, nsIRDFNode*)
{
return NS_ERROR_NOT_IMPLEMENTED;
@ -397,15 +387,15 @@ nsDOMDataSource::Move(nsIRDFResource *, nsIRDFResource *,
NS_IMETHODIMP
nsDOMDataSource::HasAssertion(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue, PRBool *_retval)
inDOMDataSource::HasAssertion(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue, PRBool *_retval)
{
nsresult rv;
*_retval = PR_FALSE;
nsCOMPtr<nsIDOMDSResource> sourceRes = do_QueryInterface(aSource, &rv);
nsCOMPtr<inIDOMRDFResource> sourceRes = do_QueryInterface(aSource, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIDOMDSResource> targetRes = do_QueryInterface(aTarget, &rv);
nsCOMPtr<inIDOMRDFResource> targetRes = do_QueryInterface(aTarget, &rv);
if (NS_FAILED(rv)) return rv;
if (aProperty == kINS_DOMRoot) {
@ -440,36 +430,38 @@ nsDOMDataSource::HasAssertion(nsIRDFResource *aSource, nsIRDFResource *aProperty
NS_IMETHODIMP
nsDOMDataSource::AddObserver(nsIRDFObserver *aObserver)
inDOMDataSource::AddObserver(nsIRDFObserver *aObserver)
{
if (! mObservers) {
if ((mObservers = new nsVoidArray()) == nsnull)
if ((mObservers = new nsAutoVoidArray()) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
}
mObservers->AppendElement(aObserver);
NS_IF_ADDREF(aObserver);
return NS_OK;
}
NS_IMETHODIMP
nsDOMDataSource::RemoveObserver(nsIRDFObserver *aObserver)
inDOMDataSource::RemoveObserver(nsIRDFObserver *aObserver)
{
if (! mObservers)
return NS_OK;
mObservers->RemoveElement(aObserver);
NS_IF_RELEASE(aObserver);
return NS_OK;
}
NS_IMETHODIMP
nsDOMDataSource::ArcLabelsIn(nsIRDFNode *aNode, nsISimpleEnumerator **_retval)
inDOMDataSource::ArcLabelsIn(nsIRDFNode *aNode, nsISimpleEnumerator **_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsDOMDataSource::ArcLabelsOut(nsIRDFResource *aSource, nsISimpleEnumerator **_retval)
inDOMDataSource::ArcLabelsOut(nsIRDFResource *aSource, nsISimpleEnumerator **_retval)
{
nsresult rv = NS_OK;
@ -494,52 +486,52 @@ nsDOMDataSource::ArcLabelsOut(nsIRDFResource *aSource, nsISimpleEnumerator **_re
NS_IMETHODIMP
nsDOMDataSource::GetAllResources(nsISimpleEnumerator **_retval)
inDOMDataSource::GetAllResources(nsISimpleEnumerator **_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsDOMDataSource::GetAllCommands(nsIRDFResource *aSource, nsIEnumerator **_retval)
inDOMDataSource::GetAllCommands(nsIRDFResource *aSource, nsIEnumerator **_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsDOMDataSource::IsCommandEnabled(nsISupportsArray *aSources, nsIRDFResource *aCommand, nsISupportsArray *aArguments, PRBool *_retval)
inDOMDataSource::IsCommandEnabled(nsISupportsArray *aSources, nsIRDFResource *aCommand, nsISupportsArray *aArguments, PRBool *_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsDOMDataSource::DoCommand(nsISupportsArray *aSources, nsIRDFResource *aCommand, nsISupportsArray *aArguments)
inDOMDataSource::DoCommand(nsISupportsArray *aSources, nsIRDFResource *aCommand, nsISupportsArray *aArguments)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsDOMDataSource::GetAllCmds(nsIRDFResource *aSource, nsISimpleEnumerator **_retval)
inDOMDataSource::GetAllCmds(nsIRDFResource *aSource, nsISimpleEnumerator **_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsDOMDataSource::HasArcIn(nsIRDFNode *aNode, nsIRDFResource *aArc, PRBool *result)
inDOMDataSource::HasArcIn(nsIRDFNode *aNode, nsIRDFResource *aArc, PRBool *result)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDOMDataSource::HasArcOut(nsIRDFResource *aSource, nsIRDFResource *aArc, PRBool *result)
inDOMDataSource::HasArcOut(nsIRDFResource *aSource, nsIRDFResource *aArc, PRBool *result)
{
if (aArc == kINS_HasChildren) {
nsCOMPtr<nsIDOMDSResource> nodeContainer = do_QueryInterface(aSource);
nsCOMPtr<inIDOMRDFResource> nodeContainer = do_QueryInterface(aSource);
nsCOMPtr<nsISupports> supports;
nodeContainer->GetObject(getter_AddRefs(supports));
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(supports);
@ -564,7 +556,7 @@ nsDOMDataSource::HasArcOut(nsIRDFResource *aSource, nsIRDFResource *aArc, PRBool
// nsIDocumentObserver
NS_IMETHODIMP
nsDOMDataSource::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRInt32 aHint)
inDOMDataSource::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRInt32 aHint)
{
nsresult rv;
@ -613,7 +605,7 @@ nsDOMDataSource::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent,
nsCOMPtr<nsIRDFResource> attrRes;
FindAttrRes(aContent, aNameSpaceID, aAttribute, getter_AddRefs(attrRes));
if (attrRes) {
nsCOMPtr<nsIDOMDSResource> dsres = do_QueryInterface(attrRes);
nsCOMPtr<inIDOMRDFResource> dsres = do_QueryInterface(attrRes);
nsCOMPtr<nsIDOMAttr> attr;
dsres->GetObject(getter_AddRefs(attr));
RemoveResourceForObject(attr);
@ -625,7 +617,7 @@ nsDOMDataSource::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent,
}
NS_IMETHODIMP
nsDOMDataSource::ContentAppended(nsIDocument *aDocument, nsIContent* aContainer, PRInt32 aNewIndexInContainer)
inDOMDataSource::ContentAppended(nsIDocument *aDocument, nsIContent* aContainer, PRInt32 aNewIndexInContainer)
{
nsresult rv;
@ -643,7 +635,7 @@ nsDOMDataSource::ContentAppended(nsIDocument *aDocument, nsIContent* aContainer,
}
NS_IMETHODIMP
nsDOMDataSource::ContentInserted(nsIDocument *aDocument, nsIContent* aContainer, nsIContent* aChild, PRInt32 aIndexInContainer)
inDOMDataSource::ContentInserted(nsIDocument *aDocument, nsIContent* aContainer, nsIContent* aChild, PRInt32 aIndexInContainer)
{
nsresult rv;
@ -658,14 +650,16 @@ nsDOMDataSource::ContentInserted(nsIDocument *aDocument, nsIContent* aContainer,
}
NS_IMETHODIMP
nsDOMDataSource::ContentReplaced(nsIDocument *aDocument, nsIContent* aContainer, nsIContent* aOldChild, nsIContent* aNewChild, PRInt32 aIndexInContainer)
inDOMDataSource::ContentReplaced(nsIDocument *aDocument, nsIContent* aContainer, nsIContent* aOldChild, nsIContent* aNewChild, PRInt32 aIndexInContainer)
{
//printf("=== CONTENT REPLACED ===\n");
ContentRemoved(aDocument, aContainer, aOldChild, aIndexInContainer);
ContentInserted(aDocument, aContainer, aOldChild, aIndexInContainer);
return NS_OK;
}
NS_IMETHODIMP
nsDOMDataSource::ContentRemoved(nsIDocument *aDocument, nsIContent* aContainer, nsIContent* aChild, PRInt32 aIndexInContainer)
inDOMDataSource::ContentRemoved(nsIDocument *aDocument, nsIContent* aContainer, nsIContent* aChild, PRInt32 aIndexInContainer)
{
nsAutoString nodeName;
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aContainer);
@ -685,20 +679,20 @@ nsDOMDataSource::ContentRemoved(nsIDocument *aDocument, nsIContent* aContainer,
}
NS_IMETHODIMP
nsDOMDataSource::DocumentWillBeDestroyed(nsIDocument *aDocument)
inDOMDataSource::DocumentWillBeDestroyed(nsIDocument *aDocument)
{
return NS_OK;
}
///////////////////////////////////////////////////////////////////////
// nsDOMDataSource
// inDOMDataSource
nsIRDFService*
nsDOMDataSource::GetRDFService()
inDOMDataSource::GetRDFService()
{
if (!mRDFService) {
nsresult rv;
rv = nsServiceManager::GetService(kRDFServiceCID, NS_GET_IID(nsIRDFService), (nsISupports**) &mRDFService);
rv = nsServiceManager::GetService(kRDFServiceCID, NS_GET_IID(nsIRDFService), getter_AddRefs(mRDFService));
if (NS_FAILED(rv)) return nsnull;
}
@ -708,7 +702,7 @@ nsDOMDataSource::GetRDFService()
///////////
nsresult
nsDOMDataSource::GetTargetsForKnownObject(nsISupports *aObject, nsIRDFResource *aProperty, PRBool aShowAnon, nsISupportsArray *aArcs)
inDOMDataSource::GetTargetsForKnownObject(nsISupports *aObject, nsIRDFResource *aProperty, PRBool aShowAnon, nsISupportsArray *aArcs)
{
if (!aObject) return NS_ERROR_NULL_POINTER;
nsresult rv;
@ -719,7 +713,7 @@ nsDOMDataSource::GetTargetsForKnownObject(nsISupports *aObject, nsIRDFResource *
}
nsresult
nsDOMDataSource::CreateDOMNodeArcs(nsIDOMNode *aNode, PRBool aShowAnon, nsISupportsArray* aArcs)
inDOMDataSource::CreateDOMNodeArcs(nsIDOMNode *aNode, PRBool aShowAnon, nsISupportsArray* aArcs)
{
if (!aNode) return NS_OK;
nsresult rv;
@ -734,14 +728,25 @@ nsDOMDataSource::CreateDOMNodeArcs(nsIDOMNode *aNode, PRBool aShowAnon, nsISuppo
if (NS_FAILED(rv)) return rv;
rv = CreateDOMNamedNodeMapArcs(attrs, aArcs);
if (mShowSubDocuments) {
nsCOMPtr<nsIDOMDocument> domdoc = inLayoutUtils::GetSubDocumentFor(aNode);
if (domdoc) {
nsCOMPtr<nsIDOMNodeList> kids;
domdoc->GetChildNodes(getter_AddRefs(kids));
CreateDOMNodeListArcs(kids, aArcs);
return NS_OK;
}
}
// try to get the anonymous content
if (aShowAnon) {
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode, &rv);
if (content) {
nsCOMPtr<nsIDOMNodeList> kids;
mBindingManager->GetAnonymousNodesFor(content, getter_AddRefs(kids));
nsCOMPtr<nsIBindingManager> bindingManager = inLayoutUtils::GetBindingManagerFor(aNode);
bindingManager->GetAnonymousNodesFor(content, getter_AddRefs(kids));
if (!kids)
mBindingManager->GetContentListFor(content, getter_AddRefs(kids));
bindingManager->GetContentListFor(content, getter_AddRefs(kids));
if (kids)
CreateDOMNodeListArcs(kids, aArcs);
} else {
@ -756,7 +761,7 @@ nsDOMDataSource::CreateDOMNodeArcs(nsIDOMNode *aNode, PRBool aShowAnon, nsISuppo
}
nsresult
nsDOMDataSource::CreateChildNodeArcs(nsIDOMNode *aNode, nsISupportsArray *aArcs)
inDOMDataSource::CreateChildNodeArcs(nsIDOMNode *aNode, nsISupportsArray *aArcs)
{
nsresult rv;
nsCOMPtr<nsIDOMNodeList> childNodes;
@ -766,7 +771,7 @@ nsDOMDataSource::CreateChildNodeArcs(nsIDOMNode *aNode, nsISupportsArray *aArcs)
}
nsresult
nsDOMDataSource::CreateDOMNodeListArcs(nsIDOMNodeList *aNodeList, nsISupportsArray *aArcs)
inDOMDataSource::CreateDOMNodeListArcs(nsIDOMNodeList *aNodeList, nsISupportsArray *aArcs)
{
if (!aNodeList) return NS_OK;
PRUint32 length=0;
@ -792,7 +797,7 @@ nsDOMDataSource::CreateDOMNodeListArcs(nsIDOMNodeList *aNodeList, nsISupportsArr
}
nsresult
nsDOMDataSource::CreateDOMNamedNodeMapArcs(nsIDOMNamedNodeMap *aNodeMap, nsISupportsArray *aArcs)
inDOMDataSource::CreateDOMNamedNodeMapArcs(nsIDOMNamedNodeMap *aNodeMap, nsISupportsArray *aArcs)
{
if (!aNodeMap) return NS_OK;
PRUint32 length=0;
@ -820,7 +825,7 @@ nsDOMDataSource::CreateDOMNamedNodeMapArcs(nsIDOMNamedNodeMap *aNodeMap, nsISupp
///////////
nsresult
nsDOMDataSource::CreateRootTarget(nsIRDFResource* aSource, nsIRDFResource* aProperty, nsIRDFNode **aResult)
inDOMDataSource::CreateRootTarget(nsIRDFResource* aSource, nsIRDFResource* aProperty, nsIRDFNode **aResult)
{
nsAutoString str;
str.AssignWithConversion("unknown");
@ -828,7 +833,7 @@ nsDOMDataSource::CreateRootTarget(nsIRDFResource* aSource, nsIRDFResource* aProp
}
nsresult
nsDOMDataSource::CreateDOMNodeTarget(nsIDOMNode *aNode, nsIRDFResource *aProperty, nsIRDFNode **aResult)
inDOMDataSource::CreateDOMNodeTarget(nsIDOMNode *aNode, nsIRDFResource *aProperty, nsIRDFNode **aResult)
{
nsAutoString str;
@ -841,7 +846,12 @@ nsDOMDataSource::CreateDOMNodeTarget(nsIDOMNode *aNode, nsIRDFResource *aPropert
aNode->GetNodeType(&type);
str.AppendInt(PRInt32(type));
} else if (aProperty == kINS_LocalName) {
aNode->GetLocalName(str);
PRUint16 type;
aNode->GetNodeType(&type);
if (type == 1 || type == 2)
aNode->GetLocalName(str);
else
aNode->GetNodeName(str);
} else if (aProperty == kINS_Prefix) {
aNode->GetPrefix(str);
} else if (aProperty == kINS_NamespaceURI) {
@ -884,15 +894,15 @@ nsDOMDataSource::CreateDOMNodeTarget(nsIDOMNode *aNode, nsIRDFResource *aPropert
///////////
nsresult
nsDOMDataSource::GetFieldNameFromRes(nsIRDFResource* aProperty, nsAutoString* aResult)
inDOMDataSource::GetFieldNameFromRes(nsIRDFResource* aProperty, nsAutoString* aResult)
{
char* resval;
aProperty->GetValue(&resval);
nsAutoString val;
val.AssignWithConversion(resval);
PRInt32 offset = val.Find(INS_NAMESPACE_URI, PR_FALSE, 0, 1);
PRInt32 offset = val.Find(IN_NAMESPACE_URI, PR_FALSE, 0, 1);
if (!offset) {
PRInt32 len = strlen(INS_NAMESPACE_URI);
PRInt32 len = strlen(IN_NAMESPACE_URI);
val.Right(*aResult, val.Length() - len);
}
@ -900,7 +910,7 @@ nsDOMDataSource::GetFieldNameFromRes(nsIRDFResource* aProperty, nsAutoString* aR
}
nsresult
nsDOMDataSource::CreateLiteral(nsString& str, nsIRDFNode **aResult)
inDOMDataSource::CreateLiteral(nsString& str, nsIRDFNode **aResult)
{
nsresult rv;
nsCOMPtr<nsIRDFLiteral> literal;
@ -915,7 +925,7 @@ nsDOMDataSource::CreateLiteral(nsString& str, nsIRDFNode **aResult)
}
PRUint16
nsDOMDataSource::GetNodeTypeKey(PRUint16 aType)
inDOMDataSource::GetNodeTypeKey(PRUint16 aType)
{
PRUint16 result;
switch (aType) {
@ -965,11 +975,11 @@ nsDOMDataSource::GetNodeTypeKey(PRUint16 aType)
/////// Observer Notification
nsresult
nsDOMDataSource::NotifyObservers(nsIRDFResource *aSubject, nsIRDFResource *aProperty, nsIRDFNode *aObject, PRUint32 aType)
inDOMDataSource::NotifyObservers(nsIRDFResource *aSubject, nsIRDFResource *aProperty, nsIRDFNode *aObject, PRUint32 aType)
{
if(mObservers)
{
nsDOMDSNotification note = { this, aSubject, aProperty, aObject };
inDOMDSNotification note = { this, aSubject, aProperty, aObject };
if (aType == RDFEVENT_CHANGE) {
mObservers->EnumerateForwards(ChangeEnumFunc, &note);
} else if (aType == RDFEVENT_ASSERT) {
@ -982,9 +992,9 @@ nsDOMDataSource::NotifyObservers(nsIRDFResource *aSubject, nsIRDFResource *aProp
}
PRBool
nsDOMDataSource::ChangeEnumFunc(void *aElement, void *aData)
inDOMDataSource::ChangeEnumFunc(void *aElement, void *aData)
{
nsDOMDSNotification *note = (nsDOMDSNotification *)aData;
inDOMDSNotification *note = (inDOMDSNotification *)aData;
nsIRDFObserver* observer = (nsIRDFObserver *)aElement;
observer->OnChange(note->datasource, note->subject, note->property, nsnull, note->object);
@ -992,9 +1002,9 @@ nsDOMDataSource::ChangeEnumFunc(void *aElement, void *aData)
}
PRBool
nsDOMDataSource::AssertEnumFunc(void *aElement, void *aData)
inDOMDataSource::AssertEnumFunc(void *aElement, void *aData)
{
nsDOMDSNotification *note = (nsDOMDSNotification *)aData;
inDOMDSNotification *note = (inDOMDSNotification *)aData;
nsIRDFObserver* observer = (nsIRDFObserver *)aElement;
observer->OnAssert(note->datasource, note->subject, note->property, note->object);
@ -1002,9 +1012,9 @@ nsDOMDataSource::AssertEnumFunc(void *aElement, void *aData)
}
PRBool
nsDOMDataSource::UnassertEnumFunc(void *aElement, void *aData)
inDOMDataSource::UnassertEnumFunc(void *aElement, void *aData)
{
nsDOMDSNotification* note = (nsDOMDSNotification *)aData;
inDOMDSNotification* note = (inDOMDSNotification *)aData;
nsIRDFObserver* observer = (nsIRDFObserver *)aElement;
observer->OnUnassert(note->datasource, note->subject, note->property, note->object);
@ -1012,7 +1022,7 @@ nsDOMDataSource::UnassertEnumFunc(void *aElement, void *aData)
}
void
nsDOMDataSource::DumpResourceValue(nsIRDFResource* aRes)
inDOMDataSource::DumpResourceValue(nsIRDFResource* aRes)
{
const char* str;
aRes->GetValueConst(&str);
@ -1020,9 +1030,9 @@ nsDOMDataSource::DumpResourceValue(nsIRDFResource* aRes)
}
nsresult
nsDOMDataSource::FindAttrRes(nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, nsIRDFResource** aAttrRes)
inDOMDataSource::FindAttrRes(nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, nsIRDFResource** aAttrRes)
{
nsDOMDSFindAttrInfo info = { nsnull, aContent, aNameSpaceID, aAttribute, aAttrRes };
inDOMDSFindAttrInfo info = { nsnull, aContent, aNameSpaceID, aAttribute, aAttrRes };
gDOMObjectTable.Enumerate(FindAttrResEnumFunc, &info);
return NS_OK;
}
@ -1036,11 +1046,11 @@ nsDOMDataSource::FindAttrRes(nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom
///////////////////////////////////////////////////////////////////////////
PRBool
nsDOMDataSource::FindAttrResEnumFunc(nsHashKey *aKey, void *aData, void* closure)
inDOMDataSource::FindAttrResEnumFunc(nsHashKey *aKey, void *aData, void* closure)
{
nsDOMDSFindAttrInfo* info = (nsDOMDSFindAttrInfo*)closure;
inDOMDSFindAttrInfo* info = (inDOMDSFindAttrInfo*)closure;
nsCOMPtr<nsISupports> supports = (nsISupports*) gDOMObjectTable.Get(aKey);
nsCOMPtr<nsIDOMDSResource> dsres = do_QueryInterface(supports);
nsCOMPtr<inIDOMRDFResource> dsres = do_QueryInterface(supports);
dsres->GetObject(getter_AddRefs(supports));
if (supports) {
nsCOMPtr<nsIDOMAttr> attr = do_QueryInterface(supports);
@ -1057,8 +1067,11 @@ nsDOMDataSource::FindAttrResEnumFunc(nsHashKey *aKey, void *aData, void* closure
attr->GetName(name2);
// make sure the attribute matches
// ToDo: make sure the namespace matches
if (name1.Equals(name2))
if (name1.Equals(name2)) {
*info->mAttrRes = res;
NS_ADDREF(*info->mAttrRes);
}
}
}
}
@ -1066,7 +1079,7 @@ nsDOMDataSource::FindAttrResEnumFunc(nsHashKey *aKey, void *aData, void* closure
}
PRBool
nsDOMDataSource::HasChild(nsIDOMNode* aContainer, nsIDOMNode* aChild)
inDOMDataSource::HasChild(nsIDOMNode* aContainer, nsIDOMNode* aChild)
{
nsresult rv;
@ -1087,7 +1100,7 @@ nsDOMDataSource::HasChild(nsIDOMNode* aContainer, nsIDOMNode* aChild)
}
PRBool
nsDOMDataSource::HasAttribute(nsIDOMNode* aContainer, nsIDOMNode* aAttr)
inDOMDataSource::HasAttribute(nsIDOMNode* aContainer, nsIDOMNode* aAttr)
{
nsresult rv;
@ -1108,19 +1121,28 @@ nsDOMDataSource::HasAttribute(nsIDOMNode* aContainer, nsIDOMNode* aAttr)
}
PRBool
nsDOMDataSource::HasChildren(nsIDOMNode* aNode)
inDOMDataSource::HasChildren(nsIDOMNode* aNode)
{
nsresult rv;
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode, &rv);
if (NS_SUCCEEDED(rv) && content) {
if (mShowSubDocuments) {
nsCOMPtr<nsIDOMDocument> domdoc = inLayoutUtils::GetSubDocumentFor(aNode);
if (domdoc)
return PR_TRUE;
}
nsCOMPtr<nsIDOMNodeList> kids;
if (*mShowAnonymousContent) {
mBindingManager->GetAnonymousNodesFor(content, getter_AddRefs(kids));
if (mShowAnonymousContent) {
nsCOMPtr<nsIBindingManager> bindingManager = inLayoutUtils::GetBindingManagerFor(aNode);
bindingManager->GetAnonymousNodesFor(content, getter_AddRefs(kids));
if (!kids)
mBindingManager->GetContentListFor(content, getter_AddRefs(kids));
bindingManager->GetContentListFor(content, getter_AddRefs(kids));
} else {
aNode->GetChildNodes(getter_AddRefs(kids));
}
if (kids) {
PRUint32 count;
kids->GetLength(&count);
@ -1133,7 +1155,7 @@ nsDOMDataSource::HasChildren(nsIDOMNode* aNode)
}
nsresult
nsDOMDataSource::RemoveResourceForObject(nsISupports* aObject)
inDOMDataSource::RemoveResourceForObject(nsISupports* aObject)
{
nsISupportsKey* objKey = new nsISupportsKey(aObject);
gDOMObjectTable.Remove(objKey);

View File

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
/*
* The contents of this file are subject to the Netscape 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
@ -14,120 +13,42 @@
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#ifndef domdatasource___h___
#define domdatasource___h___
#ifndef __inDOMDataSource_h__
#define __inDOMDataSource_h__
#define NS_DOMDSDATASOURCE_ID "Inspector_DOM"
#include "nsIInsDOMDataSource.h"
#include "nsDOMDSResource.h"
#include "inIDOMDataSource.h"
#include "inDOMRDFResource.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsISupportsArray.h"
#include "nsHashtable.h"
#include "nsString.h"
#include "nsVoidArray.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMNode.h"
#include "nsIDOMAttr.h"
#include "nsIDOMElement.h"
#include "nsIDOMNamedNodeMap.h"
#include "nsIDOMNodeList.h"
#include "nsIDocumentObserver.h"
#include "nsIDocument.h"
#include "nsIBindingManager.h"
#include "nsIXBLBinding.h"
#include "nsIDOMDocument.h"
#include "rdf.h"
#include "nsIRDFDataSource.h"
#include "nsIRDFContainer.h"
#include "nsIRDFContainerUtils.h"
#include "nsIRDFRemoteDataSource.h"
#include "nsIRDFLiteral.h"
#include "nsIRDFResource.h"
#include "nsIRDFNode.h"
#include "nsIRDFObserver.h"
#include "nsIRDFService.h"
#include "nsRDFCID.h"
#define IN_DOMDATASOURCE_ID "Inspector_DOM"
#include "nsIComponentManager.h"
#include "nsIDOMWindowInternal.h"
#include "nsIScriptGlobalObject.h"
#include "nsIServiceManager.h"
#include "nsVoidArray.h"
#include "nsXPIDLString.h"
#include "nsEnumeratorUtils.h"
#include "nsIAtom.h"
#include "prprf.h"
class nsDOMDataSource : public nsIInsDOMDataSource,
class inDOMDataSource : public inIDOMDataSource,
public nsIRDFDataSource,
public nsIDocumentObserver
{
// nsDOMDataSource
public:
nsDOMDataSource();
virtual ~nsDOMDataSource();
nsresult Init();
private:
nsCOMPtr<nsIDOMDocument> mDocument;
nsIBindingManager *mBindingManager;
PRBool *mShowAnonymousContent;
PRUint16 *mFilters;
nsIRDFService *mRDFService;
nsVoidArray *mObservers;
nsIRDFService* GetRDFService();
// Filters
PRUint16 GetNodeTypeKey(PRUint16 aType);
// Datasource Construction
nsresult GetTargetsForKnownObject(nsISupports *object, nsIRDFResource *aProperty, PRBool aShowAnon, nsISupportsArray *arcs);
nsresult CreateDOMNodeArcs(nsIDOMNode *node, PRBool aShowAnon, nsISupportsArray* arcs);
nsresult CreateChildNodeArcs(nsIDOMNode *aNode, nsISupportsArray *aArcs);
nsresult CreateDOMNodeListArcs(nsIDOMNodeList *nodelist, nsISupportsArray *arcs);
nsresult CreateDOMNamedNodeMapArcs(nsIDOMNamedNodeMap *aNodeMap, nsISupportsArray *aArcs);
nsresult CreateDOMNodeTarget(nsIDOMNode *node, nsIRDFResource *aProperty, nsIRDFNode **aResult);
nsresult CreateRootTarget(nsIRDFResource* aSource, nsIRDFResource* aProperty, nsIRDFNode **aResult);
nsresult CreateLiteral(nsString& str, nsIRDFNode **aResult);
nsresult GetFieldNameFromRes(nsIRDFResource* aProperty, nsAutoString* aResult);
// Observer Notification
static PRBool PR_CALLBACK ChangeEnumFunc(void *aElement, void *aData);
static PRBool PR_CALLBACK AssertEnumFunc(void *aElement, void *aData);
static PRBool PR_CALLBACK UnassertEnumFunc(void *aElement, void *aData);
nsresult NotifyObservers(nsIRDFResource *subject, nsIRDFResource *property, nsIRDFNode *object, PRUint32 aType);
// Misc
PRBool IsObjectInCache(nsISupports* aObject);
nsresult RemoveResourceForObject(nsISupports* aObject);
PRBool HasChildren(nsIDOMNode* aContainer);
static nsresult FindAttrRes(nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, nsIRDFResource** aAttrRes);
static PRBool PR_CALLBACK FindAttrResEnumFunc(nsHashKey *aKey, void *aData, void* closure);
static PRBool HasChild(nsIDOMNode* aContainer, nsIDOMNode* aChild);
static PRBool HasAttribute(nsIDOMNode* aContainer, nsIDOMNode* aAttr);
static void DumpResourceValue(nsIRDFResource* aRes);
public:
// nsISupports
NS_DECL_ISUPPORTS
// nsIInsDOMDataSource
NS_DECL_NSIINSDOMDATASOURCE
// nsIRDFDataSource
NS_DECL_INIDOMDATASOURCE
NS_DECL_NSIRDFDATASOURCE
inDOMDataSource();
virtual ~inDOMDataSource();
nsresult Init();
// nsIDocumentObserver
NS_IMETHOD BeginUpdate(nsIDocument *aDocument) { return NS_OK; }
NS_IMETHOD EndUpdate(nsIDocument *aDocument) { return NS_OK; }
@ -179,26 +100,77 @@ public:
nsIStyleRule* aStyleRule) { return NS_OK; }
NS_IMETHOD DocumentWillBeDestroyed(nsIDocument *aDocument);
protected:
nsCOMPtr<nsIRDFResource> kINS_DOMRoot;
nsCOMPtr<nsIRDFResource> kINS_Child;
nsCOMPtr<nsIRDFResource> kINS_Attribute;
nsCOMPtr<nsIRDFResource> kINS_NodeName;
nsCOMPtr<nsIRDFResource> kINS_NodeValue;
nsCOMPtr<nsIRDFResource> kINS_NodeType;
nsCOMPtr<nsIRDFResource> kINS_Prefix;
nsCOMPtr<nsIRDFResource> kINS_LocalName;
nsCOMPtr<nsIRDFResource> kINS_NamespaceURI;
nsCOMPtr<nsIRDFResource> kINS_Anonymous;
nsCOMPtr<nsIRDFResource> kINS_HasChildren;
protected:
nsCOMPtr<nsIDOMDocument> mDocument;
PRBool mShowAnonymousContent;
PRBool mShowSubDocuments;
PRUint16 mFilters;
nsCOMPtr<nsIRDFService> mRDFService;
nsAutoVoidArray *mObservers;
nsIRDFService* GetRDFService();
// Filters
PRUint16 GetNodeTypeKey(PRUint16 aType);
// Datasource Construction
nsresult GetTargetsForKnownObject(nsISupports *object, nsIRDFResource *aProperty, PRBool aShowAnon, nsISupportsArray *arcs);
nsresult CreateDOMNodeArcs(nsIDOMNode *node, PRBool aShowAnon, nsISupportsArray* arcs);
nsresult CreateChildNodeArcs(nsIDOMNode *aNode, nsISupportsArray *aArcs);
nsresult CreateDOMNodeListArcs(nsIDOMNodeList *nodelist, nsISupportsArray *arcs);
nsresult CreateDOMNamedNodeMapArcs(nsIDOMNamedNodeMap *aNodeMap, nsISupportsArray *aArcs);
nsresult CreateDOMNodeTarget(nsIDOMNode *node, nsIRDFResource *aProperty, nsIRDFNode **aResult);
nsresult CreateRootTarget(nsIRDFResource* aSource, nsIRDFResource* aProperty, nsIRDFNode **aResult);
nsresult CreateLiteral(nsString& str, nsIRDFNode **aResult);
nsresult GetFieldNameFromRes(nsIRDFResource* aProperty, nsAutoString* aResult);
// Observer Notification
static PRBool PR_CALLBACK ChangeEnumFunc(void *aElement, void *aData);
static PRBool PR_CALLBACK AssertEnumFunc(void *aElement, void *aData);
static PRBool PR_CALLBACK UnassertEnumFunc(void *aElement, void *aData);
nsresult NotifyObservers(nsIRDFResource *subject, nsIRDFResource *property, nsIRDFNode *object, PRUint32 aType);
// Misc
PRBool IsObjectInCache(nsISupports* aObject);
nsresult RemoveResourceForObject(nsISupports* aObject);
PRBool HasChildren(nsIDOMNode* aContainer);
static nsresult FindAttrRes(nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, nsIRDFResource** aAttrRes);
static PRBool PR_CALLBACK FindAttrResEnumFunc(nsHashKey *aKey, void *aData, void* closure);
static PRBool HasChild(nsIDOMNode* aContainer, nsIDOMNode* aChild);
static PRBool HasAttribute(nsIDOMNode* aContainer, nsIDOMNode* aAttr);
static void DumpResourceValue(nsIRDFResource* aRes);
};
//////////
typedef struct _nsDOMDSNotification {
typedef struct _inDOMDSNotification {
nsIRDFDataSource *datasource;
nsIRDFResource *subject;
nsIRDFResource *property;
nsIRDFNode *object;
} nsDOMDSNotification;
} inDOMDSNotification;
typedef struct _nsDOMDSFindAttrInfo {
typedef struct _inDOMDSFindAttrInfo {
nsIContent *mCrap;
nsIContent *mContent;
PRInt32 mNameSpaceID;
nsIAtom *mAttribute;
nsIRDFResource **mAttrRes;
} nsDOMDSFindAttrInfo;
} inDOMDSFindAttrInfo;
#endif // domdatasource___h___
#endif // __inDOMDataSource_h__

View File

@ -1,44 +1,46 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
*
* 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 Communicator client code, released
* March 31, 1998.
*
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "nsDOMDSResource.h"
#include "inDOMRDFResource.h"
nsDOMDSResource::nsDOMDSResource()
inDOMRDFResource::inDOMRDFResource()
{
}
nsDOMDSResource::~nsDOMDSResource()
inDOMRDFResource::~inDOMRDFResource()
{
}
NS_IMPL_ISUPPORTS_INHERITED(nsDOMDSResource, nsRDFResource, nsIDOMDSResource)
NS_IMPL_ISUPPORTS_INHERITED(inDOMRDFResource, nsRDFResource, inIDOMRDFResource)
NS_IMETHODIMP
nsDOMDSResource::SetObject(nsISupports* object)
inDOMRDFResource::SetObject(nsISupports* object)
{
mObject = do_QueryInterface(object);
return NS_OK;
}
NS_IMETHODIMP
nsDOMDSResource::GetObject(nsISupports** object)
inDOMRDFResource::GetObject(nsISupports** object)
{
if (!object) return NS_ERROR_NULL_POINTER;
@ -49,9 +51,9 @@ nsDOMDSResource::GetObject(nsISupports** object)
}
NS_METHOD
nsDOMDSResource::Create(nsISupports* aOuter, const nsIID& iid, void **result)
inDOMRDFResource::Create(nsISupports* aOuter, const nsIID& iid, void **result)
{
nsDOMDSResource* ve = new nsDOMDSResource();
inDOMRDFResource* ve = new inDOMRDFResource();
if (!ve) return NS_ERROR_NULL_POINTER;
NS_ADDREF(ve);
nsresult rv = ve->QueryInterface(iid, result);

View File

@ -1,29 +1,29 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
*
* 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 Communicator client code, released
* March 31, 1998.
*
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#ifndef __nsdomdsresource_h
#define __nsdomdsresource_h
#ifndef __inDOMRDFResource_h__
#define __inDOMRDFResource_h__
#define NS_DOMDSRESOURCE_ID "InspectorDOMResource"
#include "nsIDOMDSResource.h"
#include "inIDOMRDFResource.h"
#include "nscore.h"
#include "nsCOMPtr.h"
@ -32,6 +32,8 @@
#include "nsIRDFService.h"
#include "nsRDFResource.h"
#define IN_DOMRDFRESOURCE_ID "InspectorDOMResource"
/////////////////////////////////////////////////////////////////////
// This object is registered with the datasource factory to
// be instantiated for all resources created with a uri that begins
@ -45,26 +47,23 @@
// object and query it for info.
/////////////////////////////////////////////////////////////////////
class nsDOMDSResource : public nsRDFResource,
public nsIDOMDSResource
class inDOMRDFResource : public nsRDFResource,
public inIDOMRDFResource
{
// nsDOMDSResource
public:
nsDOMDSResource();
virtual ~nsDOMDSResource();
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_INIDOMRDFRESOURCE
public:
inDOMRDFResource();
virtual ~inDOMRDFResource();
static NS_METHOD Create(nsISupports* aOuter, const nsIID& iid, void **result);
private:
nsCOMPtr<nsISupports> mObject;
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMDSResource
NS_DECL_NSIDOMDSRESOURCE
};
#endif // __nsdomdsresource_h
#endif // __inDOMRDFResource_h__

View File

@ -0,0 +1,199 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "inDOMUtils.h"
#include "inLayoutUtils.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsIDOMElement.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIComponentManager.h"
#include "nsISupportsArray.h"
#include "nsEnumeratorUtils.h"
#include "nsIAtom.h"
#include "nsIContent.h"
#include "nsIBindingManager.h"
#include "nsIXBLBinding.h"
#include "nsIStyleContext.h"
#include "nsIRuleNode.h"
#include "nsIStyleRule.h"
#include "nsICSSStyleRule.h"
#include "nsIDOMCSSStyleRule.h"
#include "nsIDOMWindowInternal.h"
///////////////////////////////////////////////////////////////////////////////
inDOMUtils::inDOMUtils()
{
NS_INIT_REFCNT();
}
inDOMUtils::~inDOMUtils()
{
}
NS_IMPL_ISUPPORTS1(inDOMUtils, inIDOMUtils);
///////////////////////////////////////////////////////////////////////////////
// inIDOMUtils
NS_IMETHODIMP
inDOMUtils::GetStyleRules(nsIDOMElement *aElement, nsISupportsArray **_retval)
{
nsCOMPtr<nsISupportsArray> rules;
NS_NewISupportsArray(getter_AddRefs(rules));
if (!rules) return NS_OK;
nsCOMPtr<nsIDOMWindowInternal> win = inLayoutUtils::GetWindowFor(aElement);
nsCOMPtr<nsIPresShell> shell = inLayoutUtils::GetPresShellFor(win);
// query to a content node
nsCOMPtr<nsIContent> content;
content = do_QueryInterface(aElement);
nsIFrame* frame;
nsCOMPtr<nsIStyleContext> styleContext;
nsresult rv = shell->GetPrimaryFrameFor(content, &frame);
if (NS_FAILED(rv) || !frame) return rv;
shell->GetStyleContextFor(frame, getter_AddRefs(styleContext));
if (NS_FAILED(rv) || !styleContext) return rv;
// create a resource for all the style rules from the
// context and add them to aArcs
nsCOMPtr<nsIRuleNode> ruleNode;
styleContext->GetRuleNode(getter_AddRefs(ruleNode));
nsCOMPtr<nsIStyleRule> srule;
nsCOMPtr<nsIRuleNode> ruleNodeTmp;
while (ruleNode) {
ruleNode->GetRule(getter_AddRefs(srule));
rules->InsertElementAt(srule, 0);
ruleNode->GetParent(getter_AddRefs(ruleNodeTmp));
ruleNode = ruleNodeTmp;
// don't be adding that there root node
PRBool isRoot;
ruleNode->IsRoot(&isRoot);
if (isRoot) break;
}
*_retval = rules;
NS_IF_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP
inDOMUtils::GetRuleWeight(nsIDOMCSSStyleRule *aRule, PRUint32 *_retval)
{
if (!aRule) return NS_OK;
nsCOMPtr<nsIDOMCSSStyleRule> rule = aRule;
nsCOMPtr<nsICSSStyleRule> cssrule = do_QueryInterface(rule);
*_retval = cssrule->GetWeight();
return NS_OK;
}
NS_IMETHODIMP
inDOMUtils::GetRuleLine(nsIDOMCSSStyleRule *aRule, PRUint32 *_retval)
{
if (!aRule) return NS_OK;
nsCOMPtr<nsIDOMCSSStyleRule> rule = aRule;
nsCOMPtr<nsICSSStyleRule> cssrule = do_QueryInterface(rule);
*_retval = cssrule->GetLineNumber();
return NS_OK;
}
NS_IMETHODIMP
inDOMUtils::GetBindingURLs(nsIDOMElement *aElement, nsISimpleEnumerator **_retval)
{
nsCOMPtr<nsISupportsArray> urls;
NS_NewISupportsArray(getter_AddRefs(urls));
nsCOMPtr<nsISimpleEnumerator> e;
NS_NewArrayEnumerator(getter_AddRefs(e), urls);
*_retval = e;
NS_ADDREF(*_retval);
nsCOMPtr<nsIDOMDocument> doc1;
aElement->GetOwnerDocument(getter_AddRefs(doc1));
if (!doc1) return NS_OK;
nsCOMPtr<nsIDocument> doc = do_QueryInterface(doc1);
nsCOMPtr<nsIBindingManager> bindingManager;
doc->GetBindingManager(getter_AddRefs(bindingManager));
if (!bindingManager) return NS_OK;
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
nsCOMPtr<nsIXBLBinding> binding;
bindingManager->GetBinding(content, getter_AddRefs(binding));
nsCOMPtr<nsIXBLBinding> tempBinding;
while (binding) {
nsCString id;
binding->GetID(id);
nsCString uri;
binding->GetDocURI(uri);
uri += "#";
uri += id;
nsCOMPtr<nsIAtom> a = NS_NewAtom(uri);
urls->AppendElement(a);
binding->GetBaseBinding(getter_AddRefs(tempBinding));
binding = tempBinding;
}
return NS_OK;
}
NS_IMETHODIMP
inDOMUtils::SetContentState(nsIDOMElement *aElement, PRInt32 aState)
{
nsCOMPtr<nsIEventStateManager> esm = inLayoutUtils::GetEventStateManagerFor(aElement);
if (esm) {
nsCOMPtr<nsIContent> content;
content = do_QueryInterface(aElement);
esm->SetContentState(content, aState);
}
return NS_OK;
}
NS_IMETHODIMP
inDOMUtils::GetContentState(nsIDOMElement *aElement, PRInt32* aState)
{
nsCOMPtr<nsIEventStateManager> esm = inLayoutUtils::GetEventStateManagerFor(aElement);
if (esm) {
nsCOMPtr<nsIContent> content;
content = do_QueryInterface(aElement);
esm->GetContentState(content, *aState);
}
return NS_OK;
}

View File

@ -0,0 +1,44 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#ifndef __inDOMUtils_h__
#define __inDOMUtils_h__
#include "inIDOMUtils.h"
#include "nsIEventStateManager.h"
#include "nsISupportsArray.h"
class inDOMUtils : public inIDOMUtils
{
public:
inDOMUtils();
~inDOMUtils();
protected:
public:
NS_DECL_ISUPPORTS
NS_DECL_INIDOMUTILS
};
#endif // __inDOMUtils_h__

View File

@ -0,0 +1,345 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "inDeepTreeWalker.h"
#include "inLayoutUtils.h"
#include "nsString.h"
#include "nsIDOMDocument.h"
#include "nsIDOMNodeFilter.h"
#include "nsIDOMNodeList.h"
#include "nsIContent.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMWindow.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIWebNavigation.h"
#include "nsIScriptGlobalObject.h"
/*****************************************************************************
* This implementation does not currently operaate according to the W3C spec.
* So far, only parentNode() and nextNode() are implemented, and are not
* interoperable.
*****************************************************************************/
////////////////////////////////////////////////////
inDeepTreeWalker::inDeepTreeWalker()
{
NS_INIT_REFCNT();
mShowAnonymousContent = PR_FALSE;
mShowSubDocuments = PR_FALSE;
mWhatToShow = nsIDOMNodeFilter::SHOW_ALL;
}
inDeepTreeWalker::~inDeepTreeWalker()
{
}
NS_IMPL_ISUPPORTS1(inDeepTreeWalker, inIDeepTreeWalker);
typedef struct _DeepTreeStackItem
{
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIDOMNodeList> kids;
PRUint32 lastIndex;
} DeepTreeStackItem;
////////////////////////////////////////////////////
// inIDeepTreeWalker
NS_IMETHODIMP
inDeepTreeWalker::GetShowAnonymousContent(PRBool *aShowAnonymousContent)
{
*aShowAnonymousContent = mShowAnonymousContent;
return NS_OK;
}
NS_IMETHODIMP
inDeepTreeWalker::SetShowAnonymousContent(PRBool aShowAnonymousContent)
{
mShowAnonymousContent = aShowAnonymousContent;
return NS_OK;
}
NS_IMETHODIMP
inDeepTreeWalker::GetShowSubDocuments(PRBool *aShowSubDocuments)
{
*aShowSubDocuments = mShowSubDocuments;
return NS_OK;
}
NS_IMETHODIMP
inDeepTreeWalker::SetShowSubDocuments(PRBool aShowSubDocuments)
{
mShowSubDocuments = aShowSubDocuments;
return NS_OK;
}
NS_IMETHODIMP
inDeepTreeWalker::Init(nsIDOMNode* aRoot, PRUint32 aWhatToShow)
{
mRoot = aRoot;
mWhatToShow = aWhatToShow;
PushNode(aRoot);
return NS_OK;
}
////////////////////////////////////////////////////
// nsIDOMTreeWalker
NS_IMETHODIMP
inDeepTreeWalker::GetRoot(nsIDOMNode** aRoot)
{
*aRoot = mRoot;
NS_IF_ADDREF(*aRoot);
return NS_OK;
}
NS_IMETHODIMP
inDeepTreeWalker::GetWhatToShow(PRUint32* aWhatToShow)
{
*aWhatToShow = mWhatToShow;
return NS_OK;
}
NS_IMETHODIMP
inDeepTreeWalker::GetFilter(nsIDOMNodeFilter** aFilter)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
inDeepTreeWalker::GetExpandEntityReferences(PRBool* aExpandEntityReferences)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
inDeepTreeWalker::GetCurrentNode(nsIDOMNode** aCurrentNode)
{
*aCurrentNode = mCurrentNode;
NS_IF_ADDREF(*aCurrentNode);
return NS_OK;
}
NS_IMETHODIMP
inDeepTreeWalker::SetCurrentNode(nsIDOMNode* aCurrentNode)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
inDeepTreeWalker::ParentNode(nsIDOMNode** _retval)
{
if (!mCurrentNode) return NS_OK;
if (mShowSubDocuments && inLayoutUtils::IsDocumentElement(mCurrentNode)) {
nsCOMPtr<nsIDOMDocument> doc;
mCurrentNode->GetOwnerDocument(getter_AddRefs(doc));
nsCOMPtr<nsIDOMNode> node = inLayoutUtils::GetContainerFor(doc);
if (node)
*_retval = node;
}
if (mShowAnonymousContent && !*_retval) {
nsCOMPtr<nsIContent> content = do_QueryInterface(mCurrentNode);
nsCOMPtr<nsIContent> bparent;
nsCOMPtr<nsIBindingManager> bindingManager = inLayoutUtils::GetBindingManagerFor(mCurrentNode);
if (bindingManager)
bindingManager->GetInsertionParent(content, getter_AddRefs(bparent));
if (bparent) {
nsCOMPtr<nsIDOMNode> parent = do_QueryInterface(bparent);
*_retval = parent;
}
}
if (!*_retval) {
nsCOMPtr<nsIDOMNode> node;
mCurrentNode->GetParentNode(getter_AddRefs(node));
*_retval = node;
}
mCurrentNode = *_retval;
NS_IF_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP
inDeepTreeWalker::FirstChild(nsIDOMNode **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
inDeepTreeWalker::LastChild(nsIDOMNode **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
inDeepTreeWalker::PreviousSibling(nsIDOMNode **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
inDeepTreeWalker::NextSibling(nsIDOMNode **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
inDeepTreeWalker::PreviousNode(nsIDOMNode **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
inDeepTreeWalker::NextNode(nsIDOMNode **_retval)
{
if (!mCurrentNode) return NS_OK;
nsCOMPtr<nsIDOMNode> next;
while (1) {
DeepTreeStackItem* top = (DeepTreeStackItem*)mStack.ElementAt(mStack.Count()-1);
nsCOMPtr<nsIDOMNodeList> kids = top->kids;
PRUint32 childCount;
kids->GetLength(&childCount);
if (top->lastIndex == childCount) {
mStack.RemoveElementAt(mStack.Count()-1);
delete top;
if (mStack.Count() == 0) {
mCurrentNode = nsnull;
break;
}
} else {
kids->Item(top->lastIndex++, getter_AddRefs(next));
PushNode(next);
break;
}
}
*_retval = next;
NS_IF_ADDREF(*_retval);
return NS_OK;
}
void
inDeepTreeWalker::PushNode(nsIDOMNode* aNode)
{
mCurrentNode = aNode;
if (!aNode) return;
DeepTreeStackItem* item = new DeepTreeStackItem();
item->node = aNode;
nsCOMPtr<nsIDOMNodeList> kids;
if (mShowSubDocuments) {
nsCOMPtr<nsIDOMDocument> domdoc = inLayoutUtils::GetSubDocumentFor(aNode);
if (domdoc) {
domdoc->GetChildNodes(getter_AddRefs(kids));
}
}
if (!kids) {
if (mShowAnonymousContent) {
nsCOMPtr<nsIBindingManager> bindingManager = inLayoutUtils::GetBindingManagerFor(aNode);
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
if (bindingManager) {
bindingManager->GetAnonymousNodesFor(content, getter_AddRefs(kids));
if (!kids)
bindingManager->GetContentListFor(content, getter_AddRefs(kids));
} else {
aNode->GetChildNodes(getter_AddRefs(kids));
}
} else
aNode->GetChildNodes(getter_AddRefs(kids));
}
item->kids = kids;
item->lastIndex = 0;
mStack.AppendElement((void*)item);
}
/*
// This NextNode implementation does not require the use of stacks,
// as does the one above. However, it does not handle anonymous
// content and sub-documents.
NS_IMETHODIMP
inDeepTreeWalker::NextNode(nsIDOMNode **_retval)
{
if (!mCurrentNode) return NS_OK;
// walk down the tree first
nsCOMPtr<nsIDOMNode> next;
mCurrentNode->GetFirstChild(getter_AddRefs(next));
if (!next) {
mCurrentNode->GetNextSibling(getter_AddRefs(next));
if (!next) {
// we've hit the end, so walk back up the tree until another
// downward opening is found, or the top of the tree
nsCOMPtr<nsIDOMNode> subject = mCurrentNode;
nsCOMPtr<nsIDOMNode> parent;
while (1) {
subject->GetParentNode(getter_AddRefs(parent));
if (!parent) // hit the top of the tree
break;
parent->GetNextSibling(getter_AddRefs(subject));
if (subject) { // found a downward opening
next = subject;
break;
} else // walk up another level
subject = parent;
}
}
}
mCurrentNode = next;
*_retval = next;
NS_IF_ADDREF(*_retval);
return NS_OK;
}
char* getURL(nsIDOMDocument* aDoc)
{
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDoc);
nsCOMPtr<nsIURI> uri;
doc->GetDocumentURL(getter_AddRefs(uri));
char* s;
uri->GetSpec(&s);
return s;
}
*/

View File

@ -0,0 +1,54 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#ifndef __inDeepTreeWalker_h___
#define __inDeepTreeWalker_h___
#include "inIDeepTreeWalker.h"
#include "nsCOMPtr.h"
#include "nsIDOMNode.h"
#include "nsVoidArray.h"
class inDeepTreeWalker : public inIDeepTreeWalker
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMTREEWALKER
NS_DECL_INIDEEPTREEWALKER
inDeepTreeWalker();
~inDeepTreeWalker();
protected:
void PushNode(nsIDOMNode* aNode);
PRBool mShowAnonymousContent;
PRBool mShowSubDocuments;
nsCOMPtr<nsIDOMNode> mRoot;
nsCOMPtr<nsIDOMNode> mCurrentNode;
PRUint32 mWhatToShow;
nsAutoVoidArray mStack;
};
#endif // __inDeepTreeWalker_h___

View File

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
/*
* The contents of this file are subject to the Netscape 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
@ -14,10 +13,11 @@
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "inFileSearch.h"

View File

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
/*
* The contents of this file are subject to the Netscape 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
@ -14,10 +13,11 @@
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#ifndef __inFileSearch_h__
@ -35,6 +35,10 @@
class inFileSearch : public inIFileSearch
{
public:
NS_DECL_ISUPPORTS
NS_DECL_INISEARCHPROCESS
NS_DECL_INIFILESEARCH
inFileSearch();
~inFileSearch();
@ -83,21 +87,6 @@ protected:
nsresult MakePathRelative(nsAutoString* aPath);
nsresult CountDirectoryDepth(nsIFile* aDir, PRUint32* aDepth);
public:
NS_DECL_ISUPPORTS
NS_DECL_INISEARCHPROCESS
NS_DECL_INIFILESEARCH
};
//////////////////////////////////////////////////////////////
// {D5636476-9F94-47f2-9CE9-69CDD9D7BBCD}
#define IN_FILESEARCH_CID \
{ 0xd5636476, 0x9f94, 0x47f2, { 0x9c, 0xe9, 0x69, 0xcd, 0xd9, 0xd7, 0xbb, 0xcd } }
#define IN_FILESEARCH_CONTRACTID \
"@mozilla.org/inspector/search;1?type=file"
#endif
#endif // __inFileSearch_h__

View File

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
/*
* The contents of this file are subject to the Netscape 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
@ -14,10 +13,11 @@
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "inFlasher.h"
@ -40,6 +40,7 @@
#include "nsIView.h"
#include "nsIViewManager.h"
#include "nsIScriptGlobalObject.h"
#include "inLayoutUtils.h"
///////////////////////////////////////////////////////////////////////////////
@ -58,10 +59,13 @@ NS_IMPL_ISUPPORTS1(inFlasher, inIFlasher);
// inIFlasher
NS_IMETHODIMP
inFlasher::RepaintElement(nsIDOMElement* aElement, nsIDOMWindowInternal* aWindow)
inFlasher::RepaintElement(nsIDOMElement* aElement)
{
nsIPresShell* presShell = GetPresShellFor(aWindow);
nsIFrame* frame = GetFrameFor(aElement, presShell);
nsCOMPtr<nsIDOMWindowInternal> window = inLayoutUtils::GetWindowFor(aElement);
if (!window) return NS_OK;
nsCOMPtr<nsIPresShell> presShell = inLayoutUtils::GetPresShellFor(window);
if (!presShell) return NS_OK;
nsIFrame* frame = inLayoutUtils::GetFrameFor(aElement, presShell);
if (!frame) return NS_OK;
nsCOMPtr<nsIPresContext> pcontext;
@ -73,13 +77,14 @@ inFlasher::RepaintElement(nsIDOMElement* aElement, nsIDOMWindowInternal* aWindow
nsIView* view;
parentWithView->GetView(pcontext, &view);
if (view) {
nsIViewManager* viewManager;
view->GetViewManager(viewManager);
nsRect rect;
parentWithView->GetRect(rect);
nsCOMPtr<nsIViewManager> viewManager;
view->GetViewManager(*getter_AddRefs(viewManager));
if (viewManager) {
nsRect rect;
parentWithView->GetRect(rect);
viewManager->UpdateView(view, rect, NS_VMREFRESH_NO_SYNC);
viewManager->UpdateView(view, rect, NS_VMREFRESH_NO_SYNC);
}
}
}
@ -87,10 +92,12 @@ inFlasher::RepaintElement(nsIDOMElement* aElement, nsIDOMWindowInternal* aWindow
}
NS_IMETHODIMP
inFlasher::DrawElementOutline(nsIDOMElement* aElement, nsIDOMWindowInternal* aWindow, const PRUnichar* aColor, PRInt32 aThickness)
inFlasher::DrawElementOutline(nsIDOMElement* aElement, const PRUnichar* aColor, PRInt32 aThickness)
{
nsIPresShell* presShell = GetPresShellFor(aWindow);
nsIFrame* frame = GetFrameFor(aElement, presShell);
nsCOMPtr<nsIDOMWindowInternal> window = inLayoutUtils::GetWindowFor(aElement);
if (!window) return NS_OK;
nsCOMPtr<nsIPresShell> presShell = inLayoutUtils::GetPresShellFor(window);
nsIFrame* frame = inLayoutUtils::GetFrameFor(aElement, presShell);
if (!frame) return NS_OK;
nsCOMPtr<nsIPresContext> pcontext;
@ -105,13 +112,15 @@ inFlasher::DrawElementOutline(nsIDOMElement* aElement, nsIDOMWindowInternal* aWi
nsRect rect;
frame->GetRect(rect);
nsPoint origin(0,0);
GetClientOrigin(frame, origin);
nsPoint origin = inLayoutUtils::GetClientOrigin(frame);
rect.x = origin.x;
rect.y = origin.y;
inLayoutUtils::AdjustRectForMargins(aElement, rect);
float p2t;
pcontext->GetPixelsToTwips(&p2t);
DrawOutline(origin.x, origin.y, rect.width, rect.height, color, aThickness, p2t, rcontext);
DrawOutline(rect.x, rect.y, rect.width, rect.height, color, aThickness, p2t, rcontext);
return NS_OK;
}
@ -145,39 +154,3 @@ inFlasher::DrawLine(nscoord aX, nscoord aY, nscoord aLength, PRUint32 aThickness
return NS_OK;
}
NS_IMETHODIMP
inFlasher::GetClientOrigin(nsIFrame* aFrame, nsPoint& aPoint)
{
nsIFrame* parent = aFrame;
while (parent) {
nsPoint origin;
parent->GetOrigin(origin);
aPoint.x += origin.x;
aPoint.y += origin.y;
parent->GetParent(&parent);
}
return NS_OK;
}
nsIFrame*
inFlasher::GetFrameFor(nsIDOMElement* aElement, nsIPresShell* aShell)
{
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
nsIFrame* frame;
aShell->GetPrimaryFrameFor(content, &frame);
return frame;
}
nsIPresShell*
inFlasher::GetPresShellFor(nsISupports* aThing)
{
nsCOMPtr<nsIScriptGlobalObject> so = do_QueryInterface(aThing);
nsCOMPtr<nsIDocShell> docShell;
so->GetDocShell(getter_AddRefs(docShell));
nsIPresShell* presShell;
docShell->GetPresShell(&presShell);
return presShell;
}

View File

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
/*
* The contents of this file are subject to the Netscape 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
@ -14,10 +13,11 @@
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#ifndef __inFlasher_h__
@ -50,7 +50,6 @@ protected:
PRUint32 aThickness, float aP2T, nsIRenderingContext* aRenderContext);
NS_IMETHOD DrawLine(nscoord aX, nscoord aY, nscoord aLength, PRUint32 aThickness,
PRBool aDir, PRBool aBounds, float aP2T, nsIRenderingContext* aRenderContext);
NS_IMETHOD GetClientOrigin(nsIFrame* aFrame, nsPoint& aPoint);
public:
NS_DECL_ISUPPORTS
@ -58,13 +57,4 @@ public:
NS_DECL_INIFLASHER
};
//////////////////////////////////////////////////////////////
// {9286E71A-621A-4b91-851E-9984C1A2E81A}
#define IN_FLASHER_CID \
{ 0x9286e71a, 0x621a, 0x4b91, { 0x85, 0x1e, 0x99, 0x84, 0xc1, 0xa2, 0xe8, 0x1a } }
#define IN_FLASHER_CONTRACTID \
"@mozilla.org/inspector/flasher;1"
#endif
#endif // __inFlasher_h__

View File

@ -0,0 +1,401 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "inLayoutUtils.h"
#include "nsIDOMDocumentView.h"
#include "nsIDOMAbstractView.h"
#include "nsIDOMNodeList.h"
#include "nsIDocument.h"
#include "nsIContent.h"
#include "nsIContentViewer.h"
#include "nsIScriptGlobalObject.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIWebNavigation.h"
#include "nsIPresShell.h"
#include "nsIViewManager.h"
#include "nsIWidget.h"
#include "nsIPresContext.h"
#include "nsIStyleContext.h"
#include "nsXULAtoms.h"
#include "nsHTMLAtoms.h"
///////////////////////////////////////////////////////////////////////////////
nsIDOMNode*
FindContainerFor(nsIDOMDocument* aTopDoc, nsIDOMDocument* aTargetDoc,
nsAReadableString& aNSURI, nsAReadableString& aLocalName)
{
nsCOMPtr<nsIDOMNodeList> frames;
if (!aNSURI.Length())
aTopDoc->GetElementsByTagName(aLocalName, getter_AddRefs(frames));
else
aTopDoc->GetElementsByTagNameNS(aNSURI, aLocalName, getter_AddRefs(frames));
PRUint32 count;
frames->GetLength(&count);
nsCOMPtr<nsIDOMDocument> subdoc;
nsCOMPtr<nsIDOMNode> node;
for (PRUint32 i = 0; i < count; ++i) {
frames->Item(i, getter_AddRefs(node));
subdoc = inLayoutUtils::GetSubDocumentFor(node);
if (subdoc == aTargetDoc)
return node;
}
return nsnull;
}
///////////////////////////////////////////////////////////////////////////////
nsIDOMWindowInternal*
inLayoutUtils::GetWindowFor(nsIDOMElement* aElement)
{
nsCOMPtr<nsIDOMDocument> doc1;
aElement->GetOwnerDocument(getter_AddRefs(doc1));
return GetWindowFor(doc1);
}
nsIDOMWindowInternal*
inLayoutUtils::GetWindowFor(nsIDOMDocument* aDoc)
{
nsCOMPtr<nsIDOMDocumentView> doc = do_QueryInterface(aDoc);
if (!doc) return 0;
nsCOMPtr<nsIDOMAbstractView> view;
doc->GetDefaultView(getter_AddRefs(view));
if (!view) return 0;
nsCOMPtr<nsIDOMWindowInternal> window = do_QueryInterface(view);
return window;
}
nsIPresShell*
inLayoutUtils::GetPresShellFor(nsISupports* aThing)
{
nsCOMPtr<nsIScriptGlobalObject> so = do_QueryInterface(aThing);
nsCOMPtr<nsIDocShell> docShell;
so->GetDocShell(getter_AddRefs(docShell));
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
return presShell;
}
nsIFrame*
inLayoutUtils::GetFrameFor(nsIDOMElement* aElement, nsIPresShell* aShell)
{
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
nsIFrame* frame;
aShell->GetPrimaryFrameFor(content, &frame);
return frame;
}
nsIRenderingContext*
inLayoutUtils::GetRenderingContextFor(nsIPresShell* aShell)
{
nsCOMPtr<nsIViewManager> viewman;
aShell->GetViewManager(getter_AddRefs(viewman));
nsCOMPtr<nsIWidget> widget;
viewman->GetWidget(getter_AddRefs(widget));
nsCOMPtr<nsIRenderingContext> rcontext = widget->GetRenderingContext();
return rcontext;
}
nsIEventStateManager*
inLayoutUtils::GetEventStateManagerFor(nsIDOMElement *aElement)
{
if (aElement) {
// get the document
nsCOMPtr<nsIDOMDocument> doc1;
aElement->GetOwnerDocument(getter_AddRefs(doc1));
nsCOMPtr<nsIDocument> doc;
doc = do_QueryInterface(doc1);
// use the first PresShell
PRInt32 num = doc->GetNumberOfShells();
if (num > 0) {
nsCOMPtr<nsIPresShell> shell;
doc->GetShellAt(0, getter_AddRefs(shell));
nsCOMPtr<nsIPresContext> presContext;
shell->GetPresContext(getter_AddRefs(presContext));
nsCOMPtr<nsIEventStateManager> esm;
presContext->GetEventStateManager(getter_AddRefs(esm));
return esm;
}
}
return nsnull;
}
nsPoint
inLayoutUtils::GetClientOrigin(nsIFrame* aFrame)
{
nsPoint result(0,0);
nsIFrame* parent = aFrame;
while (parent) {
nsPoint origin;
parent->GetOrigin(origin);
result.x += origin.x;
result.y += origin.y;
parent->GetParent(&parent);
}
return result;
}
void
inLayoutUtils::AdjustRectForMargins(nsIDOMElement* aElement, nsRect& aRect)
{
if (!aElement) return;
nsCOMPtr<nsIDOMWindowInternal> window = inLayoutUtils::GetWindowFor(aElement);
if (!window) return;
nsCOMPtr<nsIPresShell> presShell = inLayoutUtils::GetPresShellFor(window);
if (!presShell) return;
nsCOMPtr<nsIPresContext> pcontext;
presShell->GetPresContext(getter_AddRefs(pcontext));
// resolve style and get margins
nsCOMPtr<nsIStyleContext> scontext;
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
pcontext->ResolveStyleContextFor(content, nsnull, PR_FALSE, getter_AddRefs(scontext));
const nsStyleStruct* mstruct = scontext->GetStyleData(eStyleStruct_Margin);
const nsStyleMargin* margins = (const nsStyleMargin*) mstruct;
// adjust coordinates for margins
nsStyleCoord coord;
margins->mMargin.GetTop(coord);
aRect.y -= coord.GetCoordValue();
aRect.height += coord.GetCoordValue();
margins->mMargin.GetLeft(coord);
aRect.x -= coord.GetCoordValue();
aRect.width += coord.GetCoordValue();
margins->mMargin.GetRight(coord);
aRect.width += coord.GetCoordValue();
margins->mMargin.GetBottom(coord);
aRect.height += coord.GetCoordValue();
}
nsRect&
inLayoutUtils::GetScreenOrigin(nsIDOMElement* aElement)
{
nsRect* rect = new nsRect(0,0,0,0);
rect->x = rect->y = 0;
rect->Empty();
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
nsCOMPtr<nsIDocument> doc;
content->GetDocument(*getter_AddRefs(doc));
if (doc) {
// Get Presentation shell 0
nsCOMPtr<nsIPresShell> presShell;
doc->GetShellAt(0, getter_AddRefs(presShell));
if (presShell) {
// Flush all pending notifications so that our frames are uptodate
presShell->FlushPendingNotifications();
nsCOMPtr<nsIPresContext> presContext;
presShell->GetPresContext(getter_AddRefs(presContext));
if (presContext) {
nsIFrame* frame;
nsresult rv = presShell->GetPrimaryFrameFor(content, &frame);
PRInt32 offsetX = 0;
PRInt32 offsetY = 0;
nsCOMPtr<nsIWidget> widget;
while (frame) {
// Look for a widget so we can get screen coordinates
nsIView* view;
rv = frame->GetView(presContext, &view);
if (view) {
rv = view->GetWidget(*getter_AddRefs(widget));
if (widget)
break;
}
// No widget yet, so count up the coordinates of the frame
nsPoint origin;
frame->GetOrigin(origin);
offsetX += origin.x;
offsetY += origin.y;
frame->GetParent(&frame);
}
if (widget) {
// Get the scale from that Presentation Context
float t2p;
presContext->GetTwipsToPixels(&t2p);
// Convert to pixels using that scale
offsetX = NSTwipsToIntPixels(offsetX, t2p);
offsetY = NSTwipsToIntPixels(offsetY, t2p);
// Add the widget's screen coordinates to the offset we've counted
nsRect oldBox(0,0,0,0);
widget->WidgetToScreen(oldBox, *rect);
rect->x += offsetX;
rect->y += offsetY;
// Convert back to twips
float p2t;
presContext->GetPixelsToTwips(&p2t);
rect->x = NSIntPixelsToTwips(rect->x, p2t);
rect->y = NSIntPixelsToTwips(rect->y, p2t);
}
}
}
}
return *rect;
}
nsIBindingManager*
inLayoutUtils::GetBindingManagerFor(nsIDOMNode* aNode)
{
nsCOMPtr<nsIDOMDocument> domdoc;
aNode->GetOwnerDocument(getter_AddRefs(domdoc));
if (domdoc) {
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domdoc);
nsCOMPtr<nsIBindingManager> bindingManager = do_QueryInterface(domdoc);
doc->GetBindingManager(getter_AddRefs(bindingManager));
return bindingManager;
}
return nsnull;
}
nsIDOMDocument*
inLayoutUtils::GetSubDocumentFor(nsIDOMNode* aNode)
{
nsXULAtoms::AddRefAtoms();
nsHTMLAtoms::AddRefAtoms();
nsCOMPtr<nsIAtom> tag;
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
if (!content) return nsnull;
content->GetTag(*getter_AddRefs(tag));
if (tag == nsHTMLAtoms::frame || tag == nsHTMLAtoms::iframe ||
tag == nsXULAtoms::iframe || tag == nsXULAtoms::browser ||
tag == nsXULAtoms::editor)
{
nsCOMPtr<nsIDocument> doc;
content->GetDocument(*getter_AddRefs(doc));
if (!doc) return nsnull;
nsCOMPtr<nsIPresShell> shell;
doc->GetShellAt(0, getter_AddRefs(shell));
if (shell) {
nsCOMPtr<nsIPresShell> subShell;
shell->GetSubShellFor(content, getter_AddRefs(subShell));
if (!subShell) return nsnull;
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(subShell);
nsCOMPtr<nsIContentViewer> contentViewer;
docShell->GetContentViewer(getter_AddRefs(contentViewer));
nsCOMPtr<nsIDOMDocument> domdoc;
contentViewer->GetDOMDocument(getter_AddRefs(domdoc));
return domdoc;
}
}
nsXULAtoms::ReleaseAtoms();
nsHTMLAtoms::ReleaseAtoms();
return nsnull;
}
nsIDOMNode*
inLayoutUtils::GetContainerFor(nsIDOMDocument* aDoc)
{
nsCOMPtr<nsIDOMNode> container;
// get the doc shell for this document and look for the parent doc shell
nsCOMPtr<nsIDOMWindowInternal> win = inLayoutUtils::GetWindowFor(aDoc);
nsCOMPtr<nsIScriptGlobalObject> so = do_QueryInterface(win);
nsCOMPtr<nsIDocShell> docShell;
so->GetDocShell(getter_AddRefs(docShell));
nsCOMPtr<nsIDocShellTreeItem> treeItem = do_QueryInterface(docShell);
nsCOMPtr<nsIDocShellTreeItem> parentItem;
treeItem->GetParent(getter_AddRefs(parentItem));
if (!parentItem) return nsnull;
nsCOMPtr<nsIWebNavigation> webnav = do_QueryInterface(parentItem);
nsCOMPtr<nsIDOMDocument> parentDoc;
webnav->GetDocument(getter_AddRefs(parentDoc));
if (!parentDoc) return nsnull;
nsAutoString XULNSURI;
XULNSURI.AssignWithConversion("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
nsAutoString HTMLNSURI;
HTMLNSURI.AssignWithConversion("http://www.w3.org/1999/xhtml");
// look for all potential sub-document containers and find which one we're in
container = FindContainerFor(parentDoc, aDoc, NS_LITERAL_STRING(""), NS_LITERAL_STRING("iframe"));
if (container)
return container;
container = FindContainerFor(parentDoc, aDoc, NS_LITERAL_STRING(""), NS_LITERAL_STRING("frame"));
if (container)
return container;
container = FindContainerFor(parentDoc, aDoc, XULNSURI, NS_LITERAL_STRING("browser"));
if (container)
return container;
container = FindContainerFor(parentDoc, aDoc, XULNSURI, NS_LITERAL_STRING("editor"));
if (container)
return container;
return nsnull;
}
PRBool
inLayoutUtils::IsDocumentElement(nsIDOMNode* aNode)
{
PRBool result = PR_FALSE;
nsCOMPtr<nsIDOMNode> parent;
aNode->GetParentNode(getter_AddRefs(parent));
if (parent) {
PRUint16 nodeType;
parent->GetNodeType(&nodeType);
if (nodeType == 9)
result = PR_TRUE;
}
return result;
}

View File

@ -0,0 +1,55 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef __inLayoutUtils_h__
#define __inLayoutUtils_h__
#include "nsCOMPtr.h"
#include "nsIDOMElement.h"
#include "nsIDOMWindowInternal.h"
#include "nsIPresShell.h"
#include "nsIFrame.h"
#include "nsIRenderingContext.h"
#include "nsIEventStateManager.h"
#include "nsIDOMDocument.h"
#include "nsIBindingManager.h"
class inLayoutUtils
{
public:
static nsIDOMWindowInternal* GetWindowFor(nsIDOMElement* aElement);
static nsIDOMWindowInternal* GetWindowFor(nsIDOMDocument* aDoc);
static nsIPresShell* GetPresShellFor(nsISupports* aThing);
static nsIFrame* GetFrameFor(nsIDOMElement* aElement, nsIPresShell* aShell);
static nsIRenderingContext* GetRenderingContextFor(nsIPresShell* aShell);
static nsIEventStateManager* GetEventStateManagerFor(nsIDOMElement *aElement);
static nsIBindingManager* GetBindingManagerFor(nsIDOMNode* aNode);
static nsIDOMDocument* GetSubDocumentFor(nsIDOMNode* aNode);
static nsIDOMNode* GetContainerFor(nsIDOMDocument* aDoc);
static PRBool IsDocumentElement(nsIDOMNode* aNode);
static nsPoint GetClientOrigin(nsIFrame* aFrame);
static nsRect& GetScreenOrigin(nsIDOMElement* aElement);
static void AdjustRectForMargins(nsIDOMElement* aElement, nsRect& aRect);
};
#endif // __inLayoutUtils_h__

View File

@ -0,0 +1,124 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "inPNGEncoder.h"
#include "nsISupportsArray.h"
#include "nsString.h"
#include "nsIPresShell.h"
#include "nsIPresContext.h"
#include "nsIRenderingContext.h"
#include "nsIFrame.h"
#include "nsIDOMElement.h"
#include "nsIDOMWindowInternal.h"
#include "png.h"
///////////////////////////////////////////////////////////////////////////////
inPNGEncoder::inPNGEncoder()
{
NS_INIT_REFCNT();
}
inPNGEncoder::~inPNGEncoder()
{
}
NS_IMPL_ISUPPORTS1(inPNGEncoder, inIPNGEncoder);
///////////////////////////////////////////////////////////////////////////////
static void gPNGErrorHandler(png_structp aPNGStruct, png_const_charp aMsg);
///////////////////////////////////////////////////////////////////////////////
/// inIPNGEncoder
NS_IMETHODIMP
inPNGEncoder::WritePNG(inIBitmap *aBitmap, const PRUnichar *aURL, PRInt16 aType)
{
PRUint8* bits;
aBitmap->GetBits(&bits);
PRUint32 width;
aBitmap->GetWidth(&width);
PRUint32 height;
aBitmap->GetHeight(&height);
png_structp pngStruct;
png_infop infoStruct;
nsAutoString str;
str.Assign(aURL);
FILE *file = fopen(str.ToNewCString(), "wb");
if (file) {
pngStruct = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, gPNGErrorHandler, NULL);
infoStruct = png_create_info_struct(pngStruct);
png_init_io(pngStruct, file);
png_set_compression_level(pngStruct, Z_BEST_COMPRESSION);
png_set_IHDR(pngStruct, infoStruct, width, height,
8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
png_write_info(pngStruct, infoStruct);
ReverseRGB(width, height, bits);
PRUint8* rowPtr = bits;
for (PRUint32 row = 0; row < height; ++row) {
png_write_row(pngStruct, rowPtr);
rowPtr += width*3;
}
ReverseRGB(width, height, bits);
png_write_end(pngStruct, NULL);
fclose(file);
} else {
return NS_ERROR_NULL_POINTER;
}
return NS_OK;
}
void
inPNGEncoder::ReverseRGB(PRUint32 aWidth, PRUint32 aHeight, PRUint8* aBits)
{
PRUint8 temp;
PRUint32 row, col;
for (row = 0; row < aHeight; ++row) {
for (col = 0; col < aWidth; ++col) {
temp = aBits[0];
aBits[0] = aBits[2];
aBits[2] = temp;
aBits += 3;
}
}
}
static void gPNGErrorHandler(png_structp aPNGStruct, png_const_charp aMsg)
{
printf("ERROR ENCODING PNG IMAGE\n");
}

View File

@ -20,24 +20,31 @@
* Contributor(s):
*/
#include "nsISupports.idl"
#ifndef __inPNGEncoder_h__
#define __inPNGEncoder_h__
interface nsIRDFResource;
#include "inIPNGEncoder.h"
#include "inIBitmap.h"
[scriptable, uuid(3777C69B-0605-454f-851C-760F4A05888A)]
interface nsICSSDecDataSource : nsISupports
#include "nsCOMPtr.h"
class inPNGEncoder : public inIPNGEncoder
{
attribute nsIRDFResource refResource;
public:
NS_DECL_ISUPPORTS
NS_DECL_INIPNGENCODER
void setCSSProperty(in wstring aName, in wstring aValue, in wstring aPriority);
void removeCSSProperty(in wstring aName);
inPNGEncoder();
~inPNGEncoder();
protected:
/*
* Since inIBitmap stores pixel bytes in BGR order, and the png encoder
* needs them in RGB format, this will reverse them prior to encoding.
*/
static void ReverseRGB(PRUint32 aWidth, PRUint32 aHeight, PRUint8* aBits);
};
%{C++
/* {B10FB023-72C7-489f-BE65-BCA9B38F856D} */
#define NS_CSSDEC_DATASOURCE_CID \
{ 0xb10fb023, 0x72c7, 0x489f, { 0xbe, 0x65, 0xbc, 0xa9, 0xb3, 0x8f, 0x85, 0x6d } }
%}
#endif // __inPNGEncoder_h__

View File

@ -1,83 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "inSearchItemImage.h"
///////////////////////////////////////////////////////////////////////////////
inSearchItemImage::inSearchItemImage(nsAutoString* aURL)
{
NS_INIT_ISUPPORTS();
mURL = *aURL;
}
inSearchItemImage::~inSearchItemImage()
{
}
NS_IMPL_ISUPPORTS1(inSearchItemImage, inISearchItem);
///////////////////////////////////////////////////////////////////////////////
// inISearchItem
NS_IMETHODIMP
inSearchItemImage::GetDescription(PRUnichar** aDescription)
{
*aDescription = mURL.ToNewUnicode();
return NS_OK;
}
NS_IMETHODIMP
inSearchItemImage::GetIconURL(PRUnichar** aURL)
{
nsAutoString url;
url.AssignWithConversion("chrome://inspector/content/search/ImageSearchItem.gif");
*aURL = url.ToNewUnicode();
return NS_OK;
}
NS_IMETHODIMP
inSearchItemImage::IsViewable(PRBool* _retval)
{
*_retval = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP
inSearchItemImage::IsEditable(PRBool *_retval)
{
*_retval = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
inSearchItemImage::ViewItem(nsIDOMElement **_retval)
{
return NS_OK;
}
NS_IMETHODIMP
inSearchItemImage::EditItem()
{
return NS_OK;
}

View File

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
/*
* The contents of this file are subject to the Netscape 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
@ -14,10 +13,11 @@
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "inSearchLoop.h"

View File

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
/*
* The contents of this file are subject to the Netscape 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
@ -14,10 +13,11 @@
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#ifndef __inSearchLoop_h__

View File

@ -1,571 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "inSearchOrphanImages.h"
#include "dsinfo.h"
#include "nsCOMPtr.h"
#include "nsISupportsArray.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsString.h"
#include "nsILocalFile.h"
#include "nsIURI.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsICSSStyleSheet.h"
#include "nsICSSStyleRule.h"
#include "nsICSSDeclaration.h"
#include "nsCSSValue.h"
#include "nsITimer.h"
#include "nsIRDFService.h"
#include "nsIRDFResource.h"
///////////////////////////////////////////////////////////////////////////////
#define INS_RDF_SEARCH_ROOT "inspector:searchResults"
#define INS_RDF_RESULTS INS_NAMESPACE_URI "results"
#define INS_RDF_URL INS_NAMESPACE_URI "url"
nsIRDFResource* kINS_SearchRoot;
nsIRDFResource* kINS_results;
nsIRDFResource* kINS_url;
///////////////////////////////////////////////////////////////////////////////
inSearchOrphanImages::inSearchOrphanImages()
{
NS_INIT_ISUPPORTS();
nsresult rv;
rv = nsServiceManager::GetService(kRDFServiceCID, NS_GET_IID(nsIRDFService), (nsISupports**) &mRDF);
NS_ASSERTION(NS_SUCCEEDED(rv), "Unable to get RDF service");
rv = nsServiceManager::GetService(kRDFContainerUtilsCID, NS_GET_IID(nsIRDFContainerUtils), (nsISupports**) &mRDFCU);
NS_ASSERTION(NS_SUCCEEDED(rv), "Unable to get RDF container utils");
mRDF->GetResource(INS_RDF_SEARCH_ROOT, &kINS_SearchRoot);
mRDF->GetResource(INS_RDF_RESULTS, &kINS_results);
mRDF->GetResource(INS_RDF_URL, &kINS_url);
}
inSearchOrphanImages::~inSearchOrphanImages()
{
}
NS_IMPL_ISUPPORTS2(inSearchOrphanImages, inISearchOrphanImages, inISearchProcess);
///////////////////////////////////////////////////////////////////////////////
// inISearchOrphanImages
NS_IMETHODIMP
inSearchOrphanImages::GetSearchPath(PRUnichar** aSearchPath)
{
*aSearchPath = mSearchPath.ToNewUnicode();
return NS_OK;
}
NS_IMETHODIMP
inSearchOrphanImages::SetSearchPath(const PRUnichar* aSearchPath)
{
mSearchPath.Assign(aSearchPath);
mSearchPath.Trim("\\/", PR_FALSE, PR_TRUE, PR_FALSE);
mSearchPath.AppendWithConversion("\\");
return NS_OK;
}
NS_IMETHODIMP
inSearchOrphanImages::GetRemotePath(PRUnichar** aRemotePath)
{
*aRemotePath = mRemotePath.ToNewUnicode();
return NS_OK;
}
NS_IMETHODIMP
inSearchOrphanImages::SetRemotePath(const PRUnichar* aRemotePath)
{
mRemotePath.Assign(aRemotePath);
return NS_OK;
}
NS_IMETHODIMP
inSearchOrphanImages::GetIsSkin(PRBool* aIsSkin)
{
*aIsSkin = mIsSkin;
return NS_OK;
}
NS_IMETHODIMP
inSearchOrphanImages::SetIsSkin(PRBool aIsSkin)
{
mIsSkin = aIsSkin;
return NS_OK;
}
NS_IMETHODIMP
inSearchOrphanImages::GetDocument(nsIDOMDocument** aDocument)
{
*aDocument = mDocument;
NS_IF_ADDREF(*aDocument);
return NS_OK;
}
NS_IMETHODIMP
inSearchOrphanImages::SetDocument(nsIDOMDocument* aDocument)
{
mDocument = aDocument;
return NS_OK;
}
///////////////////////////////////////////////////////////////////////////////
// inISearchProcess
nsresult
inSearchOrphanImages::GetUid(PRUnichar** aUid)
{
nsAutoString uid;
uid.AssignWithConversion("findOrphanImages");
*aUid = uid.ToNewUnicode();
return NS_OK;
}
NS_IMETHODIMP
inSearchOrphanImages::GetDataSource(nsIRDFDataSource** aDataSource)
{
*aDataSource = mDataSource;
NS_IF_ADDREF(*aDataSource);
return NS_OK;
}
NS_IMETHODIMP
inSearchOrphanImages::GetProgressPercent(PRInt16* aProgressPercent)
{
PRUint32 count;
mDirectories->Count(&count);
*aProgressPercent = (100 * (mCurrentStep+1)) / count;
return NS_OK;
}
NS_IMETHODIMP
inSearchOrphanImages::GetResultCount(PRUint32* aResultCount)
{
*aResultCount = mResultCount;
return NS_OK;
}
NS_IMETHODIMP
inSearchOrphanImages::GetProgressText(PRUnichar** aProgressText)
{
// XX return current directory being searched
nsAutoString text;
text.AssignWithConversion("searching");
*aProgressText = text.ToNewUnicode();
return NS_OK;
}
nsresult
inSearchOrphanImages::Start(inISearchObserver* aObserver)
{
nsresult rv;
mObserver = aObserver;
mCurrentStep = 0;
mResultCount = 0;
rv = InitDataSource();
if (NS_FAILED(rv)) {
ReportError("Unable to create results datasource.");
return NS_OK;
}
mObserver->OnSearchStart(this);
rv = CacheAllDirectories();
if (!NS_FAILED(rv))
StartSearchTimer();
PRUint32 count;
mDirectories->Count(&count);
return rv;
}
NS_IMETHODIMP
inSearchOrphanImages::Stop()
{
return NS_OK;
}
///////////////////////////////////////////////////////////////////////////////
// inSearchOrphanImages
nsresult
inSearchOrphanImages::SearchStep(PRBool* aDone)
{
PRUint32 count;
mDirectories->Count(&count);
if (mCurrentStep == 0) {
BuildRemoteURLHash();
} else if (mCurrentStep == count) {
*aDone = PR_TRUE;
mObserver->OnSearchEnd(this);
} else {
nsCOMPtr<nsIFile> file;
mDirectories->GetElementAt(mCurrentStep-1, getter_AddRefs(file));
SearchDirectory(file);
}
mCurrentStep++;
return NS_OK;
}
nsresult
inSearchOrphanImages::CacheAllDirectories()
{
if (mSearchPath.Length() < 1) return NS_ERROR_FAILURE;
mDirectories = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
nsCOMPtr<nsILocalFile> file;
NS_NewLocalFile(mSearchPath.ToNewCString(), PR_FALSE, getter_AddRefs(file));
CacheDirectory(file);
return NS_OK;
}
nsresult
inSearchOrphanImages::CacheDirectory(nsIFile* aDir)
{
// store this direcotyr
mDirectories->AppendElement(aDir);
// recurse through subdirectories
nsISimpleEnumerator* entries;
aDir->GetDirectoryEntries(&entries);
PRBool* hasMoreElements = new PRBool();
PRBool* isDirectory = new PRBool();
nsCOMPtr<nsIFile> entry;
entries->HasMoreElements(hasMoreElements);
while (*hasMoreElements) {
entries->GetNext(getter_AddRefs(entry));
entries->HasMoreElements(hasMoreElements);
entry->IsDirectory(isDirectory);
if (*isDirectory) {
CacheDirectory(entry);
}
}
return NS_OK;
}
nsresult
inSearchOrphanImages::SearchDirectory(nsIFile* aDir)
{
nsISimpleEnumerator* entries;
aDir->GetDirectoryEntries(&entries);
PRBool* hasMoreElements = new PRBool();
PRBool* isFile = new PRBool();
nsCOMPtr<nsIFile> entry;
entries->HasMoreElements(hasMoreElements);
while (*hasMoreElements) {
entries->GetNext(getter_AddRefs(entry));
entries->HasMoreElements(hasMoreElements);
entry->IsFile(isFile);
if (*isFile) {
nsAutoString ext = GetFileExtension(entry);
if (ext.EqualsIgnoreCase("gif", -1) ||
ext.EqualsIgnoreCase("png", -1) ||
ext.EqualsIgnoreCase("jpg", -1)) {
char* path;
entry->GetPath(&path);
nsAutoString localPath;
localPath.AssignWithConversion(path);
nsAutoString equalized = EqualizeLocalURL(&localPath);
nsStringKey key(equalized);
PRUint32 result = (PRUint32) mFileHash->Get(&key);
if (!result) {
//printf("ORPHAN: '%s'\n", url);
nsCOMPtr<nsIRDFResource> res;
CreateResourceFromFile(entry, getter_AddRefs(res));
mResultCount++;
mObserver->OnSearchResult(this);
}
}
}
}
return NS_OK;
}
nsAutoString
inSearchOrphanImages::GetFileExtension(nsIFile* aFile)
{
nsAutoString result;
char* fileName;
aFile->GetLeafName(&fileName);
nsAutoString name;
name.AssignWithConversion(fileName);
name.Right(result, 3);
result.ToLowerCase();
return result;
}
nsresult
inSearchOrphanImages::BuildRemoteURLHash()
{
// XXX dunno if I have to addref here and release the old one.. Scripting habits be damned!
mFileHash = new nsHashtable(3000, PR_TRUE);
nsCOMPtr<nsIDocument> doc = do_QueryInterface(mDocument);
if (doc) {
PRInt32 count = 0;
doc->GetNumberOfStyleSheets(&count);
for (PRInt32 i = 0; i < count; i++) {
nsCOMPtr<nsIStyleSheet> sheet;
doc->GetStyleSheetAt(i, getter_AddRefs(sheet));
HashStyleSheet(sheet);
}
}
return NS_OK;
}
nsresult
inSearchOrphanImages::HashStyleSheet(nsIStyleSheet* aStyleSheet)
{
NS_IF_ADDREF(aStyleSheet);
nsCOMPtr<nsICSSStyleSheet> cssSheet = do_QueryInterface(aStyleSheet);
if (cssSheet) {
// recurse downward through the stylesheet tree
PRInt32 count;
cssSheet->StyleSheetCount(count);
for (PRInt32 i = 0; i < count; i++) {
nsICSSStyleSheet* child;
cssSheet->GetStyleSheetAt(i, child);
HashStyleSheet(child);
}
cssSheet->StyleRuleCount(count);
for (i = 0; i < count; i++) {
nsICSSRule* rule;
cssSheet->GetStyleRuleAt(i, rule);
HashStyleRule(rule);
}
}
NS_IF_RELEASE(aStyleSheet);
return NS_OK;
}
nsresult
inSearchOrphanImages::HashStyleRule(nsIStyleRule* aStyleRule)
{
NS_IF_ADDREF(aStyleRule);
nsCOMPtr<nsICSSStyleRule> cssRule = do_QueryInterface(aStyleRule);
if (cssRule) {
nsCOMPtr<nsICSSDeclaration> aDec = cssRule->GetDeclaration();
HashStyleValue(aDec, eCSSProperty_background_image);
HashStyleValue(aDec, eCSSProperty_list_style_image);
}
NS_IF_RELEASE(aStyleRule);
return NS_OK;
}
nsresult
inSearchOrphanImages::HashStyleValue(nsICSSDeclaration* aDec, nsCSSProperty aProp)
{
nsCSSValue value;
aDec->GetValue(aProp, value);
if (value.GetUnit() == eCSSUnit_URL) {
nsAutoString result;
result = value.GetStringValue(result);
EqualizeRemoteURL(&result);
nsStringKey key (result);
mFileHash->Put(&key, (void*)1);
}
return NS_OK;
}
nsresult
inSearchOrphanImages::EqualizeRemoteURL(nsAutoString* aURL)
{
if (mIsSkin) {
if (aURL->Find("chrome://", PR_FALSE, 0, 1) >= 0) {
PRUint32 len = aURL->Length();
char* result = new char[len-8];
char* buffer = aURL->ToNewCString();
PRUint32 i = 9;
PRUint32 milestone = 0;
PRUint32 s = 0;
while (i < len) {
if (buffer[i] == '/') {
milestone += 1;
}
if (milestone == 0 || milestone > 1) {
result[i-9-s] = (buffer[i] == '/') ? '/' : buffer[i];
} else {
s++;
}
i++;
}
result[i-9-s] = 0;
aURL->AssignWithConversion(result);
//printf("hash: '%s'\n", result);
}
} else {
}
return NS_OK;
}
nsAutoString
inSearchOrphanImages::EqualizeLocalURL(nsAutoString* aURL)
{
nsAutoString result;
PRInt32 found = aURL->Find(mSearchPath, PR_FALSE, 0, 1);
if (found == 0) {
PRUint32 len = mSearchPath.Length();
aURL->Mid(result, len, aURL->Length()-len);
result.ReplaceChar('\\', '/');
//printf("file: '%s'\n", result.ToNewCString());
}
return result;
}
nsresult
inSearchOrphanImages::ReportError(char* aMsg)
{
nsAutoString msg;
msg.AssignWithConversion(aMsg);
mObserver->OnSearchError(this, msg.ToNewUnicode());
return NS_OK;
}
///////////////////////////////////////////////////////////////////////////////
// timer stuff
nsresult
inSearchOrphanImages::StartSearchTimer()
{
nsresult rv;
mTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
mTimer->Init(inSearchOrphanImages::SearchTimerCallback, (void*)this, 0, NS_PRIORITY_NORMAL, NS_TYPE_REPEATING_SLACK);
return NS_OK;
}
nsresult
inSearchOrphanImages::StopSearchTimer()
{
mTimer->Cancel();
mTimer = nsnull;
return NS_OK;
}
void
inSearchOrphanImages::SearchTimerCallback(nsITimer *aTimer, void *aClosure)
{
inSearchOrphanImages* search = (inSearchOrphanImages*) aClosure;
PRBool done = PR_FALSE;
search->SearchStep(&done);
if (done) {
search->StopSearchTimer();
}
}
///////////////////////////////////////////////////////////////////////////////
// RDF stuff
nsresult
inSearchOrphanImages::InitDataSource()
{
nsresult rv;
mDataSource = do_CreateInstance("@mozilla.org/rdf/datasource;1?name=in-memory-datasource", &rv);
nsCOMPtr<nsIRDFResource> res;
mRDF->GetAnonymousResource(getter_AddRefs(res));
mDataSource->Assert(kINS_SearchRoot, kINS_results, res, PR_TRUE);
mRDFCU->MakeSeq(mDataSource, res, getter_AddRefs(mResultSeq));
return rv;
}
nsresult
inSearchOrphanImages::CreateResourceFromFile(nsIFile* aFile, nsIRDFResource** aRes)
{
nsCOMPtr<nsIRDFResource> res;
mRDF->GetAnonymousResource(getter_AddRefs(res));
char* url;
aFile->GetURL(&url);
nsAutoString theURL;
theURL.AssignWithConversion(url);
nsCOMPtr<nsIRDFLiteral> literal;
mRDF->GetLiteral(theURL.ToNewUnicode(), getter_AddRefs(literal));
mDataSource->Assert(res, kINS_url, literal, PR_TRUE);
mResultSeq->AppendElement(res);
return NS_OK;
}

View File

@ -1,111 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef __searchOrphanImages_h__
#define __searchOrphanImages_h__
#include "inISearchOrphanImages.h"
#include "inISearchProcess.h"
#include "inISearchObserver.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsSupportsArray.h"
#include "nsHashtable.h"
#include "nsIDOMDocument.h"
#include "nsIStyleSheet.h"
#include "nsIStyleRule.h"
#include "nsICSSDeclaration.h"
#include "nsCSSProps.h"
#include "nsIFile.h"
#include "nsITimer.h"
#include "nsIRDFService.h"
#include "nsIRDFLiteral.h"
#include "nsIRDFContainerUtils.h"
#include "nsIRDFContainer.h"
class inSearchOrphanImages : public inISearchOrphanImages,
public inISearchProcess
{
public:
inSearchOrphanImages();
~inSearchOrphanImages();
nsresult SearchStep(PRBool* aDone);
nsresult StopSearchTimer();
protected:
nsIRDFService* mRDF;
nsIRDFContainerUtils* mRDFCU;
nsCOMPtr<nsITimer> mTimer;
nsHashtable* mFileHash;
nsCOMPtr<nsISupportsArray> mDirectories;
PRUint32 mCurrentStep;
PRUint32 mResultCount;
nsCOMPtr<nsIRDFDataSource> mDataSource;
nsCOMPtr<nsIRDFContainer> mResultSeq;
nsCOMPtr<inISearchObserver> mObserver;
nsAutoString mRemotePath;
nsAutoString mSearchPath;
PRBool mIsSkin;
nsCOMPtr<nsIDOMDocument> mDocument;
nsresult BuildRemoteURLHash();
nsresult HashStyleSheet(nsIStyleSheet* aStyleSheet);
nsresult HashStyleRule(nsIStyleRule* aStyleRule);
nsresult HashStyleValue(nsICSSDeclaration* aDec, nsCSSProperty aProp);
nsresult EqualizeRemoteURL(nsAutoString* aURL);
nsAutoString EqualizeLocalURL(nsAutoString* aURL);
nsresult SearchDirectory(nsIFile* aDir);
nsAutoString GetFileExtension(nsIFile* aFile);
nsresult StartSearchTimer();
nsresult CacheAllDirectories();
nsresult CacheDirectory(nsIFile* aDir);
nsresult InitDataSource();
nsresult CreateResourceFromFile(nsIFile* aFile, nsIRDFResource** aRes);
nsresult ReportError(char* aMsg);
static void SearchTimerCallback(nsITimer *aTimer, void *aClosure);
public:
NS_DECL_ISUPPORTS
NS_DECL_INISEARCHORPHANIMAGES
NS_DECL_INISEARCHPROCESS
};
////////////////////////////////////////////////////////////////////
// {865761A8-7A39-426c-8114-396FA2B03768}
#define IN_SEARCHORPHANIMAGES_CID \
{ 0x865761a8, 0x7a39, 0x426c, { 0x81, 0x14, 0x39, 0x6f, 0xa2, 0xb0, 0x37, 0x68 } }
#define IN_SEARCHORPHANIMAGES_CONTRACTID \
"@mozilla.org/inspector/search;1?name=findOrphanImages"
#endif

View File

@ -14,7 +14,7 @@
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
@ -26,37 +26,53 @@ MODULE=inspector
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
CPPSRCS= \
.\nsDOMDataSource.cpp \
.\nsCSSRuleDataSource.cpp \
.\nsCSSDecDataSource.cpp \
.\nsDOMDSResource.cpp \
.\nsCSSDecIntHolder.cpp \
.\inFlasher.cpp \
.\inSearchLoop.cpp \
.\inFileSearch.cpp \
.\inCSSValueSearch.cpp \
DIRS=win
CPPSRCS= \
.\inDOMDataSource.cpp \
.\inDOMRDFResource.cpp \
.\inDeepTreeWalker.cpp \
.\inFlasher.cpp \
.\inSearchLoop.cpp \
.\inFileSearch.cpp \
.\inCSSValueSearch.cpp \
.\inDOMUtils.cpp \
.\inLayoutUtils.cpp \
.\inBitmap.cpp \
.\inBitmapDepot.cpp \
.\inBitmapDecoder.cpp \
.\inBitmapProtocolHandler.cpp \
.\inBitmapChannel.cpp \
.\inBitmapURI.cpp \
.\inPNGEncoder.cpp \
$(NULL)
CPP_OBJS= \
.\$(OBJDIR)\nsDOMDataSource.obj \
.\$(OBJDIR)\nsCSSRuleDataSource.obj \
.\$(OBJDIR)\nsCSSDecDataSource.obj \
.\$(OBJDIR)\nsDOMDSResource.obj \
.\$(OBJDIR)\nsCSSDecIntHolder.obj \
.\$(OBJDIR)\inFlasher.obj \
.\$(OBJDIR)\inSearchLoop.obj \
.\$(OBJDIR)\inFileSearch.obj \
.\$(OBJDIR)\inCSSValueSearch.obj \
CPP_OBJS= \
.\$(OBJDIR)\inDOMDataSource.obj \
.\$(OBJDIR)\inDOMRDFResource.obj \
.\$(OBJDIR)\inDeepTreeWalker.obj \
.\$(OBJDIR)\inFlasher.obj \
.\$(OBJDIR)\inSearchLoop.obj \
.\$(OBJDIR)\inFileSearch.obj \
.\$(OBJDIR)\inCSSValueSearch.obj \
.\$(OBJDIR)\inDOMUtils.obj \
.\$(OBJDIR)\inLayoutUtils.obj \
.\$(OBJDIR)\inBitmap.obj \
.\$(OBJDIR)\inBitmapDepot.obj \
.\$(OBJDIR)\inBitmapDecoder.obj \
.\$(OBJDIR)\inBitmapProtocolHandler.obj \
.\$(OBJDIR)\inBitmapChannel.obj \
.\$(OBJDIR)\inBitmapURI.obj \
.\$(OBJDIR)\inPNGEncoder.obj \
$(NULL)
EXPORTS = $(NULL)
EXPORTS=$(NULL)
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\js \
-I$(PUBLIC)\dom -I$(PUBLIC)\uconv
LCFLAGS = \
LCFLAGS= \
$(LCFLAGS) \
$(DEFINES) \
$(NULL)

View File

@ -1,438 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-file-style: "stroustrup" -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
*/
#include "nsCSSDecDataSource.h"
#include "dsinfo.h"
////////////////////////////////////////////////////////////////////////
// globals and constants
#define INS_RDF_DECROOT "inspector:DecRoot"
#define INS_RDF_PROPERTY INS_NAMESPACE_URI "Property"
#define INS_RDF_PROPERTYNAME INS_NAMESPACE_URI "PropertyName"
#define INS_RDF_PROPERTYVALUE INS_NAMESPACE_URI "PropertyValue"
#define INS_RDF_PROPERTYPRIORITY INS_NAMESPACE_URI "PropertyPriority"
static PRInt32 gCurrentId = 0;
nsIRDFResource *kINS_DecRoot;
nsIRDFResource *kINS_Property;
nsIRDFResource *kINS_PropertyName;
nsIRDFResource *kINS_PropertyValue;
nsIRDFResource *kINS_PropertyPriority;
////////////////////////////////////////////////////////////////////////
nsCSSDecDataSource::nsCSSDecDataSource()
{
NS_INIT_REFCNT();
}
nsCSSDecDataSource::~nsCSSDecDataSource()
{
if (mRDFService) {
nsServiceManager::ReleaseService(kRDFServiceCID, mRDFService);
mRDFService = nsnull;
}
/* NS_IF_RELEASE(kINS_DecRoot);
NS_IF_RELEASE(kINS_Property);
NS_IF_RELEASE(kINS_PropertyName);
NS_IF_RELEASE(kINS_PropertyValue);
NS_IF_RELEASE(kINS_PropertyPriority);
*/
}
nsresult
nsCSSDecDataSource::Init()
{
nsresult rv = nsServiceManager::GetService(kRDFServiceCID, NS_GET_IID(nsIRDFService), (nsISupports**) &mRDFService);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");
if (NS_FAILED(rv)) return rv;
mRDFService->GetResource(INS_RDF_DECROOT, &kINS_DecRoot);
mRDFService->GetResource(INS_RDF_PROPERTY, &kINS_Property);
mRDFService->GetResource(INS_RDF_PROPERTYNAME, &kINS_PropertyName);
mRDFService->GetResource(INS_RDF_PROPERTYVALUE, &kINS_PropertyValue);
mRDFService->GetResource(INS_RDF_PROPERTYPRIORITY, &kINS_PropertyPriority);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////
// nsISupports
NS_IMPL_ISUPPORTS2(nsCSSDecDataSource,
nsICSSDecDataSource,
nsIRDFDataSource);
////////////////////////////////////////////////////////////////////////
// nsICSSRuleDataSource
NS_IMETHODIMP
nsCSSDecDataSource::GetRefResource(nsIRDFResource** aRefResource)
{
*aRefResource = nsnull;
return NS_OK;
}
NS_IMETHODIMP
nsCSSDecDataSource::SetRefResource(nsIRDFResource* aRefResource)
{
nsresult rv;
nsCOMPtr<nsIDOMDSResource> domRes = do_QueryInterface(aRefResource);
nsCOMPtr<nsISupports> supports;
rv = domRes->GetObject(getter_AddRefs(supports));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIDOMCSSStyleRule> rule = do_QueryInterface(supports, &rv);
if (NS_FAILED(rv)) return rv;
mStyleRule = rule;
return NS_OK;
}
NS_IMETHODIMP nsCSSDecDataSource::SetCSSProperty(const PRUnichar* aName, const PRUnichar* aValue, const PRUnichar* aPriority)
{
nsresult rv;
// get the declaration
nsCOMPtr<nsIDOMCSSStyleDeclaration> dec;
rv = mStyleRule->GetStyle(getter_AddRefs(dec));
nsAutoString name; name.Assign(aName);
nsAutoString value; value.Assign(aValue);
nsAutoString priority; priority.Assign(aPriority);
return dec->SetProperty(name, value, priority);
}
NS_IMETHODIMP nsCSSDecDataSource::RemoveCSSProperty(const PRUnichar* aName)
{
nsresult rv;
// get the declaration
nsCOMPtr<nsIDOMCSSStyleDeclaration> dec;
rv = mStyleRule->GetStyle(getter_AddRefs(dec));
nsAutoString ret;
nsAutoString name; name.Assign(aName);
return dec->RemoveProperty(name, ret);
}
////////////////////////////////////////////////////////////////////////
// nsIRDFDataSource
NS_IMETHODIMP
nsCSSDecDataSource::GetURI(char* *aURI)
{
NS_PRECONDITION(aURI != nsnull, "null ptr");
if (! aURI) return NS_ERROR_NULL_POINTER;
*aURI = nsCRT::strdup("rdf:" NS_CSSDECDATASOURCE_ID);
if (! *aURI) return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
NS_IMETHODIMP
nsCSSDecDataSource::GetSource(nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue, nsIRDFResource **_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsCSSDecDataSource::GetSources(nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue, nsISimpleEnumerator **_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsCSSDecDataSource::GetTarget(nsIRDFResource *aSource, nsIRDFResource *aProperty, PRBool aTruthValue, nsIRDFNode **_retval)
{
*_retval = nsnull;
nsresult rv;
if (aSource == kINS_DecRoot) {
// It's the root, so we ignore it
return NS_OK;
} else {
// It's not the root, so we proceed to find the target node
nsCOMPtr<nsIDOMDSResource> domRes = do_QueryInterface(aSource);
if (domRes) {
nsCOMPtr<nsISupports> supports;
domRes->GetObject(getter_AddRefs(supports));
nsCOMPtr<nsCSSDecIntHolder> rule = do_QueryInterface(supports, &rv);
if (NS_SUCCEEDED(rv))
return CreatePropertyTarget(rule->mInt, aProperty, _retval);
}
}
return rv;
}
NS_IMETHODIMP
nsCSSDecDataSource::GetTargets(nsIRDFResource *aSource, nsIRDFResource *aProperty, PRBool aTruthValue, nsISimpleEnumerator **_retval)
{
nsresult rv;
nsCOMPtr<nsISupportsArray> arcs;
rv = NS_NewISupportsArray(getter_AddRefs(arcs));
nsArrayEnumerator* cursor = new nsArrayEnumerator(arcs);
if (!cursor) return NS_ERROR_OUT_OF_MEMORY;
*_retval = cursor;
NS_ADDREF(*_retval);
if (!mStyleRule) return NS_OK;
// The only node with targets is the root, since this this data source
// is just a flat list of properties
if (aSource == kINS_DecRoot && aProperty == kINS_Property) {
rv = GetTargetsForStyleRule(mStyleRule, aProperty, arcs);
}
return NS_OK;
}
NS_IMETHODIMP
nsCSSDecDataSource::Assert(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsCSSDecDataSource::Unassert(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsCSSDecDataSource::Change(nsIRDFResource *, nsIRDFResource *,
nsIRDFNode *, nsIRDFNode*)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsCSSDecDataSource::Move(nsIRDFResource *, nsIRDFResource *,
nsIRDFResource *, nsIRDFNode*)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsCSSDecDataSource::HasAssertion(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue, PRBool *_retval)
{
*_retval = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsCSSDecDataSource::AddObserver(nsIRDFObserver *aObserver)
{
return NS_OK;
}
NS_IMETHODIMP
nsCSSDecDataSource::RemoveObserver(nsIRDFObserver *aObserver)
{
return NS_OK;
}
NS_IMETHODIMP
nsCSSDecDataSource::ArcLabelsIn(nsIRDFNode *aNode, nsISimpleEnumerator **_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsCSSDecDataSource::ArcLabelsOut(nsIRDFResource *aSource, nsISimpleEnumerator **_retval)
{
return NS_OK;
}
NS_IMETHODIMP
nsCSSDecDataSource::GetAllResources(nsISimpleEnumerator **_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsCSSDecDataSource::GetAllCommands(nsIRDFResource *aSource, nsIEnumerator **_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsCSSDecDataSource::IsCommandEnabled(nsISupportsArray *aSources, nsIRDFResource *aCommand, nsISupportsArray *aArguments, PRBool *_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsCSSDecDataSource::DoCommand(nsISupportsArray *aSources, nsIRDFResource *aCommand, nsISupportsArray *aArguments)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsCSSDecDataSource::GetAllCmds(nsIRDFResource *aSource, nsISimpleEnumerator **_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsCSSDecDataSource::HasArcIn(nsIRDFNode *aNode, nsIRDFResource *aArc, PRBool *result)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsCSSDecDataSource::HasArcOut(nsIRDFResource *aSource, nsIRDFResource *aArc, PRBool *result)
{
return NS_OK;
}
////////////////////////////////////////////////////////////////////////
// nsCSSDecDataSource
nsIRDFService*
nsCSSDecDataSource::GetRDFService()
{
if (!mRDFService) {
nsresult rv;
rv = nsServiceManager::GetService(kRDFServiceCID, NS_GET_IID(nsIRDFService), (nsISupports**) &mRDFService);
if (NS_FAILED(rv)) return nsnull;
}
return mRDFService;
}
nsresult
nsCSSDecDataSource::GetTargetsForStyleRule(nsIDOMCSSStyleRule* aRule, nsIRDFResource* aProperty, nsISupportsArray* aArcs)
{
nsresult rv;
// get the declaration
nsCOMPtr<nsIDOMCSSStyleDeclaration> dec;
rv = aRule->GetStyle(getter_AddRefs(dec));
// loop through the properties
PRUint32 count;
dec->GetLength(&count);
nsCSSDecIntHolder* holder;
for (PRUint32 i = 0; i < count; i++) {
holder = new nsCSSDecIntHolder(i);
nsCOMPtr<nsIRDFResource> resource;
rv = GetResourceForObject(holder, getter_AddRefs(resource));
rv = aArcs->AppendElement(resource);
}
return NS_OK;
}
nsresult
nsCSSDecDataSource::GetResourceForObject(nsISupports* aObject, nsIRDFResource** _retval)
{
nsresult rv;
nsISupportsKey* objKey = new nsISupportsKey(aObject);
nsCOMPtr<nsISupports> supports = (nsISupports*) mObjectTable.Get(objKey);
if (supports) {
nsCOMPtr<nsIRDFResource> res = do_QueryInterface(supports, &rv);
*_retval = res;
} else {
// it's not in the hash table, so add it.
char *uri = PR_smprintf(NS_DOMDSRESOURCE_ID "://CSSPROP%8.8X", gCurrentId++);
// have the resource created by the resource factory
rv = GetRDFService()->GetResource(uri, _retval);
if (NS_FAILED(rv)) return rv;
// add it to the hash table
mObjectTable.Put(objKey, *_retval);
// now fill in the resource stuff
nsCOMPtr<nsIDOMDSResource> nodeContainer = do_QueryInterface(*_retval, &rv);
if (NS_FAILED(rv)) return rv;
nodeContainer->SetObject(aObject);
}
return NS_OK;
}
nsresult
nsCSSDecDataSource::CreatePropertyTarget(PRUint32 aIndex, nsIRDFResource* aProperty, nsIRDFNode **aResult)
{
nsCOMPtr<nsIDOMCSSStyleDeclaration> dec;
nsresult rv = mStyleRule->GetStyle(getter_AddRefs(dec));
nsAutoString name;
dec->Item(aIndex, name);
nsAutoString str;
if (aProperty == kINS_PropertyName) {
str = name;
} else if (aProperty == kINS_PropertyValue) {
dec->GetPropertyValue(name, str);
} else if (aProperty == kINS_PropertyPriority) {
dec->GetPropertyPriority(name, str);
}
return CreateLiteral(str, aResult);
}
nsresult
nsCSSDecDataSource::CreateLiteral(nsString& str, nsIRDFNode **aResult)
{
nsresult rv;
nsCOMPtr<nsIRDFLiteral> literal;
PRUnichar* uniStr = str.ToNewUnicode();
rv = GetRDFService()->GetLiteral(uniStr, getter_AddRefs(literal));
nsMemory::Free(uniStr);
*aResult = literal;
NS_IF_ADDREF(*aResult);
return NS_OK;
}

View File

@ -1,107 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef cssdecdatasource___h___
#define cssdecdatasource___h___
#define NS_CSSDECDATASOURCE_ID "Inspector_CSSDec"
#include "nsICSSDecDataSource.h"
#include "nsDOMDSResource.h"
#include "nsCSSDecIntHolder.h"
#include "nsCOMPtr.h"
#include "nsISupportsArray.h"
#include "nsString.h"
#include "nsHashtable.h"
#include "nsIDOMElement.h"
#include "nsIDOMCSSStyleRule.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsIDocument.h"
#include "nsIStyleSheet.h"
#include "nsIURI.h"
#include "nsIPresShell.h"
#include "nsIPresContext.h"
#include "nsIStyleSet.h"
#include "nsIContent.h"
#include "nsIFrame.h"
#include "nsIStyleContext.h"
#include "nsIStyleRule.h"
#include "nsICSSStyleRule.h"
#include "nsICSSDeclaration.h"
#include "nsIRDFService.h"
#include "nsIRDFDataSource.h"
#include "nsIRDFRemoteDataSource.h"
#include "nsIRDFObserver.h"
#include "nsIRDFNode.h"
#include "nsRDFCID.h"
#include "rdf.h"
#include "nsIComponentManager.h"
#include "nsIDOMWindowInternal.h"
#include "nsIScriptGlobalObject.h"
#include "nsIServiceManager.h"
#include "nsSpecialSystemDirectory.h"
#include "nsVoidArray.h"
#include "nsXPIDLString.h"
#include "nsEnumeratorUtils.h"
#include "nsEscape.h"
#include "nsIAtom.h"
#include "prprf.h"
class nsCSSDecDataSource : public nsICSSDecDataSource,
public nsIRDFDataSource
{
// nsCSSDecDataSource
public:
nsCSSDecDataSource();
virtual ~nsCSSDecDataSource();
nsresult Init();
private:
nsIRDFService* mRDFService;
nsIDOMCSSStyleRule* mStyleRule;
nsSupportsHashtable mObjectTable;
nsIRDFService* GetRDFService();
nsresult GetTargetsForStyleRule(nsIDOMCSSStyleRule* aRule, nsIRDFResource* aProperty, nsISupportsArray* aArcs);
nsresult GetResourceForObject(nsISupports* aObject, nsIRDFResource** _retval);
nsresult CreatePropertyTarget(PRUint32 aIndex, nsIRDFResource* aProperty, nsIRDFNode **aResult);
nsresult CreateLiteral(nsString& str, nsIRDFNode **aResult);
public:
// nsISupports
NS_DECL_ISUPPORTS
// nsICSSDecDataSource
NS_DECL_NSICSSDECDATASOURCE
// nsIRDFDataSource
NS_DECL_NSIRDFDATASOURCE
};
#endif // cssdecdatasource___h___

View File

@ -1,19 +0,0 @@
#include "nsCSSDecIntHolder.h"
////////////////////////////////////////////////////
// Quick and dirty definition of holder object
nsCSSDecIntHolder::nsCSSDecIntHolder() { }
nsCSSDecIntHolder::nsCSSDecIntHolder(PRUint32 aInt)
{
mInt = aInt;
NS_INIT_REFCNT();
}
nsCSSDecIntHolder::~nsCSSDecIntHolder()
{
}
NS_IMPL_ISUPPORTS1(nsCSSDecIntHolder, nsICSSDecIntHolder);

View File

@ -1,26 +0,0 @@
#ifndef nscssdecintholder___h___
#define nscssdecintholder___h___
#include "nsICSSDecIntHolder.h"
////////////////////////////////////////////////////
// Quick and dirty declaration of holder object
class nsCSSDecIntHolder : public nsICSSDecIntHolder {
public:
nsCSSDecIntHolder();
nsCSSDecIntHolder(PRUint32 aInt);
virtual ~nsCSSDecIntHolder();
PRUint32 mInt;
// nsISupports
NS_DECL_ISUPPORTS
// nsICSSDecIntHolder
NS_DECL_NSICSSDECINTHOLDER
};
#endif

View File

@ -1,449 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-file-style: "stroustrup" -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
*/
#include "nsCSSRuleDataSource.h"
#include "dsinfo.h"
////////////////////////////////////////////////////////////////////////
// globals and constants
#define INS_RDF_RULEROOT "inspector:RuleRoot"
#define INS_RDF_RULE INS_NAMESPACE_URI "Rule"
#define INS_RDF_SELECTOR INS_NAMESPACE_URI "Selector"
#define INS_RDF_WEIGHT INS_NAMESPACE_URI "Weight"
#define INS_RDF_FILEURL INS_NAMESPACE_URI "FileURL"
#define INS_RDF_LINENUM INS_NAMESPACE_URI "LineNum"
static PRInt32 gCurrentId = 0;
nsIRDFResource *kINS_RuleRoot;
nsIRDFResource *kINS_Rule;
nsIRDFResource *kINS_Selector;
nsIRDFResource *kINS_Weight;
nsIRDFResource *kINS_FileURL;
nsIRDFResource *kINS_LineNum;
////////////////////////////////////////////////////////////////////////
nsCSSRuleDataSource::nsCSSRuleDataSource()
{
NS_INIT_REFCNT();
}
nsCSSRuleDataSource::~nsCSSRuleDataSource()
{
if (mRDFService) {
nsServiceManager::ReleaseService(kRDFServiceCID, mRDFService);
mRDFService = nsnull;
}
/* NS_IF_RELEASE(kINS_RuleRoot);
NS_IF_RELEASE(kINS_Rule);
NS_IF_RELEASE(kINS_Selector);
NS_IF_RELEASE(kINS_Weight);
NS_IF_RELEASE(kINS_FileURL);
NS_IF_RELEASE(kINS_LineNum);
*/
}
nsresult
nsCSSRuleDataSource::Init()
{
nsresult rv = nsServiceManager::GetService(kRDFServiceCID, NS_GET_IID(nsIRDFService), (nsISupports**) &mRDFService);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");
if (NS_FAILED(rv)) return rv;
mRDFService->GetResource(INS_RDF_RULEROOT, &kINS_RuleRoot);
mRDFService->GetResource(INS_RDF_RULE, &kINS_Rule);
mRDFService->GetResource(INS_RDF_SELECTOR, &kINS_Selector);
mRDFService->GetResource(INS_RDF_WEIGHT, &kINS_Weight);
mRDFService->GetResource(INS_RDF_FILEURL, &kINS_FileURL);
mRDFService->GetResource(INS_RDF_LINENUM, &kINS_LineNum);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////
// nsISupports
NS_IMPL_ISUPPORTS2(nsCSSRuleDataSource,
nsICSSRuleDataSource,
nsIRDFDataSource);
////////////////////////////////////////////////////////////////////////
// nsICSSRuleDataSource
NS_IMETHODIMP
nsCSSRuleDataSource::SetElement(nsIDOMElement* aElement)
{
mElement = aElement;
return NS_OK;
}
NS_IMETHODIMP
nsCSSRuleDataSource::GetElement(nsIDOMElement** aElement)
{
*aElement = mElement;
NS_IF_ADDREF(*aElement);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////
// nsIRDFDataSource
NS_IMETHODIMP
nsCSSRuleDataSource::GetURI(char* *aURI)
{
NS_PRECONDITION(aURI != nsnull, "null ptr");
if (! aURI) return NS_ERROR_NULL_POINTER;
*aURI = nsCRT::strdup("rdf:" NS_CSSRULEDATASOURCE_ID);
if (! *aURI) return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
NS_IMETHODIMP
nsCSSRuleDataSource::GetSource(nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue, nsIRDFResource **_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsCSSRuleDataSource::GetSources(nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue, nsISimpleEnumerator **_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsCSSRuleDataSource::GetTarget(nsIRDFResource *aSource, nsIRDFResource *aProperty, PRBool aTruthValue, nsIRDFNode **_retval)
{
*_retval = nsnull;
nsresult rv;
if (aSource == kINS_RuleRoot) {
// It's the root, so we ignore it
return NS_OK;
} else {
// It's not the root, so we proceed to find the target node
nsCOMPtr<nsIDOMDSResource> domRes = do_QueryInterface(aSource);
if (domRes) {
nsCOMPtr<nsISupports> supports;
domRes->GetObject(getter_AddRefs(supports));
nsCOMPtr<nsICSSStyleRule> rule = do_QueryInterface(supports, &rv);
if (NS_SUCCEEDED(rv))
return CreateStyleRuleTarget(rule, aProperty, _retval);
}
}
return rv;
}
NS_IMETHODIMP
nsCSSRuleDataSource::GetTargets(nsIRDFResource *aSource, nsIRDFResource *aProperty, PRBool aTruthValue, nsISimpleEnumerator **_retval)
{
nsresult rv;
nsCOMPtr<nsISupportsArray> arcs;
rv = NS_NewISupportsArray(getter_AddRefs(arcs));
nsArrayEnumerator* cursor = new nsArrayEnumerator(arcs);
if (!cursor) return NS_ERROR_OUT_OF_MEMORY;
*_retval = cursor;
NS_ADDREF(*_retval);
if (!mElement) return NS_OK;
// The only node with targets is the root, since this this data source
// is just a flat list of rules
if (aSource == kINS_RuleRoot) {
rv = GetTargetsForElement(mElement, aProperty, arcs);
}
return NS_OK;
}
NS_IMETHODIMP
nsCSSRuleDataSource::Assert(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsCSSRuleDataSource::Unassert(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsCSSRuleDataSource::Change(nsIRDFResource *, nsIRDFResource *,
nsIRDFNode *, nsIRDFNode*)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsCSSRuleDataSource::Move(nsIRDFResource *, nsIRDFResource *,
nsIRDFResource *, nsIRDFNode*)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsCSSRuleDataSource::HasAssertion(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue, PRBool *_retval)
{
return NS_OK;
}
NS_IMETHODIMP
nsCSSRuleDataSource::AddObserver(nsIRDFObserver *aObserver)
{
return NS_OK;
}
NS_IMETHODIMP
nsCSSRuleDataSource::RemoveObserver(nsIRDFObserver *aObserver)
{
return NS_OK;
}
NS_IMETHODIMP
nsCSSRuleDataSource::ArcLabelsIn(nsIRDFNode *aNode, nsISimpleEnumerator **_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsCSSRuleDataSource::ArcLabelsOut(nsIRDFResource *aSource, nsISimpleEnumerator **_retval)
{
return NS_OK;
}
NS_IMETHODIMP
nsCSSRuleDataSource::GetAllResources(nsISimpleEnumerator **_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsCSSRuleDataSource::GetAllCommands(nsIRDFResource *aSource, nsIEnumerator **_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsCSSRuleDataSource::IsCommandEnabled(nsISupportsArray *aSources, nsIRDFResource *aCommand, nsISupportsArray *aArguments, PRBool *_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsCSSRuleDataSource::DoCommand(nsISupportsArray *aSources, nsIRDFResource *aCommand, nsISupportsArray *aArguments)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsCSSRuleDataSource::GetAllCmds(nsIRDFResource *aSource, nsISimpleEnumerator **_retval)
{
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsCSSRuleDataSource::HasArcIn(nsIRDFNode *aNode, nsIRDFResource *aArc, PRBool *result)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsCSSRuleDataSource::HasArcOut(nsIRDFResource *aSource, nsIRDFResource *aArc, PRBool *result)
{
return NS_OK;
}
////////////////////////////////////////////////////////////////////////
// nsCSSRuleDataSource
nsIRDFService*
nsCSSRuleDataSource::GetRDFService()
{
if (!mRDFService) {
nsresult rv;
rv = nsServiceManager::GetService(kRDFServiceCID, NS_GET_IID(nsIRDFService), (nsISupports**) &mRDFService);
if (NS_FAILED(rv)) return nsnull;
}
return mRDFService;
}
nsresult
nsCSSRuleDataSource::GetTargetsForElement(nsIDOMElement* aElement, nsIRDFResource* aProperty, nsISupportsArray* aArcs)
{
// query to a content node
nsCOMPtr<nsIContent> content;
content = do_QueryInterface(aElement);
// get the document
nsCOMPtr<nsIDOMDocument> doc1;
aElement->GetOwnerDocument(getter_AddRefs(doc1));
nsCOMPtr<nsIDocument> doc;
doc = do_QueryInterface(doc1);
// loop through the PresShells
nsresult rv;
PRInt32 num = doc->GetNumberOfShells();
nsCOMPtr<nsIPresShell> shell;
nsIFrame* frame;
nsCOMPtr<nsIStyleContext> styleContext;
for (PRInt32 i = 0; i < num; i++) {
// get the style context
doc->GetShellAt(i, getter_AddRefs(shell));
rv = shell->GetPrimaryFrameFor(content, &frame);
if (NS_FAILED(rv) || !frame) return rv;
shell->GetStyleContextFor(frame, getter_AddRefs(styleContext));
if (NS_FAILED(rv) || !styleContext) return rv;
// create a resource for all the style rules from the
// context and add them to aArcs
nsCOMPtr<nsIRuleNode> ruleNode;
styleContext->GetRuleNode(getter_AddRefs(ruleNode));
nsCOMPtr<nsIStyleRule> srule;
nsCOMPtr<nsICSSStyleRule> rule;
nsCOMPtr<nsIRuleNode> ruleNodeTmp;
nsCOMPtr<nsIRDFResource> resource;
while (ruleNode) {
ruleNode->GetRule(getter_AddRefs(srule));
rule = do_QueryInterface(srule);
rv = GetResourceForObject(rule, getter_AddRefs(resource));
// since tree of nodes is from top down, insert in reverse order
rv = aArcs->InsertElementAt(resource, 0);
ruleNode->GetParent(getter_AddRefs(ruleNodeTmp));
ruleNode = ruleNodeTmp;
// don't be adding that there root node
PRBool isRoot;
ruleNode->IsRoot(&isRoot);
if (isRoot) break;
}
}
return NS_OK;
}
nsresult
nsCSSRuleDataSource::GetResourceForObject(nsISupports* aObject, nsIRDFResource** _retval)
{
nsresult rv;
nsISupportsKey* objKey = new nsISupportsKey(aObject);
nsCOMPtr<nsISupports> supports = (nsISupports*) mObjectTable.Get(objKey);
if (supports) {
nsCOMPtr<nsIRDFResource> res = do_QueryInterface(supports, &rv);
*_retval = res;
} else {
// it's not in the hash table, so add it.
char *uri = PR_smprintf(NS_DOMDSRESOURCE_ID "://CSSRULE%8.8X", gCurrentId++);
// have the resource created by the resource factory
rv = GetRDFService()->GetResource(uri, _retval);
if (NS_FAILED(rv)) return rv;
// add it to the hash table
mObjectTable.Put(objKey, *_retval);
// now fill in the resource stuff
nsCOMPtr<nsIDOMDSResource> nodeContainer = do_QueryInterface(*_retval, &rv);
if (NS_FAILED(rv)) return rv;
nodeContainer->SetObject(aObject);
}
return NS_OK;
}
nsresult
nsCSSRuleDataSource::CreateStyleRuleTarget(nsICSSStyleRule* aRule, nsIRDFResource* aProperty, nsIRDFNode **aResult)
{
nsresult rv;
nsAutoString str;
if (aProperty == kINS_Selector) {
aRule->GetSourceSelectorText(str);
} else if (aProperty == kINS_Weight) {
PRUint32 weight = aRule->GetWeight();
char* ln = PR_smprintf("%d", weight);
str.AssignWithConversion(ln);
} else if (aProperty == kINS_FileURL) {
nsCOMPtr<nsIStyleSheet> sheet;
nsCOMPtr<nsIURI> uri;
char* spec;
rv = aRule->GetStyleSheet(*getter_AddRefs(sheet));
if (NS_FAILED(rv) || !sheet) return rv;
rv = sheet->GetURL(*getter_AddRefs(uri));
if (NS_FAILED(rv) || !uri) return rv;
uri->GetSpec(&spec);
str.AssignWithConversion(spec);
} else if (aProperty == kINS_LineNum) {
PRUint32 linenum = aRule->GetLineNumber();
char* ln = PR_smprintf("%d", linenum);
str.AssignWithConversion(ln);
}
return CreateLiteral(str, aResult);
}
nsresult
nsCSSRuleDataSource::CreateLiteral(nsString& str, nsIRDFNode **aResult)
{
nsresult rv;
nsCOMPtr<nsIRDFLiteral> literal;
PRUnichar* uniStr = str.ToNewUnicode();
rv = GetRDFService()->GetLiteral(uniStr, getter_AddRefs(literal));
nsMemory::Free(uniStr);
*aResult = literal;
NS_IF_ADDREF(*aResult);
return NS_OK;
}

View File

@ -1,110 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef cssruledatasource___h___
#define cssruledatasource___h___
#define NS_CSSRULEDATASOURCE_ID "Inspector_CSSRules"
#include "nsICSSRuleDataSource.h"
#include "nsDOMDSResource.h"
#include "nsCOMPtr.h"
#include "nsISupportsArray.h"
#include "nsString.h"
#include "nsIDOMElement.h"
#include "nsCOMPtr.h"
#include "nsISupportsArray.h"
#include "nsString.h"
#include "nsHashtable.h"
#include "nsIDOMElement.h"
#include "nsIDOMDocument.h"
#include "nsIDocument.h"
#include "nsIStyleSheet.h"
#include "nsIURI.h"
#include "nsIPresShell.h"
#include "nsIPresContext.h"
#include "nsIStyleSet.h"
#include "nsIContent.h"
#include "nsIFrame.h"
#include "nsIStyleContext.h"
#include "nsIStyleRule.h"
#include "nsICSSStyleRule.h"
#include "nsICSSDeclaration.h"
#include "nsIRuleNode.h"
#include "nsIRDFService.h"
#include "nsIRDFDataSource.h"
#include "nsIRDFRemoteDataSource.h"
#include "nsIRDFObserver.h"
#include "nsIRDFNode.h"
#include "nsRDFCID.h"
#include "rdf.h"
#include "nsIComponentManager.h"
#include "nsIDOMWindowInternal.h"
#include "nsIScriptGlobalObject.h"
#include "nsIServiceManager.h"
#include "nsSpecialSystemDirectory.h"
#include "nsVoidArray.h"
#include "nsXPIDLString.h"
#include "nsEnumeratorUtils.h"
#include "nsEscape.h"
#include "nsIAtom.h"
#include "prprf.h"
class nsCSSRuleDataSource : public nsICSSRuleDataSource,
public nsIRDFDataSource
{
// nsCSSRuleDataSource
public:
nsCSSRuleDataSource();
virtual ~nsCSSRuleDataSource();
nsresult Init();
private:
nsIRDFService* GetRDFService();
nsresult GetTargetsForElement(nsIDOMElement* aElement, nsIRDFResource* aProperty, nsISupportsArray* aArcs);
nsresult GetResourceForObject(nsISupports* aObject, nsIRDFResource** _retval);
nsresult CreateStyleRuleTarget(nsICSSStyleRule* aRule, nsIRDFResource* aProperty, nsIRDFNode **aResult);
nsresult CreateLiteral(nsString& str, nsIRDFNode **aResult);
nsIRDFService* mRDFService;
nsIRDFService* mService;
nsIDOMElement* mElement;
nsSupportsHashtable mObjectTable;
// nsISupports
NS_DECL_ISUPPORTS
// nsICSSRuleDataSource
NS_DECL_NSICSSRULEDATASOURCE
// nsIRDFDataSource
NS_DECL_NSIRDFDATASOURCE
};
#endif // cssruledatasource___h___

View File

@ -0,0 +1,159 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "inScreenCapturer.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsIServiceManager.h"
#include "nsGfxCIID.h"
#include "nsIPresShell.h"
#include "nsIRenderingContext.h"
#include "nsIFrame.h"
#include "nsIDOMElement.h"
#include "nsIDOMWindowInternal.h"
#include "nsIImage.h"
#include "nsIDeviceContext.h"
#include "nsRect.h"
#include "inIBitmap.h"
#include "inLayoutUtils.h"
///////////////////////////////////////////////////////////////////////////////
inScreenCapturer::inScreenCapturer()
{
NS_INIT_REFCNT();
}
inScreenCapturer::~inScreenCapturer()
{
}
NS_IMPL_ISUPPORTS1(inScreenCapturer, inIScreenCapturer);
///////////////////////////////////////////////////////////////////////////////
// inIScreenCapturer
NS_IMETHODIMP
inScreenCapturer::CaptureElement(nsIDOMElement *aElement, inIBitmap **_retval)
{
if (!aElement) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMWindowInternal> window = inLayoutUtils::GetWindowFor(aElement);
if (!window) return NS_ERROR_FAILURE;
nsCOMPtr<nsIPresShell> presShell = inLayoutUtils::GetPresShellFor(window);
if (!presShell) return NS_ERROR_FAILURE;
// get the dimensions of the element, which is the region we will be copying
nsIFrame* frame = inLayoutUtils::GetFrameFor(aElement, presShell);
if (!frame) return NS_ERROR_FAILURE;
nsRect rect;
frame->GetRect(rect);
nsRect screenpos = inLayoutUtils::GetScreenOrigin(aElement);
rect.x = screenpos.x;
rect.y = screenpos.y;
// adjust rect for margins
inLayoutUtils::AdjustRectForMargins(aElement, rect);
// get scale for converting frame dimensions to pixels
nsCOMPtr<nsIPresContext> pcontext;
presShell->GetPresContext(getter_AddRefs(pcontext));
float t2p;
pcontext->GetTwipsToPixels(&t2p);
// convert twip values to pixels
PRInt32 x = NSTwipsToIntPixels(rect.x, t2p);
PRInt32 y = NSTwipsToIntPixels(rect.y, t2p);
PRInt32 w = NSTwipsToIntPixels(rect.width, t2p);
PRInt32 h = NSTwipsToIntPixels(rect.height, t2p);
// capture that sucker!
CaptureRegion(window, x, y, w, h, _retval);
return NS_OK;
}
NS_IMETHODIMP
inScreenCapturer::CaptureRegion(nsIDOMWindowInternal *aWindow,
PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight,
inIBitmap **_retval)
{
// get the native device context
HDC hdc = ::GetDC(nsnull);
nsCOMPtr<nsIDeviceContext> dc;
// determine pixel bit depth
PRUint32 depth = ::GetDeviceCaps(hdc, COLORRES);
nsCOMPtr<inIBitmap> bitmap(do_CreateInstance("@mozilla.org/inspector/bitmap;1"));
if (!bitmap) return NS_ERROR_OUT_OF_MEMORY;
bitmap->Init(aWidth, aHeight, depth);
PRUint8* bits;
bitmap->GetBits(&bits);
if (depth == 8) {
DoCopy8(bits, hdc, aX, aY, aWidth, aHeight);
} else if (depth == 16) {
DoCopy16(bits, hdc, aX, aY, aWidth, aHeight);
} else if (depth == 32 || depth == 24) {
DoCopy32(bits, hdc, aX, aY, aWidth, aHeight);
}
*_retval = bitmap;
NS_ADDREF(*_retval);
return NS_OK;
}
///////////////////////////////////////////////////////////////////////////////
// inScreenCapturer
NS_IMETHODIMP
inScreenCapturer::DoCopy32(PRUint8* aBits, HDC aHDC, PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight)
{
PRUint8* bits = aBits;
for (PRInt32 y = 0; y < aHeight; y++) {
for (PRInt32 x = 0; x < aWidth; x++) {
PRUint32 pixel = ::GetPixel(aHDC, aX+x,aY+y);
*bits = NS_GET_B(pixel);
*(bits+1) = NS_GET_G(pixel);
*(bits+2) = NS_GET_R(pixel);
bits += 3;
}
}
return NS_OK;
}
NS_IMETHODIMP
inScreenCapturer::DoCopy8(PRUint8* aBits, HDC aHDC, PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
inScreenCapturer::DoCopy16(PRUint8* aBits, HDC aHDC, PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@ -20,36 +20,26 @@
* Contributor(s):
*/
#ifndef __searchItemImage_h__
#define __searchItemImage_h__
#ifndef __inScreenCapturer_h__
#define __inScreenCapturer_h__
#include "inISearchItem.h"
#include "inIScreenCapturer.h"
#include <windows.h>
#include "nsCOMPtr.h"
#include "nsString.h"
class inSearchItemImage : public inISearchItem
class inScreenCapturer : public inIScreenCapturer
{
public:
inSearchItemImage(nsAutoString* aURL);
~inSearchItemImage();
NS_DECL_ISUPPORTS
NS_DECL_INISCREENCAPTURER
inScreenCapturer();
~inScreenCapturer();
protected:
nsAutoString mURL;
static NS_IMETHODIMP DoCopy8(PRUint8* aBits, HDC aHDC, PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight);
static NS_IMETHODIMP DoCopy16(PRUint8* aBits, HDC aHDC, PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight);
static NS_IMETHODIMP DoCopy32(PRUint8* aBits, HDC aHDC, PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight);
public:
NS_DECL_ISUPPORTS
NS_DECL_INISEARCHITEM
};
////////////////////////////////////////////////////////////////////
// {AA526D81-7523-4fc6-9B6A-22D74CC55AB7}
#define IN_SEARCHITEMIMAGE_CID \
{ 0xaa526d81, 0x7523, 0x4fc6, { 0x9b, 0x6a, 0x22, 0xd7, 0x4c, 0xc5, 0x5a, 0xb7 } }
#define IN_SEARCHITEMIMAGE_CONTRACTID \
"@mozilla.org/inspector/searchitem;1?type=image"
#endif
#endif // __inScreenCapturer_h__

View File

@ -20,6 +20,42 @@
# Contributor(s):
DEPTH=..\..\..\..\..
include <$(DEPTH)/config/config.mak>
LIBRARY_NAME=inscreencap_s
MODULE=inspector
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
INCS = $(INCS) \
-I$(DEPTH)\dist\include \
-I..\ \
$(NULL)
CPPSRCS= \
inScreenCapturer.cpp \
$(NULL)
CPP_OBJS= \
.\$(OBJDIR)\inScreenCapturer.obj \
$(NULL)
EXPORTS = $(NULL)
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\js \
-I$(PUBLIC)\dom -I$(PUBLIC)\uconv
LCFLAGS = \
$(LCFLAGS) \
$(DEFINES) \
$(NULL)
include <$(DEPTH)\config\rules.mak>
install:: $(LIBRARY)
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
clobber::
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib

View File

@ -13,11 +13,11 @@
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
# Joe Hewitt <hewitt@netscape.com> (original author)
DEPTH=../../..
topsrcdir=@top_srcdir@

View File

@ -1,3 +1,25 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
var gVersion = "0.5";
var err = initInstall("Document Inspector", "inspector", gVersion);

View File

@ -14,10 +14,11 @@
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Joe Hewitt <hewitt@netscape.com> (original author)
DEPTH=..\..\..
include <$(DEPTH)/config/config.mak>

View File

@ -13,7 +13,7 @@
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):

View File

@ -12,10 +12,11 @@
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Joe Hewitt <hewitt@netscape.com> (original author)
DEPTH=..\..\..\..
MODULE=inspector
@ -25,20 +26,23 @@ MODULE_NAME=nsInspectorModule
################################################################################
## library
LINCS=-I..\..\base\src
LINCS=-I..\..\base\src -I..\..\base\src\win
CPP_OBJS= \
.\$(OBJDIR)\nsInspectorModule.obj \
CPP_OBJS= \
.\$(OBJDIR)\nsInspectorModule.obj \
$(NULL)
LLIBS= \
$(DIST)\lib\xpcom.lib \
$(DIST)\lib\rdfutil_s.lib \
$(DIST)\lib\inspector_s.lib \
LLIBS= \
$(DIST)\lib\xpcom.lib \
$(DIST)\lib\rdfutil_s.lib \
$(DIST)\lib\inspector_s.lib \
$(DIST)\lib\gkgfx.lib \
$(DIST)\lib\contenthtmlstyle_s.lib \
$(DIST)\lib\contentshared_s.lib \
$(LIBNSPR) \
$(DIST)\lib\inscreencap_s.lib \
$(DIST)\lib\png.lib \
$(DIST)\lib\zlib.lib \
$(LIBNSPR) \
$(NULL)
include <$(DEPTH)/config/rules.mak>

View File

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
/*
* The contents of this file are subject to the Netscape 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
@ -14,42 +13,171 @@
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
#include "nsIGenericFactory.h"
#include "nsDOMDSResource.h"
#include "nsDOMDataSource.h"
#include "nsCSSRuleDataSource.h"
#include "nsCSSDecDataSource.h"
#include "nsCSSDecIntHolder.h"
#include "inDOMRDFResource.h"
#include "inDOMDataSource.h"
#include "inDeepTreeWalker.h"
#include "inFlasher.h"
#include "inCSSValueSearch.h"
#include "inFileSearch.h"
#include "inDOMUtils.h"
#include "inBitmap.h"
#include "inBitmapDepot.h"
#include "inBitmapDecoder.h"
#include "inBitmapProtocolHandler.h"
#include "inPNGEncoder.h"
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsDOMDataSource, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsCSSRuleDataSource, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsCSSDecDataSource, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMDSResource)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCSSDecIntHolder)
#ifdef WIN32
#include "inScreenCapturer.h"
#endif
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(inDOMDataSource, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(inDOMRDFResource)
NS_GENERIC_FACTORY_CONSTRUCTOR(inDeepTreeWalker)
NS_GENERIC_FACTORY_CONSTRUCTOR(inFlasher)
NS_GENERIC_FACTORY_CONSTRUCTOR(inCSSValueSearch)
NS_GENERIC_FACTORY_CONSTRUCTOR(inFileSearch)
NS_GENERIC_FACTORY_CONSTRUCTOR(inDOMUtils)
NS_GENERIC_FACTORY_CONSTRUCTOR(inBitmap)
NS_GENERIC_FACTORY_CONSTRUCTOR(inBitmapDepot)
NS_GENERIC_FACTORY_CONSTRUCTOR(inBitmapDecoder)
NS_GENERIC_FACTORY_CONSTRUCTOR(inBitmapProtocolHandler)
NS_GENERIC_FACTORY_CONSTRUCTOR(inPNGEncoder)
#ifdef WIN32
NS_GENERIC_FACTORY_CONSTRUCTOR(inScreenCapturer)
#endif
// {3AD0C13B-195E-48e7-AF29-F024E2D759EA}
#define IN_INSDOMDATASOURCE_CID \
{ 0x3ad0c13b, 0x195e, 0x48e7, { 0xaf, 0x29, 0xf0, 0x24, 0xe2, 0xd7, 0x59, 0xea } }
// {76C9161F-4C4C-4c1b-8F96-64587315C79E}
#define IN_DOMRDFRESOURCE_CID \
{ 0x76c9161f, 0x4c4c, 0x4c1b, { 0x8f, 0x96, 0x64, 0x58, 0x73, 0x15, 0xc7, 0x9e } }
// {BFCB82C2-5611-4318-90D6-BAF4A7864252}
#define IN_DEEPTREEWALKER_CID \
{ 0xbfcb82c2, 0x5611, 0x4318, { 0x90, 0xd6, 0xba, 0xf4, 0xa7, 0x86, 0x42, 0x52 } }
// {4D977F60-FBE7-4583-8CB7-F5ED882293EF}
#define IN_CSSVALUESEARCH_CID \
{ 0x4d977f60, 0xfbe7, 0x4583, { 0x8c, 0xb7, 0xf5, 0xed, 0x88, 0x22, 0x93, 0xef } }
// {9286E71A-621A-4b91-851E-9984C1A2E81A}
#define IN_FLASHER_CID \
{ 0x9286e71a, 0x621a, 0x4b91, { 0x85, 0x1e, 0x99, 0x84, 0xc1, 0xa2, 0xe8, 0x1a } }
// {D5636476-9F94-47f2-9CE9-69CDD9D7BBCD}
#define IN_FILESEARCH_CID \
{ 0xd5636476, 0x9f94, 0x47f2, { 0x9c, 0xe9, 0x69, 0xcd, 0xd9, 0xd7, 0xbb, 0xcd } }
// {40B22006-5DD5-42f2-BFE7-7DBF0757AB8B}
#define IN_DOMUTILS_CID \
{ 0x40b22006, 0x5dd5, 0x42f2, { 0xbf, 0xe7, 0x7d, 0xbf, 0x7, 0x57, 0xab, 0x8b } }
// {C4E47704-4C71-43f7-A37C-EF9FCD9ABBC2}
#define IN_BITMAP_CID \
{ 0xc4e47704, 0x4c71, 0x43f7, { 0xa3, 0x7c, 0xef, 0x9f, 0xcd, 0x9a, 0xbb, 0xc2 } }
// {99B8BA1F-B6B2-40ed-8BA4-F5EBC9BC1F10}
#define IN_BITMAPDEPOT_CID \
{ 0x99b8ba1f, 0xb6b2, 0x40ed, { 0x8b, 0xa4, 0xf5, 0xeb, 0xc9, 0xbc, 0x1f, 0x10 } }
// {9ED21085-3122-45bf-A275-61228EC5B8F2}
#define IN_BITMAPDECODER_CID \
{ 0x9ed21085, 0x3122, 0x45bf, { 0xa2, 0x75, 0x61, 0x22, 0x8e, 0xc5, 0xb8, 0xf2 } }
// {D08C5593-6C55-4d69-A0E9-4848D88CDCDA}
#define IN_BITMAPPROTOCOLHANDLER_CID \
{ 0xd08c5593, 0x6c55, 0x4d69, { 0xa0, 0xe9, 0x48, 0x48, 0xd8, 0x8c, 0xdc, 0xda } }
// {243533EA-446E-4a7e-A27A-C27890417DEE}
#define IN_PNGENCODER_CID \
{ 0x243533ea, 0x446e, 0x4a7e, { 0xa2, 0x7a, 0xc2, 0x78, 0x90, 0x41, 0x7d, 0xee } }
#ifdef WIN32
// {ECE14DF2-FC83-469f-83AC-684D5F06B6CE}
#define IN_SCREENCAPTURER_CID \
{ 0xece14df2, 0xfc83, 0x469f, { 0x83, 0xac, 0x68, 0x4d, 0x5f, 0x6, 0xb6, 0xce } }
#endif
static nsModuleComponentInfo components[] =
{
{ "DOM DS Resource", NS_DOMDSRESOURCE_CID, NS_RDF_RESOURCE_FACTORY_CONTRACTID_PREFIX NS_DOMDSRESOURCE_ID, nsDOMDSResourceConstructor },
{ "DOM Datasource", NS_INSDOMDATASOURCE_CID, NS_RDF_DATASOURCE_CONTRACTID_PREFIX NS_DOMDSDATASOURCE_ID, nsDOMDataSourceConstructor },
{ "CSS Rule Datasource", NS_CSSRULE_DATASOURCE_CID, NS_RDF_DATASOURCE_CONTRACTID_PREFIX NS_CSSRULEDATASOURCE_ID, nsCSSRuleDataSourceConstructor },
{ "CSS Dec Datasource", NS_CSSDEC_DATASOURCE_CID, NS_RDF_DATASOURCE_CONTRACTID_PREFIX NS_CSSDECDATASOURCE_ID, nsCSSDecDataSourceConstructor },
{ "Flasher", IN_FLASHER_CID, IN_FLASHER_CONTRACTID, inFlasherConstructor },
{ "Data Holder", NS_CSSDECINTHOLDER_CID, NS_CSSDECINTHOLDER_CONTRACTID, nsCSSDecIntHolderConstructor },
{ "CSS Value Search", IN_CSSVALUESEARCH_CID, IN_CSSVALUESEARCH_CONTRACTID, inCSSValueSearchConstructor },
{ "File Search", IN_FILESEARCH_CID, IN_FILESEARCH_CONTRACTID, inFileSearchConstructor }
{ "DOM Datasource",
IN_INSDOMDATASOURCE_CID,
NS_RDF_DATASOURCE_CONTRACTID_PREFIX IN_DOMDATASOURCE_ID,
inDOMDataSourceConstructor },
{ "DOM RDF Resource",
IN_DOMRDFRESOURCE_CID,
NS_RDF_RESOURCE_FACTORY_CONTRACTID_PREFIX IN_DOMRDFRESOURCE_ID,
inDOMRDFResourceConstructor },
{ "Deep Tree Holder",
IN_DEEPTREEWALKER_CID,
"@mozilla.org/inspector/deep-tree-walker;1",
inDeepTreeWalkerConstructor },
{ "Flasher",
IN_FLASHER_CID,
"@mozilla.org/inspector/flasher;1",
inFlasherConstructor },
{ "CSS Value Search",
IN_CSSVALUESEARCH_CID,
"@mozilla.org/inspector/search;1?type=cssvalue",
inCSSValueSearchConstructor },
{ "File Search",
IN_FILESEARCH_CID,
"@mozilla.org/inspector/search;1?type=file",
inFileSearchConstructor },
{ "DOM Utils",
IN_DOMUTILS_CID,
"@mozilla.org/inspector/dom-utils;1",
inDOMUtilsConstructor },
#ifdef WIN32
{ "Screen Capturer",
IN_SCREENCAPTURER_CID,
"@mozilla.org/inspector/screen-capturer;1",
inScreenCapturerConstructor },
#endif
{ "Bitmap",
IN_BITMAP_CID,
"@mozilla.org/inspector/bitmap;1",
inBitmapConstructor },
{ "Bitmap Depot",
IN_BITMAPDEPOT_CID,
"@mozilla.org/inspector/bitmap-depot;1",
inBitmapDepotConstructor },
{ "Bitmap Channel",
IN_BITMAPDECODER_CID,
"@mozilla.org/image/decoder;2?type=image/inspector-bitmap",
inBitmapDecoderConstructor },
{ "Bitmap Protocol Handler",
IN_BITMAPPROTOCOLHANDLER_CID,
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "moz-bitmap",
inBitmapProtocolHandlerConstructor },
{ "PNG Encoder",
IN_PNGENCODER_CID,
"@mozilla.org/inspector/png-encoder;1",
inPNGEncoderConstructor }
};

158
extensions/inspector/jar.mn Normal file
View File

@ -0,0 +1,158 @@
inspector.jar:
content/inspector/contents.rdf (resources/content/contents.rdf)
content/inspector/inspector.xul (resources/content/inspector.xul)
content/inspector/inspector.js (resources/content/inspector.js)
content/inspector/inspector.css (resources/content/inspector.css)
content/inspector/inspector.xml (resources/content/inspector.xml)
content/inspector/sidebar.xul (resources/content/sidebar.xul)
content/inspector/sidebar.js (resources/content/sidebar.js)
content/inspector/object.xul (resources/content/object.xul)
content/inspector/object.js (resources/content/object.js)
content/inspector/inspectorOverlay.xul (resources/content/inspectorOverlay.xul)
content/inspector/toolboxOverlay.xul (resources/content/toolboxOverlay.xul)
content/inspector/commandOverlay.xul (resources/content/commandOverlay.xul)
content/inspector/keysetOverlay.xul (resources/content/keysetOverlay.xul)
content/inspector/popupOverlay.xul (resources/content/popupOverlay.xul)
content/inspector/statusbarOverlay.xul (resources/content/statusbarOverlay.xul)
content/inspector/tasksOverlay.xul (resources/content/tasksOverlay.xul)
content/inspector/browserOverlay.xul (resources/content/browserOverlay.xul)
content/inspector/venkmanOverlay.xul (resources/content/venkmanOverlay.xul)
content/inspector/utilWindow.xul (resources/content/utilWindow.xul)
content/inspector/Flasher.js (resources/content/Flasher.js)
content/inspector/ViewerRegistry.js (resources/content/ViewerRegistry.js)
content/inspector/utils.js (resources/content/utils.js)
content/inspector/hooks.js (resources/content/hooks.js)
content/inspector/util.dtd (resources/content/util.dtd)
content/inspector/extensions/titledSplitter.css (resources/content/extensions/titledSplitter.css)
content/inspector/extensions/titledSplitter.xml (resources/content/extensions/titledSplitter.xml)
content/inspector/extensions/treeEditable.css (resources/content/extensions/treeEditable.css)
content/inspector/extensions/treeEditable.xml (resources/content/extensions/treeEditable.xml)
content/inspector/extensions/multipanel.css (resources/content/extensions/multipanel.css)
content/inspector/extensions/multipanel.xml (resources/content/extensions/multipanel.xml)
content/inspector/extensions/wsm-colorpicker.js (resources/content/extensions/wsm-colorpicker.js)
content/inspector/jsutil/rdf/RDFArray.js (resources/content/jsutil/rdf/RDFArray.js)
content/inspector/jsutil/rdf/RDFU.js (resources/content/jsutil/rdf/RDFU.js)
content/inspector/jsutil/system/DiskSearch.js (resources/content/jsutil/system/DiskSearch.js)
content/inspector/jsutil/system/FilePickerUtils.js (resources/content/jsutil/system/FilePickerUtils.js)
content/inspector/jsutil/system/PrefUtils.js (resources/content/jsutil/system/PrefUtils.js)
content/inspector/jsutil/system/file.js (resources/content/jsutil/system/file.js)
content/inspector/jsutil/system/ClipboardUtils.js (resources/content/jsutil/system/ClipboardUtils.js)
content/inspector/jsutil/xpcom/XPCU.js (resources/content/jsutil/xpcom/XPCU.js)
content/inspector/jsutil/xul/DNDUtils.js (resources/content/jsutil/xul/DNDUtils.js)
content/inspector/jsutil/xul/FrameExchange.js (resources/content/jsutil/xul/FrameExchange.js)
content/inspector/jsutil/xul/inFormManager.js (resources/content/jsutil/xul/inFormManager.js)
content/inspector/jsutil/xul/inTreeTableBuilder.js (resources/content/jsutil/xul/inTreeTableBuilder.js)
content/inspector/jsutil/xul/inOutlinerBuilder.js (resources/content/jsutil/xul/inOutlinerBuilder.js)
content/inspector/jsutil/xul/inBaseOutlinerView.js (resources/content/jsutil/xul/inBaseOutlinerView.js)
content/inspector/jsutil/events/ObserverManager.js (resources/content/jsutil/events/ObserverManager.js)
content/inspector/prefs/pref-inspector.xul (resources/content/prefs/pref-inspector.xul)
content/inspector/prefs/prefsOverlay.xul (resources/content/prefs/prefsOverlay.xul)
content/inspector/prefs/pref-sidebar.js (resources/content/prefs/pref-sidebar.js)
content/inspector/search/inSearchModule.js (resources/content/search/inSearchModule.js)
content/inspector/search/inSearchService.js (resources/content/search/inSearchService.js)
content/inspector/search/inSearchTreeBuilder.js (resources/content/search/inSearchTreeBuilder.js)
content/inspector/search/inSearchUtils.js (resources/content/search/inSearchUtils.js)
content/inspector/search/modules/commandOverlay.xul (resources/content/search/modules/commandOverlay.xul)
content/inspector/search/modules/popupOverlay.xul (resources/content/search/modules/popupOverlay.xul)
content/inspector/search/modules/findFiles/dialog.js (resources/content/search/modules/findFiles/dialog.js)
content/inspector/search/modules/findFiles/dialog.xul (resources/content/search/modules/findFiles/dialog.xul)
content/inspector/search/modules/findFiles/findFiles.xml (resources/content/search/modules/findFiles/findFiles.xml)
content/inspector/search/modules/junkImgs/dialog.js (resources/content/search/modules/junkImgs/dialog.js)
content/inspector/search/modules/junkImgs/dialog.xul (resources/content/search/modules/junkImgs/dialog.xul)
content/inspector/search/modules/junkImgs/junkImgs.xml (resources/content/search/modules/junkImgs/junkImgs.xml)
content/inspector/tests/allskin.xul (resources/content/tests/allskin.xul)
content/inspector/viewers/computedStyle/computedStyle.js (resources/content/viewers/computedStyle/computedStyle.js)
content/inspector/viewers/computedStyle/computedStyle.xul (resources/content/viewers/computedStyle/computedStyle.xul)
content/inspector/viewers/dom/FindDialog.js (resources/content/viewers/dom/FindDialog.js)
content/inspector/viewers/dom/columnsDialog.js (resources/content/viewers/dom/columnsDialog.js)
content/inspector/viewers/dom/columnsDialog.xul (resources/content/viewers/dom/columnsDialog.xul)
content/inspector/viewers/dom/commandOverlay.xul (resources/content/viewers/dom/commandOverlay.xul)
content/inspector/viewers/dom/findDialog.xul (resources/content/viewers/dom/findDialog.xul)
content/inspector/viewers/dom/keysetOverlay.xul (resources/content/viewers/dom/keysetOverlay.xul)
content/inspector/viewers/dom/popupOverlay.xul (resources/content/viewers/dom/popupOverlay.xul)
content/inspector/viewers/dom/dom.xul (resources/content/viewers/dom/dom.xul)
content/inspector/viewers/dom/dom.js (resources/content/viewers/dom/dom.js)
content/inspector/viewers/dom/pseudoClassDialog.js (resources/content/viewers/dom/pseudoClassDialog.js)
content/inspector/viewers/dom/pseudoClassDialog.xul (resources/content/viewers/dom/pseudoClassDialog.xul)
content/inspector/viewers/boxModel/boxModel.js (resources/content/viewers/boxModel/boxModel.js)
content/inspector/viewers/boxModel/boxModel.xul (resources/content/viewers/boxModel/boxModel.xul)
content/inspector/viewers/boxModel/colorPicker.xul (resources/content/viewers/boxModel/colorPicker.xul)
content/inspector/viewers/jsObject/jsObject.js (resources/content/viewers/jsObject/jsObject.js)
content/inspector/viewers/jsObject/jsObject.xul (resources/content/viewers/jsObject/jsObject.xul)
content/inspector/viewers/jsObject/evalExprDialog.js (resources/content/viewers/jsObject/evalExprDialog.js)
content/inspector/viewers/jsObject/evalExprDialog.xul (resources/content/viewers/jsObject/evalExprDialog.xul)
content/inspector/viewers/jsObject/jsObjectView.js (resources/content/viewers/jsObject/jsObjectView.js)
content/inspector/viewers/domNode/domNode.js (resources/content/viewers/domNode/domNode.js)
content/inspector/viewers/domNode/domNode.xul (resources/content/viewers/domNode/domNode.xul)
content/inspector/viewers/styleRules/commandOverlay.xul (resources/content/viewers/styleRules/commandOverlay.xul)
content/inspector/viewers/styleRules/keysetOverlay.xul (resources/content/viewers/styleRules/keysetOverlay.xul)
content/inspector/viewers/styleRules/popupOverlay.xul (resources/content/viewers/styleRules/popupOverlay.xul)
content/inspector/viewers/styleRules/styleRules.js (resources/content/viewers/styleRules/styleRules.js)
content/inspector/viewers/styleRules/styleRules.xul (resources/content/viewers/styleRules/styleRules.xul)
content/inspector/viewers/stylesheets/stylesheets.js (resources/content/viewers/stylesheets/stylesheets.js)
content/inspector/viewers/stylesheets/stylesheets.xul (resources/content/viewers/stylesheets/stylesheets.xul)
content/inspector/viewers/xblBindings/xblBindings.js (resources/content/viewers/xblBindings/xblBindings.js)
content/inspector/viewers/xblBindings/xblBindings.xul (resources/content/viewers/xblBindings/xblBindings.xul)
locale/en-US/inspector/contents.rdf (resources/locale/en-US/contents.rdf)
locale/en-US/inspector/inspector.dtd (resources/locale/en-US/inspector.dtd)
locale/en-US/inspector/prefs.dtd (resources/locale/en-US/prefs.dtd)
locale/en-US/inspector/tasksOverlay.dtd (resources/locale/en-US/tasksOverlay.dtd)
locale/en-US/inspector/search/findFiles.dtd (resources/locale/en-US/search/findFiles.dtd)
locale/en-US/inspector/search/junkImgs.dtd (resources/locale/en-US/search/junkImgs.dtd)
locale/en-US/inspector/viewers/dom.dtd (resources/locale/en-US/viewers/dom.dtd)
locale/en-US/inspector/viewers/domNode.dtd (resources/locale/en-US/viewers/domNode.dtd)
locale/en-US/inspector/viewers/styleRules.dtd (resources/locale/en-US/viewers/styleRules.dtd)
skin/classic/inspector/contents.rdf (resources/skin/classic/contents.rdf)
skin/classic/inspector/btnFind.gif (resources/skin/classic/btnFind.gif)
skin/classic/inspector/btnFind-dis.gif (resources/skin/classic/btnFind-dis.gif)
skin/classic/inspector/btnSelecting.gif (resources/skin/classic/btnSelecting.gif)
skin/classic/inspector/btnSelecting-act.gif (resources/skin/classic/btnSelecting-act.gif)
skin/classic/inspector/btnSelecting-dis.gif (resources/skin/classic/btnSelecting-dis.gif)
skin/classic/inspector/ImageSearchItem.gif (resources/skin/classic/ImageSearchItem.gif)
skin/classic/inspector/iconImportant.gif (resources/skin/classic/iconImportant.gif)
skin/classic/inspector/iconViewerList.gif (resources/skin/classic/iconViewerList.gif)
skin/classic/inspector/iconViewerMenu-dis.gif (resources/skin/classic/iconViewerMenu-dis.gif)
skin/classic/inspector/iconViewerMenu.gif (resources/skin/classic/iconViewerMenu.gif)
skin/classic/inspector/inspector.css (resources/skin/classic/inspector.css)
skin/classic/inspector/inspectorWindow.css (resources/skin/classic/inspectorWindow.css)
skin/classic/inspector/titledSplitter.css (resources/skin/classic/titledSplitter.css)
skin/classic/inspector/titledsplitter-close.gif (resources/skin/classic/titledsplitter-close.gif)
skin/classic/inspector/treeEditable.css (resources/skin/classic/treeEditable.css)
skin/classic/inspector/panelset.css (resources/skin/classic/panelset.css)
skin/classic/inspector/sidebar.css (resources/skin/classic/sidebar.css)
skin/classic/inspector/multipanel.css (resources/skin/classic/multipanel.css)
skin/classic/inspector/iconViewerList-dis.gif (resources/skin/classic/iconViewerList-dis.gif)
skin/classic/inspector/viewers/boxModel/boxModel.css (resources/skin/classic/viewers/boxModel/boxModel.css)
skin/classic/inspector/viewers/dom/columnsDialog.css (resources/skin/classic/viewers/dom/columnsDialog.css)
skin/classic/inspector/viewers/dom/dom.css (resources/skin/classic/viewers/dom/dom.css)
skin/classic/inspector/viewers/dom/findDialog.css (resources/skin/classic/viewers/dom/findDialog.css)
skin/classic/inspector/viewers/domNode/domNode.css (resources/skin/classic/viewers/domNode/domNode.css)
skin/classic/inspector/viewers/styleRules/styleRules.css (resources/skin/classic/viewers/styleRules/styleRules.css)
skin/classic/inspector/viewers/xblBindings/xblBindings.css (resources/skin/classic/viewers/xblBindings/xblBindings.css)
skin/modern/inspector/contents.rdf (resources/skin/modern/contents.rdf)
skin/modern/inspector/btnFind.gif (resources/skin/modern/btnFind.gif)
skin/modern/inspector/btnFind-dis.gif (resources/skin/modern/btnFind-dis.gif)
skin/modern/inspector/btnSelecting.gif (resources/skin/modern/btnSelecting.gif)
skin/modern/inspector/btnSelecting-act.gif (resources/skin/modern/btnSelecting-act.gif)
skin/modern/inspector/btnSelecting-dis.gif (resources/skin/modern/btnSelecting-dis.gif)
skin/modern/inspector/ImageSearchItem.gif (resources/skin/modern/ImageSearchItem.gif)
skin/modern/inspector/iconImportant.gif (resources/skin/modern/iconImportant.gif)
skin/modern/inspector/iconViewerMenu-dis.gif (resources/skin/modern/iconViewerMenu-dis.gif)
skin/modern/inspector/inspector.css (resources/skin/modern/inspector.css)
skin/modern/inspector/inspectorWindow.css (resources/skin/modern/inspectorWindow.css)
skin/modern/inspector/titledSplitter.css (resources/skin/modern/titledSplitter.css)
skin/modern/inspector/titledsplitter-close.gif (resources/skin/modern/titledsplitter-close.gif)
skin/modern/inspector/treeEditable.css (resources/skin/modern/treeEditable.css)
skin/modern/inspector/panelset.css (resources/skin/modern/panelset.css)
skin/modern/inspector/sidebar.css (resources/skin/modern/sidebar.css)
skin/modern/inspector/multipanel.css (resources/skin/modern/multipanel.css)
skin/modern/inspector/iconViewerMenu.gif (resources/skin/modern/iconViewerMenu.gif)
skin/modern/inspector/iconViewerList.gif (resources/skin/modern/iconViewerList.gif)
skin/modern/inspector/iconViewerList-dis.gif (resources/skin/modern/iconViewerList-dis.gif)
skin/modern/inspector/viewers/boxModel/boxModel.css (resources/skin/modern/viewers/boxModel/boxModel.css)
skin/modern/inspector/viewers/dom/columnsDialog.css (resources/skin/modern/viewers/dom/columnsDialog.css)
skin/modern/inspector/viewers/dom/dom.css (resources/skin/modern/viewers/dom/dom.css)
skin/modern/inspector/viewers/dom/findDialog.css (resources/skin/modern/viewers/dom/findDialog.css)
skin/modern/inspector/viewers/domNode/domNode.css (resources/skin/modern/viewers/domNode/domNode.css)
skin/modern/inspector/viewers/styleRules/styleRules.css (resources/skin/modern/viewers/styleRules/styleRules.css)
skin/modern/inspector/viewers/xblBindings/xblBindings.css (resources/skin/modern/viewers/xblBindings/xblBindings.css)

View File

@ -14,16 +14,27 @@
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Joe Hewitt <hewitt@netscape.com> (original author)
DEPTH=..\..
include <$(DEPTH)/config/config.mak>
include <$(DEPTH)\config\config.mak>
DIRS=base build resources
DIRS=base build
include <$(DEPTH)\config\rules.mak>
install::
$(MAKE_INSTALL) resources\content\res\viewer-registry.rdf $(DIST)\bin\res\inspector
$(MAKE_INSTALL) resources\content\res\search-registry.rdf $(DIST)\bin\res\inspector
$(MAKE_INSTALL) resources\content\res\winInspectorMain.ico $(DIST)\bin\chrome\icons\default
$(MAKE_INSTALL) resources\content\prefs\inspector.js $(DIST)\bin\defaults\pref
chrome::
$(REGCHROME) content inspector inspector.jar
$(REGCHROME) locale en-US/inspector inspector.jar
$(REGCHROME) skin modern/inspector inspector.jar
$(REGCHROME) skin classic/inspector inspector.jar

View File

@ -1,3 +1,25 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
/***************************************************************
* Flasher ---------------------------------------------------
* Object for controlling a timed flashing animation which
@ -15,9 +37,9 @@ var gFlasherRegistry = [];
////////////////////////////////////////////////////////////////////////////
//// class Flasher
function Flasher(aShell, aColor, aThickness, aDuration, aSpeed)
function Flasher(aColor, aThickness, aDuration, aSpeed)
{
this.mShell = aShell;
this.mShell = XPCU.createInstance("@mozilla.org/inspector/flasher;1", "inIFlasher");;
this.color = aColor;
this.mThickness = aThickness;
this.duration = aDuration;
@ -33,7 +55,6 @@ Flasher.prototype =
mFlashTimeout: null,
mElement:null,
mWindow:null,
mRegistryId: null,
mFlashes: 0,
mStartTime: 0,
@ -45,20 +66,17 @@ Flasher.prototype =
////////////////////////////////////////////////////////////////////////////
//// Properties
get flashing() { return this.mFlashTimeout; },
get flashing() { return this.mFlashTimeout != null; },
get element() { return this.mElement; },
set element(val)
{
if (val && val.nodeType == 1)
if (val && val.nodeType == 1) {
this.mElement = val;
else
} else
throw "Invalid node type.";
},
get window() { return this.mWindow; },
set window(aVal) { this.mWindow = aVal; },
get color() { return this.mColor; },
set color(aVal) { if (aVal.charAt(0) == '#') aVal = aVal.substr(1); this.mColor = aVal; },
@ -82,8 +100,11 @@ Flasher.prototype =
this.mRegistryId = length;
},
start: function()
start: function(aDuration, aSpeed, aHold)
{
this.mUDuration = aDuration ? aDuration*1000 : this.mDuration;
this.mUSpeed = aSpeed ? aSpeed : this.mSpeed
this.mHold = aHold;
this.mFlashes = 0;
this.mStartTime = new Date();
this.doFlash();
@ -91,15 +112,15 @@ Flasher.prototype =
doFlash: function()
{
if (this.mFlashes%2) {
if (this.mHold || this.mFlashes%2) {
this.paintOn();
} else {
this.paintOff();
}
this.mFlashes++;
if (new Date() - this.mStartTime < this.mDuration) {
this.mFlashTimeout = window.setTimeout("gFlasherRegistry["+this.mRegistryId+"].doFlash()", this.mSpeed);
if (this.mUDuration < 0 || new Date() - this.mStartTime < this.mUDuration) {
this.mFlashTimeout = window.setTimeout("gFlasherRegistry["+this.mRegistryId+"].doFlash()", this.mUSpeed);
} else {
this.stop();
}
@ -107,20 +128,21 @@ Flasher.prototype =
stop: function()
{
window.clearTimeout(this.mFlashTimeout);
this.mFlashTimeout = null;
this.paintOff();
if (this.flashing) {
window.clearTimeout(this.mFlashTimeout);
this.mFlashTimeout = null;
this.paintOff();
}
},
paintOn: function()
{
this.mShell.drawElementOutline(this.mElement, this.mWindow, this.mColor, this.mThickness);
this.mShell.drawElementOutline(this.mElement, this.mColor, this.mThickness);
},
paintOff: function()
{
this.mShell.repaintElement(this.mElement, this.mWindow);
this.mShell.repaintElement(this.mElement);
}
};

View File

@ -1,37 +0,0 @@
#
# The contents of this file are subject to the Netscape 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/NPL/
#
# 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 Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH=../../../..
topsrcdir=@top_srcdir@
srcdir=@srcdir@
VPATH=@srcdir@
include $(DEPTH)/config/autoconf.mk
install::
$(INSTALL) $(srcdir)/inspector-history.rdf $(DIST)/bin/chrome/inspector
$(INSTALL) $(srcdir)/inspector-prefs.rdf $(DIST)/bin/chrome/inspector
$(INSTALL) $(srcdir)/viewer-registry.rdf $(DIST)/bin/chrome/inspector
$(INSTALL) $(srcdir)/search-registry.rdf $(DIST)/bin/chrome/inspector
$(INSTALL) $(srcdir)/prefs/inspector.js $(DIST)/bin/defaults/pref
include $(topsrcdir)/config/rules.mk

View File

@ -1,266 +0,0 @@
/***************************************************************
* ViewerPane ---------------------------------------------------
* Interface for a pane accepts a node and displays all eligible
* viewers in a list and activates the selected viewer.
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* REQUIRED IMPORTS:
* chrome://inspector/content/jsutil/xpcom/XPCU.js
****************************************************************/
//////////// global variables /////////////////////
//////////// global constants ////////////////////
////////////////////////////////////////////////////////////////////////////
//// class ViewerPane
function ViewerPane() // implements inIViewerPane
{
}
ViewerPane.prototype =
{
////////////////////////////////////////////////////////////////////////////
//// Initialization
mContextMenu: null,
mCurrentEntry: null,
mCurrentViewer: null,
////////////////////////////////////////////////////////////////////////////
//// interface inIViewerPane
//// attributes
get viewee() { return this.mViewee; },
set viewee(aVal) { this.startViewingObject(aVal) },
get container() { return this.mContainer; },
get viewer() { return this.mCurrentViewer; },
get title() { return this.mTitle; },
get uiElement() { return this.mUIElement; },
get viewerReg() { return this.mViewerReg; },
//// methods
initialize: function (aTitle, aContainer, aUIElement, aRegistry)
{
this.mTitle = aTitle;
this.mUIElement = aUIElement;
this.mContainer = aContainer;
this.mViewerReg = aRegistry;
this.mListEl = aUIElement.getElementsByAttribute("ins-role", "viewer-list")[0];
this.mTitleEl = aUIElement.getElementsByAttribute("ins-role", "viewer-title")[0];
this.mMenuEl = aUIElement.getElementsByAttribute("ins-role", "viewer-menu")[0];
this.mIFrameEl = aUIElement.getElementsByAttribute("ins-role", "viewer-iframe")[0];
this.fillViewerList();
},
onViewerConstructed: function(aViewer)
{
var old = this.mCurrentViewer;
this.mCurrentViewer = aViewer;
var oldEntry = this.mCurrentEntry;
this.mCurrentEntry = this.mPendingEntry;
this.rebuildViewerContextMenu();
var title = this.mViewerReg.getEntryProperty(this.mCurrentEntry, "description");
this.setTitle(title);
this.mContainer.onViewerChanged(this, old, oldEntry, this.mCurrentViewer, this.mCurrentEntry);
aViewer.viewee = this.mViewee;
},
onVieweeChanged: function(aObject)
{
this.mContainer.onVieweeChanged(this, aObject);
},
setCommandAttribute: function(aCmdId, aAttribute, aValue)
{
this.mContainer.setCommandAttribute(aCmdId, aAttribute, aValue);
},
getCommandAttribute: function(aCmdId, aAttribute)
{
return this.mContainer.getCommandAttribute(aCmdId, aAttribute);
},
////////////////////////////////////////////////////////////////////////////
//// UI Commands
///////////////////////////////////////////////////////////////////////////
// Sets the new view to the item just selected from the "viewer list"
///////////////////////////////////////////////////////////////////////////
onViewerListCommand: function(aItem)
{
this.switchViewer(aItem.entry);
},
///////////////////////////////////////////////////////////////////////////
// Prepares the list of viewers for a node, rebuilds the menulist to display
// them, and load the default viewer for the node.
//
// @param Object aObject - the object to begin viewing
///////////////////////////////////////////////////////////////////////////
startViewingObject: function(aObject)
{
this.mViewee = aObject;
// get the list of viewers which match the node
var entries = this.mViewerReg.findViewersForObject(aObject);
this.rebuildViewerList(entries);
if (entries.length > 0 && !this.entryInList(this.mCurrentEntry, entries)) {
this.switchViewer(entries[0]);
} else {
this.mCurrentViewer.viewee = aObject;
}
},
///////////////////////////////////////////////////////////////////////////
// Clear out and rebuild the menulist full of the available views
// for the currently selected node.
//
// @param Array aEntries - an array of entries from the viewer registry
///////////////////////////////////////////////////////////////////////////
rebuildViewerList: function(aEntries)
{
var mpp = this.mListElPopup;
this.mListEl.setAttribute("disabled", aEntries.length <= 0);
// empty the list
while (mpp.childNodes.length)
mpp.removeChild(mpp.childNodes[0]);
for (var i = 0; i < aEntries.length; i++) {
var entry = aEntries[i];
var menuitem = document.createElement("menuitem");
menuitem.setAttribute("label", this.mViewerReg.getEntryProperty(entry, "description"));
menuitem.entry = entry;
mpp.appendChild(menuitem);
}
},
///////////////////////////////////////////////////////////////////////////
// Loads the viewer described by an entry in the viewer registry.
//
// @param nsIRDFNode aEntry - entry in the viewer registry
///////////////////////////////////////////////////////////////////////////
switchViewer: function(aEntry)
{
var url = this.mViewerReg.getEntryURL(aEntry);
var loadNew = true;
if (this.mCurrentViewer) {
var oldURL = this.mViewerReg.getEntryURL(this.mCurrentEntry);
if (oldURL == url) {
loadNew = false;
}
}
if (loadNew) {
this.mPendingEntry = aEntry;
this.loadViewerURL(url);
}
},
///////////////////////////////////////////////////////////////////////////
// Begin loading a new viewer from a given url.
//
// @param String aURL - the url of the viewer document
///////////////////////////////////////////////////////////////////////////
loadViewerURL: function(aURL)
{
if (this.mCurrentViewer) {
// tell the old viewer it's about to go away
this.mCurrentViewer.destroy();
}
// load the new document
FrameExchange.loadURL(this.mIFrameEl, aURL, this);
},
///////////////////////////////////////////////////////////////////////////
// Rebuild the viewer context menu
///////////////////////////////////////////////////////////////////////////
rebuildViewerContextMenu: function()
{
// remove old context menu
if (this.mContextMenu) {
this.mMenuEl.removeChild(this.mContextMenu);
this.mFormerContextParent.appendChild(this.mContextMenu);
}
var uid = this.mViewerReg.getEntryProperty(this.mCurrentEntry, "uid");
var ppId = "ppViewerContext-" + uid;
var pp = document.getElementById(ppId);
if (pp) {
this.mMenuEl.setAttribute("disabled", "false");
var parent = pp.parentNode;
parent.removeChild(pp);
this.mMenuEl.appendChild(pp);
this.mFormerContextParent = parent;
this.mContextMenu = pp;
} else {
this.mMenuEl.setAttribute("disabled", "true");
}
},
///////////////////////////////////////////////////////////////////////////
// Check to see if an entry exists in an arry of entries
//
// @param nsIRDFResource aEntry - the entry being searched for
// @param Array aList - array of entries
///////////////////////////////////////////////////////////////////////////
entryInList: function(aEntry, aList)
{
for (var i in aList) {
if (aList[i] == aEntry) return true;
}
return false;
},
///////////////////////////////////////////////////////////////////////////
// Set the text in the viewer title bar
//
// @param String title - the text to use
///////////////////////////////////////////////////////////////////////////
setTitle: function(aTitle)
{
this.mTitleEl.setAttribute("value", (this.mTitle ? this.mTitle + " - " : "") + aTitle);
},
///////////////////////////////////////////////////////////////////////////
// Fill out the content of the "viewer list" menu
///////////////////////////////////////////////////////////////////////////
fillViewerList: function()
{
this.mListEl.pViewer = this;
this.mListEl.setAttribute("oncommand", "this.pViewer.onViewerListCommand(event.target)");
var mpp = document.createElement("menupopup");
this.mListEl.appendChild(mpp);
this.mListElPopup = mpp;
}
};

View File

@ -1,6 +1,28 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
/***************************************************************
* ViewerRegistry -----------------------------------------------
* The centry registry where information about all installed
* The central registry where information about all installed
* viewers is kept.
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* REQUIRED IMPORTS:
@ -12,7 +34,8 @@
//////////// global constants ////////////////////
var kViewerURLPrefix = "chrome://inspector/content/viewers/";
const kViewerURLPrefix = "chrome://inspector/content/viewers/";
const kViewerRegURL = "resource:///res/inspector/viewer-registry.rdf";
////////////////////////////////////////////////////////////////////////////
//// class ViewerRegistry
@ -49,7 +72,7 @@ ViewerRegistry.prototype =
RDFU.loadDataSource(aURL, new ViewerRegistryLoadObserver(this));
},
onError: function(aErrorMsg)
onError: function(aStatus, aErrorMsg)
{
this.mObserver.onViewerRegistryLoadError(aStatus, aErrorMsg);
},
@ -71,7 +94,7 @@ ViewerRegistry.prototype =
for (var i = 0; i < this.mViewerDS.length; ++i) {
js = this.getEntryProperty(i, "filter");
try {
fn = new Function("object", js);
fn = new Function("doesQI", "object", js);
} catch (ex) {
fn = new Function("return false");
debug("### ERROR - Syntax error in filter for viewer \"" + this.getEntryProperty(i, "description") + "\"\n");
@ -129,7 +152,20 @@ ViewerRegistry.prototype =
///////////////////////////////////////////////////////////////////////////
objectMatchesEntry: function(aObject, aIndex)
{
return this.mFilters[aIndex](aObject);
if (!aObject) return false;
return this.mFilters[aIndex](this.doesQI, aObject);
},
doesQI: function(aObject, aInterface)
{
if (!("QueryInterface" in aObject)) return false;
try {
var result = aObject.QueryInterface(Components.interfaces[aInterface]);
return true;
} catch (ex) {
return false;
}
},
///////////////////////////////////////////////////////////////////////////
@ -144,6 +180,11 @@ ViewerRegistry.prototype =
this.mViewerHash[uid] = { viewer: aViewer, entry: aIndex };
},
uncacheViewer: function(aViewer)
{
delete this.mViewerHash[aViewer.uid].viewer;
},
// for previously loaded viewers only
getViewerByUID: function(aUID)
{
@ -200,9 +241,9 @@ function ViewerRegistryLoadObserver(aTarget)
ViewerRegistryLoadObserver.prototype = {
mTarget: null,
onError: function(aErrorMsg)
onError: function(aStatus, aErrorMsg)
{
this.mTarget.onError(aErrorMsg);
this.mTarget.onError(aStatus, aErrorMsg);
},
onDataSourceReady: function(aDS)

View File

@ -0,0 +1,60 @@
<?xml version="1.0"?>
<!DOCTYPE window SYSTEM "chrome://inspector/locale/tasksOverlay.dtd" >
<overlay id="ovBrowser"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://inspector/content/hooks.js"/>
<script type="application/x-javascript"><![CDATA[
window.addEventListener("load", inspectorNavOnLoad, true);
function inspectorNavOnLoad()
{
var enabled = pref.GetBoolPref("inspector.hooks.navigator");
if (!enabled) {
document.getElementById("context-inspect").setAttribute("hidden", "true");
document.getElementById("menu_inspectPage").setAttribute("hidden", "true");
} else {
var popup = document.getElementById("contentAreaContextMenu");
popup.addEventListener("create", inspectorContextCreate, false);
}
}
function inspectorContextCreate()
{
var mi = document.getElementById("context-inspect");
mi.setAttribute("label", "Inspect <"+inspectorGetContextNode().localName+">");
}
function inspectPopupNode()
{
inspectDOMNode(inspectorGetContextNode());
}
function inspectorGetContextNode()
{
var n = document.popupNode;
while (n && n.nodeType != 1)
n = n.parentNode;
return n;
}
]]></script>
<popup id="contentAreaContextMenu">
<menuitem id="context-inspect"
insertbefore="context-sep-view"
oncommand="inspectPopupNode();"/>
</popup>
<menupopup id="menu_FilePopup">
<menuitem id="menu_inspectPage" label="&inspectPageTaskCmd.label;" command="Tasks:InspectPage"
accesskey="&inspectPageTaskCmd.accesskey;" key="key_inspectPage"
insertbefore="menu_sendPage"/>
</menupopup>
</overlay>

View File

@ -8,7 +8,7 @@
<overlay id="ovCommandsMain"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<broadcasterset id="brsGlobalCommands" datasources="rdf:null" ref="commands:global">
<commandset id="cmdsGlobalCommands" datasources="rdf:null" ref="commands:global">
<template>
<rule>
<conditions>
@ -22,42 +22,41 @@
</bindings>
<action>
<broadcaster uri="?cmd" onkeypress="?onkeypress" oncommand="?oncommand" disabled="true"/>
<command uri="?cmd" onkeypress="?onkeypress" oncommand="?oncommand" disabled="true"/>
</action>
</rule>
</template>
<broadcaster
<command
id="cmdGotoURL"
onkeypress="if(event.keyCode == 13) inspector.gotoTypedURL();"
ontextcommand="inspector.gotoTypedURL();"
oncommand="inspector.gotoTypedURL()"/>
<broadcaster id="cmdShowOpenURLDialog" oncommand="inspector.showOpenURLDialog()"/>
<broadcaster id="cmdExit" oncommand="inspector.exit();"/>
<command id="cmdShowOpenURLDialog" oncommand="inspector.showOpenURLDialog()"/>
<command id="cmdClose" oncommand="inspector.exit();"/>
<broadcaster id="cmdUndo" disabled="true" oncommand=""/>
<broadcaster id="cmdRedo" disabled="true" oncommand=""/>
<broadcaster id="cmdCut" disabled="true" oncommand=""/>
<broadcaster id="cmdCopy" disabled="true" oncommand=""/>
<broadcaster id="cmdPaste" disabled="true" oncommand=""/>
<broadcaster id="cmdDelete" disabled="true" oncommand=""/>
<broadcaster id="cmdShowPrefsDialog" oncommand="inspector.showPrefsDialog()"/>
<command id="cmdUndo" disabled="true" oncommand=""/>
<command id="cmdRedo" disabled="true" oncommand=""/>
<command id="cmdCut" disabled="true" oncommand=""/>
<command id="cmdCopy" disabled="true" oncommand=""/>
<command id="cmdPaste" disabled="true" oncommand=""/>
<command id="cmdDelete" disabled="true" oncommand=""/>
<command id="cmdShowPrefsDialog" oncommand="inspector.showPrefsDialog()"/>
<broadcaster id="cmdRunSearch" oncommand="inspector.runSearch()"/>
<command id="cmdRunSearch" oncommand="inspector.runSearch()"/>
<broadcaster id="cmdToggleBrowser" oncommand="inspector.toggleBrowser()"/>
<broadcaster id="cmdToggleSearch" oncommand="inspector.toggleSearch()"/>
<broadcaster id="cmdFlashSelected" oncommand="inspector.toggleFlashSelected()"/>
<command id="cmdToggleBrowser" oncommand="inspector.toggleBrowser()"/>
<command id="cmdToggleSearch" oncommand="inspector.toggleSearch()"/>
<broadcaster id="cmdShowNotes" oncommand="inspector.showNotes()"/>
<broadcaster id="cmdShowAbout" oncommand="inspector.showAbout()"/>
<command id="cmdShowNotes" oncommand="inspector.showNotes()"/>
<command id="cmdShowAbout" oncommand="inspector.showAbout()"/>
<broadcaster id="cmdViewSearchItem" oncommand="inspector.viewSearchItem()"/>
<broadcaster id="cmdEditSearchItem" oncommand="inspector.editSearchItem()"/>
<broadcaster id="cmdCopySearchItemLine" oncommand="inspector.copySearchItemLine()"/>
<broadcaster id="cmdCopySearchItemAll" oncommand="inspector.copySearchItemAll()"/>
<broadcaster id="cmdSaveSearchItemText" oncommand="inspector.saveSearchItemText()"/>
<broadcaster id="cmdClearSearch" oncommand="inspector.clearSearchResults()"/>
</broadcasterset>
<command id="cmdViewSearchItem" oncommand="inspector.viewSearchItem()"/>
<command id="cmdEditSearchItem" oncommand="inspector.editSearchItem()"/>
<command id="cmdCopySearchItemLine" oncommand="inspector.copySearchItemLine()"/>
<command id="cmdCopySearchItemAll" oncommand="inspector.copySearchItemAll()"/>
<command id="cmdSaveSearchItemText" oncommand="inspector.saveSearchItemText()"/>
<command id="cmdClearSearch" oncommand="inspector.clearSearchResults()"/>
</commandset>
</overlay>

View File

@ -17,10 +17,12 @@
<!-- overlay information -->
<RDF:Seq about="urn:mozilla:overlays">
<RDF:li resource="chrome://communicator/content/tasksOverlay.xul"/>
<RDF:li resource="chrome://communicator/content/pref/preftree.xul"/>
<RDF:li resource="chrome://navigator/content/navigator.xul"/>
<RDF:li resource="chrome://venkman/content/venkman.xul"/>
<RDF:li resource="chrome://inspector/content/commandOverlay.xul"/>
<RDF:li resource="chrome://inspector/content/keysetOverlay.xul"/>
<RDF:li resource="chrome://inspector/content/popupOverlay.xul"/>
<RDF:li resource="chrome://communicator/content/pref/preftree.xul"/>
</RDF:Seq>
<!-- Communicator Overlays -->
@ -33,10 +35,23 @@
<RDF:li>chrome://inspector/content/prefs/prefsOverlay.xul</RDF:li>
</RDF:Seq>
<!-- Browser Overlays -->
<RDF:Seq about="chrome://navigator/content/navigator.xul">
<RDF:li>chrome://inspector/content/browserOverlay.xul</RDF:li>
</RDF:Seq>
<!-- Venkman Overlays -->
<RDF:Seq about="chrome://venkman/content/venkman.xul">
<RDF:li>chrome://inspector/content/venkmanOverlay.xul</RDF:li>
</RDF:Seq>
<!-- Inspector Overlays -->
<RDF:Seq about="chrome://inspector/content/commandOverlay.xul">
<RDF:li>chrome://inspector/content/viewers/dom/commandOverlay.xul</RDF:li>
<RDF:li>chrome://inspector/content/viewers/styleRules/commandOverlay.xul</RDF:li>
<RDF:li>chrome://inspector/content/search/modules/commandOverlay.xul</RDF:li>
</RDF:Seq>
@ -46,6 +61,7 @@
<RDF:Seq about="chrome://inspector/content/popupOverlay.xul">
<RDF:li>chrome://inspector/content/viewers/dom/popupOverlay.xul</RDF:li>
<RDF:li>chrome://inspector/content/viewers/styleRules/popupOverlay.xul</RDF:li>
<RDF:li>chrome://inspector/content/search/modules/popupOverlay.xul</RDF:li>
</RDF:Seq>

View File

@ -0,0 +1,35 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
multipanelset {
-moz-binding: url("chrome://inspector/content/extensions/multipanel.xml#multipanelset");
display: -moz-xul-box;
-moz-xul-box-orient: vertical;
}
multipanel {
-moz-binding: url("chrome://inspector/content/extensions/multipanel.xml#multipanel");
display: -moz-xul-box;
-moz-xul-box-orient: vertical;
}

View File

@ -0,0 +1,70 @@
<?xml version="1.0"?>
<bindings id="bdsMultipanel"
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="multipanelset">
<content>
<xul:vbox class="multipanelset-ibox" flex="1">
<children/>
</xul:vbox>
</content>
<implementation>
</implementation>
<resources>
<stylesheet src="chrome://inspector/skin/multipanel.css"/>
</resources>
</binding>
<binding id="multipanel">
<content>
<xul:box class="multipanel-label-box" onclick="this.parentNode.toggleOpen()">
<xul:box class="multipanel-label-box-2" flex="1">
<xul:text class="multipanel-title" inherits="value=label"/>
</xul:box>
</xul:box>
<xul:box anonid="content-box" class="multipanel-content-box" flex="1">
<children/>
</xul:box>
</content>
<implementation>
<constructor><![CDATA[
this.mContentBox = document.getAnonymousElementByAttribute(this, "anonid", "content-box");
this.mOnOpen = this.hasAttribute("onopen") ? new Function(this.getAttribute("onopen")) : null;
this.open = this.getAttribute("open") == "true";
]]></constructor>
<property name="open" onget="return this.getAttribute('open') == 'true';">
<setter><![CDATA[
this.setAttribute("open", val);
if (val) {
this.mContentBox.removeAttribute("hidden");
this.setAttribute("flex", "1");
} else {
this.mContentBox.setAttribute("hidden", "true");
this.removeAttribute("flex");
}
if (val && this.mOnOpen)
this.mOnOpen();
]]></setter>
</property>
<method name="toggleOpen">
<body><![CDATA[
this.open = !this.open;
]]></body>
</method>
</implementation>
<resources>
<stylesheet src="chrome://inspector/skin/multipanel.css"/>
</resources>
</binding>
</bindings>

View File

@ -1,3 +1,24 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
@import url("chrome://inspector/skin/titledSplitter.css");

View File

@ -6,16 +6,19 @@
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="titledSplitter" extends="xul:splitter">
<binding id="titledSplitter" extends="chrome://global/content/bindings/splitter.xml#splitter">
<content>
<xul:box class="titledsplitter-container" orient="vertical" flex="1">
<xul:spring class="titledsplitter-dragbar"/>
<xul:box class="titledsplitter-titlebox" flex="1" onmousedown="event.stopPropagation()">
<xul:box autostretch="never">
<xul:text class="titledsplitter-text" inherits="value"/>
<xul:text class="titledsplitter-text" inherits="value=label"/>
</xul:box>
<xul:spring flex="1"/>
<xul:box class="titledsplitter-closebutton" onclick="this.parentNode.parentNode.parentNode.close();"/>
<xul:button class="titledsplitter-closebutton" autostretch="never"
onclick="this.parentNode.parentNode.parentNode.close();">
<xul:image class="titledsplitter-closeimage"/>
</xul:button>
</xul:box>
</xul:box>
</content>

View File

@ -1,3 +1,24 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
@import url("chrome://inspector/skin/treeEditable.css");
@ -9,3 +30,6 @@
-moz-binding: url("treeEditable.xml#treecellEditable");
}
treeitem[editing="true"] > treerow {
background-color: transparent !important;
}

View File

@ -6,7 +6,7 @@
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="treeEditable" extends="chrome://global/content/treeBindings.xml#tree">
<binding id="treeEditable" extends="chrome://global/content/bindings/tree.xml#tree">
<content>
<children/>
<xul:treerows class="tree-container-treerows" inherits="dragover,dragdroptree">
@ -53,6 +53,7 @@
while (item && item.localName.toLowerCase() != "treeitem")
item = item.parentNode;
item.setAttribute("editing", "true");
var editor = this.getEditorElement(aTreecell);
editor.setAttribute("value", aTreecell.getAttribute("label"));
aTreecell.parentNode.replaceChild(editor, aTreecell);
@ -75,6 +76,7 @@
var cell = this.mEditingCell;
var ed = this.mEditingEditor;
var ev = ed.value;
this.mEditingItem.removeAttribute("editing");
var cancel = this.onAfterEdit({ newValue: ev, editingNode: cell, editingItem: this.mEditingItem });
if (!aCancel && !cancel) cell.setAttribute("label", ev);
ed.parentNode.replaceChild(cell, ed);
@ -101,12 +103,26 @@
<handlers>
<handler event="mousedown"><![CDATA[
if (this.mEditing && event.target != this.mEditingEditor)
if (this.mEditing && event.target != this.mEditingEditor
&& event.target != this.mEditingCell)
{
this.stopEdit();
}
]]></handler>
<handler event="keypress"><![CDATA[
// using ifs here because the "keycode" attribute isn't working on handler
if (!this.mEditing && event.keyCode == 113) {
var sel = this.selectedItems ? this.selectedItems[0] : null;
if (sel) {
var cells = sel.getElementsByTagName("treecell");
for (var i = 0; i < cells.length; ++i) {
if (cells[i].getAttribute("editable") == "true") {
this.startEdit(cells[i]);
break;
}
}
}
}
if (this.mEditing && event.keyCode == 13)
this.stopEdit();
if (this.mEditing && event.keyCode == 27)
@ -122,7 +138,7 @@
<!-- ==================================================================================== -->
<!-- ==================================================================================== -->
<binding id="treecellEditable" extends="chrome://global/content/treeBindings.xml#treecell">
<binding id="treecellEditable" extends="chrome://global/content/bindings/tree.xml#treecell">
<implementation>
<property name="parentItem" readonly="true"><![CDATA[
var parent = this.parentNode;

View File

@ -1,3 +1,25 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
/***************************************************************
* wsm-colorpicker ----------------------------------------------
* Quick script which adds support for the color picker widget

View File

@ -0,0 +1,39 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
function inspectDOMDocument(aDocument, aModal)
{
window.openDialog("chrome://inspector/content/", "_blank",
"chrome,all,dialog=no"+(aModal?",modal":""), aDocument);
}
function inspectDOMNode(aNode, aModal)
{
window.openDialog("chrome://inspector/content/", "_blank",
"chrome,all,dialog=no"+(aModal?",modal":""), aNode);
}
function inspectObject(aObject, aModal)
{
window.openDialog("chrome://inspector/content/object.xul", "_blank",
"chrome,all,dialog=no"+(aModal?",modal":""), aObject);
}

View File

@ -1,14 +0,0 @@
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ins="http://www.mozilla.org/inspector#">
<rdf:Seq about="inspector:history">
<rdf:li><rdf:Description
ins:Name="Foopy Doc"
ins:URL="http://www.mozilla.org"/></rdf:li>
</rdf:Seq>
</rdf:RDF>

View File

@ -1,12 +0,0 @@
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ins="http://www.mozilla.org/inspector#">
<rdf:Description about="inspector:prefs">
<ins:general><rdf:Description
ins:stuff="blah"
/></ins:general>
</rdf:Description>
</rdf:RDF>

View File

@ -1,10 +1,58 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
@namespace ins url("http://www.mozilla.org/inspector#");
@import url("chrome://inspector/content/extensions/titledSplitter.css");
@import url("chrome://inspector/content/extensions/multipanel.css");
@namespace domi url("http://www.mozilla.org/inspector");
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
*[hide="true"] {
visibility: hidden;
}
row {
vertical-align: middle;
}
domi|panelset {
-moz-binding: url("chrome://inspector/content/inspector.xml#panelset");
display: -moz-xul-box;
}
domi|panel {
-moz-binding: url("chrome://inspector/content/inspector.xml#panel");
display: -moz-xul-box;
}
#ppsViewerPopupset {
display: none;
}
.outliner-list > outlinercol,
.outliner-list > .outliner-columns > outlinercol {
-moz-binding: none;
background-color: transparent !important;
margin: 0px !important;
border: none !important;
padding: 0px !important;
}
.outliner-nocolpicker > .outliner-columns > .outliner-columnpicker {
visibility: collapse;
}

View File

@ -1,65 +1,73 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (original author)
*/
/***************************************************************
* InspectorApp -------------------------------------------------
* The primary object that controls the Inspector application.
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* REQUIRED IMPORTS:
* chrome://inspector/content/ViewerRegistry.js
* chrome://inspector/content/Flasher.js
* chrome://inspector/content/search/inSearchService.js
* chrome://inspector/content/search/inSearchModule.js
* chrome://inspector/content/jsutil/xpcom/XPCU.js
* chrome://inspector/content/jsutil/rdf/RDFArray.js
* chrome://inspector/content/jsutil/rdf/RDFU.js
* chrome://inspector/content/jsutil/xul/FrameExchange.js
* chrome://inspector/content/jsutil/system/file.js
* chrome://inspector/content/search/inSearchService.js
* chrome://inspector/content/search/inSearchModule.js
****************************************************************/
//////////// global variables /////////////////////
var inspector;
var kHistoryURL = "chrome/inspector/inspector-history.rdf";
var kViewerRegURL = "chrome/inspector/viewer-registry.rdf";
var kSearchRegURL = "chrome/inspector/search-registry.rdf";
//////////// global constants ////////////////////
const kInstallDirId = "CurProcD";
const kSearchRegURL = "resource:///res/inspector/search-registry.rdf";
const kFlasherCID = "@mozilla.org/inspector/flasher;1"
const kWindowMediatorIID = "@mozilla.org/rdf/datasource;1?name=window-mediator";
const kObserverServiceIID = "@mozilla.org/observer-service;1";
const kDirServiceCID = "@mozilla.org/file/directory_service;1"
const kClipboardHelperCID = "@mozilla.org/widget/clipboardhelper;1";
const kGlobalClipboard = Components.interfaces.nsIClipboard.kGlobalClipboard
const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
//////////////////////////////////////////////////
window.addEventListener("load", InspectorApp_initialize, false);
window.addEventListener("unload", InspectorApp_destroy, false);
function InspectorApp_initialize()
{
inspector = new InspectorApp();
inspector.initialize();
inspector.initialize(window.arguments && window.arguments.length > 0 ? window.arguments[0] : null);
}
function InspectorApp_destroy()
{
inspector.destroy();
}
////////////////////////////////////////////////////////////////////////////
//// class InspectorApp
function InspectorApp() // implements inIViewerPaneContainer
function InspectorApp()
{
// XXX HACK nsIFile.URL not implemented on unix and mac
this.mInstallURL = "file://"+this.getSpecialDirectory(kInstallDirId).path+'/';
//this.mInstallURL = this.getSpecialDirectory(kInstallDirId).URL;
kHistoryURL = this.prependBaseURL(kHistoryURL);
kViewerRegURL = this.prependBaseURL(kViewerRegURL);
kSearchRegURL = this.prependBaseURL(kSearchRegURL);
this.mUFlasher = XPCU.createInstance(kFlasherCID, "inIFlasher");
}
InspectorApp.prototype =
@ -67,30 +75,17 @@ InspectorApp.prototype =
////////////////////////////////////////////////////////////////////////////
//// Initialization
mShell: null,
mHistory: null,
mViewerReg: null,
mSearchService: null,
mPaneCount: 2,
mCurrentViewer: null,
mCurrentWindow: null,
mShowBrowser: false,
mInstallURL: null,
mFlashSelected: null,
mFlashes: 0,
mInitialized: false,
mFlasher: null,
mIsViewingContent: false,
mClipboardHelper: null,
get document() { return this.mDocViewerPane.viewer.viewee },
get document() { return this.mDocPanel.viewer.subject },
get searchRegistry() { return this.mSearchService },
initialize: function()
initialize: function(aTarget)
{
this.initPrefs();
this.loadViewerRegistry();
this.loadHistory();
this.mInitTarget = aTarget;
this.initSearch();
var el = document.getElementById("bxBrowser");
@ -98,105 +93,57 @@ InspectorApp.prototype =
this.toggleBrowser(true, false);
this.toggleSearch(true, false);
this.setFlashSelected(PrefUtils.getPref("inspector.blink.on"));
this.mClipboardHelper = XPCU.getService(kClipboardHelperCID, "nsIClipboardHelper");
this.mPanelSet = document.getElementById("bxPanelSet");
this.mPanelSet.addObserver("panelsetready", this);
this.mPanelSet.initialize();
},
initViewerPanes: function()
destroy: function()
{
var elPane = document.getElementById("bxDocPane");
this.mDocViewerPane = new ViewerPane();
this.mDocViewerPane.initialize("Document", this, elPane, this.mViewerReg);
elPane = document.getElementById("bxObjectPane");
this.mObjViewerPane = new ViewerPane();
this.mObjViewerPane.initialize("Object", this, elPane, this.mViewerReg);
this.setAllViewerCmdAttributes("disabled", "true");
},
////////////////////////////////////////////////////////////////////////////
//// interface inIViewerPaneContainer
get viewerPaneCount() { return this.mPaneCount; },
onViewerChanged: function(aPane, aOldViewer, aOldEntry, aNewViewer, aNewEntry)
{
var ids, el, i;
if (!this.mInitialized) {
this.mIsViewingContent = true;
var bx = document.getElementById("bxInspectorPanes");
bx.setAttribute("hide", "false");
} else {
this.mInitialized = true;
}
this.mViewerReg.cacheViewer(aNewViewer, aNewEntry);
// disable all commands for for the old viewer
if (aOldViewer)
this.setViewerCmdAttribute(aOldEntry, "disabled", "true");
// enable all commands for for the new viewer
if (aNewViewer)
this.setViewerCmdAttribute(aNewEntry, "disabled", "false");
InsUtil.persistAll("bxDocPanel");
InsUtil.persistAll("bxObjectPanel");
},
onVieweeChanged: function(aPane, aNewObject)
////////////////////////////////////////////////////////////////// //////////
//// Viewer Panels
initViewerPanels: function()
{
if (aPane == this.mDocViewerPane) {
this.mObjViewerPane.viewee = aNewObject;
if (this.mFlashSelected)
this.flashElement(aNewObject, this.mCurrentWindow);
this.mDocPanel = this.mPanelSet.getPanel(0);
this.mDocPanel.addObserver("subjectChange", this);
this.mObjectPanel = this.mPanelSet.getPanel(1);
if (this.mInitTarget) {
if (this.mInitTarget.nodeType == 9)
this.setTargetDocument(this.mInitTarget);
else if (this.mInitTarget.nodeType == 1) {
this.setTargetDocument(this.mInitTarget.ownerDocument);
this.mDocPanel.params = this.mInitTarget;
}
this.mInitTarget = null;
}
},
getViewerPaneAt: function(aIndex)
onEvent: function(aEvent)
{
if (aIndex == 0) {
return this.mDocViewerPane;
} else if (aIndex == 1) {
return this.mObjViewerPane;
} else {
return null;
switch (aEvent.type) {
case "panelsetready":
this.initViewerPanels();
break;
case "subjectChange":
if (aEvent.target == this.mDocPanel.viewer &&
aEvent.subject && "location" in aEvent.subject) {
this.locationText = aEvent.subject.location; // display document url
}
}
},
setCommandAttribute: function(aCmdId, aAttribute, aValue)
{
var cmd = document.getElementById(aCmdId);
if (cmd)
cmd.setAttribute(aAttribute, aValue);
},
getCommandAttribute: function(aCmdId, aAttribute)
{
var cmd = document.getElementById(aCmdId);
return cmd ? cmd.getAttribute(aAttribute) : null;
},
////////////////////////////////////////////////////////////////////////////
//// UI Commands
gotoTypedURL: function()
{
var url = document.getElementById("tfURLBar").value;
this.gotoURL(url);
},
goToWindow: function(aMenuitem)
{
this.setTargetWindowById(aMenuitem.id);
},
goToHistoryItem: function(aMenuitem)
{
var url = aMenuitem.getAttribute("value");
this.gotoURL(url, true);
},
showOpenURLDialog: function()
{
var defaultURL = "chrome://inspector/content/tests/allskin.xul"; // for testing
@ -252,19 +199,6 @@ InspectorApp.prototype =
splitter.close();
},
toggleFlashSelected: function(aExplicit, aValue)
{
var val = aExplicit ? aValue : !this.mFlashSelected;
PrefUtils.setPref("inspector.blink.on", val);
this.setFlashSelected(val);
},
setFlashSelected: function(aValue)
{
this.mFlashSelected = aValue;
var cmd = document.getElementById("cmdFlashSelected");
cmd.setAttribute("checked", aValue);
},
/*
viewSearchItem: function()
{
@ -330,16 +264,6 @@ InspectorApp.prototype =
return text;
},
showNotes: function()
{
window.open("http://www.joehewitt.com/inspector/releasenotes.html");
},
showAbout: function()
{
alert("Document Inspector - a debugging tool that's fun for the whole family!");
},
exit: function()
{
window.close();
@ -349,6 +273,12 @@ InspectorApp.prototype =
////////////////////////////////////////////////////////////////////////////
//// Navigation
gotoTypedURL: function()
{
var url = document.getElementById("tfURLBar").value;
this.gotoURL(url);
},
gotoURL: function(aURL, aNoSaveHistory)
{
this.mPendingURL = aURL;
@ -362,6 +292,11 @@ InspectorApp.prototype =
this.webNavigation.loadURI(aURL, nsIWebNavigation.LOAD_FLAGS_NONE);
},
goToWindow: function(aMenuitem)
{
this.setTargetWindowById(aMenuitem.id);
},
setTargetWindowById: function(aResId)
{
var windowManager = XPCU.getService(kWindowMediatorIID, "nsIWindowMediator");
@ -369,7 +304,6 @@ InspectorApp.prototype =
if (win) {
this.setTargetWindow(win);
this.setURLText("window: " + aResId);
this.toggleBrowser(true, false);
} else
alert("Unable to switch to window.");
@ -377,43 +311,13 @@ InspectorApp.prototype =
setTargetWindow: function(aWindow)
{
this.mCurrentWindow = aWindow;
this.setTargetDocument(aWindow.document);
},
setTargetDocument: function(aDoc)
{
this.mDocViewerPane.viewee = aDoc;
var doc = this.mDocViewerPane.viewee;
},
// turn these into getters and setters
setURLText: function(aText)
{
document.getElementById("tfURLBar").value = aText;
},
setStatus: function(aText)
{
document.getElementById("txStatus").setAttribute("value", aText);
},
getStatus: function(aText)
{
return document.getElementById("txStatus").getAttribute("value");
},
setProgress: function(aPercent)
{
document.getElementById("pmStatus").setAttribute("value", aPercent);
},
setSearchTitle: function(aTitle)
{
var splitter = document.getElementById("splSearch");
splitter.setAttribute("value", "Search" + (aTitle ? " - " + aTitle : ""));
this.mDocPanel.subject = aDoc;
this.mObjectPanel.subject = null;
},
get webNavigation()
@ -422,19 +326,40 @@ InspectorApp.prototype =
return browser.webNavigation;
},
////////////////////////////////////////////////////////////////////////////
//// UI Labels getters and setters
get locationText() { return document.getElementById("tfURLBar").value; },
set locationText(aText) { document.getElementById("tfURLBar").value = aText; },
get statusText() { return document.getElementById("txStatus").value; },
set statusText(aText) { document.getElementById("txStatus").setAttribute("value", aText); },
get progress() { return document.getElementById("pmStatus").getAttribute("value"); },
set progress(aPct) { document.getElementById("pmStatus").setAttribute("value", aPct); },
get searchTitle(aTitle) { return document.getElementById("splSearch").label; },
set searchTitle(aTitle)
{
var splitter = document.getElementById("splSearch");
splitter.setAttribute("label", "Search" + (aTitle ? " - " + aTitle : ""));
},
////////////////////////////////////////////////////////////////////////////
//// Document Loading
documentLoaded: function()
{
this.setTargetWindow(_content);
var url = this.webNavigation.currentURI.spec;
// put the url into the urlbar
this.locationText = url;
// add url to the history, unless explicity told not to
if (!this.mPendingNoSave)
this.addToHistory(this.mPendingURL);
// put the url into the urlbar
this.setURLText(this.mPendingURL);
this.addToHistory(url);
this.mPendingURL = null;
this.mPendingNoSave = null;
@ -462,9 +387,9 @@ InspectorApp.prototype =
clearSearchResults: function()
{
this.setSearchTitle(null);
this.setStatus("");
this.setProgress(0);
this.searchTitle = null;
this.statusText = "";
this.progress = 0;
this.mSearchService.clearSearch();
},
@ -474,23 +399,23 @@ InspectorApp.prototype =
onSearchStart: function(aModule)
{
this.setSearchTitle(aModule.title);
this.searchTitle = aModule.title;
this.toggleSearch(true, true);
},
onSearchResult: function(aModule)
{
if (aModule.isPastMilestone) {
this.setStatus("Searching - " + aModule.resultCount + " results found.");
this.setProgress(aModule.progressPercent);
this.statusText = "Searching - " + aModule.resultCount + " results found."; // XXX localize
this.progress = aModule.progressPercent;
}
},
onSearchEnd: function(aModule, aResult)
{
var diff = Math.round(aModule.elapsed / 100) / 10;
this.setProgress(100);
this.setStatus("Search complete - " + aModule.resultCount + " results found ("+diff+"s)");
this.progress = 100;
this.statusText = "Search complete - " + aModule.resultCount + " results found ("+diff+"s)"; // XXX localize
},
onSearchError: function(aModule, aMessage)
@ -498,91 +423,18 @@ InspectorApp.prototype =
alert("Unable to complete this search due to the following error:\n" + aMessage);
},
////////////////////////////////////////////////////////////////////////////
//// Viewer Registry Interaction
loadViewerRegistry: function()
{
this.mViewerReg = new ViewerRegistry();
this.mViewerReg.load(kViewerRegURL, this);
},
onViewerRegistryLoad: function()
{
this.initViewerPanes();
},
onViewerRegistryLoadError: function(aStatus, aErrorMsg)
{
// fatal error
alert("Unable to load viewer registry.");
this.exit();
},
getViewer: function(aUID)
{
return this.mViewerReg.getViewerByUID(aUID);
},
////////////////////////////////////////////////////////////////////////////
//// History
loadHistory: function()
{
RDFU.loadDataSource(kHistoryURL, HistoryLoadListener);
},
prepareHistory: function(aDS)
{
this.mHistory = RDFArray.fromContainer(aDS, "inspector:history", kInspectorNSURI);
var mppHistory = document.getElementById("mppHistory");
mppHistory.database.AddDataSource(aDS);
mppHistory.builder.rebuild();
},
addToHistory: function(aURL)
{
this.mHistory.add({ URL: aURL});
this.mHistory.save();
},
////////////////////////////////////////////////////////////////////////////
//// Preferences
initPrefs: function()
{
PrefUtils.addObserver("inspector", PrefChangeObserver);
},
onPrefChanged: function(aName)
{
if (aName == "inspector.blink.on")
this.setFlashSelected(PrefUtils.getPref("inspector.blink.on"));
if (this.mFlasher) {
if (aName == "inspector.blink.border-color") {
this.mFlasher.color = PrefUtils.getPref("inspector.blink.border-color");
} else if (aName == "inspector.blink.border-width") {
this.mFlasher.thickness = PrefUtils.getPref("inspector.blink.border-width");
} else if (aName == "inspector.blink.duration") {
this.mFlasher.duration = PrefUtils.getPref("inspector.blink.duration");
} else if (aName == "inspector.blink.speed") {
this.mFlasher.speed = PrefUtils.getPref("inspector.blink.speed");
}
}
},
////////////////////////////////////////////////////////////////////////////
//// Uncategorized
get isViewingContent() { return this.mIsViewingContent },
get isViewingContent() { return this.mPanelSet.getPanel(0).subject != null; },
getSpecialDirectory: function(aName)
{
var dirService = XPCU.getService(kDirServiceCID, "nsIProperties");
return dirService.get(aName, Components.interfaces.nsIFile);
},
fillInTooltip: function(tipElement)
{
var retVal = false;
@ -625,70 +477,6 @@ InspectorApp.prototype =
}
},
onTreeItemSelected: function()
{
var tree = this.mDOMTree;
var items = tree.selectedItems;
if (items.length > 0) {
var node = this.getNodeFromTreeItem(items[0]);
this.startViewingNode(node, items[0].id);
}
},
///////////////////////////////////////////////////////////////////////////
// The string we get back from shell.getInstallationURL starts with
// "file://" and so we need to add an extra slash, or the load fails.
//
// @param wstring aURL - the url to repair
///////////////////////////////////////////////////////////////////////////
prependBaseURL: function(aURL)
{
return "file:///" + this.mInstallURL.substr(7) + aURL;
},
flashElement: function(aElement, aWindow)
{
// make sure we only try to flash element nodes
if (aElement.nodeType == 1) {
if (!this.mFlasher)
this.mFlasher = new Flasher(this.mUFlasher,
PrefUtils.getPref("inspector.blink.border-color"),
PrefUtils.getPref("inspector.blink.border-width"),
PrefUtils.getPref("inspector.blink.duration"),
PrefUtils.getPref("inspector.blink.speed"));
if (this.mFlasher.flashing)
this.mFlasher.stop();
try {
this.mFlasher.element = aElement;
this.mFlasher.window = aWindow;
this.mFlasher.start();
} catch (ex) {
}
}
},
setViewerCmdAttribute: function(aEntry, aAttr, aValue)
{
var uid = this.mViewerReg.getEntryProperty(aEntry, "uid");
var cmds = document.getElementById("brsGlobalCommands");
var els = cmds.getElementsByAttribute("viewer", uid);
for (var i = 0; i < els.length; i++) {
if (els[i].getAttribute("exclusive") != "false")
els[i].setAttribute(aAttr, aValue);
}
},
setAllViewerCmdAttributes: function(aAttr, aValue)
{
var count = this.mViewerReg.getEntryCount();
for (var i = 0; i < count; i++) {
this.setViewerCmdAttribute(i, aAttr, aValue);
}
},
emptyChildren: function(aNode)
{
while (aNode.childNodes.length > 0) {
@ -703,30 +491,20 @@ InspectorApp.prototype =
} else if (aSplitter.id == "splSearch") {
this.toggleSearch(true, aSplitter.isOpened, true);
}
},
// needed by overlayed commands from viewer to get references to a specific
// viewer object by name
getViewer: function(aUID)
{
return this.mPanelSet.registry.getViewerByUID(aUID);
}
};
////////////////////////////////////////////////////////////////////////////
//// event listeners
var HistoryLoadListener = {
onDataSourceReady: function(aDS)
{
inspector.prepareHistory(aDS);
},
onError: function()
{
}
};
var PrefChangeObserver = {
Observe: function(aSubject, aTopic, aData)
{
inspector.onPrefChanged(aData);
}
};
function BrowserLoadListener(aEvent)
{
inspector.documentLoaded();

View File

@ -0,0 +1,596 @@
<?xml version="1.0"?>
<bindings id="ViewerPaneBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ***************************************************************
* Inspector
* Interface for a set of viewer panels.
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* REQUIRED IMPORTS:
* chrome://inspector/content/ViewerRegistry.js
* chrome://inspector/content/jsutil/events/ObserverManager.js
**************************************************************** -->
<binding id="panelset" extends="chrome://inspector/content/inspector.xml#base">
<content>
<children/>
</content>
<implementation>
<constructor><![CDATA[
]]></constructor>
<property name="registry" onget="return this.mRegistry"/>
<property name="initialized" onget="return this.mInitialized"/>
<method name="initialize">
<body><![CDATA[
this.mRegistry = new ViewerRegistry();
this.mRegistry.load(kViewerRegURL, this);
]]></body>
</method>
<method name="onEvent">
<parameter name="aEvent"/>
<body><![CDATA[
if (aEvent.type == "viewerChange")
this.onViewerChange(aEvent);
// bubble the event up
this.mObsMan.dispatchEvent(aEvent.type, aEvent);
]]></body>
</method>
<method name="onViewerRegistryLoad">
<body><![CDATA[
var panels = this.panels;
for (var i = 0; i < panels.length; ++i) {
panels[i].initialize();
panels[i].addObserver("viewerChange", this);
panels[i].addObserver("subjectChange", this);
}
this.setAllViewerCmdAttributes("disabled", "true");
this.mInitialized = true;
this.mObsMan.dispatchEvent("panelsetready", {});
]]></body>
</method>
<method name="onViewerRegistryLoadError">
<body><![CDATA[
throw "Unable to load the Viewer Registry";
]]></body>
</method>
<method name="onViewerChange">
<parameter name="aEvent"/>
<body><![CDATA[
if (aEvent.oldViewer)
// disable all commands for for the old viewer
this.setViewerCmdAttribute(this.mRegistry.getEntryForViewer(aEvent.oldViewer),
"disabled", "true");
if (aEvent.newViewer)
// enable all commands for for the new viewer
this.setViewerCmdAttribute(this.mRegistry.getEntryForViewer(aEvent.newViewer),
"disabled", "false");
]]></body>
</method>
<property name="panels">
<getter>
return this.getElementsByTagNameNS("http://www.mozilla.org/inspector", "panel");
</getter>
</property>
<property name="panelCount">
<getter>
return this.panels.length;
</getter>
</property>
<method name="getPanel">
<parameter name="aIndex"/>
<body><![CDATA[
return this.panels[aIndex];
]]></body>
</method>
<method name="getCommandAttribute">
<parameter name="aCmdId"/>
<parameter name="aAttribute"/>
<body><![CDATA[
var cmd = document.getElementById(aCmdId);
return cmd ? cmd.getAttribute(aAttribute) : null;
]]></body>
</method>
<method name="setCommandAttribute">
<parameter name="aCmdId"/>
<parameter name="aAttribute"/>
<parameter name="aValue"/>
<body><![CDATA[
var cmd = document.getElementById(aCmdId);
if (cmd)
cmd.setAttribute(aAttribute, aValue);
]]></body>
</method>
<method name="setViewerCmdAttribute">
<parameter name="aEntry"/>
<parameter name="aAttr"/>
<parameter name="aValue"/>
<body><![CDATA[
var uid = this.mRegistry.getEntryProperty(aEntry, "uid");
var cmds = document.getElementById(this.getAttribute("viewercommandset"));
if (!cmds) return;
var els = cmds.getElementsByAttribute("viewer", uid);
for (var i = 0; i < els.length; i++) {
if (els[i].getAttribute("exclusive") != "false")
els[i].setAttribute(aAttr, aValue);
}
]]></body>
</method>
<method name="setAllViewerCmdAttributes">
<parameter name="aAttr"/>
<parameter name="aValue"/>
<body><![CDATA[
var count = this.mRegistry.getEntryCount();
for (var i = 0; i < count; i++) {
this.setViewerCmdAttribute(i, aAttr, aValue);
}
]]></body>
</method>
</implementation>
</binding>
<!-- ***************************************************************
* ViewerPane
* Interface for a panel accepts a node and displays all eligible
* viewers in a list and activates the selected viewer.
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* REQUIRED IMPORTS:
* chrome://inspector/content/jsutil/xpcom/XPCU.js
* chrome://inspector/content/jsutil/events/ObserverManager.js
**************************************************************** -->
<binding id="panel" extends="chrome://inspector/content/inspector.xml#base">
<content orient="vertical">
<xul:toolbox class="viewer-pane-toolbox" inherits="disabled">
<xul:toolbar class="viewer-pane-header" tbautostretch="never" inherits="disabled">
<xul:menubutton anonid="viewer-list" class="viewer-list button-toolbar" disabled="true"/>
<xul:text anonid="viewer-title" class="viewer-title label toolbar" flex="1"/>
<xul:menubutton anonid="viewer-menu" class="viewer-menu button-toolbar" disabled="true"/>
</xul:toolbar>
</xul:toolbox>
<xul:box class="viewer-pane-box-1" flex="1">
<xul:box class="viewer-pane-box-2" flex="1">
<xul:iframe anonid="viewer-iframe" class="viewer-iframe" flex="1"/>
</xul:box>
</xul:box>
</content>
<resources>
<stylesheet src="chrome://inspector/skin/panelset.css"/>
</resources>
<implementation>
<constructor><![CDATA[
// look for panelset parent
var p = this.parentNode;
while (p && p.localName != "panel" && p.namespaceURI != "http://www.mozilla.org/inspector")
p = p.parentNode;
this.mPanelSet = p;
this.setAttribute("disabled", "true");
]]></constructor>
<destructor><![CDATA[
if (this.mCurrentViewer)
this.destroyViewer();
]]></destructor>
<property name="panelset"
onget="return this.mPanelSet;"/>
<property name="viewer"
onget="return this.mCurrentViewer;"/>
<property name="subject"
onget="return this.mSubject;"
onset="this.setSubject(val);"/>
<property name="params"
onget="return this.mParams;"
onset="return this.mParams = val;"/>
<property name="title"
onget="return this.getAttribute('title');"
onset="return this.setAttribute('title', val);"/>
<property name="registry"
onget="return this.panelset.registry;"/>
<property name="linkedPanel">
<getter>return this.mLinkedPanel;</getter>
<setter>
if (this.mLinkedPanel)
this.mLinkedPanel.removeObserver("viewerChange", this);
this.mLinkedPanel = val;
if (val)
val.addObserver("viewerChange", this);
</setter>
</property>
<property name="mCurrentViewer">null</property>
<property name="mCurrentEntry">null</property>
<method name="initialize">
<body><![CDATA[
this.mListEl = this.getAnonElByAttr("anonid", "viewer-list");
this.mTitleEl = this.getAnonElByAttr("anonid", "viewer-title");
this.mMenuEl = this.getAnonElByAttr("anonid", "viewer-menu");
this.mIFrameEl = this.getAnonElByAttr("anonid", "viewer-iframe");
if (this.hasAttribute("linkedpanel"))
this.linkedPanel = document.getElementById(this.getAttribute("linkedpanel"));
this.fillViewerList();
]]></body>
</method>
<method name="notifyViewerReady">
<parameter name="aViewer"/>
<body><![CDATA[
var old = this.mCurrentViewer;
this.mCurrentViewer = aViewer;
var oldEntry = this.mCurrentEntry;
this.mCurrentEntry = this.mPendingEntry;
if (aViewer) {
this.registry.cacheViewer(aViewer, this.mCurrentEntry);
var title = this.registry.getEntryProperty(this.mCurrentEntry, "description");
this.setTitle(title);
} else {
this.setTitle(null);
}
this.rebuildViewerContextMenu();
// listen for subjectChange so we can bubble it
if (old)
old.removeObserver("subjectChange", this);
if (aViewer)
aViewer.addObserver("subjectChange", this);
this.mObsMan.dispatchEvent("viewerChange",
{ viewerPane: this, oldViewer: old, newViewer: aViewer });
if (aViewer)
aViewer.subject = this.mSubject;
]]></body>
</method>
<method name="destroyViewer">
<body><![CDATA[
this.mCurrentViewer.destroy();
this.registry.uncacheViewer(this.mCurrentViewer);
]]></body>
</method>
<!-- ////////////// UI Commands /////////////////-->
<!-- ////////////////////////////////////////////////////////////////////////////
// Sets the new view to the item just selected from the "viewer list"
//////////////////////////////////////////////////////////////////////// -->
<method name="onViewerListCommand">
<parameter name="aItem"/>
<body><![CDATA[
this.switchViewer(parseInt(aItem.getAttribute("viewerListEntry")));
]]></body>
</method>
<!-- ////////////////////////////////////////////////////////////////////////////
// Prepares the list of viewers for a node, rebuilds the menulist to display
// them, and load the default viewer for the node.
//
// @param Object aObject - the object to begin viewing
//////////////////////////////////////////////////////////////////////// -->
<method name="setSubject">
<parameter name="aObject"/>
<body><![CDATA[
this.mSubject = aObject;
this.mParams = null;
// get the list of viewers which match the node
var entries = this.registry.findViewersForObject(aObject);
this.rebuildViewerList(entries);
if (entries.length == 0) {
this.switchViewer(-1);
this.setAttribute("disabled", "true");
} else if (!this.entryInList(this.mCurrentEntry, entries)) {
this.switchViewer(entries[0]);
this.removeAttribute("disabled");
} else {
this.mCurrentViewer.subject = aObject;
this.removeAttribute("disabled");
}
]]></body>
</method>
<!-- ////////////////////////////////////////////////////////////////////////////
// Clear out and rebuild the menulist full of the available views
// for the currently selected node.
//
// @param Array aEntries - an array of entries from the viewer registry
//////////////////////////////////////////////////////////////////////// -->
<method name="rebuildViewerList">
<parameter name="aEntries"/>
<body><![CDATA[
var mpp = this.mListElPopup;
this.mListEl.setAttribute("disabled", aEntries.length <= 0);
// empty the list
while (mpp.childNodes.length)
mpp.removeChild(mpp.childNodes[0]);
for (var i = 0; i < aEntries.length; i++) {
var entry = aEntries[i];
var menuitem = document.createElement("menuitem");
menuitem.setAttribute("label", this.registry.getEntryProperty(entry, "description"));
menuitem.setAttribute("viewerListEntry", entry);
mpp.appendChild(menuitem);
}
]]></body>
</method>
<!-- ////////////////////////////////////////////////////////////////////////////
// Loads the viewer described by an entry in the viewer registry.
//
// @param nsIRDFNode aEntry - entry in the viewer registry
//////////////////////////////////////////////////////////////////////// -->
<method name="switchViewer">
<parameter name="aEntry"/>
<body><![CDATA[
if (aEntry < 0) { // -1 is for null viewer
this.mPendingEntry = -1;
this.notifyViewerReady(null);
return;
}
var url = this.registry.getEntryURL(aEntry);
var loadNew = true;
if (this.mCurrentViewer) {
var oldURL = this.registry.getEntryURL(this.mCurrentEntry);
if (oldURL == url) {
loadNew = false;
}
}
if (loadNew) {
this.mPendingEntry = aEntry;
this.loadViewerURL(url);
}
]]></body>
</method>
<!-- ////////////////////////////////////////////////////////////////////////////
// Begin loading a new viewer from a given url.
//
// @param String aURL - the url of the viewer document
//////////////////////////////////////////////////////////////////////// -->
<method name="loadViewerURL">
<parameter name="aURL"/>
<body><![CDATA[
if (this.mCurrentViewer) {
// tell the old viewer it's about to go away
this.destroyViewer();
}
// load the new document
FrameExchange.loadURL(this.mIFrameEl, aURL, this);
]]></body>
</method>
<!-- ////////////////////////////////////////////////////////////////////////////
// Rebuild the viewer context menu
//////////////////////////////////////////////////////////////////////// -->
<method name="rebuildViewerContextMenu">
<body><![CDATA[
if (!this.mSubject) {
this.mMenuEl.setAttribute("disabled", "true");
return;
} else {
this.mMenuEl.removeAttribute("disabled");
}
// remove old context menu
if (this.mContextMenu) {
this.mMenuEl.removeChild(this.mContextMenu);
this.mFormerContextParent.appendChild(this.mContextMenu);
}
var uid = this.registry.getEntryProperty(this.mCurrentEntry, "uid");
var ppId = "ppViewerContext-" + uid;
var pp = document.getElementById(ppId);
if (pp) {
this.mMenuEl.setAttribute("disabled", "false");
var parent = pp.parentNode;
parent.removeChild(pp);
this.mMenuEl.appendChild(pp);
this.mFormerContextParent = parent;
this.mContextMenu = pp;
} else {
this.mMenuEl.setAttribute("disabled", "true");
}
]]></body>
</method>
<!-- ////////////////////////////////////////////////////////////////////////////
// Check to see if an entry exists in an arry of entries
//
// @param nsIRDFResource aEntry - the entry being searched for
// @param Array aList - array of entries
//////////////////////////////////////////////////////////////////////// -->
<method name="entryInList">
<parameter name="aEntry"/>
<parameter name="aList"/>
<body><![CDATA[
for (var i in aList) {
if (aList[i] == aEntry) return true;
}
return false;
]]></body>
</method>
<!-- ////////////////////////////////////////////////////////////////////////////
// Set the text in the viewer title bar
//
// @param String title - the text to use
//////////////////////////////////////////////////////////////////////// -->
<method name="setTitle">
<parameter name="aTitle"/>
<body><![CDATA[
this.mTitleEl.setAttribute("value", this.title && aTitle ? this.title + " - " + aTitle : "");
]]></body>
</method>
<!-- ////////////////////////////////////////////////////////////////////////////
// Fill out the content of the "viewer list" menu
//////////////////////////////////////////////////////////////////////// -->
<method name="fillViewerList">
<body><![CDATA[
this.mListEl.pViewer = this;
this.mListEl.setAttribute("oncommand", "this.pViewer.onViewerListCommand(event.target)");
var mpp = document.createElement("menupopup");
this.mListEl.appendChild(mpp);
this.mListElPopup = mpp;
]]></body>
</method>
<!-- ////////////////////////////////////////////////////////////////////////////
// Listen for selection changes on the viewer in the linked pane
//////////////////////////////////////////////////////////////////////// -->
<method name="observerLinkedViewer">
<body><![CDATA[
if (this.mLinkedViewer)
this.mLinkedViewer.removeObserver("selectionChange", this);
this.mLinkedViewer = this.mLinkedPanel.viewer;
this.mLinkedViewer.addObserver("selectionChange", this);
]]></body>
</method>
<!-- ////////////////////////////////////////////////////////////////////////////
// Update this pane's subject to be the selection of it's linked pane
//////////////////////////////////////////////////////////////////////// -->
<method name="updateLinkedSubject">
<body><![CDATA[
this.subject = this.mLinkedViewer.selection;
]]></body>
</method>
<!-- ////////////////////////////////////////////////////////////////////////////
// global event handler
//////////////////////////////////////////////////////////////////////// -->
<method name="onEvent">
<parameter name="aEvent"/>
<body><![CDATA[
switch (aEvent.type) {
case "viewerChange":
this.observerLinkedViewer();
break;
case "selectionChange":
this.updateLinkedSubject();
break;
case "subjectChange":
this.mObsMan.dispatchEvent("subjectChange", aEvent);
};
]]></body>
</method>
<!-- ////////////////////////////////////////////////////////////////////////////
// We need this method only because document.getAnonymousElementByAttribute
// is crashing (as of 2/26/2001)
//////////////////////////////////////////////////////////////////////// -->
<method name="getAnonElByAttr">
<parameter name="aAttr"/>
<parameter name="aVal"/>
<body><![CDATA[
var kids = document.getAnonymousNodes(this);
for (var i = 0; i < kids.length; ++i) {
if (kids[i].getAttribute(aAttr) == aVal)
return kids[i];
var kids2 = kids[i].getElementsByAttribute(aAttr, aVal);
if (kids2.length > 0)
return kids2[0];
}
return null;
]]></body>
</method>
</implementation>
</binding>
<binding id="base">
<implementation>
<constructor><![CDATA[
this.mObsMan = new ObserverManager(this);
]]></constructor>
<!-- ////////////// Event Handling /////////////////-->
<method name="addObserver">
<parameter name="aEvent"/>
<parameter name="aObserver"/>
<body><![CDATA[
this.mObsMan.addObserver(aEvent, aObserver);
]]></body>
</method>
<method name="removeObserver">
<parameter name="aEvent"/>
<parameter name="aObserver"/>
<body><![CDATA[
this.mObsMan.removeObserver(aEvent, aObserver);
]]></body>
</method>
</implementation>
</binding>
</bindings>

View File

@ -7,37 +7,50 @@
<?xul-overlay href="chrome://inspector/content/inspectorOverlay.xul"?>
<?xul-overlay href="chrome://inspector/content/toolboxOverlay.xul"?>
<?xul-overlay href="chrome://inspector/content/popupOverlay.xul"?>
<?xul-overlay href="chrome://inspector/content/commandOverlay.xul"?>
<?xul-overlay href="chrome://inspector/content/keysetOverlay.xul"?>
<?xul-overlay href="chrome://inspector/content/statusbarOverlay.xul"?>
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/tasksOverlay.xul"?>
<?xml-stylesheet href="chrome://inspector/skin/inspectorWindow.css"?>
<window id="winInspectorMain" class="color-dialog"
title="Document Inspector"
title="&Inspector.title;"
width="1024" height="768" orient="vertical"
persist="screenX screenY width height maximized"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://communicator/content/utilityOverlay.js"/>
<popupset id="psTooltipSet">
<popup id="ppTooltip" class="tooltip" oncreate="return inspector.fillInTooltip(document.tooltipNode);">
<text id="txTooltip"/>
</popup>
</popupset>
<popupset id="aTooltipSet"/>
<popupset id="ppsGlobalPopupset"/>
<popupset id="ppsViewerPopupset"/>
<keyset id="ksGlobalKeyset"/>
<broadcasterset id="brsGlobalCommands"/>
<commandset id="cmdsGlobalCommands"/>
<commandset id="tasksCommands">
<command id="cmd_quit"/>
</commandset>
<keyset id="tasksKeys">
<key id="key_close"/>
<key id="key_quit"/>
</keyset>
<toolbox id="tbxInsToolbox">
<menubar id="mbrInspectorMain"/>
<toolbar id="tbInspectorPrimary"/>
</toolbox>
<hbox id="bxInspectorMain" flex="1"/>
<vbox id="bxInspectorMain" flex="1"/>
<hbox id="bxStatus"/>
<statusbar id="status-bar"/>
</window>

View File

@ -6,14 +6,12 @@
]>
<overlay id="ovInspector"
xmlns:ins="&INS-rdf;"
xmlns:domi="http://www.mozilla.org/inspector"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://inspector/content/InspectorApp.js"/>
<script type="application/x-javascript" src="chrome://inspector/content/inspector.js"/>
<script type="application/x-javascript" src="chrome://inspector/content/ViewerRegistry.js"/>
<script type="application/x-javascript" src="chrome://inspector/content/ViewerPane.js"/>
<script type="application/x-javascript" src="chrome://inspector/content/utils.js"/>
<script type="application/x-javascript" src="chrome://inspector/content/Flasher.js"/>
<script type="application/x-javascript" src="chrome://inspector/content/jsutil/xpcom/XPCU.js"/>
<script type="application/x-javascript" src="chrome://inspector/content/jsutil/rdf/RDFU.js"/>
<script type="application/x-javascript" src="chrome://inspector/content/jsutil/rdf/RDFArray.js"/>
@ -21,6 +19,7 @@
<script type="application/x-javascript" src="chrome://inspector/content/jsutil/system/PrefUtils.js"/>
<script type="application/x-javascript" src="chrome://inspector/content/jsutil/system/FilePickerUtils.js"/>
<script type="application/x-javascript" src="chrome://inspector/content/jsutil/system/file.js"/>
<script type="application/x-javascript" src="chrome://inspector/content/jsutil/events/ObserverManager.js"/>
<script type="application/x-javascript" src="chrome://inspector/content/search/inSearchService.js"/>
<script type="application/x-javascript" src="chrome://inspector/content/search/inSearchModule.js"/>
<script type="application/x-javascript" src="chrome://inspector/content/jsutil/xul/inFormManager.js"/>
@ -30,40 +29,28 @@
<vbox id="bxInspectorMain">
<hbox id="bxInspectorPanes" flex="1" hide="true">
<vbox id="bxDocPane" class="viewer-pane" flex="1">
<hbox id="bxDocHeader" class="viewer-pane-header" autostretch="never">
<menubutton class="viewer-list" ins-role="viewer-list" disabled="true"/>
<text class="viewer-title" ins-role="viewer-title" flex="1"/>
<menubutton class="viewer-menu" ins-role="viewer-menu" disabled="true"/>
</hbox>
<iframe id="ifDocViewer" class="viewer-iframe" flex="1" ins-role="viewer-iframe"/>
</vbox>
<splitter orient="vertical" collapse="before">
<grippy/>
</splitter>
<domi:panelset id="bxPanelSet" flex="1" viewercommandset="cmdsGlobalCommands">
<domi:panel id="bxDocPanel" title="&bxDocPanel.title;"
flex="1" persist="width"/>
<vbox id="bxObjectPane" class="viewer-pane" flex="1">
<hbox id="bxObjHeader" class="viewer-pane-header" autostretch="never">
<menubutton class="viewer-list" ins-role="viewer-list" disabled="true"/>
<text class="viewer-title" ins-role="viewer-title" flex="1"/>
<menubutton class="viewer-menu" ins-role="viewer-menu" disabled="true"/>
</hbox>
<iframe id="ifObjViewer" class="viewer-iframe" flex="1" ins-role="viewer-iframe"/>
</vbox>
</hbox>
<splitter id="splPanels" orient="vertical"/>
<domi:panel id="bxObjectPanel" title="&bxObjectPanel.title;" linkedpanel="bxDocPanel"
flex="1" persist="width"/>
</domi:panelset>
<splitter id="splBrowser" class="titled-splitter"
onopen="inspector.onSplitterOpen(this)"
value="Browser" closebutton="true" collapse="after"/>
label="Browser" closebutton="true" collapse="after"/>
<hbox id="bxBrowser" flex="1">
<browser id="ifBrowser" type="content-primary" flex="1" src="about:blank"/>
</hbox>
<splitter id="splSearch" class="titled-splitter"
onopen="inspector.onSplitterOpen(this)"
value="Search Results" closebutton="true" collapse="after"/>
label="Search Results" closebutton="true" collapse="after"/>
<vbox id="bxSearch">
<tree id="trSearch" flex="1" context="ppSearchResults" datasources="rdf:null">
<template/>
@ -72,5 +59,7 @@
<!-- TEMPORARY UNTIL FIX FOR 54237 -->
<browser id="inSearchServiceLoader" height="1"/>
</vbox>
</vbox>
</overlay>

View File

@ -1,79 +0,0 @@
inspector.jar:
content/inspector/contents.rdf
content/inspector/inspector.xul
content/inspector/inspectorOverlay.xul
content/inspector/toolboxOverlay.xul
content/inspector/statusbarOverlay.xul
content/inspector/commandOverlay.xul
content/inspector/keysetOverlay.xul
content/inspector/popupOverlay.xul
content/inspector/tasksOverlay.xul
content/inspector/utilWindow.xul
content/inspector/inspector.css
content/inspector/util.dtd
content/inspector/InspectorApp.js
content/inspector/ViewerRegistry.js
content/inspector/ViewerPane.js
content/inspector/Flasher.js
content/inspector/utils.js
content/inspector/extensions/treeEditable.xml (extensions/treeEditable.xml)
content/inspector/extensions/treeEditable.css (extensions/treeEditable.css)
content/inspector/extensions/titledSplitter.xml (extensions/titledSplitter.xml)
content/inspector/extensions/titledSplitter.css (extensions/titledSplitter.css)
content/inspector/extensions/wsm-colorpicker.js (extensions/wsm-colorpicker.js)
content/inspector/jsutil/rdf/RDFU.js (jsutil/rdf/RDFU.js)
content/inspector/jsutil/rdf/RDFArray.js (jsutil/rdf/RDFArray.js)
content/inspector/jsutil/system/PrefUtils.js (jsutil/system/PrefUtils.js)
content/inspector/jsutil/system/FilePickerUtils.js (jsutil/system/FilePickerUtils.js)
content/inspector/jsutil/system/DiskSearch.js (jsutil/system/DiskSearch.js)
content/inspector/jsutil/system/file.js (jsutil/system/file.js)
content/inspector/jsutil/xpcom/XPCU.js (jsutil/xpcom/XPCU.js)
content/inspector/jsutil/xul/FrameExchange.js (jsutil/xul/FrameExchange.js)
content/inspector/jsutil/xul/inFormManager.js (jsutil/xul/inFormManager.js)
content/inspector/jsutil/xul/inTreeTableBuilder.js (jsutil/xul/inTreeTableBuilder.js)
content/inspector/jsutil/xul/DNDUtils.js (jsutil/xul/DNDUtils.js)
content/inspector/prefs/prefs.xul (prefs/prefs.xul)
content/inspector/prefs/prefsOverlay.xul (prefs/prefsOverlay.xul)
content/inspector/prefs/pref-inspector.xul (prefs/pref-inspector.xul)
content/inspector/prefs/pref-sidebar.xul (prefs/pref-sidebar.xul)
content/inspector/prefs/pref-sidebar.js (prefs/pref-sidebar.js)
content/inspector/search/inSearchService.js (search/inSearchService.js)
content/inspector/search/inSearchModule.js (search/inSearchModule.js)
content/inspector/search/inSearchTreeBuilder.js (search/inSearchTreeBuilder.js)
content/inspector/search/inSearchUtils.js (search/inSearchUtils.js)
content/inspector/search/modules/popupOverlay.xul (search/modules/popupOverlay.xul)
content/inspector/search/modules/commandOverlay.xul (search/modules/commandOverlay.xul)
content/inspector/search/modules/findFiles/findFiles.xml (search/modules/findFiles/findFiles.xml)
content/inspector/search/modules/findFiles/dialog.xul (search/modules/findFiles/dialog.xul)
content/inspector/search/modules/findFiles/dialog.js (search/modules/findFiles/dialog.js)
content/inspector/search/modules/junkImgs/junkImgs.xml (search/modules/junkImgs/junkImgs.xml)
content/inspector/search/modules/junkImgs/dialog.xul (search/modules/junkImgs/dialog.xul)
content/inspector/search/modules/junkImgs/dialog.js (search/modules/junkImgs/dialog.js)
content/inspector/sidebar/sidebar.xul (sidebar/sidebar.xul)
content/inspector/sidebar/InspectorSidebar.js (sidebar/InspectorSidebar.js)
content/inspector/tests/allskin.xul (tests/allskin.xul)
content/inspector/viewers/computedStyle/computedStyle.xul (viewers/computedStyle/computedStyle.xul)
content/inspector/viewers/computedStyle/computedStyle.js (viewers/computedStyle/computedStyle.js)
content/inspector/viewers/dom/dom.xul (viewers/dom/dom.xul)
content/inspector/viewers/dom/dom.js (viewers/dom/dom.js)
content/inspector/viewers/dom/commandOverlay.xul (viewers/dom/commandOverlay.xul)
content/inspector/viewers/dom/keysetOverlay.xul (viewers/dom/keysetOverlay.xul)
content/inspector/viewers/dom/popupOverlay.xul (viewers/dom/popupOverlay.xul)
content/inspector/viewers/dom/findDialog.xul (viewers/dom/findDialog.xul)
content/inspector/viewers/dom/FindDialog.js (viewers/dom/FindDialog.js)
content/inspector/viewers/dom/columnsDialog.xul (viewers/dom/columnsDialog.xul)
content/inspector/viewers/dom/columnsDialog.js (viewers/dom/columnsDialog.js)
content/inspector/viewers/jsObject/jsObject.xul (viewers/jsObject/jsObject.xul)
content/inspector/viewers/jsObject/jsObject.js (viewers/jsObject/jsObject.js)
content/inspector/viewers/nodeElement/nodeElement.xul (viewers/nodeElement/nodeElement.xul)
content/inspector/viewers/nodeElement/nodeElement.js (viewers/nodeElement/nodeElement.js)
content/inspector/viewers/nodeText/nodeText.xul (viewers/nodeText/nodeText.xul)
content/inspector/viewers/nodeText/nodeText.js (viewers/nodeText/nodeText.js)
content/inspector/viewers/styleRules/styleRules.xul (viewers/styleRules/styleRules.xul)
content/inspector/viewers/styleRules/styleRules.js (viewers/styleRules/styleRules.js)
content/inspector/viewers/styleRules/commandOverlay.xul (viewers/styleRules/commandOverlay.xul)
content/inspector/viewers/styleRules/popupOverlay.xul (viewers/styleRules/popupOverlay.xul)
content/inspector/viewers/stylesheets/stylesheets.xul (viewers/stylesheets/stylesheets.xul)
content/inspector/viewers/stylesheets/stylesheets.js (viewers/stylesheets/stylesheets.js)
content/inspector/viewers/xblBindings/xblBindings.xul (viewers/xblBindings/xblBindings.xul)
content/inspector/viewers/xblBindings/xblBindings.js (viewers/xblBindings/xblBindings.js)

Some files were not shown because too many files have changed in this diff Show More