From d0383a248704584cb73b40218382fb2882162058 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 26 Jun 2012 11:39:57 -0700 Subject: removing un-necessary panel styles and possibly fix IKNINJA-1626 Signed-off-by: Valerio Virgillito --- css/ninja.css | 2 +- scss/imports/scss/_PanelUI.scss | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/css/ninja.css b/css/ninja.css index d98aa513..d8dbd6bc 100755 --- a/css/ninja.css +++ b/css/ninja.css @@ -600,7 +600,7 @@ button.panel-button { -webkit-appearance: none; font-size: 9px; color: white; ba .panels .panel { min-height: 25px; -webkit-box-flex: 0; display: -webkit-box; -webkit-box-orient: vertical; background: #282828; height: 200px; padding: 0px 2px; -webkit-box-sizing: border-box; } -.panels .panel .panelBody { -webkit-box-flex: 1; -webkit-box-sizing: border-box; -webkit-box-orient: vertical; -webkit-box-align: stretch; position: relative; overflow: auto; height: 200px; } +.panels .panel .panelBody { -webkit-box-flex: 1; -webkit-box-sizing: border-box; -webkit-box-orient: vertical; -webkit-box-align: stretch; position: relative; } .panel .panelBodyContent { -webkit-box-sizing: border-box; -webkit-box-align: stretch; position: absolute; height: 100%; width: 100%; } diff --git a/scss/imports/scss/_PanelUI.scss b/scss/imports/scss/_PanelUI.scss index 543901ad..a03991f9 100755 --- a/scss/imports/scss/_PanelUI.scss +++ b/scss/imports/scss/_PanelUI.scss @@ -1118,10 +1118,8 @@ button.panel-button { -webkit-box-orient: vertical; -webkit-box-align: stretch; position:relative; - overflow: auto; - height:200px; - } + .panel .panelBodyContent { -webkit-box-sizing: border-box; -webkit-box-align:stretch; -- cgit v1.2.3 From 2be81997e1ecd14ae43cf7fb243ef7ced2696bd2 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Tue, 26 Jun 2012 19:19:31 -0700 Subject: Styles Controller - Chrome 20 Fix --- js/controllers/styles-controller.js | 81 ++++++++++++++++--------- js/panels/css-panel/rule-list.reel/rule-list.js | 2 +- 2 files changed, 54 insertions(+), 29 deletions(-) diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 1c1e75ed..1eb7bc7f 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js @@ -604,51 +604,76 @@ var stylesController = exports.StylesController = Montage.create(Component, { getRuleIndex : { value : function(rule) { - var rules = nj.toArray(rule.parentStyleSheet.rules), - i; + var rules = nj.toArray(rule.parentStyleSheet.rules); return rules.indexOf(rule); } }, - + + _getRuleWithCSSText : { + value: function(cssText, doc) { + var _doc = doc || this.currentDocument.model.views.design._document, + ruleIndex, rule; + + for(var i = 0; i < _doc.styleSheets.length; i++) { + ruleIndex = nj.toArray(_doc.styleSheets[i].rules).map(function(rule) { + return rule.cssText; + }).indexOf(cssText); + + if(ruleIndex !== -1) { + rule = _doc.styleSheets[i].rules[ruleIndex]; + break; + } + } + + if(!rule) { + ///// This should never be hit if providing cssText from existing rule (like those + ///// returned from getMatchedCSSRules() + console.warn('StylesController::_getRuleWithCSSText - No rule found with given cssText.'); + } + + return rule; + } + }, + ///// Get All Matching Rules ///// Returns an array of css rules for an element ///// Optionally sorted by specificity, and can omit pseudo elements - getMatchingRules : { + getMatchingRules : { //TODO: Remove omitPseudos from here and usages value: function(element, omitPseudos, useStageStyleSheet) { - var pseudos = [null], - rules = [], - win = element.ownerDocument.defaultView, - self = this; - - if(!omitPseudos) { - pseudos.concat(['link', 'visited', 'active', 'hover', 'focus', 'first-letter', - 'first-line', 'first-child', 'before', 'after', 'lang', 'target']); - } + var rules, + mappedRules, + doc = element.ownerDocument, + win = doc.defaultView; try { - pseudos.forEach(function(pseudo) { - rules = rules.concat(nj.toArray(win.getMatchedCSSRules(element, pseudo)).filter(function(rule) { - //// useStageStyleSheet flag indicates whether to only return rules from the stylesheet, - //// or only use rules for other stylesheets + debugger; + + mappedRules = nj.toArray(win.getMatchedCSSRules(element)).map(function(rule) { + return this._getRuleWithCSSText(rule.cssText, doc); + }, this); - var sheetId = (rule.parentStyleSheet) ? rule.parentStyleSheet.ownerNode.id : null, - isStageStyleSheet = sheetId === this.CONST.STAGE_SHEET_ID; + rules = mappedRules.filter(function(rule) { + //// useStageStyleSheet flag indicates whether to only return rules from the stylesheet, + //// or only use rules for other stylesheets - ///// filter out (return false) depending on flag - if(useStageStyleSheet && !isStageStyleSheet) { return false; } - if(!useStageStyleSheet && isStageStyleSheet) { return false; } + var sheetId = (rule.parentStyleSheet) ? rule.parentStyleSheet.ownerNode.id : null, + isStageStyleSheet = sheetId === this.CONST.STAGE_SHEET_ID; - ///// Non-filter code - just assigning specificity to the rule - if(!rule[this.CONST.SPECIFICITY_KEY]) { - rule[this.CONST.SPECIFICITY_KEY] = this.getSpecificity(rule.selectorText); - } + ///// filter out (return false) depending on flag + if(useStageStyleSheet && !isStageStyleSheet) { return false; } + if(!useStageStyleSheet && isStageStyleSheet) { return false; } - return true; + ///// Non-filter code - just assigning specificity to the rule + if(!rule[this.CONST.SPECIFICITY_KEY]) { + rule[this.CONST.SPECIFICITY_KEY] = this.getSpecificity(rule.selectorText); + } + + return true; - }, this)); }, this); + } catch(ERROR) { console.warn('StylesController::getMatchingRules - Un-attached element queried.'); } diff --git a/js/panels/css-panel/rule-list.reel/rule-list.js b/js/panels/css-panel/rule-list.reel/rule-list.js index 27d74b2f..b4cd9e97 100644 --- a/js/panels/css-panel/rule-list.reel/rule-list.js +++ b/js/panels/css-panel/rule-list.reel/rule-list.js @@ -81,7 +81,7 @@ exports.RuleList = Montage.create(Component, { // found rule in our component list, or it's the inline rule ruleComponent.update(); foundIndices.push(index); - } else if(!rule.applied) { /// remove rule (unless unapplied) + } else if(!ruleComponent.applied) { /// remove rule (unless unapplied) this.rulesToRemove.push(ruleComponent); } }, this); -- cgit v1.2.3 From 31a164700e95fb9bf37169eccdb009895452b8bf Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Tue, 26 Jun 2012 20:19:32 -0700 Subject: Styles Controller - Remove debugger --- js/controllers/styles-controller.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 1eb7bc7f..0f847653 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js @@ -648,8 +648,6 @@ var stylesController = exports.StylesController = Montage.create(Component, { win = doc.defaultView; try { - debugger; - mappedRules = nj.toArray(win.getMatchedCSSRules(element)).map(function(rule) { return this._getRuleWithCSSText(rule.cssText, doc); }, this); -- cgit v1.2.3