svnno****@sourc*****
svnno****@sourc*****
2011年 11月 3日 (木) 20:16:20 JST
Revision: 3060
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=3060
Author: dhrname
Date: 2011-11-03 20:16:20 +0900 (Thu, 03 Nov 2011)
Log Message:
-----------
0.88 merged
Modified Paths:
--------------
trunk/sie.js
Property Changed:
----------------
trunk/sie.js
Modified: trunk/sie.js
===================================================================
--- trunk/sie.js 2011-11-03 10:58:28 UTC (rev 3059)
+++ trunk/sie.js 2011-11-03 11:16:20 UTC (rev 3060)
@@ -1644,7 +1644,7 @@
*/
function CSSStyleDeclaration() {
this._list = []; //内部のリスト
- this._def = this._list._fontSize = this._list._opacity = null;
+ this._list._fontSize = this._list._opacity = null;
return this;
};
CSSStyleDeclaration.prototype = {
@@ -1683,10 +1683,6 @@
return ti;
}
}
- if (this._def) {
- i = tl = tli = tc = propertyName = void 0;
- return (this._def[prop]);
- }
i = tl = tli = prop = propertyName = void 0;
return null;
},
@@ -1761,7 +1757,6 @@
uri = RegExp.$1;
} else if (value === "currentColor") {
paintType = /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102;
- color = this.getPropertyValue("color") || "rgb(0,0,0)";
}
ti.setPaint(paintType, uri, color, null);
paintType = v1 = uri = color = void 0;
@@ -1773,27 +1768,10 @@
}
if (value === "currentColor") {
ti.colorType = /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3;
- value = this.getPropertyValue("color") || "rgb(0,0,0)";
} else {
ti.colorType = /*SVGColor.SVG_COLORTYPE_RGBCOLOR*/ 1;
}
ti.setRGBColor(value);
- } else if (this._isColor[propertyName]) {
- if (tg) { //見つかった場合
- ti = tg;
- } else {
- ti = new CSSPrimitiveValue();
- }
- fill = this.getPropertyCSSValue("fill");
- stroke = this.getPropertyCSSValue("stroke");
- stop = this.getPropertyCSSValue("stop-color");
- if (fill && (fill.paintType === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102)) {
- fill.setPaint(fill.paintType, null, value, null);
- } else if (stroke && (stroke.paintType === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102)) {
- stroke.setPaint(fill.paintType, null, value, null);
- } else if (stop && (stop.colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3)) {
- stop.setRGBColor(value);
- }
} else {
if (tg) { //見つかった場合
ti = tg;
@@ -1831,23 +1809,6 @@
var s = this._list[index].cssText.substring(0, this._list[index].cssText.indexOf(":"));
}
return s;
- },
- /*_setCSSTextメソッド SIE独自のメソッド。
- *リストをテキストに変換して、cssTextプロパティに格納しておく。cssTextがsetterである場合は、削除しておくこと。
- */
- _setCSSText : function () {
- var tlist = this._list,
- list = {}, //SIEの設計上、プロパティが重複してしまう恐れがあるので、重複防止のためのチェックするオブジェクト
- ti;
- this.length = tlist.length; //setPropertyメソッドを解さないで処理する場合があるため、lengthプロパティを同値にする
- for (var i=tlist.length-1;i>=0;--i) {
- ti = this.item(i);
- if (!list[ti]) {
- this.cssText += tlist[i].cssText+ ";";
- list[ti] = 1;
- }
- }
- tlist = list = ti = i = void 0;
}
};
@@ -2200,54 +2161,42 @@
return this;
};
/*CSSStyleDeclaration*/ ViewCSS.prototype.getComputedStyle = function( /*Element*/ elt, /*string*/ pseudoElt) {
- if (!!elt._currentStyle) {
- /*キャッシュがあれば、それを返す*/
- return (elt._currentStyle);
- }
- var s = new CSSStyleDeclaration();
- elt._currentStyle = s;
- //リストを連結することによって、カスケーディングを実現する
- var pelt = elt.parentNode;
- if (pelt) {
- var p = this.getComputedStyle(pelt, pseudoElt)._list;
- } else {
- var p = {length:0, _opacity:1, _fontSize:12};
- }
- var q = s._list;
- if (!!elt.style) {
- var estl = elt.style._list, easl = elt._attributeStyle._list, csi = CSSValue.CSS_INHERIT;
- for (var i=0,eli=estl.length;i<eli;++i) {
- q[q.length] = estl[i];
- }
- for (var i=0,eli=easl.length;i<eli;++i) {
- q[q.length] = easl[i]; //プレゼンテーション属性を結びつける
- }
- estl = easl = void 0;
- //スタイルシートのルールを結びつける
- if (elt._rules) {
- for (var i=0,eli=elt._rules.length;i<eli;++i) {
- var ei = elt._rules[i].style._list;
- for (var j=0,esli=ei.length;j<esli;++j) {
- q[q.length] = ei[j];
+ var s = new CSSStyleDeclaration(),
+ ct, p;
+ ct = null
+ p = {length:0, _opacity:1, _fontSize:12};
+ //クロージャを利用して、カスケーディングを実現する
+ s.getPropertyCSSValue = (function(elt, td, s){
+ return function( /*string*/ propertyName) {
+ var el = elt,
+ css = null;
+ while (el && (!css || (css.cssValueType === /*CSSValue.CSS_INHERIT*/ 0))) {
+ if (el._runtimeStyle && el._runtimeStyle[propertyName]) {
+ css = el._runtimeStyle.getPropertyCSSValue(propertyName);
+ } else if (el.style && el.style[propertyName]) {
+ css = el.style.getPropertyCSSValue(propertyName);
+ } else if (el._attributeStyle && el._attributeStyle[propertyName]) {
+ //プレゼンテーション属性を探す
+ css = el._attributeStyle.getPropertyCSSValue(propertyName);
+ } else if (el._rules) {
+ //スタイルシートのルールを探す
+ for (var i=0,eli=el._rules.length;i<eli;++i) {
+ el._rules[i].style[propertyName] && (css = el._rules[i].style.getPropertyCSSValue(propertyName));
+ }
}
+ el = el.parentNode;
}
- }
- //inheritの値があれば、削除しておく
- for (var i=0,qli=q.length;i<qli;++i) {
- if (q[i].cssValueType === csi) {
- q.splice(i, 1);
- --qli;
+ if (!css || (css.cssValueType === /*CSSValue.CSS_INHERIT*/ 0)) {
+ //デフォルト値を探す
+ td && (css = td[propertyName]);
}
- }
- }
- for (var i=0,pli=p.length;i<pli;++i) {
- q[q.length] = p[i];
- }
- if (elt._runtimeStyle) {
- q = elt._runtimeStyle._list.concat(q);
- }
- s._def = this._defaultCSS; //デフォルト値の設定
- s._list = q;
+ if (css && ((css.paintType === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102) || (css.colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3))) {
+ css.setRGBColor && css.setRGBColor(s.getPropertyValue("color"));
+ }
+ el = void 0;
+ return css;
+ };
+ })(elt, this._defaultCSS, s); //_defaultCSSはデフォルト値の設定
if (!!elt.style) {
var eso = elt.style._list._opacity || elt._attributeStyle._list._opacity;
} else {
@@ -2255,7 +2204,7 @@
}
s._list._opacity = p._opacity * (eso || 1);
s._list._fontSize = p._fontSize;
- pelt = eso = p = q = void 0;
+ pelt = eso = p = void 0;
s._document = elt.ownerDocument;
return s;
};
@@ -2272,29 +2221,29 @@
var s = new CSSStyleDeclaration(), setProp = s.setProperty;
tar._runtimeStyle = s;
}
- s.setProperty = function(propertyName, value, priority) {
- setProp.call(s, propertyName, value, priority);
- var tar = elt, el = tar._tar, isFill = isStroke = false;
- delete tar._currentStyle;
- if ((tar.localName === "g") || (tar.localName === "a")) {
- var sl = tar.getElementsByTagNameNS("http://www.w3.org/2000/svg", "*");
- if (sl) {
- for (var i=0,sli=sl.length;i<sli;++i) {
- var di = sl[i];
- delete di._currentStyle;
- NAIBU._setPaint(di, di.getScreenCTM());
- di = void 0;
+ s.setProperty = (function(setProp, s){
+ return function(propertyName, value, priority) {
+ setProp.call(s, propertyName, value, priority);
+ var tar = elt, el = tar._tar, isFill = isStroke = false;
+ if ((tar.localName === "g") || (tar.localName === "a")) {
+ var sl = tar.getElementsByTagNameNS("http://www.w3.org/2000/svg", "*");
+ if (sl) {
+ for (var i=0,sli=sl.length;i<sli;++i) {
+ var di = sl[i];
+ NAIBU._setPaint(di, di.getScreenCTM());
+ di = void 0;
+ }
+ sl = void 0;
}
- sl = void 0;
+ el = null;
}
- el = null;
- }
- if (!el) {
- return;
- }
- NAIBU._setPaint(tar, tar.getScreenCTM());
- el = tar = value = void 0;
- }
+ if (!el) {
+ return;
+ }
+ NAIBU._setPaint(tar, tar.getScreenCTM());
+ el = tar = value = void 0;
+ };
+ })(setProp, s);
return s;
};
/*createCSSStyleSheetメソッド
@@ -3083,7 +3032,7 @@
// raises( SVGException );
/*void*/ this.setColor =function(/*unsigned short*/ colorType, /*DOMString*/ rgbColor, /*DOMString*/ iccColor ){
this.colorType = colorType;
- if ((colorType === /*SVGColor.SVG_COLORTYPE_RGBCOLOR*/ 1) || (colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3)) {
+ if (rgbColor && ((colorType === /*SVGColor.SVG_COLORTYPE_RGBCOLOR*/ 1) || (colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3))) {
this.setRGBColor(rgbColor);
}
colorType = rgbColor = void 0;
@@ -5376,7 +5325,6 @@
tt.coordsize = vi.width.baseVal.value + " " + vi.height.baseVal.value;
NAIBU._setPaint(tar, matrix);
delete tar._cacheMatrix;
- delete tar._currentStyle;
evt = tar = dat = t = tx = ty = matrix = tlist = x = y = _parseInt = ma = mb = mc = md = me = mf = vi = isZ = isC = i = tli = tps = ti = cname = tt = void 0;
};
_sproto._com = {
@@ -5771,7 +5719,6 @@
ele.coordsize = w + " " + h;
NAIBU._setPaint(tar, ctm);
delete tar._cacheMatrix;
- delete tar._currentStyle;
evt = tar = style = list = dat = ele = vi = fontSize = void 0;
}, false);
evt = tar = void 0;
@@ -5852,7 +5799,6 @@
ele.coordsize = w + " " + h;
NAIBU._setPaint(tar, ctm);
delete tar._cacheMatrix;
- delete tar._currentStyle;
evt = tar = list = style = fontSize = dat = ele = void 0;
}, false);
evt = tar = void 0;
@@ -5935,7 +5881,6 @@
ele.coordsize = w + " " + h;
NAIBU._setPaint(tar, ctm);
delete tar._cacheMatrix;
- delete tar._currentStyle;
evt = ele = tar = style = fontSize = dat = list = ctm = w = h = void 0;
}, false);
evt = tar = void 0;
@@ -6008,7 +5953,6 @@
ele.coordsize = w + " " + h;
NAIBU._setPaint(tar, ctm);
delete tar._cacheMatrix;
- delete tar._currentStyle;
evt = ele = tar = style = fontSize = dat = list = ctm = vi = w = h = void 0;
}, false);
evt = tar = void 0;
@@ -6097,7 +6041,6 @@
ele.coordsize = w + " " + h;
NAIBU._setPaint(tar, ctm);
delete tar._cacheMatrix;
- delete tar._currentStyle;
evt = ele = tar = dat = list = ctm = w = h = vi = void 0;
}, false);
evt = tar = void 0;
@@ -6509,10 +6452,10 @@
anchor = style.getPropertyValue("text-anchor"),
tedeco = style.getPropertyValue("text-decoration"), //text-decorationは継承しないので、個々に設定する
ttps = ttp.style;
- style._setCSSText();
- ttps.cssText = style.cssText;
ttps.fontSize = n + "px";
ttps.fontFamily = style.getPropertyValue("font-family");
+ ttps.fontStyle = style.getPropertyValue("font-style");
+ ttps.fontWeight = style.getPropertyValue("font-weight");
/*ここでの変数jは前回ノードまでの総文字数*/
for (var i=0, j=0, tli=tar.getNumberOfChars();i<tli;++i) {
if (ti) {
@@ -6622,7 +6565,6 @@
ttp.appendChild(backr);
}
delete tar._cacheMatrix;
- delete tar._currentStyle;
isRect = evt = tar = style = tedeco = tpp = ttpc = style = color = cursor = disp = vis = ttps = backr = backrs = void 0;
}, false);
evt = tar = void 0;
@@ -7171,6 +7113,7 @@
st = "new";
}
tar.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:show", st);
+ tar._tar.style.color = tar.ownerDocument.defaultView.getComputedStyle(tar, "").getPropertyValue("fill");
tar = evt = void 0;
}, false);
this.addEventListener("DOMNodeInsertedIntoDocument", function(evt){
@@ -7187,47 +7130,45 @@
this.addEventListener("DOMNodeInsertedIntoDocument", function(evt){
var tar = evt.target;
tar._tar.setAttribute("target", tar.target.baseVal);
- tar = void 0;
- }, false);
- this.addEventListener("click", function(evt){
- var tar = evt.target;
if (tar.href.baseVal.indexOf(".svg") !== -1) { //もし、リンク先がSVGファイルならば
- var sd = document.body,
- ob, nd;
- sd.lastChild.innerHTML = "<object data='" +tar.href.baseVal.split("#")[0]+ "' width='" +screen.width+ "' height='" +screen.height+ "' type='image/svg+xml'></object>";
- if (tar.target.baseVal === "_self") {
- nd = tar.ownerDocument._iframe;
- nd.parentNode.insertBefore(sd.lastChild.firstChild, nd);
- ob = nd.nextSibling;
- if (ob && (ob.tagName === "OBJECT")) {
- nd.previousSibling.setAttribute("width", ob.getAttribute("width"));
- nd.previousSibling.setAttribute("height", ob.getAttribute("height"));
- nd.parentNode.removeChild(ob);
- }
- ob = NAIBU._search([nd.previousSibling]);
- nd.parentNode.removeChild(nd);
- } else {
- sd.appendChild(sd.lastChild.firstChild);
- while (sd.firstChild !== sd.lastChild) { //オブジェクト要素以外を除去
- sd.removeChild(sd.firstChild);
- }
- ob = NAIBU._search([sd.lastChild]);
- }
- NAIBU.doc = new ActiveXObject("MSXML2.DomDocument");
- evt.preventDefault();
- ob._next = {
- _init: (function (ob) {
- return (function(){
- document.title = ob.getSVGDocument().title;
- ob = void 0;
- });
- })(ob)
- };
- ob._init();
- sd = ob = nd = void 0;
- } else {
- location.href = tar.href.baseVal;
+ tar.addEventListener("click", function(evt){
+ var tar = evt.target,
+ sd = document.body,
+ ob, nd;
+ sd.lastChild.innerHTML = "<object data='" +tar.href.baseVal.split("#")[0]+ "' width='" +screen.width+ "' height='" +screen.height+ "' type='image/svg+xml'></object>";
+ if (tar.target.baseVal === "_self") {
+ nd = tar.ownerDocument._iframe;
+ nd.parentNode.insertBefore(sd.lastChild.firstChild, nd);
+ ob = nd.nextSibling;
+ if (ob && (ob.tagName === "OBJECT")) {
+ nd.previousSibling.setAttribute("width", ob.getAttribute("width"));
+ nd.previousSibling.setAttribute("height", ob.getAttribute("height"));
+ nd.parentNode.removeChild(ob);
+ }
+ ob = NAIBU._search([nd.previousSibling]);
+ nd.parentNode.removeChild(nd);
+ } else {
+ sd.appendChild(sd.lastChild.firstChild);
+ while (sd.firstChild !== sd.lastChild) { //オブジェクト要素以外を除去
+ sd.removeChild(sd.firstChild);
+ }
+ ob = NAIBU._search([sd.lastChild]);
+ }
+ NAIBU.doc = new ActiveXObject("MSXML2.DomDocument");
+ evt.preventDefault();
+ ob._next = {
+ _init: (function (ob) {
+ return (function(){
+ document.title = ob.getSVGDocument().title;
+ ob = void 0;
+ });
+ })(ob)
+ };
+ ob._init();
+ sd = ob = nd = void 0;
+ }, false);
}
+ tar = void 0;
}, false);
SVGURIReference.apply(this, arguments);
return this;
@@ -8020,7 +7961,8 @@
var tar = evt.target,
attrName = tar.getAttributeNS(null, "attributeName"),
ttr = tar.targetElement,
- fstyle = tar.ownerDocument.defaultView.getComputedStyle(ttr, "");
+ fstyle = tar.ownerDocument.defaultView.getComputedStyle(ttr, ""),
+ css, n;
if (!tar._values[0]) {
tar._values[0] = fstyle.getPropertyValue(attrName);
}
@@ -8029,13 +7971,19 @@
if (tar._values[i] === "currentColor") {
to.setRGBColor(fstyle.getPropertyValue("color") || "black");
} else if (tar._values[i] === "inherit") {
- to.setRGBColor(fstyle.getPropertyValue(attrName) || "black");
+ /*いったん、cssValueTypeプロパティをinheritに指定して、継承元のオブジェクトを取得*/
+ css = fstyle.getPropertyCSSValue(attrName);
+ n = css.cssValueType;
+ css.cssValueType = /*CSSValue.CSS_INHERIT*/ 0;
+ to = fstyle.getPropertyCSSValue(attrName);
+ css.cssValueType = n;
} else {
to.setRGBColor(tar._values[i]);
}
tar._valueList[tar._valueList.length] = to;
to = void 0;
}
+ tar = ttr = fstyle = css = n = attrName = void 0;
}, false);
}, false);
this.addEventListener("beginEvent", function(evt) {
@@ -8043,9 +7991,6 @@
attrName = tar.getAttributeNS(null, "attributeName"),
style = tar.ownerDocument.getOverrideStyle(tar.targetElement, ""),
fstyle = tar.ownerDocument.defaultView.getComputedStyle(tar.targetElement, "");
- if (tar._values[0] !== null) {
- style.setProperty(attrName, tar._values[0], null);
- }
tar._frame = function() {
var _tar = tar;
/*公式に関しては、SMIL2.0 Animation Moduleの単純アニメーション関数の項を参照
@@ -8083,13 +8028,16 @@
b = fb + (tc.blue.getFloatValue(num) - fb) * durd;
style.setProperty(attrName, "rgb(" +Math.ceil(r)+ "," +Math.ceil(g)+ "," +Math.ceil(b)+ ")", null);
_tar = d = n = tg = fc = tc = fr = fg = fb = num = r = g = b = void 0;
- }
+ };
+ tar._frame();
}, false);
this.addEventListener("endEvent", function(evt) {
var tar = evt.target;
- var evtt = tar.ownerDocument.createEvent("MutationEvents");
- evtt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null);
- tar.targetElement.dispatchEvent(evtt);
+ if (!fill || (fill === "remove")) {
+ var evtt = tar.ownerDocument.createEvent("MutationEvents");
+ evtt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null);
+ tar.targetElement.dispatchEvent(evtt);
+ }
tar._frame = evt = evtt = void 0;
}, false);
this.addEventListener("repeatEvent", function(evt) {
Property changes on: trunk/sie.js
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/04x/040/sie.js:812-829
/branches/04x/041/sie.js:891-923
/branches/04x/042/sie.js:927-967
/branches/04x/043/sie.js:969-1013
/branches/04x/044/sie.js:1015-1067
/branches/04x/045/sie.js:1069-1078
/branches/04x/046/sie.js:1080-1129
/branches/04x/047/sie.js:1131-1164
/branches/04x/048/sie.js:1166-1180
/branches/04x/sie.js:830-1181
/branches/05x/050/sie.js:1183-1201
/branches/05x/051/sie.js:1207-1323
/branches/05x/052/sie.js:1325-1352
/branches/05x/053/sie.js:1354-1400
/branches/05x/054/sie.js:1403-1422
/branches/05x/055/sie.js:1424-1454
/branches/05x/056/sie.js:1456-1491
/branches/05x/057/sie.js:1496-1523
/branches/05x/058/sie.js:1526-1590
/branches/05x/sie.js:1183-1594
/branches/06x/060/sie.js:1603-1850
/branches/06x/sie.js:1599-2355
/branches/07x/sie.js:2357-2748
/branches/08x/sie.js:2750-3019,3026
+ /branches/04x/040/sie.js:812-829
/branches/04x/041/sie.js:891-923
/branches/04x/042/sie.js:927-967
/branches/04x/043/sie.js:969-1013
/branches/04x/044/sie.js:1015-1067
/branches/04x/045/sie.js:1069-1078
/branches/04x/046/sie.js:1080-1129
/branches/04x/047/sie.js:1131-1164
/branches/04x/048/sie.js:1166-1180
/branches/04x/sie.js:830-1181
/branches/05x/050/sie.js:1183-1201
/branches/05x/051/sie.js:1207-1323
/branches/05x/052/sie.js:1325-1352
/branches/05x/053/sie.js:1354-1400
/branches/05x/054/sie.js:1403-1422
/branches/05x/055/sie.js:1424-1454
/branches/05x/056/sie.js:1456-1491
/branches/05x/057/sie.js:1496-1523
/branches/05x/058/sie.js:1526-1590
/branches/05x/sie.js:1183-1594
/branches/06x/060/sie.js:1603-1850
/branches/06x/sie.js:1599-2355
/branches/07x/sie.js:2357-2748
/branches/08x/sie.js:2750-3019,3026,3059