summaryrefslogtreecommitdiffstats
path: root/WebCore/css/CSSParser.cpp
diff options
context:
space:
mode:
authorRussell Brenner <russellbrenner@google.com>2010-11-18 17:33:13 -0800
committerRussell Brenner <russellbrenner@google.com>2010-12-02 13:47:21 -0800
commit6b70adc33054f8aee8c54d0f460458a9df11b8a5 (patch)
tree103a13998c33944d6ab3b8318c509a037e639460 /WebCore/css/CSSParser.cpp
parentbdf4ebc8e70b2d221b6ee7a65660918ecb1d33aa (diff)
downloadexternal_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.zip
external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.tar.gz
external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.tar.bz2
Merge WebKit at r72274: Initial merge by git.
Change-Id: Ie51f0b4a16da82942bd516dce59cfb79ebbe25fb
Diffstat (limited to 'WebCore/css/CSSParser.cpp')
-rw-r--r--WebCore/css/CSSParser.cpp118
1 files changed, 26 insertions, 92 deletions
diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp
index dcff1ac..df222b9 100644
--- a/WebCore/css/CSSParser.cpp
+++ b/WebCore/css/CSSParser.cpp
@@ -53,9 +53,6 @@
#include "CSSUnicodeRangeValue.h"
#include "CSSValueKeywords.h"
#include "CSSValueList.h"
-#include "CSSVariableDependentValue.h"
-#include "CSSVariablesDeclaration.h"
-#include "CSSVariablesRule.h"
#include "Counter.h"
#include "Document.h"
#include "FloatConversion.h"
@@ -158,7 +155,6 @@ CSSParser::CSSParser(bool strictParsing)
, m_lineNumber(0)
, m_lastSelectorLineNumber(0)
, m_allowImportRules(true)
- , m_allowVariablesRules(true)
, m_allowNamespaceDeclarations(true)
{
#if YYDEBUG > 0
@@ -172,8 +168,6 @@ CSSParser::~CSSParser()
clearProperties();
fastFree(m_parsedProperties);
- clearVariables();
-
delete m_valueList;
fastFree(m_data);
@@ -369,9 +363,15 @@ void CSSParser::parseSelector(const String& string, Document* doc, CSSSelectorLi
cssyyparse(this);
m_selectorListForParseSelector = 0;
+<<<<<<< HEAD
#ifdef ANDROID_INSTRUMENT
android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__);
#endif
+=======
+
+ // The style sheet will be deleted right away, so it won't outlive the document.
+ ASSERT(dummyStyleSheet->hasOneRef());
+>>>>>>> webkit.org at r72274
}
bool CSSParser::parseDeclaration(CSSMutableStyleDeclaration* declaration, const String& string, RefPtr<CSSStyleSourceData>* styleSourceData)
@@ -648,14 +648,6 @@ bool CSSParser::parseValue(int propId, bool important)
return true;
}
- // If we have any variables, then we don't parse the list of values yet. We add them to the declaration
- // as unresolved, and allow them to be parsed later. The parse is considered "successful" for now, even though
- // it might ultimately fail once the variable has been resolved.
- if (!inShorthand() && checkForVariables(m_valueList)) {
- addUnresolvedProperty(propId, important);
- return true;
- }
-
bool validPrimitive = false;
RefPtr<CSSValue> parsedValue;
@@ -1822,7 +1814,6 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyTextLineThrough:
case CSSPropertyTextOverline:
case CSSPropertyTextUnderline:
- case CSSPropertyWebkitVariableDeclarationBlock:
return false;
#if ENABLE(WCSS)
@@ -2454,7 +2445,19 @@ bool CSSParser::parseContent(int propId, bool important)
// close-quote
// no-open-quote
// no-close-quote
+ // inherit
// FIXME: These are not yet implemented (http://bugs.webkit.org/show_bug.cgi?id=6503).
+ // none
+ // normal
+ switch (val->id) {
+ case CSSValueOpenQuote:
+ case CSSValueCloseQuote:
+ case CSSValueNoOpenQuote:
+ case CSSValueNoCloseQuote:
+ case CSSValueNone:
+ case CSSValueNormal:
+ parsedValue = CSSPrimitiveValue::createIdentifier(val->id);
+ }
} else if (val->unit == CSSPrimitiveValue::CSS_STRING) {
parsedValue = CSSPrimitiveValue::create(val->string, CSSPrimitiveValue::CSS_STRING);
}
@@ -5195,7 +5198,6 @@ int CSSParser::lex(void* yylvalWithoutType)
case UNICODERANGE:
case FUNCTION:
case NOTFUNCTION:
- case VARCALL:
yylval->string.characters = t;
yylval->string.length = length;
break;
@@ -5266,7 +5268,6 @@ void CSSParser::recheckAtKeyword(const UChar* str, int len)
yyTok = WEBKIT_KEYFRAMES_SYM;
else if (equalIgnoringCase(ruleName, "@-webkit-mediaquery"))
yyTok = WEBKIT_MEDIAQUERY_SYM;
- // FIXME: Add CSS Variables if we ever decide to turn it back on.
}
UChar* CSSParser::text(int *length)
@@ -5301,19 +5302,6 @@ UChar* CSSParser::text(int *length)
l -= 2;
}
break;
- case VARCALL:
- // "-webkit-var("{w}{ident}{w}")"
- // strip "-webkit-var(" and ")"
- start += 12;
- l -= 13;
- // strip {w}
- while (l && isHTMLSpace(*start)) {
- ++start;
- --l;
- }
- while (l && isHTMLSpace(start[l - 1]))
- --l;
- break;
default:
break;
}
@@ -5536,7 +5524,7 @@ CSSRule* CSSParser::createMediaRule(MediaList* media, CSSRuleList* rules)
{
if (!media || !rules || !m_styleSheet)
return 0;
- m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false;
+ m_allowImportRules = m_allowNamespaceDeclarations = false;
RefPtr<CSSMediaRule> rule = CSSMediaRule::create(m_styleSheet, media, rules);
CSSMediaRule* result = rule.get();
m_parsedStyleObjects.append(rule.release());
@@ -5554,7 +5542,7 @@ CSSRuleList* CSSParser::createRuleList()
WebKitCSSKeyframesRule* CSSParser::createKeyframesRule()
{
- m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false;
+ m_allowImportRules = m_allowNamespaceDeclarations = false;
RefPtr<WebKitCSSKeyframesRule> rule = WebKitCSSKeyframesRule::create(m_styleSheet);
WebKitCSSKeyframesRule* rulePtr = rule.get();
m_parsedStyleObjects.append(rule.release());
@@ -5563,7 +5551,7 @@ WebKitCSSKeyframesRule* CSSParser::createKeyframesRule()
CSSRule* CSSParser::createStyleRule(Vector<CSSSelector*>* selectors)
{
- m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false;
+ m_allowImportRules = m_allowNamespaceDeclarations = false;
CSSStyleRule* result = 0;
markRuleBodyEnd();
if (selectors) {
@@ -5591,7 +5579,7 @@ CSSRule* CSSParser::createStyleRule(Vector<CSSSelector*>* selectors)
CSSRule* CSSParser::createFontFaceRule()
{
- m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false;
+ m_allowImportRules = m_allowNamespaceDeclarations = false;
RefPtr<CSSFontFaceRule> rule = CSSFontFaceRule::create(m_styleSheet);
for (unsigned i = 0; i < m_numParsedProperties; ++i) {
CSSProperty* property = m_parsedProperties[i];
@@ -5614,70 +5602,13 @@ void CSSParser::addNamespace(const AtomicString& prefix, const AtomicString& uri
if (!m_styleSheet || !m_allowNamespaceDeclarations)
return;
m_allowImportRules = false;
- m_allowVariablesRules = false;
m_styleSheet->addNamespace(this, prefix, uri);
}
-#if !ENABLE(CSS_VARIABLES)
-
-CSSRule* CSSParser::createVariablesRule(MediaList*, bool)
-{
- return 0;
-}
-
-bool CSSParser::addVariable(const CSSParserString&, CSSParserValueList*)
-{
- return false;
-}
-
-bool CSSParser::addVariableDeclarationBlock(const CSSParserString&)
-{
- return false;
-}
-
-#else
-
-CSSRule* CSSParser::createVariablesRule(MediaList* mediaList, bool variablesKeyword)
-{
- if (!m_allowVariablesRules)
- return 0;
- m_allowImportRules = false;
- RefPtr<CSSVariablesRule> rule = CSSVariablesRule::create(m_styleSheet, mediaList, variablesKeyword);
- rule->setDeclaration(CSSVariablesDeclaration::create(rule.get(), m_variableNames, m_variableValues));
- clearVariables();
- CSSRule* result = rule.get();
- m_parsedStyleObjects.append(rule.release());
- return result;
-}
-
-bool CSSParser::addVariable(const CSSParserString& name, CSSParserValueList* valueList)
-{
- if (checkForVariables(valueList)) {
- delete valueList;
- return false;
- }
- m_variableNames.append(String(name));
- m_variableValues.append(CSSValueList::createFromParserValueList(valueList));
- return true;
-}
-
-bool CSSParser::addVariableDeclarationBlock(const CSSParserString&)
-{
-// FIXME: Disabling declarations as variable values for now since they no longer have a common base class with CSSValues.
-#if 0
- m_variableNames.append(String(name));
- m_variableValues.append(CSSMutableStyleDeclaration::create(0, m_parsedProperties, m_numParsedProperties));
- clearProperties();
-#endif
- return true;
-}
-
-#endif
-
CSSRule* CSSParser::createPageRule(CSSSelector* pageSelector)
{
// FIXME: Margin at-rules are ignored.
- m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false;
+ m_allowImportRules = m_allowNamespaceDeclarations = false;
CSSPageRule* pageRule = 0;
if (pageSelector) {
RefPtr<CSSPageRule> rule = CSSPageRule::create(m_styleSheet, pageSelector, m_lastSelectorLineNumber);
@@ -5712,6 +5643,7 @@ void CSSParser::endDeclarationsForMarginBox()
m_numParsedPropertiesBeforeMarginBox = INVALID_NUM_PARSED_PROPERTIES;
}
+<<<<<<< HEAD
void CSSParser::clearVariables()
{
m_variableNames.clear();
@@ -5785,6 +5717,8 @@ void CSSParser::addUnresolvedProperty(int propId, bool important)
addProperty(propId, val.release(), important);
}
+=======
+>>>>>>> webkit.org at r72274
void CSSParser::deleteFontFaceOnlyValues()
{
ASSERT(m_hasFontFaceOnlyValues);