Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSParser.cpp

Issue 2524303002: Emit console warning when element.animate() keyframe value fails to parse (Closed)
Patch Set: Review changes Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/parser/CSSParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSParser.cpp
index ee592d990f4cc5cde6f3f1148268e0945e0e3541..a6f4e2c1f7b5622bca790d6295d40245f42463aa 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSParser.cpp
@@ -7,7 +7,6 @@
#include "core/css/CSSColorValue.h"
#include "core/css/CSSKeyframeRule.h"
#include "core/css/StyleColor.h"
-#include "core/css/StylePropertySet.h"
#include "core/css/StyleRule.h"
#include "core/css/StyleSheetContents.h"
#include "core/css/parser/CSSParserFastPaths.h"
@@ -76,20 +75,28 @@ void CSSParser::parseSheetForInspector(const CSSParserContext& context,
observer);
}
-bool CSSParser::parseValue(MutableStylePropertySet* declaration,
- CSSPropertyID unresolvedProperty,
- const String& string,
- bool important,
- StyleSheetContents* styleSheet) {
- if (string.isEmpty())
- return false;
+MutableStylePropertySet::SetResult CSSParser::parseValue(
+ MutableStylePropertySet* declaration,
+ CSSPropertyID unresolvedProperty,
+ const String& string,
+ bool important,
+ StyleSheetContents* styleSheet) {
+ if (string.isEmpty()) {
+ bool didParse = false;
+ bool didChange = false;
+ return MutableStylePropertySet::SetResult{didParse, didChange};
+ }
+
CSSPropertyID resolvedProperty = resolveCSSPropertyID(unresolvedProperty);
CSSParserMode parserMode = declaration->cssParserMode();
CSSValue* value =
CSSParserFastPaths::maybeParseValue(resolvedProperty, string, parserMode);
- if (value)
- return declaration->setProperty(
+ if (value) {
+ bool didParse = true;
+ bool didChange = declaration->setProperty(
CSSProperty(resolvedProperty, *value, important));
+ return MutableStylePropertySet::SetResult{didParse, didChange};
+ }
CSSParserContext context(parserMode, nullptr);
if (styleSheet) {
context = styleSheet->parserContext();
@@ -99,7 +106,7 @@ bool CSSParser::parseValue(MutableStylePropertySet* declaration,
context);
}
-bool CSSParser::parseValueForCustomProperty(
+MutableStylePropertySet::SetResult CSSParser::parseValueForCustomProperty(
MutableStylePropertySet* declaration,
const AtomicString& propertyName,
const String& value,
@@ -107,8 +114,11 @@ bool CSSParser::parseValueForCustomProperty(
StyleSheetContents* styleSheet,
bool isAnimationTainted) {
DCHECK(CSSVariableParser::isValidVariableName(propertyName));
- if (value.isEmpty())
- return false;
+ if (value.isEmpty()) {
+ bool didParse = false;
+ bool didChange = false;
+ return MutableStylePropertySet::SetResult{didParse, didChange};
+ }
CSSParserMode parserMode = declaration->cssParserMode();
CSSParserContext context(parserMode, nullptr);
if (styleSheet) {
@@ -124,11 +134,12 @@ ImmutableStylePropertySet* CSSParser::parseCustomPropertySet(
return CSSParserImpl::parseCustomPropertySet(range);
}
-bool CSSParser::parseValue(MutableStylePropertySet* declaration,
- CSSPropertyID unresolvedProperty,
- const String& string,
- bool important,
- const CSSParserContext& context) {
+MutableStylePropertySet::SetResult CSSParser::parseValue(
+ MutableStylePropertySet* declaration,
+ CSSPropertyID unresolvedProperty,
+ const String& string,
+ bool important,
+ const CSSParserContext& context) {
return CSSParserImpl::parseValue(declaration, unresolvedProperty, string,
important, context);
}
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSParser.h ('k') | third_party/WebKit/Source/core/css/parser/CSSParserImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698