You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Ricky Panaglucci <hi...@yahoo.co.uk> on 2004/04/27 14:23:13 UTC

CSSEngine internals

Hello,

I am in the process of extending CSSEngine for use
with html and need some help with its internals.

1. if a ShorthandedManager is invoked - how is it
possible to get a reference (from within setValues) to
the current element/node? 
setValues is called from 5 places within CSSEngine,
most or all of them are inner *handler classes where I
also cannot find the element.  

2. the following definition (for html)
{  border-color: red;
  border-left: dotted;
  color: blue }

must result in a red border with a blue left side.
Due to 1. I cannot check, but I assume that during
evaluation of the shorthanded border-left the "color"
property has not been computed yet. So my solution
would be to evaluate an element twice - how can this 
be done?

thank you,
Ricky


	
	
		
____________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Re: CSSEngine internals

Posted by Ricky Panaglucci <hi...@yahoo.co.uk>.
glen,
thank you for 1.
regarding 2. - I was merely trying to resolve
shorthanded properties and found a solution using
computeValue in the meantime
I will have a look at FOP also...

regards,
ricky

 --- Glen Mazza <gr...@yahoo.com> wrote: > Hello
Ricky,
> 
> ----- Original Message ----- 
> > 1. if a ShorthandedManager is invoked - how is it
> > possible to get a reference (from within
> setValues) to
> > the current element/node?
> > setValues is called from 5 places within
> CSSEngine,
> > most or all of them are inner *handler classes
> where I
> > also cannot find the element.
> >
> 
> Since setValues() has an instance of CSSEngine, you
> should be able to use
> that instance to call the getDocument() accessor
> (line 545 of [1],
> referencing the Document member variable at line
> 178.)  Once you have the
> document object, you can probably then get to the
> element via
> document.getDocumentElement()  (Look at the
> disposeStyleMaps argument at
> line 496 of [1] for an example.)
> 
> [1]
>
http://cvs.apache.org/viewcvs.cgi/xml-batik/sources/org/apache/batik/css/engine/CSSEngine.java?annotate=1.37
> 
> 
> > 2. the following definition (for html)
> > {  border-color: red;
> >   border-left: dotted;
> >   color: blue }
> >
> > must result in a red border with a blue left side.
> > Due to 1. I cannot check, but I assume that during
> > evaluation of the shorthanded border-left the
> "color"
> > property has not been computed yet. So my solution
> > would be to evaluate an element twice - how can
> this
> > be done?
> >
> 
> This is a bit outside my scope of knowledge--CSS
> Border conflict resolution
> [2] is quite complex.  However, on the Apache FOP
> team, we do property
> processing that may be vaguely similar to what you 
> need to do ([3], lines
> 355-431).  [Note:  FOP has *not* yet implemented the
> border conflict
> resolution scheme.]
> 
> Basically, there is a chance you may not need a
> "second pass" for
> evaluation, if you can come up with a shorthand data
> structure divided out
> into its components that is initialized when either
> (a) the shorthand or (b)
> one of its components comes up first in the
> processing.  You would just
> initialize this data structure differently depending
> on which property first
> appears.  When the other property occurs, then you
> would update the same
> data structure.
> 
> I don't know if this will work, however, and this is
> just a shot in the dark
> to your question--I wouldn't be surprised if it had
> little relevance to your
> needs.
> 
> HTH,
> Glen
> 
> [2]
>
http://www.w3.org/TR/REC-CSS2/tables.html#border-conflict-resolution
> 
> [3]
>
http://cvs.apache.org/viewcvs.cgi/xml-fop/src/java/org/apache/fop/fo/PropertyList.java?annotate=1.31
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> batik-dev-help@xml.apache.org
>  


	
	
		
____________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Re: CSSEngine internals

Posted by Glen Mazza <gr...@yahoo.com>.
Hello Ricky,

----- Original Message ----- 
> 1. if a ShorthandedManager is invoked - how is it
> possible to get a reference (from within setValues) to
> the current element/node?
> setValues is called from 5 places within CSSEngine,
> most or all of them are inner *handler classes where I
> also cannot find the element.
>

Since setValues() has an instance of CSSEngine, you should be able to use
that instance to call the getDocument() accessor (line 545 of [1],
referencing the Document member variable at line 178.)  Once you have the
document object, you can probably then get to the element via
document.getDocumentElement()  (Look at the disposeStyleMaps argument at
line 496 of [1] for an example.)

[1]
http://cvs.apache.org/viewcvs.cgi/xml-batik/sources/org/apache/batik/css/engine/CSSEngine.java?annotate=1.37


> 2. the following definition (for html)
> {  border-color: red;
>   border-left: dotted;
>   color: blue }
>
> must result in a red border with a blue left side.
> Due to 1. I cannot check, but I assume that during
> evaluation of the shorthanded border-left the "color"
> property has not been computed yet. So my solution
> would be to evaluate an element twice - how can this
> be done?
>

This is a bit outside my scope of knowledge--CSS Border conflict resolution
[2] is quite complex.  However, on the Apache FOP team, we do property
processing that may be vaguely similar to what you  need to do ([3], lines
355-431).  [Note:  FOP has *not* yet implemented the border conflict
resolution scheme.]

Basically, there is a chance you may not need a "second pass" for
evaluation, if you can come up with a shorthand data structure divided out
into its components that is initialized when either (a) the shorthand or (b)
one of its components comes up first in the processing.  You would just
initialize this data structure differently depending on which property first
appears.  When the other property occurs, then you would update the same
data structure.

I don't know if this will work, however, and this is just a shot in the dark
to your question--I wouldn't be surprised if it had little relevance to your
needs.

HTH,
Glen

[2] http://www.w3.org/TR/REC-CSS2/tables.html#border-conflict-resolution

[3]
http://cvs.apache.org/viewcvs.cgi/xml-fop/src/java/org/apache/fop/fo/PropertyList.java?annotate=1.31


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org