зеркало из https://github.com/mozilla/pjs.git
Bug 44480. Demote 'width' and 'height' attributes from NSDocument to NSHTMLDocument and XULDocument; make nsHTMLDocument's implementation use the <body> element's frame (instead of the <html> element's frame) to determine metrics. r=jst
This commit is contained in:
Родитель
f75b7cd085
Коммит
dd700db4af
|
@ -433,6 +433,7 @@ rdf/resources/Makefile
|
|||
rdf/build/Makefile
|
||||
rdf/content/Makefile
|
||||
rdf/content/public/Makefile
|
||||
rdf/content/public/idl/Makefile
|
||||
rdf/content/src/Makefile
|
||||
rdf/datasource/Makefile
|
||||
rdf/datasource/public/Makefile
|
||||
|
|
|
@ -2435,112 +2435,6 @@ nsDocument::GetDefaultView(nsIDOMAbstractView** aDefaultView)
|
|||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsDocument::GetPixelDimensions(nsIPresShell* aShell,
|
||||
PRInt32* aWidth,
|
||||
PRInt32* aHeight)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsSize size;
|
||||
nsIFrame* frame;
|
||||
|
||||
result = FlushPendingNotifications();
|
||||
if (NS_FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = aShell->GetPrimaryFrameFor(mRootContent, &frame);
|
||||
if (NS_SUCCEEDED(result) && frame) {
|
||||
nsIView* view;
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
|
||||
aShell->GetPresContext(getter_AddRefs(presContext));
|
||||
result = frame->GetView(presContext, &view);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// If we have a view check if it's scrollable. If not,
|
||||
// just use the view size itself
|
||||
if (view) {
|
||||
nsIScrollableView* scrollableView;
|
||||
|
||||
if (NS_SUCCEEDED(view->QueryInterface(NS_GET_IID(nsIScrollableView), (void**)&scrollableView))) {
|
||||
scrollableView->GetScrolledView(view);
|
||||
}
|
||||
|
||||
result = view->GetDimensions(&size.width, &size.height);
|
||||
}
|
||||
// If we don't have a view, use the frame size
|
||||
else {
|
||||
result = frame->GetSize(size);
|
||||
}
|
||||
}
|
||||
|
||||
// Convert from twips to pixels
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
|
||||
result = aShell->GetPresContext(getter_AddRefs(context));
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
float scale;
|
||||
context->GetTwipsToPixels(&scale);
|
||||
|
||||
*aWidth = NSTwipsToIntPixels(size.width, scale);
|
||||
*aHeight = NSTwipsToIntPixels(size.height, scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
*aWidth = 0;
|
||||
*aHeight = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetWidth(PRInt32* aWidth)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aWidth);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
// We make the assumption that the first presentation shell
|
||||
// is the one for which we need information.
|
||||
shell = getter_AddRefs(GetShellAt(0));
|
||||
if (shell) {
|
||||
PRInt32 width, height;
|
||||
|
||||
result = GetPixelDimensions(shell, &width, &height);
|
||||
*aWidth = width;
|
||||
} else
|
||||
*aWidth = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetHeight(PRInt32* aHeight)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aHeight);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
// We make the assumption that the first presentation shell
|
||||
// is the one for which we need information.
|
||||
shell = getter_AddRefs(GetShellAt(0));
|
||||
if (shell) {
|
||||
PRInt32 width, height;
|
||||
|
||||
result = GetPixelDimensions(shell, &width, &height);
|
||||
*aHeight = height;
|
||||
} else
|
||||
*aHeight = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::Load (const nsString& aUrl)
|
||||
{
|
||||
|
|
|
@ -397,8 +397,6 @@ public:
|
|||
const nsString& aNameSpace,
|
||||
nsIDOMElement** aReturn);
|
||||
NS_IMETHOD CreateRange(nsIDOMRange** aReturn);
|
||||
NS_IMETHOD GetWidth(PRInt32* aWidth);
|
||||
NS_IMETHOD GetHeight(PRInt32* aHeight);
|
||||
NS_IMETHOD Load (const nsString& aUrl);
|
||||
NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins);
|
||||
|
||||
|
@ -476,10 +474,6 @@ protected:
|
|||
const nsIContent* aTest1,
|
||||
const nsIContent* aTest2) const;
|
||||
|
||||
nsresult GetPixelDimensions(nsIPresShell* aShell,
|
||||
PRInt32* aWidth,
|
||||
PRInt32* aHeight);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void InternalAddStyleSheet(nsIStyleSheet* aSheet); // subclass hooks for sheet ordering
|
||||
|
|
|
@ -2303,6 +2303,117 @@ nsHTMLDocument::GetElementsByName(const nsString& aElementName,
|
|||
return elements->QueryInterface(kIDOMNodeListIID, (void**)aReturn);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLDocument::GetPixelDimensions(nsIPresShell* aShell,
|
||||
PRInt32* aWidth,
|
||||
PRInt32* aHeight)
|
||||
{
|
||||
*aWidth = *aHeight = 0;
|
||||
|
||||
nsresult result;
|
||||
result = FlushPendingNotifications();
|
||||
if (NS_FAILED(result))
|
||||
return NS_OK;
|
||||
|
||||
// Find the <body> element: this is what we'll want to use for the
|
||||
// document's width and height values.
|
||||
if (mBodyContent == nsnull && PR_FALSE == GetBodyContent()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> body = do_QueryInterface(mBodyContent);
|
||||
|
||||
// Now grab its frame
|
||||
nsIFrame* frame;
|
||||
result = aShell->GetPrimaryFrameFor(body, &frame);
|
||||
if (NS_SUCCEEDED(result) && frame) {
|
||||
nsSize size;
|
||||
nsIView* view;
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
|
||||
aShell->GetPresContext(getter_AddRefs(presContext));
|
||||
result = frame->GetView(presContext, &view);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// If we have a view check if it's scrollable. If not,
|
||||
// just use the view size itself
|
||||
if (view) {
|
||||
nsIScrollableView* scrollableView;
|
||||
|
||||
if (NS_SUCCEEDED(view->QueryInterface(NS_GET_IID(nsIScrollableView), (void**)&scrollableView))) {
|
||||
scrollableView->GetScrolledView(view);
|
||||
}
|
||||
|
||||
result = view->GetDimensions(&size.width, &size.height);
|
||||
}
|
||||
// If we don't have a view, use the frame size
|
||||
else {
|
||||
result = frame->GetSize(size);
|
||||
}
|
||||
}
|
||||
|
||||
// Convert from twips to pixels
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
|
||||
result = aShell->GetPresContext(getter_AddRefs(context));
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
float scale;
|
||||
context->GetTwipsToPixels(&scale);
|
||||
|
||||
*aWidth = NSTwipsToIntPixels(size.width, scale);
|
||||
*aHeight = NSTwipsToIntPixels(size.height, scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetWidth(PRInt32* aWidth)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aWidth);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
// We make the assumption that the first presentation shell
|
||||
// is the one for which we need information.
|
||||
shell = getter_AddRefs(GetShellAt(0));
|
||||
if (shell) {
|
||||
PRInt32 width, height;
|
||||
|
||||
result = GetPixelDimensions(shell, &width, &height);
|
||||
*aWidth = width;
|
||||
} else
|
||||
*aWidth = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetHeight(PRInt32* aHeight)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aHeight);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
// We make the assumption that the first presentation shell
|
||||
// is the one for which we need information.
|
||||
shell = getter_AddRefs(GetShellAt(0));
|
||||
if (shell) {
|
||||
PRInt32 width, height;
|
||||
|
||||
result = GetPixelDimensions(shell, &width, &height);
|
||||
*aHeight = height;
|
||||
} else
|
||||
*aHeight = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetAlinkColor(nsString& aAlinkColor)
|
||||
{
|
||||
|
|
|
@ -147,6 +147,10 @@ public:
|
|||
|
||||
virtual nsresult Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup);
|
||||
protected:
|
||||
nsresult GetPixelDimensions(nsIPresShell* aShell,
|
||||
PRInt32* aWidth,
|
||||
PRInt32* aHeight);
|
||||
|
||||
// Find/Search Method/Data member
|
||||
PRBool SearchBlock(BlockText & aBlockText,
|
||||
nsString & aStr,
|
||||
|
|
|
@ -364,8 +364,6 @@ public:
|
|||
NS_IMETHOD GetCharacterSet(nsString& aCharacterSet);
|
||||
NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, const nsString& aNameSpace, nsIDOMElement** aResult);
|
||||
NS_IMETHOD CreateRange(nsIDOMRange** aRange);
|
||||
NS_IMETHOD GetWidth(PRInt32* aWidth);
|
||||
NS_IMETHOD GetHeight(PRInt32* aHeight);
|
||||
NS_IMETHOD Load (const nsString& aUrl);
|
||||
NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins);
|
||||
|
||||
|
|
|
@ -85,8 +85,6 @@ interface NSDocument {
|
|||
/* IID: { 0xa6cf90cd, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} } */
|
||||
|
||||
readonly attribute long width;
|
||||
readonly attribute long height;
|
||||
readonly attribute DOMString characterSet;
|
||||
readonly attribute PluginArray plugins;
|
||||
// XXX This should be removed, the new createElementNS should be used in stead
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
/* IID: { 0xa6cf90c5, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
|
||||
|
||||
readonly attribute long width;
|
||||
readonly attribute long height;
|
||||
attribute wstring alinkColor;
|
||||
attribute wstring linkColor;
|
||||
attribute wstring vlinkColor;
|
||||
|
|
|
@ -10,6 +10,8 @@ interface XULDocument : Document {
|
|||
|
||||
NodeList getElementsByAttribute(in DOMString name, in DOMString value);
|
||||
|
||||
readonly attribute long width;
|
||||
readonly attribute long height;
|
||||
void persist(in DOMString id, in DOMString attr);
|
||||
readonly attribute HTMLCollection controls;
|
||||
};
|
||||
|
|
|
@ -754,10 +754,8 @@ enum nsDOMProp {
|
|||
NS_DOM_PROP_NSDOCUMENT_CHARACTERSET,
|
||||
NS_DOM_PROP_NSDOCUMENT_CREATEELEMENTWITHNAMESPACE,
|
||||
NS_DOM_PROP_NSDOCUMENT_CREATERANGE,
|
||||
NS_DOM_PROP_NSDOCUMENT_HEIGHT,
|
||||
NS_DOM_PROP_NSDOCUMENT_LOAD,
|
||||
NS_DOM_PROP_NSDOCUMENT_PLUGINS,
|
||||
NS_DOM_PROP_NSDOCUMENT_WIDTH,
|
||||
NS_DOM_PROP_NSHTMLANCHORELEMENT_HASH,
|
||||
NS_DOM_PROP_NSHTMLANCHORELEMENT_HOST,
|
||||
NS_DOM_PROP_NSHTMLANCHORELEMENT_HOSTNAME,
|
||||
|
@ -782,6 +780,7 @@ enum nsDOMProp {
|
|||
NS_DOM_PROP_NSHTMLDOCUMENT_EMBEDS,
|
||||
NS_DOM_PROP_NSHTMLDOCUMENT_FGCOLOR,
|
||||
NS_DOM_PROP_NSHTMLDOCUMENT_GETSELECTION,
|
||||
NS_DOM_PROP_NSHTMLDOCUMENT_HEIGHT,
|
||||
NS_DOM_PROP_NSHTMLDOCUMENT_LASTMODIFIED,
|
||||
NS_DOM_PROP_NSHTMLDOCUMENT_LAYERS,
|
||||
NS_DOM_PROP_NSHTMLDOCUMENT_LINKCOLOR,
|
||||
|
@ -791,6 +790,7 @@ enum nsDOMProp {
|
|||
NS_DOM_PROP_NSHTMLDOCUMENT_RELEASEEVENTS,
|
||||
NS_DOM_PROP_NSHTMLDOCUMENT_ROUTEEVENT,
|
||||
NS_DOM_PROP_NSHTMLDOCUMENT_VLINKCOLOR,
|
||||
NS_DOM_PROP_NSHTMLDOCUMENT_WIDTH,
|
||||
NS_DOM_PROP_NSHTMLDOCUMENT_WRITE,
|
||||
NS_DOM_PROP_NSHTMLDOCUMENT_WRITELN,
|
||||
NS_DOM_PROP_NSHTMLFORMELEMENT_ENCODING,
|
||||
|
@ -1022,9 +1022,11 @@ enum nsDOMProp {
|
|||
NS_DOM_PROP_XULDOCUMENT_CONTROLS,
|
||||
NS_DOM_PROP_XULDOCUMENT_GETELEMENTBYID,
|
||||
NS_DOM_PROP_XULDOCUMENT_GETELEMENTSBYATTRIBUTE,
|
||||
NS_DOM_PROP_XULDOCUMENT_HEIGHT,
|
||||
NS_DOM_PROP_XULDOCUMENT_PERSIST,
|
||||
NS_DOM_PROP_XULDOCUMENT_POPUPNODE,
|
||||
NS_DOM_PROP_XULDOCUMENT_TOOLTIPNODE,
|
||||
NS_DOM_PROP_XULDOCUMENT_WIDTH,
|
||||
NS_DOM_PROP_XULEDITORELEMENT_EDITORSHELL,
|
||||
NS_DOM_PROP_XULELEMENT_ADDBROADCASTLISTENER,
|
||||
NS_DOM_PROP_XULELEMENT_ANONYMOUSCONTENT,
|
||||
|
|
|
@ -752,10 +752,8 @@
|
|||
"nsdocument.characterset", \
|
||||
"nsdocument.createelementwithnamespace", \
|
||||
"nsdocument.createrange", \
|
||||
"nsdocument.height", \
|
||||
"nsdocument.load", \
|
||||
"nsdocument.plugins", \
|
||||
"nsdocument.width", \
|
||||
"nshtmlanchorelement.hash", \
|
||||
"nshtmlanchorelement.host", \
|
||||
"nshtmlanchorelement.hostname", \
|
||||
|
@ -780,6 +778,7 @@
|
|||
"nshtmldocument.embeds", \
|
||||
"nshtmldocument.fgcolor", \
|
||||
"nshtmldocument.getselection", \
|
||||
"nshtmldocument.height", \
|
||||
"nshtmldocument.lastmodified", \
|
||||
"nshtmldocument.layers", \
|
||||
"nshtmldocument.linkcolor", \
|
||||
|
@ -789,6 +788,7 @@
|
|||
"nshtmldocument.releaseevents", \
|
||||
"nshtmldocument.routeevent", \
|
||||
"nshtmldocument.vlinkcolor", \
|
||||
"nshtmldocument.width", \
|
||||
"nshtmldocument.write", \
|
||||
"nshtmldocument.writeln", \
|
||||
"nshtmlformelement.encoding", \
|
||||
|
@ -1020,9 +1020,11 @@
|
|||
"xuldocument.controls", \
|
||||
"xuldocument.getelementbyid", \
|
||||
"xuldocument.getelementsbyattribute", \
|
||||
"xuldocument.height", \
|
||||
"xuldocument.persist", \
|
||||
"xuldocument.popupnode", \
|
||||
"xuldocument.tooltipnode", \
|
||||
"xuldocument.width", \
|
||||
"xuleditorelement.editorshell", \
|
||||
"xulelement.addbroadcastlistener", \
|
||||
"xulelement.anonymouscontent", \
|
||||
|
|
|
@ -50,6 +50,10 @@ public:
|
|||
|
||||
NS_IMETHOD GetCommandDispatcher(nsIDOMXULCommandDispatcher** aCommandDispatcher)=0;
|
||||
|
||||
NS_IMETHOD GetWidth(PRInt32* aWidth)=0;
|
||||
|
||||
NS_IMETHOD GetHeight(PRInt32* aHeight)=0;
|
||||
|
||||
NS_IMETHOD GetControls(nsIDOMHTMLCollection** aControls)=0;
|
||||
|
||||
NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn)=0;
|
||||
|
@ -64,6 +68,8 @@ public:
|
|||
NS_IMETHOD GetTooltipNode(nsIDOMNode** aTooltipNode); \
|
||||
NS_IMETHOD SetTooltipNode(nsIDOMNode* aTooltipNode); \
|
||||
NS_IMETHOD GetCommandDispatcher(nsIDOMXULCommandDispatcher** aCommandDispatcher); \
|
||||
NS_IMETHOD GetWidth(PRInt32* aWidth); \
|
||||
NS_IMETHOD GetHeight(PRInt32* aHeight); \
|
||||
NS_IMETHOD GetControls(nsIDOMHTMLCollection** aControls); \
|
||||
NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn); \
|
||||
NS_IMETHOD Persist(const nsString& aId, const nsString& aAttr); \
|
||||
|
@ -76,6 +82,8 @@ public:
|
|||
NS_IMETHOD GetTooltipNode(nsIDOMNode** aTooltipNode) { return _to GetTooltipNode(aTooltipNode); } \
|
||||
NS_IMETHOD SetTooltipNode(nsIDOMNode* aTooltipNode) { return _to SetTooltipNode(aTooltipNode); } \
|
||||
NS_IMETHOD GetCommandDispatcher(nsIDOMXULCommandDispatcher** aCommandDispatcher) { return _to GetCommandDispatcher(aCommandDispatcher); } \
|
||||
NS_IMETHOD GetWidth(PRInt32* aWidth) { return _to GetWidth(aWidth); } \
|
||||
NS_IMETHOD GetHeight(PRInt32* aHeight) { return _to GetHeight(aHeight); } \
|
||||
NS_IMETHOD GetControls(nsIDOMHTMLCollection** aControls) { return _to GetControls(aControls); } \
|
||||
NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn) { return _to GetElementsByAttribute(aName, aValue, aReturn); } \
|
||||
NS_IMETHOD Persist(const nsString& aId, const nsString& aAttr) { return _to Persist(aId, aAttr); } \
|
||||
|
|
|
@ -39,7 +39,6 @@ CPPSRCS = \
|
|||
nsJSDocument.cpp \
|
||||
nsJSDocumentFragment.cpp \
|
||||
nsJSDocumentType.cpp \
|
||||
nsJSDocumentView.cpp \
|
||||
nsJSElement.cpp \
|
||||
nsJSEntity.cpp \
|
||||
nsJSEntityReference.cpp \
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
#!nmake
|
||||
#
|
||||
# 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=..\..\..
|
||||
|
||||
|
||||
LIBRARY_NAME=jsdomcore_s
|
||||
MODULE=raptor
|
||||
DEFINES=-D_IMPL_NS_DOM -DWIN32_LEAN_AND_MEAN
|
||||
|
||||
CPPSRCS = \
|
||||
nsJSAttr.cpp \
|
||||
nsJSCDATASection.cpp \
|
||||
nsJSComment.cpp \
|
||||
nsJSDOMImplementation.cpp \
|
||||
nsJSCharacterData.cpp \
|
||||
nsJSDocument.cpp \
|
||||
nsJSDocumentFragment.cpp \
|
||||
nsJSDocumentType.cpp \
|
||||
nsJSDocumentView.cpp \
|
||||
nsJSElement.cpp \
|
||||
nsJSEntity.cpp \
|
||||
nsJSEntityReference.cpp \
|
||||
nsJSMediaList.cpp \
|
||||
nsJSNamedNodeMap.cpp \
|
||||
nsJSNode.cpp \
|
||||
nsJSNodeList.cpp \
|
||||
nsJSNotation.cpp \
|
||||
nsJSProcessingInstruction.cpp \
|
||||
nsJSStyleSheet.cpp \
|
||||
nsJSStyleSheetList.cpp \
|
||||
nsJSText.cpp \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsJSAttr.obj \
|
||||
.\$(OBJDIR)\nsJSCDATASection.obj \
|
||||
.\$(OBJDIR)\nsJSComment.obj \
|
||||
.\$(OBJDIR)\nsJSDOMImplementation.obj \
|
||||
.\$(OBJDIR)\nsJSCharacterData.obj \
|
||||
.\$(OBJDIR)\nsJSDocument.obj \
|
||||
.\$(OBJDIR)\nsJSDocumentFragment.obj \
|
||||
.\$(OBJDIR)\nsJSDocumentType.obj \
|
||||
.\$(OBJDIR)\nsJSDocumentView.obj \
|
||||
.\$(OBJDIR)\nsJSElement.obj \
|
||||
.\$(OBJDIR)\nsJSEntity.obj \
|
||||
.\$(OBJDIR)\nsJSEntityReference.obj \
|
||||
.\$(OBJDIR)\nsJSMediaList.obj \
|
||||
.\$(OBJDIR)\nsJSNamedNodeMap.obj \
|
||||
.\$(OBJDIR)\nsJSNode.obj \
|
||||
.\$(OBJDIR)\nsJSNodeList.obj \
|
||||
.\$(OBJDIR)\nsJSNotation.obj \
|
||||
.\$(OBJDIR)\nsJSProcessingInstruction.obj \
|
||||
.\$(OBJDIR)\nsJSStyleSheet.obj \
|
||||
.\$(OBJDIR)\nsJSStyleSheetList.obj \
|
||||
.\$(OBJDIR)\nsJSText.obj \
|
||||
$(NULL)
|
||||
|
||||
|
||||
LINCS=-I$(XPDIST)\public\xpcom -I$(XPDIST)\public\raptor \
|
||||
-I$(XPDIST)\public\dom -I$(XPDIST)\public\js -I$(PUBLIC)\netlib
|
||||
|
||||
LCFLAGS = \
|
||||
$(LCFLAGS) \
|
||||
$(DEFINES) \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
|
@ -99,10 +99,8 @@ enum Document_slots {
|
|||
DOCUMENT_DOCUMENTELEMENT = -3,
|
||||
DOCUMENTSTYLE_STYLESHEETS = -4,
|
||||
DOCUMENTVIEW_DEFAULTVIEW = -5,
|
||||
NSDOCUMENT_WIDTH = -6,
|
||||
NSDOCUMENT_HEIGHT = -7,
|
||||
NSDOCUMENT_CHARACTERSET = -8,
|
||||
NSDOCUMENT_PLUGINS = -9
|
||||
NSDOCUMENT_CHARACTERSET = -6,
|
||||
NSDOCUMENT_PLUGINS = -7
|
||||
};
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -204,44 +202,6 @@ GetDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case NSDOCUMENT_WIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSDOCUMENT_WIDTH, PR_FALSE);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
nsIDOMNSDocument* b;
|
||||
if (NS_OK == a->QueryInterface(kINSDocumentIID, (void **)&b)) {
|
||||
rv = b->GetWidth(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NSDOCUMENT_HEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSDOCUMENT_HEIGHT, PR_FALSE);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
nsIDOMNSDocument* b;
|
||||
if (NS_OK == a->QueryInterface(kINSDocumentIID, (void **)&b)) {
|
||||
rv = b->GetHeight(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NSDOCUMENT_CHARACTERSET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSDOCUMENT_CHARACTERSET, PR_FALSE);
|
||||
|
@ -1388,8 +1348,6 @@ static JSPropertySpec DocumentProperties[] =
|
|||
{"documentElement", DOCUMENT_DOCUMENTELEMENT, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"styleSheets", DOCUMENTSTYLE_STYLESHEETS, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"defaultView", DOCUMENTVIEW_DEFAULTVIEW, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"width", NSDOCUMENT_WIDTH, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"height", NSDOCUMENT_HEIGHT, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"characterSet", NSDOCUMENT_CHARACTERSET, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"plugins", NSDOCUMENT_PLUGINS, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{0}
|
||||
|
|
|
@ -67,13 +67,15 @@ enum HTMLDocument_slots {
|
|||
HTMLDOCUMENT_FORMS = -9,
|
||||
HTMLDOCUMENT_ANCHORS = -10,
|
||||
HTMLDOCUMENT_COOKIE = -11,
|
||||
NSHTMLDOCUMENT_ALINKCOLOR = -12,
|
||||
NSHTMLDOCUMENT_LINKCOLOR = -13,
|
||||
NSHTMLDOCUMENT_VLINKCOLOR = -14,
|
||||
NSHTMLDOCUMENT_BGCOLOR = -15,
|
||||
NSHTMLDOCUMENT_FGCOLOR = -16,
|
||||
NSHTMLDOCUMENT_LASTMODIFIED = -17,
|
||||
NSHTMLDOCUMENT_EMBEDS = -18
|
||||
NSHTMLDOCUMENT_WIDTH = -12,
|
||||
NSHTMLDOCUMENT_HEIGHT = -13,
|
||||
NSHTMLDOCUMENT_ALINKCOLOR = -14,
|
||||
NSHTMLDOCUMENT_LINKCOLOR = -15,
|
||||
NSHTMLDOCUMENT_VLINKCOLOR = -16,
|
||||
NSHTMLDOCUMENT_BGCOLOR = -17,
|
||||
NSHTMLDOCUMENT_FGCOLOR = -18,
|
||||
NSHTMLDOCUMENT_LASTMODIFIED = -19,
|
||||
NSHTMLDOCUMENT_EMBEDS = -20
|
||||
};
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -236,6 +238,44 @@ GetHTMLDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case NSHTMLDOCUMENT_WIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLDOCUMENT_WIDTH, PR_FALSE);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
nsIDOMNSHTMLDocument* b;
|
||||
if (NS_OK == a->QueryInterface(kINSHTMLDocumentIID, (void **)&b)) {
|
||||
rv = b->GetWidth(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NSHTMLDOCUMENT_HEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLDOCUMENT_HEIGHT, PR_FALSE);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
nsIDOMNSHTMLDocument* b;
|
||||
if (NS_OK == a->QueryInterface(kINSHTMLDocumentIID, (void **)&b)) {
|
||||
rv = b->GetHeight(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NSHTMLDOCUMENT_ALINKCOLOR:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLDOCUMENT_ALINKCOLOR, PR_FALSE);
|
||||
|
@ -1120,6 +1160,8 @@ static JSPropertySpec HTMLDocumentProperties[] =
|
|||
{"forms", HTMLDOCUMENT_FORMS, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"anchors", HTMLDOCUMENT_ANCHORS, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"cookie", HTMLDOCUMENT_COOKIE, JSPROP_ENUMERATE},
|
||||
{"width", NSHTMLDOCUMENT_WIDTH, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"height", NSHTMLDOCUMENT_HEIGHT, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"alinkColor", NSHTMLDOCUMENT_ALINKCOLOR, JSPROP_ENUMERATE},
|
||||
{"linkColor", NSHTMLDOCUMENT_LINKCOLOR, JSPROP_ENUMERATE},
|
||||
{"vlinkColor", NSHTMLDOCUMENT_VLINKCOLOR, JSPROP_ENUMERATE},
|
||||
|
|
|
@ -57,7 +57,9 @@ enum XULDocument_slots {
|
|||
XULDOCUMENT_POPUPNODE = -1,
|
||||
XULDOCUMENT_TOOLTIPNODE = -2,
|
||||
XULDOCUMENT_COMMANDDISPATCHER = -3,
|
||||
XULDOCUMENT_CONTROLS = -4
|
||||
XULDOCUMENT_WIDTH = -4,
|
||||
XULDOCUMENT_HEIGHT = -5,
|
||||
XULDOCUMENT_CONTROLS = -6
|
||||
};
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -119,6 +121,30 @@ GetXULDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case XULDOCUMENT_WIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULDOCUMENT_WIDTH, PR_FALSE);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetWidth(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XULDOCUMENT_HEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULDOCUMENT_HEIGHT, PR_FALSE);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetHeight(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XULDOCUMENT_CONTROLS:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULDOCUMENT_CONTROLS, PR_FALSE);
|
||||
|
@ -358,6 +384,8 @@ static JSPropertySpec XULDocumentProperties[] =
|
|||
{"popupNode", XULDOCUMENT_POPUPNODE, JSPROP_ENUMERATE},
|
||||
{"tooltipNode", XULDOCUMENT_TOOLTIPNODE, JSPROP_ENUMERATE},
|
||||
{"commandDispatcher", XULDOCUMENT_COMMANDDISPATCHER, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"width", XULDOCUMENT_WIDTH, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"height", XULDOCUMENT_HEIGHT, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"controls", XULDOCUMENT_CONTROLS, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{0}
|
||||
};
|
||||
|
|
|
@ -2435,112 +2435,6 @@ nsDocument::GetDefaultView(nsIDOMAbstractView** aDefaultView)
|
|||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsDocument::GetPixelDimensions(nsIPresShell* aShell,
|
||||
PRInt32* aWidth,
|
||||
PRInt32* aHeight)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsSize size;
|
||||
nsIFrame* frame;
|
||||
|
||||
result = FlushPendingNotifications();
|
||||
if (NS_FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = aShell->GetPrimaryFrameFor(mRootContent, &frame);
|
||||
if (NS_SUCCEEDED(result) && frame) {
|
||||
nsIView* view;
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
|
||||
aShell->GetPresContext(getter_AddRefs(presContext));
|
||||
result = frame->GetView(presContext, &view);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// If we have a view check if it's scrollable. If not,
|
||||
// just use the view size itself
|
||||
if (view) {
|
||||
nsIScrollableView* scrollableView;
|
||||
|
||||
if (NS_SUCCEEDED(view->QueryInterface(NS_GET_IID(nsIScrollableView), (void**)&scrollableView))) {
|
||||
scrollableView->GetScrolledView(view);
|
||||
}
|
||||
|
||||
result = view->GetDimensions(&size.width, &size.height);
|
||||
}
|
||||
// If we don't have a view, use the frame size
|
||||
else {
|
||||
result = frame->GetSize(size);
|
||||
}
|
||||
}
|
||||
|
||||
// Convert from twips to pixels
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
|
||||
result = aShell->GetPresContext(getter_AddRefs(context));
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
float scale;
|
||||
context->GetTwipsToPixels(&scale);
|
||||
|
||||
*aWidth = NSTwipsToIntPixels(size.width, scale);
|
||||
*aHeight = NSTwipsToIntPixels(size.height, scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
*aWidth = 0;
|
||||
*aHeight = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetWidth(PRInt32* aWidth)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aWidth);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
// We make the assumption that the first presentation shell
|
||||
// is the one for which we need information.
|
||||
shell = getter_AddRefs(GetShellAt(0));
|
||||
if (shell) {
|
||||
PRInt32 width, height;
|
||||
|
||||
result = GetPixelDimensions(shell, &width, &height);
|
||||
*aWidth = width;
|
||||
} else
|
||||
*aWidth = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetHeight(PRInt32* aHeight)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aHeight);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
// We make the assumption that the first presentation shell
|
||||
// is the one for which we need information.
|
||||
shell = getter_AddRefs(GetShellAt(0));
|
||||
if (shell) {
|
||||
PRInt32 width, height;
|
||||
|
||||
result = GetPixelDimensions(shell, &width, &height);
|
||||
*aHeight = height;
|
||||
} else
|
||||
*aHeight = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::Load (const nsString& aUrl)
|
||||
{
|
||||
|
|
|
@ -397,8 +397,6 @@ public:
|
|||
const nsString& aNameSpace,
|
||||
nsIDOMElement** aReturn);
|
||||
NS_IMETHOD CreateRange(nsIDOMRange** aReturn);
|
||||
NS_IMETHOD GetWidth(PRInt32* aWidth);
|
||||
NS_IMETHOD GetHeight(PRInt32* aHeight);
|
||||
NS_IMETHOD Load (const nsString& aUrl);
|
||||
NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins);
|
||||
|
||||
|
@ -476,10 +474,6 @@ protected:
|
|||
const nsIContent* aTest1,
|
||||
const nsIContent* aTest2) const;
|
||||
|
||||
nsresult GetPixelDimensions(nsIPresShell* aShell,
|
||||
PRInt32* aWidth,
|
||||
PRInt32* aHeight);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void InternalAddStyleSheet(nsIStyleSheet* aSheet); // subclass hooks for sheet ordering
|
||||
|
|
|
@ -2303,6 +2303,117 @@ nsHTMLDocument::GetElementsByName(const nsString& aElementName,
|
|||
return elements->QueryInterface(kIDOMNodeListIID, (void**)aReturn);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLDocument::GetPixelDimensions(nsIPresShell* aShell,
|
||||
PRInt32* aWidth,
|
||||
PRInt32* aHeight)
|
||||
{
|
||||
*aWidth = *aHeight = 0;
|
||||
|
||||
nsresult result;
|
||||
result = FlushPendingNotifications();
|
||||
if (NS_FAILED(result))
|
||||
return NS_OK;
|
||||
|
||||
// Find the <body> element: this is what we'll want to use for the
|
||||
// document's width and height values.
|
||||
if (mBodyContent == nsnull && PR_FALSE == GetBodyContent()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> body = do_QueryInterface(mBodyContent);
|
||||
|
||||
// Now grab its frame
|
||||
nsIFrame* frame;
|
||||
result = aShell->GetPrimaryFrameFor(body, &frame);
|
||||
if (NS_SUCCEEDED(result) && frame) {
|
||||
nsSize size;
|
||||
nsIView* view;
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
|
||||
aShell->GetPresContext(getter_AddRefs(presContext));
|
||||
result = frame->GetView(presContext, &view);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// If we have a view check if it's scrollable. If not,
|
||||
// just use the view size itself
|
||||
if (view) {
|
||||
nsIScrollableView* scrollableView;
|
||||
|
||||
if (NS_SUCCEEDED(view->QueryInterface(NS_GET_IID(nsIScrollableView), (void**)&scrollableView))) {
|
||||
scrollableView->GetScrolledView(view);
|
||||
}
|
||||
|
||||
result = view->GetDimensions(&size.width, &size.height);
|
||||
}
|
||||
// If we don't have a view, use the frame size
|
||||
else {
|
||||
result = frame->GetSize(size);
|
||||
}
|
||||
}
|
||||
|
||||
// Convert from twips to pixels
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
|
||||
result = aShell->GetPresContext(getter_AddRefs(context));
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
float scale;
|
||||
context->GetTwipsToPixels(&scale);
|
||||
|
||||
*aWidth = NSTwipsToIntPixels(size.width, scale);
|
||||
*aHeight = NSTwipsToIntPixels(size.height, scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetWidth(PRInt32* aWidth)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aWidth);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
// We make the assumption that the first presentation shell
|
||||
// is the one for which we need information.
|
||||
shell = getter_AddRefs(GetShellAt(0));
|
||||
if (shell) {
|
||||
PRInt32 width, height;
|
||||
|
||||
result = GetPixelDimensions(shell, &width, &height);
|
||||
*aWidth = width;
|
||||
} else
|
||||
*aWidth = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetHeight(PRInt32* aHeight)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aHeight);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
// We make the assumption that the first presentation shell
|
||||
// is the one for which we need information.
|
||||
shell = getter_AddRefs(GetShellAt(0));
|
||||
if (shell) {
|
||||
PRInt32 width, height;
|
||||
|
||||
result = GetPixelDimensions(shell, &width, &height);
|
||||
*aHeight = height;
|
||||
} else
|
||||
*aHeight = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetAlinkColor(nsString& aAlinkColor)
|
||||
{
|
||||
|
|
|
@ -147,6 +147,10 @@ public:
|
|||
|
||||
virtual nsresult Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup);
|
||||
protected:
|
||||
nsresult GetPixelDimensions(nsIPresShell* aShell,
|
||||
PRInt32* aWidth,
|
||||
PRInt32* aHeight);
|
||||
|
||||
// Find/Search Method/Data member
|
||||
PRBool SearchBlock(BlockText & aBlockText,
|
||||
nsString & aStr,
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
#
|
||||
# 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
|
||||
|
||||
MODULE = rdf
|
||||
|
||||
GLOBALIDLSRCS = \
|
||||
$(NULL)
|
||||
|
||||
IDLSRCS = \
|
||||
XULCommandDispatcher.idl \
|
||||
XULDocument.idl \
|
||||
XULElement.idl \
|
||||
XULMenuListElement.idl \
|
||||
XULTreeElement.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
|
||||
GARBAGE += genx genjs
|
||||
|
||||
genx genjs:
|
||||
-mkdir $@
|
||||
|
||||
export:: genx genjs $(IDLSRCS)
|
||||
@echo +++ make: generating xpcom headers
|
||||
$(DIST)/bin/idlc -d genx -x $(IDLSRCS)
|
||||
$(DIST)/bin/idlc -g -d genx -x $(GLOBALIDLSRCS)
|
||||
@echo +++ make: generating JavaScript stubs
|
||||
$(DIST)/bin/idlc -d genjs -j $(IDLSRCS)
|
||||
$(DIST)/bin/idlc -g -d genjs -j $(GLOBALIDLSRCS)
|
||||
|
||||
install::
|
||||
$(NSINSTALL) genx/nsIDOM*.h $(DEPTH)/rdf/content/public
|
||||
$(NSINSTALL) genjs/nsJS*.cpp $(DEPTH)/rdf/content/src
|
||||
|
|
@ -10,6 +10,8 @@ interface XULDocument : Document {
|
|||
|
||||
NodeList getElementsByAttribute(in DOMString name, in DOMString value);
|
||||
|
||||
readonly attribute long width;
|
||||
readonly attribute long height;
|
||||
void persist(in DOMString id, in DOMString attr);
|
||||
readonly attribute HTMLCollection controls;
|
||||
};
|
||||
|
|
|
@ -50,6 +50,10 @@ public:
|
|||
|
||||
NS_IMETHOD GetCommandDispatcher(nsIDOMXULCommandDispatcher** aCommandDispatcher)=0;
|
||||
|
||||
NS_IMETHOD GetWidth(PRInt32* aWidth)=0;
|
||||
|
||||
NS_IMETHOD GetHeight(PRInt32* aHeight)=0;
|
||||
|
||||
NS_IMETHOD GetControls(nsIDOMHTMLCollection** aControls)=0;
|
||||
|
||||
NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn)=0;
|
||||
|
@ -64,6 +68,8 @@ public:
|
|||
NS_IMETHOD GetTooltipNode(nsIDOMNode** aTooltipNode); \
|
||||
NS_IMETHOD SetTooltipNode(nsIDOMNode* aTooltipNode); \
|
||||
NS_IMETHOD GetCommandDispatcher(nsIDOMXULCommandDispatcher** aCommandDispatcher); \
|
||||
NS_IMETHOD GetWidth(PRInt32* aWidth); \
|
||||
NS_IMETHOD GetHeight(PRInt32* aHeight); \
|
||||
NS_IMETHOD GetControls(nsIDOMHTMLCollection** aControls); \
|
||||
NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn); \
|
||||
NS_IMETHOD Persist(const nsString& aId, const nsString& aAttr); \
|
||||
|
@ -76,6 +82,8 @@ public:
|
|||
NS_IMETHOD GetTooltipNode(nsIDOMNode** aTooltipNode) { return _to GetTooltipNode(aTooltipNode); } \
|
||||
NS_IMETHOD SetTooltipNode(nsIDOMNode* aTooltipNode) { return _to SetTooltipNode(aTooltipNode); } \
|
||||
NS_IMETHOD GetCommandDispatcher(nsIDOMXULCommandDispatcher** aCommandDispatcher) { return _to GetCommandDispatcher(aCommandDispatcher); } \
|
||||
NS_IMETHOD GetWidth(PRInt32* aWidth) { return _to GetWidth(aWidth); } \
|
||||
NS_IMETHOD GetHeight(PRInt32* aHeight) { return _to GetHeight(aHeight); } \
|
||||
NS_IMETHOD GetControls(nsIDOMHTMLCollection** aControls) { return _to GetControls(aControls); } \
|
||||
NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn) { return _to GetElementsByAttribute(aName, aValue, aReturn); } \
|
||||
NS_IMETHOD Persist(const nsString& aId, const nsString& aAttr) { return _to Persist(aId, aAttr); } \
|
||||
|
|
|
@ -57,7 +57,9 @@ enum XULDocument_slots {
|
|||
XULDOCUMENT_POPUPNODE = -1,
|
||||
XULDOCUMENT_TOOLTIPNODE = -2,
|
||||
XULDOCUMENT_COMMANDDISPATCHER = -3,
|
||||
XULDOCUMENT_CONTROLS = -4
|
||||
XULDOCUMENT_WIDTH = -4,
|
||||
XULDOCUMENT_HEIGHT = -5,
|
||||
XULDOCUMENT_CONTROLS = -6
|
||||
};
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -119,6 +121,30 @@ GetXULDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case XULDOCUMENT_WIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULDOCUMENT_WIDTH, PR_FALSE);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetWidth(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XULDOCUMENT_HEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULDOCUMENT_HEIGHT, PR_FALSE);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetHeight(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XULDOCUMENT_CONTROLS:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULDOCUMENT_CONTROLS, PR_FALSE);
|
||||
|
@ -358,6 +384,8 @@ static JSPropertySpec XULDocumentProperties[] =
|
|||
{"popupNode", XULDOCUMENT_POPUPNODE, JSPROP_ENUMERATE},
|
||||
{"tooltipNode", XULDOCUMENT_TOOLTIPNODE, JSPROP_ENUMERATE},
|
||||
{"commandDispatcher", XULDOCUMENT_COMMANDDISPATCHER, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"width", XULDOCUMENT_WIDTH, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"height", XULDOCUMENT_HEIGHT, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"controls", XULDOCUMENT_CONTROLS, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{0}
|
||||
};
|
||||
|
|
|
@ -364,8 +364,6 @@ public:
|
|||
NS_IMETHOD GetCharacterSet(nsString& aCharacterSet);
|
||||
NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, const nsString& aNameSpace, nsIDOMElement** aResult);
|
||||
NS_IMETHOD CreateRange(nsIDOMRange** aRange);
|
||||
NS_IMETHOD GetWidth(PRInt32* aWidth);
|
||||
NS_IMETHOD GetHeight(PRInt32* aHeight);
|
||||
NS_IMETHOD Load (const nsString& aUrl);
|
||||
NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче