Commit 3a18c39d authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Support 'auto' value for CSS quotes property.

Spec:
https://drafts.csswg.org/css-content/#quotes

Intent-to-ship:
https://groups.google.com/a/chromium.org/g/blink-dev/c/iqihcxi-CzY/m/U_0GkEoqCAAJ

Bug: 990557
Change-Id: I82ab72f05468b846bf10c6b37b74eaa3e35c457c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2366720Reviewed-by: default avatarAnders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802396}
parent 07160919
......@@ -3050,7 +3050,7 @@
default_value: "nullptr",
type_name: "QuotesData",
converter: "ConvertQuotes",
keywords: ["none"],
keywords: ["auto", "none"],
typedom_types: ["Keyword"]
},
{
......
......@@ -4917,8 +4917,11 @@ void Position::ApplyInherit(StyleResolverState& state) const {
const CSSValue* Quotes::ParseSingleValue(CSSParserTokenRange& range,
const CSSParserContext& context,
const CSSParserLocalContext&) const {
if (range.Peek().Id() == CSSValueID::kNone)
return css_parsing_utils::ConsumeIdent(range);
if (auto* value =
css_parsing_utils::ConsumeIdent<CSSValueID::kAuto, CSSValueID::kNone>(
range)) {
return value;
}
CSSValueList* values = CSSValueList::CreateSpaceSeparated();
while (!range.AtEnd()) {
CSSStringValue* parsed_value = css_parsing_utils::ConsumeString(range);
......@@ -4936,11 +4939,8 @@ const CSSValue* Quotes::CSSValueFromComputedStyleInternal(
const SVGComputedStyle&,
const LayoutObject*,
bool allow_visited_style) const {
if (!style.Quotes()) {
// TODO(ramya.v): We should return the quote values that we're actually
// using.
return nullptr;
}
if (!style.Quotes())
return CSSIdentifierValue::Create(CSSValueID::kAuto);
if (style.Quotes()->size()) {
CSSValueList* list = CSSValueList::CreateSpaceSeparated();
for (int i = 0; i < style.Quotes()->size(); i++) {
......
......@@ -1384,8 +1384,10 @@ scoped_refptr<QuotesData> StyleBuilderConverter::ConvertQuotes(
}
return quotes;
}
DCHECK_EQ(To<CSSIdentifierValue>(value).GetValueID(), CSSValueID::kNone);
return QuotesData::Create();
if (To<CSSIdentifierValue>(value).GetValueID() == CSSValueID::kNone)
return QuotesData::Create();
DCHECK_EQ(To<CSSIdentifierValue>(value).GetValueID(), CSSValueID::kAuto);
return nullptr;
}
LengthSize StyleBuilderConverter::ConvertRadius(StyleResolverState& state,
......
......@@ -1349,7 +1349,6 @@ crbug.com/753671 [ Mac ] external/wpt/css/css-content/quotes-014.html [ Failure
crbug.com/753671 [ Mac10.15 ] external/wpt/css/css-content/quotes-020.html [ Failure ]
crbug.com/753671 external/wpt/css/css-content/quotes-021.html [ Failure ]
crbug.com/753671 external/wpt/css/css-content/quotes-022.html [ Failure ]
crbug.com/753671 external/wpt/css/css-content/quotes-033.html [ Failure ]
crbug.com/989123 external/wpt/css/css-typed-om/the-stylepropertymap/computed/get-auto-min-size.html [ Failure ]
crbug.com/995106 external/wpt/css/css-lists/inline-block-list.html [ Failure ]
......
This is a testharness.js-based test.
FAIL Property quotes has initial value auto assert_equals: expected "auto" but got ""
PASS Property quotes has initial value auto
PASS Property quotes inherits
FAIL Property bookmark-level has initial value none assert_true: bookmark-level doesn't seem to be supported in the computed style expected true got false
FAIL Property bookmark-level does not inherit assert_true: expected true got false
......
This is a testharness.js-based test.
FAIL Can set 'quotes' to CSS-wide keywords assert_not_equals: Computed value must not be null got disallowed value null
FAIL Can set 'quotes' to var() references assert_not_equals: Computed value must not be null got disallowed value null
PASS Can set 'quotes' to the 'none' keyword
PASS Setting 'quotes' to a length throws TypeError
PASS Setting 'quotes' to a percent throws TypeError
PASS Setting 'quotes' to a time throws TypeError
PASS Setting 'quotes' to an angle throws TypeError
PASS Setting 'quotes' to a flexible length throws TypeError
PASS Setting 'quotes' to a number throws TypeError
PASS Setting 'quotes' to a position throws TypeError
PASS Setting 'quotes' to a URL throws TypeError
PASS Setting 'quotes' to a transform throws TypeError
PASS 'quotes' does not supported '"<<" ">>" "<" ">"'
Harness: the test ran to completion.
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