[Sie-announce] SIEコード [1672] getOverrideStyleメソッドを実装

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 2月 23日 (火) 22:35:28 JST


Revision: 1672
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1672
Author:   dhrname
Date:     2010-02-23 22:35:28 +0900 (Tue, 23 Feb 2010)

Log Message:
-----------
getOverrideStyleメソッドを実装

Modified Paths:
--------------
    branches/ufltima/dom/css.js

Modified: branches/ufltima/dom/css.js
===================================================================
--- branches/ufltima/dom/css.js	2010-02-20 14:35:02 UTC (rev 1671)
+++ branches/ufltima/dom/css.js	2010-02-23 13:35:28 UTC (rev 1672)
@@ -403,6 +403,8 @@
 
 function ElementCSSInlineStyle() {
   this.style = new CSSStyleDeclaration();
+  this._runtimeStyle = new CSSStyleDeclaration();   //getOverrideStyleメソッドで利用する
+  this._attributeStyle = new CSSStyleDeclaration(); //プレゼンテーション属性の値を格納する
   return this;
 };
 
@@ -640,16 +642,15 @@
 /*interface ViewCSS : views::AbstractView {*/
 Document.prototype.defaultView = {
   /*CSSStyleDeclaration*/ getComputedStyle : function( /*Element*/ elt, /*string*/ pseudoElt) {
-    var s = new CSSStyleDeclaration(), esp;
+    var s = new CSSStyleDeclaration();
     do {
-      s._list = s._list.concat(elt.style._list); //リストを連結することによって、カスケーディングを実現する
-      esp = elt.style.parentRule;                //ルールに結び付けられていれば、それも継承する
-      if (esp) {
-        s._list = s._list.concat(esp.style._list);
-      }
+      //リストを連結することによって、カスケーディングを実現する
+      s._list = s._list.concat(elt.ownerDocument.getOverrideStyle(elt)._list); //まず、上書きスタイルシートから処理
+      s._list = s._list.concat(elt.style._list);
+      s._list = s._list.concat(elt._attributeStyle._list);  //プレゼンテーション属性を結びつける
       elt = elt.parentNode;     
     } while (elt);
-    s._list = s._list.concat(CSS2Properties._list); //デフォルト値の設定
+    s._list = s._list.concat(CSS2Properties._list);         //デフォルト値の設定
     return s;
   }
 };
@@ -659,6 +660,7 @@
  */
 /*function DocumentCSS : stylesheets::DocumentStyle {*/
 /*CSSStyleDeclaration*/ Document.prototype.getOverrideStyle = function( /*Element*/ elt, /*string*/ pseudoElt) {
+  return (elt._runtimeStyle);
 };
 /*createCSSStyleSheetメソッド
  *文書のスタイルシートを作成




Sie-announce メーリングリストの案内
Back to archive index