Changeset 15905 for lang/actionscript
- Timestamp:
- 07/17/08 00:07:13 (4 months ago)
- Location:
- lang/actionscript/ascss/src
- Files:
-
- 10 modified
-
CSSTest.as (modified) (1 diff)
-
CSSTest.swf (modified) (previous)
-
KyotoDemo.as (modified) (2 diffs)
-
KyotoDemo.swf (modified) (previous)
-
css/ASCSS.asy (modified) (2 diffs)
-
css/CSSLexer.as (modified) (5 diffs)
-
css/CSSSelector.as (modified) (1 diff)
-
css/CSSStyleSelector.as (modified) (3 diffs)
-
css/RenderStyle.as (modified) (2 diffs)
-
css/Value.as (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/actionscript/ascss/src/CSSTest.as
r10809 r15905 660 660 } 661 661 662 public function isValidPrimitiveValue(aPropID:int, aValueId:int):Boolean 662 public function isColorValue(aPropID:int):Boolean 663 { 664 return false; 665 } 666 667 public function isValidPrimitiveValue(aPropID:int, aValue:Value, aValueId:int, aHost:IPropertyExtensionHost):Boolean 663 668 { 664 669 if (aPropID == mAzimuthPropID) -
lang/actionscript/ascss/src/KyotoDemo.as
r15881 r15905 127 127 tx.height = 300; 128 128 tx.textColor = 0xffffff; 129 tx.visible = false;129 // tx.visible = false; 130 130 onXMLChanged(null); 131 131 } … … 361 361 362 362 var ed:ElementData, wrapper:XMLElementWrapper 363 STDOUT.cls();364 363 365 364 var list:Array = mDocument.elementMetadatas.slice(); -
lang/actionscript/ascss/src/css/ASCSS.asy
r15818 r15905 1249 1249 $$.id = 0; 1250 1250 $$.unit = Value.Function; 1251 $$. function = f;1251 $$.parseFunction = f; 1252 1252 } | 1253 1253 FUNCTION maybe_space error { … … 1259 1259 $$.id = 0; 1260 1260 $$.unit = Value.Function; 1261 $$. function = f;1261 $$.parseFunction = f; 1262 1262 } 1263 1263 ; -
lang/actionscript/ascss/src/css/CSSLexer.as
r15743 r15905 62 62 private static const mRxContains:RegExp = /^\*=/ 63 63 private static const mRxWhitespace:RegExp = /^[ \t\r\n\f]+/ 64 private static const mRxSingleChars:RegExp = /^[-+;:{}#.,*>~\[\]=]/ 64 private static const mRxSingleChars:RegExp = /^[)-+;:{}#.,*>~\[\]=]/ 65 private static const mRxNth:RegExp = /^((-?[0-9]*n[\+-][0-9]+)|(-?[0-9]*n))/ 65 66 private static const mRxCommnet:RegExp = new RegExp("^\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\/"); 66 67 … … 68 69 private var mRxIdsel:RegExp; 69 70 private var mRxIdent:RegExp; 71 private var mRxFunction:RegExp; 70 72 private var mRxString:RegExp; 71 73 private var mRxNum:RegExp; … … 91 93 mRxIdsel = new RegExp("^#"+RX_IDENT); 92 94 mRxIdent = new RegExp("^"+RX_IDENT); 95 mRxFunction = new RegExp("^"+RX_IDENT+"\\("); 93 96 //mRxString = new RegExp("^"+RX_STRING); 94 97 mRxString = /^"(?:\\.|[^"])*"|^'(?:[^']|\\.)*'/ … … 159 162 mTokBody = rxr[1]; 160 163 } 164 else if ((rxr = mRxFunction.exec(mCurSource)) != null) 165 { 166 kw = PARSER.FUNCTION; 167 advance = rxr[0].length; 168 mTokBody = rxr[0]; 169 } 161 170 else if ((rxr = mRxIdsel.exec(mCurSource)) != null) 162 171 { … … 195 204 kw = PARSER.PERCENTAGE; 196 205 advance = rxr[0].length; mTokBody = rxr[1]; 206 } 207 else if ((rxr = mRxNth.exec(mCurSource)) != null) 208 { 209 kw = PARSER.NTH; 210 advance = rxr[0].length; 211 mTokBody = rxr[0]; 197 212 } 198 213 else if ((rxr = mRxNum.exec(mCurSource)) != null) -
lang/actionscript/ascss/src/css/CSSSelector.as
r15820 r15905 197 197 public var m_match:uint; 198 198 public var m_relation:uint; 199 public var m_argument:String; 199 200 public var mPseudoType:uint; 200 201 private var mNext:CSSSelector; -
lang/actionscript/ascss/src/css/CSSStyleSelector.as
r15881 r15905 538 538 539 539 var result:Boolean, n:IASCSSElement; 540 var nthAB:Array = [0, 0]; 540 541 if (sel.m_match == CSSSelector.PseudoClass) { 541 542 switch (sel.pseudoType()) { … … 611 612 break; 612 613 } 614 615 case CSSSelector.PseudoNthChild: { 616 // calculate a and b every time we run through checkOneSelector 617 // this should probably be saved after we calculate it once, but currently 618 // would require increasing the size of CSSSelector 619 if (!parseNth(sel.m_argument, nthAB)) 620 break; 621 622 if (e.parentNode && e.parentNode.isElementNode) 623 { 624 var count:int = 1; 625 n = e.previousSibling; 626 627 while (n) { 628 if (n.isElementNode) { 629 /* 630 var s:RenderStyle = n.renderStyle; 631 var index:uint = s ? s.childIndex : 0; 632 if (index > 0) { 633 count += index; 634 break; 635 } 636 */ 637 count++; 638 } 639 n = n.previousSibling; 640 } 641 642 if (!mCollectRulesOnly) { 643 var childStyle:RenderStyle = (mElement == e) ? mStyle : e.renderStyle; 644 // RenderStyle* parentStyle = (m_element == e) ? m_parentStyle : e->parentNode()->renderStyle(); 645 if (childStyle) 646 childStyle.childIndex = count; 647 // if (parentStyle) 648 // parentStyle->setChildrenAffectedByForwardPositionalRules(); 649 } 650 651 if (matchNth(count, nthAB[0], nthAB[1])) 652 return true; 653 654 } 655 656 break; 657 658 659 } // case CSSSelector::PseudoNthChild 613 660 } 614 661 return false; … … 633 680 } 634 681 682 // a helper function for parsing nth-arguments 683 private static function parseNth(nth:String, idx:Array):Boolean 684 { 685 if (!nth || nth.length < 1) 686 return false; 687 idx[0] = 0; 688 idx[1] = 0; 689 if (nth == "odd") { 690 idx[0] = 2; 691 idx[1] = 1; 692 } else if (nth == "even") { 693 idx[0] = 2; 694 idx[1] = 0; 695 } else { 696 var n:int = nth.indexOf('n'); 697 if (n != -1) { 698 if (nth.charAt(0) == '-') { 699 if (n == 1) 700 idx[0] = -1; // -n == -1n 701 else 702 idx[0] = parseInt( nth.substring(0, n) ); 703 } else if (!n) 704 idx[0] = 1; // n == 1n 705 else 706 idx[0] = parseInt( nth.substring(0, n) ); 707 708 var p:int = nth.indexOf('+', n); 709 if (p != -1) 710 idx[1] = parseInt( nth.substring(p + 1) ); 711 else { 712 p = nth.indexOf('-', n); 713 idx[1] = -parseInt( nth.substring(p + 1) ); 714 } 715 } else 716 idx[1] = parseInt(nth); 717 } 718 return true; 719 } 720 635 721 public static function htmlAttributeHasCaseInsensitiveValue(attr:QualifiedName):Boolean 636 722 { -
lang/actionscript/ascss/src/css/RenderStyle.as
r12321 r15905 6 6 private var mAffectedByHoverRules:Boolean = false; 7 7 private var mEmpty:Boolean = true; 8 private var mChildIndex:uint = 0; 8 9 9 10 public static const PseudoUnknown:uint = 0; … … 45 46 } 46 47 48 public function set childIndex(i:uint):void 49 { 50 mChildIndex = i; 51 } 52 53 public function get childIndex():uint 54 { 55 return mChildIndex; 56 } 57 47 58 public function setPropertyById(propId:int, value:CSSValue):void 48 59 { -
lang/actionscript/ascss/src/css/Value.as
r10659 r15905 19 19 public var fValue:Number; 20 20 public var iValue:int; 21 public var parseFunction:ParseFunction; 21 22 22 23 public function set string(s:String):void
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)