Commit 5eab49a3 authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

Count usage of min/max/clamp in <length-percentage> values

This patch plumbs CSSParserContext into ConsumeLengthOrPercent(), so
that we can count usage of CSS comparison functions min/max/clamp when
they are used in <length-percentage> values.

There are three types of code paths, which are handled differently:

1. A caller takes the CSSParserMode from a CSSParserContext, and passes
it through. We change it to pass the CSSParserContext directly.

2. A caller has a CSSParserContext, but passes a possibly different
CSSParserMode. We change it to temporarily override the CSSParserMode
of the current context.

3. A caller doesn't necessarily has a CSSParserContext, and passes a
CSSParserMode. We change it to pass a newly created CSSParserContext
with the underlying document and the CSSParserMode.

Bug: 1047784
Change-Id: Iabc5bff859ff2dc302ee2eb9f0b3398f5a1952be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2033892Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#739408}
parent 939f1542
......@@ -6,6 +6,7 @@
#include "third_party/blink/renderer/bindings/core/v8/v8_scroll_timeline_options.h"
#include "third_party/blink/renderer/core/css/css_to_length_conversion_data.h"
#include "third_party/blink/renderer/core/css/parser/css_parser_context.h"
#include "third_party/blink/renderer/core/css/parser/css_tokenizer.h"
#include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
......@@ -47,11 +48,13 @@ bool StringToScrollDirection(String scroll_direction,
return false;
}
bool StringToScrollOffset(String scroll_offset, CSSPrimitiveValue** result) {
bool StringToScrollOffset(String scroll_offset,
const CSSParserContext& context,
CSSPrimitiveValue** result) {
CSSTokenizer tokenizer(scroll_offset);
const auto tokens = tokenizer.TokenizeToEOF();
CSSParserTokenRange range(tokens);
CSSValue* value = css_parsing_utils::ConsumeScrollOffset(range);
CSSValue* value = css_parsing_utils::ConsumeScrollOffset(range, context);
if (!value)
return false;
......@@ -80,6 +83,10 @@ ScrollTimeline* ScrollTimeline::Create(Document& document,
? options->scrollSource()
: document.scrollingElement();
// TODO(xiaochengh): Try reusing an existing context in document.
const CSSParserContext* context =
MakeGarbageCollected<CSSParserContext>(document);
ScrollDirection orientation;
if (!StringToScrollDirection(options->orientation(), orientation)) {
exception_state.ThrowDOMException(DOMExceptionCode::kNotSupportedError,
......@@ -88,14 +95,15 @@ ScrollTimeline* ScrollTimeline::Create(Document& document,
}
CSSPrimitiveValue* start_scroll_offset = nullptr;
if (!StringToScrollOffset(options->startScrollOffset(),
if (!StringToScrollOffset(options->startScrollOffset(), *context,
&start_scroll_offset)) {
exception_state.ThrowTypeError("Invalid startScrollOffset");
return nullptr;
}
CSSPrimitiveValue* end_scroll_offset = nullptr;
if (!StringToScrollOffset(options->endScrollOffset(), &end_scroll_offset)) {
if (!StringToScrollOffset(options->endScrollOffset(), *context,
&end_scroll_offset)) {
exception_state.ThrowTypeError("Invalid endScrollOffset");
return nullptr;
}
......
......@@ -40,6 +40,8 @@ bool CouldConsumeReservedKeyword(CSSParserTokenRange range) {
return false;
}
// TODO(xiaochengh): |context| is never nullptr in this function. Change
// parameter type to |const CSSParserContext&| to avoid confusion.
const CSSValue* ConsumeSingleType(const CSSSyntaxComponent& syntax,
CSSParserTokenRange& range,
const CSSParserContext* context) {
......@@ -61,9 +63,12 @@ const CSSValue* ConsumeSingleType(const CSSSyntaxComponent& syntax,
case CSSSyntaxType::kPercentage:
return css_property_parser_helpers::ConsumePercent(
range, ValueRange::kValueRangeAll);
case CSSSyntaxType::kLengthPercentage:
case CSSSyntaxType::kLengthPercentage: {
CSSParserContext::ParserModeOverridingScope scope(*context,
kHTMLStandardMode);
return css_property_parser_helpers::ConsumeLengthOrPercent(
range, kHTMLStandardMode, ValueRange::kValueRangeAll);
range, *context, ValueRange::kValueRangeAll);
}
case CSSSyntaxType::kColor:
return css_property_parser_helpers::ConsumeColor(range,
kHTMLStandardMode);
......
......@@ -136,9 +136,27 @@ class CORE_EXPORT CSSParserContext final
bool IsForMarkupSanitization() const;
// Overrides |mode_| of a CSSParserContext within the scope, allowing us to
// switching parsing mode while parsing different parts of a style sheet.
// TODO(xiaochengh): This isn't the right approach, as it breaks the
// immutability of CSSParserContext. We should introduce some local context.
class ParserModeOverridingScope {
STACK_ALLOCATED();
public:
ParserModeOverridingScope(const CSSParserContext& context,
CSSParserMode mode)
: mode_reset_(const_cast<CSSParserMode*>(&context.mode_), mode) {}
private:
base::AutoReset<CSSParserMode> mode_reset_;
};
void Trace(blink::Visitor*);
private:
friend class ParserModeOverridingScope;
KURL base_url_;
network::mojom::CSPDisposition should_check_content_security_policy_;
......
......@@ -289,7 +289,7 @@ bool CSSPropertyParser::ConsumeCSSWideKeyword(CSSPropertyID unresolved_property,
static CSSValue* ConsumeSingleViewportDescriptor(
CSSParserTokenRange& range,
CSSPropertyID prop_id,
CSSParserMode css_parser_mode) {
const CSSParserContext& context) {
CSSValueID id = range.Peek().Id();
switch (prop_id) {
case CSSPropertyID::kMinWidth:
......@@ -299,7 +299,7 @@ static CSSValue* ConsumeSingleViewportDescriptor(
if (id == CSSValueID::kAuto || id == CSSValueID::kInternalExtendToZoom)
return ConsumeIdent(range);
return css_property_parser_helpers::ConsumeLengthOrPercent(
range, css_parser_mode, kValueRangeNonNegative);
range, context, kValueRangeNonNegative);
case CSSPropertyID::kMinZoom:
case CSSPropertyID::kMaxZoom:
case CSSPropertyID::kZoom: {
......@@ -337,13 +337,13 @@ bool CSSPropertyParser::ParseViewportDescriptor(CSSPropertyID prop_id,
switch (prop_id) {
case CSSPropertyID::kWidth: {
CSSValue* min_width = ConsumeSingleViewportDescriptor(
range_, CSSPropertyID::kMinWidth, context_->Mode());
range_, CSSPropertyID::kMinWidth, *context_);
if (!min_width)
return false;
CSSValue* max_width = min_width;
if (!range_.AtEnd()) {
max_width = ConsumeSingleViewportDescriptor(
range_, CSSPropertyID::kMaxWidth, context_->Mode());
range_, CSSPropertyID::kMaxWidth, *context_);
}
if (!max_width || !range_.AtEnd())
return false;
......@@ -357,13 +357,13 @@ bool CSSPropertyParser::ParseViewportDescriptor(CSSPropertyID prop_id,
}
case CSSPropertyID::kHeight: {
CSSValue* min_height = ConsumeSingleViewportDescriptor(
range_, CSSPropertyID::kMinHeight, context_->Mode());
range_, CSSPropertyID::kMinHeight, *context_);
if (!min_height)
return false;
CSSValue* max_height = min_height;
if (!range_.AtEnd()) {
max_height = ConsumeSingleViewportDescriptor(
range_, CSSPropertyID::kMaxHeight, context_->Mode());
range_, CSSPropertyID::kMaxHeight, *context_);
}
if (!max_height || !range_.AtEnd())
return false;
......@@ -386,7 +386,7 @@ bool CSSPropertyParser::ParseViewportDescriptor(CSSPropertyID prop_id,
case CSSPropertyID::kUserZoom:
case CSSPropertyID::kOrientation: {
CSSValue* parsed_value =
ConsumeSingleViewportDescriptor(range_, prop_id, context_->Mode());
ConsumeSingleViewportDescriptor(range_, prop_id, *context_);
if (!parsed_value || !range_.AtEnd())
return false;
AddProperty(prop_id, CSSPropertyID::kInvalid, *parsed_value, important,
......
......@@ -476,17 +476,17 @@ bool CanConsumeCalcValue(CalculationCategory category,
}
CSSPrimitiveValue* ConsumeLengthOrPercent(CSSParserTokenRange& range,
CSSParserMode css_parser_mode,
const CSSParserContext& context,
ValueRange value_range,
UnitlessQuirk unitless) {
const CSSParserToken& token = range.Peek();
if (token.GetType() == kDimensionToken || token.GetType() == kNumberToken)
return ConsumeLength(range, css_parser_mode, value_range, unitless);
return ConsumeLength(range, context.Mode(), value_range, unitless);
if (token.GetType() == kPercentageToken)
return ConsumePercent(range, value_range);
MathFunctionParser math_parser(range, value_range);
MathFunctionParser math_parser(range, &context, value_range);
if (const CSSMathFunctionValue* calculation = math_parser.Value()) {
if (CanConsumeCalcValue(calculation->Category(), css_parser_mode))
if (CanConsumeCalcValue(calculation->Category(), context.Mode()))
return math_parser.ConsumeValue();
}
return nullptr;
......@@ -521,8 +521,9 @@ CSSPrimitiveValue* ConsumeSVGGeometryPropertyLength(
CSSParserTokenRange& range,
const CSSParserContext& context,
ValueRange value_range) {
CSSPrimitiveValue* value = ConsumeLengthOrPercent(
range, kSVGAttributeMode, value_range, UnitlessQuirk::kForbid);
CSSParserContext::ParserModeOverridingScope scope(context, kSVGAttributeMode);
CSSPrimitiveValue* value = ConsumeLengthOrPercent(range, context, value_range,
UnitlessQuirk::kForbid);
if (IsNonZeroUserUnitsValue(value))
context.Count(WebFeature::kSVGGeometryPropertyHasNonZeroUnitlessValue);
return value;
......@@ -533,7 +534,7 @@ CSSPrimitiveValue* ConsumeGradientLengthOrPercent(
const CSSParserContext& context,
ValueRange value_range,
UnitlessQuirk unitless) {
return ConsumeLengthOrPercent(range, context.Mode(), value_range, unitless);
return ConsumeLengthOrPercent(range, context, value_range, unitless);
}
CSSPrimitiveValue* ConsumeAngle(
......@@ -941,13 +942,12 @@ CSSValue* ConsumeLineWidth(CSSParserTokenRange& range,
}
static CSSValue* ConsumePositionComponent(CSSParserTokenRange& range,
CSSParserMode css_parser_mode,
const CSSParserContext& context,
UnitlessQuirk unitless,
bool& horizontal_edge,
bool& vertical_edge) {
if (range.Peek().GetType() != kIdentToken)
return ConsumeLengthOrPercent(range, css_parser_mode, kValueRangeAll,
unitless);
return ConsumeLengthOrPercent(range, context, kValueRangeAll, unitless);
CSSValueID id = range.Peek().Id();
if (id == CSSValueID::kLeft || id == CSSValueID::kRight) {
......@@ -1058,7 +1058,7 @@ bool ConsumePosition(CSSParserTokenRange& range,
CSSValue*& result_y) {
bool horizontal_edge = false;
bool vertical_edge = false;
CSSValue* value1 = ConsumePositionComponent(range, context.Mode(), unitless,
CSSValue* value1 = ConsumePositionComponent(range, context, unitless,
horizontal_edge, vertical_edge);
if (!value1)
return false;
......@@ -1066,7 +1066,7 @@ bool ConsumePosition(CSSParserTokenRange& range,
horizontal_edge = true;
CSSParserTokenRange range_after_first_consume = range;
CSSValue* value2 = ConsumePositionComponent(range, context.Mode(), unitless,
CSSValue* value2 = ConsumePositionComponent(range, context, unitless,
horizontal_edge, vertical_edge);
if (!value2) {
PositionFromOneValue(value1, result_x, result_y);
......@@ -1083,9 +1083,10 @@ bool ConsumePosition(CSSParserTokenRange& range,
!!identifier_value2 != (range.Peek().GetType() == kIdentToken) &&
(identifier_value2
? identifier_value2->GetValueID()
: identifier_value1->GetValueID()) != CSSValueID::kCenter)
value3 = ConsumePositionComponent(range, context.Mode(), unitless,
horizontal_edge, vertical_edge);
: identifier_value1->GetValueID()) != CSSValueID::kCenter) {
value3 = ConsumePositionComponent(range, context, unitless, horizontal_edge,
vertical_edge);
}
if (!value3) {
if (vertical_edge && !value2->IsIdentifierValue()) {
range = range_after_first_consume;
......@@ -1100,9 +1101,10 @@ bool ConsumePosition(CSSParserTokenRange& range,
auto* identifier_value3 = DynamicTo<CSSIdentifierValue>(value3);
if (identifier_value3 &&
identifier_value3->GetValueID() != CSSValueID::kCenter &&
range.Peek().GetType() != kIdentToken)
value4 = ConsumePositionComponent(range, context.Mode(), unitless,
horizontal_edge, vertical_edge);
range.Peek().GetType() != kIdentToken) {
value4 = ConsumePositionComponent(range, context, unitless, horizontal_edge,
vertical_edge);
}
if (!value4) {
if (!three_value_position) {
......@@ -1146,25 +1148,25 @@ CSSValuePair* ConsumePosition(CSSParserTokenRange& range,
}
bool ConsumeOneOrTwoValuedPosition(CSSParserTokenRange& range,
CSSParserMode css_parser_mode,
const CSSParserContext& context,
UnitlessQuirk unitless,
CSSValue*& result_x,
CSSValue*& result_y) {
bool horizontal_edge = false;
bool vertical_edge = false;
CSSValue* value1 = ConsumePositionComponent(range, css_parser_mode, unitless,
CSSValue* value1 = ConsumePositionComponent(range, context, unitless,
horizontal_edge, vertical_edge);
if (!value1)
return false;
if (!value1->IsIdentifierValue())
horizontal_edge = true;
if (vertical_edge && ConsumeLengthOrPercent(range, css_parser_mode,
kValueRangeAll, unitless)) {
if (vertical_edge &&
ConsumeLengthOrPercent(range, context, kValueRangeAll, unitless)) {
// <length-percentage> is not permitted after top | bottom.
return false;
}
CSSValue* value2 = ConsumePositionComponent(range, css_parser_mode, unitless,
CSSValue* value2 = ConsumePositionComponent(range, context, unitless,
horizontal_edge, vertical_edge);
if (!value2) {
PositionFromOneValue(value1, result_x, result_y);
......@@ -1419,8 +1421,8 @@ static CSSValue* ConsumeDeprecatedRadialGradient(
cssvalue::CSSGradientRepeat repeating) {
CSSValue* center_x = nullptr;
CSSValue* center_y = nullptr;
ConsumeOneOrTwoValuedPosition(args, context.Mode(), UnitlessQuirk::kForbid,
center_x, center_y);
ConsumeOneOrTwoValuedPosition(args, context, UnitlessQuirk::kForbid, center_x,
center_y);
if ((center_x || center_y) && !ConsumeCommaIncludingWhitespace(args))
return nullptr;
......@@ -1438,10 +1440,10 @@ static CSSValue* ConsumeDeprecatedRadialGradient(
const CSSPrimitiveValue* vertical_size = nullptr;
if (!shape && !size_keyword) {
horizontal_size =
ConsumeLengthOrPercent(args, context.Mode(), kValueRangeNonNegative);
ConsumeLengthOrPercent(args, context, kValueRangeNonNegative);
if (horizontal_size) {
vertical_size =
ConsumeLengthOrPercent(args, context.Mode(), kValueRangeNonNegative);
ConsumeLengthOrPercent(args, context, kValueRangeNonNegative);
if (!vertical_size)
return nullptr;
ConsumeCommaIncludingWhitespace(args);
......@@ -1491,14 +1493,13 @@ static CSSValue* ConsumeRadialGradient(CSSParserTokenRange& args,
}
} else {
CSSPrimitiveValue* center =
ConsumeLengthOrPercent(args, context.Mode(), kValueRangeNonNegative);
ConsumeLengthOrPercent(args, context, kValueRangeNonNegative);
if (!center)
break;
if (horizontal_size)
return nullptr;
horizontal_size = center;
center =
ConsumeLengthOrPercent(args, context.Mode(), kValueRangeNonNegative);
center = ConsumeLengthOrPercent(args, context, kValueRangeNonNegative);
if (center) {
vertical_size = center;
++i;
......
......@@ -62,7 +62,7 @@ CSSPrimitiveValue* ConsumePercent(CSSParserTokenRange&, ValueRange);
CSSPrimitiveValue* ConsumeAlphaValue(CSSParserTokenRange&);
CSSPrimitiveValue* ConsumeLengthOrPercent(
CSSParserTokenRange&,
CSSParserMode,
const CSSParserContext&,
ValueRange,
UnitlessQuirk = UnitlessQuirk::kForbid);
CSSPrimitiveValue* ConsumeSVGGeometryPropertyLength(CSSParserTokenRange&,
......@@ -116,7 +116,7 @@ bool ConsumePosition(CSSParserTokenRange&,
CSSValue*& result_x,
CSSValue*& result_y);
bool ConsumeOneOrTwoValuedPosition(CSSParserTokenRange&,
CSSParserMode,
const CSSParserContext&,
UnitlessQuirk,
CSSValue*& result_x,
CSSValue*& result_y);
......
......@@ -47,7 +47,7 @@ bool IsSelfPositionOrLeftOrRightKeyword(CSSValueID);
bool IsContentPositionKeyword(CSSValueID);
bool IsContentPositionOrLeftOrRightKeyword(CSSValueID);
CSSValue* ConsumeScrollOffset(CSSParserTokenRange&);
CSSValue* ConsumeScrollOffset(CSSParserTokenRange&, const CSSParserContext&);
CSSValue* ConsumeSelfPositionOverflowPosition(CSSParserTokenRange&,
IsPositionKeyword);
CSSValue* ConsumeSimplifiedDefaultPosition(CSSParserTokenRange&,
......@@ -118,7 +118,8 @@ bool ConsumeBorderImageComponents(CSSParserTokenRange&,
DefaultFill);
CSSValue* ConsumeBorderImageRepeat(CSSParserTokenRange&);
CSSValue* ConsumeBorderImageSlice(CSSParserTokenRange&, DefaultFill);
CSSValue* ConsumeBorderImageWidth(CSSParserTokenRange&);
CSSValue* ConsumeBorderImageWidth(CSSParserTokenRange&,
const CSSParserContext&);
CSSValue* ConsumeBorderImageOutset(CSSParserTokenRange&);
CSSValue* ParseBorderRadiusCorner(CSSParserTokenRange&,
......@@ -147,7 +148,7 @@ CSSValue* ConsumeFontSize(
css_property_parser_helpers::UnitlessQuirk =
css_property_parser_helpers::UnitlessQuirk::kForbid);
CSSValue* ConsumeLineHeight(CSSParserTokenRange&, CSSParserMode);
CSSValue* ConsumeLineHeight(CSSParserTokenRange&, const CSSParserContext&);
CSSValueList* ConsumeFontFamily(CSSParserTokenRange&);
CSSValue* ConsumeGenericFamily(CSSParserTokenRange&);
......@@ -164,15 +165,13 @@ CSSIdentifierValue* ConsumeFontVariantCSS21(CSSParserTokenRange&);
CSSValue* ConsumeGridLine(CSSParserTokenRange&, const CSSParserContext&);
CSSValue* ConsumeGridTrackList(CSSParserTokenRange&,
const CSSParserContext&,
CSSParserMode,
TrackListType);
bool ParseGridTemplateAreasRow(const WTF::String& grid_row_names,
NamedGridAreaMap&,
const size_t row_count,
size_t& column_count);
CSSValue* ConsumeGridTemplatesRowsOrColumns(CSSParserTokenRange&,
const CSSParserContext&,
CSSParserMode);
const CSSParserContext&);
bool ConsumeGridItemPositionShorthand(bool important,
CSSParserTokenRange&,
const CSSParserContext&,
......@@ -205,9 +204,9 @@ CSSValue* ConsumeWidthOrHeight(
css_property_parser_helpers::UnitlessQuirk::kForbid);
CSSValue* ConsumeMarginOrOffset(CSSParserTokenRange&,
CSSParserMode,
const CSSParserContext&,
css_property_parser_helpers::UnitlessQuirk);
CSSValue* ConsumeScrollPadding(CSSParserTokenRange&);
CSSValue* ConsumeScrollPadding(CSSParserTokenRange&, const CSSParserContext&);
CSSValue* ConsumeOffsetPath(CSSParserTokenRange&, const CSSParserContext&);
CSSValue* ConsumePathOrNone(CSSParserTokenRange&);
CSSValue* ConsumeOffsetRotate(CSSParserTokenRange&, const CSSParserContext&);
......@@ -216,7 +215,7 @@ CSSValue* ConsumeBasicShape(CSSParserTokenRange&, const CSSParserContext&);
bool ConsumeRadii(CSSValue* horizontal_radii[4],
CSSValue* vertical_radii[4],
CSSParserTokenRange&,
CSSParserMode,
const CSSParserContext&,
bool use_legacy_parsing);
CSSValue* ConsumeTextDecorationLine(CSSParserTokenRange&);
......@@ -245,7 +244,7 @@ css_property_parser_helpers::UnitlessQuirk UnitlessUnlessShorthand(
template <CSSValueID start, CSSValueID end>
CSSValue* ConsumePositionLonghand(CSSParserTokenRange& range,
CSSParserMode css_parser_mode) {
const CSSParserContext& context) {
if (range.Peek().GetType() == kIdentToken) {
CSSValueID id = range.Peek().Id();
int percent;
......@@ -261,8 +260,8 @@ CSSValue* ConsumePositionLonghand(CSSParserTokenRange& range,
return CSSNumericLiteralValue::Create(
percent, CSSPrimitiveValue::UnitType::kPercentage);
}
return css_property_parser_helpers::ConsumeLengthOrPercent(
range, css_parser_mode, kValueRangeAll);
return css_property_parser_helpers::ConsumeLengthOrPercent(range, context,
kValueRangeAll);
}
CSSValue* ConsumeIntrinsicLength(CSSParserTokenRange&, const CSSParserContext&);
......
......@@ -670,7 +670,7 @@ bool BorderRadius::ParseShorthand(
CSSValue* vertical_radii[4] = {nullptr};
if (!css_parsing_utils::ConsumeRadii(horizontal_radii, vertical_radii, range,
context.Mode(),
context,
local_context.UseAliasParsing()))
return false;
......@@ -930,7 +930,7 @@ bool Flex::ParseShorthand(bool important,
flex_basis = css_property_parser_helpers::ConsumeIdent(range);
if (!flex_basis) {
flex_basis = css_property_parser_helpers::ConsumeLengthOrPercent(
range, context.Mode(), kValueRangeNonNegative);
range, context, kValueRangeNonNegative);
}
if (index == 2 && !range.AtEnd())
return false;
......@@ -1182,7 +1182,7 @@ bool ConsumeFont(bool important,
if (css_property_parser_helpers::ConsumeSlashIncludingWhitespace(range)) {
CSSValue* line_height =
css_parsing_utils::ConsumeLineHeight(range, context.Mode());
css_parsing_utils::ConsumeLineHeight(range, context);
if (!line_height)
return false;
css_property_parser_helpers::AddProperty(
......@@ -1628,23 +1628,22 @@ bool Grid::ParseShorthand(bool important,
auto_rows_value = CSSInitialValue::Create();
} else {
auto_rows_value = css_parsing_utils::ConsumeGridTrackList(
range, context, context.Mode(),
css_parsing_utils::TrackListType::kGridAuto);
range, context, css_parsing_utils::TrackListType::kGridAuto);
if (!auto_rows_value)
return false;
if (!css_property_parser_helpers::ConsumeSlashIncludingWhitespace(range))
return false;
}
if (!(template_columns =
css_parsing_utils::ConsumeGridTemplatesRowsOrColumns(
range, context, context.Mode())))
css_parsing_utils::ConsumeGridTemplatesRowsOrColumns(range,
context)))
return false;
template_rows = CSSInitialValue::Create();
auto_columns_value = CSSInitialValue::Create();
} else {
// 3- <grid-template-rows> / [ auto-flow && dense? ] <grid-auto-columns>?
template_rows = css_parsing_utils::ConsumeGridTemplatesRowsOrColumns(
range, context, context.Mode());
template_rows =
css_parsing_utils::ConsumeGridTemplatesRowsOrColumns(range, context);
if (!template_rows)
return false;
if (!css_property_parser_helpers::ConsumeSlashIncludingWhitespace(range))
......@@ -1657,8 +1656,7 @@ bool Grid::ParseShorthand(bool important,
auto_columns_value = CSSInitialValue::Create();
} else {
auto_columns_value = css_parsing_utils::ConsumeGridTrackList(
range, context, context.Mode(),
css_parsing_utils::TrackListType::kGridAuto);
range, context, css_parsing_utils::TrackListType::kGridAuto);
if (!auto_columns_value)
return false;
}
......@@ -2166,11 +2164,11 @@ bool Offset::ParseShorthand(
const CSSValue* offset_rotate = nullptr;
if (offset_path) {
offset_distance = css_property_parser_helpers::ConsumeLengthOrPercent(
range, context.Mode(), kValueRangeAll);
range, context, kValueRangeAll);
offset_rotate = css_parsing_utils::ConsumeOffsetRotate(range, context);
if (offset_rotate && !offset_distance) {
offset_distance = css_property_parser_helpers::ConsumeLengthOrPercent(
range, context.Mode(), kValueRangeAll);
range, context, kValueRangeAll);
}
}
const CSSValue* offset_anchor = nullptr;
......
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