svnno****@sourc*****
svnno****@sourc*****
2011年 1月 6日 (木) 23:26:23 JST
Revision: 2277
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2277
Author: dhrname
Date: 2011-01-06 23:26:22 +0900 (Thu, 06 Jan 2011)
Log Message:
-----------
getComputedStyleメソッドにおいて、デフォルト値の検索をリストから外して、ハッシュ検索に変更したことで最適化
Modified Paths:
--------------
branches/06x/067/org/w3c/dom/css.js
Modified: branches/06x/067/org/w3c/dom/css.js
===================================================================
--- branches/06x/067/org/w3c/dom/css.js 2011-01-05 14:39:49 UTC (rev 2276)
+++ branches/06x/067/org/w3c/dom/css.js 2011-01-06 14:26:22 UTC (rev 2277)
@@ -185,7 +185,7 @@
*/
function CSSStyleDeclaration() {
this._list = []; //内部のリスト
- this._list._fontSize = this._list._opacity = null;
+ this._def = this._list._fontSize = this._list._opacity = null;
return this;
};
CSSStyleDeclaration.prototype = {
@@ -208,6 +208,7 @@
*CSSValueオブジェクトを返す。このメソッドは判別に用いているので、削除不可。
*/
/*CSSValue*/ getPropertyCSSValue : function( /*string*/ propertyName) {
+ var prop = propertyName;
propertyName += ":";
if (propertyName === ":") { //どんなデータ型でも、文字列に変換する機能をJavaScriptが持つことに注意
return null;
@@ -216,11 +217,15 @@
var ti = this._list[i], tc = ti.cssText;
if (tc.indexOf(propertyName) > -1) { //プロパティ名に合致するCSSValueオブジェクトが見つかった場合
ti._empercents = this._list._fontSize;
- propertyName = null;
+ tc = prop = propertyName = null;
return ti;
}
}
- propertyName = null;
+ if (this._def) {
+ propertyName = null;
+ return (this._def[prop]);
+ }
+ prop = propertyName = null;
return null;
},
/*removePropertyメソッド
@@ -641,8 +646,6 @@
/*interface ViewCSS : views::AbstractView {*/
Document.prototype.defaultView = new ViewCSS();
function ViewCSS(){
- this._cache = null;
- this._cache_ele = null;
return this;
};
/*CSSStyleDeclaration*/ ViewCSS.prototype.getComputedStyle = function( /*Element*/ elt, /*string*/ pseudoElt) {
@@ -657,7 +660,7 @@
if (pelt) {
var p = this.getComputedStyle(pelt, pseudoElt)._list;
} else {
- var p = this._defaultCSS; //デフォルト値の設定
+ var p = {length:0, _opacity:1, _fontSize:12};
}
var q = s._list;
if (!!elt.style) {
@@ -679,6 +682,7 @@
for (var i=0,pli=p.length;i<pli;++i) {
q[q.length] = p[i];
}
+ s._def = this._defaultCSS; //デフォルト値の設定
s._list = q;
if (!!elt.style) {
var eso = elt.style._list._opacity || elt._attributeStyle._list._opacity;