Commit 0d67873c authored by Kevin Babbitt's avatar Kevin Babbitt Committed by Commit Bot

Return system color keywords from computedStyleMap

This CL uses the parameter introduced in crrev.com/c/2438010 to
serialize system colors either as keywords or as rgb values depending
on whether computed or used value was requested.

Bug: 1112362
Change-Id: I5dfca764f944789930c42c5d80338fca1437ea12
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2436515Reviewed-by: default avatarAlison Maher <almaher@microsoft.com>
Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Commit-Queue: Kevin Babbitt <kbabbitt@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#813440}
parent 1617663a
...@@ -117,6 +117,10 @@ CSSValue* ComputedStyleUtils::CurrentColorOrValidColor( ...@@ -117,6 +117,10 @@ CSSValue* ComputedStyleUtils::CurrentColorOrValidColor(
CSSValuePhase value_phase) { CSSValuePhase value_phase) {
// This function does NOT look at visited information, so that computed style // This function does NOT look at visited information, so that computed style
// doesn't expose that. // doesn't expose that.
if (value_phase == CSSValuePhase::kComputedValue && color.IsSystemColor() &&
RuntimeEnabledFeatures::CSSSystemColorComputeToSelfEnabled()) {
return CSSIdentifierValue::Create(color.GetColorKeyword());
}
return cssvalue::CSSColorValue::Create( return cssvalue::CSSColorValue::Create(
color.Resolve(style.GetCurrentColor(), style.UsedColorScheme()).Rgb()); color.Resolve(style.GetCurrentColor(), style.UsedColorScheme()).Rgb());
} }
......
This is a testharness.js-based test. This is a testharness.js-based test.
FAIL color-scheme property affects Menu system color keyword assert_not_equals: got disallowed value "rgb(247, 247, 247)" FAIL color-scheme property affects Menu system color keyword assert_not_equals: got disallowed value "rgb(247, 247, 247)"
PASS System color computes to itself on color PASS System color computes to itself on color
FAIL Inherited system color keyword is observable on color assert_regexp_match: expected object "/menu/i" but got object "rgb(247, 247, 247)" PASS Inherited system color keyword is observable on color
PASS System color computes to itself on background-color PASS System color computes to itself on background-color
FAIL Inherited system color keyword is observable on background-color assert_regexp_match: expected object "/menu/i" but got object "rgb(247, 247, 247)" PASS Inherited system color keyword is observable on background-color
PASS System color computes to itself on box-shadow PASS System color computes to itself on box-shadow
FAIL Inherited system color keyword is observable on box-shadow assert_regexp_match: expected object "/menu/i" but got object "rgb(247, 247, 247) 2px 2px 0px 0px" PASS Inherited system color keyword is observable on box-shadow
PASS System color computes to itself on text-shadow PASS System color computes to itself on text-shadow
FAIL Inherited system color keyword is observable on text-shadow assert_regexp_match: expected object "/menu/i" but got object "rgb(247, 247, 247) 2px 2px 0px" PASS Inherited system color keyword is observable on text-shadow
PASS System color computes to itself on border-left-color PASS System color computes to itself on border-left-color
FAIL Inherited system color keyword is observable on border-left-color assert_regexp_match: expected object "/menu/i" but got object "rgb(247, 247, 247)" PASS Inherited system color keyword is observable on border-left-color
PASS System color computes to itself on border-top-color PASS System color computes to itself on border-top-color
FAIL Inherited system color keyword is observable on border-top-color assert_regexp_match: expected object "/menu/i" but got object "rgb(247, 247, 247)" PASS Inherited system color keyword is observable on border-top-color
PASS System color computes to itself on border-right-color PASS System color computes to itself on border-right-color
FAIL Inherited system color keyword is observable on border-right-color assert_regexp_match: expected object "/menu/i" but got object "rgb(247, 247, 247)" PASS Inherited system color keyword is observable on border-right-color
PASS System color computes to itself on border-bottom-color PASS System color computes to itself on border-bottom-color
FAIL Inherited system color keyword is observable on border-bottom-color assert_regexp_match: expected object "/menu/i" but got object "rgb(247, 247, 247)" PASS Inherited system color keyword is observable on border-bottom-color
PASS System color computes to itself on column-rule-color PASS System color computes to itself on column-rule-color
FAIL Inherited system color keyword is observable on column-rule-color assert_regexp_match: expected object "/menu/i" but got object "rgb(247, 247, 247)" PASS Inherited system color keyword is observable on column-rule-color
PASS System color computes to itself on outline-color PASS System color computes to itself on outline-color
FAIL Inherited system color keyword is observable on outline-color assert_regexp_match: expected object "/menu/i" but got object "rgb(247, 247, 247)" PASS Inherited system color keyword is observable on outline-color
PASS System color computes to itself on caret-color PASS System color computes to itself on caret-color
FAIL Inherited system color keyword is observable on caret-color assert_regexp_match: expected object "/menu/i" but got object "rgb(247, 247, 247)" PASS Inherited system color keyword is observable on caret-color
PASS System color computes to itself on fill PASS System color computes to itself on fill
FAIL Inherited system color keyword is observable on fill assert_regexp_match: expected object "/menu/i" but got object "rgb(247, 247, 247)" PASS Inherited system color keyword is observable on fill
PASS System color computes to itself on stroke PASS System color computes to itself on stroke
FAIL Inherited system color keyword is observable on stroke assert_regexp_match: expected object "/menu/i" but got object "rgb(247, 247, 247)" PASS Inherited system color keyword is observable on stroke
Harness: the test ran to completion. Harness: the test ran to completion.
...@@ -14,11 +14,11 @@ function checkSystemColor(id1, id2, systemColor) ...@@ -14,11 +14,11 @@ function checkSystemColor(id1, id2, systemColor)
var textElement = document.getElementById(id1); var textElement = document.getElementById(id1);
computedStyleText = textElement.ownerDocument.defaultView.getComputedStyle(textElement); computedStyleText = textElement.ownerDocument.defaultView.getComputedStyle(textElement);
var divElement = document.getElementById(id2); var divElement = document.getElementById(id2);
computedStyleDiv = divElement.ownerDocument.defaultView.getComputedStyle(divElement); computedStyleDiv = divElement.computedStyleMap();
debug('Testing system color' + systemColor); debug('Testing system color' + systemColor);
shouldBe("computedStyleText.fill", "computedStyleDiv.color"); shouldBe("computedStyleText.fill", "computedStyleDiv.get('color').toString()");
shouldBe("computedStyleText.stroke", "computedStyleDiv.color"); shouldBe("computedStyleText.stroke", "computedStyleDiv.get('color').toString()");
} }
description('Test that fill and stroke properties accept system colors'); description('Test that fill and stroke properties accept system colors');
......
This is a testharness.js-based test. This is a testharness.js-based test.
PASS color-scheme property affects Menu system color keyword PASS color-scheme property affects Menu system color keyword
PASS System color computes to itself on color PASS System color computes to itself on color
FAIL Inherited system color keyword is observable on color assert_regexp_match: expected object "/menu/i" but got object "rgb(64, 64, 64)" PASS Inherited system color keyword is observable on color
PASS System color computes to itself on background-color PASS System color computes to itself on background-color
FAIL Inherited system color keyword is observable on background-color assert_regexp_match: expected object "/menu/i" but got object "rgb(64, 64, 64)" PASS Inherited system color keyword is observable on background-color
PASS System color computes to itself on box-shadow PASS System color computes to itself on box-shadow
FAIL Inherited system color keyword is observable on box-shadow assert_regexp_match: expected object "/menu/i" but got object "rgb(64, 64, 64) 2px 2px 0px 0px" PASS Inherited system color keyword is observable on box-shadow
PASS System color computes to itself on text-shadow PASS System color computes to itself on text-shadow
FAIL Inherited system color keyword is observable on text-shadow assert_regexp_match: expected object "/menu/i" but got object "rgb(64, 64, 64) 2px 2px 0px" PASS Inherited system color keyword is observable on text-shadow
PASS System color computes to itself on border-left-color PASS System color computes to itself on border-left-color
FAIL Inherited system color keyword is observable on border-left-color assert_regexp_match: expected object "/menu/i" but got object "rgb(64, 64, 64)" PASS Inherited system color keyword is observable on border-left-color
PASS System color computes to itself on border-top-color PASS System color computes to itself on border-top-color
FAIL Inherited system color keyword is observable on border-top-color assert_regexp_match: expected object "/menu/i" but got object "rgb(64, 64, 64)" PASS Inherited system color keyword is observable on border-top-color
PASS System color computes to itself on border-right-color PASS System color computes to itself on border-right-color
FAIL Inherited system color keyword is observable on border-right-color assert_regexp_match: expected object "/menu/i" but got object "rgb(64, 64, 64)" PASS Inherited system color keyword is observable on border-right-color
PASS System color computes to itself on border-bottom-color PASS System color computes to itself on border-bottom-color
FAIL Inherited system color keyword is observable on border-bottom-color assert_regexp_match: expected object "/menu/i" but got object "rgb(64, 64, 64)" PASS Inherited system color keyword is observable on border-bottom-color
PASS System color computes to itself on column-rule-color PASS System color computes to itself on column-rule-color
FAIL Inherited system color keyword is observable on column-rule-color assert_regexp_match: expected object "/menu/i" but got object "rgb(64, 64, 64)" PASS Inherited system color keyword is observable on column-rule-color
PASS System color computes to itself on outline-color PASS System color computes to itself on outline-color
FAIL Inherited system color keyword is observable on outline-color assert_regexp_match: expected object "/menu/i" but got object "rgb(64, 64, 64)" PASS Inherited system color keyword is observable on outline-color
PASS System color computes to itself on caret-color PASS System color computes to itself on caret-color
FAIL Inherited system color keyword is observable on caret-color assert_regexp_match: expected object "/menu/i" but got object "rgb(64, 64, 64)" PASS Inherited system color keyword is observable on caret-color
PASS System color computes to itself on fill PASS System color computes to itself on fill
FAIL Inherited system color keyword is observable on fill assert_regexp_match: expected object "/menu/i" but got object "rgb(64, 64, 64)" PASS Inherited system color keyword is observable on fill
PASS System color computes to itself on stroke PASS System color computes to itself on stroke
FAIL Inherited system color keyword is observable on stroke assert_regexp_match: expected object "/menu/i" but got object "rgb(64, 64, 64)" PASS Inherited system color keyword is observable on stroke
Harness: the test ran to completion. 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