#include "core/css/CSSFunctionValue.h"
#include "core/css/CSSGradientValue.h"
#include "core/css/CSSGridLineNamesValue.h"
-#include "core/css/CSSGridTemplateValue.h"
+#include "core/css/CSSGridTemplateAreasValue.h"
#include "core/css/CSSImageSetValue.h"
#include "core/css/CSSImageValue.h"
#include "core/css/CSSInheritedValue.h"
#include "core/css/CSSUnicodeRangeValue.h"
#include "core/css/CSSValueList.h"
#include "core/css/CSSValuePool.h"
-#include "core/css/CSSVariableValue.h"
#include "core/css/Counter.h"
#include "core/css/HashTools.h"
#include "core/css/MediaList.h"
return equalIgnoringCase(value->string, b);
}
-static PassRefPtr<CSSPrimitiveValue> createPrimitiveValuePair(PassRefPtr<CSSPrimitiveValue> first, PassRefPtr<CSSPrimitiveValue> second, Pair::IdenticalValuesPolicy identicalValuesPolicy = Pair::DropIdenticalValues)
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createPrimitiveValuePair(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> first, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> second, Pair::IdenticalValuesPolicy identicalValuesPolicy = Pair::DropIdenticalValues)
{
return cssValuePool().createValue(Pair::create(first, second, identicalValuesPolicy));
}
bool m_hasSeenAnimationPropertyKeyword;
};
-BisonCSSParser::BisonCSSParser(const CSSParserContext& context, UseCounter* counter)
+BisonCSSParser::BisonCSSParser(const CSSParserContext& context)
: m_context(context)
, m_important(false)
, m_id(CSSPropertyInvalid)
, m_allowImportRules(true)
, m_allowNamespaceDeclarations(true)
, m_inViewport(false)
- , m_useCounter(counter)
, m_tokenizer(*this)
{
#if YYDEBUG > 0
if (valueID == CSSValueNone || valueID == CSSValueRow || valueID == CSSValueColumn)
return RuntimeEnabledFeatures::cssGridLayoutEnabled();
break;
- case CSSPropertyWebkitLineAlign:
- if (valueID == CSSValueNone || valueID == CSSValueEdges)
- return true;
- break;
case CSSPropertyWebkitLineBreak: // auto | loose | normal | strict | after-white-space
if (valueID == CSSValueAuto || valueID == CSSValueLoose || valueID == CSSValueNormal || valueID == CSSValueStrict || valueID == CSSValueAfterWhiteSpace)
return true;
break;
- case CSSPropertyWebkitLineSnap:
- if (valueID == CSSValueNone || valueID == CSSValueBaseline || valueID == CSSValueContain)
- return true;
- break;
case CSSPropertyWebkitMarginAfterCollapse:
case CSSPropertyWebkitMarginBeforeCollapse:
case CSSPropertyWebkitMarginBottomCollapse:
if (valueID == CSSValueExact || valueID == CSSValueEconomy)
return true;
break;
- case CSSPropertyWebkitRegionBreakAfter:
- case CSSPropertyWebkitRegionBreakBefore:
- if (RuntimeEnabledFeatures::cssRegionsEnabled() && (valueID == CSSValueAuto || valueID == CSSValueAlways || valueID == CSSValueAvoid || valueID == CSSValueLeft || valueID == CSSValueRight))
- return true;
- break;
- case CSSPropertyWebkitRegionBreakInside:
- if (RuntimeEnabledFeatures::cssRegionsEnabled() && (valueID == CSSValueAuto || valueID == CSSValueAvoid))
- return true;
- break;
- case CSSPropertyWebkitRegionFragment:
- if (RuntimeEnabledFeatures::cssRegionsEnabled() && (valueID == CSSValueAuto || valueID == CSSValueBreak))
- return true;
- break;
case CSSPropertyWebkitRtlOrdering:
if (valueID == CSSValueLogical || valueID == CSSValueVisual)
return true;
case CSSPropertyFontKerning:
case CSSPropertyWebkitFontSmoothing:
case CSSPropertyGridAutoFlow:
- case CSSPropertyWebkitLineAlign:
case CSSPropertyWebkitLineBreak:
- case CSSPropertyWebkitLineSnap:
case CSSPropertyWebkitMarginAfterCollapse:
case CSSPropertyWebkitMarginBeforeCollapse:
case CSSPropertyWebkitMarginBottomCollapse:
case CSSPropertyInternalMarqueeDirection:
case CSSPropertyInternalMarqueeStyle:
case CSSPropertyWebkitPrintColorAdjust:
- case CSSPropertyWebkitRegionBreakAfter:
- case CSSPropertyWebkitRegionBreakBefore:
- case CSSPropertyWebkitRegionBreakInside:
- case CSSPropertyWebkitRegionFragment:
case CSSPropertyWebkitRtlOrdering:
case CSSPropertyWebkitRubyPosition:
case CSSPropertyWebkitTextCombine:
}
template <typename CharType>
-static PassRefPtr<CSSTransformValue> parseTranslateTransformValue(CharType*& pos, CharType* end)
+static PassRefPtrWillBeRawPtr<CSSTransformValue> parseTranslateTransformValue(CharType*& pos, CharType* end)
{
static const int shortestValidTransformStringLength = 12;
}
pos += argumentStart;
- RefPtr<CSSTransformValue> transformValue = CSSTransformValue::create(transformType);
+ RefPtrWillBeRawPtr<CSSTransformValue> transformValue = CSSTransformValue::create(transformType);
if (!parseTransformTranslateArguments(pos, end, expectedArgumentCount, transformValue.get()))
return 0;
return transformValue.release();
}
template <typename CharType>
-static PassRefPtr<CSSValueList> parseTranslateTransformList(CharType*& pos, CharType* end)
+static PassRefPtrWillBeRawPtr<CSSValueList> parseTranslateTransformList(CharType*& pos, CharType* end)
{
- RefPtr<CSSValueList> transformList;
+ RefPtrWillBeRawPtr<CSSValueList> transformList;
while (pos < end) {
while (pos < end && isCSSSpace(*pos))
++pos;
- RefPtr<CSSTransformValue> transformValue = parseTranslateTransformValue(pos, end);
+ RefPtrWillBeRawPtr<CSSTransformValue> transformValue = parseTranslateTransformValue(pos, end);
if (!transformValue)
return 0;
if (!transformList)
return false;
if (string.isEmpty())
return false;
- RefPtr<CSSValueList> transformList;
+ RefPtrWillBeRawPtr<CSSValueList> transformList;
if (string.is8Bit()) {
const LChar* pos = string.characters8();
const LChar* end = pos + string.length();
return true;
}
-PassRefPtr<CSSValueList> BisonCSSParser::parseFontFaceValue(const AtomicString& string)
+PassRefPtrWillBeRawPtr<CSSValueList> BisonCSSParser::parseFontFaceValue(const AtomicString& string)
{
if (string.isEmpty())
return 0;
return toCSSValueList(dummyStyle->getPropertyCSSValue(CSSPropertyFontFamily).get());
}
+PassRefPtr<CSSValue> BisonCSSParser::parseAnimationTimingFunctionValue(const String& string)
+{
+ if (string.isEmpty())
+ return 0;
+ RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create();
+ if (!parseValue(style.get(), CSSPropertyAnimationTimingFunction, string, false, HTMLStandardMode, 0))
+ return 0;
+
+ return style->getPropertyCSSValue(CSSPropertyAnimationTimingFunction);
+}
+
bool BisonCSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID propertyID, const String& string, bool important, const Document& document)
{
ASSERT(!string.isEmpty());
- CSSParserContext context(document);
+ CSSParserContext context(document, UseCounter::getFrom(&document));
if (parseSimpleLengthValue(declaration, propertyID, string, important, context.mode()))
return true;
if (parseKeywordValue(declaration, propertyID, string, important, context))
return true;
- BisonCSSParser parser(context, UseCounter::getFrom(&document));
+ BisonCSSParser parser(context);
return parser.parseValue(declaration, propertyID, string, important, static_cast<StyleSheetContents*>(0));
}
if (parseColorValue(declaration, propertyID, string, important, cssParserMode))
return true;
- CSSParserContext context(cssParserMode);
+ CSSParserContext context(cssParserMode, 0);
if (contextStyleSheet) {
context = contextStyleSheet->parserContext();
context.setMode(cssParserMode);
{
// FIXME: Check RuntimeCSSEnabled::isPropertyEnabled or isValueEnabledForProperty.
- if (m_useCounter)
- m_useCounter->count(m_context, propertyID);
+ if (m_context.useCounter())
+ m_context.useCounter()->count(m_context, propertyID);
setStyleSheet(contextStyleSheet);
if (fastParseColor(color, string, strict))
return true;
- BisonCSSParser parser(HTMLStandardMode);
+ BisonCSSParser parser(strictCSSParserContext());
// In case the fast-path parser didn't understand the color, try the full parser.
if (!parser.parseColor(string))
PassRefPtr<ImmutableStylePropertySet> BisonCSSParser::parseInlineStyleDeclaration(const String& string, Element* element)
{
Document& document = element->document();
- CSSParserContext context = document.elementSheet()->contents()->parserContext();
+ CSSParserContext context = CSSParserContext(document.elementSheet()->contents()->parserContext(), UseCounter::getFrom(&document));
context.setMode((element->isHTMLElement() && !document.inQuirksMode()) ? HTMLStandardMode : HTMLQuirksMode);
- return BisonCSSParser(context, UseCounter::getFrom(&document)).parseDeclaration(string, document.elementSheet()->contents());
+ return BisonCSSParser(context).parseDeclaration(string, document.elementSheet()->contents());
}
PassRefPtr<ImmutableStylePropertySet> BisonCSSParser::parseDeclaration(const String& string, StyleSheetContents* contextStyleSheet)
return m_mediaList.release();
}
-static inline void filterProperties(bool important, const BisonCSSParser::ParsedPropertyVector& input, Vector<CSSProperty, 256>& output, size_t& unusedEntries, BitArray<numCSSProperties>& seenProperties, HashSet<AtomicString>& seenVariables)
+static inline void filterProperties(bool important, const BisonCSSParser::ParsedPropertyVector& input, Vector<CSSProperty, 256>& output, size_t& unusedEntries, BitArray<numCSSProperties>& seenProperties)
{
// Add properties in reverse order so that highest priority definitions are reached first. Duplicate definitions can then be ignored when found.
for (int i = input.size() - 1; i >= 0; --i) {
const CSSProperty& property = input[i];
if (property.isImportant() != important)
continue;
- if (property.id() == CSSPropertyVariable) {
- const AtomicString& name = toCSSVariableValue(property.value())->name();
- if (!seenVariables.add(name).isNewEntry)
- continue;
- output[--unusedEntries] = property;
- continue;
- }
const unsigned propertyIDIndex = property.id() - firstCSSProperty;
if (seenProperties.get(propertyIDIndex))
continue;
Vector<CSSProperty, 256> results(unusedEntries);
// Important properties have higher priority, so add them first. Duplicate definitions can then be ignored when found.
- HashSet<AtomicString> seenVariables;
- filterProperties(true, m_parsedProperties, results, unusedEntries, seenProperties, seenVariables);
- filterProperties(false, m_parsedProperties, results, unusedEntries, seenProperties, seenVariables);
+ filterProperties(true, m_parsedProperties, results, unusedEntries, seenProperties);
+ filterProperties(false, m_parsedProperties, results, unusedEntries, seenProperties);
if (unusedEntries)
results.remove(0, unusedEntries);
void BisonCSSParser::addProperty(CSSPropertyID propId, PassRefPtr<CSSValue> value, bool important, bool implicit)
{
- CSSPrimitiveValue* primitiveValue = value->isPrimitiveValue() ? toCSSPrimitiveValue(value.get()) : 0;
- // This property doesn't belong to a shorthand or is a CSS variable (which will be resolved later).
- if (!m_currentShorthand || (primitiveValue && primitiveValue->isVariableReference())) {
+ // This property doesn't belong to a shorthand.
+ if (!m_currentShorthand) {
m_parsedProperties.append(CSSProperty(propId, value, important, false, CSSPropertyInvalid, m_implicitShorthand || implicit));
return;
}
case CalcPercentNumber:
b = (unitflags & FPercent) && (unitflags & FNumber);
break;
- case CalcVariable:
- b = true;
- break;
case CalcOther:
break;
}
return b;
}
-static bool isVariableReference(CSSParserValue* value)
-{
- return value->unit == CSSParserValue::Function && equal(value->function->name, "var(");
-}
-
inline bool BisonCSSParser::shouldAcceptUnitLessValues(CSSParserValue* value, Units unitflags, CSSParserMode cssParserMode)
{
// Quirks mode and presentation attributes accept unit less values.
if (isCalculation(value))
return validCalculationUnit(value, unitflags, releaseCalc);
- // Variables are checked at the point they are dereferenced because unit type is not available here.
- if (isVariableReference(value))
- return true;
-
bool b = false;
switch (value->unit) {
case CSSPrimitiveValue::CSS_NUMBER:
return b;
}
-inline PassRefPtr<CSSPrimitiveValue> BisonCSSParser::createPrimitiveNumericValue(CSSParserValue* value)
+inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::createPrimitiveNumericValue(CSSParserValue* value)
{
- if (isVariableReference(value))
- return createPrimitiveVariableReferenceValue(value);
-
if (m_parsedCalculation) {
ASSERT(isCalculation(value));
return CSSPrimitiveValue::create(m_parsedCalculation.release());
return cssValuePool().createValue(value->fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit));
}
-inline PassRefPtr<CSSPrimitiveValue> BisonCSSParser::createPrimitiveStringValue(CSSParserValue* value)
+inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::createPrimitiveStringValue(CSSParserValue* value)
{
ASSERT(value->unit == CSSPrimitiveValue::CSS_STRING || value->unit == CSSPrimitiveValue::CSS_IDENT);
return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_STRING);
}
-inline PassRefPtr<CSSPrimitiveValue> BisonCSSParser::createPrimitiveVariableReferenceValue(CSSParserValue* value)
-{
- ASSERT(value->unit == CSSParserValue::Function && value->function->args->size() == 1);
- return CSSPrimitiveValue::create(value->function->args->valueAt(0)->string, CSSPrimitiveValue::CSS_VARIABLE_REFERENCE);
-}
-
static inline bool isComma(CSSParserValue* value)
{
return value && value->unit == CSSParserValue::Operator && value->iValue == ',';
return !id && validUnit(value, FLength | FPercent | FNonNeg);
}
-inline PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseValidPrimitive(CSSValueID identifier, CSSParserValue* value)
+inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseValidPrimitive(CSSValueID identifier, CSSParserValue* value)
{
if (identifier)
return cssValuePool().createIdentifierValue(identifier);
return CSSPrimitiveValue::createAllowingMarginQuirk(value->fValue, CSSPrimitiveValue::CSS_EMS);
if (isCalculation(value))
return CSSPrimitiveValue::create(m_parsedCalculation.release());
- if (isVariableReference(value))
- return createPrimitiveVariableReferenceValue(value);
return 0;
}
return false;
// We don't count the UA style sheet in our statistics.
- if (m_useCounter)
- m_useCounter->count(m_context, propId);
+ if (m_context.useCounter())
+ m_context.useCounter()->count(m_context, propId);
if (!m_valueList)
return false;
return true;
}
- if (!id && num == 1 && isVariableReference(value)) {
- addProperty(propId, createPrimitiveVariableReferenceValue(value), important);
- m_valueList->next();
- return true;
- }
- ASSERT(propId != CSSPropertyVariable);
-
if (isKeywordPropertyID(propId)) {
if (!isValidKeywordPropertyAndValue(propId, id, m_context))
return false;
// ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | text | wait | help |
// vertical-text | cell | context-menu | alias | copy | no-drop | not-allowed | -webkit-zoom-in
// -webkit-zoom-out | all-scroll | -webkit-grab | -webkit-grabbing ] ] | inherit
- RefPtr<CSSValueList> list;
+ RefPtrWillBeRawPtr<CSSValueList> list;
while (value) {
RefPtr<CSSValue> image = 0;
if (value->unit == CSSPrimitiveValue::CSS_URI) {
case CSSPropertyBorderImageOutset:
case CSSPropertyWebkitMaskBoxImageOutset: {
- RefPtr<CSSPrimitiveValue> result;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> result;
if (parseBorderImageOutset(result)) {
addProperty(propId, result, important);
return true;
}
case CSSPropertyBorderImageSlice:
case CSSPropertyWebkitMaskBoxImageSlice: {
- RefPtr<CSSBorderImageSliceValue> result;
+ RefPtrWillBeRawPtr<CSSBorderImageSliceValue> result;
if (parseBorderImageSlice(propId, result)) {
addProperty(propId, result, important);
return true;
}
case CSSPropertyBorderImageWidth:
case CSSPropertyWebkitMaskBoxImageWidth: {
- RefPtr<CSSPrimitiveValue> result;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> result;
if (parseBorderImageWidth(result)) {
addProperty(propId, result, important);
return true;
validPrimitive = validUnit(value, FLength | FPercent | FNonNeg);
if (!validPrimitive)
return false;
- RefPtr<CSSPrimitiveValue> parsedValue1 = createPrimitiveNumericValue(value);
- RefPtr<CSSPrimitiveValue> parsedValue2;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1 = createPrimitiveNumericValue(value);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2;
if (num == 2) {
value = m_valueList->next();
validPrimitive = validUnit(value, FLength | FPercent | FNonNeg);
if (id == CSSValueNone)
validPrimitive = true;
else {
- RefPtr<CSSValueList> shadowValueList = parseShadow(m_valueList.get(), propId);
+ RefPtrWillBeRawPtr<CSSValueList> shadowValueList = parseShadow(m_valueList.get(), propId);
if (shadowValueList) {
addProperty(propId, shadowValueList.release(), important);
m_valueList->next();
validPrimitive = validUnit(value, FNumber | FNonNeg);
break;
case CSSPropertyOrder:
- if (validUnit(value, FInteger, HTMLStandardMode)) {
- if (!isVariableReference(value)) {
- // We restrict the smallest value to int min + 2 because we use int min and int min + 1 as special values in a hash set.
- parsedValue = cssValuePool().createValue(max(static_cast<double>(std::numeric_limits<int>::min() + 2), value->fValue),
- static_cast<CSSPrimitiveValue::UnitTypes>(value->unit));
- m_valueList->next();
- } else {
- validPrimitive = true;
- }
- }
+ validPrimitive = validUnit(value, FInteger, HTMLStandardMode);
break;
case CSSPropertyInternalMarqueeIncrement:
if (id == CSSValueSmall || id == CSSValueLarge || id == CSSValueMedium)
else
validPrimitive = validUnit(value, FTime | FInteger | FNonNeg);
break;
- case CSSPropertyWebkitFlowInto:
- if (!RuntimeEnabledFeatures::cssRegionsEnabled())
- return false;
- return parseFlowThread(propId, important);
- case CSSPropertyWebkitFlowFrom:
- if (!RuntimeEnabledFeatures::cssRegionsEnabled())
- return false;
- return parseRegionThread(propId, important);
case CSSPropertyWebkitTransform:
if (id == CSSValueNone)
validPrimitive = true;
parsedValue = parseGridTrackSize(*m_valueList);
break;
- case CSSPropertyGridDefinitionColumns:
- case CSSPropertyGridDefinitionRows:
+ case CSSPropertyGridTemplateColumns:
+ case CSSPropertyGridTemplateRows:
if (!RuntimeEnabledFeatures::cssGridLayoutEnabled())
return false;
return parseGridTrackList(propId, important);
return false;
return parseGridAreaShorthand(important);
- case CSSPropertyGridTemplate:
+ case CSSPropertyGridTemplateAreas:
if (!RuntimeEnabledFeatures::cssGridLayoutEnabled())
return false;
- parsedValue = parseGridTemplate();
+ parsedValue = parseGridTemplateAreas();
break;
case CSSPropertyWebkitMarginCollapse: {
validPrimitive = true;
break;
- case CSSPropertyWebkitLineGrid:
- if (id == CSSValueNone)
- validPrimitive = true;
- else if (value->unit == CSSPrimitiveValue::CSS_IDENT) {
- String lineGridValue = String(value->string);
- if (!lineGridValue.isEmpty()) {
- addProperty(propId, cssValuePool().createValue(lineGridValue, CSSPrimitiveValue::CSS_STRING), important);
- return true;
- }
- }
- break;
case CSSPropertyWebkitLocale:
if (id == CSSValueAuto || value->unit == CSSPrimitiveValue::CSS_STRING)
validPrimitive = true;
return parseFontFeatureSettings(important);
break;
- case CSSPropertyWebkitFontVariantLigatures:
+ case CSSPropertyFontVariantLigatures:
if (id == CSSValueNormal)
validPrimitive = true;
else
case CSSPropertyTextUnderlineMode:
case CSSPropertyTextUnderlineStyle:
case CSSPropertyTouchActionDelay:
- case CSSPropertyVariable:
case CSSPropertyVisibility:
case CSSPropertyWebkitAppearance:
case CSSPropertyWebkitBackfaceVisibility:
case CSSPropertyFontKerning:
case CSSPropertyWebkitFontSmoothing:
case CSSPropertyGridAutoFlow:
- case CSSPropertyWebkitLineAlign:
case CSSPropertyWebkitLineBreak:
- case CSSPropertyWebkitLineSnap:
case CSSPropertyWebkitMarginAfterCollapse:
case CSSPropertyWebkitMarginBeforeCollapse:
case CSSPropertyWebkitMarginBottomCollapse:
case CSSPropertyInternalMarqueeDirection:
case CSSPropertyInternalMarqueeStyle:
case CSSPropertyWebkitPrintColorAdjust:
- case CSSPropertyWebkitRegionBreakAfter:
- case CSSPropertyWebkitRegionBreakBefore:
- case CSSPropertyWebkitRegionBreakInside:
- case CSSPropertyWebkitRegionFragment:
case CSSPropertyWebkitRtlOrdering:
case CSSPropertyWebkitRubyPosition:
case CSSPropertyWebkitTextCombine:
toCSSValueList(lval.get())->append(rval);
else {
PassRefPtr<CSSValue> oldlVal(lval.release());
- PassRefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ PassRefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
list->append(oldlVal);
list->append(rval);
lval = list;
return true;
}
-void BisonCSSParser::storeVariableDeclaration(const CSSParserString& name, PassOwnPtr<CSSParserValueList> value, bool important)
-{
- // When CSSGrammar.y encounters an invalid declaration it passes null for the CSSParserValueList, just bail.
- if (!value)
- return;
-
- static const unsigned prefixLength = sizeof("var-") - 1;
-
- ASSERT(name.length() > prefixLength);
- AtomicString variableReference = name.atomicSubstring(prefixLength, name.length() - prefixLength);
-
- StringBuilder builder;
- for (unsigned i = 0, size = value->size(); i < size; i++) {
- if (i)
- builder.append(' ');
- RefPtr<CSSValue> cssValue = value->valueAt(i)->createCSSValue();
- if (!cssValue)
- return;
- builder.append(cssValue->cssText());
- }
-
- addProperty(CSSPropertyVariable, CSSVariableValue::create(variableReference, builder.toString()), important, false);
-}
-
void BisonCSSParser::addAnimationValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> rval)
{
if (lval) {
toCSSValueList(lval.get())->append(rval);
else {
PassRefPtr<CSSValue> oldVal(lval.release());
- PassRefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ PassRefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
list->append(oldVal);
list->append(rval);
lval = list;
if (!value)
return false;
- RefPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSeparated();
// First parameter.
SizeParameterType paramType = parseSizeParameter(parsedValues.get(), value, None);
// inherit and none are handled in parseValue.
bool BisonCSSParser::parseQuotes(CSSPropertyID propId, bool important)
{
- RefPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
while (CSSParserValue* val = m_valueList->current()) {
RefPtr<CSSValue> parsedValue;
if (val->unit == CSSPrimitiveValue::CSS_STRING)
// [ <string> | attr(X) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit
bool BisonCSSParser::parseContent(CSSPropertyID propId, bool important)
{
- RefPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
while (CSSParserValue* val = m_valueList->current()) {
RefPtr<CSSValue> parsedValue;
return 0;
}
-PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseFillPositionComponent(CSSParserValueList* valueList, unsigned& cumulativeFlags, FillPositionFlag& individualFlag, FillPositionParsingMode parsingMode)
+PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseFillPositionComponent(CSSParserValueList* valueList, unsigned& cumulativeFlags, FillPositionFlag& individualFlag, FillPositionParsingMode parsingMode)
{
CSSValueID id = valueList->current()->id;
if (id == CSSValueLeft || id == CSSValueTop || id == CSSValueRight || id == CSSValueBottom || id == CSSValueCenter) {
return value == CSSValueLeft || value == CSSValueTop || value == CSSValueBottom || value == CSSValueRight || value == CSSValueCenter;
}
-void BisonCSSParser::parse4ValuesFillPosition(CSSParserValueList* valueList, RefPtr<CSSValue>& value1, RefPtr<CSSValue>& value2, PassRefPtr<CSSPrimitiveValue> parsedValue1, PassRefPtr<CSSPrimitiveValue> parsedValue2)
+void BisonCSSParser::parse4ValuesFillPosition(CSSParserValueList* valueList, RefPtr<CSSValue>& value1, RefPtr<CSSValue>& value2, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2)
{
// [ left | right ] [ <percentage] | <length> ] && [ top | bottom ] [ <percentage> | <length> ]
// In the case of 4 values <position> requires the second value to be a length or a percentage.
unsigned cumulativeFlags = 0;
FillPositionFlag value3Flag = InvalidFillPosition;
- RefPtr<CSSPrimitiveValue> value3 = parseFillPositionComponent(valueList, cumulativeFlags, value3Flag, ResolveValuesAsKeyword);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> value3 = parseFillPositionComponent(valueList, cumulativeFlags, value3Flag, ResolveValuesAsKeyword);
if (!value3)
return;
cumulativeFlags = 0;
FillPositionFlag value4Flag = InvalidFillPosition;
- RefPtr<CSSPrimitiveValue> value4 = parseFillPositionComponent(valueList, cumulativeFlags, value4Flag, ResolveValuesAsKeyword);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> value4 = parseFillPositionComponent(valueList, cumulativeFlags, value4Flag, ResolveValuesAsKeyword);
if (!value4)
return;
valueList->next();
}
-void BisonCSSParser::parse3ValuesFillPosition(CSSParserValueList* valueList, RefPtr<CSSValue>& value1, RefPtr<CSSValue>& value2, PassRefPtr<CSSPrimitiveValue> parsedValue1, PassRefPtr<CSSPrimitiveValue> parsedValue2)
+void BisonCSSParser::parse3ValuesFillPosition(CSSParserValueList* valueList, RefPtr<CSSValue>& value1, RefPtr<CSSValue>& value2, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2)
{
unsigned cumulativeFlags = 0;
FillPositionFlag value3Flag = InvalidFillPosition;
- RefPtr<CSSPrimitiveValue> value3 = parseFillPositionComponent(valueList, cumulativeFlags, value3Flag, ResolveValuesAsKeyword);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> value3 = parseFillPositionComponent(valueList, cumulativeFlags, value3Flag, ResolveValuesAsKeyword);
// value3 is not an expected value, we return.
if (!value3)
value1 = createPrimitiveValuePair(parsedValue1, parsedValue2);
value2 = createPrimitiveValuePair(cssValuePool().createIdentifierValue(secondPositionKeyword), cssValuePool().createValue(50, CSSPrimitiveValue::CSS_PERCENTAGE));
} else {
- RefPtr<CSSPrimitiveValue> firstPositionValue;
- RefPtr<CSSPrimitiveValue> secondPositionValue;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> firstPositionValue;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> secondPositionValue;
if (isFillPositionKeyword(ident2)) {
// To match CSS grammar, we should only accept: [ center | left | right | bottom | top ] [ left | right | top | bottom ] [ <percentage> | <length> ].
return;
}
- RefPtr<CSSPrimitiveValue> parsedValue1 = toCSSPrimitiveValue(value1.get());
- RefPtr<CSSPrimitiveValue> parsedValue2 = toCSSPrimitiveValue(value2.get());
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1 = toCSSPrimitiveValue(value1.get());
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2 = toCSSPrimitiveValue(value2.get());
value1.clear();
value2.clear();
if (value->id == CSSValueContain || value->id == CSSValueCover)
return cssValuePool().createIdentifierValue(value->id);
- RefPtr<CSSPrimitiveValue> parsedValue1;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1;
if (value->id == CSSValueAuto)
parsedValue1 = cssValuePool().createIdentifierValue(CSSValueAuto);
parsedValue1 = createPrimitiveNumericValue(value);
}
- RefPtr<CSSPrimitiveValue> parsedValue2;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2;
if ((value = m_valueList->next())) {
if (value->unit == CSSParserValue::Operator && value->iValue == ',')
allowComma = false;
bool BisonCSSParser::parseFillProperty(CSSPropertyID propId, CSSPropertyID& propId1, CSSPropertyID& propId2,
RefPtr<CSSValue>& retValue1, RefPtr<CSSValue>& retValue2)
{
- RefPtr<CSSValueList> values;
- RefPtr<CSSValueList> values2;
+ RefPtrWillBeRawPtr<CSSValueList> values;
+ RefPtrWillBeRawPtr<CSSValueList> values2;
CSSParserValue* val;
RefPtr<CSSValue> value;
RefPtr<CSSValue> value2;
bool BisonCSSParser::parseAnimationProperty(CSSPropertyID propId, RefPtr<CSSValue>& result, AnimationParseContext& context)
{
- RefPtr<CSSValueList> values;
+ RefPtrWillBeRawPtr<CSSValueList> values;
CSSParserValue* val;
RefPtr<CSSValue> value;
bool allowComma = false;
}
// The function parses [ <integer> || <string> ] in <grid-line> (which can be stand alone or with 'span').
-bool BisonCSSParser::parseIntegerOrStringFromGridPosition(RefPtr<CSSPrimitiveValue>& numericValue, RefPtr<CSSPrimitiveValue>& gridLineName)
+bool BisonCSSParser::parseIntegerOrStringFromGridPosition(RefPtrWillBeRawPtr<CSSPrimitiveValue>& numericValue, RefPtrWillBeRawPtr<CSSPrimitiveValue>& gridLineName)
{
CSSParserValue* value = m_valueList->current();
if (validUnit(value, FInteger) && value->fValue) {
return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_STRING);
}
- RefPtr<CSSPrimitiveValue> numericValue;
- RefPtr<CSSPrimitiveValue> gridLineName;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> numericValue;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> gridLineName;
bool hasSeenSpanKeyword = false;
if (parseIntegerOrStringFromGridPosition(numericValue, gridLineName)) {
if (hasSeenSpanKeyword && numericValue && numericValue->getIntValue() < 0)
return 0;
- RefPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
if (hasSeenSpanKeyword)
values->append(cssValuePool().createIdentifierValue(CSSValueSpan));
if (numericValue)
return;
}
- RefPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue::create();
+ RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue::create();
while (CSSParserValue* identValue = identList->current()) {
ASSERT(identValue->unit == CSSPrimitiveValue::CSS_IDENT);
- RefPtr<CSSPrimitiveValue> lineName = createPrimitiveStringValue(identValue);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> lineName = createPrimitiveStringValue(identValue);
lineNames->append(lineName.release());
identList->next();
}
return true;
}
- RefPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
// Handle leading <ident>*.
value = m_valueList->current();
if (value && value->unit == CSSParserValue::ValueList)
ASSERT_WITH_SECURITY_IMPLICATION(arguments->valueAt(0)->fValue > 0);
size_t repetitions = arguments->valueAt(0)->fValue;
- RefPtr<CSSValueList> repeatedValues = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> repeatedValues = CSSValueList::createSpaceSeparated();
arguments->next(); // Skip the repetition count.
arguments->next(); // Skip the comma.
if (!arguments || arguments->size() != 3 || !isComma(arguments->valueAt(1)))
return 0;
- RefPtr<CSSPrimitiveValue> minTrackBreadth = parseGridBreadth(arguments->valueAt(0));
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> minTrackBreadth = parseGridBreadth(arguments->valueAt(0));
if (!minTrackBreadth)
return 0;
- RefPtr<CSSPrimitiveValue> maxTrackBreadth = parseGridBreadth(arguments->valueAt(2));
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> maxTrackBreadth = parseGridBreadth(arguments->valueAt(2));
if (!maxTrackBreadth)
return 0;
- RefPtr<CSSValueList> parsedArguments = CSSValueList::createCommaSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> parsedArguments = CSSValueList::createCommaSeparated();
parsedArguments->append(minTrackBreadth);
parsedArguments->append(maxTrackBreadth);
return CSSFunctionValue::create("minmax(", parsedArguments);
return parseGridBreadth(currentValue);
}
-PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseGridBreadth(CSSParserValue* currentValue)
+PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseGridBreadth(CSSParserValue* currentValue)
{
if (currentValue->id == CSSValueMinContent || currentValue->id == CSSValueMaxContent)
return cssValuePool().createIdentifierValue(currentValue->id);
return createPrimitiveNumericValue(currentValue);
}
-PassRefPtr<CSSValue> BisonCSSParser::parseGridTemplate()
+PassRefPtr<CSSValue> BisonCSSParser::parseGridTemplateAreas()
{
NamedGridAreaMap gridAreaMap;
size_t rowCount = 0;
if (!rowCount || !columnCount)
return 0;
- return CSSGridTemplateValue::create(gridAreaMap, rowCount, columnCount);
+ return CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount);
}
PassRefPtr<CSSValue> BisonCSSParser::parseCounterContent(CSSParserValueList* args, bool counters)
CSSParserValue* i = args->current();
if (i->unit != CSSPrimitiveValue::CSS_IDENT)
return 0;
- RefPtr<CSSPrimitiveValue> identifier = createPrimitiveStringValue(i);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> identifier = createPrimitiveStringValue(i);
- RefPtr<CSSPrimitiveValue> separator;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> separator;
if (!counters)
separator = cssValuePool().createValue(String(), CSSPrimitiveValue::CSS_STRING);
else {
separator = createPrimitiveStringValue(i);
}
- RefPtr<CSSPrimitiveValue> listStyle;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle;
i = args->next();
if (!i) // Make the list style default decimal
listStyle = cssValuePool().createIdentifierValue(CSSValueDecimal);
valid = a->id == CSSValueAuto || validUnit(a, FLength);
if (!valid)
break;
- RefPtr<CSSPrimitiveValue> length = a->id == CSSValueAuto ?
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> length = a->id == CSSValueAuto ?
cssValuePool().createIdentifierValue(CSSValueAuto) :
createPrimitiveNumericValue(a);
if (i == 0)
return false;
}
+static void completeBorderRadii(RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[4])
+{
+ if (radii[3])
+ return;
+ if (!radii[2]) {
+ if (!radii[1])
+ radii[1] = radii[0];
+ radii[2] = radii[0];
+ }
+ radii[3] = radii[1];
+}
+
+// FIXME: This should be refactored with CSSParser::parseBorderRadius.
+// CSSParser::parseBorderRadius contains support for some legacy radius construction.
+PassRefPtr<CSSBasicShape> BisonCSSParser::parseInsetRoundedCorners(PassRefPtr<CSSBasicShapeInset> shape, CSSParserValueList* args)
+{
+ CSSParserValue* argument = args->next();
+
+ if (!argument)
+ return 0;
+
+ CSSParserValueList radiusArguments;
+ while (argument) {
+ radiusArguments.addValue(*argument);
+ argument = args->next();
+ }
+
+ unsigned num = radiusArguments.size();
+ if (!num || num > 9)
+ return 0;
+
+ // FIXME: Refactor completeBorderRadii and the array
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[2][4];
+
+ unsigned indexAfterSlash = 0;
+ for (unsigned i = 0; i < num; ++i) {
+ CSSParserValue* value = radiusArguments.valueAt(i);
+ if (value->unit == CSSParserValue::Operator) {
+ if (value->iValue != '/')
+ return 0;
+
+ if (!i || indexAfterSlash || i + 1 == num)
+ return 0;
+
+ indexAfterSlash = i + 1;
+ completeBorderRadii(radii[0]);
+ continue;
+ }
+
+ if (i - indexAfterSlash >= 4)
+ return 0;
+
+ if (!validUnit(value, FLength | FPercent | FNonNeg))
+ return 0;
+
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = createPrimitiveNumericValue(value);
+
+ if (!indexAfterSlash)
+ radii[0][i] = radius;
+ else
+ radii[1][i - indexAfterSlash] = radius.release();
+ }
+
+ if (!indexAfterSlash) {
+ completeBorderRadii(radii[0]);
+ for (unsigned i = 0; i < 4; ++i)
+ radii[1][i] = radii[0][i];
+ } else {
+ completeBorderRadii(radii[1]);
+ }
+ shape->setTopLeftRadius(createPrimitiveValuePair(radii[0][0].release(), radii[1][0].release()));
+ shape->setTopRightRadius(createPrimitiveValuePair(radii[0][1].release(), radii[1][1].release()));
+ shape->setBottomRightRadius(createPrimitiveValuePair(radii[0][2].release(), radii[1][2].release()));
+ shape->setBottomLeftRadius(createPrimitiveValuePair(radii[0][3].release(), radii[1][3].release()));
+
+ return shape;
+}
+
+PassRefPtr<CSSBasicShape> BisonCSSParser::parseBasicShapeInset(CSSParserValueList* args)
+{
+ ASSERT(args);
+
+ RefPtr<CSSBasicShapeInset> shape = CSSBasicShapeInset::create();
+
+ CSSParserValue* argument = args->current();
+ WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue> > widthArguments;
+ bool hasRoundedInset = false;
+
+ while (argument) {
+ if (argument->unit == CSSPrimitiveValue::CSS_IDENT && equalIgnoringCase(argument->string, "round")) {
+ hasRoundedInset = true;
+ break;
+ }
+
+ Units unitFlags = FLength | FPercent;
+ if (!validUnit(argument, unitFlags) || widthArguments.size() > 4)
+ return 0;
+
+ widthArguments.append(createPrimitiveNumericValue(argument));
+ argument = args->next();
+ }
+
+ switch (widthArguments.size()) {
+ case 1: {
+ shape->updateShapeSize1Value(widthArguments[0].get());
+ break;
+ }
+ case 2: {
+ shape->updateShapeSize2Values(widthArguments[0].get(), widthArguments[1].get());
+ break;
+ }
+ case 3: {
+ shape->updateShapeSize3Values(widthArguments[0].get(), widthArguments[1].get(), widthArguments[2].get());
+ break;
+ }
+ case 4: {
+ shape->updateShapeSize4Values(widthArguments[0].get(), widthArguments[1].get(), widthArguments[2].get(), widthArguments[3].get());
+ break;
+ }
+ default:
+ return 0;
+ }
+
+ if (hasRoundedInset)
+ return parseInsetRoundedCorners(shape, args);
+ return shape;
+}
+
static bool isItemPositionKeyword(CSSValueID id)
{
return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter
return true;
}
- RefPtr<CSSPrimitiveValue> position = 0;
- RefPtr<CSSPrimitiveValue> overflowAlignmentKeyword = 0;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> position = 0;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> overflowAlignmentKeyword = 0;
if (isItemPositionKeyword(value->id)) {
position = cssValuePool().createIdentifierValue(value->id);
value = m_valueList->next();
if (!validUnit(argument, unitFlags))
return 0;
- RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
ASSERT(argumentNumber < 6);
switch (argumentNumber) {
case 0:
if (!validUnit(argument, unitFlags))
return 0;
- RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
ASSERT(argumentNumber < 6);
switch (argumentNumber) {
case 0:
return shape;
}
-PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseShapeRadius(CSSParserValue* value)
+PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseShapeRadius(CSSParserValue* value)
{
if (value->id == CSSValueClosestSide || value->id == CSSValueFarthestSide)
return cssValuePool().createIdentifierValue(value->id);
return 0;
if (!args->currentIndex() && argument->id != CSSValueAt) {
- if (RefPtr<CSSPrimitiveValue> radius = parseShapeRadius(argument)) {
+ if (RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = parseShapeRadius(argument)) {
shape->setRadius(radius);
continue;
}
if (!validUnit(argument, unitFlags))
return 0;
- RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
ASSERT(argumentNumber < 3);
switch (argumentNumber) {
case 0:
return 0;
if (args->currentIndex() < 2 && argument->id != CSSValueAt) {
- if (RefPtr<CSSPrimitiveValue> radius = parseShapeRadius(argument)) {
+ if (RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = parseShapeRadius(argument)) {
if (!shape->radiusX())
shape->setRadiusX(radius);
else
if (!validUnit(argument, unitFlags))
return 0;
- RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
ASSERT(argumentNumber < 4);
switch (argumentNumber) {
case 0:
if (!argumentY || !validUnit(argumentY, FLength | FPercent))
return 0;
- RefPtr<CSSPrimitiveValue> xLength = createPrimitiveNumericValue(argumentX);
- RefPtr<CSSPrimitiveValue> yLength = createPrimitiveNumericValue(argumentY);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> xLength = createPrimitiveNumericValue(argumentX);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> yLength = createPrimitiveNumericValue(argumentY);
shape->appendPoint(xLength.release(), yLength.release());
CSSParserValue* value = m_valueList->current();
CSSValueID valueId = value->id;
- RefPtr<CSSPrimitiveValue> boxValue;
- RefPtr<CSSPrimitiveValue> shapeValue;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> boxValue;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue;
if (valueId == CSSValueNone
|| (valueId == CSSValueOutsideShape && propId == CSSPropertyShapeInside)) {
- RefPtr<CSSPrimitiveValue> keywordValue = parseValidPrimitive(valueId, value);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> keywordValue = parseValidPrimitive(valueId, value);
m_valueList->next();
return keywordValue.release();
}
return boxValue.release();
}
-PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseBasicShape()
+PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseBasicShape()
{
CSSParserValue* value = m_valueList->current();
ASSERT(value->unit == CSSParserValue::Function);
shape = parseBasicShapePolygon(args);
else if (equalIgnoringCase(value->function->name, "inset-rectangle("))
shape = parseBasicShapeInsetRectangle(args);
+ else if (equalIgnoringCase(value->function->name, "inset("))
+ shape = parseBasicShapeInset(args);
if (!shape)
return 0;
CSSValueList* m_list;
};
-PassRefPtr<CSSValueList> BisonCSSParser::parseFontFamily()
+PassRefPtrWillBeRawPtr<CSSValueList> BisonCSSParser::parseFontFamily()
{
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
CSSParserValue* value = m_valueList->current();
FontFamilyValueBuilder familyBuilder(list.get());
bool BisonCSSParser::parseFontVariant(bool important)
{
- RefPtr<CSSValueList> values;
+ RefPtrWillBeRawPtr<CSSValueList> values;
if (m_valueList->size() > 1)
values = CSSValueList::createCommaSeparated();
CSSParserValue* val;
bool expectComma = false;
while ((val = m_valueList->current())) {
- RefPtr<CSSPrimitiveValue> parsedValue;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue;
if (!expectComma) {
expectComma = true;
if (val->id == CSSValueNormal || val->id == CSSValueSmallCaps)
bool BisonCSSParser::parseFontFaceSrcURI(CSSValueList* valueList)
{
- RefPtr<CSSFontFaceSrcValue> uriValue(CSSFontFaceSrcValue::create(completeURL(m_valueList->current()->string)));
+ RefPtrWillBeRawPtr<CSSFontFaceSrcValue> uriValue(CSSFontFaceSrcValue::create(completeURL(m_valueList->current()->string)));
CSSParserValue* value = m_valueList->next();
if (!value) {
bool BisonCSSParser::parseFontFaceSrc()
{
- RefPtr<CSSValueList> values(CSSValueList::createCommaSeparated());
+ RefPtrWillBeRawPtr<CSSValueList> values(CSSValueList::createCommaSeparated());
while (CSSParserValue* value = m_valueList->current()) {
if (value->unit == CSSPrimitiveValue::CSS_URI) {
bool BisonCSSParser::parseFontFaceUnicodeRange()
{
- RefPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
bool failed = false;
bool operatorExpected = false;
for (; m_valueList->current(); m_valueList->next(), operatorExpected = !operatorExpected) {
return true;
}
-PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseColor(CSSParserValue* value)
+PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseColor(CSSParserValue* value)
{
RGBA32 c = Color::transparent;
if (!parseColorFromValue(value ? value : m_valueList->current(), c))
// This class tracks parsing state for shadow values. If it goes out of scope (e.g., due to an early return)
// without the allowBreak bit being set, then it will clean up all of the objects and destroy them.
struct ShadowParseContext {
+ DISALLOW_ALLOCATION();
+public:
ShadowParseContext(CSSPropertyID prop, BisonCSSParser* parser)
: property(prop)
, m_parser(parser)
void commitLength(CSSParserValue* v)
{
- RefPtr<CSSPrimitiveValue> val = m_parser->createPrimitiveNumericValue(v);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> val = m_parser->createPrimitiveNumericValue(v);
if (allowX) {
x = val.release();
}
}
- void commitColor(PassRefPtr<CSSPrimitiveValue> val)
+ void commitColor(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val)
{
color = val;
allowColor = false;
CSSPropertyID property;
BisonCSSParser* m_parser;
- RefPtr<CSSValueList> values;
- RefPtr<CSSPrimitiveValue> x;
- RefPtr<CSSPrimitiveValue> y;
- RefPtr<CSSPrimitiveValue> blur;
- RefPtr<CSSPrimitiveValue> spread;
- RefPtr<CSSPrimitiveValue> style;
- RefPtr<CSSPrimitiveValue> color;
+ RefPtrWillBeRawPtr<CSSValueList> values;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> x;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> y;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> blur;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> spread;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> style;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> color;
bool allowX;
bool allowY;
bool allowBreak;
};
-PassRefPtr<CSSValueList> BisonCSSParser::parseShadow(CSSParserValueList* valueList, CSSPropertyID propId)
+PassRefPtrWillBeRawPtr<CSSValueList> BisonCSSParser::parseShadow(CSSParserValueList* valueList, CSSPropertyID propId)
{
ShadowParseContext context(propId, this);
CSSParserValue* val;
context.commitStyle(val);
} else {
// The only other type of value that's ok is a color value.
- RefPtr<CSSPrimitiveValue> parsedColor;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedColor;
bool isColor = ((val->id >= CSSValueAqua && val->id <= CSSValueWindowtext) || val->id == CSSValueMenu
|| (val->id >= CSSValueWebkitFocusRingColor && val->id <= CSSValueWebkitText && inQuirksMode())
|| val->id == CSSValueCurrentcolor);
// Direction comes first.
CSSParserValue* val = m_valueList->current();
- RefPtr<CSSPrimitiveValue> direction;
- if (isVariableReference(val)) {
- direction = createPrimitiveVariableReferenceValue(val);
- } else {
- switch (val->id) {
- case CSSValueAbove:
- case CSSValueBelow:
- case CSSValueLeft:
- case CSSValueRight:
- direction = cssValuePool().createIdentifierValue(val->id);
- break;
- default:
- return false;
- }
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> direction;
+ switch (val->id) {
+ case CSSValueAbove:
+ case CSSValueBelow:
+ case CSSValueLeft:
+ case CSSValueRight:
+ direction = cssValuePool().createIdentifierValue(val->id);
+ break;
+ default:
+ return false;
}
// The offset comes next.
val = m_valueList->next();
- RefPtr<CSSPrimitiveValue> offset;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> offset;
if (!val)
offset = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX);
else {
return false;
}
- RefPtr<CSSReflectValue> reflectValue = CSSReflectValue::create(direction.release(), offset.release(), mask.release());
+ RefPtrWillBeRawPtr<CSSReflectValue> reflectValue = CSSReflectValue::create(direction.release(), offset.release(), mask.release());
addProperty(propId, reflectValue.release(), important);
m_valueList->next();
return true;
static const double unsetValue = -1;
double flexGrow = unsetValue;
double flexShrink = unsetValue;
- RefPtr<CSSPrimitiveValue> flexBasis;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> flexBasis;
while (CSSParserValue* arg = args->current()) {
if (validUnit(arg, FNumber | FNonNeg)) {
}
struct BorderImageParseContext {
+ DISALLOW_ALLOCATION();
+public:
BorderImageParseContext()
: m_canAdvance(false)
, m_allowCommit(true)
m_allowImageSlice = !m_imageSlice;
m_allowRepeat = !m_repeat;
}
- void commitImageSlice(PassRefPtr<CSSBorderImageSliceValue> slice)
+ void commitImageSlice(PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> slice)
{
m_imageSlice = slice;
m_canAdvance = true;
m_requireWidth = false;
}
}
- void commitBorderWidth(PassRefPtr<CSSPrimitiveValue> slice)
+ void commitBorderWidth(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> slice)
{
m_borderSlice = slice;
m_canAdvance = true;
m_allowImage = !m_image;
m_allowRepeat = !m_repeat;
}
- void commitBorderOutset(PassRefPtr<CSSPrimitiveValue> outset)
+ void commitBorderOutset(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> outset)
{
m_outset = outset;
m_canAdvance = true;
bool m_requireOutset;
RefPtr<CSSValue> m_image;
- RefPtr<CSSBorderImageSliceValue> m_imageSlice;
- RefPtr<CSSPrimitiveValue> m_borderSlice;
- RefPtr<CSSPrimitiveValue> m_outset;
+ RefPtrWillBeRawPtr<CSSBorderImageSliceValue> m_imageSlice;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> m_borderSlice;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> m_outset;
RefPtr<CSSValue> m_repeat;
};
}
if (!context.canAdvance() && context.allowImageSlice()) {
- RefPtr<CSSBorderImageSliceValue> imageSlice;
+ RefPtrWillBeRawPtr<CSSBorderImageSliceValue> imageSlice;
if (parser.parseBorderImageSlice(propId, imageSlice))
context.commitImageSlice(imageSlice.release());
}
}
if (!context.canAdvance() && context.requireWidth()) {
- RefPtr<CSSPrimitiveValue> borderSlice;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> borderSlice;
if (parser.parseBorderImageWidth(borderSlice))
context.commitBorderWidth(borderSlice.release());
}
if (!context.canAdvance() && context.requireOutset()) {
- RefPtr<CSSPrimitiveValue> borderOutset;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset;
if (parser.parseBorderImageOutset(borderOutset))
context.commitBorderOutset(borderOutset.release());
}
bool BisonCSSParser::parseBorderImageRepeat(RefPtr<CSSValue>& result)
{
- RefPtr<CSSPrimitiveValue> firstValue;
- RefPtr<CSSPrimitiveValue> secondValue;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> firstValue;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> secondValue;
CSSParserValue* val = m_valueList->current();
if (!val)
return false;
}
class BorderImageSliceParseContext {
+ DISALLOW_ALLOCATION();
public:
BorderImageSliceParseContext(BisonCSSParser* parser)
: m_parser(parser)
void commitNumber(CSSParserValue* v)
{
- RefPtr<CSSPrimitiveValue> val = m_parser->createPrimitiveNumericValue(v);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> val = m_parser->createPrimitiveNumericValue(v);
if (!m_top)
m_top = val;
else if (!m_right)
void commitFill() { m_fill = true; m_allowFill = false; m_allowNumber = !m_top; }
- PassRefPtr<CSSBorderImageSliceValue> commitBorderImageSlice()
+ PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> commitBorderImageSlice()
{
// We need to clone and repeat values for any omissions.
ASSERT(m_top);
bool m_allowFill;
bool m_allowFinalCommit;
- RefPtr<CSSPrimitiveValue> m_top;
- RefPtr<CSSPrimitiveValue> m_right;
- RefPtr<CSSPrimitiveValue> m_bottom;
- RefPtr<CSSPrimitiveValue> m_left;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> m_top;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> m_right;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> m_bottom;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> m_left;
bool m_fill;
};
-bool BisonCSSParser::parseBorderImageSlice(CSSPropertyID propId, RefPtr<CSSBorderImageSliceValue>& result)
+bool BisonCSSParser::parseBorderImageSlice(CSSPropertyID propId, RefPtrWillBeRawPtr<CSSBorderImageSliceValue>& result)
{
BorderImageSliceParseContext context(this);
CSSParserValue* val;
void commitNumber(CSSParserValue* v)
{
- RefPtr<CSSPrimitiveValue> val;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> val;
if (v->id == CSSValueAuto)
val = cssValuePool().createIdentifierValue(v->id);
else
}
void setAllowFinalCommit() { m_allowFinalCommit = true; }
- void setTop(PassRefPtr<CSSPrimitiveValue> val) { m_top = val; }
+ void setTop(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_top = val; }
- PassRefPtr<CSSPrimitiveValue> commitBorderImageQuad()
+ PassRefPtrWillBeRawPtr<CSSPrimitiveValue> commitBorderImageQuad()
{
// We need to clone and repeat values for any omissions.
ASSERT(m_top);
bool m_allowNumber;
bool m_allowFinalCommit;
- RefPtr<CSSPrimitiveValue> m_top;
- RefPtr<CSSPrimitiveValue> m_right;
- RefPtr<CSSPrimitiveValue> m_bottom;
- RefPtr<CSSPrimitiveValue> m_left;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> m_top;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> m_right;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> m_bottom;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> m_left;
};
-bool BisonCSSParser::parseBorderImageQuad(Units validUnits, RefPtr<CSSPrimitiveValue>& result)
+bool BisonCSSParser::parseBorderImageQuad(Units validUnits, RefPtrWillBeRawPtr<CSSPrimitiveValue>& result)
{
BorderImageQuadParseContext context(this);
CSSParserValue* val;
return false;
}
-bool BisonCSSParser::parseBorderImageWidth(RefPtr<CSSPrimitiveValue>& result)
+bool BisonCSSParser::parseBorderImageWidth(RefPtrWillBeRawPtr<CSSPrimitiveValue>& result)
{
return parseBorderImageQuad(FLength | FNumber | FNonNeg | FPercent, result);
}
-bool BisonCSSParser::parseBorderImageOutset(RefPtr<CSSPrimitiveValue>& result)
+bool BisonCSSParser::parseBorderImageOutset(RefPtrWillBeRawPtr<CSSPrimitiveValue>& result)
{
return parseBorderImageQuad(FLength | FNumber | FNonNeg, result);
}
-static void completeBorderRadii(RefPtr<CSSPrimitiveValue> radii[4])
-{
- if (radii[3])
- return;
- if (!radii[2]) {
- if (!radii[1])
- radii[1] = radii[0];
- radii[2] = radii[0];
- }
- radii[3] = radii[1];
-}
-
bool BisonCSSParser::parseBorderRadius(CSSPropertyID propId, bool important)
{
unsigned num = m_valueList->size();
return false;
ShorthandScope scope(this, propId);
- RefPtr<CSSPrimitiveValue> radii[2][4];
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[2][4];
unsigned indexAfterSlash = 0;
for (unsigned i = 0; i < num; ++i) {
if (!validUnit(value, FLength | FPercent | FNonNeg))
return false;
- RefPtr<CSSPrimitiveValue> radius = createPrimitiveNumericValue(value);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = createPrimitiveNumericValue(value);
if (!indexAfterSlash) {
radii[0][i] = radius;
{
enum { ID, VAL } state = ID;
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- RefPtr<CSSPrimitiveValue> counterName;
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> counterName;
while (true) {
CSSParserValue* val = m_valueList->current();
}
// This should go away once we drop support for -webkit-gradient
-static PassRefPtr<CSSPrimitiveValue> parseDeprecatedGradientPoint(CSSParserValue* a, bool horizontal)
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseDeprecatedGradientPoint(CSSParserValue* a, bool horizontal)
{
- RefPtr<CSSPrimitiveValue> result;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> result;
if (a->unit == CSSPrimitiveValue::CSS_IDENT) {
if ((equalIgnoringCase(a, "left") && horizontal)
|| (equalIgnoringCase(a, "top") && !horizontal))
a = args->next();
if (!a)
return false;
- RefPtr<CSSPrimitiveValue> point = parseDeprecatedGradientPoint(a, true);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> point = parseDeprecatedGradientPoint(a, true);
if (!point)
return false;
result->setFirstX(point.release());
return true;
}
-static PassRefPtr<CSSPrimitiveValue> valueFromSideKeyword(CSSParserValue* a, bool& isHorizontal)
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueFromSideKeyword(CSSParserValue* a, bool& isHorizontal)
{
if (a->unit != CSSPrimitiveValue::CSS_IDENT)
return 0;
return cssValuePool().createIdentifierValue(a->id);
}
-static PassRefPtr<CSSPrimitiveValue> parseGradientColorOrKeyword(BisonCSSParser* p, CSSParserValue* value)
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseGradientColorOrKeyword(BisonCSSParser* p, CSSParserValue* value)
{
CSSValueID id = value->id;
if (id == CSSValueWebkitText || (id >= CSSValueAqua && id <= CSSValueWindowtext) || id == CSSValueMenu || id == CSSValueCurrentcolor)
bool BisonCSSParser::parseDeprecatedLinearGradient(CSSParserValueList* valueList, RefPtr<CSSValue>& gradient, CSSGradientRepeat repeating)
{
- RefPtr<CSSLinearGradientValue> result = CSSLinearGradientValue::create(repeating, CSSPrefixedLinearGradient);
+ RefPtrWillBeRawPtr<CSSLinearGradientValue> result = CSSLinearGradientValue::create(repeating, CSSPrefixedLinearGradient);
// Walk the arguments.
CSSParserValueList* args = valueList->current()->function->args.get();
expectComma = true;
} else {
// Look one or two optional keywords that indicate a side or corner.
- RefPtr<CSSPrimitiveValue> startX, startY;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> startX, startY;
- RefPtr<CSSPrimitiveValue> location;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> location;
bool isHorizontal = false;
if ((location = valueFromSideKeyword(a, isHorizontal))) {
if (isHorizontal)
bool BisonCSSParser::parseDeprecatedRadialGradient(CSSParserValueList* valueList, RefPtr<CSSValue>& gradient, CSSGradientRepeat repeating)
{
- RefPtr<CSSRadialGradientValue> result = CSSRadialGradientValue::create(repeating, CSSPrefixedRadialGradient);
+ RefPtrWillBeRawPtr<CSSRadialGradientValue> result = CSSRadialGradientValue::create(repeating, CSSPrefixedRadialGradient);
// Walk the arguments.
CSSParserValueList* args = valueList->current()->function->args.get();
result->setFirstY(toCSSPrimitiveValue(centerY.get()));
result->setSecondY(toCSSPrimitiveValue(centerY.get()));
- RefPtr<CSSPrimitiveValue> shapeValue;
- RefPtr<CSSPrimitiveValue> sizeValue;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> sizeValue;
// Optional shape and/or size in any order.
for (int i = 0; i < 2; ++i) {
result->setSizingBehavior(sizeValue);
// Or, two lengths or percentages
- RefPtr<CSSPrimitiveValue> horizontalSize;
- RefPtr<CSSPrimitiveValue> verticalSize;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalSize;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalSize;
if (!shapeValue && !sizeValue) {
if (validUnit(a, FLength | FPercent)) {
bool BisonCSSParser::parseLinearGradient(CSSParserValueList* valueList, RefPtr<CSSValue>& gradient, CSSGradientRepeat repeating)
{
- RefPtr<CSSLinearGradientValue> result = CSSLinearGradientValue::create(repeating, CSSLinearGradient);
+ RefPtrWillBeRawPtr<CSSLinearGradientValue> result = CSSLinearGradientValue::create(repeating, CSSLinearGradient);
CSSParserValueList* args = valueList->current()->function->args.get();
if (!args || !args->size())
if (!a)
return false;
- RefPtr<CSSPrimitiveValue> endX, endY;
- RefPtr<CSSPrimitiveValue> location;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> endX, endY;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> location;
bool isHorizontal = false;
location = valueFromSideKeyword(a, isHorizontal);
bool BisonCSSParser::parseRadialGradient(CSSParserValueList* valueList, RefPtr<CSSValue>& gradient, CSSGradientRepeat repeating)
{
- RefPtr<CSSRadialGradientValue> result = CSSRadialGradientValue::create(repeating, CSSRadialGradient);
+ RefPtrWillBeRawPtr<CSSRadialGradientValue> result = CSSRadialGradientValue::create(repeating, CSSRadialGradient);
CSSParserValueList* args = valueList->current()->function->args.get();
if (!args || !args->size())
bool expectComma = false;
- RefPtr<CSSPrimitiveValue> shapeValue;
- RefPtr<CSSPrimitiveValue> sizeValue;
- RefPtr<CSSPrimitiveValue> horizontalSize;
- RefPtr<CSSPrimitiveValue> verticalSize;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> sizeValue;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalSize;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalSize;
// First part of grammar, the size/shape clause:
// [ circle || <length> ] |
if (val->unit != CSSParserValue::Function)
return false;
- if (equalIgnoringCase(val->function->name, "-webkit-gradient("))
+ if (equalIgnoringCase(val->function->name, "-webkit-gradient(")) {
+ // FIXME: This should send a deprecation message.
+ if (m_context.useCounter())
+ m_context.useCounter()->count(UseCounter::DeprecatedWebKitGradient);
return parseDeprecatedGradient(valueList, value);
+ }
- if (equalIgnoringCase(val->function->name, "-webkit-linear-gradient("))
+ if (equalIgnoringCase(val->function->name, "-webkit-linear-gradient(")) {
+ // FIXME: This should send a deprecation message.
+ if (m_context.useCounter())
+ m_context.useCounter()->count(UseCounter::DeprecatedWebKitLinearGradient);
return parseDeprecatedLinearGradient(valueList, value, NonRepeating);
+ }
if (equalIgnoringCase(val->function->name, "linear-gradient("))
return parseLinearGradient(valueList, value, NonRepeating);
- if (equalIgnoringCase(val->function->name, "-webkit-repeating-linear-gradient("))
+ if (equalIgnoringCase(val->function->name, "-webkit-repeating-linear-gradient(")) {
+ // FIXME: This should send a deprecation message.
+ if (m_context.useCounter())
+ m_context.useCounter()->count(UseCounter::DeprecatedWebKitRepeatingLinearGradient);
return parseDeprecatedLinearGradient(valueList, value, Repeating);
+ }
if (equalIgnoringCase(val->function->name, "repeating-linear-gradient("))
return parseLinearGradient(valueList, value, Repeating);
- if (equalIgnoringCase(val->function->name, "-webkit-radial-gradient("))
+ if (equalIgnoringCase(val->function->name, "-webkit-radial-gradient(")) {
+ // FIXME: This should send a deprecation message.
+ if (m_context.useCounter())
+ m_context.useCounter()->count(UseCounter::DeprecatedWebKitRadialGradient);
return parseDeprecatedRadialGradient(valueList, value, NonRepeating);
+ }
if (equalIgnoringCase(val->function->name, "radial-gradient("))
return parseRadialGradient(valueList, value, NonRepeating);
- if (equalIgnoringCase(val->function->name, "-webkit-repeating-radial-gradient("))
+ if (equalIgnoringCase(val->function->name, "-webkit-repeating-radial-gradient(")) {
+ if (m_context.useCounter())
+ m_context.useCounter()->count(UseCounter::DeprecatedWebKitRepeatingRadialGradient);
return parseDeprecatedRadialGradient(valueList, value, Repeating);
+ }
if (equalIgnoringCase(val->function->name, "repeating-radial-gradient("))
return parseRadialGradient(valueList, value, Repeating);
bool BisonCSSParser::parseCrossfade(CSSParserValueList* valueList, RefPtr<CSSValue>& crossfade)
{
- RefPtr<CSSCrossfadeValue> result;
-
// Walk the arguments.
CSSParserValueList* args = valueList->current()->function->args.get();
if (!args || args->size() != 5)
a = args->next();
// The third argument is the crossfade value. It is a percentage or a fractional number.
- RefPtr<CSSPrimitiveValue> percentage;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> percentage;
if (!a)
return false;
else
return false;
- result = CSSCrossfadeValue::create(fromImageValue, toImageValue);
+ RefPtrWillBeRawPtr<CSSCrossfadeValue> result = CSSCrossfadeValue::create(fromImageValue, toImageValue);
result->setPercentage(percentage);
crossfade = result;
if (!functionArgs || !functionArgs->size() || !functionArgs->current())
return 0;
- RefPtr<CSSImageSetValue> imageSet = CSSImageSetValue::create();
+ RefPtrWillBeRawPtr<CSSImageSetValue> imageSet = CSSImageSetValue::create();
CSSParserValue* arg = functionArgs->current();
while (arg) {
BisonCSSParser::Units m_unit;
};
-PassRefPtr<CSSValueList> BisonCSSParser::parseTransform()
+PassRefPtrWillBeRawPtr<CSSValueList> BisonCSSParser::parseTransform()
{
if (!m_valueList)
return 0;
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
for (CSSParserValue* value = m_valueList->current(); value; value = m_valueList->next()) {
RefPtr<CSSValue> parsedTransformValue = parseTransformValue(value);
if (!parsedTransformValue)
// We collect a list of CSSTransformValues, where each value specifies a single operation.
// Create the new CSSTransformValue for this operation and add it to our list.
- RefPtr<CSSTransformValue> transformValue = CSSTransformValue::create(info.type());
+ RefPtrWillBeRawPtr<CSSTransformValue> transformValue = CSSTransformValue::create(info.type());
// Snag our values.
CSSParserValue* a = args->current();
}
}
-PassRefPtr<CSSFilterValue> BisonCSSParser::parseBuiltinFilterArguments(CSSParserValueList* args, CSSFilterValue::FilterOperationType filterType)
+PassRefPtrWillBeRawPtr<CSSFilterValue> BisonCSSParser::parseBuiltinFilterArguments(CSSParserValueList* args, CSSFilterValue::FilterOperationType filterType)
{
- RefPtr<CSSFilterValue> filterValue = CSSFilterValue::create(filterType);
+ RefPtrWillBeRawPtr<CSSFilterValue> filterValue = CSSFilterValue::create(filterType);
ASSERT(args);
switch (filterType) {
}
case CSSFilterValue::DropShadowFilterOperation: {
// drop-shadow() takes a single shadow.
- RefPtr<CSSValueList> shadowValueList = parseShadow(args, CSSPropertyWebkitFilter);
+ RefPtrWillBeRawPtr<CSSValueList> shadowValueList = parseShadow(args, CSSPropertyWebkitFilter);
if (!shadowValueList || shadowValueList->length() != 1)
return 0;
return filterValue.release();
}
-PassRefPtr<CSSValueList> BisonCSSParser::parseFilter()
+PassRefPtrWillBeRawPtr<CSSValueList> BisonCSSParser::parseFilter()
{
if (!m_valueList)
return 0;
// The filter is a list of functional primitives that specify individual operations.
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
for (CSSParserValue* value = m_valueList->current(); value; value = m_valueList->next()) {
if (value->unit != CSSPrimitiveValue::CSS_URI && (value->unit != CSSParserValue::Function || !value->function))
return 0;
// See if the specified primitive is one we understand.
if (value->unit == CSSPrimitiveValue::CSS_URI) {
- RefPtr<CSSFilterValue> referenceFilterValue = CSSFilterValue::create(CSSFilterValue::ReferenceFilterOperation);
+ RefPtrWillBeRawPtr<CSSFilterValue> referenceFilterValue = CSSFilterValue::create(CSSFilterValue::ReferenceFilterOperation);
list->append(referenceFilterValue);
referenceFilterValue->append(CSSSVGDocumentValue::create(value->string));
} else {
if (!args)
return 0;
- RefPtr<CSSFilterValue> filterValue = parseBuiltinFilterArguments(args, filterType);
+ RefPtrWillBeRawPtr<CSSFilterValue> filterValue = parseBuiltinFilterArguments(args, filterType);
if (!filterValue)
return 0;
return list.release();
}
-static bool validFlowName(const String& flowName)
-{
- return !(equalIgnoringCase(flowName, "auto")
- || equalIgnoringCase(flowName, "default")
- || equalIgnoringCase(flowName, "inherit")
- || equalIgnoringCase(flowName, "initial")
- || equalIgnoringCase(flowName, "none"));
-}
-
-// none | <ident>
-bool BisonCSSParser::parseFlowThread(CSSPropertyID propId, bool important)
-{
- ASSERT(propId == CSSPropertyWebkitFlowInto);
- ASSERT(RuntimeEnabledFeatures::cssRegionsEnabled());
-
- if (m_valueList->size() != 1)
- return false;
-
- CSSParserValue* value = m_valueList->current();
- if (!value)
- return false;
-
- if (value->unit != CSSPrimitiveValue::CSS_IDENT)
- return false;
-
- if (value->id == CSSValueNone) {
- addProperty(propId, cssValuePool().createIdentifierValue(value->id), important);
- return true;
- }
-
- String inputProperty = String(value->string);
- if (!inputProperty.isEmpty()) {
- if (!validFlowName(inputProperty))
- return false;
- addProperty(propId, cssValuePool().createValue(inputProperty, CSSPrimitiveValue::CSS_STRING), important);
- } else
- addProperty(propId, cssValuePool().createIdentifierValue(CSSValueNone), important);
-
- return true;
-}
-
-// -webkit-flow-from: none | <ident>
-bool BisonCSSParser::parseRegionThread(CSSPropertyID propId, bool important)
-{
- ASSERT(propId == CSSPropertyWebkitFlowFrom);
- ASSERT(RuntimeEnabledFeatures::cssRegionsEnabled());
-
- if (m_valueList->size() != 1)
- return false;
-
- CSSParserValue* value = m_valueList->current();
- if (!value)
- return false;
-
- if (value->unit != CSSPrimitiveValue::CSS_IDENT)
- return false;
-
- if (value->id == CSSValueNone)
- addProperty(propId, cssValuePool().createIdentifierValue(value->id), important);
- else {
- String inputProperty = String(value->string);
- if (!inputProperty.isEmpty()) {
- if (!validFlowName(inputProperty))
- return false;
- addProperty(propId, cssValuePool().createValue(inputProperty, CSSPrimitiveValue::CSS_STRING), important);
- } else
- addProperty(propId, cssValuePool().createIdentifierValue(CSSValueNone), important);
- }
-
- return true;
-}
-
bool BisonCSSParser::parseTransformOrigin(CSSPropertyID propId, CSSPropertyID& propId1, CSSPropertyID& propId2, CSSPropertyID& propId3, RefPtr<CSSValue>& value, RefPtr<CSSValue>& value2, RefPtr<CSSValue>& value3)
{
propId1 = propId;
return false;
CSSParserValue* value = m_valueList->current();
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
if (m_valueList->size() == 1 && value && (value->id == CSSValueAuto || value->id == CSSValueNone)) {
list->append(cssValuePool().createIdentifierValue(value->id));
addProperty(CSSPropertyTouchAction, list.release(), important);
return true;
}
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
bool isValid = true;
while (isValid && value) {
switch (value->id) {
{
unsigned valueListSize = m_valueList->size();
- RefPtr<CSSPrimitiveValue> fill;
- RefPtr<CSSPrimitiveValue> shape;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> fill;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> shape;
for (CSSParserValue* value = m_valueList->current(); value; value = m_valueList->next()) {
if (value->unit == CSSPrimitiveValue::CSS_STRING) {
}
if (fill && shape) {
- RefPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSeparated();
parsedValues->append(fill.release());
parsedValues->append(shape.release());
addProperty(CSSPropertyWebkitTextEmphasisStyle, parsedValues.release(), important);
PassRefPtr<CSSValue> BisonCSSParser::parseTextIndent()
{
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
// <length> | <percentage> | inherit
if (m_valueList->size() == 1) {
bool BisonCSSParser::parseFontFeatureSettings(bool important)
{
if (m_valueList->size() == 1 && m_valueList->current()->id == CSSValueNormal) {
- RefPtr<CSSPrimitiveValue> normalValue = cssValuePool().createIdentifierValue(CSSValueNormal);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> normalValue = cssValuePool().createIdentifierValue(CSSValueNormal);
m_valueList->next();
addProperty(CSSPropertyWebkitFontFeatureSettings, normalValue.release(), important);
return true;
}
- RefPtr<CSSValueList> settings = CSSValueList::createCommaSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> settings = CSSValueList::createCommaSeparated();
for (CSSParserValue* value = m_valueList->current(); value; value = m_valueList->next()) {
if (!parseFontFeatureTag(settings.get()))
return false;
bool BisonCSSParser::parseFontVariantLigatures(bool important)
{
- RefPtr<CSSValueList> ligatureValues = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> ligatureValues = CSSValueList::createSpaceSeparated();
bool sawCommonLigaturesValue = false;
bool sawDiscretionaryLigaturesValue = false;
bool sawHistoricalLigaturesValue = false;
if (!ligatureValues->length())
return false;
- addProperty(CSSPropertyWebkitFontVariantLigatures, ligatureValues.release(), important);
+ addProperty(CSSPropertyFontVariantLigatures, ligatureValues.release(), important);
return true;
}
CSSParserSelector* BisonCSSParser::rewriteSpecifiersWithElementNameForCustomPseudoElement(const QualifiedName& tag, const AtomicString& elementName, CSSParserSelector* specifiers, bool tagIsForNamespaceRule)
{
- if (m_useCounter && specifiers->pseudoType() == CSSSelector::PseudoUserAgentCustomElement)
- m_useCounter->count(UseCounter::CSSPseudoElementUserAgentCustomPseudo);
+ if (m_context.useCounter() && specifiers->pseudoType() == CSSSelector::PseudoUserAgentCustomElement)
+ m_context.useCounter()->count(UseCounter::CSSPseudoElementUserAgentCustomPseudo);
CSSParserSelector* lastShadowPseudo = specifiers;
CSSParserSelector* history = specifiers;
CSSParserSelector* BisonCSSParser::rewriteSpecifiersForShadowDistributed(CSSParserSelector* specifiers, CSSParserSelector* distributedPseudoElementSelector)
{
- if (m_useCounter)
- m_useCounter->count(UseCounter::CSSPseudoElementPrefixedDistributed);
+ if (m_context.useCounter())
+ m_context.useCounter()->count(UseCounter::CSSPseudoElementPrefixedDistributed);
CSSParserSelector* argumentSelector = distributedPseudoElementSelector->functionArgumentSelector();
ASSERT(argumentSelector);
ASSERT(!specifiers->isDistributedPseudoElement());
return pageRule;
}
-void BisonCSSParser::setReusableRegionSelectorVector(Vector<OwnPtr<CSSParserSelector> >* selectors)
-{
- if (selectors)
- m_reusableRegionSelectorVector.swap(*selectors);
-}
-
-StyleRuleBase* BisonCSSParser::createRegionRule(Vector<OwnPtr<CSSParserSelector> >* regionSelector, RuleList* rules)
-{
- if (m_useCounter)
- m_useCounter->count(UseCounter::CSSWebkitRegionAtRule);
-
- if (!RuntimeEnabledFeatures::cssRegionsEnabled() || !regionSelector || !rules)
- return 0;
-
- m_allowImportRules = m_allowNamespaceDeclarations = false;
-
- RefPtr<StyleRuleRegion> regionRule = StyleRuleRegion::create(regionSelector, *rules);
-
- StyleRuleRegion* result = regionRule.get();
- m_parsedRules.append(regionRule.release());
- if (m_observer)
- m_observer->startEndUnknownRule();
-
- return result;
-}
-
StyleRuleBase* BisonCSSParser::createMarginAtRule(CSSSelector::MarginBoxType /* marginBox */)
{
// FIXME: Implement margin at-rule here, using: