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

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

Issue 2653733005: Added parseShorthand method from the parser to CSSPropertyAPI.h. (Closed)
Patch Set: Moved implementation check into macro in CSSPropertyDescriptor.h Created 3 years, 11 months 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/CSSPropertyParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
index ba72614df31d56bf54518ba0369b639e7d0463bd..2a22a665190d9527da7785b0d923b57635b61fa2 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -41,6 +41,7 @@
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/parser/CSSVariableParser.h"
#include "core/css/parser/FontVariantLigaturesParser.h"
+#include "core/css/properties/CSSPropertyAPI.h"
#include "core/css/properties/CSSPropertyAlignmentUtils.h"
#include "core/css/properties/CSSPropertyColumnUtils.h"
#include "core/css/properties/CSSPropertyDescriptor.h"
@@ -2258,8 +2259,10 @@ const CSSValue* CSSPropertyParser::parseSingleValue(
// statement.
const CSSPropertyDescriptor& cssPropertyDesc =
CSSPropertyDescriptor::get(property);
- if (cssPropertyDesc.temporaryCanReadValue)
+ if (FUNCTION_IMPLEMENTED_FOR_PROPERTY(parseSingleValue, cssPropertyDesc) &&
+ cssPropertyDesc.parseSingleValue) {
return cssPropertyDesc.parseSingleValue(m_range, m_context);
+ }
switch (property) {
case CSSPropertyWebkitHighlight:
@@ -3808,6 +3811,17 @@ bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty,
bool important) {
CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
+ // Gets the parsing function for our current property from the property API.
+ // If it has been implemented, we call this function, otherwise we manually
+ // parse this value in the switch statement below. As we implement APIs for
+ // other properties, those properties will be taken out of the switch
+ // statement.
+ const CSSPropertyDescriptor& cssPropertyDesc =
+ CSSPropertyDescriptor::get(property);
+ if (FUNCTION_IMPLEMENTED_FOR_PROPERTY(parseShorthand, cssPropertyDesc) &&
+ cssPropertyDesc.parseShorthand) {
+ return cssPropertyDesc.parseShorthand(important, m_range, m_context);
+ }
switch (property) {
case CSSPropertyWebkitMarginCollapse: {
CSSValueID id = m_range.consumeIncludingWhitespace().id();

Powered by Google App Engine
This is Rietveld 408576698