Sounds good. I'll look into that. Here's another conundrum: CSS breaks fontstyle out into font-style and font-weight, but we overload them into one value, e.g. bolditalic. Maybe the best approach is to add a fontweight setter for CSS and have that combine with fontstyle as we have it now - but that could lead to results like 'bolditalicbold', hmm...
In any case, there isn't always going to be a 1-to-one mapping between CSS styles and LZX attributes. Some CSS attributes combine multiple values into one, e.g. box-shadow: 10px 10px 5px #888; padding: 5px 5px 5px 15px; - which would need to map to separate LZX attributes. This seems more straightforward - it can be done with a CSS parser and setter that breaks out the discreet values... P T Withington wrote: > I think I can adjust the warning only to be output when there is no > fallback. > > Or we could turn it off altogether. I put it in for wt when they could > not tell why their styles were not working, but now there is a debugger > 'explainStyles' API that serves that purpose. > > On Oct 8, 2009, at 20:05, Max Carlson <[email protected]> wrote: > >> I tried, and it does work - mostly. There are some issues with >> constraints failing, and the debugger warns all over the place for >> styles that don't match - we probably only want to only warn for 'user >> created' styles or something like that. I'll keep digging into the >> constraint issue... >> >> P T Withington wrote: >>> I leave it up to you to try actually adding some defaults and see if >>> this actually works! >>>> attributes.bgcolor = new LzStyleConstraintExpr('bgcolor', >>>> 'background-color', 'color', null)'; >>> On 2009-10-07, at 23:09, Max Carlson wrote: >>>> Approved! This is good stuff! >>>> >>>> P T Withington wrote: >>>>> Change 20091007-ptw-x by [email protected] on 2009-10-07 17:38:08 EDT >>>>> in /Users/ptw/OpenLaszlo/trunk-2 >>>>> for http://svn.openlaszlo.org/openlaszlo/trunk >>>>> Summary: Implement a simple mechanism for constant style bindings >>>>> New Features: >>>>> With this change, it should be possible to define default style >>>>> bindings for LFC classes by saying (for example): >>>>> attributes.bgcolor = new LzStyleConstraintExpr('bgcolor', >>>>> 'background-color', 'color', null)'; >>>>> Which says that the `bgcolor` attribute will be styled by the CSS >>>>> `background-color` property, that the attribute is of type `color` >>>>> and that the default, if there is no CSS style, is `null`. >>>>> Instances and subclasses can override this style binding using the >>>>> normal mechanisms. >>>>> Bugs Fixed: >>>>> Technical Reviewer: max (pending) >>>>> QA Reviewer: hminsky (pending) >>>>> Doc Reviewer: (pending) >>>>> Details: >>>>> Create a simpler mechanism for style bindings that have constant >>>>> CSS property names. A new subclass of constraint-expr is used to >>>>> encode this and is applied specially by applyConstraint. This >>>>> eliminates the need to create a separate binding method for every >>>>> styled attribute in a class. >>>>> Tests: >>>>> test/style/metasuite has the same 2 errors as before >>>>> Inspecting the output of the compiler shows a savings of about 12% >>>>> in the DHTML case. >>>>> Files: >>>>> M WEB-INF/lps/lfc/services/LzCSSStyle.lzs >>>>> M WEB-INF/lps/lfc/core/LzNode.lzs >>>>> M WEB-INF/lps/lfc/core/LzDefs.lzs >>>>> M WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java >>>>> Changeset: >>>>> http://svn.openlaszlo.org/openlaszlo/patches/20091007-ptw-x.tar >>>> >>>> -- >>>> Regards, >>>> Max Carlson >>>> OpenLaszlo.org >> >> -- >> Regards, >> Max Carlson >> OpenLaszlo.org -- Regards, Max Carlson OpenLaszlo.org _______________________________________________ Laszlo-reviews mailing list [email protected] http://www.openlaszlo.org/mailman/listinfo/laszlo-reviews
