mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-24 05:44:10 +00:00
Removed css/layout directory
This commit is contained in:
parent
b2f664e496
commit
8f2807a027
@ -154,7 +154,7 @@ CPP_OBJS= \
|
||||
|
||||
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\js \
|
||||
-I$(PUBLIC)\dom -I$(PUBLIC)\netlib \
|
||||
-I..\..\style\src -I..\..\..\css\layout\src \
|
||||
-I..\..\style\src \
|
||||
-I..\..\..\base\src -I..\..\base\src
|
||||
|
||||
LCFLAGS = \
|
||||
|
@ -53,8 +53,8 @@
|
||||
#include "nsString.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsDOMEventsIIDs.h"
|
||||
#include "nsCSSBlockFrame.h"
|
||||
#include "nsCSSInlineFrame.h"
|
||||
#include "nsBlockFrame.h"
|
||||
#include "nsInlineFrame.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
@ -1884,11 +1884,11 @@ nsGenericHTMLElement::CreateFrame(nsIPresContext* aPresContext,
|
||||
switch (styleDisplay->mDisplay) {
|
||||
case NS_STYLE_DISPLAY_BLOCK:
|
||||
case NS_STYLE_DISPLAY_LIST_ITEM:
|
||||
rv = NS_NewCSSBlockFrame(&frame, mContent, aParentFrame);
|
||||
rv = NS_NewBlockFrame(&frame, mContent, aParentFrame);
|
||||
break;
|
||||
|
||||
case NS_STYLE_DISPLAY_INLINE:
|
||||
rv = NS_NewCSSInlineFrame(&frame, mContent, aParentFrame);
|
||||
rv = NS_NewInlineFrame(&frame, mContent, aParentFrame);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1089,14 +1089,14 @@ NS_IMETHODIMP HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
|
||||
switch (styleDisplay->mDisplay) {
|
||||
case NS_STYLE_DISPLAY_BLOCK:
|
||||
case NS_STYLE_DISPLAY_LIST_ITEM:
|
||||
rv = NS_NewCSSBlockFrame(&frame, aContent, aParentFrame);
|
||||
rv = NS_NewBlockFrame(&frame, aContent, aParentFrame);
|
||||
|
||||
// Process the child content
|
||||
ProcessChildren(aPresContext, frame, aContent, childList);
|
||||
break;
|
||||
|
||||
case NS_STYLE_DISPLAY_INLINE:
|
||||
rv = NS_NewCSSInlineFrame(&frame, aContent, aParentFrame);
|
||||
rv = NS_NewInlineFrame(&frame, aContent, aParentFrame);
|
||||
|
||||
// Process the child content
|
||||
ProcessChildren(aPresContext, frame, aContent, childList);
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
DEPTH = ..
|
||||
|
||||
DIRS = base css html events build
|
||||
DIRS = base html events build
|
||||
|
||||
include $(DEPTH)/config/config.mk
|
||||
|
||||
|
@ -43,11 +43,10 @@ EXTRA_DSO_LDOPTS = \
|
||||
$(LD_ALL) \
|
||||
$(DIST)/lib/libraptorhtmldoc_s.a \
|
||||
$(DIST)/lib/libnglhtmlcon_s.a \
|
||||
$(DIST)/lib/libraptorhtmldoc_s.a \
|
||||
$(DIST)/lib/libraptorhtmldoc_s.a \
|
||||
$(DIST)/lib/libraptorhtmlforms_s.a \
|
||||
$(DIST)/lib/libraptorhtmltable_s.a \
|
||||
$(DIST)/lib/libraptorhtmlbase_s.a \
|
||||
$(DIST)/lib/libnglcsslay_s.a \
|
||||
$(DIST)/lib/libraptorhtmlstyle_s.a \
|
||||
$(DIST)/lib/libraptorlayout_s.a \
|
||||
$(DIST)/lib/libraptorevents_s.a \
|
||||
|
@ -36,7 +36,6 @@ MISCDEP = \
|
||||
$(DIST)\lib\raptorlayout_s.lib \
|
||||
$(DIST)\lib\raptorhtmlbase_s.lib \
|
||||
$(DIST)\lib\nglhtmlcon_s.lib \
|
||||
$(DIST)\lib\nglcsslay_s.lib \
|
||||
$(DIST)\lib\raptorhtmldoc_s.lib \
|
||||
$(DIST)\lib\raptorhtmlforms_s.lib \
|
||||
$(DIST)\lib\raptorhtmlstyle_s.lib \
|
||||
@ -63,7 +62,6 @@ LLIBS= \
|
||||
$(DIST)\lib\raptorlayout_s.lib \
|
||||
$(DIST)\lib\raptorhtmlbase_s.lib \
|
||||
$(DIST)\lib\nglhtmlcon_s.lib \
|
||||
$(DIST)\lib\nglcsslay_s.lib \
|
||||
$(DIST)\lib\raptorhtmldoc_s.lib \
|
||||
$(DIST)\lib\raptorhtmlforms_s.lib \
|
||||
$(DIST)\lib\raptorhtmlstyle_s.lib \
|
||||
|
@ -1,24 +0,0 @@
|
||||
#!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 = layout
|
||||
|
||||
include $(DEPTH)/config/config.mk
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
@ -1,24 +0,0 @@
|
||||
#!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 = public src
|
||||
|
||||
include $(DEPTH)/config/config.mk
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
@ -1,22 +0,0 @@
|
||||
#!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=public src
|
||||
|
||||
include <$(DEPTH)\layout\config\rules.mak>
|
@ -1,46 +0,0 @@
|
||||
#!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 = nglcsslay_s
|
||||
|
||||
# Note the sophisticated alphabetical ordering :-|
|
||||
CPPSRCS = \
|
||||
nsCSSBlockFrame.cpp \
|
||||
nsCSSContainerFrame.cpp \
|
||||
nsCSSInlineFrame.cpp \
|
||||
nsCSSInlineLayout.cpp \
|
||||
nsCSSLineLayout.cpp \
|
||||
$(NULL)
|
||||
|
||||
MODULE = raptor
|
||||
|
||||
REQUIRES = xpcom raptor dom netlib
|
||||
|
||||
include $(DEPTH)/config/config.mk
|
||||
|
||||
LCFLAGS += -D_IMPL_NS_HTML
|
||||
|
||||
INCLUDES += -I../../../html/style/src -I../../../html/base/src \
|
||||
-I../../../base/src
|
||||
|
||||
MKSHLIB :=
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
|
||||
install::
|
@ -1,233 +0,0 @@
|
||||
todo for AOL August 1st deadline:
|
||||
---------------------------------
|
||||
|
||||
o bug17-3.html: when dealing with incremental frame-appended reflow we
|
||||
need to know how the last clean line was ended (e.g. break, clear=all, etc.)
|
||||
otherwise we won't adjust the y coordinate properly. We can save the
|
||||
break status into the line or adjust the line height and make it tall.
|
||||
|
||||
o entities in attributes (e.g. alt text at disney.com)
|
||||
|
||||
o tuning ideas:
|
||||
o DidReflow N^2 [current disabled because of nested view x,y problem]
|
||||
o FindTextRuns N^2
|
||||
o LineData allocations/frees
|
||||
|
||||
o click on gif, jpg, txt
|
||||
|
||||
o http://www.aol.com/netfind
|
||||
o fix the size of the iframe
|
||||
o look into the parsing bug's
|
||||
|
||||
o http://www.magicbit.com/links/travel.htm; why is the SMART-NET image
|
||||
at the bottom instead of at the baseline?
|
||||
|
||||
o http://www.altavista.com looks wrong. why?
|
||||
why does it go into an infinite loop during a -f run?
|
||||
|
||||
o bug2.html
|
||||
|
||||
o UMR bug because of painting during reflow
|
||||
|
||||
|
||||
o fast scroll to #ref for a link targeted at the same document as is
|
||||
currently showing
|
||||
|
||||
o force-refresh needs to get the nsIScrollableView and update that view,
|
||||
not the root view
|
||||
|
||||
o f:/html/bug8.html (descent bug in vertically align children)
|
||||
|
||||
o Viewer:
|
||||
o make the print-preview menu item work
|
||||
o select-all and copy menu items
|
||||
o fix link-over status
|
||||
|
||||
o fix floating tables
|
||||
x current-line floaters need to go in previous line's bcl list; if first line
|
||||
then they go in the block-frame's pending floater list
|
||||
x <block><floater>... we need a place to hang current-line floaters!!!
|
||||
x http://www.news.com
|
||||
x http://www.usatoday.com/
|
||||
o http://www.mrshowbiz.com/
|
||||
x file:/f:/html/floating-images.html
|
||||
"tucked between the woofers" isn't
|
||||
o file:/f:/html/floating-tables-inline.html
|
||||
overwrite errors
|
||||
o file:/f:/html/br-clear.html
|
||||
3rd test case is not compatible with navigator; I think navigator
|
||||
has a bug IMHO.
|
||||
|
||||
o block-frame: DidReflow and content-appended can be smarter; right now
|
||||
we did-reflow the whole caboodle whereas we could keep a bit in the
|
||||
line that indicates where the dirty lines were so that when the
|
||||
block's parent comes along and does a did-reflow it can propogate it
|
||||
down to only the affected lines.
|
||||
|
||||
o fix blocks inside of inlines; need to find the block's inline-layout
|
||||
state and see where the block child is with respect to the left edge
|
||||
of the line.
|
||||
|
||||
o mark/insert-at-mark for parser???
|
||||
|
||||
o www.cnn.com: crash
|
||||
|
||||
o performance:
|
||||
o people.netscape.com
|
||||
|
||||
o slide show resize bug
|
||||
|
||||
o fix assertion on LCIC in nscssblockframe::content-inserted when
|
||||
running rotate.html/js test
|
||||
|
||||
o docloader needs to disconnect itself as an observer when it's done
|
||||
|
||||
----------------------------------------------------------------------
|
||||
After august 10th
|
||||
----------------------------------------------------------------------
|
||||
|
||||
o why is nsInlineLayout different from nsInlineReflowState (mott@nc.com)
|
||||
|
||||
BASE TAG SUPPORT:
|
||||
o revise the way that base tags work (somehow); either make the
|
||||
content sink aware of all tags that can have url's in them, or better
|
||||
yet, add in base tag api's to the nsHTMLDocument and make the content
|
||||
set-attribute methods deal with it; or add in a method to
|
||||
nsIHTMLContent called SetBaseURL and SetTarget (which is defined to be
|
||||
ignored except for those tags that care)
|
||||
|
||||
o implement base tag support:
|
||||
o frame, iframe, frameset
|
||||
o layer
|
||||
o Body (background), TABLE, TR, TD (background), etc.
|
||||
o Image, Anchor; look at html4.0 spec for attributes that are URI's
|
||||
|
||||
o TEST base tag support:
|
||||
o script src=
|
||||
o style src=
|
||||
|
||||
o NS_FRAME_FIRST_REFLOW needs to go; block code is the only consumer
|
||||
instead keep a list of new frames and when we hit one, trigger the
|
||||
initial reflow
|
||||
|
||||
o Query-Interface day: go through and change all the QueryInterface
|
||||
implementations to put the cast into a temp variable and then cast the
|
||||
temp variable to void*
|
||||
|
||||
o crash in: http://www-dsed.llnl.gov/documents/a_document.html
|
||||
the problem stems from a OL marked display:inline that contains LI's;
|
||||
the LI's aren't doing the right thing to find the container that
|
||||
has next ordinal number (which in this case is none!)
|
||||
|
||||
o implement hspace, vspace; test for navigator compatability
|
||||
check for all other unimplemented tag attributes
|
||||
verify that DumpContent works; write a oneof.html test that has every
|
||||
tag with every attribute in every combination in it.
|
||||
|
||||
o max-element-size and floaters:
|
||||
the correct value is dependent on which table pass we are in;
|
||||
for pass1 we really only need the max(floaters, child-max-element-size)
|
||||
for pass2 we need a per-line max-element-size and then we need to
|
||||
compute the sum(floaters, line-max-element-size); this is still not
|
||||
quite right; the sum should be the sum of the floaters and the line's
|
||||
first-element-size.
|
||||
|
||||
o ebina margin bugs:
|
||||
BR tags
|
||||
line-height adjustment (sometimes; see test0.html and the large font)
|
||||
P's in LI's
|
||||
f:/html/bug3.html (yikes!)
|
||||
f:/html/bug6.html
|
||||
www.infoseek.com; see steve's mail (date july 21st)
|
||||
www.w3.org
|
||||
f:/html/image-hspace.html
|
||||
|
||||
o rework how BR's work:
|
||||
f:/html/image-vspace.html; notice the top two lines stuck together in nav
|
||||
make clear-line a real style-const property and use it to mean "give me
|
||||
a fresh line". Then make br's zero height. Have the block code handle the
|
||||
fresh line concept directly...work this in with keeping track of pending
|
||||
vertical whitespace for table shrink wrapping.
|
||||
|
||||
o ebina's engine provides automatic margins around floating images that
|
||||
are PROPORTIONAL to the size of the image's border (find the code
|
||||
luke)
|
||||
|
||||
o tinderbox: add selftest to our makefile so that it will run whatever
|
||||
we want and verify the results of a build
|
||||
|
||||
o XXX code in block frame code
|
||||
|
||||
o rethink list-item handling again
|
||||
o f:/html/list-padding.html: bullet turns into a box
|
||||
o f:/html/list-style-image.html: bullets don't trigger a reflow properly
|
||||
when the image size finally arrives
|
||||
|
||||
o have michael fix up the scrolling-view code so that if a document is
|
||||
scrolled and grown the relative scroll position is maintained so that
|
||||
the view doesn't jump around. Then re-enable the html content sink
|
||||
scroll-to-ref code in the incremental reflow cases.
|
||||
o scroll to #ref needs to be able to update the scrollbars when it
|
||||
finds the target frame has been reflowed.
|
||||
|
||||
pseudo-frame whackage
|
||||
|
||||
factories for html etc. so that viewer no longer links against the dll
|
||||
|
||||
async style sheet loading
|
||||
async script src= loading
|
||||
need blocking model in content sink and parser
|
||||
|
||||
o Get rid of XXX::NewFrame methods
|
||||
o ListTag(nsString& aResult) instead of FILE*
|
||||
o style attributes of BODY tag
|
||||
o style attributes of HTML tag
|
||||
o turn noisy code in nsContainerFrame into NS_FRAME_TRACE calls
|
||||
|
||||
o implement the LINK tag including base attributes for style sheets
|
||||
and other linked objects
|
||||
|
||||
o LINK rel=stylesheet href=... type=text/css
|
||||
|
||||
Underlines across font/style changes look like cr*p. We should draw a
|
||||
single underline that's the same size.
|
||||
|
||||
www.excite.com; crash
|
||||
|
||||
people.netscape.com/paquin/temple.html; crash
|
||||
|
||||
people.netscape.com/kipp - Hickman breaking bug
|
||||
|
||||
block-margins.html: margin after block & before text is lost
|
||||
|
||||
Content objects for: FORM, /FORM, MAP, AREA, SCRIPT, STYLE
|
||||
|
||||
width/height sizing stuff into body/block/inline code
|
||||
|
||||
image-map.html: top border is black; why?
|
||||
|
||||
css2 cursors into raptor
|
||||
|
||||
1 pass build on windows
|
||||
|
||||
o write a combinatoric test case of the all the different variations on
|
||||
url parsing and compare with navigator; get nsURL.cpp to agree with it.
|
||||
|
||||
security dialog support code using raptor
|
||||
|
||||
nspr log module list online
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Would be nice someday
|
||||
----------------------------------------------------------------------
|
||||
|
||||
async dns slow mode
|
||||
|
||||
css parser keeping comments
|
||||
|
||||
----------------------------------------------------------------------
|
||||
DONE
|
||||
----------------------------------------------------------------------
|
||||
|
||||
x fix limited stack depth in content sink
|
||||
x missing space after ampersand on http://home.netscape.com
|
@ -1,57 +0,0 @@
|
||||
#!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=nglcsslay_s
|
||||
MODULE=raptor
|
||||
REQUIRES=xpcom raptor
|
||||
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
|
||||
|
||||
CPPSRCS= \
|
||||
nsCSSBlockFrame.cpp \
|
||||
nsCSSContainerFrame.cpp \
|
||||
nsCSSInlineFrame.cpp \
|
||||
nsCSSInlineLayout.cpp \
|
||||
nsCSSLineLayout.cpp \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsCSSBlockFrame.obj \
|
||||
.\$(OBJDIR)\nsCSSContainerFrame.obj \
|
||||
.\$(OBJDIR)\nsCSSInlineFrame.obj \
|
||||
.\$(OBJDIR)\nsCSSInlineLayout.obj \
|
||||
.\$(OBJDIR)\nsCSSLineLayout.obj \
|
||||
$(NULL)
|
||||
|
||||
LINCS = \
|
||||
-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\dom -I$(PUBLIC)\netlib \
|
||||
-I..\..\..\base\src \
|
||||
-I..\..\..\html\style\src -I..\..\..\html\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
|
@ -1,51 +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.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
#include "nsCSSContainerFrame.h"
|
||||
#include "nsPlaceholderFrame.h"
|
||||
#include "nsIStyleContext.h"
|
||||
|
||||
nsCSSContainerFrame::nsCSSContainerFrame(nsIContent* aContent,
|
||||
nsIFrame* aParent)
|
||||
: nsHTMLContainerFrame(aContent, aParent)
|
||||
{
|
||||
}
|
||||
|
||||
nsCSSContainerFrame::~nsCSSContainerFrame()
|
||||
{
|
||||
}
|
||||
|
||||
nsPlaceholderFrame*
|
||||
nsCSSContainerFrame::CreatePlaceholderFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFloatedFrame)
|
||||
{
|
||||
nsIContent* content;
|
||||
aFloatedFrame->GetContent(content);
|
||||
|
||||
nsPlaceholderFrame* placeholder;
|
||||
nsPlaceholderFrame::NewFrame((nsIFrame**)&placeholder, content, this, aFloatedFrame);
|
||||
NS_IF_RELEASE(content);
|
||||
|
||||
// Let the placeholder share the same style context as the floated element
|
||||
nsIStyleContext* kidSC;
|
||||
aFloatedFrame->GetStyleContext(aPresContext, kidSC);
|
||||
placeholder->SetStyleContext(aPresContext, kidSC);
|
||||
NS_RELEASE(kidSC);
|
||||
|
||||
return placeholder;
|
||||
}
|
@ -1,40 +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.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef nsCSSContainerFrame_h___
|
||||
#define nsCSSContainerFrame_h___
|
||||
|
||||
#include "nsHTMLContainerFrame.h"
|
||||
|
||||
class nsPlaceholderFrame;
|
||||
|
||||
class nsCSSContainerFrame : public nsHTMLContainerFrame {
|
||||
public:
|
||||
|
||||
virtual PRBool DeleteNextInFlowsFor(nsIPresContext& aPresContext, nsIFrame* aChild) = 0;
|
||||
|
||||
protected:
|
||||
nsCSSContainerFrame(nsIContent* aContent, nsIFrame* aParent);
|
||||
~nsCSSContainerFrame();
|
||||
|
||||
nsPlaceholderFrame* CreatePlaceholderFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFloatedFrame);
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsCSSContainerFrame_h___ */
|
@ -1,22 +0,0 @@
|
||||
#!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 = layout
|
||||
|
||||
include <$(DEPTH)\layout\config\rules.mak>
|
@ -20,7 +20,7 @@
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIInlineReflow.h"
|
||||
#include "nsCSSLineLayout.h"
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIStyleContext.h"
|
||||
@ -40,9 +40,9 @@ public:
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
// nsIInlineReflow
|
||||
NS_IMETHOD FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aDesiredSize,
|
||||
const nsReflowState& aReflowState);
|
||||
|
||||
@ -100,7 +100,7 @@ BRFrame::Paint(nsIPresContext& aPresContext,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BRFrame::FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
BRFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
{
|
||||
aLineLayout.EndTextRun();
|
||||
@ -108,7 +108,7 @@ BRFrame::FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BRFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
BRFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
const nsReflowState& aReflowState)
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,17 +16,17 @@
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
#ifndef nsCSSBlockFrame_h___
|
||||
#define nsCSSBlockFrame_h___
|
||||
#ifndef nsBlockFrame_h___
|
||||
#define nsBlockFrame_h___
|
||||
|
||||
#include "nsCSSContainerFrame.h"
|
||||
#include "nsCSSLineLayout.h"
|
||||
#include "nsCSSInlineLayout.h"
|
||||
#include "nsHTMLContainerFrame.h"
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsInlineLayout.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsISpaceManager.h"
|
||||
|
||||
class nsCSSBlockFrame;
|
||||
struct nsCSSInlineLayout;
|
||||
class nsBlockFrame;
|
||||
struct nsInlineLayout;
|
||||
class nsPlaceholderFrame;
|
||||
struct LineData;
|
||||
|
||||
@ -36,16 +36,16 @@ struct LineData;
|
||||
|
||||
// XXX hide this as soon as list bullet code is cleaned up
|
||||
|
||||
struct nsCSSBlockReflowState : public nsReflowState {
|
||||
nsCSSBlockReflowState(nsIPresContext* aPresContext,
|
||||
nsISpaceManager* aSpaceManager,
|
||||
nsCSSBlockFrame* aBlock,
|
||||
nsIStyleContext* aBlockSC,
|
||||
const nsReflowState& aReflowState,
|
||||
nsReflowMetrics& aMetrics,
|
||||
PRBool aComputeMaxElementSize);
|
||||
struct nsBlockReflowState : public nsReflowState {
|
||||
nsBlockReflowState(nsIPresContext* aPresContext,
|
||||
nsISpaceManager* aSpaceManager,
|
||||
nsBlockFrame* aBlock,
|
||||
nsIStyleContext* aBlockSC,
|
||||
const nsReflowState& aReflowState,
|
||||
nsReflowMetrics& aMetrics,
|
||||
PRBool aComputeMaxElementSize);
|
||||
|
||||
~nsCSSBlockReflowState();
|
||||
~nsBlockReflowState();
|
||||
|
||||
/**
|
||||
* Update the mCurrentBand data based on the current mY position.
|
||||
@ -64,9 +64,9 @@ struct nsCSSBlockReflowState : public nsReflowState {
|
||||
|
||||
nsIPresContext* mPresContext;
|
||||
nsISpaceManager* mSpaceManager;
|
||||
nsCSSBlockFrame* mBlock;
|
||||
nsBlockFrame* mBlock;
|
||||
PRBool mBlockIsPseudo;
|
||||
nsCSSBlockFrame* mNextInFlow;
|
||||
nsBlockFrame* mNextInFlow;
|
||||
PRUint8 mTextAlign;
|
||||
PRUint8 mDirection;
|
||||
|
||||
@ -96,9 +96,9 @@ struct nsCSSBlockReflowState : public nsReflowState {
|
||||
|
||||
nsSize mMaxElementSize;
|
||||
|
||||
nsCSSLineLayout mLineLayout;
|
||||
nsLineLayout mLineLayout;
|
||||
|
||||
nsCSSInlineLayout mInlineLayout;
|
||||
nsInlineLayout mInlineLayout;
|
||||
PRBool mInlineLayoutPrepared;
|
||||
|
||||
nsIFrame* mPrevChild;
|
||||
@ -140,13 +140,13 @@ struct nsCSSBlockReflowState : public nsReflowState {
|
||||
};
|
||||
|
||||
inline void
|
||||
nsCSSLineLayout::AddFloater(nsPlaceholderFrame* aFrame)
|
||||
nsLineLayout::AddFloater(nsPlaceholderFrame* aFrame)
|
||||
{
|
||||
mBlockReflowState->AddFloater(aFrame);
|
||||
}
|
||||
|
||||
extern nsresult NS_NewCSSBlockFrame(nsIFrame** aInstancePtrResult,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent);
|
||||
extern nsresult NS_NewBlockFrame(nsIFrame** aInstancePtrResult,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent);
|
||||
|
||||
#endif /* nsCSSBlockFrame_h___ */
|
4735
layout/generic/nsBlockReflowState.cpp
Normal file
4735
layout/generic/nsBlockReflowState.cpp
Normal file
File diff suppressed because it is too large
Load Diff
4735
layout/generic/nsBlockReflowState.h
Normal file
4735
layout/generic/nsBlockReflowState.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -389,3 +389,32 @@ nsHTMLContainerFrame::ProcessInitialReflow(nsIPresContext* aPresContext)
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLContainerFrame::DeleteNextInFlowsFor(nsIPresContext& aPresContext,
|
||||
nsIFrame* aChild)
|
||||
{
|
||||
// XXX get rid of this sillyness
|
||||
NS_NOTREACHED("subclass should've overriden this!");
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsPlaceholderFrame*
|
||||
nsHTMLContainerFrame::CreatePlaceholderFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFloatedFrame)
|
||||
{
|
||||
nsIContent* content;
|
||||
aFloatedFrame->GetContent(content);
|
||||
|
||||
nsPlaceholderFrame* placeholder;
|
||||
nsPlaceholderFrame::NewFrame((nsIFrame**)&placeholder, content, this, aFloatedFrame);
|
||||
NS_IF_RELEASE(content);
|
||||
|
||||
// Let the placeholder share the same style context as the floated element
|
||||
nsIStyleContext* kidSC;
|
||||
aFloatedFrame->GetStyleContext(aPresContext, kidSC);
|
||||
placeholder->SetStyleContext(aPresContext, kidSC);
|
||||
NS_RELEASE(kidSC);
|
||||
|
||||
return placeholder;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "nsContainerFrame.h"
|
||||
class nsString;
|
||||
class nsPlaceholderFrame;
|
||||
|
||||
// Base class for html container frames that provides common
|
||||
// functionality.
|
||||
@ -53,6 +54,12 @@ public:
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent);
|
||||
|
||||
virtual PRBool DeleteNextInFlowsFor(nsIPresContext& aPresContext,
|
||||
nsIFrame* aChild);
|
||||
|
||||
nsPlaceholderFrame* CreatePlaceholderFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFloatedFrame);
|
||||
|
||||
protected:
|
||||
virtual ~nsHTMLContainerFrame();
|
||||
|
||||
|
@ -235,13 +235,18 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult,
|
||||
|
||||
// Factory methods for creating html layout objects
|
||||
|
||||
extern nsresult
|
||||
NS_NewBRFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame);
|
||||
|
||||
extern nsresult
|
||||
NS_NewBodyFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame);
|
||||
|
||||
extern nsresult
|
||||
NS_NewBRFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame);
|
||||
NS_NewBlockFrame(nsIFrame** aInstancePtrResult,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent);
|
||||
|
||||
extern nsresult
|
||||
NS_NewCommentFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
@ -252,11 +257,13 @@ NS_NewHRFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame);
|
||||
|
||||
// <frame> and <iframe>
|
||||
extern nsresult NS_NewHTMLFrameOuterFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame);
|
||||
extern nsresult
|
||||
NS_NewHTMLFrameOuterFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame);
|
||||
// <frameset>
|
||||
extern nsresult NS_NewHTMLFramesetFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame);
|
||||
extern nsresult
|
||||
NS_NewHTMLFramesetFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame);
|
||||
|
||||
extern nsresult
|
||||
NS_NewHTMLFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
@ -266,6 +273,11 @@ extern nsresult
|
||||
NS_NewImageFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aFrameResult);
|
||||
|
||||
extern nsresult
|
||||
NS_NewInlineFrame(nsIFrame** aInstancePtrResult,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent);
|
||||
|
||||
extern nsresult
|
||||
NS_NewObjectFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aFrameResult);
|
||||
@ -282,16 +294,6 @@ nsresult
|
||||
NS_NewWBRFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aResult);
|
||||
|
||||
extern nsresult
|
||||
NS_NewCSSInlineFrame(nsIFrame** aInstancePtrResult,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent);
|
||||
|
||||
extern nsresult
|
||||
NS_NewCSSBlockFrame(nsIFrame** aInstancePtrResult,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent);
|
||||
|
||||
extern nsresult
|
||||
NS_NewInputButtonFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aResult);
|
||||
|
@ -15,7 +15,7 @@
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#include "nsCSSInlineFrame.h"
|
||||
#include "nsInlineFrame.h"
|
||||
#include "nsCSSLayout.h"
|
||||
|
||||
#include "nsIReflowCommand.h"
|
||||
@ -23,7 +23,7 @@
|
||||
#include "nsPlaceholderFrame.h"
|
||||
|
||||
#include "nsHTMLIIDs.h"// XXX
|
||||
#include "nsHTMLBase.h"// XXX rename to nsCSSBase?
|
||||
#include "nsHTMLBase.h"// XXX rename to nsBase?
|
||||
|
||||
// XXX TODO:
|
||||
|
||||
@ -34,8 +34,8 @@
|
||||
// content inserted INCREMENTAL reflow
|
||||
// content deleted INCREMENTAL reflow
|
||||
|
||||
nsCSSInlineReflowState::nsCSSInlineReflowState(nsCSSLineLayout& aLineLayout,
|
||||
nsCSSInlineFrame* aInlineFrame,
|
||||
nsInlineReflowState::nsInlineReflowState(nsLineLayout& aLineLayout,
|
||||
nsInlineFrame* aInlineFrame,
|
||||
nsIStyleContext* aInlineSC,
|
||||
const nsReflowState& aRS,
|
||||
PRBool aComputeMaxElementSize)
|
||||
@ -85,21 +85,21 @@ nsCSSInlineReflowState::nsCSSInlineReflowState(nsCSSLineLayout& aLineLayout,
|
||||
width, height/* XXX height??? */);
|
||||
}
|
||||
|
||||
nsCSSInlineReflowState::~nsCSSInlineReflowState()
|
||||
nsInlineReflowState::~nsInlineReflowState()
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsresult NS_NewCSSInlineFrame(nsIFrame** aInstancePtrResult,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent)
|
||||
nsresult NS_NewInlineFrame(nsIFrame** aInstancePtrResult,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIFrame* it = new nsCSSInlineFrame(aContent, aParent);
|
||||
nsIFrame* it = new nsInlineFrame(aContent, aParent);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -107,17 +107,17 @@ nsresult NS_NewCSSInlineFrame(nsIFrame** aInstancePtrResult,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCSSInlineFrame::nsCSSInlineFrame(nsIContent* aContent, nsIFrame* aParent)
|
||||
: nsCSSContainerFrame(aContent, aParent)
|
||||
nsInlineFrame::nsInlineFrame(nsIContent* aContent, nsIFrame* aParent)
|
||||
: nsHTMLContainerFrame(aContent, aParent)
|
||||
{
|
||||
}
|
||||
|
||||
nsCSSInlineFrame::~nsCSSInlineFrame()
|
||||
nsInlineFrame::~nsInlineFrame()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSInlineFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
nsInlineFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
@ -131,7 +131,7 @@ nsCSSInlineFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
}
|
||||
|
||||
PRIntn
|
||||
nsCSSInlineFrame::GetSkipSides() const
|
||||
nsInlineFrame::GetSkipSides() const
|
||||
{
|
||||
PRIntn skip = 0;
|
||||
if (nsnull != mPrevInFlow) {
|
||||
@ -144,7 +144,7 @@ nsCSSInlineFrame::GetSkipSides() const
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsCSSInlineFrame::AppendNewFrames(nsIPresContext* aPresContext,
|
||||
nsInlineFrame::AppendNewFrames(nsIPresContext* aPresContext,
|
||||
nsIFrame* aNewFrame)
|
||||
{
|
||||
nsIFrame* lastFrame;
|
||||
@ -167,7 +167,8 @@ nsCSSInlineFrame::AppendNewFrames(nsIPresContext* aPresContext,
|
||||
// See if the element wants to be floated
|
||||
if (NS_STYLE_FLOAT_NONE != display->mFloats) {
|
||||
// Create a placeholder frame that will serve as the anchor point.
|
||||
nsPlaceholderFrame* placeholder = CreatePlaceholderFrame(aPresContext, frame);
|
||||
nsPlaceholderFrame* placeholder =
|
||||
CreatePlaceholderFrame(aPresContext, frame);
|
||||
|
||||
// Remove the floated element from the flow, and replace it with the
|
||||
// placeholder frame
|
||||
@ -192,41 +193,41 @@ nsCSSInlineFrame::AppendNewFrames(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSInlineFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
|
||||
nsInlineFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
|
||||
{
|
||||
NS_PRECONDITION(nsnull == mFirstChild, "already initialized");
|
||||
return AppendNewFrames(&aPresContext, aChildList);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSInlineFrame::CreateContinuingFrame(nsIPresContext& aCX,
|
||||
nsInlineFrame::CreateContinuingFrame(nsIPresContext& aCX,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIFrame*& aContinuingFrame)
|
||||
{
|
||||
nsCSSInlineFrame* cf = new nsCSSInlineFrame(mContent, aParent);
|
||||
nsInlineFrame* cf = new nsInlineFrame(mContent, aParent);
|
||||
if (nsnull == cf) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
PrepareContinuingFrame(aCX, aParent, aStyleContext, cf);
|
||||
aContinuingFrame = cf;
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("nsCSSInlineFrame::CreateContinuingFrame: newFrame=%p", cf));
|
||||
("nsInlineFrame::CreateContinuingFrame: newFrame=%p", cf));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsCSSInlineFrame::DeleteNextInFlowsFor(nsIPresContext& aPresContext, nsIFrame* aChild)
|
||||
nsInlineFrame::DeleteNextInFlowsFor(nsIPresContext& aPresContext, nsIFrame* aChild)
|
||||
{
|
||||
return DeleteChildsNextInFlow(aPresContext, aChild);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSInlineFrame::FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
{
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("enter nsCSSInlineFrame::FindTextRuns [%d,%d,%c]",
|
||||
("enter nsInlineFrame::FindTextRuns [%d,%d,%c]",
|
||||
mFirstContentOffset, mLastContentOffset, mLastContentIsComplete?'T':'F'));
|
||||
|
||||
nsIFrame* frame;
|
||||
@ -284,19 +285,19 @@ nsCSSInlineFrame::FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
|
||||
done:;
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("exit nsCSSInlineFrame::FindTextRuns rv=%x [%d,%d,%c]",
|
||||
("exit nsInlineFrame::FindTextRuns rv=%x [%d,%d,%c]",
|
||||
rv, mFirstContentOffset, mLastContentOffset,
|
||||
mLastContentIsComplete?'T':'F'));
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSInlineFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
const nsReflowState& aReflowState)
|
||||
{
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("enter nsCSSInlineFrame::InlineReflow maxSize=%d,%d reason=%d kids=%d nif=%p [%d,%d,%c]",
|
||||
("enter nsInlineFrame::InlineReflow maxSize=%d,%d reason=%d kids=%d nif=%p [%d,%d,%c]",
|
||||
aReflowState.maxSize.width, aReflowState.maxSize.height,
|
||||
aReflowState.reason, mChildCount, mNextInFlow,
|
||||
mFirstContentOffset, mLastContentOffset, mLastContentIsComplete?'T':'F'));
|
||||
@ -310,7 +311,7 @@ nsCSSInlineFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
NS_ASSERTION(0 == (NS_FRAME_FIRST_REFLOW & mState), "bad mState");
|
||||
}
|
||||
|
||||
nsCSSInlineReflowState state(aLineLayout, this, mStyleContext,
|
||||
nsInlineReflowState state(aLineLayout, this, mStyleContext,
|
||||
aReflowState,
|
||||
PRBool(nsnull != aMetrics.maxElementSize));
|
||||
nsresult rv = NS_OK;
|
||||
@ -358,7 +359,7 @@ nsCSSInlineFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
ComputeFinalSize(state, aMetrics);
|
||||
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("exit nsCSSInlineFrame::InlineReflow size=%d,%d rv=%x kids=%d nif=%p [%d,%d,%c]",
|
||||
("exit nsInlineFrame::InlineReflow size=%d,%d rv=%x kids=%d nif=%p [%d,%d,%c]",
|
||||
aMetrics.width, aMetrics.height, rv, mChildCount, mNextInFlow,
|
||||
mFirstContentOffset, mLastContentOffset,
|
||||
mLastContentIsComplete?'T':'F'));
|
||||
@ -366,12 +367,12 @@ nsCSSInlineFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSInlineFrame::ComputeFinalSize(nsCSSInlineReflowState& aState,
|
||||
nsInlineFrame::ComputeFinalSize(nsInlineReflowState& aState,
|
||||
nsReflowMetrics& aMetrics)
|
||||
{
|
||||
// Align our child frames. Note that inline frames "shrink wrap"
|
||||
// around their contents therefore we need to fixup the available
|
||||
// width in nsCSSInlineLayout so that it doesn't do any horizontal
|
||||
// width in nsInlineLayout so that it doesn't do any horizontal
|
||||
// alignment.
|
||||
nsRect bounds;
|
||||
aState.mInlineLayout.mAvailWidth =
|
||||
@ -449,7 +450,7 @@ nsCSSInlineFrame::ComputeFinalSize(nsCSSInlineReflowState& aState,
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsCSSInlineFrame::InitialReflow(nsCSSInlineReflowState& aState)
|
||||
nsInlineFrame::InitialReflow(nsInlineReflowState& aState)
|
||||
{
|
||||
NS_PRECONDITION(nsnull == mNextInFlow, "bad frame-appended-reflow");
|
||||
NS_PRECONDITION(mLastContentIsComplete == PR_TRUE, "bad state");
|
||||
@ -469,7 +470,7 @@ nsCSSInlineFrame::InitialReflow(nsCSSInlineReflowState& aState)
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsCSSInlineFrame::FrameAppendedReflow(nsCSSInlineReflowState& aState)
|
||||
nsInlineFrame::FrameAppendedReflow(nsInlineReflowState& aState)
|
||||
{
|
||||
NS_PRECONDITION(nsnull == mNextInFlow, "bad frame-appended-reflow");
|
||||
NS_PRECONDITION(mLastContentIsComplete == PR_TRUE, "bad state");
|
||||
@ -492,7 +493,7 @@ nsCSSInlineFrame::FrameAppendedReflow(nsCSSInlineReflowState& aState)
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
nsresult
|
||||
nsCSSInlineFrame::CreateNewFrames(nsIPresContext* aPresContext)
|
||||
nsInlineFrame::CreateNewFrames(nsIPresContext* aPresContext)
|
||||
{
|
||||
// reason: initial: (a) null nif, pif: create frames
|
||||
// (b) pullup: don't create frames
|
||||
@ -506,7 +507,7 @@ nsCSSInlineFrame::CreateNewFrames(nsIPresContext* aPresContext)
|
||||
nsIFrame* childPrevInFlow = nsnull;
|
||||
nsIFrame* prevChild = nsnull;
|
||||
if ((nsnull == mFirstChild) && (nsnull != mPrevInFlow)) {
|
||||
nsCSSInlineFrame* prev = (nsCSSInlineFrame*)mPrevInFlow;
|
||||
nsInlineFrame* prev = (nsInlineFrame*)mPrevInFlow;
|
||||
NS_ASSERTION(prev->mLastContentOffset >= prev->mFirstContentOffset,
|
||||
"bad prevInFlow");
|
||||
kidContentIndex = prev->NextChildOffset();
|
||||
@ -524,7 +525,7 @@ nsCSSInlineFrame::CreateNewFrames(nsIPresContext* aPresContext)
|
||||
PRInt32 lastContentIndex;
|
||||
mContent->ChildCount(lastContentIndex);
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("enter nsCSSInlineFrame::CreateNewFrames: kidContentIndex=%d lastContentIndex=%d childPrevInFlow=%p",
|
||||
("enter nsInlineFrame::CreateNewFrames: kidContentIndex=%d lastContentIndex=%d childPrevInFlow=%p",
|
||||
kidContentIndex, lastContentIndex, childPrevInFlow));
|
||||
while (kidContentIndex < lastContentIndex) {
|
||||
nsIContent* kid;
|
||||
@ -554,7 +555,7 @@ nsCSSInlineFrame::CreateNewFrames(nsIPresContext* aPresContext)
|
||||
childPrevInFlow = nsnull;
|
||||
prevChild = child;
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_NEW_FRAMES,
|
||||
("nsCSSInlineFrame::CreateNewFrames: new-frame=%p prev-in-flow=%p",
|
||||
("nsInlineFrame::CreateNewFrames: new-frame=%p prev-in-flow=%p",
|
||||
child, childPrevInFlow));
|
||||
}
|
||||
if (kidContentIndex == 0) {
|
||||
@ -567,19 +568,19 @@ nsCSSInlineFrame::CreateNewFrames(nsIPresContext* aPresContext)
|
||||
mLastContentIsComplete = PR_TRUE;
|
||||
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("exit nsCSSInlineFrame::CreateNewFrames"));
|
||||
("exit nsInlineFrame::CreateNewFrames"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsCSSInlineFrame::ChildIncrementalReflow(nsCSSInlineReflowState& aState)
|
||||
nsInlineFrame::ChildIncrementalReflow(nsInlineReflowState& aState)
|
||||
{
|
||||
// XXX we can do better SOMEDAY
|
||||
return ResizeReflow(aState);
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsCSSInlineFrame::ResizeReflow(nsCSSInlineReflowState& aState)
|
||||
nsInlineFrame::ResizeReflow(nsInlineReflowState& aState)
|
||||
{
|
||||
nsInlineReflowStatus rs = NS_FRAME_COMPLETE;
|
||||
if (0 != mChildCount) {
|
||||
@ -601,11 +602,11 @@ nsCSSInlineFrame::ResizeReflow(nsCSSInlineReflowState& aState)
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsCSSInlineFrame::ReflowMapped(nsCSSInlineReflowState& aState,
|
||||
nsInlineFrame::ReflowMapped(nsInlineReflowState& aState,
|
||||
nsInlineReflowStatus& aReflowStatus)
|
||||
{
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("enter nsCSSInlineFrame::ReflowMapped: childCount=%d", mChildCount));
|
||||
("enter nsInlineFrame::ReflowMapped: childCount=%d", mChildCount));
|
||||
|
||||
nsresult rv;
|
||||
|
||||
@ -630,7 +631,7 @@ nsCSSInlineFrame::ReflowMapped(nsCSSInlineReflowState& aState,
|
||||
}
|
||||
}
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("nsCSSInlineFrame::ReflowMapped: frame=%p c=%c kidRS=%x",
|
||||
("nsInlineFrame::ReflowMapped: frame=%p c=%c kidRS=%x",
|
||||
child, mLastContentIsComplete ? 'T' : 'F', aReflowStatus));
|
||||
|
||||
// See if a break is needed and if one is needed, what kind of break
|
||||
@ -675,7 +676,7 @@ nsCSSInlineFrame::ReflowMapped(nsCSSInlineReflowState& aState,
|
||||
PRInt32 lastContentIndex;
|
||||
mContent->ChildCount(lastContentIndex);
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("nsCSSInlineFrame::ReflowMapped: HERE kidContentIndex=%d lastContentIndex=%d frame=%p c=%c kidRS=%x",
|
||||
("nsInlineFrame::ReflowMapped: HERE kidContentIndex=%d lastContentIndex=%d frame=%p c=%c kidRS=%x",
|
||||
kidContentIndex, lastContentIndex, child, mLastContentIsComplete ? 'T' : 'F', aReflowStatus));
|
||||
if (++kidContentIndex == lastContentIndex) {
|
||||
// We are complete. Yippee. :-)
|
||||
@ -727,23 +728,23 @@ done:;
|
||||
NS_POSTCONDITION(mFirstContentOffset <= mLastContentOffset,
|
||||
"bad content offsets");
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("exit nsCSSInlineFrame::ReflowMapped: childCount=%d rs=%x",
|
||||
("exit nsInlineFrame::ReflowMapped: childCount=%d rs=%x",
|
||||
mChildCount, aReflowStatus));
|
||||
return keepGoing;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsCSSInlineFrame::PullUpChildren(nsCSSInlineReflowState& aState,
|
||||
nsInlineFrame::PullUpChildren(nsInlineReflowState& aState,
|
||||
nsInlineReflowStatus& aReflowStatus)
|
||||
{
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("enter nsCSSInlineFrame::PullUpChildren: childCount=%d",
|
||||
("enter nsInlineFrame::PullUpChildren: childCount=%d",
|
||||
mChildCount));
|
||||
|
||||
// Get correct kidContentIndex
|
||||
PRInt32 kidContentIndex;
|
||||
if ((nsnull == mFirstChild) && (nsnull != mPrevInFlow)) {
|
||||
nsCSSInlineFrame* prev = (nsCSSInlineFrame*)mPrevInFlow;
|
||||
nsInlineFrame* prev = (nsInlineFrame*)mPrevInFlow;
|
||||
NS_ASSERTION(prev->mLastContentOffset >= prev->mFirstContentOffset,
|
||||
"bad prevInFlow");
|
||||
kidContentIndex = prev->NextChildOffset();
|
||||
@ -755,7 +756,7 @@ nsCSSInlineFrame::PullUpChildren(nsCSSInlineReflowState& aState,
|
||||
PRBool keepGoing = PR_FALSE;
|
||||
nsresult rv;
|
||||
aReflowStatus = NS_FRAME_COMPLETE;
|
||||
nsCSSInlineFrame* nextInFlow = (nsCSSInlineFrame*) mNextInFlow;
|
||||
nsInlineFrame* nextInFlow = (nsInlineFrame*) mNextInFlow;
|
||||
nsIFrame* prevChild = aState.mLastChild;
|
||||
#ifdef NS_DEBUG
|
||||
if (nsnull == prevChild) {
|
||||
@ -771,11 +772,11 @@ nsCSSInlineFrame::PullUpChildren(nsCSSInlineReflowState& aState,
|
||||
// Get child from our next-in-flow
|
||||
nsIFrame* child = PullOneChild(nextInFlow, prevChild);
|
||||
if (nsnull == child) {
|
||||
nextInFlow = (nsCSSInlineFrame*) nextInFlow->mNextInFlow;
|
||||
nextInFlow = (nsInlineFrame*) nextInFlow->mNextInFlow;
|
||||
continue;
|
||||
}
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_PUSH_PULL,
|
||||
("nsCSSInlineFrame::PullUpChildren: trying to pullup %p", child));
|
||||
("nsInlineFrame::PullUpChildren: trying to pullup %p", child));
|
||||
|
||||
// Reflow it
|
||||
aReflowStatus = aState.mInlineLayout.ReflowAndPlaceFrame(child);
|
||||
@ -887,7 +888,7 @@ done:;
|
||||
// XXX Why bother? Assuming our offsets are correct then our
|
||||
// next-in-flow will pick up where we left off.
|
||||
#if XXX
|
||||
nextInFlow = (nsCSSInlineFrame*) mNextInFlow;
|
||||
nextInFlow = (nsInlineFrame*) mNextInFlow;
|
||||
if ((nsnull != nextInFlow) && (nsnull == nextInFlow->mFirstChild)) {
|
||||
if (NS_FRAME_IS_NOT_COMPLETE(aReflowStatus)) {
|
||||
AdjustOffsetOfEmptyNextInFlows();
|
||||
@ -896,13 +897,13 @@ done:;
|
||||
#endif
|
||||
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("exit nsCSSInlineFrame::PullUpChildren: childCount=%d rs=%x",
|
||||
("exit nsInlineFrame::PullUpChildren: childCount=%d rs=%x",
|
||||
mChildCount, aReflowStatus));
|
||||
return keepGoing;
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
nsCSSInlineFrame::PullOneChild(nsCSSInlineFrame* aNextInFlow,
|
||||
nsInlineFrame::PullOneChild(nsInlineFrame* aNextInFlow,
|
||||
nsIFrame* aLastChild)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aNextInFlow, "null ptr");
|
||||
@ -915,14 +916,14 @@ nsCSSInlineFrame::PullOneChild(nsCSSInlineFrame* aNextInFlow,
|
||||
return nsnull;
|
||||
}
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
|
||||
("nsCSSInlineFrame::PullOneChild: from overflow list, frame=%p",
|
||||
("nsInlineFrame::PullOneChild: from overflow list, frame=%p",
|
||||
kidFrame));
|
||||
kidFrame = aNextInFlow->mOverflowList;
|
||||
kidFrame->GetNextSibling(aNextInFlow->mOverflowList);
|
||||
}
|
||||
else {
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
|
||||
("nsCSSInlineFrame::PullOneChild: frame=%p (%d kids left)",
|
||||
("nsInlineFrame::PullOneChild: frame=%p (%d kids left)",
|
||||
kidFrame, aNextInFlow->mChildCount - 1));
|
||||
|
||||
// Take the frame away from the next-in-flow. Update it's first
|
||||
@ -961,7 +962,7 @@ nsCSSInlineFrame::PullOneChild(nsCSSInlineFrame* aNextInFlow,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsCSSInlineFrame::MaybeCreateNextInFlow(nsCSSInlineReflowState& aState,
|
||||
nsInlineFrame::MaybeCreateNextInFlow(nsInlineReflowState& aState,
|
||||
nsIFrame* aFrame)
|
||||
{
|
||||
nsIFrame* nextInFlow;
|
||||
@ -976,7 +977,7 @@ nsCSSInlineFrame::MaybeCreateNextInFlow(nsCSSInlineReflowState& aState,
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSInlineFrame::PushKids(nsCSSInlineReflowState& aState,
|
||||
nsInlineFrame::PushKids(nsInlineReflowState& aState,
|
||||
nsIFrame* aPrevChild,
|
||||
nsIFrame* aPushedChild)
|
||||
{
|
||||
@ -989,7 +990,7 @@ nsCSSInlineFrame::PushKids(nsCSSInlineReflowState& aState,
|
||||
// something to push...
|
||||
if (0 != pushCount) {
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_PUSH_PULL,
|
||||
("nsCSSInlineFrame::PushKids: pushing %d children", pushCount));
|
||||
("nsInlineFrame::PushKids: pushing %d children", pushCount));
|
||||
// Break sibling list
|
||||
aPrevChild->SetNextSibling(nsnull);
|
||||
mChildCount -= pushCount;
|
||||
@ -1005,12 +1006,12 @@ nsCSSInlineFrame::PushKids(nsCSSInlineReflowState& aState,
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSInlineFrame::DrainOverflowLists()
|
||||
nsInlineFrame::DrainOverflowLists()
|
||||
{
|
||||
// Our prev-in-flows overflow list goes before my children and must
|
||||
// be re-parented.
|
||||
if (nsnull != mPrevInFlow) {
|
||||
nsCSSInlineFrame* prevInFlow = (nsCSSInlineFrame*) mPrevInFlow;
|
||||
nsInlineFrame* prevInFlow = (nsInlineFrame*) mPrevInFlow;
|
||||
if (nsnull != prevInFlow->mOverflowList) {
|
||||
nsIFrame* frame = prevInFlow->mOverflowList;
|
||||
nsIFrame* lastFrame = nsnull;
|
@ -16,13 +16,13 @@
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
#include "nsCSSLineLayout.h"
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsCSSLayout.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIStyleContext.h"
|
||||
|
||||
void
|
||||
nsCSSTextRun::List(FILE* out, PRInt32 aIndent)
|
||||
nsTextRun::List(FILE* out, PRInt32 aIndent)
|
||||
{
|
||||
PRInt32 i;
|
||||
for (i = aIndent; --i >= 0; ) fputs(" ", out);
|
||||
@ -38,7 +38,7 @@ nsCSSTextRun::List(FILE* out, PRInt32 aIndent)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsCSSLineLayout::nsCSSLineLayout(nsIPresContext* aPresContext,
|
||||
nsLineLayout::nsLineLayout(nsIPresContext* aPresContext,
|
||||
nsISpaceManager* aSpaceManager)
|
||||
{
|
||||
mPresContext = aPresContext;
|
||||
@ -53,40 +53,40 @@ nsCSSLineLayout::nsCSSLineLayout(nsIPresContext* aPresContext,
|
||||
ResetTextRuns();
|
||||
}
|
||||
|
||||
nsCSSLineLayout::~nsCSSLineLayout()
|
||||
nsLineLayout::~nsLineLayout()
|
||||
{
|
||||
nsCSSTextRun::DeleteTextRuns(mTextRuns);
|
||||
nsTextRun::DeleteTextRuns(mTextRuns);
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSLineLayout::ResetTextRuns()
|
||||
nsLineLayout::ResetTextRuns()
|
||||
{
|
||||
nsCSSTextRun::DeleteTextRuns(mTextRuns);
|
||||
nsTextRun::DeleteTextRuns(mTextRuns);
|
||||
mTextRuns = nsnull;
|
||||
mTextRunP = &mTextRuns;
|
||||
mNewTextRun = nsnull;
|
||||
}
|
||||
|
||||
nsCSSTextRun*
|
||||
nsCSSLineLayout::TakeTextRuns()
|
||||
nsTextRun*
|
||||
nsLineLayout::TakeTextRuns()
|
||||
{
|
||||
nsCSSTextRun* result = mTextRuns;
|
||||
nsTextRun* result = mTextRuns;
|
||||
mTextRuns = nsnull;
|
||||
ResetTextRuns();
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSLineLayout::EndTextRun()
|
||||
nsLineLayout::EndTextRun()
|
||||
{
|
||||
mNewTextRun = nsnull;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsCSSLineLayout::AddText(nsIFrame* aTextFrame)
|
||||
nsLineLayout::AddText(nsIFrame* aTextFrame)
|
||||
{
|
||||
if (nsnull == mNewTextRun) {
|
||||
mNewTextRun = new nsCSSTextRun();
|
||||
mNewTextRun = new nsTextRun();
|
||||
if (nsnull == mNewTextRun) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -99,7 +99,7 @@ nsCSSLineLayout::AddText(nsIFrame* aTextFrame)
|
||||
|
||||
// XXX move this somewhere else!!!
|
||||
PRBool
|
||||
nsCSSLineLayout::TreatFrameAsBlock(const nsStyleDisplay* aDisplay,
|
||||
nsLineLayout::TreatFrameAsBlock(const nsStyleDisplay* aDisplay,
|
||||
const nsStylePosition* aPosition)
|
||||
{
|
||||
if (NS_STYLE_POSITION_ABSOLUTE == aPosition->mPosition) {
|
@ -16,27 +16,27 @@
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
#ifndef nsCSSLineLayout_h___
|
||||
#define nsCSSLineLayout_h___
|
||||
#ifndef nsLineLayout_h___
|
||||
#define nsLineLayout_h___
|
||||
|
||||
#include "nsIFrame.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
struct nsCSSBlockReflowState;
|
||||
struct nsBlockReflowState;
|
||||
class nsPlaceholderFrame;
|
||||
struct nsStyleDisplay;
|
||||
struct nsStylePosition;
|
||||
|
||||
// This structure represents a run of text. In mText are the
|
||||
// nsIFrame's that are considered text frames.
|
||||
struct nsCSSTextRun {
|
||||
nsCSSTextRun() {
|
||||
struct nsTextRun {
|
||||
nsTextRun() {
|
||||
mNext = nsnull;
|
||||
}
|
||||
|
||||
static void DeleteTextRuns(nsCSSTextRun* aRun) {
|
||||
static void DeleteTextRuns(nsTextRun* aRun) {
|
||||
while (nsnull != aRun) {
|
||||
nsCSSTextRun* next = aRun->mNext;
|
||||
nsTextRun* next = aRun->mNext;
|
||||
delete aRun;
|
||||
aRun = next;
|
||||
}
|
||||
@ -45,22 +45,22 @@ struct nsCSSTextRun {
|
||||
void List(FILE* out, PRInt32 aIndent);
|
||||
|
||||
nsVoidArray mArray;
|
||||
nsCSSTextRun* mNext;
|
||||
nsTextRun* mNext;
|
||||
|
||||
protected:
|
||||
~nsCSSTextRun() {
|
||||
~nsTextRun() {
|
||||
}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class nsCSSLineLayout {
|
||||
class nsLineLayout {
|
||||
public:
|
||||
nsCSSLineLayout(nsIPresContext* aPresContext,
|
||||
nsISpaceManager* aSpaceManager);
|
||||
~nsCSSLineLayout();
|
||||
nsLineLayout(nsIPresContext* aPresContext,
|
||||
nsISpaceManager* aSpaceManager);
|
||||
~nsLineLayout();
|
||||
|
||||
void Init(nsCSSBlockReflowState* aReflowState) {
|
||||
void Init(nsBlockReflowState* aReflowState) {
|
||||
mBlockReflowState = aReflowState;
|
||||
}
|
||||
|
||||
@ -75,9 +75,9 @@ public:
|
||||
// Close out a text-run during FindTextRuns.
|
||||
void EndTextRun();
|
||||
|
||||
// This returns the first nsCSSTextRun found during a
|
||||
// This returns the first nsTextRun found during a
|
||||
// FindTextRuns. The internal text-run state is reset.
|
||||
nsCSSTextRun* TakeTextRuns();
|
||||
nsTextRun* TakeTextRuns();
|
||||
|
||||
// Prepare this line-layout for the reflow of a new line
|
||||
void Prepare(nscoord aLeftEdge) {
|
||||
@ -105,7 +105,7 @@ public:
|
||||
|
||||
nsIPresContext* mPresContext;
|
||||
nsISpaceManager* mSpaceManager;
|
||||
nsCSSBlockReflowState* mBlockReflowState;
|
||||
nsBlockReflowState* mBlockReflowState;
|
||||
|
||||
PRBool mListPositionOutside;
|
||||
PRInt32 mLineNumber;
|
||||
@ -123,13 +123,13 @@ public:
|
||||
|
||||
protected:
|
||||
// These slots are used during FindTextRuns
|
||||
nsCSSTextRun* mTextRuns;
|
||||
nsCSSTextRun** mTextRunP;
|
||||
nsCSSTextRun* mNewTextRun;
|
||||
nsTextRun* mTextRuns;
|
||||
nsTextRun** mTextRunP;
|
||||
nsTextRun* mNewTextRun;
|
||||
|
||||
// These slots are used during InlineReflow
|
||||
nsCSSTextRun* mReflowTextRuns;
|
||||
nsCSSTextRun* mTextRun;
|
||||
nsTextRun* mReflowTextRuns;
|
||||
nsTextRun* mTextRun;
|
||||
};
|
||||
|
||||
#endif /* nsCSSLineLayout_h___ */
|
||||
#endif /* nsLineLayout_h___ */
|
@ -25,7 +25,7 @@
|
||||
#include "nsIView.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsCSSBlockFrame.h"
|
||||
#include "nsBlockFrame.h"
|
||||
|
||||
nsresult
|
||||
nsPlaceholderFrame::NewFrame(nsIFrame** aInstancePtrResult,
|
||||
@ -73,14 +73,15 @@ nsPlaceholderFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlaceholderFrame::FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
nsPlaceholderFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
{
|
||||
aLineLayout.EndTextRun();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlaceholderFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
nsPlaceholderFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aDesiredSize,
|
||||
const nsReflowState& aReflowState)
|
||||
{
|
||||
|
@ -41,9 +41,9 @@ public:
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
// nsIFrame overrides
|
||||
NS_IMETHOD FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aDesiredSize,
|
||||
const nsReflowState& aReflowState);
|
||||
NS_IMETHOD Paint(nsIPresContext& aPresContext,
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsFrame.h"
|
||||
#include "nsIInlineReflow.h"
|
||||
#include "nsCSSLineLayout.h"
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
@ -41,9 +41,9 @@ public:
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
// nsIInlineReflow
|
||||
NS_IMETHOD FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aDesiredSize,
|
||||
const nsReflowState& aReflowState);
|
||||
|
||||
@ -90,7 +90,7 @@ SpacerFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SpacerFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
SpacerFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
const nsReflowState& aReflowState)
|
||||
{
|
||||
@ -165,7 +165,7 @@ SpacerFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SpacerFrame::FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
SpacerFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
{
|
||||
aLineLayout.EndTextRun();
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "nsCRT.h"
|
||||
#include "nsSplittableFrame.h"
|
||||
#include "nsIInlineReflow.h"
|
||||
#include "nsCSSLineLayout.h"
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
@ -143,11 +143,11 @@ public:
|
||||
PRUint32& aAcutalContentOffset);
|
||||
|
||||
// nsIInlineReflow
|
||||
NS_IMETHOD FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
|
||||
NS_IMETHOD InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
const nsReflowState& aReflowState);
|
||||
|
||||
// TextFrame methods
|
||||
@ -184,13 +184,13 @@ public:
|
||||
nscolor aSelectionBGColor,
|
||||
nscoord dx, nscoord dy);
|
||||
|
||||
nsInlineReflowStatus ReflowPre(nsCSSLineLayout& aLineLayout,
|
||||
nsInlineReflowStatus ReflowPre(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsStyleFont& aFont,
|
||||
PRInt32 aStartingOffset);
|
||||
|
||||
nsInlineReflowStatus ReflowNormal(nsCSSLineLayout& aLineLayout,
|
||||
nsInlineReflowStatus ReflowNormal(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsStyleFont& aFontStyle,
|
||||
@ -1081,7 +1081,7 @@ TextFrame::PaintAsciiText(nsIPresContext& aPresContext,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TextFrame::FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
TextFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
{
|
||||
if (nsnull == mPrevInFlow) {
|
||||
@ -1214,7 +1214,7 @@ TextFrame::GetPosition(nsIPresContext& aCX,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TextFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
TextFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
const nsReflowState& aReflowState)
|
||||
{
|
||||
@ -1267,7 +1267,7 @@ TextFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
// tabs). Normal text reflow may or may not wrap depending on the
|
||||
// "whiteSpace" style property.
|
||||
nsInlineReflowStatus
|
||||
TextFrame::ReflowNormal(nsCSSLineLayout& aLineLayout,
|
||||
TextFrame::ReflowNormal(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsStyleFont& aFont,
|
||||
@ -1441,7 +1441,7 @@ TextFrame::ReflowNormal(nsCSSLineLayout& aLineLayout,
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
TextFrame::ReflowPre(nsCSSLineLayout& aLineLayout,
|
||||
TextFrame::ReflowPre(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsStyleFont& aFont,
|
||||
|
@ -62,7 +62,7 @@ include $(DEPTH)/config/config.mk
|
||||
|
||||
LCFLAGS += -D_IMPL_NS_HTML
|
||||
|
||||
INCLUDES += -I../../style/src -I../../content/src -I../../../base/src -I../../../css/layout/src -I.
|
||||
INCLUDES += -I../../style/src -I../../content/src -I../../../base/src -I.
|
||||
|
||||
MKSHLIB :=
|
||||
|
||||
|
@ -15,30 +15,30 @@
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#ifndef nsCSSInlineFrame_h___
|
||||
#define nsCSSInlineFrame_h___
|
||||
#ifndef nsInlineFrame_h___
|
||||
#define nsInlineFrame_h___
|
||||
|
||||
#include "nsCSSContainerFrame.h"
|
||||
#include "nsCSSInlineLayout.h"
|
||||
#include "nsCSSLineLayout.h"
|
||||
#include "nsHTMLContainerFrame.h"
|
||||
#include "nsInlineLayout.h"
|
||||
#include "nsLineLayout.h"
|
||||
|
||||
class nsCSSInlineFrame;
|
||||
class nsInlineFrame;
|
||||
class nsPlaceholderFrame;
|
||||
|
||||
/**
|
||||
* Reflow state object for managing css inline layout. Most of the state
|
||||
* is managed by the nsCSSInlineLayout object.
|
||||
* is managed by the nsInlineLayout object.
|
||||
*/
|
||||
struct nsCSSInlineReflowState : public nsReflowState {
|
||||
nsCSSInlineReflowState(nsCSSLineLayout& aLineLayout,
|
||||
nsCSSInlineFrame* aInlineFrame,
|
||||
nsIStyleContext* aInlineSC,
|
||||
const nsReflowState& aReflowState,
|
||||
PRBool aComputeMaxElementSize);
|
||||
~nsCSSInlineReflowState();
|
||||
struct nsInlineReflowState : public nsReflowState {
|
||||
nsInlineReflowState(nsLineLayout& aLineLayout,
|
||||
nsInlineFrame* aInlineFrame,
|
||||
nsIStyleContext* aInlineSC,
|
||||
const nsReflowState& aReflowState,
|
||||
PRBool aComputeMaxElementSize);
|
||||
~nsInlineReflowState();
|
||||
|
||||
nsIPresContext* mPresContext;
|
||||
nsCSSInlineLayout mInlineLayout;
|
||||
nsInlineLayout mInlineLayout;
|
||||
|
||||
nsIFrame* mLastChild; // last child we have reflowed (so far)
|
||||
|
||||
@ -55,8 +55,8 @@ struct nsCSSInlineReflowState : public nsReflowState {
|
||||
*
|
||||
* Note: This class does not support being used as a pseudo frame.
|
||||
*/
|
||||
class nsCSSInlineFrame : public nsCSSContainerFrame,
|
||||
public nsIInlineReflow
|
||||
class nsInlineFrame : public nsHTMLContainerFrame,
|
||||
public nsIInlineReflow
|
||||
{
|
||||
public:
|
||||
// nsISupports
|
||||
@ -76,46 +76,46 @@ public:
|
||||
#endif
|
||||
|
||||
// nsIInlineReflow
|
||||
NS_IMETHOD FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aDesiredSize,
|
||||
const nsReflowState& aReflowState);
|
||||
|
||||
// nsCSSContainerFrame
|
||||
// nsContainerFrame
|
||||
virtual PRBool DeleteNextInFlowsFor(nsIPresContext& aPresContext, nsIFrame* aChild);
|
||||
|
||||
protected:
|
||||
nsCSSInlineFrame(nsIContent* aContent, nsIFrame* aParent);
|
||||
nsInlineFrame(nsIContent* aContent, nsIFrame* aParent);
|
||||
|
||||
virtual ~nsCSSInlineFrame();
|
||||
virtual ~nsInlineFrame();
|
||||
|
||||
virtual PRIntn GetSkipSides() const;
|
||||
|
||||
nsresult InitialReflow(nsCSSInlineReflowState& aState);
|
||||
nsresult InitialReflow(nsInlineReflowState& aState);
|
||||
|
||||
nsresult FrameAppendedReflow(nsCSSInlineReflowState& aState);
|
||||
nsresult FrameAppendedReflow(nsInlineReflowState& aState);
|
||||
|
||||
nsresult ChildIncrementalReflow(nsCSSInlineReflowState& aState);
|
||||
nsresult ChildIncrementalReflow(nsInlineReflowState& aState);
|
||||
|
||||
nsresult ResizeReflow(nsCSSInlineReflowState& aState);
|
||||
nsresult ResizeReflow(nsInlineReflowState& aState);
|
||||
|
||||
void ComputeFinalSize(nsCSSInlineReflowState& aState,
|
||||
void ComputeFinalSize(nsInlineReflowState& aState,
|
||||
nsReflowMetrics& aMetrics);
|
||||
|
||||
PRBool ReflowMapped(nsCSSInlineReflowState& aState,
|
||||
PRBool ReflowMapped(nsInlineReflowState& aState,
|
||||
nsInlineReflowStatus& aReflowStatus);
|
||||
|
||||
PRBool PullUpChildren(nsCSSInlineReflowState& aState,
|
||||
PRBool PullUpChildren(nsInlineReflowState& aState,
|
||||
nsInlineReflowStatus& aReflowStatus);
|
||||
|
||||
nsIFrame* PullOneChild(nsCSSInlineFrame* aNextInFlow,
|
||||
nsIFrame* PullOneChild(nsInlineFrame* aNextInFlow,
|
||||
nsIFrame* aLastChild);
|
||||
|
||||
nsresult MaybeCreateNextInFlow(nsCSSInlineReflowState& aState,
|
||||
nsresult MaybeCreateNextInFlow(nsInlineReflowState& aState,
|
||||
nsIFrame* aFrame);
|
||||
|
||||
void PushKids(nsCSSInlineReflowState& aState,
|
||||
void PushKids(nsInlineReflowState& aState,
|
||||
nsIFrame* aPrevChild, nsIFrame* aPushedChild);
|
||||
|
||||
void DrainOverflowLists();
|
||||
@ -124,13 +124,13 @@ protected:
|
||||
nsresult CreateNewFrames(nsIPresContext* aPresContext);
|
||||
nsresult AppendNewFrames(nsIPresContext* aPresContext, nsIFrame*);
|
||||
|
||||
friend nsresult NS_NewCSSInlineFrame(nsIFrame** aInstancePtrResult,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent);
|
||||
friend nsresult NS_NewInlineFrame(nsIFrame** aInstancePtrResult,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent);
|
||||
};
|
||||
|
||||
extern nsresult NS_NewCSSInlineFrame(nsIFrame** aInstancePtrResult,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent);
|
||||
extern nsresult NS_NewInlineFrame(nsIFrame** aInstancePtrResult,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent);
|
||||
|
||||
#endif /* nsCSSInlineFrame_h___ */
|
||||
#endif /* nsInlineFrame_h___ */
|
@ -25,6 +25,7 @@ DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
|
||||
CPPSRCS= \
|
||||
nsAbsoluteFrame.cpp \
|
||||
nsBRFrame.cpp \
|
||||
nsBlockFrame.cpp \
|
||||
nsBodyFrame.cpp \
|
||||
nsGlobalVariables.cpp \
|
||||
nsHRFrame.cpp \
|
||||
@ -37,7 +38,10 @@ CPPSRCS= \
|
||||
nsHTMLReflowCommand.cpp \
|
||||
nsImageFrame.cpp \
|
||||
nsImageMap.cpp \
|
||||
nsInlineFrame.cpp \
|
||||
nsInlineLayout.cpp \
|
||||
nsLeafFrame.cpp \
|
||||
nsLineLayout.cpp \
|
||||
nsObjectFrame.cpp \
|
||||
nsPageFrame.cpp \
|
||||
nsPlaceholderFrame.cpp \
|
||||
@ -55,6 +59,7 @@ CPPSRCS= \
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsAbsoluteFrame.obj \
|
||||
.\$(OBJDIR)\nsBRFrame.obj \
|
||||
.\$(OBJDIR)\nsBlockFrame.obj \
|
||||
.\$(OBJDIR)\nsBodyFrame.obj \
|
||||
.\$(OBJDIR)\nsGlobalVariables.obj \
|
||||
.\$(OBJDIR)\nsHRFrame.obj \
|
||||
@ -70,7 +75,10 @@ CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsHTMLTagContent.obj \
|
||||
.\$(OBJDIR)\nsImageFrame.obj \
|
||||
.\$(OBJDIR)\nsImageMap.obj \
|
||||
.\$(OBJDIR)\nsInlineFrame.obj \
|
||||
.\$(OBJDIR)\nsInlineLayout.obj \
|
||||
.\$(OBJDIR)\nsLeafFrame.obj \
|
||||
.\$(OBJDIR)\nsLineLayout.obj \
|
||||
.\$(OBJDIR)\nsObjectFrame.obj \
|
||||
.\$(OBJDIR)\nsPageFrame.obj \
|
||||
.\$(OBJDIR)\nsPlaceholderFrame.obj \
|
||||
@ -86,8 +94,8 @@ EXPORTS=nsGlobalVariables.h
|
||||
|
||||
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\js \
|
||||
-I$(PUBLIC)\dom -I$(PUBLIC)\netlib \
|
||||
-I..\..\style\src -I..\..\..\css\layout\src \
|
||||
-I..\..\content\src \
|
||||
-I..\..\style\src \
|
||||
-I..\..\content\src \
|
||||
-I..\..\..\base\src -I$(PUBLIC)\plugin -I$(PUBLIC)\java
|
||||
|
||||
LCFLAGS = \
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIInlineReflow.h"
|
||||
#include "nsCSSLineLayout.h"
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIStyleContext.h"
|
||||
@ -40,9 +40,9 @@ public:
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
// nsIInlineReflow
|
||||
NS_IMETHOD FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aDesiredSize,
|
||||
const nsReflowState& aReflowState);
|
||||
|
||||
@ -100,7 +100,7 @@ BRFrame::Paint(nsIPresContext& aPresContext,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BRFrame::FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
BRFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
{
|
||||
aLineLayout.EndTextRun();
|
||||
@ -108,7 +108,7 @@ BRFrame::FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BRFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
BRFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
const nsReflowState& aReflowState)
|
||||
{
|
||||
|
4735
layout/html/base/src/nsBlockFrame.cpp
Normal file
4735
layout/html/base/src/nsBlockFrame.cpp
Normal file
File diff suppressed because it is too large
Load Diff
152
layout/html/base/src/nsBlockFrame.h
Normal file
152
layout/html/base/src/nsBlockFrame.h
Normal file
@ -0,0 +1,152 @@
|
||||
/* -*- 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 "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef nsBlockFrame_h___
|
||||
#define nsBlockFrame_h___
|
||||
|
||||
#include "nsHTMLContainerFrame.h"
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsInlineLayout.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsISpaceManager.h"
|
||||
|
||||
class nsBlockFrame;
|
||||
struct nsInlineLayout;
|
||||
class nsPlaceholderFrame;
|
||||
struct LineData;
|
||||
|
||||
/* 52b33130-0b99-11d2-932e-00805f8add32 */
|
||||
#define NS_BLOCK_FRAME_CID \
|
||||
{ 0x52b33130, 0x0b99, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
// XXX hide this as soon as list bullet code is cleaned up
|
||||
|
||||
struct nsBlockReflowState : public nsReflowState {
|
||||
nsBlockReflowState(nsIPresContext* aPresContext,
|
||||
nsISpaceManager* aSpaceManager,
|
||||
nsBlockFrame* aBlock,
|
||||
nsIStyleContext* aBlockSC,
|
||||
const nsReflowState& aReflowState,
|
||||
nsReflowMetrics& aMetrics,
|
||||
PRBool aComputeMaxElementSize);
|
||||
|
||||
~nsBlockReflowState();
|
||||
|
||||
/**
|
||||
* Update the mCurrentBand data based on the current mY position.
|
||||
*/
|
||||
void GetAvailableSpace();
|
||||
|
||||
void AddFloater(nsPlaceholderFrame* aPlaceholderFrame);
|
||||
|
||||
void PlaceFloater(nsPlaceholderFrame* aFloater);
|
||||
|
||||
void PlaceFloaters(nsVoidArray* aFloaters);
|
||||
|
||||
void ClearFloaters(PRUint8 aBreakType);
|
||||
|
||||
PRBool IsLeftMostChild(nsIFrame* aFrame);
|
||||
|
||||
nsIPresContext* mPresContext;
|
||||
nsISpaceManager* mSpaceManager;
|
||||
nsBlockFrame* mBlock;
|
||||
PRBool mBlockIsPseudo;
|
||||
nsBlockFrame* mNextInFlow;
|
||||
PRUint8 mTextAlign;
|
||||
PRUint8 mDirection;
|
||||
|
||||
nsMargin mBorderPadding;
|
||||
nsSize mInnerSize; // inner area after removing border+padding
|
||||
nsSize mStyleSize;
|
||||
PRIntn mStyleSizeFlags;
|
||||
nscoord mDeltaWidth;
|
||||
nscoord mBottomEdge; // maximum Y
|
||||
nscoord mBulletPadding;
|
||||
nscoord mLeftPadding;
|
||||
|
||||
PRPackedBool mUnconstrainedWidth;
|
||||
PRPackedBool mUnconstrainedHeight;
|
||||
PRPackedBool mNoWrap;
|
||||
PRPackedBool mComputeMaxElementSize;
|
||||
nscoord mX, mY;
|
||||
nscoord mPrevBottomMargin;
|
||||
nscoord mOuterTopMargin;
|
||||
nscoord mKidXMost;
|
||||
|
||||
// When a block that contains a block is unconstrained we need to
|
||||
// give the inner block a limited width otherwise they don't reflow
|
||||
// properly.
|
||||
PRPackedBool mHaveBlockMaxWidth;
|
||||
nscoord mBlockMaxWidth;
|
||||
|
||||
nsSize mMaxElementSize;
|
||||
|
||||
nsLineLayout mLineLayout;
|
||||
|
||||
nsInlineLayout mInlineLayout;
|
||||
PRBool mInlineLayoutPrepared;
|
||||
|
||||
nsIFrame* mPrevChild;
|
||||
|
||||
LineData* mFreeList;
|
||||
|
||||
nsVoidArray mPendingFloaters;
|
||||
nscoord mSpaceManagerX, mSpaceManagerY;
|
||||
|
||||
LineData* mCurrentLine;
|
||||
LineData* mPrevLine;
|
||||
|
||||
// XXX The next list ordinal for counting list bullets
|
||||
PRInt32 mNextListOrdinal;
|
||||
|
||||
// XXX what happens if we need more than 12 trapezoids?
|
||||
struct BlockBandData : public nsBandData {
|
||||
// Trapezoids used during band processing
|
||||
nsBandTrapezoid data[12];
|
||||
|
||||
// Bounding rect of available space between any left and right floaters
|
||||
nsRect availSpace;
|
||||
|
||||
BlockBandData() {
|
||||
size = 12;
|
||||
trapezoids = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the bounding rect of the available space, i.e. space
|
||||
* between any left and right floaters Uses the current trapezoid
|
||||
* data, see nsISpaceManager::GetBandData(). Also updates member
|
||||
* data "availSpace".
|
||||
*/
|
||||
void ComputeAvailSpaceRect();
|
||||
};
|
||||
|
||||
BlockBandData mCurrentBand;
|
||||
};
|
||||
|
||||
inline void
|
||||
nsLineLayout::AddFloater(nsPlaceholderFrame* aFrame)
|
||||
{
|
||||
mBlockReflowState->AddFloater(aFrame);
|
||||
}
|
||||
|
||||
extern nsresult NS_NewBlockFrame(nsIFrame** aInstancePtrResult,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent);
|
||||
|
||||
#endif /* nsCSSBlockFrame_h___ */
|
4735
layout/html/base/src/nsBlockReflowState.cpp
Normal file
4735
layout/html/base/src/nsBlockReflowState.cpp
Normal file
File diff suppressed because it is too large
Load Diff
4735
layout/html/base/src/nsBlockReflowState.h
Normal file
4735
layout/html/base/src/nsBlockReflowState.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -32,7 +32,7 @@
|
||||
#include "nsViewsCID.h"
|
||||
#include "nsAbsoluteFrame.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsCSSBlockFrame.h"
|
||||
#include "nsBlockFrame.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsHTMLValue.h"
|
||||
#include "nsHTMLTagContent.h"
|
||||
@ -90,7 +90,7 @@ NS_IMETHODIMP
|
||||
nsBodyFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
|
||||
{
|
||||
// Create a block frame and set its style context
|
||||
NS_NewCSSBlockFrame(&mFirstChild, mContent, this);
|
||||
NS_NewBlockFrame(&mFirstChild, mContent, this);
|
||||
mChildCount = 1;
|
||||
nsIStyleContext* pseudoStyleContext =
|
||||
aPresContext.ResolvePseudoStyleContextFor(nsHTMLAtoms::columnPseudo, this);
|
||||
@ -510,7 +510,7 @@ void nsBodyFrame::CreateColumnFrame(nsIPresContext* aPresContext)
|
||||
// Do we have a prev-in-flow?
|
||||
if (nsnull == mPrevInFlow) {
|
||||
// No, create a column pseudo frame
|
||||
NS_NewCSSBlockFrame(&mFirstChild, mContent, this);
|
||||
NS_NewBlockFrame(&mFirstChild, mContent, this);
|
||||
mChildCount = 1;
|
||||
mFirstChild->SetStyleContext(aPresContext,styleContext);
|
||||
} else {
|
||||
|
@ -18,9 +18,9 @@
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsHTMLTagContent.h"
|
||||
#include "nsLeafFrame.h"
|
||||
#include "nsCSSBlockFrame.h"
|
||||
#include "nsBlockFrame.h"
|
||||
#include "nsIInlineReflow.h"
|
||||
#include "nsCSSLineLayout.h"
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIRenderingContext.h"
|
||||
@ -82,28 +82,28 @@ public:
|
||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
||||
|
||||
// nsIInlineReflow
|
||||
NS_IMETHOD FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
const nsReflowState& aReflowState);
|
||||
|
||||
protected:
|
||||
void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
nsCSSBlockReflowState* aBlockState,
|
||||
void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
nsBlockReflowState* aBlockState,
|
||||
const nsReflowState& aReflowState,
|
||||
nsReflowMetrics& aMetrics);
|
||||
|
||||
PRInt32 GetListItemOrdinal(nsIPresContext* aCX,
|
||||
nsCSSBlockReflowState* aBlockState,
|
||||
PRInt32 GetListItemOrdinal(nsIPresContext* aCX,
|
||||
nsBlockReflowState* aBlockState,
|
||||
const nsStyleList& aMol);
|
||||
|
||||
void GetListItemText(nsIPresContext* aCX,
|
||||
nsCSSBlockReflowState* aBlockState,
|
||||
void GetListItemText(nsIPresContext* aCX,
|
||||
nsBlockReflowState* aBlockState,
|
||||
const nsStyleList& aMol,
|
||||
nsString& aResult);
|
||||
|
||||
nsCSSBlockReflowState*
|
||||
nsBlockReflowState*
|
||||
GetListContainerReflowState(nsIPresContext* aCX,
|
||||
const nsReflowState& aReflowState);
|
||||
|
||||
@ -338,7 +338,7 @@ BulletFrame::Paint(nsIPresContext& aCX,
|
||||
// Return the reflow state for the list container that contains this
|
||||
// list item frame. There may be no list container (a dangling LI)
|
||||
// therefore this may return nsnull.
|
||||
nsCSSBlockReflowState*
|
||||
nsBlockReflowState*
|
||||
BulletFrame::GetListContainerReflowState(nsIPresContext* aCX,
|
||||
const nsReflowState& aReflowState)
|
||||
{
|
||||
@ -352,7 +352,7 @@ BulletFrame::GetListContainerReflowState(nsIPresContext* aCX,
|
||||
if ((tag == nsHTMLAtoms::ul) || (tag == nsHTMLAtoms::ol) ||
|
||||
(tag == nsHTMLAtoms::menu) || (tag == nsHTMLAtoms::dir)) {
|
||||
NS_RELEASE(tag);
|
||||
return (nsCSSBlockReflowState*) rs;
|
||||
return (nsBlockReflowState*) rs;
|
||||
}
|
||||
NS_RELEASE(tag);
|
||||
rs = rs->parentReflowState;
|
||||
@ -361,9 +361,9 @@ BulletFrame::GetListContainerReflowState(nsIPresContext* aCX,
|
||||
}
|
||||
|
||||
PRInt32
|
||||
BulletFrame::GetListItemOrdinal(nsIPresContext* aCX,
|
||||
nsCSSBlockReflowState* aReflowState,
|
||||
const nsStyleList& aListStyle)
|
||||
BulletFrame::GetListItemOrdinal(nsIPresContext* aCX,
|
||||
nsBlockReflowState* aReflowState,
|
||||
const nsStyleList& aListStyle)
|
||||
{
|
||||
if (mOrdinalValid) {
|
||||
return mOrdinal;
|
||||
@ -427,7 +427,7 @@ static const char* gUpperAlphaChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
// maxnegint will work
|
||||
void
|
||||
BulletFrame::GetListItemText(nsIPresContext* aCX,
|
||||
nsCSSBlockReflowState* aReflowState,
|
||||
nsBlockReflowState* aReflowState,
|
||||
const nsStyleList& aListStyle,
|
||||
nsString& result)
|
||||
{
|
||||
@ -548,7 +548,7 @@ BulletFrame::GetListItemText(nsIPresContext* aCX,
|
||||
|
||||
void
|
||||
BulletFrame::GetDesiredSize(nsIPresContext* aCX,
|
||||
nsCSSBlockReflowState* aState,
|
||||
nsBlockReflowState* aState,
|
||||
const nsReflowState& aReflowState,
|
||||
nsReflowMetrics& aMetrics)
|
||||
{
|
||||
@ -629,11 +629,11 @@ BulletFrame::GetDesiredSize(nsIPresContext* aCX,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
BulletFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
const nsReflowState& aReflowState)
|
||||
{
|
||||
nsCSSBlockReflowState* state =
|
||||
nsBlockReflowState* state =
|
||||
GetListContainerReflowState(aLineLayout.mPresContext, aReflowState);
|
||||
|
||||
// Get the base size
|
||||
@ -658,7 +658,7 @@ BulletFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
BulletFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
{
|
||||
aLineLayout.EndTextRun();
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "nsIArena.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsCSSBlockFrame.h"
|
||||
#include "nsBlockFrame.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
@ -37,7 +37,7 @@
|
||||
#include "prprf.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
|
||||
#include "nsCSSInlineFrame.h"
|
||||
#include "nsInlineFrame.h"
|
||||
#include "nsIWebShell.h"
|
||||
|
||||
|
||||
@ -257,11 +257,11 @@ nsHTMLContainer::CreateFrame(nsIPresContext* aPresContext,
|
||||
switch (styleDisplay->mDisplay) {
|
||||
case NS_STYLE_DISPLAY_BLOCK:
|
||||
case NS_STYLE_DISPLAY_LIST_ITEM:
|
||||
rv = NS_NewCSSBlockFrame(&frame, this, aParentFrame);
|
||||
rv = NS_NewBlockFrame(&frame, this, aParentFrame);
|
||||
break;
|
||||
|
||||
case NS_STYLE_DISPLAY_INLINE:
|
||||
rv = NS_NewCSSInlineFrame(&frame, this, aParentFrame);
|
||||
rv = NS_NewInlineFrame(&frame, this, aParentFrame);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -389,3 +389,32 @@ nsHTMLContainerFrame::ProcessInitialReflow(nsIPresContext* aPresContext)
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLContainerFrame::DeleteNextInFlowsFor(nsIPresContext& aPresContext,
|
||||
nsIFrame* aChild)
|
||||
{
|
||||
// XXX get rid of this sillyness
|
||||
NS_NOTREACHED("subclass should've overriden this!");
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsPlaceholderFrame*
|
||||
nsHTMLContainerFrame::CreatePlaceholderFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFloatedFrame)
|
||||
{
|
||||
nsIContent* content;
|
||||
aFloatedFrame->GetContent(content);
|
||||
|
||||
nsPlaceholderFrame* placeholder;
|
||||
nsPlaceholderFrame::NewFrame((nsIFrame**)&placeholder, content, this, aFloatedFrame);
|
||||
NS_IF_RELEASE(content);
|
||||
|
||||
// Let the placeholder share the same style context as the floated element
|
||||
nsIStyleContext* kidSC;
|
||||
aFloatedFrame->GetStyleContext(aPresContext, kidSC);
|
||||
placeholder->SetStyleContext(aPresContext, kidSC);
|
||||
NS_RELEASE(kidSC);
|
||||
|
||||
return placeholder;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "nsContainerFrame.h"
|
||||
class nsString;
|
||||
class nsPlaceholderFrame;
|
||||
|
||||
// Base class for html container frames that provides common
|
||||
// functionality.
|
||||
@ -53,6 +54,12 @@ public:
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent);
|
||||
|
||||
virtual PRBool DeleteNextInFlowsFor(nsIPresContext& aPresContext,
|
||||
nsIFrame* aChild);
|
||||
|
||||
nsPlaceholderFrame* CreatePlaceholderFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFloatedFrame);
|
||||
|
||||
protected:
|
||||
virtual ~nsHTMLContainerFrame();
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "nsIFloaterContainer.h"
|
||||
#include "nsIRunaround.h"
|
||||
#include "nsIInlineReflow.h"
|
||||
#include "nsCSSBlockFrame.h"
|
||||
#include "nsBlockFrame.h"
|
||||
|
||||
const nsIID kIAbsoluteItemsIID = NS_IABSOLUTE_ITEMS_IID;
|
||||
const nsIID kIAnchoredItemsIID = NS_IANCHORED_ITEMS_IID;
|
||||
|
@ -235,13 +235,18 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult,
|
||||
|
||||
// Factory methods for creating html layout objects
|
||||
|
||||
extern nsresult
|
||||
NS_NewBRFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame);
|
||||
|
||||
extern nsresult
|
||||
NS_NewBodyFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame);
|
||||
|
||||
extern nsresult
|
||||
NS_NewBRFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame);
|
||||
NS_NewBlockFrame(nsIFrame** aInstancePtrResult,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent);
|
||||
|
||||
extern nsresult
|
||||
NS_NewCommentFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
@ -252,11 +257,13 @@ NS_NewHRFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame);
|
||||
|
||||
// <frame> and <iframe>
|
||||
extern nsresult NS_NewHTMLFrameOuterFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame);
|
||||
extern nsresult
|
||||
NS_NewHTMLFrameOuterFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame);
|
||||
// <frameset>
|
||||
extern nsresult NS_NewHTMLFramesetFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame);
|
||||
extern nsresult
|
||||
NS_NewHTMLFramesetFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame);
|
||||
|
||||
extern nsresult
|
||||
NS_NewHTMLFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
@ -266,6 +273,11 @@ extern nsresult
|
||||
NS_NewImageFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aFrameResult);
|
||||
|
||||
extern nsresult
|
||||
NS_NewInlineFrame(nsIFrame** aInstancePtrResult,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent);
|
||||
|
||||
extern nsresult
|
||||
NS_NewObjectFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aFrameResult);
|
||||
@ -282,16 +294,6 @@ nsresult
|
||||
NS_NewWBRFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aResult);
|
||||
|
||||
extern nsresult
|
||||
NS_NewCSSInlineFrame(nsIFrame** aInstancePtrResult,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent);
|
||||
|
||||
extern nsresult
|
||||
NS_NewCSSBlockFrame(nsIFrame** aInstancePtrResult,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent);
|
||||
|
||||
extern nsresult
|
||||
NS_NewInputButtonFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aResult);
|
||||
|
101
layout/html/base/src/nsIInlineReflow.h
Normal file
101
layout/html/base/src/nsIInlineReflow.h
Normal file
@ -0,0 +1,101 @@
|
||||
/* -*- 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 "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef nsIInlineReflow_h___
|
||||
#define nsIInlineReflow_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsStyleConsts.h"
|
||||
class nsLineLayout;
|
||||
|
||||
/* d76e29b0-ff56-11d1-89e7-006008911b81 */
|
||||
#define NS_IINLINE_REFLOW_IID \
|
||||
{0xd76e29b0, 0xff56, 0x11d1, {0x89, 0xe7, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81}}
|
||||
|
||||
class nsIInlineReflow {
|
||||
public:
|
||||
/**
|
||||
* Recursively find all of the text runs contained in an outer
|
||||
* block container. Inline frames implement this by recursing over
|
||||
* their children; note that inlines frames may need to create
|
||||
* missing child frames before proceeding (e.g. when a tree
|
||||
* containing inlines is appended/inserted into a block container
|
||||
*/
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand) = 0;
|
||||
|
||||
/**
|
||||
* InlineReflow method. See below for how to interpret the return value.
|
||||
*/
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aDesiredSize,
|
||||
const nsReflowState& aReflowState) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* For InlineReflow the return value (an nsresult) indicates the
|
||||
* status of the reflow operation. If the return value is negative
|
||||
* then some sort of catastrophic error has occured (e.g. out of memory).
|
||||
* If the return value is non-negative then the macros below can be
|
||||
* used to interpret it.
|
||||
*
|
||||
* This is an extension of the nsReflowStatus value; it's bits are used
|
||||
* in addition the bits that we add.
|
||||
*/
|
||||
typedef nsReflowStatus nsInlineReflowStatus;
|
||||
|
||||
// This bit is set, when a break is requested. This bit is orthogonal
|
||||
// to the nsIFrame::nsReflowStatus completion bits.
|
||||
#define NS_INLINE_BREAK 0x0100
|
||||
|
||||
#define NS_INLINE_IS_BREAK(_status) \
|
||||
(0 != ((_status) & NS_INLINE_BREAK))
|
||||
|
||||
// When a break is requested, this bit when set indicates that the
|
||||
// break should occur after the frame just reflowed; when the bit is
|
||||
// clear the break should occur before the frame just reflowed.
|
||||
#define NS_INLINE_BREAK_SIDE 0x0200 // 0 = before, !0 = after
|
||||
#define NS_INLINE_BREAK_BEFORE 0x0000
|
||||
#define NS_INLINE_BREAK_AFTER NS_INLINE_BREAK_SIDE
|
||||
|
||||
#define NS_INLINE_IS_BREAK_AFTER(_status) \
|
||||
(0 != ((_status) & NS_INLINE_BREAK_SIDE))
|
||||
|
||||
#define NS_INLINE_IS_BREAK_BEFORE(_status) \
|
||||
(NS_INLINE_BREAK == ((_status) & (NS_INLINE_BREAK|NS_INLINE_BREAK_SIDE)))
|
||||
|
||||
// The type of break requested can be found in these bits.
|
||||
#define NS_INLINE_BREAK_TYPE_MASK 0xF000
|
||||
|
||||
#define NS_INLINE_GET_BREAK_TYPE(_status) (((_status) >> 12) & 0xF)
|
||||
|
||||
#define NS_INLINE_MAKE_BREAK_TYPE(_type) ((_type) << 12)
|
||||
|
||||
// Convenience macro's: Take a completion status and add to it
|
||||
// the desire to have a line-break before.
|
||||
#define NS_INLINE_LINE_BREAK_BEFORE(_completionStatus) \
|
||||
((_completionStatus) | NS_INLINE_BREAK | NS_INLINE_BREAK_BEFORE | \
|
||||
NS_INLINE_MAKE_BREAK_TYPE(NS_STYLE_CLEAR_LINE))
|
||||
|
||||
// Convenience macro's: Take a completion status and add to it
|
||||
// the desire to have a line-break after.
|
||||
#define NS_INLINE_LINE_BREAK_AFTER(_completionStatus) \
|
||||
((_completionStatus) | NS_INLINE_BREAK | NS_INLINE_BREAK_AFTER | \
|
||||
NS_INLINE_MAKE_BREAK_TYPE(NS_STYLE_CLEAR_LINE))
|
||||
|
||||
#endif /* nsIInlineReflow_h___ */
|
1089
layout/html/base/src/nsInlineFrame.cpp
Normal file
1089
layout/html/base/src/nsInlineFrame.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -16,11 +16,11 @@
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
#include "nsCSSInlineLayout.h"
|
||||
#include "nsCSSLineLayout.h"
|
||||
#include "nsInlineLayout.h"
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsCSSLayout.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsCSSContainerFrame.h"
|
||||
#include "nsContainerFrame.h"
|
||||
|
||||
#include "nsIFontMetrics.h"
|
||||
#include "nsIStyleContext.h"
|
||||
@ -29,8 +29,8 @@
|
||||
#include "nsIRunaround.h"
|
||||
#include "nsISpaceManager.h"
|
||||
|
||||
nsCSSInlineLayout::nsCSSInlineLayout(nsCSSLineLayout& aLineLayout,
|
||||
nsCSSContainerFrame* aContainerFrame,
|
||||
nsInlineLayout::nsInlineLayout(nsLineLayout& aLineLayout,
|
||||
nsContainerFrame* aContainerFrame,
|
||||
nsIStyleContext* aContainerStyle)
|
||||
: mLineLayout(aLineLayout)
|
||||
{
|
||||
@ -50,7 +50,7 @@ nsCSSInlineLayout::nsCSSInlineLayout(nsCSSLineLayout& aLineLayout,
|
||||
mNextRCFrame = nsnull;
|
||||
}
|
||||
|
||||
nsCSSInlineLayout::~nsCSSInlineLayout()
|
||||
nsInlineLayout::~nsInlineLayout()
|
||||
{
|
||||
if (mAscents != mAscentBuf) {
|
||||
delete [] mAscents;
|
||||
@ -58,13 +58,13 @@ nsCSSInlineLayout::~nsCSSInlineLayout()
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSInlineLayout::Init(const nsReflowState* aContainerReflowState)
|
||||
nsInlineLayout::Init(const nsReflowState* aContainerReflowState)
|
||||
{
|
||||
mContainerReflowState = aContainerReflowState;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsCSSInlineLayout::SetAscent(nscoord aAscent)
|
||||
nsInlineLayout::SetAscent(nscoord aAscent)
|
||||
{
|
||||
PRInt32 frameNum = mFrameNum;
|
||||
if (frameNum == mMaxAscents) {
|
||||
@ -84,7 +84,7 @@ nsCSSInlineLayout::SetAscent(nscoord aAscent)
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSInlineLayout::Prepare(PRBool aUnconstrainedWidth,
|
||||
nsInlineLayout::Prepare(PRBool aUnconstrainedWidth,
|
||||
PRBool aNoWrap,
|
||||
PRBool aComputeMaxElementSize)
|
||||
{
|
||||
@ -103,7 +103,7 @@ nsCSSInlineLayout::Prepare(PRBool aUnconstrainedWidth,
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSInlineLayout::SetReflowSpace(nscoord aX, nscoord aY,
|
||||
nsInlineLayout::SetReflowSpace(nscoord aX, nscoord aY,
|
||||
nscoord aAvailWidth, nscoord aAvailHeight)
|
||||
{
|
||||
mAvailWidth = aAvailWidth;
|
||||
@ -117,10 +117,10 @@ nsCSSInlineLayout::SetReflowSpace(nscoord aX, nscoord aY,
|
||||
//XXX block children of inline frames needs handling *here*
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsCSSInlineLayout::ReflowAndPlaceFrame(nsIFrame* aFrame)
|
||||
nsInlineLayout::ReflowAndPlaceFrame(nsIFrame* aFrame)
|
||||
{
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
|
||||
("nsCSSInlineLayout::ReflowAndPlaceFrame: frame=%p x=%d",
|
||||
("nsInlineLayout::ReflowAndPlaceFrame: frame=%p x=%d",
|
||||
aFrame, mX));
|
||||
|
||||
// If the frame is a block frame and this is not the first frame on
|
||||
@ -131,7 +131,7 @@ nsCSSInlineLayout::ReflowAndPlaceFrame(nsIFrame* aFrame)
|
||||
const nsStylePosition* kidPosition;
|
||||
aFrame->GetStyleData(eStyleStruct_Position,
|
||||
(const nsStyleStruct*&) kidPosition);
|
||||
PRBool isBlock = nsCSSLineLayout::TreatFrameAsBlock(kidDisplay, kidPosition);
|
||||
PRBool isBlock = nsLineLayout::TreatFrameAsBlock(kidDisplay, kidPosition);
|
||||
if (isBlock && !IsFirstChild()) {
|
||||
return NS_INLINE_LINE_BREAK_BEFORE(0);/* XXX indicate never-reflowed? */
|
||||
}
|
||||
@ -142,7 +142,7 @@ nsCSSInlineLayout::ReflowAndPlaceFrame(nsIFrame* aFrame)
|
||||
nsMargin margin;
|
||||
if (!ComputeMaxSize(aFrame, margin, maxSize)) {
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
|
||||
("nsCSSInlineLayout::ReflowAndPlaceFrame: break-before"));
|
||||
("nsInlineLayout::ReflowAndPlaceFrame: break-before"));
|
||||
return NS_INLINE_LINE_BREAK_BEFORE(0);/* XXX indicate never-reflowed? */
|
||||
}
|
||||
|
||||
@ -198,7 +198,7 @@ nsCSSInlineLayout::ReflowAndPlaceFrame(nsIFrame* aFrame)
|
||||
// We are out of room.
|
||||
// XXX mKidPrevInFlow
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
|
||||
("nsCSSInlineLayout::ReflowAndPlaceFrame: !fit size=%d,%d",
|
||||
("nsInlineLayout::ReflowAndPlaceFrame: !fit size=%d,%d",
|
||||
metrics.width, metrics.height));
|
||||
|
||||
// XXX if the child requested a break and we need to break too...
|
||||
@ -213,7 +213,7 @@ nsCSSInlineLayout::ReflowAndPlaceFrame(nsIFrame* aFrame)
|
||||
|
||||
// XXX RTL
|
||||
PRBool
|
||||
nsCSSInlineLayout::IsFirstChild()
|
||||
nsInlineLayout::IsFirstChild()
|
||||
{
|
||||
if (mHaveBullet) {
|
||||
return mFrameNum < 2;
|
||||
@ -222,7 +222,7 @@ nsCSSInlineLayout::IsFirstChild()
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsCSSInlineLayout::ComputeMaxSize(nsIFrame* aFrame,
|
||||
nsInlineLayout::ComputeMaxSize(nsIFrame* aFrame,
|
||||
nsMargin& aKidMargin,
|
||||
nsSize& aResult)
|
||||
{
|
||||
@ -243,7 +243,7 @@ nsCSSInlineLayout::ComputeMaxSize(nsIFrame* aFrame,
|
||||
// XXX Make sure child is dirty for next time
|
||||
aFrame->WillReflow(*mLineLayout.mPresContext);
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
|
||||
("nsCSSInlineLayout::ComputeMaxSize: !fit"));
|
||||
("nsInlineLayout::ComputeMaxSize: !fit"));
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
@ -255,7 +255,7 @@ nsCSSInlineLayout::ComputeMaxSize(nsIFrame* aFrame,
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsCSSInlineLayout::ReflowFrame(nsIFrame* aKidFrame,
|
||||
nsInlineLayout::ReflowFrame(nsIFrame* aKidFrame,
|
||||
nsReflowMetrics& aMetrics,
|
||||
const nsReflowState& aReflowState,
|
||||
PRBool& aInlineAware)
|
||||
@ -316,19 +316,19 @@ nsCSSInlineLayout::ReflowFrame(nsIFrame* aKidFrame,
|
||||
// parent is not this because we are executing pullup code)
|
||||
nsIFrame* parent;
|
||||
aKidFrame->GetGeometricParent(parent);
|
||||
((nsCSSContainerFrame*)parent)->DeleteNextInFlowsFor(*mLineLayout.mPresContext,
|
||||
((nsHTMLContainerFrame*)parent)->DeleteNextInFlowsFor(*mLineLayout.mPresContext,
|
||||
aKidFrame);
|
||||
}
|
||||
}
|
||||
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
|
||||
("nsCSSInlineLayout::ReflowFrame: frame=%p reflowStatus=%x %saware",
|
||||
("nsInlineLayout::ReflowFrame: frame=%p reflowStatus=%x %saware",
|
||||
aKidFrame, rv, aInlineAware ? "" :"not "));
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsCSSInlineLayout::PlaceFrame(nsIFrame* aFrame,
|
||||
nsInlineLayout::PlaceFrame(nsIFrame* aFrame,
|
||||
nsRect& aFrameRect,
|
||||
const nsReflowMetrics& aFrameMetrics,
|
||||
const nsMargin& aFrameMargin,
|
||||
@ -383,7 +383,7 @@ nsCSSInlineLayout::PlaceFrame(nsIFrame* aFrame,
|
||||
}
|
||||
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
|
||||
("nsCSSInlineLayout::PlaceFrame: frame=%p {%d, %d, %d, %d}",
|
||||
("nsInlineLayout::PlaceFrame: frame=%p {%d, %d, %d, %d}",
|
||||
aFrame,
|
||||
aFrameRect.x, aFrameRect.y,
|
||||
aFrameRect.width, aFrameRect.height));
|
||||
@ -424,7 +424,7 @@ nsCSSInlineLayout::PlaceFrame(nsIFrame* aFrame,
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSInlineLayout::AlignFrames(nsIFrame* aFrame, PRInt32 aFrameCount,
|
||||
nsInlineLayout::AlignFrames(nsIFrame* aFrame, PRInt32 aFrameCount,
|
||||
nsRect& aBounds)
|
||||
{
|
||||
NS_PRECONDITION(aFrameCount == mFrameNum, "bogus reflow");
|
||||
@ -467,7 +467,7 @@ nsCSSInlineLayout::AlignFrames(nsIFrame* aFrame, PRInt32 aFrameCount,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsCSSInlineLayout::MaybeCreateNextInFlow(nsIFrame* aFrame,
|
||||
nsInlineLayout::MaybeCreateNextInFlow(nsIFrame* aFrame,
|
||||
nsIFrame*& aNextInFlowResult)
|
||||
{
|
||||
aNextInFlowResult = nsnull;
|
||||
@ -491,7 +491,7 @@ nsCSSInlineLayout::MaybeCreateNextInFlow(nsIFrame* aFrame,
|
||||
nextInFlow->SetNextSibling(nextFrame);
|
||||
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_NEW_FRAMES,
|
||||
("nsCSSInlineLayout::MaybeCreateNextInFlow: frame=%p nextInFlow=%p",
|
||||
("nsInlineLayout::MaybeCreateNextInFlow: frame=%p nextInFlow=%p",
|
||||
aFrame, nextInFlow));
|
||||
|
||||
aNextInFlowResult = nextInFlow;
|
@ -16,27 +16,27 @@
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
#ifndef nsCSSInlineLayout_h___
|
||||
#define nsCSSInlineLayout_h___
|
||||
#ifndef nsInlineLayout_h___
|
||||
#define nsInlineLayout_h___
|
||||
|
||||
#include "nsCSSContainerFrame.h"
|
||||
#include "nsHTMLContainerFrame.h"
|
||||
#include "nsIInlineReflow.h"
|
||||
class nsCSSLineLayout;
|
||||
class nsLineLayout;
|
||||
struct nsStyleDisplay;
|
||||
struct nsStyleFont;
|
||||
struct nsStyleText;
|
||||
|
||||
/**
|
||||
* This structure contains the horizontal layout state for line
|
||||
* layout frame placement. This is factored out of nsCSSLineLayout so
|
||||
* layout frame placement. This is factored out of nsLineLayout so
|
||||
* that the block layout code and the inline layout code can use
|
||||
* nsCSSLineLayout to reflow and place frames.
|
||||
* nsLineLayout to reflow and place frames.
|
||||
*/
|
||||
struct nsCSSInlineLayout {
|
||||
nsCSSInlineLayout(nsCSSLineLayout& aLineLayout,
|
||||
nsCSSContainerFrame* aContainerFrame,
|
||||
nsIStyleContext* aContainerStyle);
|
||||
~nsCSSInlineLayout();
|
||||
struct nsInlineLayout {
|
||||
nsInlineLayout(nsLineLayout& aLineLayout,
|
||||
nsContainerFrame* aContainerFrame,
|
||||
nsIStyleContext* aContainerStyle);
|
||||
~nsInlineLayout();
|
||||
|
||||
void Init(const nsReflowState* aContainerReflowState);
|
||||
|
||||
@ -79,8 +79,8 @@ struct nsCSSInlineLayout {
|
||||
nsresult MaybeCreateNextInFlow(nsIFrame* aFrame,
|
||||
nsIFrame*& aNextInFlowResult);
|
||||
|
||||
nsCSSLineLayout& mLineLayout;
|
||||
nsCSSContainerFrame* mContainerFrame;
|
||||
nsLineLayout& mLineLayout;
|
||||
nsContainerFrame* mContainerFrame;
|
||||
const nsStyleFont* mContainerFont;
|
||||
const nsStyleText* mContainerText;
|
||||
const nsStyleDisplay* mContainerDisplay;
|
||||
@ -109,4 +109,4 @@ struct nsCSSInlineLayout {
|
||||
nsIFrame* mNextRCFrame;
|
||||
};
|
||||
|
||||
#endif /* nsCSSInlineLayout_h___ */
|
||||
#endif /* nsInlineLayout_h___ */
|
118
layout/html/base/src/nsLineLayout.cpp
Normal file
118
layout/html/base/src/nsLineLayout.cpp
Normal file
@ -0,0 +1,118 @@
|
||||
/* -*- 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 "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsCSSLayout.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIStyleContext.h"
|
||||
|
||||
void
|
||||
nsTextRun::List(FILE* out, PRInt32 aIndent)
|
||||
{
|
||||
PRInt32 i;
|
||||
for (i = aIndent; --i >= 0; ) fputs(" ", out);
|
||||
PRInt32 n = mArray.Count();
|
||||
fprintf(out, "%p: count=%d <", this, n);
|
||||
for (i = 0; i < n; i++) {
|
||||
nsIFrame* text = (nsIFrame*) mArray.ElementAt(i);
|
||||
text->ListTag(out);
|
||||
printf(" ");
|
||||
}
|
||||
fputs(">\n", out);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsLineLayout::nsLineLayout(nsIPresContext* aPresContext,
|
||||
nsISpaceManager* aSpaceManager)
|
||||
{
|
||||
mPresContext = aPresContext;
|
||||
mSpaceManager = aSpaceManager;
|
||||
mListPositionOutside = PR_FALSE;
|
||||
mLineNumber = 0;
|
||||
mLeftEdge = 0;
|
||||
mColumn = 0;
|
||||
mSkipLeadingWS = PR_TRUE;
|
||||
|
||||
mTextRuns = nsnull;
|
||||
ResetTextRuns();
|
||||
}
|
||||
|
||||
nsLineLayout::~nsLineLayout()
|
||||
{
|
||||
nsTextRun::DeleteTextRuns(mTextRuns);
|
||||
}
|
||||
|
||||
void
|
||||
nsLineLayout::ResetTextRuns()
|
||||
{
|
||||
nsTextRun::DeleteTextRuns(mTextRuns);
|
||||
mTextRuns = nsnull;
|
||||
mTextRunP = &mTextRuns;
|
||||
mNewTextRun = nsnull;
|
||||
}
|
||||
|
||||
nsTextRun*
|
||||
nsLineLayout::TakeTextRuns()
|
||||
{
|
||||
nsTextRun* result = mTextRuns;
|
||||
mTextRuns = nsnull;
|
||||
ResetTextRuns();
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
nsLineLayout::EndTextRun()
|
||||
{
|
||||
mNewTextRun = nsnull;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsLineLayout::AddText(nsIFrame* aTextFrame)
|
||||
{
|
||||
if (nsnull == mNewTextRun) {
|
||||
mNewTextRun = new nsTextRun();
|
||||
if (nsnull == mNewTextRun) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
*mTextRunP = mNewTextRun;
|
||||
mTextRunP = &mNewTextRun->mNext;
|
||||
}
|
||||
mNewTextRun->mArray.AppendElement(aTextFrame);
|
||||
return NS_OK;/* XXX */
|
||||
}
|
||||
|
||||
// XXX move this somewhere else!!!
|
||||
PRBool
|
||||
nsLineLayout::TreatFrameAsBlock(const nsStyleDisplay* aDisplay,
|
||||
const nsStylePosition* aPosition)
|
||||
{
|
||||
if (NS_STYLE_POSITION_ABSOLUTE == aPosition->mPosition) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (NS_STYLE_FLOAT_NONE != aDisplay->mFloats) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
switch (aDisplay->mDisplay) {
|
||||
case NS_STYLE_DISPLAY_BLOCK:
|
||||
case NS_STYLE_DISPLAY_LIST_ITEM:
|
||||
case NS_STYLE_DISPLAY_TABLE:
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
135
layout/html/base/src/nsLineLayout.h
Normal file
135
layout/html/base/src/nsLineLayout.h
Normal file
@ -0,0 +1,135 @@
|
||||
/* -*- 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 "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef nsLineLayout_h___
|
||||
#define nsLineLayout_h___
|
||||
|
||||
#include "nsIFrame.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
struct nsBlockReflowState;
|
||||
class nsPlaceholderFrame;
|
||||
struct nsStyleDisplay;
|
||||
struct nsStylePosition;
|
||||
|
||||
// This structure represents a run of text. In mText are the
|
||||
// nsIFrame's that are considered text frames.
|
||||
struct nsTextRun {
|
||||
nsTextRun() {
|
||||
mNext = nsnull;
|
||||
}
|
||||
|
||||
static void DeleteTextRuns(nsTextRun* aRun) {
|
||||
while (nsnull != aRun) {
|
||||
nsTextRun* next = aRun->mNext;
|
||||
delete aRun;
|
||||
aRun = next;
|
||||
}
|
||||
}
|
||||
|
||||
void List(FILE* out, PRInt32 aIndent);
|
||||
|
||||
nsVoidArray mArray;
|
||||
nsTextRun* mNext;
|
||||
|
||||
protected:
|
||||
~nsTextRun() {
|
||||
}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class nsLineLayout {
|
||||
public:
|
||||
nsLineLayout(nsIPresContext* aPresContext,
|
||||
nsISpaceManager* aSpaceManager);
|
||||
~nsLineLayout();
|
||||
|
||||
void Init(nsBlockReflowState* aReflowState) {
|
||||
mBlockReflowState = aReflowState;
|
||||
}
|
||||
|
||||
// Reset the text-run information in preparation for a FindTextRuns
|
||||
void ResetTextRuns();
|
||||
|
||||
// Add another piece of text to a text-run during FindTextRuns.
|
||||
// Note: continuation frames must NOT add themselves; just the
|
||||
// first-in-flow
|
||||
nsresult AddText(nsIFrame* aTextFrame);
|
||||
|
||||
// Close out a text-run during FindTextRuns.
|
||||
void EndTextRun();
|
||||
|
||||
// This returns the first nsTextRun found during a
|
||||
// FindTextRuns. The internal text-run state is reset.
|
||||
nsTextRun* TakeTextRuns();
|
||||
|
||||
// Prepare this line-layout for the reflow of a new line
|
||||
void Prepare(nscoord aLeftEdge) {
|
||||
mLeftEdge = aLeftEdge;
|
||||
mColumn = 0;
|
||||
mSkipLeadingWS = PR_TRUE;
|
||||
}
|
||||
|
||||
PRInt32 GetColumn() {
|
||||
return mColumn;
|
||||
}
|
||||
|
||||
void SetColumn(PRInt32 aNewColumn) {
|
||||
mColumn = aNewColumn;
|
||||
}
|
||||
|
||||
void NextLine() {
|
||||
mLineNumber++;
|
||||
}
|
||||
|
||||
void AddFloater(nsPlaceholderFrame* aFrame);
|
||||
|
||||
static PRBool TreatFrameAsBlock(const nsStyleDisplay* aDisplay,
|
||||
const nsStylePosition* aPosition);
|
||||
|
||||
nsIPresContext* mPresContext;
|
||||
nsISpaceManager* mSpaceManager;
|
||||
nsBlockReflowState* mBlockReflowState;
|
||||
|
||||
PRBool mListPositionOutside;
|
||||
PRInt32 mLineNumber;
|
||||
nscoord mLeftEdge;
|
||||
PRInt32 mColumn;
|
||||
|
||||
//XXX temporary?
|
||||
|
||||
void SetSkipLeadingWhiteSpace(PRBool aNewSetting) {
|
||||
mSkipLeadingWS = aNewSetting;
|
||||
}
|
||||
PRBool GetSkipLeadingWhiteSpace() { return mSkipLeadingWS; }
|
||||
|
||||
PRBool mSkipLeadingWS;
|
||||
|
||||
protected:
|
||||
// These slots are used during FindTextRuns
|
||||
nsTextRun* mTextRuns;
|
||||
nsTextRun** mTextRunP;
|
||||
nsTextRun* mNewTextRun;
|
||||
|
||||
// These slots are used during InlineReflow
|
||||
nsTextRun* mReflowTextRuns;
|
||||
nsTextRun* mTextRun;
|
||||
};
|
||||
|
||||
#endif /* nsLineLayout_h___ */
|
@ -25,7 +25,7 @@
|
||||
#include "nsIView.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsCSSBlockFrame.h"
|
||||
#include "nsBlockFrame.h"
|
||||
|
||||
nsresult
|
||||
nsPlaceholderFrame::NewFrame(nsIFrame** aInstancePtrResult,
|
||||
@ -73,14 +73,15 @@ nsPlaceholderFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlaceholderFrame::FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
nsPlaceholderFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
{
|
||||
aLineLayout.EndTextRun();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlaceholderFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
nsPlaceholderFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aDesiredSize,
|
||||
const nsReflowState& aReflowState)
|
||||
{
|
||||
|
@ -41,9 +41,9 @@ public:
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
// nsIFrame overrides
|
||||
NS_IMETHOD FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aDesiredSize,
|
||||
const nsReflowState& aReflowState);
|
||||
NS_IMETHOD Paint(nsIPresContext& aPresContext,
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsFrame.h"
|
||||
#include "nsIInlineReflow.h"
|
||||
#include "nsCSSLineLayout.h"
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
@ -41,9 +41,9 @@ public:
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
// nsIInlineReflow
|
||||
NS_IMETHOD FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aDesiredSize,
|
||||
const nsReflowState& aReflowState);
|
||||
|
||||
@ -90,7 +90,7 @@ SpacerFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SpacerFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
SpacerFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
const nsReflowState& aReflowState)
|
||||
{
|
||||
@ -165,7 +165,7 @@ SpacerFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SpacerFrame::FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
SpacerFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
{
|
||||
aLineLayout.EndTextRun();
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "nsCRT.h"
|
||||
#include "nsSplittableFrame.h"
|
||||
#include "nsIInlineReflow.h"
|
||||
#include "nsCSSLineLayout.h"
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
@ -143,11 +143,11 @@ public:
|
||||
PRUint32& aAcutalContentOffset);
|
||||
|
||||
// nsIInlineReflow
|
||||
NS_IMETHOD FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
|
||||
NS_IMETHOD InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
const nsReflowState& aReflowState);
|
||||
|
||||
// TextFrame methods
|
||||
@ -184,13 +184,13 @@ public:
|
||||
nscolor aSelectionBGColor,
|
||||
nscoord dx, nscoord dy);
|
||||
|
||||
nsInlineReflowStatus ReflowPre(nsCSSLineLayout& aLineLayout,
|
||||
nsInlineReflowStatus ReflowPre(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsStyleFont& aFont,
|
||||
PRInt32 aStartingOffset);
|
||||
|
||||
nsInlineReflowStatus ReflowNormal(nsCSSLineLayout& aLineLayout,
|
||||
nsInlineReflowStatus ReflowNormal(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsStyleFont& aFontStyle,
|
||||
@ -1081,7 +1081,7 @@ TextFrame::PaintAsciiText(nsIPresContext& aPresContext,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TextFrame::FindTextRuns(nsCSSLineLayout& aLineLayout,
|
||||
TextFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
{
|
||||
if (nsnull == mPrevInFlow) {
|
||||
@ -1214,7 +1214,7 @@ TextFrame::GetPosition(nsIPresContext& aCX,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TextFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
TextFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
const nsReflowState& aReflowState)
|
||||
{
|
||||
@ -1267,7 +1267,7 @@ TextFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
// tabs). Normal text reflow may or may not wrap depending on the
|
||||
// "whiteSpace" style property.
|
||||
nsInlineReflowStatus
|
||||
TextFrame::ReflowNormal(nsCSSLineLayout& aLineLayout,
|
||||
TextFrame::ReflowNormal(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsStyleFont& aFont,
|
||||
@ -1441,7 +1441,7 @@ TextFrame::ReflowNormal(nsCSSLineLayout& aLineLayout,
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
TextFrame::ReflowPre(nsCSSLineLayout& aLineLayout,
|
||||
TextFrame::ReflowPre(nsLineLayout& aLineLayout,
|
||||
nsReflowMetrics& aMetrics,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsStyleFont& aFont,
|
||||
|
@ -93,7 +93,7 @@ include $(DEPTH)/config/config.mk
|
||||
|
||||
LCFLAGS += -D_IMPL_NS_HTML
|
||||
|
||||
INCLUDES += -I../../style/src -I../../../base/src -I../../../css/layout/src \
|
||||
INCLUDES += -I../../style/src -I../../../base/src \
|
||||
-I../../base/src
|
||||
|
||||
MKSLIB :=
|
||||
|
@ -154,7 +154,7 @@ CPP_OBJS= \
|
||||
|
||||
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\js \
|
||||
-I$(PUBLIC)\dom -I$(PUBLIC)\netlib \
|
||||
-I..\..\style\src -I..\..\..\css\layout\src \
|
||||
-I..\..\style\src \
|
||||
-I..\..\..\base\src -I..\..\base\src
|
||||
|
||||
LCFLAGS = \
|
||||
|
@ -53,8 +53,8 @@
|
||||
#include "nsString.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsDOMEventsIIDs.h"
|
||||
#include "nsCSSBlockFrame.h"
|
||||
#include "nsCSSInlineFrame.h"
|
||||
#include "nsBlockFrame.h"
|
||||
#include "nsInlineFrame.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
@ -1884,11 +1884,11 @@ nsGenericHTMLElement::CreateFrame(nsIPresContext* aPresContext,
|
||||
switch (styleDisplay->mDisplay) {
|
||||
case NS_STYLE_DISPLAY_BLOCK:
|
||||
case NS_STYLE_DISPLAY_LIST_ITEM:
|
||||
rv = NS_NewCSSBlockFrame(&frame, mContent, aParentFrame);
|
||||
rv = NS_NewBlockFrame(&frame, mContent, aParentFrame);
|
||||
break;
|
||||
|
||||
case NS_STYLE_DISPLAY_INLINE:
|
||||
rv = NS_NewCSSInlineFrame(&frame, mContent, aParentFrame);
|
||||
rv = NS_NewInlineFrame(&frame, mContent, aParentFrame);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -39,7 +39,7 @@ CPPSRCS = \
|
||||
MODULE = raptor
|
||||
|
||||
INCLUDES += -I../../../base/src -I../../base/src -I../../style/src \
|
||||
-I../../../css/layout/src -I../../content/src
|
||||
-I../../content/src
|
||||
|
||||
REQUIRES = xpcom raptor dom netlib js
|
||||
|
||||
|
@ -35,7 +35,7 @@ CPP_OBJS=.\$(OBJDIR)\nsForm.obj .\$(OBJDIR)\nsInput.obj \
|
||||
|
||||
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\js \
|
||||
-I$(PUBLIC)\dom -I$(PUBLIC)\netlib \
|
||||
-I..\..\base\src -I..\..\style\src -I..\..\..\css\layout\src \
|
||||
-I..\..\base\src -I..\..\style\src \
|
||||
-I..\..\..\base\src -I..\..\content\src
|
||||
|
||||
LCFLAGS = \
|
||||
|
@ -1089,14 +1089,14 @@ NS_IMETHODIMP HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
|
||||
switch (styleDisplay->mDisplay) {
|
||||
case NS_STYLE_DISPLAY_BLOCK:
|
||||
case NS_STYLE_DISPLAY_LIST_ITEM:
|
||||
rv = NS_NewCSSBlockFrame(&frame, aContent, aParentFrame);
|
||||
rv = NS_NewBlockFrame(&frame, aContent, aParentFrame);
|
||||
|
||||
// Process the child content
|
||||
ProcessChildren(aPresContext, frame, aContent, childList);
|
||||
break;
|
||||
|
||||
case NS_STYLE_DISPLAY_INLINE:
|
||||
rv = NS_NewCSSInlineFrame(&frame, aContent, aParentFrame);
|
||||
rv = NS_NewInlineFrame(&frame, aContent, aParentFrame);
|
||||
|
||||
// Process the child content
|
||||
ProcessChildren(aPresContext, frame, aContent, childList);
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "nsSplittableFrame.h"
|
||||
#include "nsIContentDelegate.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsCSSInlineFrame.h"
|
||||
#include "nsInlineFrame.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
static NS_DEFINE_IID(kIContentDelegateIID, NS_ICONTENTDELEGATE_IID);
|
||||
@ -187,7 +187,7 @@ void FixedSizeContent::ToHTML(nsString& out)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
class InlineFrame : public nsCSSInlineFrame
|
||||
class InlineFrame : public nsInlineFrame
|
||||
{
|
||||
public:
|
||||
InlineFrame(nsIContent* aContent,
|
||||
@ -205,7 +205,7 @@ public:
|
||||
|
||||
InlineFrame::InlineFrame(nsIContent* aContent,
|
||||
nsIFrame* aParent)
|
||||
: nsCSSInlineFrame(aContent, aParent)
|
||||
: nsInlineFrame(aContent, aParent)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,6 @@ LINCS= \
|
||||
|
||||
LLIBS= \
|
||||
$(DIST)\lib\raptorhtmlbase_s.lib \
|
||||
$(DIST)\lib\nglcsslay_s.lib \
|
||||
$(DIST)\lib\nglhtmlcon_s.lib \
|
||||
$(DIST)\lib\raptorhtmldoc_s.lib \
|
||||
$(DIST)\lib\raptorhtmlstyle_s.lib \
|
||||
|
@ -17,6 +17,6 @@
|
||||
|
||||
DEPTH=..
|
||||
|
||||
DIRS=base css html events build
|
||||
DIRS=base html events build
|
||||
|
||||
include <$(DEPTH)\layout\config\rules.mak>
|
||||
|
@ -1089,14 +1089,14 @@ NS_IMETHODIMP HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
|
||||
switch (styleDisplay->mDisplay) {
|
||||
case NS_STYLE_DISPLAY_BLOCK:
|
||||
case NS_STYLE_DISPLAY_LIST_ITEM:
|
||||
rv = NS_NewCSSBlockFrame(&frame, aContent, aParentFrame);
|
||||
rv = NS_NewBlockFrame(&frame, aContent, aParentFrame);
|
||||
|
||||
// Process the child content
|
||||
ProcessChildren(aPresContext, frame, aContent, childList);
|
||||
break;
|
||||
|
||||
case NS_STYLE_DISPLAY_INLINE:
|
||||
rv = NS_NewCSSInlineFrame(&frame, aContent, aParentFrame);
|
||||
rv = NS_NewInlineFrame(&frame, aContent, aParentFrame);
|
||||
|
||||
// Process the child content
|
||||
ProcessChildren(aPresContext, frame, aContent, childList);
|
||||
|
Loading…
x
Reference in New Issue
Block a user