diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 8323cd780d16..87ec94e06366 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,15 @@ +2008-02-11 Rob Buis + + Reviewed by David Kilzer. + + http://bugs.webkit.org/show_bug.cgi?id=17201 + Bug 17201: Use RefPtr in CSSParser::parseFont() to get rid of goto silliness + + Gets rid of goto usage in parseFont. + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseFont): + 2008-02-11 David Hyatt Fix for bug 17298, Acid3 text should be black and not red. Make sure stylesheets with the wrong MIME type diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp index 3f2c8f98d6ea..5abef296af9c 100644 --- a/WebCore/css/CSSParser.cpp +++ b/WebCore/css/CSSParser.cpp @@ -2558,7 +2558,7 @@ bool CSSParser::parseFont(bool important) { bool valid = true; Value *value = valueList->current(); - FontValue *font = new FontValue; + RefPtr font = new FontValue; // optional font-style, font-variant and font-weight while (value) { int id = value->id; @@ -2567,15 +2567,15 @@ bool CSSParser::parseFont(bool important) // do nothing, it's the inital value for all three } else if (id == CSS_VAL_ITALIC || id == CSS_VAL_OBLIQUE) { if (font->style) - goto invalid; + return false; font->style = new CSSPrimitiveValue(id); } else if (id == CSS_VAL_SMALL_CAPS) { if (font->variant) - goto invalid; + return false; font->variant = new CSSPrimitiveValue(id); } else if (id >= CSS_VAL_BOLD && id <= CSS_VAL_LIGHTER) { if (font->weight) - goto invalid; + return false; font->weight = new CSSPrimitiveValue(id); } else { valid = false; @@ -2614,7 +2614,7 @@ bool CSSParser::parseFont(bool important) value = valueList->next(); } if (!value) - goto invalid; + return false; // set undefined values to default if (!font->style) @@ -2632,22 +2632,22 @@ bool CSSParser::parseFont(bool important) font->size = new CSSPrimitiveValue(value->fValue, (CSSPrimitiveValue::UnitTypes) value->unit); value = valueList->next(); if (!font->size || !value) - goto invalid; + return false; if (value->unit == Value::Operator && value->iValue == '/') { // line-height value = valueList->next(); if (!value) - goto invalid; + return false; if (value->id == CSS_VAL_NORMAL) { // default value, nothing to do } else if (validUnit(value, FNumber|FLength|FPercent, strict)) font->lineHeight = new CSSPrimitiveValue(value->fValue, (CSSPrimitiveValue::UnitTypes) value->unit); else - goto invalid; + return false; value = valueList->next(); if (!value) - goto invalid; + return false; } if (!font->lineHeight) @@ -2657,14 +2657,10 @@ bool CSSParser::parseFont(bool important) font->family = parseFontFamily(); if (valueList->current() || !font->family) - goto invalid; + return false; - addProperty(CSS_PROP_FONT, font, important); + addProperty(CSS_PROP_FONT, font.release(), important); return true; - - invalid: - delete font; - return false; } PassRefPtr CSSParser::parseFontFamily()