RE: area tree questions

2003-10-11 Thread Victor Mote
J.Pietschmann wrote:

> Victor Mote wrote:
> > Since this is
> > information that is useful only during layout, perhaps this
> change was made
> > to make the Area Tree more lean (i.e. use less memory)?
>
> IIRC it was made to allow areas GC'd early. In the maintenance branch,
> if something keeps a reference to an area, like tables did, the tree
> for the whole page is kept until the page sequence ends and the whole
> FO subtree can be reclaimed.
> However, the parent pointer isn't always set properly, for example
> line areas may not set it (fortunately, because basic-link keeps a
> reference to the line).

Some of that makes sense, and some sounds like stuff that just needs to be
fixed. In any event, I understand the desire to keep the area tree lean.

> > In both cases, the maintenance branch seems more correct to my
> naive eye.
> Uh, duh :-)

Hmmm. I don't know what this means.

> > Is there any enthusiasm for a lowest-common-denominator
> approach to the area
> > tree?
> No. I'd rather have the bugs in HEAD fixed. Then refactor the Area
> heirarchy (factoring out a bordered area, for example), and get a
> more efficient representation for words.

>From my perspective, the first item is not really an option, yet. FWIW, it
is actually third on my list, after 1) PionerLS (and finally killing the
maintenance branch), and 2) fonts.

> > I am contemplating adding a
> > "shadow" concept to the FO Tree that would allow a layout
> system to store
> > data in an object that has a one-to-one relationship with a
> node in the FO
> > Tree.
> The bad news is there are areas not corresponding to FOs.

I didn't do a good job of explaining this. What I am looking at /
experimenting with is two separate "shadow" object concepts, one for FONode
and one for Area. (There is no GoF Shadow pattern -- the closest that I can
see is Decoration, and that is not it.) Each of these shadow concepts would
have a null interface, and each FONode and Area subclass would have exactly
one pointer to a shadow object conforming to the respective interface.
Implementations of the interface would belong to the LayoutStrategy, and
would be used to expand the respective tree objects. When a page is
completed, the related Area shadows can be discarded (even before the Areas
themselves have been). When a page sequence is completed any shadow objects
attached to it can be discarded as well. This gives LayoutStrategies a place
to store data that they may need without forcing either FOTree or AreaTree
to know anything or do anything about it. The only costs to the non-layout
portion of FOP is 1) the cost of the memory for the pointer in each FONode
and Area object, and 2) the cost of traversing the tree fragments and
discarding any shadow objects that exist. I think these costs are acceptable
for the additional flexibility. Of course, for LayoutStrategies that wish to
use them, there are additional costs, but those are tradeoffs anyway. The
LayoutManager LS goes through and creates a bunch of LM objects instead.

I am not entirely sure yet whether the above idea is feasible. The issue
that I haven't worked through yet is dealing with subclass differences,
e.g., if I need fo.flow.Block to have additional items stored that FONode
doesn't need, or InlineArea to have items that Area doesn't. I think our
already implemented Visitor patterns can help us with these issues. I'll
know more shortly. In the meantime, if you and Glen and anyone else paying
attention would care to comment on whether the above ideas are acceptable or
not, that would be appreciated. If they are *not*, then I believe bringing
the PioneerLS into the trunk is not feasible, and I will abandon it.

Victor Mote



Re: area tree questions

2003-10-10 Thread J.Pietschmann
Victor Mote wrote:
Since this is
information that is useful only during layout, perhaps this change was made
to make the Area Tree more lean (i.e. use less memory)?
IIRC it was made to allow areas GC'd early. In the maintenance branch,
if something keeps a reference to an area, like tables did, the tree
for the whole page is kept until the page sequence ends and the whole
FO subtree can be reclaimed.
However, the parent pointer isn't always set properly, for example
line areas may not set it (fortunately, because basic-link keeps a
reference to the line).
In both cases, the maintenance branch seems more correct to my naive eye.
Uh, duh :-)

Is there any enthusiasm for a lowest-common-denominator approach to the area
tree?
No. I'd rather have the bugs in HEAD fixed. Then refactor the Area
heirarchy (factoring out a bordered area, for example), and get a
more efficient representation for words.
I am contemplating adding a
"shadow" concept to the FO Tree that would allow a layout system to store
data in an object that has a one-to-one relationship with a node in the FO
Tree.
The bad news is there are areas not corresponding to FOs.

J.Pietschmann



RE: area tree questions

2003-10-10 Thread Victor Mote
Please disregard my previous message under this thread. After working on
this a bit more, I think I just need to do more homework here.

Victor Mote



area tree questions

2003-10-10 Thread Victor Mote
I think Joerg already said this, but it appears that the main challenge to
completing a port of the maintenance branch layout to the trunk will be a
reconciliation of the differences between the two area trees. Since we don't
have a fully-functional layout system using either of the two models, I have
several questions along these lines that I hope one of the veterans can
answer:

1. image/ImageArea in the maintenance branch subclasses InlineArea.
area/inline/Image (which appears to be the equivalent trunk class)
subclasses Area (even though it is in the inline package).

2. layout/Area in the maintenance branch stores a parent (through its
superclass Box) which (along with pointers to children) ties the AreaTree
together. It also stores a generatedBy variable, which I think points to the
FObj which generated it. Both of these seem to be missing in the trunk. I
haven't spent a lot of time digging into this yet, but it looks like the
LayoutManagers may be storing this information in the trunk. Since this is
information that is useful only during layout, perhaps this change was made
to make the Area Tree more lean (i.e. use less memory)?

In both cases, the maintenance branch seems more correct to my naive eye.
However, I admit I have much to learn about the two area trees and layout
systems.

Is there any enthusiasm for a lowest-common-denominator approach to the area
tree? In other words, to add back some of the variables to accommodate the
Pioneer layout system? I am not eager to clutter it up, but I think some
modest retrofits will keep this moving forward, and we can always factor
them back out later if we think it is useful and convenient. I am eager
enough to get all of our problems in one pile that I think it is worth it to
create some modest-sized ones to get that done. I am contemplating adding a
"shadow" concept to the FO Tree that would allow a layout system to store
data in an object that has a one-to-one relationship with a node in the FO
Tree. Something similar could be done with the Area Tree, with the data
essential to rendering stored in one and the layout-oriented data in the
other, which can be jettisoned when layout is done, to save memory.

Victor Mote