Permalink
Browse files

#23 write out delta rules, and find them in cascade

  • Loading branch information...
1 parent 9100a25 commit 99991bc984deff239c9182be86e06c15ef401b99 @billreed63 billreed63 committed Apr 24, 2012
@@ -164,7 +164,7 @@ return declare("davinci.ve.ThemeModifier", null, {
for (var r = 0; r < rules.length; r++){
var rule = rules[r];
- var file = rule.searchUp( "CSSFile");
+ //var file = rule.searchUp( "CSSFile"); #23
var rebasedValues; // = dojo.clone(values);
if (values.length < 1) {
rebasedValues = [];
@@ -190,7 +190,9 @@ return declare("davinci.ve.ThemeModifier", null, {
allPropValues.push(o)
//}
}
+ rule = this.getDeltaRule(rule); // create delta if needed #23
context.modifyRule(rule, allPropValues);
+ var file = rule.searchUp( "CSSFile"); //#23
this._markDirty(file.url);
propertiesAlreadyProcessed[a] = true;
}
@@ -199,6 +201,21 @@ return declare("davinci.ve.ThemeModifier", null, {
}
}
},
+ /*
+ * Added for theme Delta #23
+ */
+ getDeltaRule: function(rule){
+ var retRule=null;
+
+ // if this rule is not from the delat file add a new rule to the delta
+ retRule = this.cssFiles[0].getRule(rule.getSelectorText());
+ if (retRule.parent.url != this.cssFiles[0].url) {
+ retRule = this.cssFiles[0].addRule(rule.getSelectorText()+" {}");
+ }/*else{
+ retRule = rule;
+ }*/
+ return retRule;
+ },
_markDirty: function (file,cssModelObject){
if(!this._dirtyResource) {
@@ -430,6 +430,16 @@ define(["dojo/_base/declare",
/* theme/meta rules */
if (this._editor.editorID == 'davinci.ve.ThemeEditor'){
v = this._editor._getCssRules(this._widget, null, this._editor._currentState);
+ // #23
+ if (v){
+ // cascade excepts the rules in decending order
+ var t = [];
+ for (var x = v.length -1; x > -1; --x){
+ t.push(v[x]);
+ }
+ v = t;
+ }
+ // #23
} else if(this._widget){
v = this.context.getMetaTargets(this._widget,this.target);
}else{

0 comments on commit 99991bc

Please sign in to comment.