Added content directory and moved some code

This commit is contained in:
kipp 1998-06-26 15:08:55 +00:00
Родитель b00f7215a5
Коммит 4e73a0df94
19 изменённых файлов: 477 добавлений и 7 удалений

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

@ -0,0 +1,22 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..
DIRS=src
include <$(DEPTH)\layout\config\rules.mak>

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

@ -0,0 +1,51 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..\..
LIBRARY_NAME = nglhtmlcon_s
MODULE=raptor
REQUIRES=xpcom raptor js
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
CPPSRCS= \
nsHTMLHead.cpp \
nsHTMLMeta.cpp \
$(NULL)
CPP_OBJS= \
.\$(OBJDIR)\nsHTMLHead.obj \
.\$(OBJDIR)\nsHTMLMeta.obj \
$(NULL)
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\js \
-I$(PUBLIC)\dom -I$(PUBLIC)\netlib \
-I..\..\style\src -I..\..\..\css\layout\src \
-I..\..\..\base\src -I..\..\base\src
LCFLAGS = \
$(LCFLAGS) \
$(DEFINES) \
$(NULL)
include <$(DEPTH)\layout\config\rules.mak>
libs:: $(LIBRARY)
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
clobber::
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib

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

@ -150,6 +150,7 @@ protected:
nsresult ProcessAREATag(const nsIParserNode& aNode);
nsresult ProcessBASETag(const nsIParserNode& aNode);
nsresult ProcessMETATag(const nsIParserNode& aNode);
nsresult ProcessSTYLETag(const nsIParserNode& aNode);
nsresult ProcessSCRIPTTag(const nsIParserNode& aNode);
@ -752,6 +753,11 @@ PRInt32 HTMLContentSink::AddLeaf(const nsIParserNode& aNode)
case eHTMLTag_area:
ProcessAREATag(aNode);
return 0;
case eHTMLTag_meta:
// Add meta objects to the head object
ProcessMETATag(aNode);
return 0;
}
eHTMLTags parentType;
@ -976,6 +982,27 @@ nsresult HTMLContentSink::ProcessBASETag(const nsIParserNode& aNode)
return NS_OK;
}
nsresult
HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
{
NS_PRECONDITION(nsnull != mHead, "bad parser: meta before head");
nsresult rv = NS_OK;
if (nsnull != mHead) {
nsAutoString tmp(aNode.GetText());
tmp.ToUpperCase();
nsIAtom* atom = NS_NewAtom(tmp);
nsIHTMLContent* it = nsnull;
rv = NS_NewHTMLMeta(&it, atom) ;
if (NS_OK == rv) {
rv = AddAttributes(aNode, it);
mHead->AppendChild(it, PR_FALSE);
}
NS_RELEASE(atom);
}
return rv;
}
nsresult HTMLContentSink::ProcessBRTag(nsIHTMLContent** aInstancePtrResult,
const nsIParserNode& aNode)
{

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

@ -43,9 +43,14 @@ extern nsresult NS_NewHTMLContentSink(nsIHTMLContentSink** aInstancePtrResult,
extern nsresult
NS_NewRootPart(nsIHTMLContent** aInstancePtrResult,
nsIDocument* aDocument);
// Head parts
extern nsresult
NS_NewHTMLHead(nsIHTMLContent** aInstancePtrResult,
nsIAtom* aTag);
extern nsresult
NS_NewHTMLMeta(nsIHTMLContent** aInstancePtrResult,
nsIAtom* aTag);
// Create an html body part
extern nsresult

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

@ -19,7 +19,7 @@ DEPTH = ../..
# Don't do tests for now
#DIRS = base document forms style table build tests
DIRS = base document forms style table
DIRS = base content document forms style table
include $(DEPTH)/config/config.mk

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

@ -33,10 +33,10 @@ CPPSRCS = \
nsHTMLContainer.cpp \
nsHTMLContainerFrame.cpp \
nsHTMLContent.cpp \
nsHTMLHead.cpp \
nsHTMLIIDs.cpp \
nsHTMLImage.cpp \
nsHTMLReflowCommand.cpp \
nsHTMLMeta.cpp \
nsHTMLReflowCommand.cpp \
nsHTMLTagContent.cpp \
nsHTMLTags.cpp \
nsImageMap.cpp \

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

@ -35,7 +35,6 @@ CPPSRCS= \
nsHTMLContainer.cpp \
nsHTMLContainerFrame.cpp \
nsHTMLContent.cpp \
nsHTMLHead.cpp \
nsHTMLIIDs.cpp \
nsHTMLImage.cpp \
nsHTMLReflowCommand.cpp \
@ -66,7 +65,6 @@ CPP_OBJS= \
.\$(OBJDIR)\nsHTMLContainer.obj \
.\$(OBJDIR)\nsHTMLContainerFrame.obj \
.\$(OBJDIR)\nsHTMLContent.obj \
.\$(OBJDIR)\nsHTMLHead.obj \
.\$(OBJDIR)\nsHTMLIIDs.obj \
.\$(OBJDIR)\nsHTMLImage.obj \
.\$(OBJDIR)\nsHTMLReflowCommand.obj \

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

@ -72,6 +72,10 @@ public:
HRuleFrame(nsIContent* aContent,
nsIFrame* aParentFrame);
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
nsReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD Paint(nsIPresContext& aPresContext,
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect);
@ -223,6 +227,33 @@ HRuleFrame::Paint(nsIPresContext& aPresContext,
return NS_OK;
}
NS_IMETHODIMP
HRuleFrame::Reflow(nsIPresContext* aPresContext,
nsReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
// XXX add in code to check for width/height being set via css
// and if set use them instead of calling GetDesiredSize.
GetDesiredSize(aPresContext, aReflowState, aDesiredSize);
AddBordersAndPadding(aPresContext, aDesiredSize);
// HR's do not impact the max-element-size, otherwise tables behave
// badly. This makes sense they are springy.
if (nsnull != aDesiredSize.maxElementSize) {
nscoord onePixel = nscoord(aPresContext->GetPixelsToTwips());
aDesiredSize.maxElementSize->width = onePixel;
aDesiredSize.maxElementSize->height = onePixel;
}
aStatus = NS_FRAME_COMPLETE;
return NS_OK;
}
void
HRuleFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,

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

@ -504,6 +504,21 @@ nsContentAttr nsHTMLContainer::AttributeToString(nsIAtom* aAttribute,
}
}
}
else if (aValue.GetUnit() == eHTMLUnit_Integer) {
if (mTag == nsHTMLAtoms::font) {
if ((aAttribute == nsHTMLAtoms::size) ||
(aAttribute == nsHTMLAtoms::pointSize) ||
(aAttribute == nsHTMLAtoms::fontWeight)) {
aResult.Truncate();
PRInt32 value = aValue.GetIntValue();
if (value >= 0) {
aResult.Append('+');
}
aResult.Append(value, 10);
ca = eContentAttr_HasValue;
}
}
}
return ca;
}
@ -603,7 +618,8 @@ void nsHTMLContainer::MapAttributesInto(nsIStyleContext* aContext,
if (parentFont->mFont.size < (nscoord)((float)normal.size * kFontScale[index]))
break;
size = ((index - 1) + size);
if (7 < size) size = 7;
if (size < 0) size = 0;
if (size > 6) size = 6;
font->mFont.size = (nscoord)((float)normal.size * kFontScale[size]);
}
else if ((-7 <= size) && (size < 0)) {
@ -613,6 +629,7 @@ void nsHTMLContainer::MapAttributesInto(nsIStyleContext* aContext,
break;
size = ((index + 1) + size);
if (size < 0) size = 0;
if (size > 6) size = 6;
font->mFont.size = (nscoord)((float)normal.size * kFontScale[size]);
}
else if (0 == size) {

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

@ -43,9 +43,14 @@ extern nsresult NS_NewHTMLContentSink(nsIHTMLContentSink** aInstancePtrResult,
extern nsresult
NS_NewRootPart(nsIHTMLContent** aInstancePtrResult,
nsIDocument* aDocument);
// Head parts
extern nsresult
NS_NewHTMLHead(nsIHTMLContent** aInstancePtrResult,
nsIAtom* aTag);
extern nsresult
NS_NewHTMLMeta(nsIHTMLContent** aInstancePtrResult,
nsIAtom* aTag);
// Create an html body part
extern nsresult

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

@ -0,0 +1,24 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../../..
DIRS = src
include $(DEPTH)/config/config.mk
include $(DEPTH)/config/rules.mk

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

@ -0,0 +1,22 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..
DIRS=src
include <$(DEPTH)\layout\config\rules.mak>

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

@ -0,0 +1,39 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=../../../..
LIBRARY_NAME = nglhtmlcon_s
# Note the sophisticated alphabetical ordering :-|
CPPSRCS = \
nsHTMLHead.cpp \
nsHTMLMeta.cpp \
$(NULL)
MODULE = raptor
REQUIRES = xpcom raptor dom js
include $(DEPTH)/config/config.mk
LCFLAGS += -D_IMPL_NS_HTML
INCLUDES += -I../../style/src -I../../../base/src -I../../../css/layout/src \
-I../../base/src
include $(DEPTH)/config/rules.mk

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

@ -0,0 +1,51 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..\..
LIBRARY_NAME = nglhtmlcon_s
MODULE=raptor
REQUIRES=xpcom raptor js
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
CPPSRCS= \
nsHTMLHead.cpp \
nsHTMLMeta.cpp \
$(NULL)
CPP_OBJS= \
.\$(OBJDIR)\nsHTMLHead.obj \
.\$(OBJDIR)\nsHTMLMeta.obj \
$(NULL)
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\js \
-I$(PUBLIC)\dom -I$(PUBLIC)\netlib \
-I..\..\style\src -I..\..\..\css\layout\src \
-I..\..\..\base\src -I..\..\base\src
LCFLAGS = \
$(LCFLAGS) \
$(DEFINES) \
$(NULL)
include <$(DEPTH)\layout\config\rules.mak>
libs:: $(LIBRARY)
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
clobber::
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib

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

@ -0,0 +1,74 @@
/* -*- 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.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsHTMLParts.h"
#include "nsHTMLContainer.h"
#include "nsFrame.h"
#include "nsHTMLIIDs.h"
class nsHTMLHead : public nsHTMLContainer {
public:
nsHTMLHead(nsIAtom* aTag);
virtual nsresult CreateFrame(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIStyleContext* aStyleContext,
nsIFrame*& aResult);
protected:
virtual ~nsHTMLHead();
};
nsHTMLHead::nsHTMLHead(nsIAtom* aTag)
: nsHTMLContainer(aTag)
{
}
nsHTMLHead::~nsHTMLHead()
{
}
nsresult
nsHTMLHead::CreateFrame(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIStyleContext* aStyleContext,
nsIFrame*& aResult)
{
nsIFrame* frame;
nsFrame::NewFrame(&frame, this, aParentFrame);
if (nsnull == frame) {
return NS_ERROR_OUT_OF_MEMORY;
}
frame->SetStyleContext(aPresContext, aStyleContext);
aResult = frame;
return NS_OK;
}
nsresult
NS_NewHTMLHead(nsIHTMLContent** aInstancePtrResult,
nsIAtom* aTag)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLHead(aTag);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
return it->QueryInterface(kIHTMLContentIID, (void **) aInstancePtrResult);
}

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

@ -0,0 +1,76 @@
/* -*- 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.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsHTMLParts.h"
#include "nsHTMLContainer.h"
#include "nsFrame.h"
#include "nsHTMLIIDs.h"
#define nsHTMLMetaSuper nsHTMLTagContent
class nsHTMLMeta : public nsHTMLMetaSuper {
public:
nsHTMLMeta(nsIAtom* aTag);
virtual nsresult CreateFrame(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIStyleContext* aStyleContext,
nsIFrame*& aResult);
protected:
virtual ~nsHTMLMeta();
};
nsHTMLMeta::nsHTMLMeta(nsIAtom* aTag)
: nsHTMLMetaSuper(aTag)
{
}
nsHTMLMeta::~nsHTMLMeta()
{
}
nsresult
nsHTMLMeta::CreateFrame(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIStyleContext* aStyleContext,
nsIFrame*& aResult)
{
nsIFrame* frame;
nsFrame::NewFrame(&frame, this, aParentFrame);
if (nsnull == frame) {
return NS_ERROR_OUT_OF_MEMORY;
}
frame->SetStyleContext(aPresContext, aStyleContext);
aResult = frame;
return NS_OK;
}
nsresult
NS_NewHTMLMeta(nsIHTMLContent** aInstancePtrResult,
nsIAtom* aTag)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLMeta(aTag);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
return it->QueryInterface(kIHTMLContentIID, (void **) aInstancePtrResult);
}

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

@ -150,6 +150,7 @@ protected:
nsresult ProcessAREATag(const nsIParserNode& aNode);
nsresult ProcessBASETag(const nsIParserNode& aNode);
nsresult ProcessMETATag(const nsIParserNode& aNode);
nsresult ProcessSTYLETag(const nsIParserNode& aNode);
nsresult ProcessSCRIPTTag(const nsIParserNode& aNode);
@ -752,6 +753,11 @@ PRInt32 HTMLContentSink::AddLeaf(const nsIParserNode& aNode)
case eHTMLTag_area:
ProcessAREATag(aNode);
return 0;
case eHTMLTag_meta:
// Add meta objects to the head object
ProcessMETATag(aNode);
return 0;
}
eHTMLTags parentType;
@ -976,6 +982,27 @@ nsresult HTMLContentSink::ProcessBASETag(const nsIParserNode& aNode)
return NS_OK;
}
nsresult
HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
{
NS_PRECONDITION(nsnull != mHead, "bad parser: meta before head");
nsresult rv = NS_OK;
if (nsnull != mHead) {
nsAutoString tmp(aNode.GetText());
tmp.ToUpperCase();
nsIAtom* atom = NS_NewAtom(tmp);
nsIHTMLContent* it = nsnull;
rv = NS_NewHTMLMeta(&it, atom) ;
if (NS_OK == rv) {
rv = AddAttributes(aNode, it);
mHead->AppendChild(it, PR_FALSE);
}
NS_RELEASE(atom);
}
return rv;
}
nsresult HTMLContentSink::ProcessBRTag(nsIHTMLContent** aInstancePtrResult,
const nsIParserNode& aNode)
{

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

@ -17,6 +17,6 @@
DEPTH=..\..
DIRS = base document forms style table tests
DIRS = base content document forms style table tests
include <$(DEPTH)\layout\config\rules.mak>

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

@ -47,6 +47,7 @@ LINCS= \
LLIBS= \
$(DIST)\lib\raptorhtmlbase_s.lib \
$(DIST)\lib\nglcsslay_s.lib \
$(DIST)\lib\nglhtmlcon_s.lib \
$(DIST)\lib\raptorhtmlstyle_s.lib \
$(DIST)\lib\raptorlayout_s.lib \
$(DIST)\lib\raptorgfx.lib \