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

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: rebase 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 179d0e2e1cd15f56d931d63406b0600ae393857c..02db6576cd862648c7a6af366d22e2dbaaa6085b 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -42,6 +42,7 @@
#include "core/css/parser/CSSVariableParser.h"
#include "core/css/parser/FontVariantLigaturesParser.h"
#include "core/css/parser/FontVariantNumericParser.h"
+#include "core/css/properties/CSSPropertyAPI.h"
sashab 2017/02/01 18:21:45 Why is this needed?
#include "core/css/properties/CSSPropertyAlignmentUtils.h"
#include "core/css/properties/CSSPropertyColumnUtils.h"
#include "core/css/properties/CSSPropertyDescriptor.h"
@@ -2072,8 +2073,8 @@ const CSSValue* CSSPropertyParser::parseSingleValue(
return consumeIdent(m_range);
}
- // Gets the parsing function for our current property from the property API.
- // If it has been implemented, we call this function, otherwise we manually
+ // Gets the parsing method for our current property from the property API.
+ // If it has been implemented, we call this method, 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.
@@ -3575,6 +3576,16 @@ bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty,
bool important) {
CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
+ // Gets the parsing method for our current property from the property API.
+ // If it has been implemented, we call this method, 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 (cssPropertyDesc.parseShorthand)
+ return cssPropertyDesc.parseShorthand(important, m_range, m_context);
+
switch (property) {
case CSSPropertyWebkitMarginCollapse: {
CSSValueID id = m_range.consumeIncludingWhitespace().id();
@@ -3610,11 +3621,13 @@ bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty,
CSSValue* overflowXValue = nullptr;
- // FIXME: -webkit-paged-x or -webkit-paged-y only apply to overflow-y. If
+ // FIXME: -webkit-paged-x or -webkit-paged-y only apply to overflow-y.
+ // If
sashab 2017/02/01 18:21:45 Fix weird commenting thing :)
// this value has been set using the shorthand, then for now overflow-x
// will default to auto, but once we implement pagination controls, it
// should default to hidden. If the overflow-y value is anything but
- // paged-x or paged-y, then overflow-x and overflow-y should have the same
+ // paged-x or paged-y, then overflow-x and overflow-y should have the
+ // same
// value.
if (id == CSSValueWebkitPagedX || id == CSSValueWebkitPagedY)
overflowXValue = CSSIdentifierValue::create(CSSValueAuto);

Powered by Google App Engine
This is Rietveld 408576698