Splitting layout into two libraries, layout and content. r=jst@netscape.com, sr=waterson@netscape.com

This commit is contained in:
heikki%netscape.com 2001-02-19 21:50:04 +00:00
Родитель 107aa654d8
Коммит fa72c631ce
103 изменённых файлов: 1865 добавлений и 6681 удалений

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

@ -102,6 +102,7 @@ DIRS += \
dom \
view \
widget \
content \
layout \
db \
rdf \

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

@ -230,6 +230,47 @@ js/src/xpconnect/tools/idl/Makefile
js/src/xpconnect/tools/idl/Makefile
"
MAKEFILES_content="
content/Makefile
content/base/Makefile
content/base/public/Makefile
content/base/src/Makefile
content/build/Makefile
content/events/Makefile
content/events/public/Makefile
content/events/src/Makefile
content/html/Makefile
content/html/base/Makefile
content/html/base/src/Makefile
content/html/content/Makefile
content/html/content/public/Makefile
content/html/content/src/Makefile
content/html/document/Makefile
content/html/document/public/Makefile
content/html/document/src/Makefile
content/html/style/Makefile
content/html/style/public/Makefile
content/html/style/src/Makefile
content/xml/Makefile
content/xml/content/Makefile
content/xml/content/public/Makefile
content/xml/content/src/Makefile
content/xml/document/Makefile
content/xml/document/public/Makefile
content/xml/document/src/Makefile
content/xul/Makefile
content/xul/content/Makefile
content/xul/content/src/Makefile
content/xbl/Makefile
content/xbl/public/Makefile
content/xbl/src/Makefile
content/xbl/builtin/Makefile
content/xbl/builtin/os2/Makefile
content/xsl/Makefile
content/xsl/document/Makefile
content/xsl/document/src/Makefile
"
MAKEFILES_layout="
layout/Makefile
layout/base/Makefile
@ -237,17 +278,10 @@ layout/base/public/Makefile
layout/base/src/Makefile
layout/base/tests/Makefile
layout/build/Makefile
layout/events/Makefile
layout/events/public/Makefile
layout/events/src/Makefile
layout/html/Makefile
layout/html/base/Makefile
layout/html/base/src/Makefile
layout/html/content/Makefile
layout/html/content/public/Makefile
layout/html/content/src/Makefile
layout/html/document/Makefile
layout/html/document/public/Makefile
layout/html/document/src/Makefile
layout/html/forms/Makefile
layout/html/forms/public/Makefile
@ -260,27 +294,12 @@ layout/html/table/public/Makefile
layout/html/table/src/Makefile
layout/html/tests/Makefile
layout/tools/Makefile
layout/xml/Makefile
layout/xml/content/Makefile
layout/xml/content/public/Makefile
layout/xml/content/src/Makefile
layout/xml/document/Makefile
layout/xml/document/public/Makefile
layout/xml/document/src/Makefile
layout/xul/Makefile
layout/xul/base/Makefile
layout/xul/base/public/Makefile
layout/xul/base/src/Makefile
layout/xul/content/Makefile
layout/xul/content/src/Makefile
layout/xbl/Makefile
layout/xbl/public/Makefile
layout/xbl/src/Makefile
layout/xbl/builtin/Makefile
layout/xbl/builtin/os2/Makefile
layout/xsl/Makefile
layout/xsl/document/Makefile
layout/xsl/document/src/Makefile
"
MAKEFILES_mpfilelocprovider="
@ -986,6 +1005,7 @@ $MAKEFILES_js
$MAKEFILES_l10n
$MAKEFILES_l10n_lang
$MAKEFILES_langpacks
$MAKEFILES_content
$MAKEFILES_layout
$MAKEFILES_libreg
$MAKEFILES_libimg

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

