Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyPensov authored and SergeyPensov committed Feb 13, 2014
2 parents 2086120 + 4e9d203 commit 822e9bc
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 16 deletions.
Expand Up @@ -895,7 +895,7 @@ O$.DropDownField = {
}, 100);
else {
dropDown._reacquireFocus = undefined;
dropDown.focus();
// dropDown.focus();
}
};

Expand Down
26 changes: 26 additions & 0 deletions openFaces/source/META-INF/resources/openfaces/table/table.js
Expand Up @@ -856,6 +856,32 @@ O$.Table = {
if (newIdx != null) {
passEvent = false;
this.__setSelectedRowIndexes([newIdx]);
///////////////////////////////////////////////////
if (O$._activeElement.nodeName == "INPUT") {
var needElement = O$._activeElement;
var isNeedNode = true;
var needColumn = null;
var needChildrenNodes = null;
while (isNeedNode) {
needElement = needElement.parentNode;
if (needElement.nodeName == "TD") {
if (needElement._column._table == this) {
needColumn = needElement.cellIndex;
needElement = needElement.parentNode.parentNode;
needChildrenNodes = needElement.childNodes;
needElement = needChildrenNodes[newIdx];
needChildrenNodes = needElement.childNodes
needElement = needChildrenNodes[needColumn];
needElement = O$.getFirstFocusableControl(needElement);
needElement.focus();
isNeedNode = false;
}
}
}


}
///////////////////////////////////////////////////////
O$.Table._scrollToRowIndexes(this, [newIdx]);
this._baseRowIndex = null;
this._baseSelectedRowIndexes = null;
Expand Down
35 changes: 20 additions & 15 deletions openFaces/source/META-INF/resources/openfaces/util/util.js
Expand Up @@ -3062,7 +3062,7 @@ if (!window.O$) {
return document._of_localStyleSheet;
};

// TODO: in IE for high loaded pages we get limit for rules inside one style sheet, in this case we are starting to cr8 additionale sheets
// TODO: in IE for high loaded pages we get limit for rules inside one style sheet, in this case we are starting to cr8 additional sheets
O$.addAdditionalStyleSheet = function() {
document._of_localAdditionalStyleSheetsCount = document._of_localAdditionalStyleSheetsCount ? document._of_localAdditionalStyleSheetsCount + 1 : 1;
document._of_localAdditionalStyleSheets = [];
Expand Down Expand Up @@ -3094,9 +3094,10 @@ if (!window.O$) {

try {
if (styleSheet.addRule) { // IE only
if (styleSheet.cssRules.length > 4000){ // IN IE there are MAX 4096 rules
var rules = styleSheet.cssRules ? styleSheet.cssRules : styleSheet.rules;
if (rules && rules.length > 4000){ // IN IE there are MAX 4096 rules
styleSheet = O$.packCssStyleSheet(styleSheet);
if (styleSheet.cssRules.length > 3800){ // we add a little bit less number to avoid calls for each adding when you have smth like 3999 rules
if (rules.length > 3800){ // we add a little bit less number to avoid calls for each adding when you have smth like 3999 rules
styleSheet = O$.addAdditionalStyleSheet();

}
Expand Down Expand Up @@ -3140,7 +3141,7 @@ if (!window.O$) {
}
}
} else { // all others
styleSheet.insertRule(strRule, styleSheet.cssRules.length);
styleSheet.insertRule(strRule, styleSheet.rules.length);
}
return styleSheet;
} catch (e) {
Expand All @@ -3162,40 +3163,44 @@ if (!window.O$) {
// #return link to new style sheet with packed rules
O$.packCssStyleSheet = function (styleSheet){
var initialRulesList = [];
O$.extend(initialRulesList, styleSheet.cssRules);
var rules = styleSheet.cssRules ? styleSheet.cssRules : styleSheet.rules;
O$.extend(initialRulesList, rules);
var packedRulesList = [];
for (var i = 0; i < initialRulesList.length; i++){
if (!initialRulesList[i]) continue;
var resultSelector = O$.getCssSelectorFromString(initialRulesList[i].cssText);
var resultDeclaration = O$.getCssDeclarationFromString(initialRulesList[i].cssText);
var resultSelector = initialRulesList[i].selectorText;
var resultDeclaration = initialRulesList[i].style;
initialRulesList[i] = null;
for (var j = i + 1; j < initialRulesList.length; j++){
if (!initialRulesList[j]) continue;
var currentDeclaration = O$.getCssDeclarationFromString(initialRulesList[j].cssText);
if ( O$.compareCssDeclarationString(resultDeclaration, currentDeclaration) ) {
resultSelector += ", " + O$.getCssSelectorFromString(initialRulesList[j].cssText);
var currentDeclaration = initialRulesList[j].style;
if ( O$.compareCssDeclarationString(resultDeclaration.cssText, currentDeclaration.cssText) ) {
resultSelector = initialRulesList[j].selectorText;
initialRulesList[j] = null;
}
}
packedRulesList.push({
selector: resultSelector,
declaration: resultDeclaration
declaration: resultDeclaration.cssText
})

}


var resultStyleSheet = O$.getLocalStyleSheet();
while (resultStyleSheet.cssRules.length>0){
resultStyleSheet.removeRule(resultStyleSheet.length-1);
rules = resultStyleSheet.cssRules ? resultStyleSheet.cssRules : resultStyleSheet.rules;
while (rules.length>0){
rules = resultStyleSheet.cssRules ? resultStyleSheet.cssRules : resultStyleSheet.rules;
resultStyleSheet.removeRule(rules.length-1);
}

for (var i = 0; i < packedRulesList.length; i++){
if (resultStyleSheet.addRule){ //IE
resultStyleSheet.addRule(packedRulesList[i].selector, packedRulesList[i].declaration, i);
} else { // all others
var cssText = packedRulesList[i].selector + " " + packedRulesList[i].declaration;
resultStyleSheet.insertRule(cssText, resultStyleSheet.cssRules.length);
rules = resultStyleSheet.cssRules ? resultStyleSheet.cssRules : resultStyleSheet.rules;
resultStyleSheet.insertRule(cssText, rules.length);
}
}

Expand Down Expand Up @@ -3246,7 +3251,7 @@ if (!window.O$) {
}
}
} else { // all others
var rules = styleSheet.cssRules;
var rules = styleSheet.rules;
for (var i = 0; i < rules.length; i++) {
if (rules[i].selectorText == nameOfCssClass) {
var ruleBySelector = O$._cssRulesBySelectors ? O$._cssRulesBySelectors[nameOfCssClass] : null;
Expand Down

0 comments on commit 822e9bc

Please sign in to comment.