summaryrefslogtreecommitdiff
path: root/Source/WebCore/css/CSSParser.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-08-24 08:29:43 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-08-24 08:29:43 +0200
commit2e2ba8ff45915f40ed3e014101269c175f2a89a0 (patch)
tree3b94a9a9fa83efa384b8dac611cf8c6495532a62 /Source/WebCore/css/CSSParser.cpp
parentf53e6f8e798362ed712d4a51633b0d0b03dbc213 (diff)
downloadqtwebkit-2e2ba8ff45915f40ed3e014101269c175f2a89a0.tar.gz
Imported WebKit commit bf0b0213bbf3886c96610020602012ca7d11b084 (http://svn.webkit.org/repository/webkit/trunk@126545)
New snapshot with clang and python build fixes
Diffstat (limited to 'Source/WebCore/css/CSSParser.cpp')
-rw-r--r--Source/WebCore/css/CSSParser.cpp55
1 files changed, 32 insertions, 23 deletions
diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp
index 18c4c0352..7a5ea37d3 100644
--- a/Source/WebCore/css/CSSParser.cpp
+++ b/Source/WebCore/css/CSSParser.cpp
@@ -46,11 +46,13 @@
#include "CSSPropertySourceData.h"
#include "CSSReflectValue.h"
#include "CSSSelector.h"
+#include "CSSStyleSheet.h"
#include "CSSTimingFunctionValue.h"
#include "CSSUnicodeRangeValue.h"
#include "CSSValueKeywords.h"
#include "CSSValueList.h"
#include "CSSValuePool.h"
+#include "StylePropertyShorthand.h"
#if ENABLE(CSS_VARIABLES)
#include "CSSVariableValue.h"
#endif
@@ -1241,6 +1243,30 @@ void CSSParser::parseSelector(const String& string, CSSSelectorList& selectorLis
m_selectorListForParseSelector = 0;
}
+PassRefPtr<StylePropertySet> CSSParser::parseInlineStyleDeclaration(const String& string, Element* element)
+{
+ CSSParserContext context = element->document()->elementSheet()->contents()->parserContext();
+ context.mode = strictToCSSParserMode(element->isHTMLElement() && !element->document()->inQuirksMode());
+ return CSSParser(context).parseDeclaration(string, element->document()->elementSheet()->contents());
+}
+
+PassRefPtr<StylePropertySet> CSSParser::parseDeclaration(const String& string, StyleSheetContents* contextStyleSheet)
+{
+ setStyleSheet(contextStyleSheet);
+
+ setupParser("@-webkit-decls{", string, "} ");
+ cssyyparse(this);
+ m_rule = 0;
+
+ if (m_hasFontFaceOnlyValues)
+ deleteFontFaceOnlyValues();
+
+ RefPtr<StylePropertySet> style = createStylePropertySet();
+ clearProperties();
+ return style.release();
+}
+
+
bool CSSParser::parseDeclaration(StylePropertySet* declaration, const String& string, PassRefPtr<CSSRuleSourceData> prpRuleSourceData, StyleSheetContents* contextStyleSheet)
{
// Length of the "@-webkit-decls{" prefix.
@@ -3074,30 +3100,13 @@ void CSSParser::addAnimationValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> r
bool CSSParser::parseAnimationShorthand(bool important)
{
- // When we parse the animation shorthand we need to look for animation-name
- // last because otherwise it might match against the keywords for fill mode,
- // timing functions and infinite iteration. This means that animation names
- // that are the same as keywords (e.g. 'forwards') won't always match in the
- // shorthand. In that case they should be using longhands (or reconsidering
- // their approach). This is covered by the animations spec bug:
- // https://www.w3.org/Bugs/Public/show_bug.cgi?id=14790
- // And in the spec (editor's draft) at:
- // http://dev.w3.org/csswg/css3-animations/#animation-shorthand-property
-
- static const CSSPropertyID animationProperties[] = {
- CSSPropertyWebkitAnimationDuration,
- CSSPropertyWebkitAnimationTimingFunction,
- CSSPropertyWebkitAnimationDelay,
- CSSPropertyWebkitAnimationIterationCount,
- CSSPropertyWebkitAnimationDirection,
- CSSPropertyWebkitAnimationFillMode,
- CSSPropertyWebkitAnimationName
- };
+ const StylePropertyShorthand& animationProperties = webkitAnimationShorthandForParsing();
const unsigned numProperties = 7;
// The list of properties in the shorthand should be the same
- // length as the list we have here, even though they are
- // a different order.
+ // length as the list with animation name in last position, even though they are
+ // in a different order.
+ ASSERT(numProperties == webkitAnimationShorthandForParsing().length());
ASSERT(numProperties == webkitAnimationShorthand().length());
ShorthandScope scope(this, CSSPropertyWebkitAnimation);
@@ -3124,7 +3133,7 @@ bool CSSParser::parseAnimationShorthand(bool important)
for (i = 0; i < numProperties; ++i) {
if (!parsedProperty[i]) {
RefPtr<CSSValue> val;
- if (parseAnimationProperty(animationProperties[i], val)) {
+ if (parseAnimationProperty(animationProperties.properties()[i], val)) {
parsedProperty[i] = found = true;
addAnimationValue(values[i], val.release());
break;
@@ -3143,7 +3152,7 @@ bool CSSParser::parseAnimationShorthand(bool important)
if (!parsedProperty[i])
addAnimationValue(values[i], cssValuePool().createImplicitInitialValue());
- addProperty(animationProperties[i], values[i].release(), important);
+ addProperty(animationProperties.properties()[i], values[i].release(), important);
}
return true;