Changeset 15881 for lang/actionscript

Show
Ignore:
Timestamp:
07/16/08 03:24:11 (4 months ago)
Author:
gyuque
Message:

updated demo

Location:
lang/actionscript/ascss/src
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • lang/actionscript/ascss/src/KyotoDemo.as

    r15869 r15881  
    348348 
    349349 
    350                 private static const rxStartTag:RegExp = /<[-_a-zA-Z0-9]+[^>]*>/ 
    351                 private static const rxEndTag:RegExp = /<\/[-_a-zA-Z0-9]+[^>]*>/ 
     350                private static const rxStartTag:RegExp = /^<[-_a-zA-Z0-9]+[^>]*>/ 
     351                private static const rxEndTag:RegExp = /^<\/[-_a-zA-Z0-9]+[^>]*>/ 
    352352                private static const rxEmptyTag:RegExp = /\/[ \t]*>/ 
    353353 
    354                 private static const rxCommentStart:RegExp = /<!--/ 
     354                private static const rxCommentStart:RegExp = /^<!--/ 
    355355                private static const rxCommentEnd:RegExp = /-->/ 
    356356 
     
    374374                        var fwd:String; 
    375375                        for (;;) { 
     376                                curpos = src.indexOf('<', curpos); 
     377                                if (curpos < 0) break; 
     378 
    376379                                fwd = src.substring(curpos); 
    377380 
  • lang/actionscript/ascss/src/css/CSSStyleSelector.as

    r15869 r15881  
    584584                                                break; 
    585585                                        } 
     586 
     587                                        case CSSSelector.PseudoLastChild: 
     588                                        { 
     589                                                // last-child matches the last child that is an element 
     590                                                if (e.parentNode && e.parentNode.isElementNode) { 
     591                                                        result = false; 
     592//                                                      if (parentNode->isFinishedParsingChildren()) { 
     593                                                                n = e.nextSibling; 
     594                                                                while (n && !n.isElementNode) 
     595                                                                        n = n.nextSibling; 
     596                                                                if (!n) 
     597                                                                        result = true; 
     598//                                                      } 
     599/* 
     600                                                        if (!m_collectRulesOnly) { 
     601                                                                RenderStyle* childStyle = (m_element == e) ? m_style : e->renderStyle(); 
     602                                                                RenderStyle* parentStyle = (m_element == e) ? m_parentStyle : parentNode->renderStyle(); 
     603                                                                if (parentStyle) 
     604                                                                        parentStyle->setChildrenAffectedByLastChildRules(); 
     605                                                                if (result && childStyle) 
     606                                                                        childStyle->setLastChildState(); 
     607                                                        } 
     608*/ 
     609                                                        return result; 
     610                                                } 
     611                                                break; 
     612                                        } 
    586613                                } 
    587614                                return false; 
     
    589616 
    590617                        return true; 
     618                } 
     619 
     620                public static function matchNth(count:int, a:int, b:int):Boolean 
     621                { 
     622                    if (a == 0) 
     623                        return count == b; 
     624                    else if (a > 0) { 
     625                        if (count < b) 
     626                            return false; 
     627                        return (count - b) % a == 0; 
     628                    } else { 
     629                        if (count > b) 
     630                            return false; 
     631                        return (b - count) % (-a) == 0; 
     632                    } 
    591633                } 
    592634 
  • lang/actionscript/ascss/src/cssdom/IASCSSElement.as

    r15869 r15881  
    1212                function get parentNode():IASCSSElement; 
    1313                function get previousSibling():IASCSSElement; 
     14                function get nextSibling():IASCSSElement; 
    1415                function getAttributeQ(qn:QualifiedName):String 
    1516                function get document():IASCSSDocument 
  • lang/actionscript/ascss/src/cssdom/XMLElementWrapper.as

    r15869 r15881  
    1212                private var mElement:XML; 
    1313                private var mParent:XMLElementWrapper; 
    14                 private var mPreviousSibling:XMLElementWrapper; 
     14                private var mPreviousSibling:XMLElementWrapper = null; 
     15                private var mNextSibling:XMLElementWrapper = null; 
    1516                private var mChildren:Array; 
    1617                private var mClassNames:ClassNames; 
     
    8384                                var ch_w:XMLElementWrapper = createFor(ch, d); 
    8485                                ch_w.parent = wrapper; 
    85                                 ch_w.setPreviousSibling(prev); 
     86                                if (prev) 
     87                                        prev.chainNextSibling(ch_w); 
    8688 
    8789                                if (!wrapper.mChildren) 
     
    138140                } 
    139141 
    140                 public function setPreviousSibling(s:XMLElementWrapper):void 
    141                 { 
    142                         mPreviousSibling = s; 
     142                public function get nextSibling():IASCSSElement 
     143                { 
     144                        return mNextSibling; 
     145                } 
     146 
     147                public function chainNextSibling(nxt:XMLElementWrapper):void 
     148                { 
     149                        nxt.mPreviousSibling = this; 
     150                        mNextSibling = nxt; 
    143151                } 
    144152 
  • lang/actionscript/ascss/src/kyotodemo/XMLDocument.as

    r15869 r15881  
    7777                                if (chdata) 
    7878                                { 
    79                                         chdata.wrapper.setPreviousSibling(prevsib_chdata ? prevsib_chdata.wrapper : null); 
     79                                        if (prevsib_chdata) 
     80                                                prevsib_chdata.wrapper.chainNextSibling(chdata.wrapper); 
    8081                                        prevsib_chdata = chdata; 
    8182                                }