@ -25,7 +25,7 @@
#include "nscore.h"
#include "nsCoord.h"
#include "nsCRT.h"
class nsString;
#include "nsString.h"
enum nsStyleUnit {
eStyleUnit_Null = 0, // (no value) value is not specified
@ -48,15 +48,86 @@ typedef union {
class nsStyleCoord {
public:
nsStyleCoord(nsStyleUnit aUnit = eStyleUnit_Null);
nsStyleCoord(nscoord aValue);
nsStyleCoord(PRInt32 aValue, nsStyleUnit aUnit);
nsStyleCoord(float aValue, nsStyleUnit aUnit);
nsStyleCoord(const nsStyleCoord& aCopy);
nsStyleCoord(nsStyleUnit aUnit = eStyleUnit_Null)
: mUnit(aUnit) {
NS_ASSERTION(aUnit < eStyleUnit_Percent, "not a valueless unit");
if (aUnit >= eStyleUnit_Percent) {
mUnit = eStyleUnit_Null;
}
mValue.mInt = 0;
}
nsStyleCoord& operator=(const nsStyleCoord& aCopy);
PRBool operator==(const nsStyleCoord& aOther) const;
PRBool operator!=(const nsStyleCoord& aOther) const;
nsStyleCoord(nscoord aValue)
: mUnit(eStyleUnit_Coord) {
mValue.mInt = aValue;
}
nsStyleCoord(PRInt32 aValue, nsStyleUnit aUnit)
: mUnit(aUnit) {
//if you want to pass in eStyleUnit_Coord, don't. instead, use the
//constructor just above this one... MMP
NS_ASSERTION((aUnit == eStyleUnit_Proportional) ||
(aUnit == eStyleUnit_Enumerated) ||
(aUnit == eStyleUnit_Integer), "not an int value");
if ((aUnit == eStyleUnit_Proportional) ||
(aUnit == eStyleUnit_Enumerated) ||
(aUnit == eStyleUnit_Integer)) {
mValue.mInt = aValue;
}
else {
mUnit = eStyleUnit_Null;
mValue.mInt = 0;
}
}
nsStyleCoord(float aValue, nsStyleUnit aUnit)
: mUnit(aUnit) {
NS_ASSERTION((aUnit == eStyleUnit_Percent) ||
(aUnit == eStyleUnit_Factor), "not a float value");
if ((aUnit == eStyleUnit_Percent) ||
(aUnit == eStyleUnit_Factor)) {
mValue.mFloat = aValue;
}
else {
mUnit = eStyleUnit_Null;
mValue.mInt = 0;
}
}
nsStyleCoord(const nsStyleCoord& aCopy)
: mUnit(aCopy.mUnit) {
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
mValue.mFloat = aCopy.mValue.mFloat;
}
else {
mValue.mInt = aCopy.mValue.mInt;
}
}
nsStyleCoord& operator=(const nsStyleCoord& aCopy) {
mUnit = aCopy.mUnit;
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
mValue.mFloat = aCopy.mValue.mFloat;
}
else {
mValue.mInt = aCopy.mValue.mInt;
}
return *this;
}
PRBool operator==(const nsStyleCoord& aOther) const {
if (mUnit == aOther.mUnit) {
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
return PRBool(mValue.mFloat == aOther.mValue.mFloat);
}
else {
return PRBool(mValue.mInt == aOther.mValue.mInt);
}
}
return PR_FALSE;
}
PRBool operator!=(const nsStyleCoord& aOther) const;
nsStyleUnit GetUnit(void) const { return mUnit; }
nscoord GetCoordValue(void) const;
@ -65,18 +136,98 @@ public:
float GetFactorValue(void) const;
void GetUnionValue(nsStyleUnion& aValue) const;
void Reset(void); // sets to null
void SetCoordValue(nscoord aValue);
void SetIntValue(PRInt32 aValue, nsStyleUnit aUnit);
void SetPercentValue(float aValue);
void SetFactorValue(float aValue);
void SetNormalValue(void);
void SetAutoValue(void);
void SetInheritValue(void);
void SetUnionValue(const nsStyleUnion& aValue, nsStyleUnit aUnit);
void Reset(void) {
mUnit = eStyleUnit_Null;
mValue.mInt = 0;
}
void AppendToString(nsString& aBuffer) const;
void ToString(nsString& aBuffer) const;
void SetCoordValue(nscoord aValue) {
mUnit = eStyleUnit_Coord;
mValue.mInt = aValue;
}
void SetIntValue(PRInt32 aValue, nsStyleUnit aUnit) {
if ((aUnit == eStyleUnit_Proportional) ||
(aUnit == eStyleUnit_Enumerated) ||
(aUnit == eStyleUnit_Chars) ||
(aUnit == eStyleUnit_Integer)) {
mUnit = aUnit;
mValue.mInt = aValue;
}
else {
NS_WARNING("not an int value");
Reset();
}
}
void SetPercentValue(float aValue) {
mUnit = eStyleUnit_Percent;
mValue.mFloat = aValue;
}
void SetFactorValue(float aValue) {
mUnit = eStyleUnit_Factor;
mValue.mFloat = aValue;
}
void SetNormalValue(void) {
mUnit = eStyleUnit_Normal;
mValue.mInt = 0;
}
void SetAutoValue(void) {
mUnit = eStyleUnit_Auto;
mValue.mInt = 0;
}
void SetInheritValue(void) {
mUnit = eStyleUnit_Inherit;
mValue.mInt = 0;
}
void SetUnionValue(const nsStyleUnion& aValue, nsStyleUnit aUnit) {
mUnit = aUnit;
#if PR_BYTES_PER_INT == PR_BYTES_PER_FLOAT
mValue.mInt = aValue.mInt;
#else
nsCRT::memcpy(&mValue, &aValue, sizeof(nsStyleUnion));
#endif
}
void AppendToString(nsString& aBuffer) const {
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
aBuffer.AppendFloat(mValue.mFloat);
}
else if ((eStyleUnit_Coord == mUnit) ||
(eStyleUnit_Proportional == mUnit) ||
(eStyleUnit_Enumerated == mUnit) ||
(eStyleUnit_Integer == mUnit)) {
aBuffer.AppendInt(mValue.mInt, 10);
aBuffer.AppendWithConversion("[0x");
aBuffer.AppendInt(mValue.mInt, 16);
aBuffer.AppendWithConversion(']');
}
switch (mUnit) {
case eStyleUnit_Null: aBuffer.AppendWithConversion("Null"); break;
case eStyleUnit_Coord: aBuffer.AppendWithConversion("tw"); break;
case eStyleUnit_Percent: aBuffer.AppendWithConversion("%"); break;
case eStyleUnit_Factor: aBuffer.AppendWithConversion("f"); break;
case eStyleUnit_Normal: aBuffer.AppendWithConversion("Normal"); break;
case eStyleUnit_Auto: aBuffer.AppendWithConversion("Auto"); break;
case eStyleUnit_Inherit: aBuffer.AppendWithConversion("Inherit"); break;
case eStyleUnit_Proportional: aBuffer.AppendWithConversion("*"); break;
case eStyleUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break;
case eStyleUnit_Integer: aBuffer.AppendWithConversion("int"); break;
case eStyleUnit_Chars: aBuffer.AppendWithConversion("chars"); break;
}
aBuffer.AppendWithConversion(' ');
}
void ToString(nsString& aBuffer) const {
aBuffer.Truncate();
AppendToString(aBuffer);
}
public:
nsStyleUnit mUnit;
@ -84,12 +235,38 @@ public:
};
#define COMPARE_SIDE(side) \
if ((eStyleUnit_Percent <= m##side##Unit) && \
(m##side##Unit < eStyleUnit_Coord)) { \
if (m##side##Value.mFloat != aOther.m##side##Value.mFloat) \
return PR_FALSE; \
} \
else { \
if (m##side##Value.mInt != aOther.m##side##Value.mInt) \
return PR_FALSE; \
}
class nsStyleSides {
public:
nsStyleSides(void);
nsStyleSides(void) {
nsCRT::memset(this, 0x00, sizeof(nsStyleSides));
}
// nsStyleSides& operator=(const nsStyleSides& aCopy); // use compiler's version
PRBool operator==(const nsStyleSides& aOther) const;
PRBool operator==(const nsStyleSides& aOther) const {
if ((mLeftUnit == aOther.mLeftUnit) &&
(mTopUnit == aOther.mTopUnit) &&
(mRightUnit == aOther.mRightUnit) &&
(mBottomUnit == aOther.mBottomUnit)) {
COMPARE_SIDE(Left);
COMPARE_SIDE(Top);
COMPARE_SIDE(Right);
COMPARE_SIDE(Bottom);
return PR_TRUE;
}
return PR_FALSE;
}
PRBool operator!=(const nsStyleSides& aOther) const;
nsStyleUnit GetLeftUnit(void) const;
@ -102,14 +279,39 @@ public:
nsStyleCoord& GetRight(nsStyleCoord& aCoord) const;
nsStyleCoord& GetBottom(nsStyleCoord& aCoord) const;
void Reset(void);
void Reset(void) {
nsCRT::memset(this, 0x00, sizeof(nsStyleSides));
}
void SetLeft(const nsStyleCoord& aCoord);
void SetTop(const nsStyleCoord& aCoord);
void SetRight(const nsStyleCoord& aCoord);
void SetBottom(const nsStyleCoord& aCoord);
void AppendToString(nsString& aBuffer) const;
void ToString(nsString& aBuffer) const;
void AppendToString(nsString& aBuffer) const {
nsStyleCoord temp;
GetLeft(temp);
aBuffer.AppendWithConversion("left: ");
temp.AppendToString(aBuffer);
GetTop(temp);
aBuffer.AppendWithConversion("top: ");
temp.AppendToString(aBuffer);
GetRight(temp);
aBuffer.AppendWithConversion("right: ");
temp.AppendToString(aBuffer);
GetBottom(temp);
aBuffer.AppendWithConversion("bottom: ");
temp.AppendToString(aBuffer);
}
void ToString(nsString& aBuffer) const {
aBuffer.Truncate();
AppendToString(aBuffer);
}
protected:
PRUint8 mLeftUnit;

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

@ -25,6 +25,8 @@
#include "nsString.h"
#include "nsINameSpaceManager.h"
#include "nsXULAtoms.h"
#include "nsContentCID.h"
static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
static const char kXULNameSpace[] = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
@ -45,7 +47,7 @@ void nsXULAtoms::AddRefAtoms() {
/* XUL Atoms registers the XUL name space ID because it's a convenient
place to do this, if you don't want a permanent, "well-known" ID.
*/
if (NS_SUCCEEDED(NS_NewNameSpaceManager(&gNameSpaceManager))) {
if (NS_SUCCEEDED(nsComponentManager::CreateInstance(kNameSpaceManagerCID,nsnull,NS_GET_IID(nsINameSpaceManager),(void**)&gNameSpaceManager))) {
// gNameSpaceManager->CreateRootNameSpace(namespace);
nsAutoString nameSpace; nameSpace.AssignWithConversion(kXULNameSpace);
gNameSpaceManager->RegisterNameSpace(nameSpace, nameSpaceID);

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

@ -101,6 +101,7 @@
#include "nsIXULTemplateBuilder.h"
#include "nsIXBLService.h"
#include "nsLayoutCID.h"
#include "nsContentCID.h"
#include "nsRDFCID.h"
#include "nsRDFDOMNodeList.h"
#include "nsStyleConsts.h"

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

@ -106,6 +106,7 @@
#include "nsIXULPrototypeCache.h"
#include "nsLWBrkCIID.h"
#include "nsLayoutCID.h"
#include "nsContentCID.h"
#include "nsNetUtil.h"
#include "nsParserCIID.h"
#include "nsPIBoxObject.h"

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

@ -29,6 +29,7 @@
#include "nsIPresShell.h"
#include "nsIPresContext.h"
#include "nsLayoutCID.h"
#include "nsContentCID.h"
#include "nsIEventStateManager.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMWindowInternal.h"

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

@ -26,7 +26,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = base html xml xul xbl xsl
DIRS = base html xul
ifdef MOZ_MATHML
DIRS += mathml
@ -36,7 +36,7 @@ ifdef MOZ_SVG
DIRS += svg
endif
DIRS += events build
DIRS += build
ifdef ENABLE_TESTS
DIRS += html/tests

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

@ -28,9 +28,5 @@ include $(DEPTH)/config/autoconf.mk
DIRS = public src
#ifdef ENABLE_TESTS
#DIRS += tests
#endif
include $(topsrcdir)/config/rules.mk

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

@ -37,7 +37,6 @@
#include "nsIPresContext.h"
#include "nsILinkHandler.h"
#include "nsIDocument.h"
#include "nsIHTMLTableCellElement.h"
#include "nsTableColGroupFrame.h"
#include "nsTableColFrame.h"
#include "nsHTMLIIDs.h"
@ -80,6 +79,13 @@
#include "nsBoxLayoutState.h"
#include "nsIBindingManager.h"
#include "nsIXBLBinding.h"
#include "nsIElementFactory.h"
#include "nsContentCID.h"
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
static NS_DEFINE_CID(kHTMLImageElementCID, NS_HTMLIMAGEELEMENT_CID);
static NS_DEFINE_CID(kAttributeContentCID, NS_ATTRIBUTECONTENT_CID);
#include "nsIDOMWindowInternal.h"
#include "nsPIDOMWindow.h"
@ -859,6 +865,22 @@ PRBool GetCaptionAdjustedParent(nsIFrame* aParentFrame,
return haveCaption;
}
nsresult NS_CreateCSSFrameConstructor(nsICSSFrameConstructor **aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = nsnull;
nsCSSFrameConstructor *c = new nsCSSFrameConstructor();
if (!c)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(c);
nsresult rv = c->QueryInterface(NS_GET_IID(nsICSSFrameConstructor),(void**)aResult);
NS_RELEASE(c);
return rv;
}
nsCSSFrameConstructor::nsCSSFrameConstructor(void)
: nsIStyleFrameConstruction(),
mDocument(nsnull),
@ -886,7 +908,7 @@ nsCSSFrameConstructor::~nsCSSFrameConstructor(void)
{
}
NS_IMPL_ISUPPORTS(nsCSSFrameConstructor, kIStyleFrameConstructionIID);
NS_IMPL_ISUPPORTS2(nsCSSFrameConstructor, nsIStyleFrameConstruction,nsICSSFrameConstructor);
NS_IMETHODIMP
nsCSSFrameConstructor::Init(nsIDocument* aDocument)
@ -1268,8 +1290,6 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex
aPresContext->GetShell(getter_AddRefs(shell));
if (eStyleContentType_URL == type) {
nsIHTMLContent* imageContent;
// Create an HTML image content object, and set the SRC.
// XXX Check if it's an image type we can handle...
@ -1281,7 +1301,16 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex
nimgr->GetNodeInfo(nsHTMLAtoms::img, nsnull, kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
NS_NewHTMLImageElement(&imageContent, nodeInfo);
nsCOMPtr<nsIElementFactory> ef(do_CreateInstance(kHTMLElementFactoryCID,&rv));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIContent> content;
rv = ef->CreateInstanceByTag(nodeInfo,getter_AddRefs(content));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIHTMLContent> imageContent(do_QueryInterface(content,&rv));
NS_ENSURE_SUCCESS(rv, rv);
imageContent->SetHTMLAttribute(nsHTMLAtoms::src, contentString, PR_FALSE);
// Set aContent as the parent content and set the document object. This
@ -1293,7 +1322,6 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex
nsIFrame* imageFrame;
NS_NewImageFrame(shell, &imageFrame);
imageFrame->Init(aPresContext, imageContent, aParentFrame, aStyleContext, nsnull);
NS_RELEASE(imageContent);
// Return the image frame
*aFrame = imageFrame;
@ -1326,10 +1354,9 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex
// Creates the content and frame and return if successful
nsresult rv = NS_ERROR_FAILURE;
if (nsnull != attrName) {
nsCOMPtr<nsIContent> content;
nsIFrame* textFrame = nsnull;
NS_NewAttributeContent(getter_AddRefs(content));
if (nsnull != content) {
nsCOMPtr<nsIContent> content(do_CreateInstance(kAttributeContentCID));
if (content) {
nsCOMPtr<nsIAttributeContent> attrContent(do_QueryInterface(content));
if (attrContent) {
attrContent->Init(aContent, attrNameSpace, attrName);
@ -1394,11 +1421,11 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex
// Create a text content node
nsIContent* textContent = nsnull;
nsIDOMCharacterData* domData;
nsIFrame* textFrame = nsnull;
NS_NewTextNode(&textContent);
nsCOMPtr<nsIContent> textContent(do_CreateInstance(kTextNodeCID));
if (textContent) {
// Set the text
textContent->QueryInterface(NS_GET_IID(nsIDOMCharacterData), (void**)&domData);
@ -1413,8 +1440,6 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex
// Create a text frame and initialize it
NS_NewTextFrame(shell, &textFrame);
textFrame->Init(aPresContext, textContent, aParentFrame, aStyleContext, nsnull);
NS_RELEASE(textContent);
}
// Return the text frame
@ -9946,6 +9971,7 @@ nsCSSFrameConstructor::ConstructAlternateFrame(nsIPresShell* aPresShell,
nsIFrame* aParentFrame,
nsIFrame*& aFrame)
{
nsresult rv;
nsAutoString altText;
// Initialize OUT parameter
@ -9957,8 +9983,9 @@ nsCSSFrameConstructor::ConstructAlternateFrame(nsIPresShell* aPresShell,
GetAlternateTextFor(aContent, tag, altText);
// Create a text content element for the alternate text
nsCOMPtr<nsIContent> altTextContent;
NS_NewTextNode(getter_AddRefs(altTextContent));
nsCOMPtr<nsIContent> altTextContent(do_CreateInstance(kTextNodeCID,&rv));
if (NS_FAILED(rv))
return rv;
// Set the content's text
nsIDOMCharacterData* domData;

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

@ -22,6 +22,7 @@
#ifndef nsCSSFrameConstructor_h___
#define nsCSSFrameConstructor_h___
#include "nsICSSFrameConstructor.h"
#include "nsIStyleFrameConstruction.h"
#include "nslayout.h"
#include "nsIPresContext.h"
@ -44,7 +45,7 @@ class nsFrameConstructorState;
class nsIDOMHTMLSelectElement;
class nsIXBLService;
class nsCSSFrameConstructor : public nsIStyleFrameConstruction {
class nsCSSFrameConstructor : public nsIStyleFrameConstruction, public nsICSSFrameConstructor {
public:
nsCSSFrameConstructor(void);
virtual ~nsCSSFrameConstructor(void);
@ -57,6 +58,7 @@ private:
public:
NS_DECL_ISUPPORTS
// nsICSSFrameConstructor
NS_IMETHOD Init(nsIDocument* aDocument);
// nsIStyleFrameConstruction API

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

@ -96,6 +96,21 @@ private :
/************IMPLEMENTATIONS**************/
nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = nsnull;
nsCOMPtr<nsIFrameTraversal> t(new nsFrameTraversal());
if (!t)
return NS_ERROR_OUT_OF_MEMORY;
*aResult = t;
NS_ADDREF(*aResult);
return NS_OK;
}
nsresult
NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
nsTraversalType aType,
@ -141,6 +156,27 @@ NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
}
nsFrameTraversal::nsFrameTraversal()
{
NS_INIT_ISUPPORTS();
}
nsFrameTraversal::~nsFrameTraversal()
{
}
NS_IMPL_ISUPPORTS1(nsFrameTraversal,nsIFrameTraversal);
NS_IMETHODIMP
nsFrameTraversal::NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
PRUint32 aType,
nsIPresContext* aPresContext,
nsIFrame *aStart)
{
return NS_NewFrameTraversal(aEnumerator, NS_STATIC_CAST(nsTraversalType,
aType),
aPresContext, aStart);
}
/*********nsFrameIterator************/
NS_IMPL_ISUPPORTS2(nsFrameIterator, nsIEnumerator, nsIBidirectionalEnumerator)

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

@ -24,12 +24,27 @@
#include "nsIEnumerator.h"
#include "nsIFrame.h"
#include "nsIFrameTraversal.h"
enum nsTraversalType{LEAF, EXTENSIVE, FASTEST};
nsresult NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
nsTraversalType aType,
nsIPresContext* aPresContext,
nsIFrame *aStart);
nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult);
class nsFrameTraversal : public nsIFrameTraversal
{
public:
nsFrameTraversal();
virtual ~nsFrameTraversal();
NS_DECL_ISUPPORTS
NS_IMETHOD NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
PRUint32 aType,
nsIPresContext* aPresContext,
nsIFrame *aStart);
};
#endif //NSFRAMETRAVERSAL_H

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

@ -44,7 +44,6 @@
#include "nsIContent.h"
#include "nsIFrame.h"
#include "nsIRenderingContext.h"
#include "nsEventStateManager.h"
#include "nsIURL.h"
#include "nsIDocument.h"
#include "nsIStyleContext.h"
@ -73,6 +72,8 @@ PrefChangedCallback(const char* aPrefName, void* instance_data)
}
static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
#include "nsContentCID.h"
static NS_DEFINE_CID(kEventStateManagerCID, NS_EVENTSTATEMANAGER_CID);
nsPresContext::nsPresContext()
: mDefaultFont("serif", NS_FONT_STYLE_NORMAL,
@ -1270,8 +1271,9 @@ nsPresContext::GetEventStateManager(nsIEventStateManager** aManager)
}
if (!mEventManager) {
nsresult rv = NS_NewEventStateManager(getter_AddRefs(mEventManager));
if (NS_OK != rv) {
nsresult rv;
mEventManager = do_CreateInstance(kEventStateManagerCID,&rv);
if (NS_FAILED(rv)) {
return rv;
}
}

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

@ -135,6 +135,10 @@
// SubShell map
#include "nsDST.h"
#include "nsContentCID.h"
static NS_DEFINE_CID(kCSSStyleSheetCID, NS_CSS_STYLESHEET_CID);
static NS_DEFINE_CID(kStyleSetCID, NS_STYLESET_CID);
// supporting bugs 31816, 20760, 22963
// define USE_OVERRIDE to put prefs in as an override stylesheet
// otherwise they go in as a Backstop stylesheets
@ -1813,7 +1817,7 @@ nsresult PresShell::CreatePreferenceStyleSheet(void)
NS_ASSERTION(mPrefStyleSheet==nsnull, "prefStyleSheet already exists");
nsresult result = NS_OK;
result = NS_NewCSSStyleSheet(&mPrefStyleSheet);
result = nsComponentManager::CreateInstance(kCSSStyleSheetCID,nsnull,NS_GET_IID(nsICSSStyleSheet),(void**)&mPrefStyleSheet);
if (NS_SUCCEEDED(result)) {
NS_ASSERTION(mPrefStyleSheet, "null but no error");
nsCOMPtr<nsIURI> uri;
@ -3608,7 +3612,7 @@ PresShell::DoCopy()
rv = nsCopySupport::HTMLCopy(sel, doc, nsIClipboard::kGlobalClipboard);
if (NS_FAILED(rv))
return rv;
// Now that we have copied, update the Paste menu item
nsCOMPtr<nsIScriptGlobalObject> globalObject;
doc->GetScriptGlobalObject(getter_AddRefs(globalObject));
@ -5170,8 +5174,8 @@ PresShell::SetReflowEventStatus(PRBool aPending)
nsresult
PresShell::CloneStyleSet(nsIStyleSet* aSet, nsIStyleSet** aResult)
{
nsIStyleSet* clone;
nsresult rv = NS_NewStyleSet(&clone);
nsresult rv;
nsCOMPtr<nsIStyleSet> clone(do_CreateInstance(kStyleSetCID,&rv));
if (NS_FAILED(rv)) {
return rv;
}
@ -5206,7 +5210,8 @@ PresShell::CloneStyleSet(nsIStyleSet* aSet, nsIStyleSet** aResult)
NS_RELEASE(ss);
}
}
*aResult = clone;
*aResult = clone.get();
NS_ADDREF(*aResult);
return NS_OK;
}

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

@ -1,31 +1,22 @@
#
# This is a list of local files which get copied to the mozilla:dist:layout directory
#
nslayout.h
nsFrameList.h
nsFrameTraversal.h
nsHTMLReflowState.h
nsIAutoCopy.h
nsICaret.h
nsIContent.h
nsIContentIterator.h
nsContentPolicyUtils.h
nsIDocument.h
nsIDocumentContainer.h
nsIDocumentEncoder.h
nsIDocumentObserver.h
nsIDocumentViewer.h
nsIElementFactory.h
nsIFocusTracker.h
nsIFrame.h
nsIFrameDebug.h
nsIFrameSelection.h
nsIFrameUtil.h
nsIFrameImageLoader.h
nsIFrameManager.h
nsIFrameSelection.h
nsIFrameUtil.h
nsIIndependentSelection.h
nsILayoutDebugger.h
nsINameSpace.h
nsINameSpaceManager.h
nsINodeInfo.h
nsILayoutHistoryState.h
nsIMutableStyleContext.h
nsIPageSequenceFrame.h
nsIPresContext.h
nsIPresShell.h
@ -33,32 +24,21 @@ nsIPresState.h
nsIPrintContext.h
nsIReflowCallback.h
nsIReflowCommand.h
nsIScrollableFrame.h
nsIScrollableViewProvider.h
nsISpaceManager.h
nsFrameList.h
nsFrameTraversal.h
nsLayoutAtoms.h
nsIStatefulFrame.h
nsIStyleContext.h
nsIStyleSet.h
nslayout.h
nsLayoutAtomList.h
nsLayoutAtoms.h
nsLayoutUtils.h
nsStyleChangeList.h
nsStyleCoord.h
nsStyleStruct.h
nsStyleConsts.h
nsIStyledContent.h
nsIStyleContext.h
nsIMutableStyleContext.h
nsIStyleRule.h
nsIStyleRuleSupplier.h
nsIStyleSet.h
nsIStyleSheet.h
nsIStyleSheetLinkingElement.h
nsIStyleRuleProcessor.h
nsITextContent.h
nsTextFragment.h
nsIAnonymousContent.h
nsILayoutHistoryState.h
nsIStatefulFrame.h
nsIScrollableFrame.h
nsIPrivateDOMImplementation.h
nsIContentSerializer.h
nsIHTMLToTextSink.h
nsIScrollableViewProvider.h
nsStyleCoord.h
nsIStyleFrameConstruction.h
nsStyleStruct.h
nsIFrameTraversal.h
nsIObjectFrame.h
nsIImageFrame.h

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

@ -34,25 +34,16 @@ nslayout.h \
nsHTMLReflowState.h \
nsIAutoCopy.h \
nsICaret.h \
nsIContent.h \
nsIContentIterator.h \
nsContentPolicyUtils.h \
nsIDocument.h \
nsIDocumentContainer.h \
nsIDocumentEncoder.h \
nsIDocumentObserver.h \
nsIDocumentViewer.h \
nsIElementFactory.h \
nsIFocusTracker.h \
nsIFrame.h \
nsIImageFrame.h \
nsIObjectFrame.h \
nsIFrameTraversal.h \
nsIFrameDebug.h \
nsIFrameImageLoader.h \
nsIFrameManager.h \
nsIIndependentSelection.h \
nsILayoutDebugger.h \
nsINameSpace.h \
nsINameSpaceManager.h \
nsINodeInfo.h \
nsIFrameUtil.h \
nsIPageSequenceFrame.h \
nsIPresContext.h \
@ -63,17 +54,10 @@ nsIReflowCallback.h \
nsIReflowCommand.h \
nsIFrameSelection.h \
nsISpaceManager.h \
nsIStyledContent.h \
nsIStyleContext.h \
nsIMutableStyleContext.h \
nsIStyleFrameConstruction.h \
nsIStyleRule.h \
nsIStyleRuleSupplier.h \
nsIStyleSet.h \
nsIStyleSheet.h \
nsIStyleSheetLinkingElement.h \
nsIStyleRuleProcessor.h \
nsITextContent.h \
nsLayoutAtoms.h \
nsLayoutAtomList.h \
nsLayoutUtils.h \
@ -83,24 +67,14 @@ nsStyleChangeList.h \
nsStyleConsts.h \
nsStyleCoord.h \
nsStyleStruct.h \
nsTextFragment.h \
nsILayoutHistoryState.h \
nsIStatefulFrame.h \
nsIScrollableFrame.h \
nsIPrivateDOMImplementation.h \
nsIContentSerializer.h \
nsIHTMLToTextSink.h \
nsIScrollableViewProvider.h \
$(NULL)
XPIDLSRCS = \
nsIChromeEventHandler.idl \
nsIContentPolicy.idl \
nsIDiskDocument.idl \
nsISelectionController.idl \
nsISelectionListener.idl \
nsISelection.idl \
nsISelectionPrivate.idl \
nsIPrintListener.idl \
$(NULL)

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

@ -23,28 +23,19 @@ DEPTH=..\..\..
EXPORTS = \
nslayout.h \
nsContentPolicyUtils.h \
nsHTMLReflowState.h \
nsIAutoCopy.h \
nsICaret.h \
nsIContent.h \
nsIContentIterator.h \
nsIDocument.h \
nsIDocumentContainer.h \
nsIDocumentEncoder.h \
nsIDocumentObserver.h \
nsIDocumentViewer.h \
nsIElementFactory.h \
nsIFocusTracker.h \
nsIFrame.h \
nsIObjectFrame.h \
nsIImageFrame.h \
nsIFrameTraversal.h \
nsIFrameDebug.h \
nsIFrameImageLoader.h \
nsIFrameManager.h \
nsIIndependentSelection.h \
nsILayoutDebugger.h \
nsINameSpace.h \
nsINameSpaceManager.h \
nsINodeInfo.h \
nsIFrameUtil.h \
nsIPageSequenceFrame.h \
nsIPresContext.h \
@ -54,17 +45,10 @@ EXPORTS = \
nsIReflowCommand.h \
nsIFrameSelection.h \
nsISpaceManager.h \
nsIStyledContent.h \
nsIStyleContext.h \
nsIMutableStyleContext.h \
nsIStyleFrameConstruction.h \
nsIStyleRule.h \
nsIStyleRuleSupplier.h \
nsIStyleSet.h \
nsIStyleSheet.h \
nsIStyleSheetLinkingElement.h \
nsIStyleRuleProcessor.h \
nsITextContent.h \
nsLayoutAtoms.h \
nsLayoutAtomList.h \
nsLayoutUtils.h \
@ -74,13 +58,9 @@ EXPORTS = \
nsStyleConsts.h \
nsStyleCoord.h \
nsStyleStruct.h \
nsTextFragment.h \
nsILayoutHistoryState.h \
nsIStatefulFrame.h \
nsIScrollableFrame.h \
nsIPrivateDOMImplementation.h \
nsIContentSerializer.h \
nsIHTMLToTextSink.h \
nsIScrollableViewProvider.h \
nsIPrintContext.h \
$(NULL)
@ -89,12 +69,6 @@ MODULE=layout_base
XPIDLSRCS= \
.\nsIChromeEventHandler.idl \
.\nsIContentPolicy.idl \
.\nsIDiskDocument.idl \
.\nsISelectionController.idl \
.\nsISelectionListener.idl \
.\nsISelection.idl \
.\nsISelectionPrivate.idl \
.\nsIPrintListener.idl \
$(NULL)

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

@ -24,12 +24,27 @@
#include "nsIEnumerator.h"
#include "nsIFrame.h"
#include "nsIFrameTraversal.h"
enum nsTraversalType{LEAF, EXTENSIVE, FASTEST};
nsresult NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
nsTraversalType aType,
nsIPresContext* aPresContext,
nsIFrame *aStart);
nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult);
class nsFrameTraversal : public nsIFrameTraversal
{
public:
nsFrameTraversal();
virtual ~nsFrameTraversal();
NS_DECL_ISUPPORTS
NS_IMETHOD NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
PRUint32 aType,
nsIPresContext* aPresContext,
nsIFrame *aStart);
};
#endif //NSFRAMETRAVERSAL_H

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

@ -36,12 +36,20 @@
#include "nsIStyleSet.h"
#include "nsCOMPtr.h"
#include "nsILanguageAtom.h"
#include "nsIFrame.h"
class nsISizeOfHandler;
class nsIFrame;
class nsIPresContext;
class nsISupportsArray;
class nsIStyleContext;
inline void CalcSidesFor(const nsIFrame* aFrame, const nsStyleSides& aSides,
PRUint8 aSpacing,
const nscoord* aEnumTable, PRInt32 aNumEnums,
nsMargin& aResult);
#define SHARE_STYLECONTEXTS
@ -49,8 +57,13 @@ class nsISupportsArray;
// The lifetime of these objects is managed by the nsIStyleContext.
struct nsStyleFont : public nsStyleStruct {
nsStyleFont(void);
~nsStyleFont(void);
nsStyleFont(void)
: mFont(nsnull, NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
NS_FONT_WEIGHT_NORMAL, NS_FONT_DECORATION_NONE, 0),
mFixedFont(nsnull, NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
NS_FONT_WEIGHT_NORMAL, NS_FONT_DECORATION_NONE, 0)
{}
~nsStyleFont(void) {};
nsFont mFont; // [inherited]
nsFont mFixedFont; // [inherited]
@ -62,8 +75,8 @@ protected:
};
struct nsStyleColor : public nsStyleStruct {
nsStyleColor(void);
~nsStyleColor(void);
nsStyleColor(void) {}
~nsStyleColor(void) {}
nscolor mColor; // [inherited]
@ -86,16 +99,39 @@ struct nsStyleColor : public nsStyleStruct {
};
#define BORDER_COLOR_DEFINED 0x80
#define BORDER_COLOR_SPECIAL 0x40
#define BORDER_STYLE_MASK 0x3F
#define NS_SPACING_MARGIN 0
#define NS_SPACING_PADDING 1
#define NS_SPACING_BORDER 2
struct nsStyleMargin: public nsStyleStruct {
nsStyleMargin(void);
~nsStyleMargin(void);
nsStyleMargin(void) {};
~nsStyleMargin(void) {};
nsStyleSides mMargin; // [reset] length, percent, auto, inherit
PRBool GetMargin(nsMargin& aMargin) const;
PRBool GetMargin(nsMargin& aMargin) const
{
if (mHasCachedMargin) {
aMargin = mCachedMargin;
return PR_TRUE;
}
return PR_FALSE;
}
// XXX this is a deprecated method
void CalcMarginFor(const nsIFrame* aFrame, nsMargin& aMargin) const;
// XXX this is a deprecated method
void CalcMarginFor(const nsIFrame* aFrame, nsMargin& aMargin) const
{
if (mHasCachedMargin) {
aMargin = mCachedMargin;
} else {
CalcSidesFor(aFrame, mMargin, NS_SPACING_MARGIN, nsnull, 0, aMargin);
}
}
protected:
PRPackedBool mHasCachedMargin;
@ -104,15 +140,29 @@ protected:
struct nsStylePadding: public nsStyleStruct {
nsStylePadding(void);
~nsStylePadding(void);
nsStylePadding(void) {};
~nsStylePadding(void) {};
nsStyleSides mPadding; // [reset] length, percent, inherit
PRBool GetPadding(nsMargin& aPadding) const;
PRBool GetPadding(nsMargin& aPadding) const
{
if (mHasCachedPadding) {
aPadding = mCachedPadding;
return PR_TRUE;
}
return PR_FALSE;
}
// XXX this is a deprecated method
void CalcPaddingFor(const nsIFrame* aFrame, nsMargin& aPadding) const;
// XXX this is a deprecated method
void CalcPaddingFor(const nsIFrame* aFrame, nsMargin& aPadding) const
{
if (mHasCachedPadding) {
aPadding = mCachedPadding;
} else {
CalcSidesFor(aFrame, mPadding, NS_SPACING_PADDING, nsnull, 0, aPadding);
}
}
protected:
PRPackedBool mHasCachedPadding;
@ -121,24 +171,76 @@ protected:
struct nsStyleBorder: public nsStyleStruct {
nsStyleBorder(void);
~nsStyleBorder(void);
nsStyleBorder(void) {};
~nsStyleBorder(void) {};
nsStyleSides mBorder; // [reset] length, enum (see nsStyleConsts.h)
nsStyleSides mBorderRadius; // [reset] length, percent, inherit
PRUint8 mFloatEdge; // [reset] see nsStyleConsts.h
PRBool GetBorder(nsMargin& aBorder) const;
PRBool GetBorder(nsMargin& aBorder) const
{
if (mHasCachedBorder) {
aBorder = mCachedBorder;
return PR_TRUE;
}
return PR_FALSE;
}
PRUint8 GetBorderStyle(PRUint8 aSide) const;
void SetBorderStyle(PRUint8 aSide, PRUint8 aStyle);
PRBool GetBorderColor(PRUint8 aSide, nscolor& aColor) const; // PR_FALSE means TRANSPARENT
void SetBorderColor(PRUint8 aSide, nscolor aColor);
void SetBorderTransparent(PRUint8 aSide);
void UnsetBorderColor(PRUint8 aSide);
PRUint8 GetBorderStyle(PRUint8 aSide) const
{
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
return (mBorderStyle[aSide] & BORDER_STYLE_MASK);
}
// XXX these are deprecated methods
void CalcBorderFor(const nsIFrame* aFrame, nsMargin& aBorder) const;
void SetBorderStyle(PRUint8 aSide, PRUint8 aStyle)
{
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
mBorderStyle[aSide] &= ~BORDER_STYLE_MASK;
mBorderStyle[aSide] |= (aStyle & BORDER_STYLE_MASK);
}
// PR_FALSE means TRANSPARENT
PRBool GetBorderColor(PRUint8 aSide, nscolor& aColor) const
{
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
if ((mBorderStyle[aSide] & BORDER_COLOR_SPECIAL) == 0) {
aColor = mBorderColor[aSide];
return PR_TRUE;
}
return PR_FALSE;
}
void SetBorderColor(PRUint8 aSide, nscolor aColor)
{
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
mBorderColor[aSide] = aColor;
mBorderStyle[aSide] &= ~BORDER_COLOR_SPECIAL;
mBorderStyle[aSide] |= BORDER_COLOR_DEFINED;
}
void SetBorderTransparent(PRUint8 aSide)
{
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
mBorderStyle[aSide] |= (BORDER_COLOR_DEFINED | BORDER_COLOR_SPECIAL);
}
void UnsetBorderColor(PRUint8 aSide)
{
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
mBorderStyle[aSide] &= BORDER_STYLE_MASK;
}
// XXX these are deprecated methods
void CalcBorderFor(const nsIFrame* aFrame, nsMargin& aBorder) const
{
if (mHasCachedBorder) {
aBorder = mCachedBorder;
} else {
CalcSidesFor(aFrame, mBorder, NS_SPACING_BORDER, mBorderWidths, 3, aBorder);
}
}
protected:
PRPackedBool mHasCachedBorder;
@ -146,15 +248,29 @@ protected:
PRUint8 mBorderStyle[4]; // [reset] See nsStyleConsts.h
nscolor mBorderColor[4]; // [reset]
// XXX remove with deprecated methods
nscoord mBorderWidths[3];
};
struct nsStyleBorderPadding: public nsStyleStruct {
nsStyleBorderPadding(void);
~nsStyleBorderPadding(void);
nsStyleBorderPadding(void) { mHasCachedBorderPadding = PR_FALSE; };
~nsStyleBorderPadding(void) {};
PRBool GetBorderPadding(nsMargin& aBorderPadding) const {
if (mHasCachedBorderPadding) {
aBorderPadding = mCachedBorderPadding;
return PR_TRUE;
}
return PR_FALSE;
}
void SetBorderPadding(nsMargin aBorderPadding) {
mCachedBorderPadding = aBorderPadding;
mHasCachedBorderPadding = PR_TRUE;
}
PRBool GetBorderPadding(nsMargin& aBorderPadding) const;
void SetBorderPadding(nsMargin aBorderPadding);
protected:
nsMargin mCachedBorderPadding;
PRPackedBool mHasCachedBorderPadding;
@ -162,21 +278,55 @@ protected:
struct nsStyleOutline: public nsStyleStruct {
nsStyleOutline(void);
~nsStyleOutline(void);
nsStyleOutline(void) {};
~nsStyleOutline(void) {};
nsStyleSides mOutlineRadius; // [reset] length, percent, inherit
// (top=topLeft, right=topRight, bottom=bottomRight, left=bottomLeft)
nsStyleCoord mOutlineWidth; // [reset] length, enum (see nsStyleConsts.h)
PRBool GetOutlineWidth(nscoord& aWidth) const; // PR_TRUE if pre-computed
PRUint8 GetOutlineStyle(void) const;
void SetOutlineStyle(PRUint8 aStyle);
PRBool GetOutlineColor(nscolor& aColor) const; // PR_FALSE means INVERT
void SetOutlineColor(nscolor aColor);
void SetOutlineInvert(void);
PRBool GetOutlineWidth(nscoord& aWidth) const
{
if (mHasCachedOutline) {
aWidth = mCachedOutlineWidth;
return PR_TRUE;
}
return PR_FALSE;
}
PRUint8 GetOutlineStyle(void) const
{
return (mOutlineStyle & BORDER_STYLE_MASK);
}
void SetOutlineStyle(PRUint8 aStyle)
{
mOutlineStyle &= ~BORDER_STYLE_MASK;
mOutlineStyle |= (aStyle & BORDER_STYLE_MASK);
}
// PR_FALSE means INVERT
PRBool GetOutlineColor(nscolor& aColor) const
{
if ((mOutlineStyle & BORDER_COLOR_SPECIAL) == 0) {
aColor = mOutlineColor;
return PR_TRUE;
}
return PR_FALSE;
}
void SetOutlineColor(nscolor aColor)
{
mOutlineColor = aColor;
mOutlineStyle &= ~BORDER_COLOR_SPECIAL;
mOutlineStyle |= BORDER_COLOR_DEFINED;
}
void SetOutlineInvert(void)
{
mOutlineStyle |= (BORDER_COLOR_DEFINED | BORDER_COLOR_SPECIAL);
}
protected:
PRPackedBool mHasCachedOutline;
@ -184,6 +334,9 @@ protected:
PRUint8 mOutlineStyle; // [reset] See nsStyleConsts.h
nscolor mOutlineColor; // [reset]
// XXX remove with deprecated methods
nscoord mBorderWidths[3];
};
@ -241,8 +394,8 @@ struct nsStyleText : public nsStyleStruct {
};
struct nsStyleDisplay : public nsStyleStruct {
nsStyleDisplay(void);
~nsStyleDisplay(void);
nsStyleDisplay(void) {};
~nsStyleDisplay(void) {};
PRUint8 mDirection; // [inherited] see nsStyleConsts.h NS_STYLE_DIRECTION_*
PRUint8 mDisplay; // [reset] see nsStyleConsts.h NS_STYLE_DISPLAY_*
@ -322,31 +475,157 @@ struct nsStyleCounterData {
PRInt32 mValue;
};
#define DELETE_ARRAY_IF(array) if (array) { delete[] array; array = nsnull; }
struct nsStyleContent: public nsStyleStruct {
nsStyleContent(void);
~nsStyleContent(void);
PRUint32 ContentCount(void) const { return mContentCount; } // [reset]
nsresult GetContentAt(PRUint32 aIndex, nsStyleContentType& aType, nsString& aContent) const;
nsresult AllocateContents(PRUint32 aCount);
nsresult SetContentAt(PRUint32 aIndex, nsStyleContentType aType, const nsString& aContent);
nsresult GetContentAt(PRUint32 aIndex, nsStyleContentType& aType, nsString& aContent) const {
if (aIndex < mContentCount) {
aType = mContents[aIndex].mType;
aContent = mContents[aIndex].mContent;
return NS_OK;
}
return NS_ERROR_ILLEGAL_VALUE;
}
nsresult AllocateContents(PRUint32 aCount) {
if (aCount != mContentCount) {
DELETE_ARRAY_IF(mContents);
if (aCount) {
mContents = new nsStyleContentData[aCount];
if (! mContents) {
mContentCount = 0;
return NS_ERROR_OUT_OF_MEMORY;
}
}
mContentCount = aCount;
}
return NS_OK;
}
nsresult SetContentAt(PRUint32 aIndex, nsStyleContentType aType, const nsString& aContent) {
if (aIndex < mContentCount) {
mContents[aIndex].mType = aType;
if (aType < eStyleContentType_OpenQuote) {
mContents[aIndex].mContent = aContent;
}
else {
mContents[aIndex].mContent.Truncate();
}
return NS_OK;
}
return NS_ERROR_ILLEGAL_VALUE;
}
PRUint32 CounterIncrementCount(void) const { return mIncrementCount; } // [reset]
nsresult GetCounterIncrementAt(PRUint32 aIndex, nsString& aCounter, PRInt32& aIncrement) const;
nsresult AllocateCounterIncrements(PRUint32 aCount);
nsresult SetCounterIncrementAt(PRUint32 aIndex, const nsString& aCounter, PRInt32 aIncrement);
nsresult GetCounterIncrementAt(PRUint32 aIndex, nsString& aCounter, PRInt32& aIncrement) const {
if (aIndex < mIncrementCount) {
aCounter = mIncrements[aIndex].mCounter;
aIncrement = mIncrements[aIndex].mValue;
return NS_OK;
}
return NS_ERROR_ILLEGAL_VALUE;
}
nsresult AllocateCounterIncrements(PRUint32 aCount) {
if (aCount != mIncrementCount) {
DELETE_ARRAY_IF(mIncrements);
if (aCount) {
mIncrements = new nsStyleCounterData[aCount];
if (! mIncrements) {
mIncrementCount = 0;
return NS_ERROR_OUT_OF_MEMORY;
}
}
mIncrementCount = aCount;
}
return NS_OK;
}
nsresult SetCounterIncrementAt(PRUint32 aIndex, const nsString& aCounter, PRInt32 aIncrement) {
if (aIndex < mIncrementCount) {
mIncrements[aIndex].mCounter = aCounter;
mIncrements[aIndex].mValue = aIncrement;
return NS_OK;
}
return NS_ERROR_ILLEGAL_VALUE;
}
PRUint32 CounterResetCount(void) const { return mResetCount; } // [reset]
nsresult GetCounterResetAt(PRUint32 aIndex, nsString& aCounter, PRInt32& aValue) const;
nsresult AllocateCounterResets(PRUint32 aCount);
nsresult SetCounterResetAt(PRUint32 aIndex, const nsString& aCounter, PRInt32 aValue);
nsresult GetCounterResetAt(PRUint32 aIndex, nsString& aCounter, PRInt32& aValue) const {
if (aIndex < mResetCount) {
aCounter = mResets[aIndex].mCounter;
aValue = mResets[aIndex].mValue;
return NS_OK;
}
return NS_ERROR_ILLEGAL_VALUE;
}
nsresult AllocateCounterResets(PRUint32 aCount) {
if (aCount != mResetCount) {
DELETE_ARRAY_IF(mResets);
if (aCount) {
mResets = new nsStyleCounterData[aCount];
if (! mResets) {
mResetCount = 0;
return NS_ERROR_OUT_OF_MEMORY;
}
}
mResetCount = aCount;
}
return NS_OK;
}
nsresult SetCounterResetAt(PRUint32 aIndex, const nsString& aCounter, PRInt32 aValue) {
if (aIndex < mResetCount) {
mResets[aIndex].mCounter = aCounter;
mResets[aIndex].mValue = aValue;
return NS_OK;
}
return NS_ERROR_ILLEGAL_VALUE;
}
nsStyleCoord mMarkerOffset; // [reset]
PRUint32 QuotesCount(void) const { return mQuotesCount; } // [inherited]
nsresult GetQuotesAt(PRUint32 aIndex, nsString& aOpen, nsString& aClose) const;
nsresult AllocateQuotes(PRUint32 aCount);
nsresult SetQuotesAt(PRUint32 aIndex, const nsString& aOpen, const nsString& aClose);
nsresult GetQuotesAt(PRUint32 aIndex, nsString& aOpen, nsString& aClose) const {
if (aIndex < mQuotesCount) {
aIndex *= 2;
aOpen = mQuotes[aIndex];
aClose = mQuotes[++aIndex];
return NS_OK;
}
return NS_ERROR_ILLEGAL_VALUE;
}
nsresult AllocateQuotes(PRUint32 aCount) {
if (aCount != mQuotesCount) {
DELETE_ARRAY_IF(mQuotes);
if (aCount) {
mQuotes = new nsString[aCount * 2];
if (! mQuotes) {
mQuotesCount = 0;
return NS_ERROR_OUT_OF_MEMORY;
}
}
mQuotesCount = aCount;
}
return NS_OK;
}
nsresult SetQuotesAt(PRUint32 aIndex, const nsString& aOpen, const nsString& aClose) {
if (aIndex < mQuotesCount) {
aIndex *= 2;
mQuotes[aIndex] = aOpen;
mQuotes[++aIndex] = aClose;
return NS_OK;
}
return NS_ERROR_ILLEGAL_VALUE;
}
protected:
PRUint32 mContentCount;
@ -508,6 +787,128 @@ public:
virtual void CalcBorderPaddingFor(const nsIFrame* aFrame, nsMargin& aBorderPadding) const = 0;
};
// XXX this is here to support deprecated calc spacing methods only
inline nscoord CalcSideFor(const nsIFrame* aFrame, const nsStyleCoord& aCoord,
PRUint8 aSpacing, PRUint8 aSide,
const nscoord* aEnumTable, PRInt32 aNumEnums)
{
nscoord result = 0;
switch (aCoord.GetUnit()) {
case eStyleUnit_Auto:
// Auto margins are handled by layout
break;
case eStyleUnit_Inherit:
nsIFrame* parentFrame;
aFrame->GetParent(&parentFrame); // XXX may not be direct parent...
if (nsnull != parentFrame) {
nsIStyleContext* parentContext;
parentFrame->GetStyleContext(&parentContext);
if (nsnull != parentContext) {
nsMargin parentSpacing;
switch (aSpacing) {
case NS_SPACING_MARGIN:
{
const nsStyleMargin* parentMargin = (const nsStyleMargin*)parentContext->GetStyleData(eStyleStruct_Margin);
parentMargin->CalcMarginFor(parentFrame, parentSpacing);
}
break;
case NS_SPACING_PADDING:
{
const nsStylePadding* parentPadding = (const nsStylePadding*)parentContext->GetStyleData(eStyleStruct_Padding);
parentPadding->CalcPaddingFor(parentFrame, parentSpacing);
}
break;
case NS_SPACING_BORDER:
{
const nsStyleBorder* parentBorder = (const nsStyleBorder*)parentContext->GetStyleData(eStyleStruct_Border);
parentBorder->CalcBorderFor(parentFrame, parentSpacing);
}
break;
}
switch (aSide) {
case NS_SIDE_LEFT: result = parentSpacing.left; break;
case NS_SIDE_TOP: result = parentSpacing.top; break;
case NS_SIDE_RIGHT: result = parentSpacing.right; break;
case NS_SIDE_BOTTOM: result = parentSpacing.bottom; break;
}
NS_RELEASE(parentContext);
}
}
break;
case eStyleUnit_Percent:
{
nscoord baseWidth = 0;
PRBool isBase = PR_FALSE;
nsIFrame* frame;
aFrame->GetParent(&frame);
while (nsnull != frame) {
frame->IsPercentageBase(isBase);
if (isBase) {
nsSize size;
frame->GetSize(size);
baseWidth = size.width; // not really width, need to subtract out padding...
break;
}
frame->GetParent(&frame);
}
result = (nscoord)((float)baseWidth * aCoord.GetPercentValue());
}
break;
case eStyleUnit_Coord:
result = aCoord.GetCoordValue();
break;
case eStyleUnit_Enumerated:
if (nsnull != aEnumTable) {
PRInt32 value = aCoord.GetIntValue();
if ((0 <= value) && (value < aNumEnums)) {
return aEnumTable[aCoord.GetIntValue()];
}
}
break;
case eStyleUnit_Null:
case eStyleUnit_Normal:
case eStyleUnit_Integer:
case eStyleUnit_Proportional:
default:
result = 0;
break;
}
if ((NS_SPACING_PADDING == aSpacing) || (NS_SPACING_BORDER == aSpacing)) {
if (result < 0) {
result = 0;
}
}
return result;
}
inline void CalcSidesFor(const nsIFrame* aFrame, const nsStyleSides& aSides,
PRUint8 aSpacing,
const nscoord* aEnumTable, PRInt32 aNumEnums,
nsMargin& aResult)
{
nsStyleCoord coord;
aResult.left = CalcSideFor(aFrame, aSides.GetLeft(coord), aSpacing, NS_SIDE_LEFT,
aEnumTable, aNumEnums);
aResult.top = CalcSideFor(aFrame, aSides.GetTop(coord), aSpacing, NS_SIDE_TOP,
aEnumTable, aNumEnums);
aResult.right = CalcSideFor(aFrame, aSides.GetRight(coord), aSpacing, NS_SIDE_RIGHT,
aEnumTable, aNumEnums);
aResult.bottom = CalcSideFor(aFrame, aSides.GetBottom(coord), aSpacing, NS_SIDE_BOTTOM,
aEnumTable, aNumEnums);
}
// this is private to nsStyleSet, don't call it
extern NS_LAYOUT nsresult
NS_NewStyleContext(nsIStyleContext** aInstancePtrResult,
@ -516,4 +917,5 @@ extern NS_LAYOUT nsresult
nsISupportsArray* aRules,
nsIPresContext* aPresContext);
#endif /* nsIStyleContext_h___ */

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

@ -47,6 +47,8 @@ class nsILayoutHistoryState;
*/
class nsIStyleFrameConstruction : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTYLE_FRAME_CONSTRUCTION_IID)
/**
* Create frames for the root content element and its child content.
*

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

@ -1,256 +0,0 @@
/* -*- 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
* 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 nsStyleCoord_h___
#define nsStyleCoord_h___
#include "nscore.h"
#include "nsCoord.h"
#include "nsCRT.h"
class nsString;
enum nsStyleUnit {
eStyleUnit_Null = 0, // (no value) value is not specified
eStyleUnit_Normal = 1, // (no value)
eStyleUnit_Auto = 2, // (no value)
eStyleUnit_Inherit = 3, // (no value) value should be inherited
eStyleUnit_Percent = 10, // (float) 1.0 == 100%
eStyleUnit_Factor = 11, // (float) a multiplier
eStyleUnit_Coord = 20, // (nscoord) value is twips
eStyleUnit_Integer = 30, // (int) value is simple integer
eStyleUnit_Proportional = 31, // (int) value has proportional meaning
eStyleUnit_Enumerated = 32, // (int) value has enumerated meaning
eStyleUnit_Chars = 33 // (int) value is number of characters
};
typedef union {
PRInt32 mInt; // nscoord is a PRInt32 for now
float mFloat;
} nsStyleUnion;
class nsStyleCoord {
public:
nsStyleCoord(nsStyleUnit aUnit = eStyleUnit_Null);
nsStyleCoord(nscoord aValue);
nsStyleCoord(PRInt32 aValue, nsStyleUnit aUnit);
nsStyleCoord(float aValue, nsStyleUnit aUnit);
nsStyleCoord(const nsStyleCoord& aCopy);
nsStyleCoord& operator=(const nsStyleCoord& aCopy);
PRBool operator==(const nsStyleCoord& aOther) const;
PRBool operator!=(const nsStyleCoord& aOther) const;
nsStyleUnit GetUnit(void) const { return mUnit; }
nscoord GetCoordValue(void) const;
PRInt32 GetIntValue(void) const;
float GetPercentValue(void) const;
float GetFactorValue(void) const;
void GetUnionValue(nsStyleUnion& aValue) const;
void Reset(void); // sets to null
void SetCoordValue(nscoord aValue);
void SetIntValue(PRInt32 aValue, nsStyleUnit aUnit);
void SetPercentValue(float aValue);
void SetFactorValue(float aValue);
void SetNormalValue(void);
void SetAutoValue(void);
void SetInheritValue(void);
void SetUnionValue(const nsStyleUnion& aValue, nsStyleUnit aUnit);
void AppendToString(nsString& aBuffer) const;
void ToString(nsString& aBuffer) const;
public:
nsStyleUnit mUnit;
nsStyleUnion mValue;
};
class nsStyleSides {
public:
nsStyleSides(void);
// nsStyleSides& operator=(const nsStyleSides& aCopy); // use compiler's version
PRBool operator==(const nsStyleSides& aOther) const;
PRBool operator!=(const nsStyleSides& aOther) const;
nsStyleUnit GetLeftUnit(void) const;
nsStyleUnit GetTopUnit(void) const;
nsStyleUnit GetRightUnit(void) const;
nsStyleUnit GetBottomUnit(void) const;
nsStyleCoord& GetLeft(nsStyleCoord& aCoord) const;
nsStyleCoord& GetTop(nsStyleCoord& aCoord) const;
nsStyleCoord& GetRight(nsStyleCoord& aCoord) const;
nsStyleCoord& GetBottom(nsStyleCoord& aCoord) const;
void Reset(void);
void SetLeft(const nsStyleCoord& aCoord);
void SetTop(const nsStyleCoord& aCoord);
void SetRight(const nsStyleCoord& aCoord);
void SetBottom(const nsStyleCoord& aCoord);
void AppendToString(nsString& aBuffer) const;
void ToString(nsString& aBuffer) const;
protected:
PRUint8 mLeftUnit;
PRUint8 mTopUnit;
PRUint8 mRightUnit;
PRUint8 mBottomUnit;
nsStyleUnion mLeftValue;
nsStyleUnion mTopValue;
nsStyleUnion mRightValue;
nsStyleUnion mBottomValue;
};
// -------------------------
// nsStyleCoord inlines
//
inline PRBool nsStyleCoord::operator!=(const nsStyleCoord& aOther) const
{
return PRBool(! ((*this) == aOther));
}
inline PRInt32 nsStyleCoord::GetCoordValue(void) const
{
NS_ASSERTION((mUnit == eStyleUnit_Coord), "not a coord value");
if (mUnit == eStyleUnit_Coord) {
return mValue.mInt;
}
return 0;
}
inline PRInt32 nsStyleCoord::GetIntValue(void) const
{
NS_ASSERTION((mUnit == eStyleUnit_Proportional) ||
(mUnit == eStyleUnit_Enumerated) ||
(mUnit == eStyleUnit_Chars) ||
(mUnit == eStyleUnit_Integer), "not an int value");
if ((mUnit == eStyleUnit_Proportional) ||
(mUnit == eStyleUnit_Enumerated) ||
(mUnit == eStyleUnit_Chars) ||
(mUnit == eStyleUnit_Integer)) {
return mValue.mInt;
}
return 0;
}
inline float nsStyleCoord::GetPercentValue(void) const
{
NS_ASSERTION(mUnit == eStyleUnit_Percent, "not a percent value");
if (mUnit == eStyleUnit_Percent) {
return mValue.mFloat;
}
return 0.0f;
}
inline float nsStyleCoord::GetFactorValue(void) const
{
NS_ASSERTION(mUnit == eStyleUnit_Factor, "not a factor value");
if (mUnit == eStyleUnit_Factor) {
return mValue.mFloat;
}
return 0.0f;
}
inline void nsStyleCoord::GetUnionValue(nsStyleUnion& aValue) const
{
nsCRT::memcpy(&aValue, &mValue, sizeof(nsStyleUnion));
}
// -------------------------
// nsStyleSides inlines
//
inline PRBool nsStyleSides::operator!=(const nsStyleSides& aOther) const
{
return PRBool(! ((*this) == aOther));
}
inline nsStyleUnit nsStyleSides::GetLeftUnit(void) const
{
return (nsStyleUnit)mLeftUnit;
}
inline nsStyleUnit nsStyleSides::GetTopUnit(void) const
{
return (nsStyleUnit)mTopUnit;
}
inline nsStyleUnit nsStyleSides::GetRightUnit(void) const
{
return (nsStyleUnit)mRightUnit;
}
inline nsStyleUnit nsStyleSides::GetBottomUnit(void) const
{
return (nsStyleUnit)mBottomUnit;
}
inline nsStyleCoord& nsStyleSides::GetLeft(nsStyleCoord& aCoord) const
{
aCoord.SetUnionValue(mLeftValue, (nsStyleUnit)mLeftUnit);
return aCoord;
}
inline nsStyleCoord& nsStyleSides::GetTop(nsStyleCoord& aCoord) const
{
aCoord.SetUnionValue(mTopValue, (nsStyleUnit)mTopUnit);
return aCoord;
}
inline nsStyleCoord& nsStyleSides::GetRight(nsStyleCoord& aCoord) const
{
aCoord.SetUnionValue(mRightValue, (nsStyleUnit)mRightUnit);
return aCoord;
}
inline nsStyleCoord& nsStyleSides::GetBottom(nsStyleCoord& aCoord) const
{
aCoord.SetUnionValue(mBottomValue, (nsStyleUnit)mBottomUnit);
return aCoord;
}
inline void nsStyleSides::SetLeft(const nsStyleCoord& aCoord)
{
mLeftUnit = aCoord.GetUnit();
aCoord.GetUnionValue(mLeftValue);
}
inline void nsStyleSides::SetTop(const nsStyleCoord& aCoord)
{
mTopUnit = aCoord.GetUnit();
aCoord.GetUnionValue(mTopValue);
}
inline void nsStyleSides::SetRight(const nsStyleCoord& aCoord)
{
mRightUnit = aCoord.GetUnit();
aCoord.GetUnionValue(mRightValue);
}
inline void nsStyleSides::SetBottom(const nsStyleCoord& aCoord)
{
mBottomUnit = aCoord.GetUnit();
aCoord.GetUnionValue(mBottomValue);
}
#endif /* nsStyleCoord_h___ */

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

@ -33,51 +33,23 @@ REQUIRES = xpcom dom widget view locale timer htmlparser js webshell necko caps
CPPSRCS = \
nsAutoCopy.cpp \
nsCaret.cpp \
nsCommentNode.cpp \
nsContentIterator.cpp \
nsContentList.cpp \
nsContentPolicy.cpp \
nsCopySupport.cpp \
nsDocument.cpp \
nsDocumentEncoder.cpp \
nsDocumentFragment.cpp \
nsDocumentViewer.cpp \
nsDOMAttribute.cpp \
nsDOMAttributeMap.cpp \
nsDOMDocumentType.cpp \
nsFrameImageLoader.cpp \
nsFrameList.cpp \
nsFrameTraversal.cpp \
nsFrameUtil.cpp \
nsGalleyContext.cpp \
nsGeneratedIterator.cpp \
nsGenericDOMDataNode.cpp \
nsGenericDOMNodeList.cpp \
nsGenericElement.cpp \
nsLayoutAtoms.cpp \
nsLayoutDebugger.cpp \
nsLayoutUtils.cpp \
nsNameSpaceManager.cpp \
nsNodeInfo.cpp \
nsNodeInfoManager.cpp \
nsPresContext.cpp \
nsPresState.cpp \
nsPrintContext.cpp \
nsPrintPreviewContext.cpp \
nsRange.cpp \
nsSelection.cpp \
nsSpaceManager.cpp \
nsStyleChangeList.cpp \
nsStyleCoord.cpp \
nsStyleContext.cpp \
nsStyleSet.cpp \
nsTextContentChangeData.cpp \
nsTextFragment.cpp \
nsTextNode.cpp \
nsLayoutHistoryState.cpp \
nsXMLContentSerializer.cpp \
nsHTMLContentSerializer.cpp \
nsPlainTextSerializer.cpp \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.

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

@ -21,7 +21,7 @@
DEPTH=..\..\..
LIBRARY_NAME=raptorlayout_s
LIBRARY_NAME=layoutbase_s
DEFINES=-D_IMPL_NS_LAYOUT -DWIN32_LEAN_AND_MEAN
!if defined(XP_NEW_SELECTION)
DEFINES = $(DEFINES) -DXP_NEW_SELECTION
@ -29,112 +29,51 @@ DEFINES = $(DEFINES) -DXP_NEW_SELECTION
CPPSRCS = \
nsAutoCopy.cpp \
nsCommentNode.cpp \
nsGenericElement.cpp \
nsGenericDOMDataNode.cpp \
nsGenericDOMNodeList.cpp \
nsContentList.cpp \
nsContentIterator.cpp \
nsContentPolicy.cpp \
nsCopySupport.cpp \
nsDocument.cpp \
nsDocumentEncoder.cpp \
nsDocumentFragment.cpp \
nsDocumentViewer.cpp \
nsDOMAttribute.cpp \
nsDOMAttributeMap.cpp \
nsDOMDocumentType.cpp \
nsFrameImageLoader.cpp \
nsFrameList.cpp \
nsFrameTraversal.cpp \
nsFrameUtil.cpp \
nsGalleyContext.cpp \
nsGeneratedIterator.cpp \
nsNameSpaceManager.cpp \
nsNodeInfo.cpp \
nsNodeInfoManager.cpp \
nsPresContext.cpp \
nsPresState.cpp \
nsPrintContext.cpp \
nsPrintPreviewContext.cpp \
nsSpaceManager.cpp \
nsStyleContext.cpp \
nsStyleChangeList.cpp \
nsStyleCoord.cpp \
nsStyleSet.cpp \
nsTextFragment.cpp \
nsSelection.cpp \
nsLayoutAtoms.cpp \
nsLayoutDebugger.cpp \
nsLayoutUtils.cpp \
nsCaret.cpp \
nsRange.cpp \
nsTextContentChangeData.cpp \
nsTextNode.cpp \
nsLayoutHistoryState.cpp \
nsXMLContentSerializer.cpp \
nsHTMLContentSerializer.cpp \
nsPlainTextSerializer.cpp \
$(NULL)
MODULE=raptor
CPP_OBJS= \
.\$(OBJDIR)\nsAutoCopy.obj \
.\$(OBJDIR)\nsCommentNode.obj \
.\$(OBJDIR)\nsGenericDOMDataNode.obj \
.\$(OBJDIR)\nsGenericDOMNodeList.obj \
.\$(OBJDIR)\nsGenericElement.obj \
.\$(OBJDIR)\nsContentList.obj \
.\$(OBJDIR)\nsContentIterator.obj \
.\$(OBJDIR)\nsContentPolicy.obj \
.\$(OBJDIR)\nsCopySupport.obj \
.\$(OBJDIR)\nsDocument.obj \
.\$(OBJDIR)\nsDocumentEncoder.obj \
.\$(OBJDIR)\nsDocumentFragment.obj \
.\$(OBJDIR)\nsDocumentViewer.obj \
.\$(OBJDIR)\nsDOMAttribute.obj \
.\$(OBJDIR)\nsDOMAttributeMap.obj \
.\$(OBJDIR)\nsDOMDocumentType.obj \
.\$(OBJDIR)\nsFrameImageLoader.obj \
.\$(OBJDIR)\nsFrameList.obj \
.\$(OBJDIR)\nsFrameTraversal.obj \
.\$(OBJDIR)\nsFrameUtil.obj \
.\$(OBJDIR)\nsGalleyContext.obj \
.\$(OBJDIR)\nsGeneratedIterator.obj \
.\$(OBJDIR)\nsNameSpaceManager.obj \
.\$(OBJDIR)\nsNodeInfo.obj \
.\$(OBJDIR)\nsNodeInfoManager.obj \
.\$(OBJDIR)\nsPresContext.obj \
.\$(OBJDIR)\nsPresState.obj \
.\$(OBJDIR)\nsPrintContext.obj \
.\$(OBJDIR)\nsPrintPreviewContext.obj \
.\$(OBJDIR)\nsSpaceManager.obj \
.\$(OBJDIR)\nsStyleContext.obj \
.\$(OBJDIR)\nsStyleChangeList.obj \
.\$(OBJDIR)\nsStyleCoord.obj \
.\$(OBJDIR)\nsStyleSet.obj \
.\$(OBJDIR)\nsTextFragment.obj \
.\$(OBJDIR)\nsSelection.obj \
.\$(OBJDIR)\nsLayoutAtoms.obj \
.\$(OBJDIR)\nsLayoutDebugger.obj \
.\$(OBJDIR)\nsLayoutUtils.obj \
.\$(OBJDIR)\nsCaret.obj \
.\$(OBJDIR)\nsRange.obj \
.\$(OBJDIR)\nsTextContentChangeData.obj \
.\$(OBJDIR)\nsTextNode.obj \
.\$(OBJDIR)\nsLayoutHistoryState.obj \
.\$(OBJDIR)\nsXMLContentSerializer.obj \
.\$(OBJDIR)\nsHTMLContentSerializer.obj \
.\$(OBJDIR)\nsPlainTextSerializer.obj \
$(NULL)
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor \
-I$(PUBLIC)\dom -I$(PUBLIC)\js -I$(PUBLIC)\netlib \
-I$(PUBLIC)\pref -I..\..\html\base\src -I..\..\html\style\src \
LINCS=-I..\..\html\base\src -I..\..\html\style\src \
-I..\..\xul\base\src -I..\..\xul\content\src \
-I..\..\events\src \
-I$(PUBLIC)\lwbrk -I$(PUBLIC)\plugin
-I..\..\events\src
LCFLAGS = \
$(LCFLAGS) \

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

@ -96,6 +96,21 @@ private :
/************IMPLEMENTATIONS**************/
nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = nsnull;
nsCOMPtr<nsIFrameTraversal> t(new nsFrameTraversal());
if (!t)
return NS_ERROR_OUT_OF_MEMORY;
*aResult = t;
NS_ADDREF(*aResult);
return NS_OK;
}
nsresult
NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
nsTraversalType aType,
@ -141,6 +156,27 @@ NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
}
nsFrameTraversal::nsFrameTraversal()
{
NS_INIT_ISUPPORTS();
}
nsFrameTraversal::~nsFrameTraversal()
{
}
NS_IMPL_ISUPPORTS1(nsFrameTraversal,nsIFrameTraversal);
NS_IMETHODIMP
nsFrameTraversal::NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
PRUint32 aType,
nsIPresContext* aPresContext,
nsIFrame *aStart)
{
return NS_NewFrameTraversal(aEnumerator, NS_STATIC_CAST(nsTraversalType,
aType),
aPresContext, aStart);
}
/*********nsFrameIterator************/
NS_IMPL_ISUPPORTS2(nsFrameIterator, nsIEnumerator, nsIBidirectionalEnumerator)

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

@ -44,7 +44,6 @@
#include "nsIContent.h"
#include "nsIFrame.h"
#include "nsIRenderingContext.h"
#include "nsEventStateManager.h"
#include "nsIURL.h"
#include "nsIDocument.h"
#include "nsIStyleContext.h"
@ -73,6 +72,8 @@ PrefChangedCallback(const char* aPrefName, void* instance_data)
}
static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
#include "nsContentCID.h"
static NS_DEFINE_CID(kEventStateManagerCID, NS_EVENTSTATEMANAGER_CID);
nsPresContext::nsPresContext()
: mDefaultFont("serif", NS_FONT_STYLE_NORMAL,
@ -1270,8 +1271,9 @@ nsPresContext::GetEventStateManager(nsIEventStateManager** aManager)
}
if (!mEventManager) {
nsresult rv = NS_NewEventStateManager(getter_AddRefs(mEventManager));
if (NS_OK != rv) {
nsresult rv;
mEventManager = do_CreateInstance(kEventStateManagerCID,&rv);
if (NS_FAILED(rv)) {
return rv;
}
}

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

@ -1,284 +0,0 @@
/* -*- 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
* 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 "nsStyleCoord.h"
#include "nsString.h"
#include "nsCRT.h"
nsStyleCoord::nsStyleCoord(nsStyleUnit aUnit)
: mUnit(aUnit)
{
NS_ASSERTION(aUnit < eStyleUnit_Percent, "not a valueless unit");
if (aUnit >= eStyleUnit_Percent) {
mUnit = eStyleUnit_Null;
}
mValue.mInt = 0;
}
nsStyleCoord::nsStyleCoord(nscoord aValue)
: mUnit(eStyleUnit_Coord)
{
mValue.mInt = aValue;
}
nsStyleCoord::nsStyleCoord(PRInt32 aValue, nsStyleUnit aUnit)
: mUnit(aUnit)
{
//if you want to pass in eStyleUnit_Coord, don't. instead, use the
//constructor just above this one... MMP
NS_ASSERTION((aUnit == eStyleUnit_Proportional) ||
(aUnit == eStyleUnit_Enumerated) ||
(aUnit == eStyleUnit_Integer), "not an int value");
if ((aUnit == eStyleUnit_Proportional) ||
(aUnit == eStyleUnit_Enumerated) ||
(aUnit == eStyleUnit_Integer)) {
mValue.mInt = aValue;
}
else {
mUnit = eStyleUnit_Null;
mValue.mInt = 0;
}
}
nsStyleCoord::nsStyleCoord(float aValue, nsStyleUnit aUnit)
: mUnit(aUnit)
{
NS_ASSERTION((aUnit == eStyleUnit_Percent) ||
(aUnit == eStyleUnit_Factor), "not a float value");
if ((aUnit == eStyleUnit_Percent) ||
(aUnit == eStyleUnit_Factor)) {
mValue.mFloat = aValue;
}
else {
mUnit = eStyleUnit_Null;
mValue.mInt = 0;
}
}
nsStyleCoord::nsStyleCoord(const nsStyleCoord& aCopy)
: mUnit(aCopy.mUnit)
{
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
mValue.mFloat = aCopy.mValue.mFloat;
}
else {
mValue.mInt = aCopy.mValue.mInt;
}
}
nsStyleCoord& nsStyleCoord::operator=(const nsStyleCoord& aCopy)
{
mUnit = aCopy.mUnit;
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
mValue.mFloat = aCopy.mValue.mFloat;
}
else {
mValue.mInt = aCopy.mValue.mInt;
}
return *this;
}
PRBool nsStyleCoord::operator==(const nsStyleCoord& aOther) const
{
if (mUnit == aOther.mUnit) {
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
return PRBool(mValue.mFloat == aOther.mValue.mFloat);
}
else {
return PRBool(mValue.mInt == aOther.mValue.mInt);
}
}
return PR_FALSE;
}
void nsStyleCoord::Reset(void)
{
mUnit = eStyleUnit_Null;
mValue.mInt = 0;
}
void nsStyleCoord::SetCoordValue(nscoord aValue)
{
mUnit = eStyleUnit_Coord;
mValue.mInt = aValue;
}
void nsStyleCoord::SetIntValue(PRInt32 aValue, nsStyleUnit aUnit)
{
NS_ASSERTION((aUnit == eStyleUnit_Proportional) ||
(aUnit == eStyleUnit_Enumerated) ||
(aUnit == eStyleUnit_Chars) ||
(aUnit == eStyleUnit_Integer), "not an int value");
if ((aUnit == eStyleUnit_Proportional) ||
(aUnit == eStyleUnit_Enumerated) ||
(aUnit == eStyleUnit_Chars) ||
(aUnit == eStyleUnit_Integer)) {
mUnit = aUnit;
mValue.mInt = aValue;
}
else {
Reset();
}
}
void nsStyleCoord::SetPercentValue(float aValue)
{
mUnit = eStyleUnit_Percent;
mValue.mFloat = aValue;
}
void nsStyleCoord::SetFactorValue(float aValue)
{
mUnit = eStyleUnit_Factor;
mValue.mFloat = aValue;
}
void nsStyleCoord::SetNormalValue(void)
{
mUnit = eStyleUnit_Normal;
mValue.mInt = 0;
}
void nsStyleCoord::SetAutoValue(void)
{
mUnit = eStyleUnit_Auto;
mValue.mInt = 0;
}
void nsStyleCoord::SetInheritValue(void)
{
mUnit = eStyleUnit_Inherit;
mValue.mInt = 0;
}
void nsStyleCoord::SetUnionValue(const nsStyleUnion& aValue, nsStyleUnit aUnit)
{
mUnit = aUnit;
#if PR_BYTES_PER_INT == PR_BYTES_PER_FLOAT
mValue.mInt = aValue.mInt;
#else
nsCRT::memcpy(&mValue, &aValue, sizeof(nsStyleUnion));
#endif
}
void nsStyleCoord::AppendToString(nsString& aBuffer) const
{
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
aBuffer.AppendFloat(mValue.mFloat);
}
else if ((eStyleUnit_Coord == mUnit) ||
(eStyleUnit_Proportional == mUnit) ||
(eStyleUnit_Enumerated == mUnit) ||
(eStyleUnit_Integer == mUnit)) {
aBuffer.AppendInt(mValue.mInt, 10);
aBuffer.AppendWithConversion("[0x");
aBuffer.AppendInt(mValue.mInt, 16);
aBuffer.AppendWithConversion(']');
}
switch (mUnit) {
case eStyleUnit_Null: aBuffer.AppendWithConversion("Null"); break;
case eStyleUnit_Coord: aBuffer.AppendWithConversion("tw"); break;
case eStyleUnit_Percent: aBuffer.AppendWithConversion("%"); break;
case eStyleUnit_Factor: aBuffer.AppendWithConversion("f"); break;
case eStyleUnit_Normal: aBuffer.AppendWithConversion("Normal"); break;
case eStyleUnit_Auto: aBuffer.AppendWithConversion("Auto"); break;
case eStyleUnit_Inherit: aBuffer.AppendWithConversion("Inherit"); break;
case eStyleUnit_Proportional: aBuffer.AppendWithConversion("*"); break;
case eStyleUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break;
case eStyleUnit_Integer: aBuffer.AppendWithConversion("int"); break;
case eStyleUnit_Chars: aBuffer.AppendWithConversion("chars"); break;
}
aBuffer.AppendWithConversion(' ');
}
void nsStyleCoord::ToString(nsString& aBuffer) const
{
aBuffer.Truncate();
AppendToString(aBuffer);
}
nsStyleSides::nsStyleSides(void)
{
nsCRT::memset(this, 0x00, sizeof(nsStyleSides));
}
#define COMPARE_SIDE(side) \
if ((eStyleUnit_Percent <= m##side##Unit) && (m##side##Unit < eStyleUnit_Coord)) { \
if (m##side##Value.mFloat != aOther.m##side##Value.mFloat) \
return PR_FALSE; \
} \
else { \
if (m##side##Value.mInt != aOther.m##side##Value.mInt) \
return PR_FALSE; \
}
PRBool nsStyleSides::operator==(const nsStyleSides& aOther) const
{
if ((mLeftUnit == aOther.mLeftUnit) &&
(mTopUnit == aOther.mTopUnit) &&
(mRightUnit == aOther.mRightUnit) &&
(mBottomUnit == aOther.mBottomUnit)) {
COMPARE_SIDE(Left);
COMPARE_SIDE(Top);
COMPARE_SIDE(Right);
COMPARE_SIDE(Bottom);
return PR_TRUE;
}
return PR_FALSE;
}
void nsStyleSides::Reset(void)
{
nsCRT::memset(this, 0x00, sizeof(nsStyleSides));
}
void nsStyleSides::AppendToString(nsString& aBuffer) const
{
nsStyleCoord temp;
GetLeft(temp);
aBuffer.AppendWithConversion("left: ");
temp.AppendToString(aBuffer);
GetTop(temp);
aBuffer.AppendWithConversion("top: ");
temp.AppendToString(aBuffer);
GetRight(temp);
aBuffer.AppendWithConversion("right: ");
temp.AppendToString(aBuffer);
GetBottom(temp);
aBuffer.AppendWithConversion("bottom: ");
temp.AppendToString(aBuffer);
}
void nsStyleSides::ToString(nsString& aBuffer) const
{
aBuffer.Truncate();
AppendToString(aBuffer);
}

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

@ -27,7 +27,7 @@ PROGRAMS = $(PROG1)
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I..\src
LLIBS= \
$(DIST)\lib\raptorlayout_s.lib \
$(DIST)\lib\layoutbase_s.lib \
$(DIST)\lib\gkgfxwin.lib \
$(DIST)\lib\xpcom.lib \
$(DIST)\lib\jsdom.lib \

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

@ -48,19 +48,13 @@ endif
EXPORTS = nsLayoutCID.h $(BUILD_DATE)
SHARED_LIBRARY_LIBS = \
$(DIST)/lib/libgkevents_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkhtmlbase_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkhtmlcon_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkhtmldoc_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkhtmlforms_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkhtmlstyle_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkhtmltable_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkxmlcon_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkxmldoc_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkxsldoc_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkxulcon_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkxulbase_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkxbl_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkbase_s.$(LIB_SUFFIX) \
$(NULL)

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

@ -41,11 +41,6 @@ void XXXNeverCalled()
NS_NewGalleyContext(&cx);
NS_NewPrintPreviewContext(&cx);
NS_NewPrintContext(&px);
nsIStyleSet* ss;
NS_NewStyleSet(&ss);
nsIDocument* doc;
NS_NewHTMLDocument(&doc);
NS_NewImageDocument(&doc);
nsIFrame* f;
NS_NewTextFrame(ps, &f);
NS_NewInlineFrame(ps, &f);
@ -58,7 +53,4 @@ void XXXNeverCalled()
NS_NewCanvasFrame(ps, &f);
NS_NewScrollFrame(ps, &f);
NS_NewSimplePageSequenceFrame(ps, &f);
nsINameSpaceManager* nsm;
NS_NewNameSpaceManager(&nsm);
NS_CreateHTMLElement(nsnull, nsnull);
}

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

@ -42,7 +42,7 @@ EXPORTS=nsLayoutCID.h $(BUILD_DATE)
MAKE_OBJ_TYPE = DLL
DLLNAME = gkhtml
DLLNAME = gklayout
DLL=.\$(OBJDIR)\$(DLLNAME).dll
LCFLAGS = \
@ -65,28 +65,22 @@ LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\dom \
# These are the libraries we need to link with to create the dll
LLIBS= \
$(DIST)\lib\raptorlayout_s.lib \
$(DIST)\lib\raptorhtmlbase_s.lib \
$(DIST)\lib\nglhtmlcon_s.lib \
$(DIST)\lib\raptorhtmldoc_s.lib \
$(DIST)\lib\raptorhtmlforms_s.lib \
$(DIST)\lib\raptorhtmlstyle_s.lib \
$(DIST)\lib\raptorhtmltable_s.lib \
$(DIST)\lib\raptorxmlcontent_s.lib \
$(DIST)\lib\raptorxmldoc_s.lib \
$(DIST)\lib\raptorxsldoc_s.lib \
$(DIST)\lib\raptorxulbase_s.lib \
$(DIST)\lib\raptorxulcontent_s.lib \
$(DIST)\lib\raptorxbl_s.lib \
$(DIST)\lib\layoutbase_s.lib \
$(DIST)\lib\layouthtmlbase_s.lib \
$(DIST)\lib\layouthtmldoc_s.lib \
$(DIST)\lib\layouthtmlforms_s.lib \
$(DIST)\lib\layouthtmlstyle_s.lib \
$(DIST)\lib\layouthtmltable_s.lib \
$(DIST)\lib\layoutxulbase_s.lib \
$(DIST)\lib\layoutxulcontent_s.lib \
!ifdef MOZ_MATHML
$(DIST)\lib\raptormathmlbase_s.lib \
$(DIST)\lib\raptormathmlcontent_s.lib \
$(DIST)\lib\layoutmathmlbase_s.lib \
$(DIST)\lib\layoutmathmlcontent_s.lib \
!endif
!ifdef MOZ_SVG
$(DIST)\lib\raptorsvgbase_s.lib \
$(DIST)\lib\raptorsvgcontent_s.lib \
$(DIST)\lib\layoutsvgbase_s.lib \
$(DIST)\lib\layoutsvgcontent_s.lib \
!endif
$(DIST)\lib\raptorevents_s.lib \
$(DIST)\lib\xpcom.lib \
$(DIST)\lib\gkgfxwin.lib \
$(DIST)\lib\timer_s.lib \

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

@ -27,6 +27,14 @@
#include "nsIFactory.h"
#include "nsIComponentManager.h"
// {1691E1F5-EE41-11d4-9885-00C04FA0CF4B}
#define NS_CSSFRAMECONSTRUCTOR_CID \
{ 0x1691e1f5, 0xee41, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
// {1691E1F4-EE41-11d4-9885-00C04FA0CF4B}
#define NS_FRAMETRAVERSAL_CID \
{ 0x1691e1f4, 0xee41, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
/* a6cf90fa-15b3-11d2-932e-00805f8add32 */
#define NS_LAYOUT_DOCUMENT_LOADER_FACTORY_CID \
{ 0xa6cf90fa, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
@ -91,9 +99,17 @@
#define NS_PRESSHELL_CID \
{ 0xe6fd9940, 0x899d, 0x11d2, { 0x8e, 0xae, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
// {96882B70-8A27-11d2-8EAF-00805F29F370}
#define NS_HTMLSTYLESHEET_CID \
{ 0x96882b70, 0x8a27, 0x11d2, { 0x8e, 0xaf, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
// {A1FDE861-E802-11d4-9885-00C04FA0CF4B}
#define NS_PRESSTATE_CID \
{ 0xa1fde861, 0xe802, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
// {A1FDE85E-E802-11d4-9885-00C04FA0CF4B}
#define NS_GALLEYCONTEXT_CID \
{ 0xa1fde85e, 0xe802, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
// {A1FDE85F-E802-11d4-9885-00C04FA0CF4B}
#define NS_PRINTCONTEXT_CID \
{ 0xa1fde85f, 0xe802, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
// {95F46161-D177-11d2-BF86-00105A1B0627}
#define NS_HTML_CSS_STYLESHEET_CID \
@ -139,10 +155,6 @@
{/* {a6cf90e5-15b3-11d2-932e-00805f8add32}*/ \
0xa6cf90e5, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
// {09F689E0-B4DA-11d2-A68B-00104BDE6048}
#define NS_EVENTLISTENERMANAGER_CID \
{ 0x9f689e0, 0xb4da, 0x11d2, { 0xa6, 0x8b, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 } }
/* a6cf90f7-15b3-11d2-932e-00805f8add32 */
#define NS_PRINT_PREVIEW_CONTEXT_CID \
{ 0xa6cf90f7, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}

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

@ -40,6 +40,10 @@
#include "nsIStreamLoadableDocument.h"
#include "nsIDocStreamLoaderFactory.h"
#include "nsContentCID.h"
static NS_DEFINE_CID(kDocumentViewerCID, NS_DOCUMENT_VIEWER_CID);
static NS_DEFINE_CID(kCSSLoaderCID, NS_CSS_LOADER_CID);
#define VIEW_SOURCE_HTML
// URL for the "user agent" style sheet
@ -54,8 +58,6 @@ static NS_DEFINE_IID(kXMLDocumentCID, NS_XMLDOCUMENT_CID);
static NS_DEFINE_IID(kImageDocumentCID, NS_IMAGEDOCUMENT_CID);
static NS_DEFINE_IID(kXULDocumentCID, NS_XULDOCUMENT_CID);
extern nsresult NS_NewDocumentViewer(nsIDocumentViewer** aResult);
static char* gHTMLTypes[] = {
"text/html",
"text/plain",
@ -227,8 +229,7 @@ nsLayoutDLF::CreateInstance(const char *aCommand,
nsCOMPtr<nsIURI> uaURL;
rv = NS_NewURI(getter_AddRefs(uaURL), UA_CSS_URL);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsICSSLoader> cssLoader;
rv = NS_NewCSSLoader(getter_AddRefs(cssLoader));
nsCOMPtr<nsICSSLoader> cssLoader(do_CreateInstance(kCSSLoaderCID,&rv));
if (cssLoader) {
PRBool complete;
rv = cssLoader->LoadAgentSheet(uaURL, nsLayoutModule::gUAStyleSheet, complete,
@ -316,9 +317,7 @@ nsLayoutDLF::CreateInstanceForDocument(nsISupports* aContainer,
nsresult rv = NS_ERROR_FAILURE;
do {
nsCOMPtr<nsIDocumentViewer> docv;
// Create the document viewer
rv = NS_NewDocumentViewer(getter_AddRefs(docv));
nsCOMPtr<nsIDocumentViewer> docv(do_CreateInstance(kDocumentViewerCID,&rv));
if (NS_FAILED(rv))
break;
docv->SetUAStyleSheet(nsLayoutDLF::GetUAStyleSheet());
@ -367,7 +366,7 @@ nsLayoutDLF::CreateDocument(const char* aCommand,
break;
// Create the document viewer XXX: could reuse document viewer here!
rv = NS_NewDocumentViewer(getter_AddRefs(docv));
docv = do_CreateInstance(kDocumentViewerCID,&rv);
if (NS_FAILED(rv))
break;
docv->SetUAStyleSheet(nsLayoutDLF::GetUAStyleSheet());
@ -429,7 +428,7 @@ nsLayoutDLF::CreateRDFDocument(nsISupports* aExtraInfo,
if (NS_FAILED(rv)) return rv;
// Create the image content viewer...
rv = NS_NewDocumentViewer(getter_AddRefs(*docv));
rv = nsComponentManager::CreateInstance(kDocumentViewerCID,nsnull,NS_GET_IID(nsIDocumentViewer),getter_AddRefs(*docv));
if (NS_FAILED(rv)) return rv;
// Load the UA style sheet if we haven't already done that

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

@ -28,20 +28,17 @@
#include "nsIHTMLContent.h"
#include "nsITextContent.h"
#include "nsIPresShell.h"
#include "nsIPresState.h"
#include "nsIPresContext.h"
#include "nsISelection.h"
#include "nsIPrintContext.h"
#include "nsIFrameUtil.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLParts.h"
#include "nsDOMCID.h"
#include "nsIServiceManager.h"
#include "nsICSSParser.h"
#include "nsIHTMLStyleSheet.h"
#include "nsIHTMLCSSStyleSheet.h"
#include "nsICSSLoader.h"
#include "nsIDOMRange.h"
#include "nsIContentIterator.h"
#include "nsINameSpaceManager.h"
#include "nsIScriptNameSetRegistry.h"
#include "nsIScriptNameSpaceManager.h"
@ -51,69 +48,34 @@
#include "nsIElementFactory.h"
#include "nsIDocumentEncoder.h"
#include "nsCOMPtr.h"
#include "nsIFrameSelection.h"
#include "nsIDOMDOMImplementation.h"
#include "nsIPrivateDOMImplementation.h"
#include "nsIXBLService.h"
#include "nsIBindingManager.h"
#include "nsIBoxObject.h"
#include "nsIAutoCopy.h"
#include "nsContentPolicyUtils.h"
#include "nsXMLContentSerializer.h"
#include "nsHTMLContentSerializer.h"
#include "nsPlainTextSerializer.h"
#include "nsINodeInfo.h"
#include "nsIComputedDOMStyle.h"
#include "nsIFrameTraversal.h"
#include "nsICSSFrameConstructor.h"
class nsIDocumentLoaderFactory;
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
static NS_DEFINE_IID(kHTMLDocumentCID, NS_HTMLDOCUMENT_CID);
static NS_DEFINE_IID(kXMLDocumentCID, NS_XMLDOCUMENT_CID);
static NS_DEFINE_CID(kXMLElementFactoryCID, NS_XML_ELEMENT_FACTORY_CID);
static NS_DEFINE_IID(kImageDocumentCID, NS_IMAGEDOCUMENT_CID);
static NS_DEFINE_IID(kCSSParserCID, NS_CSSPARSER_CID);
static NS_DEFINE_CID(kHTMLStyleSheetCID, NS_HTMLSTYLESHEET_CID);
static NS_DEFINE_CID(kHTMLCSSStyleSheetCID, NS_HTML_CSS_STYLESHEET_CID);
static NS_DEFINE_CID(kCSSLoaderCID, NS_CSS_LOADER_CID);
static NS_DEFINE_IID(kHTMLImageElementCID, NS_HTMLIMAGEELEMENT_CID);
static NS_DEFINE_IID(kHTMLOptionElementCID, NS_HTMLOPTIONELEMENT_CID);
static NS_DEFINE_CID(kSelectionCID, NS_SELECTION_CID);
static NS_DEFINE_IID(kFrameSelectionCID, NS_FRAMESELECTION_CID);
static NS_DEFINE_IID(kDOMSelectionCID, NS_DOMSELECTION_CID);
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
static NS_DEFINE_IID(kContentIteratorCID, NS_CONTENTITERATOR_CID);
static NS_DEFINE_IID(kGeneratedContentIteratorCID, NS_GENERATEDCONTENTITERATOR_CID);
static NS_DEFINE_IID(kGeneratedSubtreeIteratorCID, NS_GENERATEDSUBTREEITERATOR_CID);
static NS_DEFINE_IID(kSubtreeIteratorCID, NS_SUBTREEITERATOR_CID);
static NS_DEFINE_CID(kPresShellCID, NS_PRESSHELL_CID);
static NS_DEFINE_CID(kPresStateCID, NS_PRESSTATE_CID);
static NS_DEFINE_CID(kGalleyContextCID, NS_GALLEYCONTEXT_CID);
static NS_DEFINE_CID(kPrintContextCID, NS_PRINTCONTEXT_CID);
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
static NS_DEFINE_CID(kFrameUtilCID, NS_FRAME_UTIL_CID);
static NS_DEFINE_CID(kEventListenerManagerCID, NS_EVENTLISTENERMANAGER_CID);
static NS_DEFINE_CID(kFrameTraversalCID, NS_FRAMETRAVERSAL_CID);
static NS_DEFINE_CID(kCSSFrameConstructorCID, NS_CSSFRAMECONSTRUCTOR_CID);
static NS_DEFINE_CID(kPrintPreviewContextCID, NS_PRINT_PREVIEW_CONTEXT_CID);
static NS_DEFINE_CID(kLayoutDocumentLoaderFactoryCID, NS_LAYOUT_DOCUMENT_LOADER_FACTORY_CID);
static NS_DEFINE_CID(kLayoutDebuggerCID, NS_LAYOUT_DEBUGGER_CID);
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
static NS_DEFINE_CID(kTextEncoderCID, NS_TEXT_ENCODER_CID);
static NS_DEFINE_CID(kHTMLCopyTextEncoderCID, NS_HTMLCOPY_TEXT_ENCODER_CID);
static NS_DEFINE_CID(kXMLContentSerializerCID, NS_XMLCONTENTSERIALIZER_CID);
static NS_DEFINE_CID(kHTMLContentSerializerCID, NS_HTMLCONTENTSERIALIZER_CID);
static NS_DEFINE_CID(kPlainTextSerializerCID, NS_PLAINTEXTSERIALIZER_CID);
static NS_DEFINE_CID(kXBLServiceCID, NS_XBLSERVICE_CID);
static NS_DEFINE_CID(kBindingManagerCID, NS_BINDINGMANAGER_CID);
static NS_DEFINE_CID(kBoxObjectCID, NS_BOXOBJECT_CID);
static NS_DEFINE_CID(kTreeBoxObjectCID, NS_TREEBOXOBJECT_CID);
@ -124,35 +86,13 @@ static NS_DEFINE_CID(kBrowserBoxObjectCID, NS_BROWSERBOXOBJECT_CID);
static NS_DEFINE_CID(kEditorBoxObjectCID, NS_EDITORBOXOBJECT_CID);
static NS_DEFINE_CID(kIFrameBoxObjectCID, NS_IFRAMEBOXOBJECT_CID);
static NS_DEFINE_CID(kDOMImplementationCID, NS_DOM_IMPLEMENTATION_CID);
static NS_DEFINE_CID(kNodeInfoManagerCID, NS_NODEINFOMANAGER_CID);
static NS_DEFINE_CID(kAutoCopyServiceCID, NS_AUTOCOPYSERVICE_CID);
static NS_DEFINE_CID(kContentPolicyCID, NS_CONTENTPOLICY_CID);
static NS_DEFINE_CID(kComputedDOMStyleCID, NS_COMPUTEDDOMSTYLE_CID);
extern nsresult NS_NewSelection(nsIFrameSelection** aResult);
extern nsresult NS_NewDomSelection(nsISelection** aResult);
extern nsresult NS_NewRange(nsIDOMRange** aResult);
extern nsresult NS_NewContentIterator(nsIContentIterator** aResult);
extern nsresult NS_NewGenRegularIterator(nsIContentIterator** aResult);
extern nsresult NS_NewContentSubtreeIterator(nsIContentIterator** aResult);
extern nsresult NS_NewGenSubtreeIterator(nsIContentIterator** aInstancePtrResult);
extern nsresult NS_NewLayoutDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
#ifdef NS_DEBUG
extern nsresult NS_NewFrameUtil(nsIFrameUtil** aResult);
extern nsresult NS_NewLayoutDebugger(nsILayoutDebugger** aResult);
#endif
extern nsresult NS_NewHTMLElementFactory(nsIElementFactory** aResult);
extern nsresult NS_NewXMLElementFactory(nsIElementFactory** aResult);
extern nsresult NS_NewHTMLCopyTextEncoder(nsIDocumentEncoder** aResult);
extern nsresult NS_NewTextEncoder(nsIDocumentEncoder** aResult);
extern nsresult NS_NewXBLService(nsIXBLService** aResult);
extern nsresult NS_NewBindingManager(nsIBindingManager** aResult);
extern nsresult NS_NewBoxObject(nsIBoxObject** aResult);
extern nsresult NS_NewTreeBoxObject(nsIBoxObject** aResult);
@ -163,11 +103,16 @@ extern nsresult NS_NewPopupSetBoxObject(nsIBoxObject** aResult);
extern nsresult NS_NewBrowserBoxObject(nsIBoxObject** aResult);
extern nsresult NS_NewIFrameBoxObject(nsIBoxObject** aResult);
extern nsresult NS_NewNodeInfoManager(nsINodeInfoManager** aResult);
extern nsresult NS_NewAutoCopyService(nsIAutoCopyService** aResult);
extern nsresult NS_NewContentPolicy(nsIContentPolicy** aResult);
extern nsresult NS_NewGalleyContext(nsIPresContext** aResult);
extern nsresult NS_NewPresShell(nsIPresShell** aResult);
extern nsresult NS_NewPresState(nsIPresState** aResult);
extern nsresult NS_NewPrintContext(nsIPrintContext** aResult);
extern nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult);
extern nsresult NS_CreateCSSFrameConstructor(nsICSSFrameConstructor** aResult);
//----------------------------------------------------------------------
@ -221,47 +166,10 @@ nsLayoutFactory::CreateInstance(nsISupports *aOuter,
nsISupports *inst = nsnull;
// XXX ClassID check happens here
if (mClassID.Equals(kHTMLDocumentCID)) {
res = NS_NewHTMLDocument((nsIDocument **)&inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewHTMLDocument", res);
return res;
}
}
else if (mClassID.Equals(kXMLDocumentCID)) {
res = NS_NewXMLDocument((nsIDocument **)&inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewXMLDocument", res);
return res;
}
}
else if (mClassID.Equals(kImageDocumentCID)) {
res = NS_NewImageDocument((nsIDocument **)&inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewImageDocument", res);
return res;
}
}
#if 1
// XXX replace these with nsIElementFactory calls
else if (mClassID.Equals(kHTMLImageElementCID)) {
// Note! NS_NewHTMLImageElement is special cased to handle a null nodeinfo
res = NS_NewHTMLImageElement((nsIHTMLContent**)&inst, nsnull);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewHTMLImageElement", res);
return res;
}
}
else if (mClassID.Equals(kHTMLOptionElementCID)) {
// Note! NS_NewHTMLOptionElement is special cased to handle a null nodeinfo
res = NS_NewHTMLOptionElement((nsIHTMLContent**)&inst, nsnull);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewHTMLOptionElement", res);
return res;
}
}
// XXX why the heck is this exported???? bad bad bad bad
else if (mClassID.Equals(kPresShellCID)) {
if (mClassID.Equals(kPresShellCID)) {
res = NS_NewPresShell((nsIPresShell**) &inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewPresShell", res);
@ -269,101 +177,24 @@ nsLayoutFactory::CreateInstance(nsISupports *aOuter,
}
}
#endif
else if (mClassID.Equals(kFrameSelectionCID)) {
res = NS_NewSelection((nsIFrameSelection**)&inst);
else if (mClassID.Equals(kPresStateCID)) {
res = NS_NewPresState((nsIPresState**) &inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewSelection", res);
LOG_NEW_FAILURE("NS_NewPresState", res);
return res;
}
}
else if (mClassID.Equals(kDOMSelectionCID)) {
res = NS_NewDomSelection((nsISelection**)&inst);
else if (mClassID.Equals(kFrameTraversalCID)) {
res = NS_CreateFrameTraversal((nsIFrameTraversal**)&inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewDomSelection", res);
LOG_NEW_FAILURE("NS_CreateFrameTraversal", res);
return res;
}
}
else if (mClassID.Equals(kRangeCID)) {
res = NS_NewRange((nsIDOMRange **)&inst);
else if (mClassID.Equals(kCSSFrameConstructorCID)) {
res = NS_CreateCSSFrameConstructor((nsICSSFrameConstructor**)&inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewRange", res);
return res;
}
}
else if (mClassID.Equals(kContentIteratorCID)) {
res = NS_NewContentIterator((nsIContentIterator **)&inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewContentIterator", res);
return res;
}
}
else if (mClassID.Equals(kGeneratedContentIteratorCID)) {
res = NS_NewGenRegularIterator((nsIContentIterator **)&inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewGenRegularIterator", res);
return res;
}
}
else if (mClassID.Equals(kSubtreeIteratorCID)) {
res = NS_NewContentSubtreeIterator((nsIContentIterator **)&inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewContentSubtreeIterator", res);
return res;
}
}
else if (mClassID.Equals(kGeneratedSubtreeIteratorCID)) {
res = NS_NewGenSubtreeIterator((nsIContentIterator **)&inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewGenSubtreeIterator", res);
return res;
}
}
else if (mClassID.Equals(kCSSParserCID)) {
res = NS_NewCSSParser((nsICSSParser**)&inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewCSSParser", res);
return res;
}
}
else if (mClassID.Equals(kHTMLStyleSheetCID)) {
res = NS_NewHTMLStyleSheet((nsIHTMLStyleSheet**)&inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewHTMLStyleSheet", res);
return res;
}
}
else if (mClassID.Equals(kHTMLCSSStyleSheetCID)) {
res = NS_NewHTMLCSSStyleSheet((nsIHTMLCSSStyleSheet**)&inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewHTMLCSSStyleSheet", res);
return res;
}
}
else if (mClassID.Equals(kCSSLoaderCID)) {
res = NS_NewCSSLoader((nsICSSLoader**)&inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewCSSLoader", res);
return res;
}
}
else if (mClassID.Equals(kTextNodeCID)) {
res = NS_NewTextNode((nsIContent**) &inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewTextNode", res);
return res;
}
}
else if (mClassID.Equals(kNameSpaceManagerCID)) {
res = NS_NewNameSpaceManager((nsINameSpaceManager**)&inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewNameSpaceManager", res);
return res;
}
}
else if (mClassID.Equals(kEventListenerManagerCID)) {
res = NS_NewEventListenerManager((nsIEventListenerManager**) &inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewEventListenerManager", res);
LOG_NEW_FAILURE("NS_CreateCSSFrameConstructor", res);
return res;
}
}
@ -374,6 +205,20 @@ nsLayoutFactory::CreateInstance(nsISupports *aOuter,
return res;
}
}
else if (mClassID.Equals(kPrintContextCID)) {
res = NS_NewPrintContext((nsIPrintContext**) &inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewPrintContext", res);
return res;
}
}
else if (mClassID.Equals(kGalleyContextCID)) {
res = NS_NewGalleyContext((nsIPresContext**) &inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewGalleyContext", res);
return res;
}
}
else if (mClassID.Equals(kLayoutDocumentLoaderFactoryCID)) {
res = NS_NewLayoutDocumentLoaderFactory((nsIDocumentLoaderFactory**)&inst);
if (NS_FAILED(res)) {
@ -397,69 +242,6 @@ nsLayoutFactory::CreateInstance(nsISupports *aOuter,
}
}
#endif
else if (mClassID.Equals(kHTMLElementFactoryCID)) {
res = NS_NewHTMLElementFactory((nsIElementFactory**) &inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewHTMLElementFactory", res);
return res;
}
}
else if (mClassID.Equals(kXMLElementFactoryCID)) {
res = NS_NewXMLElementFactory((nsIElementFactory**) &inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewXMLElementFactory", res);
return res;
}
}
else if (mClassID.Equals(kTextEncoderCID)) {
res = NS_NewTextEncoder((nsIDocumentEncoder**) &inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewTextEncoder", res);
return res;
}
}
else if (mClassID.Equals(kHTMLCopyTextEncoderCID)) {
res = NS_NewHTMLCopyTextEncoder((nsIDocumentEncoder**) &inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewHTMLCopyTextEncoder", res);
return res;
}
}
else if (mClassID.Equals(kXMLContentSerializerCID)) {
res = NS_NewXMLContentSerializer((nsIContentSerializer**) &inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewXMLContentSerializer", res);
return res;
}
}
else if (mClassID.Equals(kHTMLContentSerializerCID)) {
res = NS_NewHTMLContentSerializer((nsIContentSerializer**) &inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewHTMLContentSerializer", res);
return res;
}
}
else if (mClassID.Equals(kPlainTextSerializerCID)) {
res = NS_NewPlainTextSerializer((nsIContentSerializer**) &inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewPlainTextSerializer", res);
return res;
}
}
else if (mClassID.Equals(kXBLServiceCID)) {
res = NS_NewXBLService((nsIXBLService**) &inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewXBLService", res);
return res;
}
}
else if (mClassID.Equals(kBindingManagerCID)) {
res = NS_NewBindingManager((nsIBindingManager**) &inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewBindingManager", res);
return res;
}
}
else if (mClassID.Equals(kBoxObjectCID)) {
res = NS_NewBoxObject((nsIBoxObject**) &inst);
if (NS_FAILED(res)) {
@ -509,13 +291,6 @@ nsLayoutFactory::CreateInstance(nsISupports *aOuter,
return res;
}
}
else if (mClassID.Equals(kNodeInfoManagerCID)) {
res = NS_NewNodeInfoManager((nsINodeInfoManager**) &inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewNodeInfoManager", res);
return res;
}
}
else if (mClassID.Equals(kAutoCopyServiceCID)) {
res = NS_NewAutoCopyService((nsIAutoCopyService**) &inst);
if (NS_FAILED(res)) {
@ -523,27 +298,6 @@ nsLayoutFactory::CreateInstance(nsISupports *aOuter,
return res;
}
}
else if (mClassID.Equals(kDOMImplementationCID)) {
res = NS_NewDOMImplementation((nsIDOMDOMImplementation**) &inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewDOMImplementation", res);
return res;
}
}
else if (mClassID.Equals(kContentPolicyCID)) {
res = NS_NewContentPolicy((nsIContentPolicy**) &inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewContentPolicy", res);
return res;
}
}
else if (mClassID.Equals(kComputedDOMStyleCID)) {
res = NS_NewComputedDOMStyle((nsIComputedDOMStyle**) &inst);
if (NS_FAILED(res)) {
LOG_NEW_FAILURE("NS_NewComputedDOMStyle", res);
return res;
}
}
else if (mClassID.Equals(kScrollBoxObjectCID)) {
res = NS_NewScrollBoxObject((nsIBoxObject**) &inst);
if (NS_FAILED(res)) {

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

@ -28,7 +28,6 @@
#include "nsIComponentManager.h"
#include "nsNetUtil.h"
#include "nsICSSStyleSheet.h"
#include "nsICSSLoader.h"
#include "nsHTMLAtoms.h"
#include "nsCSSKeywords.h" // to addref/release table
#include "nsCSSProps.h" // to addref/release table
@ -68,8 +67,6 @@
#include "nsIServiceManager.h"
#include "nsTextTransformer.h"
#include "nsRange.h"
#include "nsGenericElement.h"
#ifdef INCLUDE_XUL
#include "nsBulletinBoardLayout.h"
#include "nsRepeatService.h"
@ -264,9 +261,6 @@ nsLayoutModule::Shutdown()
nsStackLayout::Shutdown();
#endif
nsRange::Shutdown();
nsGenericElement::Shutdown();
// Release all of our atoms
nsColorNames::ReleaseTable();
nsCSSProps::ReleaseTable();
@ -276,7 +270,7 @@ nsLayoutModule::Shutdown()
nsLayoutAtoms::ReleaseAtoms();
#ifdef INCLUDE_XUL
nsXULAtoms::ReleaseAtoms();
#endif
#endif
//MathML Mod - RBS
#ifdef MOZ_MATHML
nsMathMLOperators::ReleaseTable();
@ -328,66 +322,20 @@ struct Components {
// The list of components we register
static Components gComponents[] = {
{ "Namespace manager", NS_NAMESPACEMANAGER_CID, nsnull, },
{ "Event listener manager", NS_EVENTLISTENERMANAGER_CID, nsnull, },
{ "Frame utility", NS_FRAME_UTIL_CID, nsnull, },
{ "Print preview context", NS_PRINT_PREVIEW_CONTEXT_CID, nsnull, },
{ "Layout debugger", NS_LAYOUT_DEBUGGER_CID, nsnull, },
{ "HTML document", NS_HTMLDOCUMENT_CID, nsnull, },
{ "HTML style sheet", NS_HTMLSTYLESHEET_CID, nsnull, },
{ "HTML-CSS style sheet", NS_HTML_CSS_STYLESHEET_CID, nsnull, },
{ "DOM implementation", NS_DOM_IMPLEMENTATION_CID, nsnull, },
{ "XML document", NS_XMLDOCUMENT_CID, nsnull, },
{ "Image document", NS_IMAGEDOCUMENT_CID, nsnull, },
{ "CSS parser", NS_CSSPARSER_CID, nsnull, },
{ "CSS loader", NS_CSS_LOADER_CID, nsnull, },
{ "HTML element factory", NS_HTML_ELEMENT_FACTORY_CID, NS_HTML_ELEMENT_FACTORY_CONTRACTID, },
{ "Text element", NS_TEXTNODE_CID, nsnull, },
{ "XML element factory", NS_XML_ELEMENT_FACTORY_CID, NS_XML_ELEMENT_FACTORY_CONTRACTID, },
{ "Selection", NS_SELECTION_CID, nsnull, },
{ "Frame selection", NS_FRAMESELECTION_CID, nsnull, },
{ "Dom selection", NS_DOMSELECTION_CID, nsnull, },
{ "Range", NS_RANGE_CID, nsnull, },
{ "Content iterator", NS_CONTENTITERATOR_CID, nsnull, },
{ "Generated Content iterator", NS_GENERATEDCONTENTITERATOR_CID, nsnull, },
{ "Generated Subtree iterator", NS_GENERATEDSUBTREEITERATOR_CID, nsnull, },
{ "Subtree iterator", NS_SUBTREEITERATOR_CID, nsnull, },
{ "CSS Frame Constructor", NS_CSSFRAMECONSTRUCTOR_CID, nsnull, },
{ "Frame Traversal", NS_FRAMETRAVERSAL_CID, nsnull, },
// XXX ick
{ "HTML image element", NS_HTMLIMAGEELEMENT_CID, nsnull, },
{ "HTML option element", NS_HTMLOPTIONELEMENT_CID, nsnull, },
{ "Presentation shell", NS_PRESSHELL_CID, nsnull, },
{ "Presentation state", NS_PRESSTATE_CID, nsnull, },
{ "Galley context", NS_GALLEYCONTEXT_CID, nsnull, },
{ "Print context", NS_PRINTCONTEXT_CID, nsnull, },
// XXX end ick
{ "XML document encoder", NS_TEXT_ENCODER_CID,
NS_DOC_ENCODER_CONTRACTID_BASE "text/xml", },
{ "HTML document encoder", NS_TEXT_ENCODER_CID,
NS_DOC_ENCODER_CONTRACTID_BASE "text/html", },
{ "Plaintext document encoder", NS_TEXT_ENCODER_CID,
NS_DOC_ENCODER_CONTRACTID_BASE "text/plain", },
{ "HTML copy encoder", NS_HTMLCOPY_TEXT_ENCODER_CID,
NS_HTMLCOPY_ENCODER_CONTRACTID, },
{ "XML content serializer", NS_XMLCONTENTSERIALIZER_CID,
NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/xml", },
{ "HTML content serializer", NS_HTMLCONTENTSERIALIZER_CID,
NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/html", },
{ "XUL content serializer", NS_XMLCONTENTSERIALIZER_CID,
NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/xul", },
{ "plaintext content serializer", NS_PLAINTEXTSERIALIZER_CID,
NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/plain", },
{ "plaintext sink", NS_PLAINTEXTSERIALIZER_CID,
NS_PLAINTEXTSINK_CONTRACTID, },
{ "XBL Service", NS_XBLSERVICE_CID, "@mozilla.org/xbl;1" },
{ "XBL Binding Manager", NS_BINDINGMANAGER_CID, "@mozilla.org/xbl/binding-manager;1" },
{ "XUL Box Object", NS_BOXOBJECT_CID, "@mozilla.org/layout/xul-boxobject;1" },
{ "XUL Tree Box Object", NS_TREEBOXOBJECT_CID, "@mozilla.org/layout/xul-boxobject-tree;1" },
{ "XUL Menu Box Object", NS_MENUBOXOBJECT_CID, "@mozilla.org/layout/xul-boxobject-menu;1" },
@ -397,11 +345,7 @@ static Components gComponents[] = {
{ "XUL Iframe Object", NS_IFRAMEBOXOBJECT_CID, "@mozilla.org/layout/xul-boxobject-iframe;1" },
{ "XUL ScrollBox Object", NS_SCROLLBOXOBJECT_CID, "@mozilla.org/layout/xul-boxobject-scrollbox;1" },
{ "AutoCopy Service", NS_AUTOCOPYSERVICE_CID, "@mozilla.org/autocopy;1" },
{ "Content policy service", NS_CONTENTPOLICY_CID, NS_CONTENTPOLICY_CONTRACTID },
{ "NodeInfoManager", NS_NODEINFOMANAGER_CID, NS_NODEINFOMANAGER_CONTRACTID },
{ "DOM CSS Computed Style Declaration", NS_COMPUTEDDOMSTYLE_CID,
"@mozilla.org/DOM/Level2/CSS/computedStyleDeclaration;1" }
{ "AutoCopy Service", NS_AUTOCOPYSERVICE_CID, "@mozilla.org/autocopy;1" }
};
#define NUM_COMPONENTS (sizeof(gComponents) / sizeof(gComponents[0]))

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

@ -60,7 +60,10 @@
#include "nsINodeInfo.h"
#include "nsIScrollableFrame.h"
#include "nsIScrollableView.h"
#include "nsIElementFactory.h"
#include "nsContentCID.h"
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
#include "nsIXULDocument.h" // Temporary fix for Bug 36558
@ -2159,8 +2162,8 @@ nsComboboxControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
//nsIAtom* tag = NS_NewAtom("mozcombodisplay");
// Add a child text content node for the label
nsCOMPtr<nsIContent> labelContent;
nsresult result = NS_NewTextNode(getter_AddRefs(labelContent));
nsresult result;
nsCOMPtr<nsIContent> labelContent(do_CreateInstance(kTextNodeCID,&result));
nsAutoString value; value.AssignWithConversion("X");
if (NS_SUCCEEDED(result) && labelContent) {
// set the value of the text node
@ -2185,11 +2188,17 @@ nsComboboxControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
aChildList.AppendElement(labelContent);
// create button which drops the list down
nsCOMPtr<nsIHTMLContent> btnContent;
result = NS_NewHTMLInputElement(getter_AddRefs(btnContent), nodeInfo);
if (NS_SUCCEEDED(result) && btnContent) {
btnContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("button"), PR_FALSE);
aChildList.AppendElement(btnContent);
nsCOMPtr<nsIElementFactory> ef(do_CreateInstance(kHTMLElementFactoryCID));
if (ef) {
nsCOMPtr<nsIContent> content;
result = ef->CreateInstanceByTag(nodeInfo,getter_AddRefs(content));
if (NS_SUCCEEDED(result)) {
nsCOMPtr<nsIHTMLContent> btnContent(do_QueryInterface(content));
if (btnContent) {
btnContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("button"), PR_FALSE);
aChildList.AppendElement(btnContent);
}
}
}
}

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

@ -24,7 +24,7 @@
#include "nsFormFrame.h"
#include "nsIElementFactory.h"
#include "nsIContent.h"
#include "prtypes.h"
#include "nsIAtom.h"
@ -58,7 +58,8 @@
#include "nsIDOMEventReceiver.h"
#include "nsIScriptGlobalObject.h"
#include "nsContentCID.h"
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
nsresult
NS_NewFileControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
@ -122,7 +123,16 @@ nsFileControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
nimgr->GetNodeInfo(nsHTMLAtoms::input, nsnull, kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
if (NS_OK == NS_NewHTMLInputElement(&mTextContent, nodeInfo)) {
nsCOMPtr<nsIElementFactory> ef(do_CreateInstance(kHTMLElementFactoryCID,&rv));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIContent> content;
rv = ef->CreateInstanceByTag(nodeInfo,getter_AddRefs(content));
NS_ENSURE_SUCCESS(rv, rv);
rv = content->QueryInterface(NS_GET_IID(nsIHTMLContent),(void**)&mTextContent);
if (NS_SUCCEEDED(rv)) {
mTextContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("text"), PR_FALSE);
if (nsFormFrame::GetDisabled(this)) {
nsCOMPtr<nsIDOMHTMLInputElement> textControl = do_QueryInterface(mTextContent);
@ -134,7 +144,12 @@ nsFileControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
}
// create browse button
if (NS_OK == NS_NewHTMLInputElement(getter_AddRefs(mBrowse), nodeInfo)) {
rv = ef->CreateInstanceByTag(nodeInfo,getter_AddRefs(content));
NS_ENSURE_SUCCESS(rv, rv);
mBrowse = do_QueryInterface(content,&rv);
if (NS_SUCCEEDED(rv)) {
mBrowse->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("button"), PR_FALSE);
//browse->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::value, nsAutoString("browse..."), PR_FALSE);

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

@ -27,6 +27,8 @@
#include "nsFormControlFrame.h"
#include "nsISupportsArray.h"
#include "nsINameSpaceManager.h"
#include "nsContentCID.h"
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
// Saving PresState
#include "nsIPresState.h"
@ -395,8 +397,7 @@ nsGfxButtonControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
}
// Add a child text content node for the label
nsCOMPtr<nsIContent> labelContent;
result = NS_NewTextNode(getter_AddRefs(labelContent));
nsCOMPtr<nsIContent> labelContent(do_CreateInstance(kTextNodeCID,&result));
if (NS_SUCCEEDED(result) && labelContent) {
// set the value of the text node and add it to the child list
mTextContent = do_QueryInterface(labelContent, &result);

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

@ -60,6 +60,11 @@
#include "nsIFormControlFrame.h"
#include "nsINodeInfo.h"
#include "nsIDOMEventReceiver.h"
#include "nsIElementFactory.h"
#include "nsContentCID.h"
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
@ -206,22 +211,28 @@ nsIsIndexFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
nsCOMPtr<nsIDocument> doc;
mContent->GetDocument(*getter_AddRefs(doc));
nsCOMPtr<nsINodeInfoManager> nimgr;
nsresult rv = doc->GetNodeInfoManager(*getter_AddRefs(nimgr));
NS_ENSURE_SUCCESS(rv, rv);
result = doc->GetNodeInfoManager(*getter_AddRefs(nimgr));
NS_ENSURE_SUCCESS(result, result);
nsCOMPtr<nsIElementFactory> ef(do_CreateInstance(kHTMLElementFactoryCID,&result));
NS_ENSURE_SUCCESS(result, result);
// Create an hr
nsCOMPtr<nsINodeInfo> hrInfo;
nsCOMPtr<nsIHTMLContent> prehr;
nimgr->GetNodeInfo(nsHTMLAtoms::hr, nsnull, kNameSpaceID_None,
*getter_AddRefs(hrInfo));
if (NS_OK == NS_NewHTMLHRElement(getter_AddRefs(prehr), hrInfo)) {
nsCOMPtr<nsIContent> content;
result = ef->CreateInstanceByTag(hrInfo,getter_AddRefs(content));
NS_ENSURE_SUCCESS(result, result);
nsCOMPtr<nsIHTMLContent> prehr(do_QueryInterface(content,&result));
if (NS_SUCCEEDED(result)) {
result = aChildList.AppendElement(prehr);
}
// Add a child text content node for the label
if (NS_SUCCEEDED(result)) {
nsCOMPtr<nsIContent> labelContent;
result = NS_NewTextNode(getter_AddRefs(labelContent));
nsCOMPtr<nsIContent> labelContent(do_CreateInstance(kTextNodeCID,&result));
if (NS_SUCCEEDED(result) && labelContent) {
// set the value of the text node and add it to the child list
result = labelContent->QueryInterface(NS_GET_IID(nsITextContent),(void**)&mTextContent);
@ -237,7 +248,12 @@ nsIsIndexFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
nimgr->GetNodeInfo(nsHTMLAtoms::input, nsnull, kNameSpaceID_None,
*getter_AddRefs(inputInfo));
if (NS_OK == NS_NewHTMLInputElement(&mInputContent, inputInfo)) {
result = ef->CreateInstanceByTag(inputInfo,getter_AddRefs(content));
NS_ENSURE_SUCCESS(result, result);
result = content->QueryInterface(NS_GET_IID(nsIHTMLContent),(void**)&mInputContent);
if (NS_SUCCEEDED(result)) {
mInputContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("text"), PR_FALSE);
aChildList.AppendElement(mInputContent);
@ -247,8 +263,11 @@ nsIsIndexFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
}
// Create an hr
nsCOMPtr<nsIHTMLContent> posthr;
if (NS_OK == NS_NewHTMLHRElement(getter_AddRefs(posthr), hrInfo)) {
result = ef->CreateInstanceByTag(hrInfo,getter_AddRefs(content));
NS_ENSURE_SUCCESS(result, result);
nsCOMPtr<nsIHTMLContent> posthr(do_QueryInterface(content,&result));
if (NS_SUCCEEDED(result)) {
aChildList.AppendElement(posthr);
}

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

@ -377,8 +377,6 @@ nsGfxScrollFrame::GetScrollbarBox(PRBool aVertical, nsIBox** aResult)
return NS_OK;
}
nsresult NS_CreateAnonymousNode(nsIContent* aParent, nsIAtom* aTag, PRInt32 aNameSpaceId, nsCOMPtr<nsIContent>& aNewNode);
NS_IMETHODIMP
nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
nsISupportsArray& aAnonymousChildren)

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

@ -107,7 +107,45 @@ nsImageFrame::~nsImageFrame()
}
}
NS_METHOD
NS_IMETHODIMP
nsImageFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_ENSURE_ARG_POINTER(aInstancePtr);
*aInstancePtr = nsnull;
#ifdef DEBUG
if (aIID.Equals(NS_GET_IID(nsIFrameDebug))) {
*aInstancePtr = NS_STATIC_CAST(nsIFrameDebug*,this);
return NS_OK;
}
#endif
if (aIID.Equals(NS_GET_IID(nsIImageFrame))) {
*aInstancePtr = NS_STATIC_CAST(nsIImageFrame*,this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIFrame))) {
*aInstancePtr = NS_STATIC_CAST(nsIFrame*,this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsISupports))) {
*aInstancePtr = NS_STATIC_CAST(nsIImageFrame*,this);
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_IMETHODIMP_(nsrefcnt) nsImageFrame::AddRef(void)
{
NS_WARNING("not supported for frames");
return 1;
}
NS_IMETHODIMP_(nsrefcnt) nsImageFrame::Release(void)
{
NS_WARNING("not supported for frames");
return 1;
}
NS_IMETHODIMP
nsImageFrame::Destroy(nsIPresContext* aPresContext)
{
// Tell our image map, if there is one, to clean up

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

@ -26,6 +26,7 @@
#include "nsString.h"
#include "nsIPresContext.h"
#include "nsHTMLImageLoader.h"
#include "nsIImageFrame.h"
class nsIFrame;
class nsImageMap;
@ -37,10 +38,13 @@ struct nsSize;
#define ImageFrameSuper nsLeafFrame
class nsImageFrame : public ImageFrameSuper {
class nsImageFrame : public ImageFrameSuper, public nsIImageFrame {
public:
nsImageFrame();
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD Destroy(nsIPresContext* aPresContext);
NS_IMETHOD Init(nsIPresContext* aPresContext,
nsIContent* aContent,
@ -58,7 +62,7 @@ public:
NS_IMETHOD GetContentForEvent(nsIPresContext* aPresContext,
nsEvent* aEvent,
nsIContent** aContent);
NS_METHOD HandleEvent(nsIPresContext* aPresContext,
NS_IMETHOD HandleEvent(nsIPresContext* aPresContext,
nsGUIEvent* aEvent,
nsEventStatus* aEventStatus);
NS_IMETHOD GetCursor(nsIPresContext* aPresContext,
@ -82,6 +86,10 @@ public:
#endif
protected:
// nsISupports
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
virtual ~nsImageFrame();
virtual void GetDesiredSize(nsIPresContext* aPresContext,

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

@ -60,7 +60,7 @@
#include "nsIDOMEventReceiver.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDocumentEncoder.h"
#include "nsRange.h"
#include "nsIDOMRange.h"
// XXX For temporary paint code
#include "nsIStyleContext.h"
@ -69,7 +69,11 @@
#include "nsMimeTypes.h"
#include "nsObjectFrame.h"
#include "nsIObjectFrame.h"
#include "nsContentCID.h"
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
/* X headers suck */
#ifdef KeyPress
#undef KeyPress
@ -247,7 +251,44 @@ nsObjectFrame::~nsObjectFrame()
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
NS_IMETHODIMP
nsObjectFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_ENSURE_ARG_POINTER(aInstancePtr);
*aInstancePtr = nsnull;
#ifdef DEBUG
if (aIID.Equals(NS_GET_IID(nsIFrameDebug))) {
*aInstancePtr = NS_STATIC_CAST(nsIFrameDebug*,this);
return NS_OK;
}
#endif
if (aIID.Equals(NS_GET_IID(nsIObjectFrame))) {
*aInstancePtr = NS_STATIC_CAST(nsIObjectFrame*,this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIFrame))) {
*aInstancePtr = NS_STATIC_CAST(nsIFrame*,this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsISupports))) {
*aInstancePtr = NS_STATIC_CAST(nsIObjectFrame*,this);
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_IMETHODIMP_(nsrefcnt) nsObjectFrame::AddRef(void)
{
NS_WARNING("not supported for frames");
return 1;
}
NS_IMETHODIMP_(nsrefcnt) nsObjectFrame::Release(void)
{
NS_WARNING("not supported for frames");
return 1;
}
static NS_DEFINE_IID(kViewCID, NS_VIEW_CID);
static NS_DEFINE_IID(kWidgetCID, NS_CHILD_CID);
static NS_DEFINE_IID(kCAppShellCID, NS_APPSHELL_CID);
@ -1429,20 +1470,6 @@ NS_NewObjectFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
return NS_OK;
}
// TODO: put this in a header file.
extern nsresult NS_GetObjectFramePluginInstance(nsIFrame* aFrame, nsIPluginInstance*& aPluginInstance);
nsresult
NS_GetObjectFramePluginInstance(nsIFrame* aFrame, nsIPluginInstance*& aPluginInstance)
{
if(aFrame == nsnull)
return NS_ERROR_NULL_POINTER;
// TODO: any way to determine this cast is safe?
nsObjectFrame* objectFrame = NS_STATIC_CAST(nsObjectFrame*, aFrame);
return objectFrame->GetPluginInstance(aPluginInstance);
}
//plugin instance owner
nsPluginInstanceOwner::nsPluginInstanceOwner()
@ -1612,7 +1639,7 @@ nsresult nsPluginInstanceOwner::QueryInterface(const nsIID& aIID,
return NS_OK;
}
if (aIID.Equals(kISupportsIID))
if (aIID.Equals(NS_GET_IID(nsISupports)))
{
*aInstancePtrResult = (void *)((nsISupports *)((nsIPluginTagInfo *)this));
AddRef();
@ -1980,9 +2007,9 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetTagText(const char* *result)
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIDOMRange> range(new nsRange);
if (!range)
return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIDOMRange> range(do_CreateInstance(kRangeCID,&rv));
if (NS_FAILED(rv))
return rv;
rv = range->SelectNode(node);
if (NS_FAILED(rv))

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

@ -28,13 +28,17 @@
#include "nsIPresShell.h"
#include "nsIPluginHost.h"
#include "nsplugin.h"
#include "nsIObjectFrame.h"
class nsPluginInstanceOwner;
#define nsObjectFrameSuper nsHTMLContainerFrame
class nsObjectFrame : public nsObjectFrameSuper {
class nsObjectFrame : public nsObjectFrameSuper, public nsIObjectFrame {
public:
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
@ -69,18 +73,22 @@ public:
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent);
NS_IMETHOD GetPluginInstance(nsIPluginInstance*& aPluginInstance);
//local methods
nsresult CreateWidget(nsIPresContext* aPresContext,
nscoord aWidth,
nscoord aHeight,
PRBool aViewOnly);
nsresult GetFullURL(nsIURI*& aFullURL);
nsresult GetPluginInstance(nsIPluginInstance*& aPluginInstance);
void IsSupportedImage(nsIContent* aContent, PRBool* aImage);
protected:
// nsISupports
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
virtual ~nsObjectFrame();
virtual PRIntn GetSkipSides() const;

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

@ -26,6 +26,6 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = base content document forms style table
DIRS = base document forms style table
include $(topsrcdir)/config/rules.mk

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

@ -4,3 +4,4 @@
nsILineIterator.h
nsIHTMLContent.h
nsHTMLParts.h

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

@ -21,7 +21,7 @@
DEPTH=..\..\..\..
LIBRARY_NAME=raptorhtmlbase_s
LIBRARY_NAME=layouthtmlbase_s
MODULE=raptor
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
!if defined(XP_NEW_SELECTION)

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

@ -377,8 +377,6 @@ nsGfxScrollFrame::GetScrollbarBox(PRBool aVertical, nsIBox** aResult)
return NS_OK;
}
nsresult NS_CreateAnonymousNode(nsIContent* aParent, nsIAtom* aTag, PRInt32 aNameSpaceId, nsCOMPtr<nsIContent>& aNewNode);
NS_IMETHODIMP
nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
nsISupportsArray& aAnonymousChildren)

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

@ -107,7 +107,45 @@ nsImageFrame::~nsImageFrame()
}
}
NS_METHOD
NS_IMETHODIMP
nsImageFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_ENSURE_ARG_POINTER(aInstancePtr);
*aInstancePtr = nsnull;
#ifdef DEBUG
if (aIID.Equals(NS_GET_IID(nsIFrameDebug))) {
*aInstancePtr = NS_STATIC_CAST(nsIFrameDebug*,this);
return NS_OK;
}
#endif
if (aIID.Equals(NS_GET_IID(nsIImageFrame))) {
*aInstancePtr = NS_STATIC_CAST(nsIImageFrame*,this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIFrame))) {
*aInstancePtr = NS_STATIC_CAST(nsIFrame*,this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsISupports))) {
*aInstancePtr = NS_STATIC_CAST(nsIImageFrame*,this);
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_IMETHODIMP_(nsrefcnt) nsImageFrame::AddRef(void)
{
NS_WARNING("not supported for frames");
return 1;
}
NS_IMETHODIMP_(nsrefcnt) nsImageFrame::Release(void)
{
NS_WARNING("not supported for frames");
return 1;
}
NS_IMETHODIMP
nsImageFrame::Destroy(nsIPresContext* aPresContext)
{
// Tell our image map, if there is one, to clean up

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

@ -26,6 +26,7 @@
#include "nsString.h"
#include "nsIPresContext.h"
#include "nsHTMLImageLoader.h"
#include "nsIImageFrame.h"
class nsIFrame;
class nsImageMap;
@ -37,10 +38,13 @@ struct nsSize;
#define ImageFrameSuper nsLeafFrame
class nsImageFrame : public ImageFrameSuper {
class nsImageFrame : public ImageFrameSuper, public nsIImageFrame {
public:
nsImageFrame();
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD Destroy(nsIPresContext* aPresContext);
NS_IMETHOD Init(nsIPresContext* aPresContext,
nsIContent* aContent,
@ -58,7 +62,7 @@ public:
NS_IMETHOD GetContentForEvent(nsIPresContext* aPresContext,
nsEvent* aEvent,
nsIContent** aContent);
NS_METHOD HandleEvent(nsIPresContext* aPresContext,
NS_IMETHOD HandleEvent(nsIPresContext* aPresContext,
nsGUIEvent* aEvent,
nsEventStatus* aEventStatus);
NS_IMETHOD GetCursor(nsIPresContext* aPresContext,
@ -82,6 +86,10 @@ public:
#endif
protected:
// nsISupports
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
virtual ~nsImageFrame();
virtual void GetDesiredSize(nsIPresContext* aPresContext,

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

@ -60,7 +60,7 @@
#include "nsIDOMEventReceiver.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDocumentEncoder.h"
#include "nsRange.h"
#include "nsIDOMRange.h"
// XXX For temporary paint code
#include "nsIStyleContext.h"
@ -69,7 +69,11 @@
#include "nsMimeTypes.h"
#include "nsObjectFrame.h"
#include "nsIObjectFrame.h"
#include "nsContentCID.h"
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
/* X headers suck */
#ifdef KeyPress
#undef KeyPress
@ -247,7 +251,44 @@ nsObjectFrame::~nsObjectFrame()
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
NS_IMETHODIMP
nsObjectFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_ENSURE_ARG_POINTER(aInstancePtr);
*aInstancePtr = nsnull;
#ifdef DEBUG
if (aIID.Equals(NS_GET_IID(nsIFrameDebug))) {
*aInstancePtr = NS_STATIC_CAST(nsIFrameDebug*,this);
return NS_OK;
}
#endif
if (aIID.Equals(NS_GET_IID(nsIObjectFrame))) {
*aInstancePtr = NS_STATIC_CAST(nsIObjectFrame*,this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIFrame))) {
*aInstancePtr = NS_STATIC_CAST(nsIFrame*,this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsISupports))) {
*aInstancePtr = NS_STATIC_CAST(nsIObjectFrame*,this);
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_IMETHODIMP_(nsrefcnt) nsObjectFrame::AddRef(void)
{
NS_WARNING("not supported for frames");
return 1;
}
NS_IMETHODIMP_(nsrefcnt) nsObjectFrame::Release(void)
{
NS_WARNING("not supported for frames");
return 1;
}
static NS_DEFINE_IID(kViewCID, NS_VIEW_CID);
static NS_DEFINE_IID(kWidgetCID, NS_CHILD_CID);
static NS_DEFINE_IID(kCAppShellCID, NS_APPSHELL_CID);
@ -1429,20 +1470,6 @@ NS_NewObjectFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
return NS_OK;
}
// TODO: put this in a header file.
extern nsresult NS_GetObjectFramePluginInstance(nsIFrame* aFrame, nsIPluginInstance*& aPluginInstance);
nsresult
NS_GetObjectFramePluginInstance(nsIFrame* aFrame, nsIPluginInstance*& aPluginInstance)
{
if(aFrame == nsnull)
return NS_ERROR_NULL_POINTER;
// TODO: any way to determine this cast is safe?
nsObjectFrame* objectFrame = NS_STATIC_CAST(nsObjectFrame*, aFrame);
return objectFrame->GetPluginInstance(aPluginInstance);
}
//plugin instance owner
nsPluginInstanceOwner::nsPluginInstanceOwner()
@ -1612,7 +1639,7 @@ nsresult nsPluginInstanceOwner::QueryInterface(const nsIID& aIID,
return NS_OK;
}
if (aIID.Equals(kISupportsIID))
if (aIID.Equals(NS_GET_IID(nsISupports)))
{
*aInstancePtrResult = (void *)((nsISupports *)((nsIPluginTagInfo *)this));
AddRef();
@ -1980,9 +2007,9 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetTagText(const char* *result)
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIDOMRange> range(new nsRange);
if (!range)
return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIDOMRange> range(do_CreateInstance(kRangeCID,&rv));
if (NS_FAILED(rv))
return rv;
rv = range->SelectNode(node);
if (NS_FAILED(rv))

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

@ -28,13 +28,17 @@
#include "nsIPresShell.h"
#include "nsIPluginHost.h"
#include "nsplugin.h"
#include "nsIObjectFrame.h"
class nsPluginInstanceOwner;
#define nsObjectFrameSuper nsHTMLContainerFrame
class nsObjectFrame : public nsObjectFrameSuper {
class nsObjectFrame : public nsObjectFrameSuper, public nsIObjectFrame {
public:
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
@ -69,18 +73,22 @@ public:
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent);
NS_IMETHOD GetPluginInstance(nsIPluginInstance*& aPluginInstance);
//local methods
nsresult CreateWidget(nsIPresContext* aPresContext,
nscoord aWidth,
nscoord aHeight,
PRBool aViewOnly);
nsresult GetFullURL(nsIURI*& aFullURL);
nsresult GetPluginInstance(nsIPluginInstance*& aPluginInstance);
void IsSupportedImage(nsIContent* aContent, PRBool* aImage);
protected:
// nsISupports
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
virtual ~nsObjectFrame();
virtual PRIntn GetSkipSides() const;

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

@ -135,6 +135,10 @@
// SubShell map
#include "nsDST.h"
#include "nsContentCID.h"
static NS_DEFINE_CID(kCSSStyleSheetCID, NS_CSS_STYLESHEET_CID);
static NS_DEFINE_CID(kStyleSetCID, NS_STYLESET_CID);
// supporting bugs 31816, 20760, 22963
// define USE_OVERRIDE to put prefs in as an override stylesheet
// otherwise they go in as a Backstop stylesheets
@ -1813,7 +1817,7 @@ nsresult PresShell::CreatePreferenceStyleSheet(void)
NS_ASSERTION(mPrefStyleSheet==nsnull, "prefStyleSheet already exists");
nsresult result = NS_OK;
result = NS_NewCSSStyleSheet(&mPrefStyleSheet);
result = nsComponentManager::CreateInstance(kCSSStyleSheetCID,nsnull,NS_GET_IID(nsICSSStyleSheet),(void**)&mPrefStyleSheet);
if (NS_SUCCEEDED(result)) {
NS_ASSERTION(mPrefStyleSheet, "null but no error");
nsCOMPtr<nsIURI> uri;
@ -3608,7 +3612,7 @@ PresShell::DoCopy()
rv = nsCopySupport::HTMLCopy(sel, doc, nsIClipboard::kGlobalClipboard);
if (NS_FAILED(rv))
return rv;
// Now that we have copied, update the Paste menu item
nsCOMPtr<nsIScriptGlobalObject> globalObject;
doc->GetScriptGlobalObject(getter_AddRefs(globalObject));
@ -5170,8 +5174,8 @@ PresShell::SetReflowEventStatus(PRBool aPending)
nsresult
PresShell::CloneStyleSet(nsIStyleSet* aSet, nsIStyleSet** aResult)
{
nsIStyleSet* clone;
nsresult rv = NS_NewStyleSet(&clone);
nsresult rv;
nsCOMPtr<nsIStyleSet> clone(do_CreateInstance(kStyleSetCID,&rv));
if (NS_FAILED(rv)) {
return rv;
}
@ -5206,7 +5210,8 @@ PresShell::CloneStyleSet(nsIStyleSet* aSet, nsIStyleSet** aResult)
NS_RELEASE(ss);
}
}
*aResult = clone;
*aResult = clone.get();
NS_ADDREF(*aResult);
return NS_OK;
}

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

@ -26,7 +26,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = public src
DIRS = src
include $(topsrcdir)/config/rules.mk

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

@ -1,26 +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=..\..\..
DIRS=public src
include <$(DEPTH)\config\rules.mak>

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

@ -31,22 +31,10 @@ LIBRARY_NAME = gkhtmldoc_s
REQUIRES = xpcom widget dom necko htmlparser locale view js intl webshell docshell cookie caps util timer uconv pref uriloader rdf chardet appshell nkcache shistory appcomps lwbrk
CPPSRCS = \
nsHTMLContentSink.cpp \
nsHTMLFragmentContentSink.cpp \
nsHTMLDocument.cpp \
nsFrameFrame.cpp \
nsFrameSetFrame.cpp \
nsImageDocument.cpp \
nsMarkupDocument.cpp \
$(NULL)
EXPORTS = \
nsIHTMLDocument.h \
nsIHTMLContentContainer.h \
$(NULL)
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
# we don't want the shared lib, but we want to force the creation of a static lib.
override NO_SHARED_LIB=1
override NO_STATIC_LIB=

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

@ -21,7 +21,7 @@
DEPTH=..\..\..\..
LIBRARY_NAME=raptorhtmldoc_s
LIBRARY_NAME=layouthtmldoc_s
MODULE=raptor
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
@ -30,28 +30,13 @@ DEFINES = $(DEFINES) -DXP_NEW_SELECTION
!endif
CPPSRCS= \
nsHTMLContentSink.cpp \
nsHTMLDocument.cpp \
nsHTMLFragmentContentSink.cpp \
nsFrameFrame.cpp \
nsFrameSetFrame.cpp \
nsImageDocument.cpp \
nsMarkupDocument.cpp \
$(NULL)
CPP_OBJS= \
.\$(OBJDIR)\nsHTMLContentSink.obj \
.\$(OBJDIR)\nsHTMLDocument.obj \
.\$(OBJDIR)\nsHTMLFragmentContentSink.obj \
.\$(OBJDIR)\nsFrameFrame.obj \
.\$(OBJDIR)\nsFrameSetFrame.obj \
.\$(OBJDIR)\nsImageDocument.obj \
.\$(OBJDIR)\nsMarkupDocument.obj \
$(NULL)
EXPORTS = \
nsIHTMLDocument.h \
nsIHTMLContentContainer.h \
$(NULL)
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\js \

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

@ -11,3 +11,4 @@ nsIFormSubmitObserver.h
nsIFormProcessor.h
nsISelectControlFrame.h
nsIGfxTextControlFrame.h
nsIFormManager.h

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

@ -21,7 +21,7 @@
DEPTH=..\..\..\..
LIBRARY_NAME=raptorhtmlforms_s
LIBRARY_NAME=layouthtmlforms_s
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
MODULE=raptor

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

@ -60,7 +60,10 @@
#include "nsINodeInfo.h"
#include "nsIScrollableFrame.h"
#include "nsIScrollableView.h"
#include "nsIElementFactory.h"
#include "nsContentCID.h"
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
#include "nsIXULDocument.h" // Temporary fix for Bug 36558
@ -2159,8 +2162,8 @@ nsComboboxControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
//nsIAtom* tag = NS_NewAtom("mozcombodisplay");
// Add a child text content node for the label
nsCOMPtr<nsIContent> labelContent;
nsresult result = NS_NewTextNode(getter_AddRefs(labelContent));
nsresult result;
nsCOMPtr<nsIContent> labelContent(do_CreateInstance(kTextNodeCID,&result));
nsAutoString value; value.AssignWithConversion("X");
if (NS_SUCCEEDED(result) && labelContent) {
// set the value of the text node
@ -2185,11 +2188,17 @@ nsComboboxControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
aChildList.AppendElement(labelContent);
// create button which drops the list down
nsCOMPtr<nsIHTMLContent> btnContent;
result = NS_NewHTMLInputElement(getter_AddRefs(btnContent), nodeInfo);
if (NS_SUCCEEDED(result) && btnContent) {
btnContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("button"), PR_FALSE);
aChildList.AppendElement(btnContent);
nsCOMPtr<nsIElementFactory> ef(do_CreateInstance(kHTMLElementFactoryCID));
if (ef) {
nsCOMPtr<nsIContent> content;
result = ef->CreateInstanceByTag(nodeInfo,getter_AddRefs(content));
if (NS_SUCCEEDED(result)) {
nsCOMPtr<nsIHTMLContent> btnContent(do_QueryInterface(content));
if (btnContent) {
btnContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("button"), PR_FALSE);
aChildList.AppendElement(btnContent);
}
}
}
}

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

@ -24,7 +24,7 @@
#include "nsFormFrame.h"
#include "nsIElementFactory.h"
#include "nsIContent.h"
#include "prtypes.h"
#include "nsIAtom.h"
@ -58,7 +58,8 @@
#include "nsIDOMEventReceiver.h"
#include "nsIScriptGlobalObject.h"
#include "nsContentCID.h"
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
nsresult
NS_NewFileControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
@ -122,7 +123,16 @@ nsFileControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
nimgr->GetNodeInfo(nsHTMLAtoms::input, nsnull, kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
if (NS_OK == NS_NewHTMLInputElement(&mTextContent, nodeInfo)) {
nsCOMPtr<nsIElementFactory> ef(do_CreateInstance(kHTMLElementFactoryCID,&rv));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIContent> content;
rv = ef->CreateInstanceByTag(nodeInfo,getter_AddRefs(content));
NS_ENSURE_SUCCESS(rv, rv);
rv = content->QueryInterface(NS_GET_IID(nsIHTMLContent),(void**)&mTextContent);
if (NS_SUCCEEDED(rv)) {
mTextContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("text"), PR_FALSE);
if (nsFormFrame::GetDisabled(this)) {
nsCOMPtr<nsIDOMHTMLInputElement> textControl = do_QueryInterface(mTextContent);
@ -134,7 +144,12 @@ nsFileControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
}
// create browse button
if (NS_OK == NS_NewHTMLInputElement(getter_AddRefs(mBrowse), nodeInfo)) {
rv = ef->CreateInstanceByTag(nodeInfo,getter_AddRefs(content));
NS_ENSURE_SUCCESS(rv, rv);
mBrowse = do_QueryInterface(content,&rv);
if (NS_SUCCEEDED(rv)) {
mBrowse->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("button"), PR_FALSE);
//browse->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::value, nsAutoString("browse..."), PR_FALSE);

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

@ -27,6 +27,8 @@
#include "nsFormControlFrame.h"
#include "nsISupportsArray.h"
#include "nsINameSpaceManager.h"
#include "nsContentCID.h"
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
// Saving PresState
#include "nsIPresState.h"
@ -395,8 +397,7 @@ nsGfxButtonControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
}
// Add a child text content node for the label
nsCOMPtr<nsIContent> labelContent;
result = NS_NewTextNode(getter_AddRefs(labelContent));
nsCOMPtr<nsIContent> labelContent(do_CreateInstance(kTextNodeCID,&result));
if (NS_SUCCEEDED(result) && labelContent) {
// set the value of the text node and add it to the child list
mTextContent = do_QueryInterface(labelContent, &result);

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

@ -89,7 +89,7 @@
#include "nsIEventStateManager.h"
#include "nsStyleUtil.h"
#include "nsLinebreakConverter.h"
#include "nsRange.h"
#include "nsIDOMRange.h"
// for anonymous content and frames
#include "nsHTMLParts.h"
@ -106,6 +106,10 @@
#include "nsINodeInfo.h"
#include "nsLayoutAtoms.h"
#include "nsContentCID.h"
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
static NS_DEFINE_IID(kTextCID, NS_TEXTFIELD_CID);
@ -575,9 +579,9 @@ nsGfxTextControlFrame::SetSelectionEndPoints(PRInt32 aSelStart, PRInt32 aSelEnd)
// remove existing ranges
selection->ClearSelection();
nsCOMPtr<nsIDOMRange> selectionRange;
NS_NewRange(getter_AddRefs(selectionRange));
if (!selectionRange) return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIDOMRange> selectionRange(do_CreateInstance(kRangeCID,&rv));
if (NS_FAILED(rv))
return rv;
selectionRange->SetStart(firstTextNode, aSelStart);
selectionRange->SetEnd(firstTextNode, aSelEnd);
@ -600,8 +604,9 @@ nsGfxTextControlFrame::SetSelectionEndPoints(PRInt32 aSelStart, PRInt32 aSelEnd)
else
{
// no range. Make a new one.
NS_NewRange(getter_AddRefs(firstRange));
if (!firstRange) return NS_ERROR_OUT_OF_MEMORY;
firstRange = do_CreateInstance(kRangeCID,&rv);
if (NS_FAILED(rv))
return rv;
mustAdd = PR_TRUE;
}
@ -2562,8 +2567,7 @@ nsGfxTextControlFrame::Reflow(nsIPresContext* aPresContext,
{ // single line text controls get a display frame rather than a subdoc.
// the subdoc will be created when the frame first gets focus
// create anonymous text content
nsCOMPtr<nsIContent> content;
rv = NS_NewTextNode(getter_AddRefs(content));
nsCOMPtr<nsIContent> content(do_CreateInstance(kTextNodeCID,&result));
if (NS_FAILED(rv)) { return rv; }
if (!content) { return NS_ERROR_NULL_POINTER; }
nsIDocument* doc;

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

@ -87,9 +87,8 @@
#include "nsIDOMFocusListener.h" //onchange events
#include "nsIDOMCharacterData.h" //for selection setting helper func
#include "nsIDOMNodeList.h" //for selection settting helper func
#include "nsIDOMRange.h" //for selection settting helper func
#include "nsRange.h" //for selection settting helper func (i cant believe this is exported!?)
#include "nsIDOMNodeList.h" //for selection setting helper func
#include "nsIDOMRange.h" //for selection setting helper func
#include "nsIScriptGlobalObject.h" //needed for notify selection changed to update the menus ect.
#include "nsIDOMWindowInternal.h" //needed for notify selection changed to update the menus ect.
#include "nsITextContent.h" //needed to create initial text control content
@ -100,6 +99,8 @@
#define DEFAULT_COLUMN_WIDTH 20
#define GUESS_INPUT_SIZE 150 // 10 pixels wide
#include "nsContentCID.h"
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
static NS_DEFINE_CID(kTextEditorCID, NS_TEXTEDITOR_CID);
static NS_DEFINE_CID(kFrameSelectionCID, NS_FRAMESELECTION_CID);
@ -2495,9 +2496,9 @@ nsGfxTextControlFrame2::SetSelectionEndPoints(PRInt32 aSelStart, PRInt32 aSelEnd
// remove existing ranges
selection->RemoveAllRanges();
nsCOMPtr<nsIDOMRange> selectionRange;
NS_NewRange(getter_AddRefs(selectionRange));
if (!selectionRange) return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIDOMRange> selectionRange(do_CreateInstance(kRangeCID,&rv));
if (NS_FAILED(rv))
return rv;
selectionRange->SetStart(firstTextNode, aSelStart);
selectionRange->SetEnd(firstTextNode, aSelEnd);
@ -2520,8 +2521,9 @@ nsGfxTextControlFrame2::SetSelectionEndPoints(PRInt32 aSelStart, PRInt32 aSelEnd
else
{
// no range. Make a new one.
NS_NewRange(getter_AddRefs(firstRange));
if (!firstRange) return NS_ERROR_OUT_OF_MEMORY;
firstRange = do_CreateInstance(kRangeCID,&rv);
if (NS_FAILED(rv))
return rv;
mustAdd = PR_TRUE;
}

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

@ -60,6 +60,11 @@
#include "nsIFormControlFrame.h"
#include "nsINodeInfo.h"
#include "nsIDOMEventReceiver.h"
#include "nsIElementFactory.h"
#include "nsContentCID.h"
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
@ -206,22 +211,28 @@ nsIsIndexFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
nsCOMPtr<nsIDocument> doc;
mContent->GetDocument(*getter_AddRefs(doc));
nsCOMPtr<nsINodeInfoManager> nimgr;
nsresult rv = doc->GetNodeInfoManager(*getter_AddRefs(nimgr));
NS_ENSURE_SUCCESS(rv, rv);
result = doc->GetNodeInfoManager(*getter_AddRefs(nimgr));
NS_ENSURE_SUCCESS(result, result);
nsCOMPtr<nsIElementFactory> ef(do_CreateInstance(kHTMLElementFactoryCID,&result));
NS_ENSURE_SUCCESS(result, result);
// Create an hr
nsCOMPtr<nsINodeInfo> hrInfo;
nsCOMPtr<nsIHTMLContent> prehr;
nimgr->GetNodeInfo(nsHTMLAtoms::hr, nsnull, kNameSpaceID_None,
*getter_AddRefs(hrInfo));
if (NS_OK == NS_NewHTMLHRElement(getter_AddRefs(prehr), hrInfo)) {
nsCOMPtr<nsIContent> content;
result = ef->CreateInstanceByTag(hrInfo,getter_AddRefs(content));
NS_ENSURE_SUCCESS(result, result);
nsCOMPtr<nsIHTMLContent> prehr(do_QueryInterface(content,&result));
if (NS_SUCCEEDED(result)) {
result = aChildList.AppendElement(prehr);
}
// Add a child text content node for the label
if (NS_SUCCEEDED(result)) {
nsCOMPtr<nsIContent> labelContent;
result = NS_NewTextNode(getter_AddRefs(labelContent));
nsCOMPtr<nsIContent> labelContent(do_CreateInstance(kTextNodeCID,&result));
if (NS_SUCCEEDED(result) && labelContent) {
// set the value of the text node and add it to the child list
result = labelContent->QueryInterface(NS_GET_IID(nsITextContent),(void**)&mTextContent);
@ -237,7 +248,12 @@ nsIsIndexFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
nimgr->GetNodeInfo(nsHTMLAtoms::input, nsnull, kNameSpaceID_None,
*getter_AddRefs(inputInfo));
if (NS_OK == NS_NewHTMLInputElement(&mInputContent, inputInfo)) {
result = ef->CreateInstanceByTag(inputInfo,getter_AddRefs(content));
NS_ENSURE_SUCCESS(result, result);
result = content->QueryInterface(NS_GET_IID(nsIHTMLContent),(void**)&mInputContent);
if (NS_SUCCEEDED(result)) {
mInputContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("text"), PR_FALSE);
aChildList.AppendElement(mInputContent);
@ -247,8 +263,11 @@ nsIsIndexFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
}
// Create an hr
nsCOMPtr<nsIHTMLContent> posthr;
if (NS_OK == NS_NewHTMLHRElement(getter_AddRefs(posthr), hrInfo)) {
result = ef->CreateInstanceByTag(hrInfo,getter_AddRefs(content));
NS_ENSURE_SUCCESS(result, result);
nsCOMPtr<nsIHTMLContent> posthr(do_QueryInterface(content,&result));
if (NS_SUCCEEDED(result)) {
aChildList.AppendElement(posthr);
}

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

@ -1,27 +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=..\..
DIRS = base content document forms style table
# tests is now done after we build layout/events
include <$(DEPTH)\config\rules.mak>

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

@ -1,13 +0,0 @@
#
# This is a list of local files which get copied to the mozilla:dist:layout directory
#
nsCSSAtoms.h
nsCSSAtomList.h
nsICSSLoader.h
nsICSSParser.h
nsICSSPseudoComparator.h
nsICSSStyleSheet.h
nsStyleUtil.h
nsICSSLoaderObserver.h
nsIComputedDOMStyle.h

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

@ -1,46 +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
MODULE = layout
EXPORTS = \
nsCSSAtoms.h \
nsCSSAtomList.h \
nsICSSLoader.h \
nsICSSParser.h \
nsICSSPseudoComparator.h \
nsICSSStyleSheet.h \
nsStyleUtil.h \
nsICSSLoaderObserver.h \
nsIComputedDOMStyle.h \
$(NULL)
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
include $(topsrcdir)/config/rules.mk

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

@ -1,28 +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=..\..\..\..
EXPORTS=nsCSSAtoms.h nsCSSAtomList.h nsICSSLoader.h nsICSSParser.h nsICSSPseudoComparator.h nsICSSStyleSheet.h nsStyleUtil.h nsICSSLoaderObserver.h nsIComputedDOMStyle.h
MODULE=raptor
include <$(DEPTH)\config\rules.mak>

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

@ -33,47 +33,15 @@ REQUIRES = xpcom dom widget timer caps editor locale js view necko webshell pref
CPPSRCS = \
nsCSSAtoms.cpp \
nsCSSKeywords.cpp \
nsCSSDeclaration.cpp \
nsCSSFrameConstructor.cpp \
nsCSSLoader.cpp \
nsCSSParser.cpp \
nsCSSProps.cpp \
nsCSSRendering.cpp \
nsCSSScanner.cpp \
nsCSSRule.cpp \
nsCSSStyleRule.cpp \
nsCSSRules.cpp \
nsCSSStyleSheet.cpp \
nsCSSValue.cpp \
nsDOMCSSDeclaration.cpp \
nsHTMLAttributes.cpp \
nsHTMLStyleSheet.cpp \
nsHTMLCSSStyleSheet.cpp \
nsHTMLValue.cpp \
nsStyleUtil.cpp \
nsComputedDOMStyle.cpp \
nsROCSSPrimitiveValue.cpp \
$(NULL)
EXPORTS = \
nsDOMCSSDeclaration.h \
nsCSSKeywords.h \
nsCSSKeywordList.h \
nsCSSProps.h \
nsCSSPropList.h \
nsCSSValue.h \
nsICSSStyleRuleProcessor.h \
nsICSSRule.h \
nsICSSGroupRule.h \
nsICSSStyleRule.h \
nsICSSCharsetRule.h \
nsICSSImportRule.h \
nsICSSMediaRule.h \
nsICSSNameSpaceRule.h \
nsICSSDeclaration.h \
nsHTMLValue.h \
nsIHTMLCSSStyleSheet.h \
nsIHTMLStyleSheet.h \
nsICSSFrameConstructor.h \
$(NULL)
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))

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

@ -21,80 +21,34 @@
DEPTH=..\..\..\..
LIBRARY_NAME=raptorhtmlstyle_s
LIBRARY_NAME=layouthtmlstyle_s
MODULE=raptor
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
EXPORTS = \
nsCSSKeywords.h \
nsCSSKeywordList.h \
nsCSSProps.h \
nsCSSPropList.h \
nsCSSValue.h \
nsICSSStyleRuleProcessor.h \
nsICSSRule.h \
nsICSSGroupRule.h \
nsICSSStyleRule.h \
nsICSSCharsetRule.h \
nsICSSImportRule.h \
nsICSSMediaRule.h \
nsICSSNameSpaceRule.h \
nsICSSDeclaration.h \
nsIHTMLCSSStyleSheet.h \
nsIHTMLStyleSheet.h \
nsHTMLValue.h \
nsDOMCSSDeclaration.h \
nsICSSFrameConstructor.h \
$(NULL)
CPPSRCS= \
nsCSSAtoms.cpp \
nsCSSKeywords.cpp \
nsCSSDeclaration.cpp \
nsCSSFrameConstructor.cpp \
nsCSSLoader.cpp \
nsCSSParser.cpp \
nsCSSProps.cpp \
nsCSSRendering.cpp \
nsCSSScanner.cpp \
nsCSSRule.cpp \
nsCSSStyleRule.cpp \
nsCSSRules.cpp \
nsCSSStyleSheet.cpp \
nsCSSValue.cpp \
nsHTMLAttributes.cpp \
nsHTMLStyleSheet.cpp \
nsHTMLCSSStyleSheet.cpp \
nsHTMLValue.cpp \
# nsHTMLStyleSheet.cpp \
nsStyleUtil.cpp \
nsDOMCSSDeclaration.cpp \
nsComputedDOMStyle.cpp \
nsROCSSPrimitiveValue.cpp \
$(NULL)
CPP_OBJS = \
.\$(OBJDIR)\nsCSSAtoms.obj \
.\$(OBJDIR)\nsCSSKeywords.obj \
.\$(OBJDIR)\nsCSSDeclaration.obj \
.\$(OBJDIR)\nsCSSFrameConstructor.obj \
.\$(OBJDIR)\nsCSSLoader.obj \
.\$(OBJDIR)\nsCSSParser.obj \
.\$(OBJDIR)\nsCSSProps.obj \
.\$(OBJDIR)\nsCSSRendering.obj \
.\$(OBJDIR)\nsCSSScanner.obj \
.\$(OBJDIR)\nsCSSRule.obj \
.\$(OBJDIR)\nsCSSStyleRule.obj \
.\$(OBJDIR)\nsCSSRules.obj \
.\$(OBJDIR)\nsCSSStyleSheet.obj \
.\$(OBJDIR)\nsCSSValue.obj \
.\$(OBJDIR)\nsHTMLAttributes.obj \
.\$(OBJDIR)\nsHTMLStyleSheet.obj \
.\$(OBJDIR)\nsHTMLCSSStyleSheet.obj \
.\$(OBJDIR)\nsHTMLValue.obj \
# .\$(OBJDIR)\nsHTMLStyleSheet.obj \
.\$(OBJDIR)\nsStyleUtil.obj \
.\$(OBJDIR)\nsDOMCSSDeclaration.obj \
.\$(OBJDIR)\nsComputedDOMStyle.obj \
.\$(OBJDIR)\nsROCSSPrimitiveValue.obj \
$(NULL)
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\netlib \

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

@ -37,7 +37,6 @@
#include "nsIPresContext.h"
#include "nsILinkHandler.h"
#include "nsIDocument.h"
#include "nsIHTMLTableCellElement.h"
#include "nsTableColGroupFrame.h"
#include "nsTableColFrame.h"
#include "nsHTMLIIDs.h"
@ -80,6 +79,13 @@
#include "nsBoxLayoutState.h"
#include "nsIBindingManager.h"
#include "nsIXBLBinding.h"
#include "nsIElementFactory.h"
#include "nsContentCID.h"
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
static NS_DEFINE_CID(kHTMLImageElementCID, NS_HTMLIMAGEELEMENT_CID);
static NS_DEFINE_CID(kAttributeContentCID, NS_ATTRIBUTECONTENT_CID);
#include "nsIDOMWindowInternal.h"
#include "nsPIDOMWindow.h"
@ -859,6 +865,22 @@ PRBool GetCaptionAdjustedParent(nsIFrame* aParentFrame,
return haveCaption;
}
nsresult NS_CreateCSSFrameConstructor(nsICSSFrameConstructor **aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = nsnull;
nsCSSFrameConstructor *c = new nsCSSFrameConstructor();
if (!c)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(c);
nsresult rv = c->QueryInterface(NS_GET_IID(nsICSSFrameConstructor),(void**)aResult);
NS_RELEASE(c);
return rv;
}
nsCSSFrameConstructor::nsCSSFrameConstructor(void)
: nsIStyleFrameConstruction(),
mDocument(nsnull),
@ -886,7 +908,7 @@ nsCSSFrameConstructor::~nsCSSFrameConstructor(void)
{
}
NS_IMPL_ISUPPORTS(nsCSSFrameConstructor, kIStyleFrameConstructionIID);
NS_IMPL_ISUPPORTS2(nsCSSFrameConstructor, nsIStyleFrameConstruction,nsICSSFrameConstructor);
NS_IMETHODIMP
nsCSSFrameConstructor::Init(nsIDocument* aDocument)
@ -1268,8 +1290,6 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex
aPresContext->GetShell(getter_AddRefs(shell));
if (eStyleContentType_URL == type) {
nsIHTMLContent* imageContent;
// Create an HTML image content object, and set the SRC.
// XXX Check if it's an image type we can handle...
@ -1281,7 +1301,16 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex
nimgr->GetNodeInfo(nsHTMLAtoms::img, nsnull, kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
NS_NewHTMLImageElement(&imageContent, nodeInfo);
nsCOMPtr<nsIElementFactory> ef(do_CreateInstance(kHTMLElementFactoryCID,&rv));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIContent> content;
rv = ef->CreateInstanceByTag(nodeInfo,getter_AddRefs(content));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIHTMLContent> imageContent(do_QueryInterface(content,&rv));
NS_ENSURE_SUCCESS(rv, rv);
imageContent->SetHTMLAttribute(nsHTMLAtoms::src, contentString, PR_FALSE);
// Set aContent as the parent content and set the document object. This
@ -1293,7 +1322,6 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex
nsIFrame* imageFrame;
NS_NewImageFrame(shell, &imageFrame);
imageFrame->Init(aPresContext, imageContent, aParentFrame, aStyleContext, nsnull);
NS_RELEASE(imageContent);
// Return the image frame
*aFrame = imageFrame;
@ -1326,10 +1354,9 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex
// Creates the content and frame and return if successful
nsresult rv = NS_ERROR_FAILURE;
if (nsnull != attrName) {
nsCOMPtr<nsIContent> content;
nsIFrame* textFrame = nsnull;
NS_NewAttributeContent(getter_AddRefs(content));
if (nsnull != content) {
nsCOMPtr<nsIContent> content(do_CreateInstance(kAttributeContentCID));
if (content) {
nsCOMPtr<nsIAttributeContent> attrContent(do_QueryInterface(content));
if (attrContent) {
attrContent->Init(aContent, attrNameSpace, attrName);
@ -1394,11 +1421,11 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex
// Create a text content node
nsIContent* textContent = nsnull;
nsIDOMCharacterData* domData;
nsIFrame* textFrame = nsnull;
NS_NewTextNode(&textContent);
nsCOMPtr<nsIContent> textContent(do_CreateInstance(kTextNodeCID));
if (textContent) {
// Set the text
textContent->QueryInterface(NS_GET_IID(nsIDOMCharacterData), (void**)&domData);
@ -1413,8 +1440,6 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex
// Create a text frame and initialize it
NS_NewTextFrame(shell, &textFrame);
textFrame->Init(aPresContext, textContent, aParentFrame, aStyleContext, nsnull);
NS_RELEASE(textContent);
}
// Return the text frame
@ -9946,6 +9971,7 @@ nsCSSFrameConstructor::ConstructAlternateFrame(nsIPresShell* aPresShell,
nsIFrame* aParentFrame,
nsIFrame*& aFrame)
{
nsresult rv;
nsAutoString altText;
// Initialize OUT parameter
@ -9957,8 +9983,9 @@ nsCSSFrameConstructor::ConstructAlternateFrame(nsIPresShell* aPresShell,
GetAlternateTextFor(aContent, tag, altText);
// Create a text content element for the alternate text
nsCOMPtr<nsIContent> altTextContent;
NS_NewTextNode(getter_AddRefs(altTextContent));
nsCOMPtr<nsIContent> altTextContent(do_CreateInstance(kTextNodeCID,&rv));
if (NS_FAILED(rv))
return rv;
// Set the content's text
nsIDOMCharacterData* domData;

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

@ -22,6 +22,7 @@
#ifndef nsCSSFrameConstructor_h___
#define nsCSSFrameConstructor_h___
#include "nsICSSFrameConstructor.h"
#include "nsIStyleFrameConstruction.h"
#include "nslayout.h"
#include "nsIPresContext.h"
@ -44,7 +45,7 @@ class nsFrameConstructorState;
class nsIDOMHTMLSelectElement;
class nsIXBLService;
class nsCSSFrameConstructor : public nsIStyleFrameConstruction {
class nsCSSFrameConstructor : public nsIStyleFrameConstruction, public nsICSSFrameConstructor {
public:
nsCSSFrameConstructor(void);
virtual ~nsCSSFrameConstructor(void);
@ -57,6 +58,7 @@ private:
public:
NS_DECL_ISUPPORTS
// nsICSSFrameConstructor
NS_IMETHOD Init(nsIDocument* aDocument);
// nsIStyleFrameConstruction API

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

@ -40,6 +40,8 @@ class nsIDocument;
class nsIHTMLStyleSheet : public nsIStyleSheet {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IHTML_STYLE_SHEET_IID)
NS_IMETHOD Init(nsIURI* aURL, nsIDocument* aDocument) = 0;
NS_IMETHOD Reset(nsIURI* aURL) = 0;
NS_IMETHOD GetLinkColor(nscolor& aColor) = 0;

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

@ -21,7 +21,7 @@
DEPTH=..\..\..\..
LIBRARY_NAME=raptorhtmltable_s
LIBRARY_NAME=layouthtmltable_s
MODULE=raptor
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN -DoffDEBUG_TABLE_REFLOW_TIMING -DoffDEBUG_TABLE_REFLOW_TIMING_DETAIL

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

@ -31,9 +31,7 @@ REQUIRES = xpcom layout necko unicharutil
SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=$(BIN_SUFFIX))
CPPSRCS = \
TestCSSParser.cpp \
TestCSSPropertyLookup.cpp \
TestCSSScanner.cpp \
$(NULL)
LOCAL_INCLUDES = -I$(srcdir)/../style/src
@ -43,16 +41,16 @@ EXTRA_DSO_LIBS += gkgfx
EXTRA_DSO_LIBS += jsdom
LIBS = \
$(DIST)/lib/libgkhtmlcon_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkhtmldoc_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkconhtmlcon_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkconhtmldoc_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkhtmlforms_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkhtmlstyle_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkconhtmlstyle_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkhtmltable_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkhtmlbase_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkbase_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkevents_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkxmlcon_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkxmldoc_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkconevents_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkconxmlcon_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkconxmldoc_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkxulbase_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkxulcon_s.$(LIB_SUFFIX) \
$(MOZ_JS_LIBS) \

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

@ -23,11 +23,8 @@ DEPTH=..\..\..
include <$(DEPTH)/config/config.mak>
MAKE_OBJ_TYPE = EXE
PROG1 = .\$(OBJDIR)\TestCSSScanner.exe
PROG2 = .\$(OBJDIR)\TestCSSPropertyLookup.exe
PROG3 = .\$(OBJDIR)\TestCSSParser.exe
PROG4 = .\$(OBJDIR)\TestAttributes.exe
PROGRAMS = $(PROG1) $(PROG2) $(PROG3) $(PROG4)
PROGRAMS = $(PROG2)
DEFINES = -D_IMPL_NS_HTML
@ -48,29 +45,24 @@ LINCS= \
-I..\document\src
LLIBS= \
$(DIST)\lib\raptorhtmlbase_s.lib \
$(DIST)\lib\nglhtmlcon_s.lib \
$(DIST)\lib\raptorhtmldoc_s.lib \
$(DIST)\lib\raptorhtmlforms_s.lib \
$(DIST)\lib\raptorhtmlstyle_s.lib \
$(DIST)\lib\raptorhtmltable_s.lib \
$(DIST)\lib\raptorxmlcontent_s.lib \
$(DIST)\lib\raptorxmldoc_s.lib \
$(DIST)\lib\layouthtmlbase_s.lib \
$(DIST)\lib\layouthtmldoc_s.lib \
$(DIST)\lib\layouthtmlforms_s.lib \
$(DIST)\lib\layouthtmlstyle_s.lib \
$(DIST)\lib\layouthtmltable_s.lib \
$(DIST)\lib\gkparser.lib \
$(DIST)\lib\raptorlayout_s.lib \
$(DIST)\lib\layoutbase_s.lib \
$(DIST)\lib\gkgfxwin.lib \
$(DIST)\lib\raptorevents_s.lib \
$(DIST)\lib\raptorxulbase_s.lib \
$(DIST)\lib\raptorxulcontent_s.lib \
$(DIST)\lib\layoutxulbase_s.lib \
$(DIST)\lib\layoutxulcontent_s.lib \
!ifdef MOZ_MATHML
$(DIST)\lib\raptormathmlbase_s.lib \
$(DIST)\lib\raptormathmlcontent_s.lib \
$(DIST)\lib\layoutmathmlbase_s.lib \
$(DIST)\lib\layoutmathmlcontent_s.lib \
!endif
!ifdef MOZ_SVG
$(DIST)\lib\raptorsvgbase_s.lib \
$(DIST)\lib\raptorsvgcontent_s.lib \
$(DIST)\lib\layoutsvgbase_s.lib \
$(DIST)\lib\layoutsvgcontent_s.lib \
!endif
$(DIST)\lib\raptorxsldoc_s.lib \
$(DIST)\lib\img32$(VERSION_NUMBER).lib \
$(DIST)\lib\util.lib \
$(DIST)\lib\xpcom.lib \
@ -82,22 +74,9 @@ LLIBS= \
include <$(DEPTH)\config\rules.mak>
install:: $(PROGRAMS)
$(MAKE_INSTALL) $(PROG1) $(DIST)\bin
$(MAKE_INSTALL) $(PROG2) $(DIST)\bin
$(MAKE_INSTALL) $(PROG3) $(DIST)\bin
$(MAKE_INSTALL) $(PROG4) $(DIST)\bin
clobber::
rm -f $(DIST)\bin\TestCSSScanner.exe
rm -f $(DIST)\bin\TestCSSPropertyLookup.exe
rm -f $(DIST)\bin\TestCSSParser.exe
rm -f $(DIST)\bin\TestAttributes.exe
rm -f $(DIST)\bin\TestInlineFrame.exe
$(PROG1): $(OBJDIR) TestCSSScanner.cpp
$(PROG2): $(OBJDIR) TestCSSPropertyLookup.cpp
$(PROG3): $(OBJDIR) TestCSSParser.cpp
$(PROG4): $(OBJDIR) TestAttributes.cpp

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

@ -37,6 +37,8 @@
#include "nsIHTMLContent.h"
#include "..\..\..\src\nsTablePart.h"
#include "nsContentCID.h"
static NS_DEFINE_CID(kStyleSetCID, NS_STYLESET_CID);
static FILE * out;
@ -482,9 +484,8 @@ GeometryTest::GeometryTest(BasicTest *aDoc)
vm->SetRootView(rootView);
nsIStyleSet * ss = nsnull;
status = NS_NewStyleSet(&ss);
if ((NS_FAILED(status)) || nsnull==ss)
nsCOMPtr<nsIStyleSet> ss(do_CreateInstance(kStyleSetCID,&status));
if ((NS_FAILED(status)))
{
fprintf(out, "bad style set");
NS_ASSERTION(PR_FALSE, "bad style set");

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

@ -24,17 +24,13 @@ DEPTH=..
DIRS= \
base \
html \
xml \
xul \
xbl \
xsl \
!ifdef MOZ_MATHML
mathml \
!endif
!ifdef MOZ_SVG
svg \
!endif
events \
build \
!if !defined(DISABLE_TESTS)
html\tests \

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

@ -22,7 +22,7 @@
DEPTH=..\..\..\..
LIBRARY_NAME=raptormathmlbase_s
LIBRARY_NAME=layoutmathmlbase_s
MODULE=raptor
DEFINES= -DWIN32_LEAN_AND_MEAN

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

@ -23,7 +23,7 @@
DEPTH=..\..\..\..
LIBRARY_NAME=raptormathmlcontent_s
LIBRARY_NAME=layoutmathmlcontent_s
MODULE=raptor
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN

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

@ -23,6 +23,7 @@
#include "nsString.h"
#include "nsINameSpaceManager.h"
#include "nsMathMLAtoms.h"
#include "nsLayoutCID.h"
static const char kMathMLNameSpace[] = "http://www.w3.org/1998/Math/MathML";
@ -42,11 +43,20 @@ void nsMathMLAtoms::AddRefAtoms() {
/* MathML Atoms registers the MathML name space ID because it's a convenient
place to do this, if you don't want a permanent, "well-known" ID.
*/
if (NS_SUCCEEDED(NS_NewNameSpaceManager(&gNameSpaceManager)))
NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
nsCOMPtr<nsINameSpaceManager> nsmgr =
do_CreateInstance(kNameSpaceManagerCID);
if (nsmgr) {
// gNameSpaceManager->CreateRootNameSpace(namespace);
gNameSpaceManager->RegisterNameSpace(NS_ConvertASCIItoUCS2(kMathMLNameSpace), nameSpaceID);
else
nsmgr->RegisterNameSpace(NS_ConvertASCIItoUCS2(kMathMLNameSpace),
nameSpaceID);
gNameSpaceManager = nsmgr;
NS_ADDREF(gNameSpaceManager);
} else {
NS_ASSERTION(0, "failed to create MathML atoms namespace manager");
}
// now register the atoms
#define MATHML_ATOM(_name, _value) _name = NS_NewAtom(_value);

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

@ -25,7 +25,7 @@
#include "nscore.h"
#include "nsCoord.h"
#include "nsCRT.h"
class nsString;
#include "nsString.h"
enum nsStyleUnit {
eStyleUnit_Null = 0, // (no value) value is not specified
@ -48,15 +48,86 @@ typedef union {
class nsStyleCoord {
public:
nsStyleCoord(nsStyleUnit aUnit = eStyleUnit_Null);
nsStyleCoord(nscoord aValue);
nsStyleCoord(PRInt32 aValue, nsStyleUnit aUnit);
nsStyleCoord(float aValue, nsStyleUnit aUnit);
nsStyleCoord(const nsStyleCoord& aCopy);
nsStyleCoord(nsStyleUnit aUnit = eStyleUnit_Null)
: mUnit(aUnit) {
NS_ASSERTION(aUnit < eStyleUnit_Percent, "not a valueless unit");
if (aUnit >= eStyleUnit_Percent) {
mUnit = eStyleUnit_Null;
}
mValue.mInt = 0;
}
nsStyleCoord& operator=(const nsStyleCoord& aCopy);
PRBool operator==(const nsStyleCoord& aOther) const;
PRBool operator!=(const nsStyleCoord& aOther) const;
nsStyleCoord(nscoord aValue)
: mUnit(eStyleUnit_Coord) {
mValue.mInt = aValue;
}
nsStyleCoord(PRInt32 aValue, nsStyleUnit aUnit)
: mUnit(aUnit) {
//if you want to pass in eStyleUnit_Coord, don't. instead, use the
//constructor just above this one... MMP
NS_ASSERTION((aUnit == eStyleUnit_Proportional) ||
(aUnit == eStyleUnit_Enumerated) ||
(aUnit == eStyleUnit_Integer), "not an int value");
if ((aUnit == eStyleUnit_Proportional) ||
(aUnit == eStyleUnit_Enumerated) ||
(aUnit == eStyleUnit_Integer)) {
mValue.mInt = aValue;
}
else {
mUnit = eStyleUnit_Null;
mValue.mInt = 0;
}
}
nsStyleCoord(float aValue, nsStyleUnit aUnit)
: mUnit(aUnit) {
NS_ASSERTION((aUnit == eStyleUnit_Percent) ||
(aUnit == eStyleUnit_Factor), "not a float value");
if ((aUnit == eStyleUnit_Percent) ||
(aUnit == eStyleUnit_Factor)) {
mValue.mFloat = aValue;
}
else {
mUnit = eStyleUnit_Null;
mValue.mInt = 0;
}
}
nsStyleCoord(const nsStyleCoord& aCopy)
: mUnit(aCopy.mUnit) {
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
mValue.mFloat = aCopy.mValue.mFloat;
}
else {
mValue.mInt = aCopy.mValue.mInt;
}
}
nsStyleCoord& operator=(const nsStyleCoord& aCopy) {
mUnit = aCopy.mUnit;
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
mValue.mFloat = aCopy.mValue.mFloat;
}
else {
mValue.mInt = aCopy.mValue.mInt;
}
return *this;
}
PRBool operator==(const nsStyleCoord& aOther) const {
if (mUnit == aOther.mUnit) {
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
return PRBool(mValue.mFloat == aOther.mValue.mFloat);
}
else {
return PRBool(mValue.mInt == aOther.mValue.mInt);
}
}
return PR_FALSE;
}
PRBool operator!=(const nsStyleCoord& aOther) const;
nsStyleUnit GetUnit(void) const { return mUnit; }
nscoord GetCoordValue(void) const;
@ -65,18 +136,98 @@ public:
float GetFactorValue(void) const;
void GetUnionValue(nsStyleUnion& aValue) const;
void Reset(void); // sets to null
void SetCoordValue(nscoord aValue);
void SetIntValue(PRInt32 aValue, nsStyleUnit aUnit);
void SetPercentValue(float aValue);
void SetFactorValue(float aValue);
void SetNormalValue(void);
void SetAutoValue(void);
void SetInheritValue(void);
void SetUnionValue(const nsStyleUnion& aValue, nsStyleUnit aUnit);
void Reset(void) {
mUnit = eStyleUnit_Null;
mValue.mInt = 0;
}
void AppendToString(nsString& aBuffer) const;
void ToString(nsString& aBuffer) const;
void SetCoordValue(nscoord aValue) {
mUnit = eStyleUnit_Coord;
mValue.mInt = aValue;
}
void SetIntValue(PRInt32 aValue, nsStyleUnit aUnit) {
if ((aUnit == eStyleUnit_Proportional) ||
(aUnit == eStyleUnit_Enumerated) ||
(aUnit == eStyleUnit_Chars) ||
(aUnit == eStyleUnit_Integer)) {
mUnit = aUnit;
mValue.mInt = aValue;
}
else {
NS_WARNING("not an int value");
Reset();
}
}
void SetPercentValue(float aValue) {
mUnit = eStyleUnit_Percent;
mValue.mFloat = aValue;
}
void SetFactorValue(float aValue) {
mUnit = eStyleUnit_Factor;
mValue.mFloat = aValue;
}
void SetNormalValue(void) {
mUnit = eStyleUnit_Normal;
mValue.mInt = 0;
}
void SetAutoValue(void) {
mUnit = eStyleUnit_Auto;
mValue.mInt = 0;
}
void SetInheritValue(void) {
mUnit = eStyleUnit_Inherit;
mValue.mInt = 0;
}
void SetUnionValue(const nsStyleUnion& aValue, nsStyleUnit aUnit) {
mUnit = aUnit;
#if PR_BYTES_PER_INT == PR_BYTES_PER_FLOAT
mValue.mInt = aValue.mInt;
#else
nsCRT::memcpy(&mValue, &aValue, sizeof(nsStyleUnion));
#endif
}
void AppendToString(nsString& aBuffer) const {
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
aBuffer.AppendFloat(mValue.mFloat);
}
else if ((eStyleUnit_Coord == mUnit) ||
(eStyleUnit_Proportional == mUnit) ||
(eStyleUnit_Enumerated == mUnit) ||
(eStyleUnit_Integer == mUnit)) {
aBuffer.AppendInt(mValue.mInt, 10);
aBuffer.AppendWithConversion("[0x");
aBuffer.AppendInt(mValue.mInt, 16);
aBuffer.AppendWithConversion(']');
}
switch (mUnit) {
case eStyleUnit_Null: aBuffer.AppendWithConversion("Null"); break;
case eStyleUnit_Coord: aBuffer.AppendWithConversion("tw"); break;
case eStyleUnit_Percent: aBuffer.AppendWithConversion("%"); break;
case eStyleUnit_Factor: aBuffer.AppendWithConversion("f"); break;
case eStyleUnit_Normal: aBuffer.AppendWithConversion("Normal"); break;
case eStyleUnit_Auto: aBuffer.AppendWithConversion("Auto"); break;
case eStyleUnit_Inherit: aBuffer.AppendWithConversion("Inherit"); break;
case eStyleUnit_Proportional: aBuffer.AppendWithConversion("*"); break;
case eStyleUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break;
case eStyleUnit_Integer: aBuffer.AppendWithConversion("int"); break;
case eStyleUnit_Chars: aBuffer.AppendWithConversion("chars"); break;
}
aBuffer.AppendWithConversion(' ');
}
void ToString(nsString& aBuffer) const {
aBuffer.Truncate();
AppendToString(aBuffer);
}
public:
nsStyleUnit mUnit;
@ -84,12 +235,38 @@ public:
};
#define COMPARE_SIDE(side) \
if ((eStyleUnit_Percent <= m##side##Unit) && \
(m##side##Unit < eStyleUnit_Coord)) { \
if (m##side##Value.mFloat != aOther.m##side##Value.mFloat) \
return PR_FALSE; \
} \
else { \
if (m##side##Value.mInt != aOther.m##side##Value.mInt) \
return PR_FALSE; \
}
class nsStyleSides {
public:
nsStyleSides(void);
nsStyleSides(void) {
nsCRT::memset(this, 0x00, sizeof(nsStyleSides));
}
// nsStyleSides& operator=(const nsStyleSides& aCopy); // use compiler's version
PRBool operator==(const nsStyleSides& aOther) const;
PRBool operator==(const nsStyleSides& aOther) const {
if ((mLeftUnit == aOther.mLeftUnit) &&
(mTopUnit == aOther.mTopUnit) &&
(mRightUnit == aOther.mRightUnit) &&
(mBottomUnit == aOther.mBottomUnit)) {
COMPARE_SIDE(Left);
COMPARE_SIDE(Top);
COMPARE_SIDE(Right);
COMPARE_SIDE(Bottom);
return PR_TRUE;
}
return PR_FALSE;
}
PRBool operator!=(const nsStyleSides& aOther) const;
nsStyleUnit GetLeftUnit(void) const;
@ -102,14 +279,39 @@ public:
nsStyleCoord& GetRight(nsStyleCoord& aCoord) const;
nsStyleCoord& GetBottom(nsStyleCoord& aCoord) const;
void Reset(void);
void Reset(void) {
nsCRT::memset(this, 0x00, sizeof(nsStyleSides));
}
void SetLeft(const nsStyleCoord& aCoord);
void SetTop(const nsStyleCoord& aCoord);
void SetRight(const nsStyleCoord& aCoord);
void SetBottom(const nsStyleCoord& aCoord);
void AppendToString(nsString& aBuffer) const;
void ToString(nsString& aBuffer) const;
void AppendToString(nsString& aBuffer) const {
nsStyleCoord temp;
GetLeft(temp);
aBuffer.AppendWithConversion("left: ");
temp.AppendToString(aBuffer);
GetTop(temp);
aBuffer.AppendWithConversion("top: ");
temp.AppendToString(aBuffer);
GetRight(temp);
aBuffer.AppendWithConversion("right: ");
temp.AppendToString(aBuffer);
GetBottom(temp);
aBuffer.AppendWithConversion("bottom: ");
temp.AppendToString(aBuffer);
}
void ToString(nsString& aBuffer) const {
aBuffer.Truncate();
AppendToString(aBuffer);
}
protected:
PRUint8 mLeftUnit;

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

@ -21,7 +21,7 @@
DEPTH=..\..\..\..
LIBRARY_NAME=raptorsvgbase_s
LIBRARY_NAME=layoutsvgbase_s
MODULE=raptor
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN

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

@ -36,7 +36,6 @@
#include "nsIViewManager.h"
#include "nsIView.h"
#include "nsIPresShell.h"
#include "nsGenericHTMLElement.h"
#include "nsCSSRendering.h"
#include "nsIPref.h"
#include "nsIServiceManager.h"

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

@ -21,7 +21,7 @@
DEPTH=..\..\..\..
LIBRARY_NAME=raptorsvgcontent_s
LIBRARY_NAME=layoutsvgcontent_s
MODULE=raptor
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN

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

@ -25,6 +25,7 @@
#include "nsString.h"
#include "nsINameSpaceManager.h"
#include "nsSVGAtoms.h"
#include "nsLayoutCID.h"
static const char kSVGNameSpace[] = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.svg";
@ -45,8 +46,17 @@ void nsSVGAtoms::AddRefAtoms() {
/* SVG Atoms registers the SVG name space ID because it's a convenient
place to do this, if you don't want a permanent, "well-known" ID.
*/
if (NS_SUCCEEDED(NS_NewNameSpaceManager(&gNameSpaceManager))) {
gNameSpaceManager->RegisterNameSpace(NS_ConvertASCIItoUCS2(kSVGNameSpace), nameSpaceID);
NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
nsCOMPtr<nsINameSpaceManager> nsmgr =
do_CreateInstance(kNameSpaceManagerCID);
if (nsmgr) {
nsmgr->RegisterNameSpace(NS_ConvertASCIItoUCS2(kSVGNameSpace),
nameSpaceID);
gNameSpaceManager = nsmgr;
NS_ADDREF(gNameSpaceManager);
} else {
NS_ASSERTION(0, "failed to create SVG atoms namespace manager");
}

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

@ -21,7 +21,7 @@
DEPTH=..\..\..\..
LIBRARY_NAME=raptorxulbase_s
LIBRARY_NAME=layoutxulbase_s
MODULE=raptor
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN

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

@ -29,137 +29,9 @@
#include "nsScrollbarFrame.h"
#include "nsScrollbarButtonFrame.h"
#include "nsXULAtoms.h"
#include "nsHTMLAtoms.h"
#include "nsISupportsArray.h"
#include "nsXULAtoms.h"
#include "nsHTMLAtoms.h"
#include "nsINameSpaceManager.h"
#include "nsIXMLContent.h"
#include "nsIDOMDocument.h"
#include "nsIDocument.h"
#include "nsIDOMElement.h"
#include "nsXMLElement.h"
#include "nsIStyledContent.h"
#include "nsIStyleRule.h"
#include "nsHTMLValue.h"
#include "nsIAnonymousContent.h"
#include "nsIView.h"
class AnonymousElement : public nsXMLElement, public nsIAnonymousContent
{
public:
AnonymousElement() {}
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
nsEvent* aEvent,
nsIDOMEvent** aDOMEvent,
PRUint32 aFlags,
nsEventStatus* aEventStatus);
};
#if 0
NS_IMETHODIMP
AnonymousElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const {
return this->nsXMLElement::SizeOf(aSizer, aResult);
}
#endif
NS_IMETHODIMP
AnonymousElement::HandleDOMEvent(nsIPresContext* aPresContext,
nsEvent* aEvent,
nsIDOMEvent** aDOMEvent,
PRUint32 aFlags,
nsEventStatus* aEventStatus)
{
/*
// if our parent is not anonymous then we don't want to bubble the event
// so lets set our parent in nsnull to prevent it. Then we will set it
// back.
nsIContent* parent = nsnull;
GetParent(parent);
nsCOMPtr<nsIAnonymousContent> anonymousParent(do_QueryInterface(parent));
if (!anonymousParent)
SetParent(nsnull);
*/
nsresult rv = nsXMLElement::HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
aFlags, aEventStatus);
/*
if (!anonymousParent)
SetParent(parent);
*/
return rv;
}
NS_IMPL_ADDREF_INHERITED(AnonymousElement, nsXMLElement)
NS_IMPL_RELEASE_INHERITED(AnonymousElement, nsXMLElement)
//
// QueryInterface
//
NS_INTERFACE_MAP_BEGIN(AnonymousElement)
NS_INTERFACE_MAP_ENTRY(nsIAnonymousContent)
NS_INTERFACE_MAP_END_INHERITING(nsXMLElement)
nsresult NS_CreateAnonymousNode(nsIContent* aParent, nsIAtom* aTag, PRInt32 aNameSpaceId, nsCOMPtr<nsIContent>& aNewNode)
{
NS_ENSURE_ARG_POINTER(aParent);
// create the xml element
//NS_NewXMLElement(getter_AddRefs(content), aTag);
nsCOMPtr<nsIDocument> doc;
aParent->GetDocument(*getter_AddRefs(doc));
nsCOMPtr<nsINodeInfoManager> nodeInfoManager;
doc->GetNodeInfoManager(*getter_AddRefs(nodeInfoManager));
nsCOMPtr<nsINodeInfo> nodeInfo;
nodeInfoManager->GetNodeInfo(aTag, nsnull, aNameSpaceId,
*getter_AddRefs(nodeInfo));
nsXMLElement *content = new AnonymousElement();
if (!content)
return NS_ERROR_OUT_OF_MEMORY;
nsresult rv = content->Init(nodeInfo);
if (NS_FAILED(rv)) {
delete content;
return rv;
}
aNewNode = content;
/*
nsCOMPtr<nsIDocument> document;
aParent->GetDocument(*getter_AddRefs(document));
nsCOMPtr<nsIDOMDocument> domDocument(do_QueryInterface(document));
nsCOMPtr<nsIDOMElement> element;
nsString name;
aTag->ToString(name);
domDocument->CreateElement(name, getter_AddRefs(element));
aNewNode = do_QueryInterface(element);
*/
return NS_OK;
}
//
// NS_NewToolbarFrame
//
@ -181,7 +53,6 @@ NS_NewScrollbarFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame )
} // NS_NewScrollbarFrame
//
// QueryInterface
//

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

@ -57,6 +57,11 @@
#include "nsIXBLService.h"
#include "nsIServiceManager.h"
#include "nsHTMLContainerFrame.h"
#include "nsINodeInfo.h"
#include "nsIAnonymousContent.h"
#include "nsContentCID.h"
static NS_DEFINE_IID(kAnonymousElementCID, NS_ANONYMOUSCONTENT_CID);
const PRInt32 kMaxZ = 0x7fffffff; //XXX: Shouldn't there be a define somewhere for MaxInt for PRInt32
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
@ -260,7 +265,46 @@ NS_INTERFACE_MAP_BEGIN(nsSplitterFrame)
NS_INTERFACE_MAP_END_INHERITING(nsBoxFrame)
nsresult NS_CreateAnonymousNode(nsIContent* aParent, nsIAtom* aTag, PRInt32 aNameSpaceId, nsCOMPtr<nsIContent>& aNewNode);
static nsresult CreateAnonymousNode(nsIContent* aParent, nsIAtom* aTag, PRInt32 aNameSpaceId, nsIContent **aNewNode)
{
NS_ENSURE_ARG_POINTER(aParent);
NS_ENSURE_ARG_POINTER(aNewNode);
*aNewNode = nsnull;
nsresult rv;
nsCOMPtr<nsIContent> content(do_CreateInstance(kAnonymousElementCID,&rv));
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIDocument> doc;
rv = aParent->GetDocument(*getter_AddRefs(doc));
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsINodeInfoManager> nodeInfoManager;
rv = doc->GetNodeInfoManager(*getter_AddRefs(nodeInfoManager));
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsINodeInfo> nodeInfo;
rv = nodeInfoManager->GetNodeInfo(aTag, nsnull, aNameSpaceId,
*getter_AddRefs(nodeInfo));
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIAnonymousContent> anon(do_QueryInterface(content,&rv));
if (NS_FAILED(rv))
return rv;
rv = anon->Init(nodeInfo);
if (NS_FAILED(rv))
return rv;
*aNewNode = content.get();
NS_ADDREF(*aNewNode);
return NS_OK;
}
/**
* Anonymous interface
@ -281,16 +325,16 @@ nsSplitterFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
{
// create a spring
nsCOMPtr<nsIContent> content;
NS_CreateAnonymousNode(mContent, nsXULAtoms::spring, nsXULAtoms::nameSpaceID, content);
CreateAnonymousNode(mContent, nsXULAtoms::spring, nsXULAtoms::nameSpaceID, getter_AddRefs(content));
content->SetAttribute(kNameSpaceID_None, nsXULAtoms::flex, NS_ConvertASCIItoUCS2("100%"), PR_FALSE);
aAnonymousChildren.AppendElement(content);
// a grippy
NS_CreateAnonymousNode(mContent, nsXULAtoms::grippy, nsXULAtoms::nameSpaceID, content);
CreateAnonymousNode(mContent, nsXULAtoms::grippy, nsXULAtoms::nameSpaceID, getter_AddRefs(content));
aAnonymousChildren.AppendElement(content);
// create a spring
NS_CreateAnonymousNode(mContent, nsXULAtoms::spring, nsXULAtoms::nameSpaceID, content);
CreateAnonymousNode(mContent, nsXULAtoms::spring, nsXULAtoms::nameSpaceID, getter_AddRefs(content));
content->SetAttribute(kNameSpaceID_None, nsXULAtoms::flex, NS_ConvertASCIItoUCS2("100%"), PR_FALSE);
aAnonymousChildren.AppendElement(content);
}

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

@ -1,54 +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=raptorxulcontent_s
MODULE=raptor
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
CPPSRCS= \
nsXULAtoms.cpp \
$(NULL)
CPP_OBJS= \
.\$(OBJDIR)\nsXULAtoms.obj \
$(NULL)
EXPORTS = \
$(NULL)
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\js \
-I$(PUBLIC)\dom -I$(PUBLIC)\netlib -I$(PUBLIC)\pref
LCFLAGS = \
$(LCFLAGS) \
$(DEFINES) \
$(NULL)
include <$(DEPTH)\config\rules.mak>
install:: $(LIBRARY)
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
clobber::
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib

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

@ -1,74 +0,0 @@
/* -*- 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
* 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.
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
*/
#include "nsString.h"
#include "nsINameSpaceManager.h"
#include "nsXULAtoms.h"
static const char kXULNameSpace[] = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
PRInt32 nsXULAtoms::nameSpaceID;
// define storage for all atoms
#define XUL_ATOM(_name, _value) nsIAtom* nsXULAtoms::_name;
#include "nsXULAtomList.h"
#undef XUL_ATOM
static nsrefcnt gRefCnt = 0;
static nsINameSpaceManager* gNameSpaceManager;
void nsXULAtoms::AddRefAtoms() {
if (gRefCnt == 0) {
/* XUL Atoms registers the XUL name space ID because it's a convenient
place to do this, if you don't want a permanent, "well-known" ID.
*/
if (NS_SUCCEEDED(NS_NewNameSpaceManager(&gNameSpaceManager))) {
// gNameSpaceManager->CreateRootNameSpace(namespace);
nsAutoString nameSpace; nameSpace.AssignWithConversion(kXULNameSpace);
gNameSpaceManager->RegisterNameSpace(nameSpace, nameSpaceID);
} else {
NS_ASSERTION(0, "failed to create xul atoms namespace manager");
}
// now register the atoms
#define XUL_ATOM(_name, _value) _name = NS_NewAtom(_value);
#include "nsXULAtomList.h"
#undef XUL_ATOM
}
++gRefCnt;
}
void nsXULAtoms::ReleaseAtoms() {
NS_PRECONDITION(gRefCnt != 0, "bad release of xul atoms");
if (--gRefCnt == 0) {
#define XUL_ATOM(_name, _value) NS_RELEASE(_name);
#include "nsXULAtomList.h"
#undef XUL_ATOM
NS_IF_RELEASE(gNameSpaceManager);
}
}

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

@ -79,6 +79,7 @@ DIRS = \
widget \
dom \
view \
content \
layout \
rdf \
docshell \

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

@ -106,6 +106,7 @@
#include "nsIXULPrototypeCache.h"
#include "nsLWBrkCIID.h"
#include "nsLayoutCID.h"
#include "nsContentCID.h"
#include "nsNetUtil.h"
#include "nsParserCIID.h"
#include "nsPIBoxObject.h"

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

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

@ -33,10 +33,7 @@ MODULE = xpinstall
LIBRARY_NAME = xpinstall
SHORT_LIBNAME = xpinstal
IS_COMPONENT = 1
REQUIRES = xpcom jar chrome necko intl locale libreg dom js pref appshell widget layout uriloader xpconnect rdf docshell
EXTRA_DSO_LIBS = jsdom
REQUIRES = xpcom jar chrome necko intl locale libreg js pref appshell widget layout uriloader xpconnect rdf docshell
# XXX shouldn't need to export this
EXPORTS = nsXPITriggerInfo.h

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

@ -45,9 +45,7 @@ LCFLAGS = \
LLIBS = \
$(DIST)\lib\xpcom.lib \
$(DIST)\lib\js3250.lib \
$(DIST)\lib\jsdombase_s.lib \
$(DIST)\lib\jsdomevents_s.lib \
$(DIST)\lib\zlib.lib \
$(DIST)\lib\zlib.lib \
$(DIST)\lib\strres.lib \
$(LIBNSPR) \
$(DIST)\lib\mozreg.lib \

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

@ -21,7 +21,6 @@
*/
#include "jsapi.h"
#include "nsJSUtils.h"
#include "nscore.h"
#include "nsIScriptContext.h"

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

@ -24,7 +24,6 @@
#define __NS_JSFILE_H__
#include "jsapi.h"
#include "nsJSUtils.h"
#include "nscore.h"

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

@ -17,7 +17,6 @@
*/
#include "jsapi.h"
#include "nsJSUtils.h"
#include "nscore.h"
#include "nsIScriptContext.h"
@ -66,9 +65,17 @@ fso_ToString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
return JS_TRUE;
}
if(NS_FAILED( nativeThis->ToString(&stringReturned)))
return JS_FALSE;
nsJSUtils::nsConvertStringToJSVal(stringReturned, cx, rval);
if(NS_FAILED( nativeThis->ToString(&stringReturned)))
return JS_FALSE;
JSString *jsstring =
JS_NewUCStringCopyN(cx, NS_REINTERPRET_CAST(const jschar*,
stringReturned.GetUnicode()),
stringReturned.Length());
// set the return value
*rval = STRING_TO_JSVAL(jsstring);
return JS_TRUE;
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше