internal void AppendStyleRule(CssRule aRule) { mOrderedRules.Add(aRule); aRule.SetStyleSheet(this); if (aRule.GetKind() == CssRuleKind.Namespace) { RegisterNamespaceRule((CssNamespaceRule)aRule); } }
internal nsresult ParseRule(string aRule, Uri aSheetURI, Uri aBaseURI, nsIPrincipal aSheetPrincipal, ref Rule aResult) { if (aSheetPrincipal == null) throw new ArgumentException("Must have principal here!"); if (aBaseURI == null) throw new ArgumentException("need base URI"); aResult = null; var scanner = new nsCSSScanner(aRule, 0); var reporter = new ErrorReporter(scanner, mSheet, mChildLoader, aSheetURI); InitScanner(scanner, reporter, aSheetURI, aBaseURI, aSheetPrincipal); mSection = nsCSSSection.Charset; // callers are responsible for rejecting invalid rules. nsCSSToken tk = mToken; // Get first non-whitespace token nsresult rv = nsresult.OK; if (!GetToken(true)) { { if (!mSuppressErrors) mReporter.ReportUnexpected("PEParseRuleWSOnly"); }; mReporter.OutputError(); rv = nsresult.ERROR_DOM_SYNTAX_ERR; } else { if (nsCSSTokenType.AtKeyword == tk.mType) { // FIXME: perhaps aInsideBlock should be true when we are? Rule result = null; ParseAtRule((rule, _) => result = rule, aResult, false); aResult = result; } else { UngetToken(); Rule result = null; ParseRuleSet((rule, _) => result = rule, aResult); aResult = result; } if (aResult != null && GetToken(true)) { // garbage after rule { if (!mSuppressErrors) mReporter.ReportUnexpected("PERuleTrailing", mToken); }; aResult = null; } if (aResult == null) { rv = nsresult.ERROR_DOM_SYNTAX_ERR; mReporter.OutputError(); } } ReleaseScanner(); return rv; }
internal void AppendRule(Rule aRule) { uint32_t count = mGroupStack.Length(); if (0 < count) { mGroupStack[count - 1].AppendStyleRule(aRule); } else { mSheet.AppendStyleRule(aRule); } }
internal void AppendStyleRule(CssRule aRule) { mRules.Add(aRule); }
internal nsresult GetStyleRuleAt(int aIndex, ref CssRule aRule) { aRule = mOrderedRules[aIndex]; return(nsresult.OK); }