Commit 4c1fff6c authored by Vadim Zaslavsky's avatar Vadim Zaslavsky Committed by mrbean-bremen
Browse files

Font shorthand parsing fixed

See ExCSS pull request #62: https://github.com/TylerBrinks/ExCSS/pull/62
parent 38d6c5e2
...@@ -119,5 +119,13 @@ namespace ExCSS ...@@ -119,5 +119,13 @@ namespace ExCSS
Comma, Comma,
Space Space
} }
internal void SetLastTerm(Term term)
{
if (Length == 0)
AddTerm(term);
else
_items[Length - 1] = term;
}
} }
} }
...@@ -131,18 +131,18 @@ namespace ExCSS ...@@ -131,18 +131,18 @@ namespace ExCSS
private bool AddTerm(Term value) private bool AddTerm(Term value)
{ {
var added = true;
if (_isFraction) if (_isFraction)
{ {
if (_terms.Length > 0) if (_terms.Length > 0)
{ {
value = new PrimitiveTerm(UnitType.Unknown, _terms[0] + "/" + value); value = new PrimitiveTerm(UnitType.Unknown, _terms[_terms.Length - 1] + "/" + value);
_terms = new TermList();
} }
_terms.SetLastTerm(value);
_isFraction = false; _isFraction = false;
} }
else if (_functionBuffers.Count > 0)
if (_functionBuffers.Count > 0)
{ {
_functionBuffers.Peek().TermList.Add(value); _functionBuffers.Peek().TermList.Add(value);
} }
...@@ -156,10 +156,10 @@ namespace ExCSS ...@@ -156,10 +156,10 @@ namespace ExCSS
} }
else else
{ {
return false; added = false;
} }
return true; return added;
} }
private void FinalizeProperty() private void FinalizeProperty()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment