svnno****@sourc*****
svnno****@sourc*****
2010年 10月 26日 (火) 23:31:08 JST
Revision: 2099 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2099 Author: dhrname Date: 2010-10-26 23:31:08 +0900 (Tue, 26 Oct 2010) Log Message: ----------- getOverrideStyleメソッドの修正 Modified Paths: -------------- branches/06x/062/org/w3c/dom/css.js Modified: branches/06x/062/org/w3c/dom/css.js =================================================================== --- branches/06x/062/org/w3c/dom/css.js 2010-10-26 11:18:39 UTC (rev 2098) +++ branches/06x/062/org/w3c/dom/css.js 2010-10-26 14:31:08 UTC (rev 2099) @@ -701,30 +701,40 @@ } var style = this.defaultView.getComputedStyle(tar, "") s.setProperty = function(propertyName, value, priority) { - var tar = elt, el = tar._tar; + var tar = elt, el = tar._tar, isFill = isStroke = false; if (!!!tar._fillElement) { tar._fillElement = document.createElement("v:fill"); //キャッシュを作る - el.appendChild(tar._fillElement); + } else { + /*あらかじめ消しおかないと、効果が出ない*/ + el.removeChild(tar._fillElement); + isFill = true; } if (!!!tar._strokeElement) { tar._strokeElement = document.createElement("v:stroke"); - el.appendChild(tar._strokeElement); + } else { + /*あらかじめ消しおかないと、効果が出ない*/ + el.removeChild(tar._strokeElement); + isStroke = true; } + var fillElement = tar._fillElement, strokeElement = tar._strokeElement; setProp.call(s, propertyName, value, priority); if (propertyName === "fill-opacity") { var fillOpacity = parseFloat(value) * style._list._opacity; //opacityを掛け合わせる if (fillOpacity < 1) { fillElement.setAttribute("opacity", fillOpacity+""); + isFill = true; } } else if (propertyName === "opacity") { var fillOpacity = parseFloat(style.getPropertyValue("fill-opacity")) * parseFloat(value); //opacityを掛け合わせる if (fillOpacity < 1) { fillElement.setAttribute("opacity", fillOpacity+""); + isFill = true; } var strokeOpacity = parseFloat(style.getPropertyValue("stroke-opacity")) * parseFloat(value); if (strokeOpacity < 1) { strokeElement.setAttribute("opacity", strokeOpacity+""); + isStroke = true; } fillOpacity = strokeOpacity = null; } else if (propertyName === "fill") { @@ -744,6 +754,7 @@ el.appendChild(evtt._tar); tar._fillElement = evtt._tar; //キャッシュを作る } + isFill = true; t = evtt = null; } tod = null; @@ -753,6 +764,7 @@ } else { var fc = fill.rgbColor, num = CSSPrimitiveValue.CSS_NUMBER; fillElement.setAttribute("color", "rgb(" +fc.red.getFloatValue(num)+ "," +fc.green.getFloatValue(num)+ "," +fc.blue.getFloatValue(num)+ ")"); + isFill = true; } } else if (propertyName === "stroke") { var stroke = style.getPropertyCSSValue("stroke"); @@ -762,11 +774,13 @@ } else if (!stroke.uri) { var fc = stroke.rgbColor, num = CSSPrimitiveValue.CSS_NUMBER; strokeElement.setAttribute("color", "rgb(" +fc.red.getFloatValue(num)+ "," +fc.green.getFloatValue(num)+ "," +fc.blue.getFloatValue(num)+ ")"); + isStroke = true; } } else if (propertyName === "stroke-opacity") { var strokeOpacity = parseFloat(value) * parseFloat(style.getPropertyValue("opacity")); //opacityを掛け合わせる if (strokeOpacity < 1) { strokeElement.setAttribute("opacity", strokeOpacity); + isStroke = true; } fc = num = strokeOpacity = null; } else if (propertyName === "stroke-width") { @@ -774,17 +788,21 @@ sgsw._percent = Math.sqrt((w*w + h*h) / 2); var swx = sgsw.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) * Math.sqrt(Math.abs(tar.getScreenCTM()._determinant())); strokeElement.setAttribute("weight", swx + "px"); + isStroke = true; sgsw = w = h = null; } else if (propertyName === "stroke-miterlimit") { strokeElement.setAttribute("miterlimit", value); + isStroke = true; } else if (propertyName === "stroke-linejoin") { strokeElement.setAttribute("joinstyle", value); + isStroke = true; } else if (propertyName === "stroke-linecap") { if (value === "butt") { strokeElement.setAttribute("endcap", "flat"); } else { strokeElement.setAttribute("endcap", value); } + isStroke = true; } else if (propertyName === "stroke-dasharray") { var tsd = value; if (tsd !== "none") { @@ -799,6 +817,7 @@ } } strokeElement.setAttribute("dashstyle", strokedasharray); + isStroke = true; tsd = strs = null; } } else if ((propertyName === "cursor") && (value !== "auto") && (value !== "")) { @@ -808,6 +827,11 @@ } else if (propertyName === "display") { el.style.display = value; } + if (isFill) { + el.appendChild(tar._fillElement); + } else if (isStroke) { + el.appendChild(tar._strokeElement); + } el = fill = stroke = tar = value = propertyName = null; } return s;