From 6823abb8024060eee6a4f8eaace288ed9dd58e65 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Wed, 27 Jun 2012 17:21:17 -0700 Subject: Styles Controller - Fix specificity comparison in hasGreaterSpecificity() --- js/controllers/styles-controller.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'js/controllers/styles-controller.js') diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 0f847653..47c63c09 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js @@ -213,6 +213,9 @@ var stylesController = exports.StylesController = Montage.create(Component, { stylesheet.insertRule(ruleText, index); + ///// Invalidate cache because rule dominance is affected + this._clearCache(); + this.styleSheetModified(stylesheet); rule = stylesheet.rules[index]; @@ -775,7 +778,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { var a = this._getMostSpecificSelectorForElement(element, rule1[this.CONST.SPECIFICITY_KEY]), b = this._getMostSpecificSelectorForElement(element, rule2[this.CONST.SPECIFICITY_KEY]), win = element.ownerDocument.defaultView, - order; + order, sheetAIndex, sheetBIndex, ruleAIndex, ruleBIndex; order = this.compareSpecificity(a.specificity, b.specificity); @@ -786,9 +789,9 @@ var stylesController = exports.StylesController = Montage.create(Component, { /// If tied again (same sheet), determine which is further down in the sheet if(sheetAIndex === sheetBIndex) { ruleAIndex = this.getRuleIndex(rule1); ruleBIndex = this.getRuleIndex(rule2); - return ruleAIndex < ruleBIndex ? 1 : (ruleAIndex > ruleBIndex) ? -1 : 0; + return ruleAIndex < ruleBIndex ? false : (ruleAIndex > ruleBIndex) ? true : false; } else { - return sheetAIndex < sheetBIndex ? 1 : (sheetAIndex > sheetBIndex) ? -1 : 0; + return sheetAIndex < sheetBIndex ? false : (sheetAIndex > sheetBIndex) ? true : false; } } @@ -1552,6 +1555,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { value: function(el, property, rule) { if(!el.elementModel) { return false; } /// return null if there is no element model + console.log("Setting cache for property: ", property); this._cacheHistory.push({ rule: rule, element: el, @@ -1614,6 +1618,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { if(!element) { this._cacheHistory = null; this._cacheHistory = []; + console.log("Removing cache: ", this._cacheHistory); } } -- cgit v1.2.3 From e3eb68c3a0b911acd873ee6211931b8f4e620030 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 28 Jun 2012 17:54:15 -0700 Subject: Fixed not being able to draw linear and radial gradients. Also fixed IKNINJA-1721 - File dirty marker does not show when modifying elements and IKNinja-1581 and IKNinja-1758 - Paint bucket fill bugs with lines and brush objects. Squashed commit of the following: commit 7cad082c89911d34a99feeef8e91d22b89cae8f1 Author: Nivesh Rajbhandari Date: Thu Jun 28 17:52:07 2012 -0700 Fix for not being able to draw linear and radial gradient materials. I'm turning off pre-flight support of gradients for WebGL since it conflicts with the materials' color support. Signed-off-by: Nivesh Rajbhandari commit d0df8a2bff052d855bafb7885792b1dfff8eab7d Merge: 2c67d26 b4b54f6 Author: Nivesh Rajbhandari Date: Thu Jun 28 17:50:11 2012 -0700 Merge branch 'refs/heads/ninja-internal' into ToolFixes commit 2c67d264851f0897fdca8ca887c1c82d0e434217 Author: Nivesh Rajbhandari Date: Thu Jun 28 15:06:13 2012 -0700 IKNINJA-1721 - File dirty marker does not show when modifying elements. Signed-off-by: Nivesh Rajbhandari commit bb4b6a52eb75efb2f435cdb53f810ae3bc1f1fc3 Author: Nivesh Rajbhandari Date: Thu Jun 28 11:15:34 2012 -0700 IKNinja-1581 and IKNinja-1758 - Paint bucket fill bugs with lines and brush objects. Signed-off-by: Nivesh Rajbhandari Signed-off-by: Nivesh Rajbhandari --- js/controllers/styles-controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/controllers/styles-controller.js') diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 0f847653..e7f95335 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js @@ -1437,11 +1437,11 @@ var stylesController = exports.StylesController = Montage.create(Component, { ///// Dispatch modified event NJevent('styleSheetModified', eventData); + this.currentDocument.model.needsSave = true; ///// If the sheet doesn't already exist in the list of modified ///// sheets, dispatch dirty event and add the sheet to the list if(sheetSearch.length === 0) { - this.currentDocument.model.needsSave = true; this.dirtyStyleSheets.push({ document : sheet.ownerNode.ownerDocument, stylesheet : sheet -- cgit v1.2.3 From 72a236ce7af6711f9d30762c2409d0ebd5ecf7aa Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Fri, 29 Jun 2012 09:14:30 -0700 Subject: Styles Controller - removing console logs --- js/controllers/styles-controller.js | 2 -- 1 file changed, 2 deletions(-) (limited to 'js/controllers/styles-controller.js') diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 47c63c09..e25ed20c 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js @@ -1555,7 +1555,6 @@ var stylesController = exports.StylesController = Montage.create(Component, { value: function(el, property, rule) { if(!el.elementModel) { return false; } /// return null if there is no element model - console.log("Setting cache for property: ", property); this._cacheHistory.push({ rule: rule, element: el, @@ -1618,7 +1617,6 @@ var stylesController = exports.StylesController = Montage.create(Component, { if(!element) { this._cacheHistory = null; this._cacheHistory = []; - console.log("Removing cache: ", this._cacheHistory); } } -- cgit v1.2.3