Approved, since this is blocking people, but I have some questions/ 
suggestions on StyleSheetCompiler:

1) You have several (TODO) comments which you seem to have already  
done.  I highly encourage you to use our conventional notation to  
make these more accurate and easier to find:

   TODO: [2006-09-21 ben] (LPP-2638) Read stylesheet from file

and to remove when the Jira bug is resolved. :)

2) Is there a reason you did not use the FileResolver that is used  
for other src and href attributes to resolve the href for stylesheets?

3) Is it really an error to have an empty stylesheet?  That would  
seem to be only worth a warning to me.  Hm, I see you are catching  
all the style sheet errors and just logging them.  That doesn't seem  
quite right either.  I would think that you would really want to  
signal an error if your style sheet path or content is invalid.

4) You could fix "TODO: move this out out global scope [bshine  
9.17.06]" by simply wrapping your script in a function that is  
immediately evaluated:

     mEnv.compileScript("(function () {" + script + "})()");

5) You'll want to look at ScriptCompiler.writeObject.  Basically,  
this will turn a Java Map or List into (a string representation of) a  
Javascript Object or Array.  This will save you a lot of string  
manipulation, let you accumulate your selectors and properties more  
naturally in Java and simplify your code.

On 2006-09-18, at 19:42 EDT, Benjamin Shine wrote:

> <patch.ben.fkSY.tgz>
>
> Change change.XXXXXXXXX.HsDQbQRS.txt by [EMAIL PROTECTED] /Users/ben/ 
> src/svnchanges/ on 2006-09-18 12:16:42 PDT
>
> Summary: Add support for external stylesheet files. Refactored  
> CSSHandler, put guts of style sheet compilation into  
> StyleSheetCompiler.
>
> New Features: stylesheet tag can reference external file, multiple  
> stylesheet tags allowed
>
> Bugs Fixed: LPP-2638 <stylesheet> tag should have src= attribute
>
> Technical Reviewer: wolff (in person), ptw (pending)
> QA Reviewer: mgregor (pending)
> Doc Reviewer: frisco (pending)
>
> Documentation:
> The stylesheet tag can either link to an external file, or specify the
> stylesheet inline. See test/style/stylesheetelement-test.lzx for  
> examples
> of each usage.
>
> Release Notes:
>
> Details:
> Previously, CSSHandler was a singleton. This only worked really  
> correctly when there was just one stylesheet. We now want to  
> support multiple stylesheet tags and external stylesheets; to meet  
> this requirement, I refactored CSSHandler into a temporary utility  
> object to parse CSS.
>
> Most of the work of emitting script to build runtime css objects  
> has been moved into StyleSheetCompiler.java. Now the stylesheet  
> element works more like other elements; when the compiler hits a  
> stylesheet element, it parses it and immediately writes script for  
> it. This makes the implementation more flexible; it supports  
> mulitple external and inline stylesheets, while preserving lexical  
> order.
>
> Extraneous support for compile-time CSS was removed from  
> CSSHandler.java; there had been lots of leftover code in it from  
> the which has not been used since we moved away from CSS-as- 
> preprocessor.
>
> I removed the cssfile attribute from canvas, and updated all the  
> tests to work with this change.
>
> This work was undertaken specifically to support diamond developer  
> requests.
>
> Tests:
> http://localhost:8080/trunk-csscompiler/test/style/compiler/ 
> stylesheetelement-test.lzx?debug=true
> http://localhost:8080/trunk-csscompiler/test/style/compiler/ 
> external-only.lzx?debug=true
> http://localhost:8080/trunk-csscompiler/test/style/constraints/ 
> constraint-test.lzx?debug=true
> http://localhost:8080/trunk-csscompiler/test/style/specificity/ 
> applicability.lzx?debug=true
> http://localhost:8080/trunk-csscompiler/test/style/errors/ 
> badcanvasattr.lzx (expected compiler warning)
> http://localhost:8080/trunk-csscompiler/test/style/errors/ 
> cssfilenotfound.lzx (expected compiler error)
>
> Files:
> M      test/style/elementselector/main.lzx
> M      test/style/idselector/main.lzx
> M      test/style/descendantselector/descendantselector-test.lzx
> A      test/style/compiler/external1.css
> A      test/style/compiler/external2.css
> M      test/style/compiler/stylesheetelement-test.lzx
> A      test/style/compiler/external-only.lzx
> M      test/style/errors/cssfilenotfound.lzx
> M      WEB-INF/lps/server/src/org/openlaszlo/css/CSSHandler.java
> M      WEB-INF/lps/server/src/org/openlaszlo/compiler/ 
> CanvasCompiler.java
> M      WEB-INF/lps/server/src/org/openlaszlo/compiler/ 
> CompilationEnvironment.java
> M      WEB-INF/lps/server/src/org/openlaszlo/compiler/Compiler.java
> M      WEB-INF/lps/server/src/org/openlaszlo/compiler/ 
> StyleSheetCompiler.java


_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to