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(
CSSValuePhase value_phase) {
// This function does NOT look at visited information, so that computed style
// doesn't expose that.
if (value_phase == CSSValuePhase::kComputedValue && color.IsSystemColor() &&
RuntimeEnabledFeatures::CSSSystemColorComputeToSelfEnabled()) {
return CSSIdentifierValue::Create(color.GetColorKeyword());
}
return cssvalue::CSSColorValue::Create(
color.Resolve(style.GetCurrentColor(), style.UsedColorScheme()).Rgb());
}
......
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)"
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
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
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
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
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
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
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
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
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
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
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
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
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.
......@@ -5,110 +5,110 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
Testing system colorActiveBorder
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorActiveCaption
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorActiveText
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorAppWorkspace
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorBackground
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorButtonFace
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorButtonHighlight
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorButtonShadow
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorButtonText
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorCanvas
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorCanvasText
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorCaptionText
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorField
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorFieldText
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorGrayText
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorHighlight
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorHighlightText
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorInactiveBorder
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorInactiveCaption
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorInactiveCaptionText
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorInfoBackground
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorInfoText
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorLinkText
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorMenu
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorMenuText
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorScrollbar
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorThreeDDarkShadow
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorThreeDFace
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorThreeDHighlight
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorThreeDLightShadow
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorThreeDShadow
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorVisitedText
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorWindow
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorWindowFrame
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
Testing system colorWindowText
PASS computedStyleText.fill is computedStyleDiv.color
PASS computedStyleText.stroke is computedStyleDiv.color
PASS computedStyleText.fill is computedStyleDiv.get('color').toString()
PASS computedStyleText.stroke is computedStyleDiv.get('color').toString()
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -14,11 +14,11 @@ function checkSystemColor(id1, id2, systemColor)
var textElement = document.getElementById(id1);
computedStyleText = textElement.ownerDocument.defaultView.getComputedStyle(textElement);
var divElement = document.getElementById(id2);
computedStyleDiv = divElement.ownerDocument.defaultView.getComputedStyle(divElement);
computedStyleDiv = divElement.computedStyleMap();
debug('Testing system color' + systemColor);
shouldBe("computedStyleText.fill", "computedStyleDiv.color");
shouldBe("computedStyleText.stroke", "computedStyleDiv.color");
shouldBe("computedStyleText.fill", "computedStyleDiv.get('color').toString()");
shouldBe("computedStyleText.stroke", "computedStyleDiv.get('color').toString()");
}
description('Test that fill and stroke properties accept system colors');
......
This is a testharness.js-based test.
PASS color-scheme property affects Menu system color keyword
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
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
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
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
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
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
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
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
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
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
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
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
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.
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