Commit 3a75d4a5 authored by Bugs Nash's avatar Bugs Nash Committed by Commit Bot

Implemented parsing logic in simple single property APIs

This patch
- Implemented the parsing logic for the single property APIs for the
  following properties
  - offset-distance
  - offset-rotate
  - -webkit-box-flex
  - -webkit-border-image
- Removed the legacy parsing logic for these properties from
  CSSPropertyParser.cpp
- updated CSSProperties.json5 so that the generated header files for
  the property APIs are updated

diff for generated files:
https://gist.github.com/BugsNash/8844b947b4e7e165b7475684b04da92c/revisions

Bug: 668012
Change-Id: I144a82c9ba6727af9387a59a6d57427fd223327b
Reviewed-on: https://chromium-review.googlesource.com/578757Reviewed-by: default avatarRenée Wright <rjwright@chromium.org>
Commit-Queue: Bugs Nash <bugsnash@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488594}
parent 000ee391
...@@ -1797,6 +1797,7 @@ ...@@ -1797,6 +1797,7 @@
{ {
name: "offset-distance", name: "offset-distance",
api_class: true, api_class: true,
api_methods: ["parseSingleValue"],
converter: "ConvertLength", converter: "ConvertLength",
interpolable: true, interpolable: true,
field_template: "<length>", field_template: "<length>",
...@@ -1831,6 +1832,7 @@ ...@@ -1831,6 +1832,7 @@
{ {
name: "offset-rotate", name: "offset-rotate",
api_class: "CSSPropertyAPIOffsetRotate", api_class: "CSSPropertyAPIOffsetRotate",
api_methods: ["parseSingleValue"],
converter: "ConvertOffsetRotate", converter: "ConvertOffsetRotate",
interpolable: true, interpolable: true,
field_template: "external", field_template: "external",
...@@ -2855,6 +2857,7 @@ ...@@ -2855,6 +2857,7 @@
{ {
name: "-webkit-border-image", name: "-webkit-border-image",
api_class: true, api_class: true,
api_methods: ["parseSingleValue"],
custom_value: true, custom_value: true,
}, },
{ {
...@@ -2898,6 +2901,7 @@ ...@@ -2898,6 +2901,7 @@
{ {
name: "-webkit-box-flex", name: "-webkit-box-flex",
api_class: true, api_class: true,
api_methods: ["parseSingleValue"],
type_name: "float", type_name: "float",
field_template: "primitive", field_template: "primitive",
default_value: "0.0f", default_value: "0.0f",
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include "core/css/properties/CSSPropertyFontUtils.h" #include "core/css/properties/CSSPropertyFontUtils.h"
#include "core/css/properties/CSSPropertyLengthUtils.h" #include "core/css/properties/CSSPropertyLengthUtils.h"
#include "core/css/properties/CSSPropertyMarginUtils.h" #include "core/css/properties/CSSPropertyMarginUtils.h"
#include "core/css/properties/CSSPropertyOffsetRotateUtils.h"
#include "core/css/properties/CSSPropertyPositionUtils.h" #include "core/css/properties/CSSPropertyPositionUtils.h"
#include "core/css/properties/CSSPropertyTextDecorationLineUtils.h" #include "core/css/properties/CSSPropertyTextDecorationLineUtils.h"
#include "core/css/properties/CSSPropertyTransitionPropertyUtils.h" #include "core/css/properties/CSSPropertyTransitionPropertyUtils.h"
...@@ -999,11 +998,6 @@ const CSSValue* CSSPropertyParser::ParseSingleValue( ...@@ -999,11 +998,6 @@ const CSSValue* CSSPropertyParser::ParseSingleValue(
DCHECK(!RuntimeEnabledFeatures::CSS3TextDecorationsEnabled()); DCHECK(!RuntimeEnabledFeatures::CSS3TextDecorationsEnabled());
return CSSPropertyTextDecorationLineUtils::ConsumeTextDecorationLine( return CSSPropertyTextDecorationLineUtils::ConsumeTextDecorationLine(
range_); range_);
case CSSPropertyOffsetDistance:
return ConsumeLengthOrPercent(range_, context_->Mode(), kValueRangeAll);
case CSSPropertyOffsetRotate:
return CSSPropertyOffsetRotateUtils::ConsumeOffsetRotate(range_,
*context_);
case CSSPropertyWebkitTransformOriginX: case CSSPropertyWebkitTransformOriginX:
case CSSPropertyWebkitPerspectiveOriginX: case CSSPropertyWebkitPerspectiveOriginX:
return CSSPropertyPositionUtils::ConsumePositionLonghand<CSSValueLeft, return CSSPropertyPositionUtils::ConsumePositionLonghand<CSSValueLeft,
...@@ -1014,8 +1008,6 @@ const CSSValue* CSSPropertyParser::ParseSingleValue( ...@@ -1014,8 +1008,6 @@ const CSSValue* CSSPropertyParser::ParseSingleValue(
return CSSPropertyPositionUtils::ConsumePositionLonghand<CSSValueTop, return CSSPropertyPositionUtils::ConsumePositionLonghand<CSSValueTop,
CSSValueBottom>( CSSValueBottom>(
range_, context_->Mode()); range_, context_->Mode());
case CSSPropertyWebkitBoxFlex:
return ConsumeNumber(range_, kValueRangeAll);
case CSSPropertyStrokeWidth: case CSSPropertyStrokeWidth:
case CSSPropertyStrokeDashoffset: case CSSPropertyStrokeDashoffset:
case CSSPropertyCx: case CSSPropertyCx:
...@@ -1038,9 +1030,6 @@ const CSSValue* CSSPropertyParser::ParseSingleValue( ...@@ -1038,9 +1030,6 @@ const CSSValue* CSSPropertyParser::ParseSingleValue(
case CSSPropertyBorderImageWidth: case CSSPropertyBorderImageWidth:
case CSSPropertyWebkitMaskBoxImageWidth: case CSSPropertyWebkitMaskBoxImageWidth:
return CSSPropertyBorderImageUtils::ConsumeBorderImageWidth(range_); return CSSPropertyBorderImageUtils::ConsumeBorderImageWidth(range_);
case CSSPropertyWebkitBorderImage:
return CSSPropertyBorderImageUtils::ConsumeWebkitBorderImage(range_,
context_);
case CSSPropertyBackgroundAttachment: case CSSPropertyBackgroundAttachment:
case CSSPropertyBackgroundBlendMode: case CSSPropertyBackgroundBlendMode:
case CSSPropertyBackgroundClip: case CSSPropertyBackgroundClip:
......
...@@ -4,4 +4,18 @@ ...@@ -4,4 +4,18 @@
#include "core/css/properties/CSSPropertyAPIOffsetDistance.h" #include "core/css/properties/CSSPropertyAPIOffsetDistance.h"
namespace blink {} // namespace blink #include "core/css/parser/CSSParserContext.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "platform/Length.h"
namespace blink {
const CSSValue* CSSPropertyAPIOffsetDistance::parseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext& context,
const CSSParserLocalContext&) {
return CSSPropertyParserHelpers::ConsumeLengthOrPercent(range, context.Mode(),
kValueRangeAll);
}
} // namespace blink
...@@ -4,4 +4,15 @@ ...@@ -4,4 +4,15 @@
#include "core/css/properties/CSSPropertyAPIOffsetRotate.h" #include "core/css/properties/CSSPropertyAPIOffsetRotate.h"
namespace blink {} // namespace blink #include "core/css/properties/CSSPropertyOffsetRotateUtils.h"
namespace blink {
const CSSValue* CSSPropertyAPIOffsetRotate::parseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext& context,
const CSSParserLocalContext&) {
return CSSPropertyOffsetRotateUtils::ConsumeOffsetRotate(range, context);
}
} // namespace blink
...@@ -4,4 +4,15 @@ ...@@ -4,4 +4,15 @@
#include "core/css/properties/CSSPropertyAPIWebkitBorderImage.h" #include "core/css/properties/CSSPropertyAPIWebkitBorderImage.h"
namespace blink {} // namespace blink #include "core/css/properties/CSSPropertyBorderImageUtils.h"
namespace blink {
const CSSValue* CSSPropertyAPIWebkitBorderImage::parseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext& context,
const CSSParserLocalContext&) {
return CSSPropertyBorderImageUtils::ConsumeWebkitBorderImage(range, &context);
}
} // namespace blink
...@@ -4,4 +4,15 @@ ...@@ -4,4 +4,15 @@
#include "core/css/properties/CSSPropertyAPIWebkitBoxFlex.h" #include "core/css/properties/CSSPropertyAPIWebkitBoxFlex.h"
namespace blink {} // namespace blink #include "core/css/parser/CSSPropertyParserHelpers.h"
namespace blink {
const CSSValue* CSSPropertyAPIWebkitBoxFlex::parseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext&,
const CSSParserLocalContext&) {
return CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeAll);
}
} // namespace blink
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment