Change 20100423-ptw-i by [email protected] on 2010-04-23 19:59:54 EDT
in /Users/ptw/OpenLaszlo/trunk-test
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Add support for dynamic CSS attribute bindings
Bugs Fixed: LPP-7359 - Make CSS attribute selectors dynamic
Technical Reviewer: max
QA Reviewer: hminsky
Release Notes:
CSS attribute selectors now automatically update when the value of
an attribute specified by the selector changes. E.g.:
button[mouse=down]
will listen for changes to the 'mouse' attribute and will only
apply when button.mouse == 'down'.
Overview:
Building on Max's pioneering efforts, I've simplified a little and
gotten compound dynamic selectors to work. The second test case
in LPP-7359 shows an example of multiple compound dynamic
selectors implementing a color blender.
Details:
LzCSSStyle: Add a new helper class for accumulating style
dependencies. In rule gathering, gather _all_ attr rules, since
we don't know which values will hold at apply time. When
determining applicability, gather all dependencies, but only
return the currently applicable rule. Compound rules need to
gather dependencies all along the rule chain, whether they apply
or not (because the dependency might make them applicable). When
there are dependencies, install a constraint to cause the rules
and properties to be recalculated.
LzDebug: Use the new standard CSS prop list to explain styles.
LzNode: Per Max's change, we accumulate the CSS props and types
that will style attributes (don't need the gather them just for
debugging any more, since we always are). Two new methods to
install the style dependencies and reapply the styles when they
change. For now, simplified to just re-apply all style bindings,
since there are few -- we can tune this later. Have to rebuild
both rules and props cache, because only the rules code
understands compound applicability test.
Tests:
See the two test cases attached to LPP-7359,
test/style/metasuite.lzx?debug=true, smokecheck across runtimes.
Examine the output of Debug.explainStyleBindings(testview) for the
complex case and verify that the compound rule takes precedence
over the simple rules.
Files:
M WEB-INF/lps/lfc/services/LzCSSStyle.lzs
M WEB-INF/lps/lfc/debugger/LzDebug.lzs
M WEB-INF/lps/lfc/core/LzNode.lzs
Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20100423-ptw-i.tar