@@ -0,0 +1,93 @@
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
<title>Search Text 1</title>
</head>
<body id="body">

<p contenteditable="true" id="text">The quick brown fox <span id="target">jumps</span> over the lazy dog. </p>

<p contenteditable="true" id="text2">TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.</p>

<p id="description"></p>
<div id="console"></div>

<script>
description("This tests the ability to search for text given a starting point and a direction for the search.");

function selectElementText(element) {
var range = document.createRange();
range.selectNodeContents(element);

var selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
}

if (window.accessibilityController) {
var text = accessibilityController.accessibleElementById("text");
var result = 0;
var selection = 0;
var target = document.getElementById("target");

// Select target element.
selectElementText(target);

// Search for text after selection (single search string).
result = text.searchTextWithCriteria("lazy", "AXSearchTextStartFromSelection", "AXSearchTextDirectionForward");
shouldBe("result.length", "1");
shouldBe("text.stringForTextMarkerRange(result[0])", "'lazy'");

// Search for text before selection (single search string).
result = text.searchTextWithCriteria("quick", "AXSearchTextStartFromSelection", "AXSearchTextDirectionBackward");
shouldBe("result.length", "1");
shouldBe("text.stringForTextMarkerRange(result[0])", "'quick'");

// Search for text closest to selection (single search string).
result = text.searchTextWithCriteria("the", "AXSearchTextStartFromSelection", "AXSearchTextDirectionClosest");
shouldBe("result.length", "1");
shouldBe("text.stringForTextMarkerRange(result[0])", "'the'");

// Search from the beginning (single search string).
result = text.searchTextWithCriteria("the", "AXSearchTextStartFromBegin", "AXSearchTextDirectionClosest");
shouldBe("result.length", "1");
shouldBe("text.stringForTextMarkerRange(result[0])", "'The'");

// Search for all occurrences from the beginning of document (single search string).
var body = accessibilityController.rootElement.childAtIndex(0);
result = body.searchTextWithCriteria("dog", "AXSearchTextStartFromBegin", "AXSearchTextDirectionAll");
shouldBe("result.length", "3");
for (var i = 0; i < result.length; i++)
shouldBe("body.stringForTextMarkerRange(result[i])", "'dog'");

// Search for all occurrences from the end of document (single search string).
result = body.searchTextWithCriteria("fox", "AXSearchTextStartFromEnd", "AXSearchTextDirectionAll");
shouldBe("result.length", "3");
for (var i = 0; i < result.length; i++)
shouldBe("body.stringForTextMarkerRange(result[i])", "'fox'");

// Search for a non-present string (single search string).
result = body.searchTextWithCriteria("cat", "AXSearchTextStartFromBegin", "AXSearchTextDirectionAll");
shouldBe("typeof result", "'undefined'");

// Search for multiple strings after selection.
result = text.searchTextWithCriteria(["lazy", "over"], "AXSearchTextStartFromSelection", "AXSearchTextDirectionForward");
shouldBe("result.length", "1");
shouldBe("text.stringForTextMarkerRange(result[0])", "'over'");

// Search for multiple strings before selection.
result = text.searchTextWithCriteria(["quick", "fox"], "AXSearchTextStartFromSelection", "AXSearchTextDirectionBackward");
shouldBe("result.length", "1");
shouldBe("text.stringForTextMarkerRange(result[0])", "'fox'");

// Search for multiple strings closest to selection.
result = text.searchTextWithCriteria(["dog", "fox"], "AXSearchTextStartFromSelection", "AXSearchTextDirectionClosest");
shouldBe("result.length", "1");
shouldBe("text.stringForTextMarkerRange(result[0])", "'fox'");
}
</script>

<script src="../../../resources/js-test-post.js"></script>
</body>
</html>
@@ -1,26 +1,15 @@
This tests that selection changes as a result of advancing focus include AXTextSelectionChangedFocus flag.
This tests that selection changes as a result of advancing focus.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS webArea.addNotificationListener(notificationCallback) is true
eventSender.keyDown(tabCharacter);
Received AXSelectedTextChanged
PASS userInfo["AXTextSelectionChangedFocus"] is true
Received AXFocusChanged
Received AXSelectedTextChanged
PASS userInfo["AXTextSelectionChangedFocus"] is true

PASS accessibilityController.accessibleElementById("1").isFocusable is true
accessibilityController.accessibleElementById("1").takeFocus()
Received AXFocusChanged

eventSender.keyDown(tabCharacter)
Received AXSelectedTextChanged
PASS userInfo["AXTextSelectionChangedFocus"] is true
Received AXFocusChanged
Received AXSelectedTextChanged
PASS userInfo["AXTextSelectionChangedFocus"] is true
PASS successfullyParsed is true

TEST COMPLETE
@@ -15,56 +15,66 @@
</div>
</fieldset>
<script>
description("This tests that selection changes as a result of advancing focus include AXTextSelectionChangedFocus flag.");
description("This tests that selection changes as a result of advancing focus.");
jsTestIsAsync = true;

var webArea = 0;
var axTextFocusChangeOne = 0;
var axTextFocusChangeTwo = 0;
var axTextFocusChangeThree = 0;
var axTextFocusChangeFour = 0;
var tabCharacter = "\t";

function notificationCallback(notification, userInfo) {
if (notification == "AXSelectedTextChanged") {
debug("Received AXSelectedTextChanged");
window.userInfo = userInfo;
shouldBeTrue("userInfo[\"AXTextSelectionChangedFocus\"]");
} else if (notification == "AXFocusChanged")
debug("Received AXFocusChanged");
if (notification == "AXSelectedTextChanged" || notification == "AXFocusChanged")
window.promise.resolve();
}

function runTest() {
if (window.accessibilityController) {
testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1);

accessibilityController.enableEnhancedAccessibility(true);
webArea = accessibilityController.rootElement.childAtIndex(0);
webArea.setBoolAttributeValue("AXCaretBrowsingEnabled", true)

shouldBeTrue("webArea.addNotificationListener(notificationCallback)");
evalAndLog("eventSender.keyDown(tabCharacter);");
setTimeout(runTakeFocusTest, 0);
} else {
if (!window.accessibilityController) {
debug("window.accessibilityController is not present");
finishJSTest();
return;
}

runFirstTabMoveTest();
}

function runFirstTabMoveTest() {
testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1);

accessibilityController.enableEnhancedAccessibility(true);
webArea = accessibilityController.rootElement.childAtIndex(0);
webArea.setBoolAttributeValue("AXCaretBrowsingEnabled", true)

shouldBeTrue("webArea.addNotificationListener(notificationCallback)");
evalAndLog("eventSender.keyDown(tabCharacter);");

window.promise = new Promise(function(resolve, reject) {
setTimeout(() => {
runTakeFocusTest();
}, 0);
});
}

function runTakeFocusTest() {
debug('');
shouldBeTrue("accessibilityController.accessibleElementById(\"1\").isFocusable");
evalAndLog("accessibilityController.accessibleElementById(\"1\").takeFocus()");
setTimeout(runSecondTabMoveTest, 0);

window.promise = new Promise(function(resolve, reject) {
setTimeout(() => {
runSecondTabMoveTest();
}, 0);
});
}

function runSecondTabMoveTest() {
debug('');
evalAndLog("eventSender.keyDown(tabCharacter)");
setTimeout(() => {
webArea.removeNotificationListener();
finishJSTest();
}, 0);

window.promise = new Promise(function(resolve, reject) {
setTimeout(() => {
webArea.removeNotificationListener();
finishJSTest();
}, 0);
});
}

</script>
@@ -35,7 +35,7 @@
{
const WarmupFrames = 5;
if (++currentFrame > WarmupFrames && timestamp != timestamp1) {
testFailed("timestamp1 = " + timestamp1 + ", timestamp2 = " + timestamp2 + ", window.performance.now() = " + window.performance.now());
testFailed("timestamp = " + timestamp + ", timestamp1 = " + timestamp1 + ", window.performance.now() = " + window.performance.now());
failed = true;
}
}
@@ -1,2 +1,2 @@
Got iteration event.
PASS: saw two or fewer style recalcs during the animation.
PASS: saw three or fewer style recalcs during the animation.
@@ -35,10 +35,10 @@
box.addEventListener("animationiteration", () => result.innerText = "Got iteration event.\n");
box.addEventListener("animationend", () => {
const numRecalcs = internals.styleRecalcCount();
if (numRecalcs > 2)
result.innerText += "FAIL: saw " + numRecalcs + " style recalcs during the animation, should only see two."
if (numRecalcs > 3)
result.innerText += "FAIL: saw " + numRecalcs + " style recalcs during the animation, should only see three."
else
result.innerText += "PASS: saw two or fewer style recalcs during the animation."
result.innerText += "PASS: saw three or fewer style recalcs during the animation."

if (window.testRunner)
testRunner.notifyDone();
@@ -595,6 +595,6 @@ function runAnimationTest(expected, startCallback, event, disablePauseAnimationA
function waitForAnimationToStart(element, callback)
{
element.addEventListener('webkitAnimationStart', function() {
window.setTimeout(callback, 0); // delay to give hardware animations a chance to start
requestAnimationFrame(callback); // delay to give hardware animations a chance to start
}, false);
}
@@ -0,0 +1 @@
(display-mode) (display-mode: browser)
@@ -0,0 +1,32 @@
<!-- webkit-test-runner [ applicationManifest=resources/bad.manifest ] -->
<script>
if (window.testRunner)
testRunner.dumpAsText();
</script>
<style>
div { display: none; }
@media (display-mode) {
.display-mode-null { display: inline; }
}
@media (display-mode: browser) {
.display-mode-browser { display: inline; }
}
@media (display-mode: minimal-ui) {
.display-mode-minimal-ui { display: inline; }
}
@media (display-mode: standalone) {
.display-mode-standalone { display: inline; }
}
@media (display-mode: fullscreen) {
.display-mode-fullscreen { display: inline; }
}
@media (display-mode: invalid-value) {
.display-mode-invalid-value { display: inline; }
}
</style>
<div class="display-mode-null">(display-mode)</div>
<div class="display-mode-browser">(display-mode: browser)</div>
<div class="display-mode-minimal-ui">(display-mode: minimal-ui)</div>
<div class="display-mode-standalone">(display-mode: standalone)</div>
<div class="display-mode-fullscreen">(display-mode: fullscreen)</div>
<div class="display-mode-invalid-value">(display-mode: invalid-value)</div>
@@ -0,0 +1 @@
"\
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<style>
.stage {
margin: 20px;
width: 300px; height: 250px;
border: 2px solid black;
transform-style: preserve-3d;
}

.slide {
width: 100%;
height: 100%;
-webkit-backface-visibility: hidden;
background-color: blue;
transform: translateX(0px);
}
</style>
</head>
<body>
<div class="stage">
<div id="target" class="slide" onanimationend="animationEnded()"></div>
</div>
</body>
</html>
@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<style>
.stage {
margin: 20px;
width: 300px; height: 250px;
border: 2px solid black;
transform-style: preserve-3d;
}

.slide {
width: 100%;
height: 100%;
animation-duration: 20ms;
animation-fill-mode: forwards;
-webkit-backface-visibility: hidden;
background-color: blue;
}

.animating {
animation-name: slide;
}

@keyframes slide {
0% { transform-origin: 50% 50%; transform: translateX(400px); }
50% { transform-origin: 50% 50%; transform: translateX(0px); }
100% { transform-origin: 50% 50%; transform: translateX(0px); }
}
</style>
<script>
if (window.testRunner)
testRunner.waitUntilDone();

function animationEnded()
{
if (window.testRunner)
testRunner.notifyDone();
}

window.addEventListener('load', () => {
document.getElementById('target').classList.add('animating');
}, false);
</script>
</head>
<body>
<div class="stage">
<div id="target" class="slide" onanimationend="animationEnded()"></div>
</div>
</body>
</html>
@@ -20,6 +20,7 @@
(contentsOpaque 1)
(drawsContent 1)
(backingStoreAttached 1)
(transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [-520.00 0.00 0.00 1.00])
)
)
)
@@ -52,6 +52,7 @@
to { -webkit-transform: translateX(100px); }
}
</style>
<script src="resources/compositing-overlap-utils.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
@@ -61,17 +62,10 @@
function runTest()
{
var box = document.getElementById('to-animate');
box.addEventListener('webkitAnimationStart', animationStarted, false);
box.addEventListener('webkitAnimationStart', dumpLayers, false);
box.classList.add('animating');
}

function animationStarted()
{
if (window.testRunner) {
document.getElementById('layers').innerText = window.internals.layerTreeAsText(document);
testRunner.notifyDone();
}
}
window.addEventListener('load', runTest, false);
</script>
</head>
@@ -12,7 +12,6 @@
(anchor 0.74 0.27)
(bounds 148.00 128.00)
(drawsContent 1)
(transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [10.00 0.00 0.00 1.00])
)
(GraphicsLayer
(bounds 4.00 4.00)
@@ -37,44 +37,24 @@
}
}
</style>
<script src="resources/compositing-overlap-utils.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}

function dumpLayers()
function runTest()
{
if (window.testRunner) {
document.getElementById('layers').innerText = window.internals.layerTreeAsText(document);
testRunner.notifyDone();
}
}

function makeDots()
{
const width = 30;
const height = 30;

const spacing = 10;

for (var row = 0; row < height; ++row) {
for (var col = 0; col < width; ++col) {
var dot = document.createElement('div');
dot.className = 'dot';
dot.style.left = spacing * col + 'px';
dot.style.top = spacing * row + 'px';
document.body.appendChild(dot);
}
}
makeDots(30, 30);

window.setTimeout(function() {
document.getElementById('target').addEventListener('animationstart', dumpLayers, false);
document.body.classList.add('changed');
}, 0);
}

window.addEventListener('load', makeDots, false);
window.addEventListener('load', runTest, false);
</script>
</head>
<body>
@@ -28,44 +28,24 @@
-webkit-transform: scale(1.3) rotate(1deg);
}
</style>
<script src="resources/compositing-overlap-utils.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}

function dumpLayers()
function runTest()
{
if (window.testRunner) {
document.getElementById('layers').innerText = window.internals.layerTreeAsText(document);
testRunner.notifyDone();
}
}

function makeDots()
{
const width = 30;
const height = 30;

const spacing = 10;

for (var row = 0; row < height; ++row) {
for (var col = 0; col < width; ++col) {
var dot = document.createElement('div');
dot.className = 'dot';
dot.style.left = spacing * col + 'px';
dot.style.top = spacing * row + 'px';
document.body.appendChild(dot);
}
}
makeDots(30, 30);

window.setTimeout(function() {
document.body.classList.add('changed');
window.setTimeout(dumpLayers, 0);
}, 0);
}

window.addEventListener('load', makeDots, false);
window.addEventListener('load', runTest, false);
</script>
</head>
<body>
@@ -28,44 +28,24 @@
-webkit-transform: scale(1.3);
}
</style>
<script src="resources/compositing-overlap-utils.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}

function dumpLayers()
function runTest()
{
if (window.testRunner) {
document.getElementById('layers').innerText = window.internals.layerTreeAsText(document);
testRunner.notifyDone();
}
}

function makeDots()
{
const width = 30;
const height = 30;

const spacing = 10;

for (var row = 0; row < height; ++row) {
for (var col = 0; col < width; ++col) {
var dot = document.createElement('div');
dot.className = 'dot';
dot.style.left = spacing * col + 'px';
dot.style.top = spacing * row + 'px';
document.body.appendChild(dot);
}
}
makeDots(30, 30);

window.setTimeout(function() {
document.body.classList.add('changed');
window.setTimeout(dumpLayers, 0);
}, 0);
}

window.addEventListener('load', makeDots, false);
window.addEventListener('load', runTest, false);
</script>
</head>
<body>
@@ -12,7 +12,6 @@
(anchor 0.06 0.89)
(bounds 228.00 128.00)
(drawsContent 1)
(transform [1.00 -0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [10.00 0.00 0.00 1.00])
)
(GraphicsLayer
(position 20.00 30.00)
@@ -45,44 +45,24 @@
}
}
</style>
<script src="resources/compositing-overlap-utils.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}

function dumpLayers()
function runTest()
{
if (window.testRunner) {
document.getElementById('layers').innerText = window.internals.layerTreeAsText(document);
testRunner.notifyDone();
}
}

function makeDots()
{
const width = 50;
const height = 23;

const spacing = 10;

for (var row = 0; row < height; ++row) {
for (var col = 0; col < width; ++col) {
var dot = document.createElement('div');
dot.className = 'dot';
dot.style.left = spacing * col + 'px';
dot.style.top = spacing * row + 'px';
document.body.appendChild(dot);
}
}
makeDots(50, 23);

window.setTimeout(function() {
document.getElementById('target').addEventListener('animationstart', dumpLayers, false);
document.body.classList.add('changed');
}, 0);
}

window.addEventListener('load', makeDots, false);
window.addEventListener('load', runTest, false);
</script>
</head>
<body>
@@ -25,7 +25,7 @@
}

.sticky {
position: -webkit-sticky;
position: sticky;
display: inline-block;
background: silver;
margin: 4px;
@@ -0,0 +1,27 @@
function makeDots(width, height, spacing = 10)
{
for (var row = 0; row < height; ++row) {
for (var col = 0; col < width; ++col) {
var dot = document.createElement('div');
dot.className = 'dot';
dot.style.left = spacing * col + 'px';
dot.style.top = spacing * row + 'px';
document.body.appendChild(dot);
}
}
}

function layerTreeWithoutTransforms()
{
var layerTreeText = internals.layerTreeAsText(document);
var filteredLines = layerTreeText.split("\n").filter(line => line.indexOf('transform') == -1);
return filteredLines.join('\n');
}

function dumpLayers()
{
if (window.testRunner) {
document.getElementById('layers').innerText = layerTreeWithoutTransforms();
testRunner.notifyDone();
}
}
@@ -12,7 +12,6 @@
(anchor 0.74 0.27)
(bounds 148.00 128.00)
(drawsContent 1)
(transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [10.00 0.00 0.00 1.00])
)
(GraphicsLayer
(position 30.00 20.00)
@@ -45,44 +45,24 @@
}
}
</style>
<script src="resources/compositing-overlap-utils.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}

function dumpLayers()
function runTest()
{
if (window.testRunner) {
document.getElementById('layers').innerText = window.internals.layerTreeAsText(document);
testRunner.notifyDone();
}
}

function makeDots()
{
const width = 60;
const height = 60;

const spacing = 10;

for (var row = 0; row < height; ++row) {
for (var col = 0; col < width; ++col) {
var dot = document.createElement('div');
dot.className = 'dot';
dot.style.left = spacing * col + 'px';
dot.style.top = spacing * row + 'px';
document.body.appendChild(dot);
}
}
makeDots(60, 60);

window.setTimeout(function() {
document.getElementById('target').addEventListener('animationstart', dumpLayers, false);
document.body.classList.add('changed');
}, 0);
}

window.addEventListener('load', makeDots, false);
window.addEventListener('load', runTest, false);
</script>
</head>
<body>
@@ -27,6 +27,7 @@
-webkit-transform: scale(1.3) rotate(45deg);
}
</style>
<script src="resources/compositing-overlap-utils.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
@@ -41,30 +42,17 @@
}
}

function makeDots()
function runTest()
{
const width = 42;
const height = 42;

const spacing = 10;

for (var row = 0; row < height; ++row) {
for (var col = 0; col < width; ++col) {
var dot = document.createElement('div');
dot.className = 'dot';
dot.style.left = spacing * col + 'px';
dot.style.top = spacing * row + 'px';
document.body.appendChild(dot);
}
}
makeDots(42, 42);

window.setTimeout(function() {
document.body.classList.add('changed');
window.setTimeout(dumpLayers, 0);
}, 0);
}

window.addEventListener('load', makeDots, false);
window.addEventListener('load', runTest, false);
</script>
</head>
<body>
@@ -11,7 +11,6 @@
(position 24.00 38.00)
(bounds 228.00 128.00)
(drawsContent 1)
(transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [10.00 0.00 0.00 1.00])
)
(GraphicsLayer
(position 30.00 40.00)
@@ -34,44 +34,24 @@
}
}
</style>
<script src="resources/compositing-overlap-utils.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}

function dumpLayers()
function runTest()
{
if (window.testRunner) {
document.getElementById('layers').innerText = window.internals.layerTreeAsText(document);
testRunner.notifyDone();
}
}

function makeDots()
{
const width = 40;
const height = 20;

const spacing = 10;

for (var row = 0; row < height; ++row) {
for (var col = 0; col < width; ++col) {
var dot = document.createElement('div');
dot.className = 'dot';
dot.style.left = spacing * col + 'px';
dot.style.top = spacing * row + 'px';
document.body.appendChild(dot);
}
}
makeDots(40, 20);

window.setTimeout(function() {
document.getElementById('target').addEventListener('animationstart', dumpLayers, false);
document.body.classList.add('changed');
}, 0);
}

window.addEventListener('load', makeDots, false);
window.addEventListener('load', runTest, false);
</script>
</head>
<body>
@@ -12,7 +12,6 @@
(anchor 0.11 0.89)
(bounds 228.00 128.00)
(drawsContent 1)
(transform [1.00 -0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [10.00 0.00 0.00 1.00])
)
(GraphicsLayer
(position 30.00 30.00)
@@ -36,44 +36,24 @@
}
}
</style>
<script src="resources/compositing-overlap-utils.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}

function dumpLayers()
function runTest()
{
if (window.testRunner) {
document.getElementById('layers').innerText = window.internals.layerTreeAsText(document);
testRunner.notifyDone();
}
}

function makeDots()
{
const width = 50;
const height = 23;

const spacing = 10;

for (var row = 0; row < height; ++row) {
for (var col = 0; col < width; ++col) {
var dot = document.createElement('div');
dot.className = 'dot';
dot.style.left = spacing * col + 'px';
dot.style.top = spacing * row + 'px';
document.body.appendChild(dot);
}
}
makeDots(50, 23);

window.setTimeout(function() {
document.getElementById('target').addEventListener('animationstart', dumpLayers, false);
document.body.classList.add('changed');
}, 0);
}

window.addEventListener('load', makeDots, false);
window.addEventListener('load', runTest, false);
</script>
</head>
<body>
@@ -27,6 +27,7 @@
-webkit-transform: translateX(100px) scale(1.3);
}
</style>
<script src="resources/compositing-overlap-utils.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
@@ -41,30 +42,17 @@
}
}

function makeDots()
function runTest()
{
const width = 50;
const height = 23;

const spacing = 10;

for (var row = 0; row < height; ++row) {
for (var col = 0; col < width; ++col) {
var dot = document.createElement('div');
dot.className = 'dot';
dot.style.left = spacing * col + 'px';
dot.style.top = spacing * row + 'px';
document.body.appendChild(dot);
}
}
makeDots(50, 23);

window.setTimeout(function() {
document.body.classList.add('changed');
window.setTimeout(dumpLayers, 0);
}, 0);
}

window.addEventListener('load', makeDots, false);
window.addEventListener('load', runTest, false);
</script>
</head>
<body>
@@ -27,44 +27,24 @@
-webkit-transform: translateX(100px);
}
</style>
<script src="resources/compositing-overlap-utils.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}

function dumpLayers()
function runTest()
{
if (window.testRunner) {
document.getElementById('layers').innerText = window.internals.layerTreeAsText(document);
testRunner.notifyDone();
}
}

function makeDots()
{
const width = 40;
const height = 20;

const spacing = 10;

for (var row = 0; row < height; ++row) {
for (var col = 0; col < width; ++col) {
var dot = document.createElement('div');
dot.className = 'dot';
dot.style.left = spacing * col + 'px';
dot.style.top = spacing * row + 'px';
document.body.appendChild(dot);
}
}
makeDots(40, 20);

window.setTimeout(function() {
document.body.classList.add('changed');
window.setTimeout(dumpLayers, 0);
}, 0);
}

window.addEventListener('load', makeDots, false);
window.addEventListener('load', runTest, false);
</script>
</head>
<body>
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<style>
.container {
margin: 50px;
height: 300px;
width: 300px;
border: 1px solid black;
perspective: 500px;
}

.transformed {
width: 100%;
height: 100%;
background-color: blue;
transform: rotateY(145deg);
-webkit-backface-visibility: visible;
}
</style>
</head>
<body>
<div class="container">
<div class="transformed"></div>
</div>
</body>
</html>
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<style>
.container {
margin: 50px;
height: 300px;
width: 300px;
border: 1px solid black;
perspective: 500px;
}

.transformed {
width: 100%;
height: 100%;
background-color: blue;
transform: rotateY(145deg);
-webkit-backface-visibility: hidden;
}

.transformed.changed {
-webkit-backface-visibility: visible;
}
</style>
<script>
if (window.testRunner)
testRunner.waitUntilDone();

window.addEventListener('load', () => {
setTimeout(() => {
document.querySelector('.transformed').classList.add('changed');
if (window.testRunner)
testRunner.notifyDone();
}, 1000);

}, false);
</script>
</head>
<body>
<div class="container">
<div class="transformed"></div>
</div>
</body>
</html>
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<style>
.container {
margin: 50px;
height: 300px;
width: 300px;
border: 1px solid black;
}

.clipped {
width: 100%;
height: 100%;
background-color: blue;
transform: translateZ(0);
-webkit-clip-path: circle(50% at center);
}
</style>
</head>
<body>
<div class="container">
<div class="clipped"></div>
</div>
</body>
</html>
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<style>
.container {
margin: 50px;
height: 300px;
width: 300px;
border: 1px solid black;
}

.clipped {
width: 100%;
height: 100%;
background-color: blue;
transform: translateZ(0);
-webkit-clip-path: circle(10% at center);
}

.clipped.changed {
-webkit-clip-path: circle(50% at center);
}
</style>
<script>
if (window.testRunner)
testRunner.waitUntilDone();

window.addEventListener('load', () => {
setTimeout(() => {
document.querySelector('.clipped').classList.add('changed');
if (window.testRunner)
testRunner.notifyDone();
}, 0);
}, false);
</script>
</head>
<body>
<div class="container">
<div class="clipped"></div>
</div>
</body>
</html>
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<style>
.container {
margin: 50px;
height: 300px;
width: 300px;
border: 1px solid black;
perspective: 1500px;
}

.transformed {
width: 100%;
height: 100%;
transform: rotateY(45deg);
background-color: blue;
}
</style>
</head>
<body>
<div class="container">
<div class="transformed"></div>
</div>
</body>
</html>
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<head>
<style>
.container {
margin: 50px;
height: 300px;
width: 300px;
border: 1px solid black;
perspective: 500px;
}

.container.changed {
perspective: 1500px;
}

.transformed {
width: 100%;
height: 100%;
transform: rotateY(45deg);
background-color: blue;
}

.transformed:hover {
transform-origin: top left;
background-color: orange;
}
</style>
<script>
if (window.testRunner)
testRunner.waitUntilDone();

window.addEventListener('load', () => {
setTimeout(() => {
document.querySelector('.container').classList.add('changed');
if (window.testRunner)
testRunner.notifyDone();
}, 0);

}, false);
</script>
</head>
<body>
<div class="container">
<div class="transformed"></div>
</div>
</body>
</html>
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<style>
.container {
margin: 50px;
height: 300px;
width: 300px;
border: 1px solid black;
perspective: 500px;
perspective-origin: top left;
}

.transformed {
width: 100%;
height: 100%;
transform: rotateY(45deg);
background-color: blue;
}
</style>
</head>
<body>
<div class="container">
<div class="transformed"></div>
</div>
</body>
</html>
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<style>
.container {
margin: 50px;
height: 300px;
width: 300px;
border: 1px solid black;
perspective: 500px;
}

.container.changed {
perspective-origin: top left;
}

.transformed {
width: 100%;
height: 100%;
transform: rotateY(45deg);
background-color: blue;
}
</style>
<script>
if (window.testRunner)
testRunner.waitUntilDone();

window.addEventListener('load', () => {
setTimeout(() => {
document.querySelector('.container').classList.add('changed');
if (window.testRunner)
testRunner.notifyDone();
}, 0);

}, false);
</script>
</head>
<body>
<div class="container">
<div class="transformed"></div>
</div>
</body>
</html>
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<style>
.container {
margin: 50px;
height: 300px;
width: 300px;
border: 1px solid black;
}

.transformed {
width: 100%;
height: 100%;
background-color: blue;
transform: rotateY(45deg);
transform-origin: top left;
}
</style>
</head>
<body>
<div class="container">
<div class="transformed"></div>
</div>
</body>
</html>
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<style>
.container {
margin: 50px;
height: 300px;
width: 300px;
border: 1px solid black;
}

.transformed {
width: 100%;
height: 100%;
background-color: blue;
transform: rotateY(45deg);
}

.transformed.changed {
transform-origin: top left;
}
</style>
<script>
if (window.testRunner)
testRunner.waitUntilDone();

window.addEventListener('load', () => {
setTimeout(() => {
document.querySelector('.transformed').classList.add('changed');
if (window.testRunner)
testRunner.notifyDone();
}, 0);

}, false);
</script>
</head>
<body>
<div class="container">
<div class="transformed"></div>
</div>
</body>
</html>
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<style>
.container {
margin: 50px;
height: 300px;
width: 300px;
border: 1px solid black;
perspective: 500px;
}

.intermediate {
width: 100%;
height: 100%;
transform: translateX(0);
transform-style: preserve-3d;
}

.transformed {
width: 100%;
height: 100%;
background-color: blue;
transform: rotateY(45deg);
}
</style>
</head>
<body>
<div class="container">
<div class="intermediate">
<div class="transformed"></div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html>
<head>
<style>
.container {
margin: 50px;
height: 300px;
width: 300px;
border: 1px solid black;
perspective: 500px;
}

.intermediate {
width: 100%;
height: 100%;
transform: translateX(0);
transform-style: flat;
}

.intermediate.changed {
transform-style: preserve-3d;
}

.transformed {
width: 100%;
height: 100%;
background-color: blue;
transform: rotateY(45deg);
}
</style>
<script>
if (window.testRunner)
testRunner.waitUntilDone();

window.addEventListener('load', () => {
setTimeout(() => {
document.querySelector('.intermediate').classList.add('changed');
if (window.testRunner)
testRunner.notifyDone();
}, 0);

}, false);
</script>
</head>
<body>
<div class="container">
<div class="intermediate">
<div class="transformed"></div>
</div>
</div>
</body>
</html>
@@ -37,7 +37,7 @@

function endTest() {
if (window.testRunner)
setTimeout(function() { testRunner.notifyDone(); }, 150);
setTimeout(function() { testRunner.notifyDone(); }, 250);
}
</script>
<style>
@@ -0,0 +1,28 @@

PASS Element colors are correct in light color scheme with only light supported color scheme
PASS Dark color scheme enabled
PASS Element colors are correct in dark color scheme with only light supported color scheme
PASS Light color scheme enabled
PASS Color schemes changed to light and dark
PASS Element colors are correct in light color scheme with light and dark supported color scheme
PASS Dark color scheme enabled
PASS Element colors are correct in dark color scheme with light and dark supported color scheme
PASS Light color scheme enabled
PASS Color schemes changed to dark
PASS Element colors are correct in light color scheme with only dark supported color scheme
PASS Dark color scheme enabled
PASS Element colors are correct in dark color scheme with only dark supported color scheme
PASS Color schemes changed to light and a bogus value
PASS Element colors are correct in dark color scheme with only light supported color scheme
PASS Color schemes changed to auto value
PASS Element colors are correct in dark color scheme with implicit light supported color scheme
PASS Color schemes changed to light and dark via <meta> element
PASS Element colors are correct in dark color scheme with light and dark supported color scheme via <meta> element
PASS Color schemes changed to light value
PASS Element colors are correct in dark color scheme with explicit light, overriding <meta> element
PASS Remove test meta element
PASS Color schemes changed to light and dark
PASS Element colors are correct in dark color scheme with light and dark supported color scheme
PASS Color schemes changed to a bogus value and dark
PASS Element colors are correct in dark color scheme with dark supported color scheme

File renamed without changes.
@@ -0,0 +1,128 @@
<!DOCTYPE html>

<!-- webkit-test-runner [ experimental:DarkModeCSSEnabled=true ] -->

<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>

<style>
#testAuto {
color-scheme: auto;
}

#testOnly {
color-scheme: only;
}

#testLight {
color-scheme: light;
}

#testDark {
color-scheme: dark;
}

#testLightDark {
color-scheme: light dark;
}

#testDarkLight {
color-scheme: dark light;
}

#testLightDarkOnly {
color-scheme: light dark only;
}

#testOnlyDark {
color-scheme: only dark;
}

#testLightOnlyDark {
color-scheme: light only dark;
}

#testLightUnknown {
color-scheme: light foo;
}

#testUnknownDarkOnly {
color-scheme: bar dark only;
}

#testLightUnknownOnly {
color-scheme: light baz only;
}

#testInvalidLightAuto {
color-scheme: light auto;
}

#testInvalidAutoDark {
color-scheme: auto dark;
}

#testInvalidLightDarkLight {
color-scheme: light dark light;
}

#testInvalidNumber {
color-scheme: 42;
}

#testInvalidString {
color-scheme: "foo";
}

#testInvalidLightString {
color-scheme: light "foo";
}
</style>

<div id="testAuto"></div>
<div id="testOnly"></div>
<div id="testLight"></div>
<div id="testDark"></div>
<div id="testLightDark"></div>
<div id="testDarkLight"></div>
<div id="testLightDarkOnly"></div>
<div id="testOnlyDark"></div>
<div id="testLightOnlyDark"></div>
<div id="testLightUnknown"></div>
<div id="testUnknownDarkOnly"></div>

<div id="testInvalidLightAuto"></div>
<div id="testInvalidAutoDark"></div>
<div id="testInvalidLightDarkLight"></div>
<div id="testInvalidNumber"></div>
<div id="testInvalidString"></div>
<div id="testInvalidLightString"></div>

<script>
function test_prop(id, property, expected) {
assert_equals(window.getComputedStyle(document.getElementById(id)).getPropertyValue(property), expected);
}

test(function() {
test_prop("testAuto", "color-scheme", "auto");
test_prop("testOnly", "color-scheme", "light only");
test_prop("testLight", "color-scheme", "light");
test_prop("testDark", "color-scheme", "dark");
test_prop("testLightDark", "color-scheme", "light dark");
test_prop("testDarkLight", "color-scheme", "light dark");
test_prop("testLightDarkOnly", "color-scheme", "light dark only");
test_prop("testOnlyDark", "color-scheme", "dark only");
test_prop("testLightOnlyDark", "color-scheme", "light dark only");
test_prop("testLightUnknown", "color-scheme", "light");
test_prop("testUnknownDarkOnly", "color-scheme", "dark only");
}, "Test valid values");

test(function() {
test_prop("testInvalidLightAuto", "color-scheme", "auto");
test_prop("testInvalidAutoDark", "color-scheme", "auto");
test_prop("testInvalidLightDarkLight", "color-scheme", "auto");
test_prop("testInvalidNumber", "color-scheme", "auto");
test_prop("testInvalidString", "color-scheme", "auto");
test_prop("testInvalidLightString", "color-scheme", "auto");
}, "Test invalid values");
</script>
@@ -0,0 +1,160 @@
<!DOCTYPE html>

<!-- webkit-test-runner [ experimental:DarkModeCSSEnabled=true ] -->

<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>

<style>
#test1 {
color: text;
}
</style>

<div id="test1"></div>

<script>
function test_prop(element, prop, expected) {
assert_equals(window.getComputedStyle(element).getPropertyValue(prop), expected);
}

function test_color_is_white(id) {
test_prop(document.getElementById("test1"), "color", "rgb(255, 255, 255)");
}

function test_color_is_black(id) {
test_prop(document.getElementById("test1"), "color", "rgb(0, 0, 0)");
}

test(function() {
// The semantic text color should be black.
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with only light supported color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(true);
}, "Dark color scheme enabled");

test(function() {
// The semantic text color should be black, and not change.
test_color_is_black("test1");
}, "Element colors are correct in dark color scheme with only light supported color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(false);
}, "Light color scheme enabled");

test(function() {
document.body.style.setProperty("color-scheme", "light dark");
test_prop(document.body, "color-scheme", "light dark");
}, "Color schemes changed to light and dark");

test(function() {
// The semantic text color should be black.
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with light and dark supported color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(true);
}, "Dark color scheme enabled");

test(function() {
// The semantic text color should be white.
test_color_is_white("test1");
}, "Element colors are correct in dark color scheme with light and dark supported color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(false);
}, "Light color scheme enabled");

test(function() {
document.body.style.setProperty("color-scheme", "dark");
test_prop(document.body, "color-scheme", "dark");
}, "Color schemes changed to dark");

test(function() {
// The semantic text color should be white.
test_color_is_white("test1");
}, "Element colors are correct in light color scheme with only dark supported color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(true);
}, "Dark color scheme enabled");

test(function() {
// The semantic text color should be white still.
test_color_is_white("test1");
}, "Element colors are correct in dark color scheme with only dark supported color scheme");

test(function() {
document.body.style.setProperty("color-scheme", "light foo");
test_prop(document.body, "color-scheme", "light");
}, "Color schemes changed to light and a bogus value");

test(function() {
// The semantic text color should be black again.
test_color_is_black("test1");
}, "Element colors are correct in dark color scheme with only light supported color scheme");

test(function() {
document.body.style.setProperty("color-scheme", "auto");
test_prop(document.body, "color-scheme", "auto");
}, "Color schemes changed to auto value");

test(function() {
// The semantic text color should be black still.
test_color_is_black("test1");
}, "Element colors are correct in dark color scheme with implicit light supported color scheme");

test(function() {
let meta = document.createElement("meta");
meta.id = "test-meta";
meta.name = "color-scheme";
meta.content = "light dark";
document.head.appendChild(meta);
}, "Color schemes changed to light and dark via <meta> element");

test(function() {
// The semantic text color should be white now.
test_color_is_white("test1");
}, "Element colors are correct in dark color scheme with light and dark supported color scheme via <meta> element");

test(function() {
document.body.style.setProperty("color-scheme", "light");
test_prop(document.body, "color-scheme", "light");
}, "Color schemes changed to light value");

test(function() {
// The semantic text color should be black again.
test_color_is_black("test1");
}, "Element colors are correct in dark color scheme with explicit light, overriding <meta> element");

test(function() {
document.getElementById("test-meta").remove();
}, "Remove test meta element");

test(function() {
document.body.style.setProperty("color-scheme", "light dark");
test_prop(document.body, "color-scheme", "light dark");
}, "Color schemes changed to light and dark");

test(function() {
// The semantic text color should be white now.
test_color_is_white("test1");
}, "Element colors are correct in dark color scheme with light and dark supported color scheme");

test(function() {
document.body.style.setProperty("color-scheme", "foo dark");
test_prop(document.body, "color-scheme", "dark");
}, "Color schemes changed to a bogus value and dark");

test(function() {
// The semantic text color should be white still.
test_color_is_white("test1");
}, "Element colors are correct in dark color scheme with dark supported color scheme");
</script>
@@ -0,0 +1,25 @@

PASS Element colors are correct in light color scheme with only light color scheme
PASS Dark color scheme enabled
PASS Element colors are correct in dark color scheme with only light color scheme
PASS Light color scheme enabled
PASS Color schemes changed to light and dark
PASS Element colors are correct in light color scheme with light and dark color scheme
PASS Dark color scheme enabled
PASS Element colors are correct in dark color scheme with light and dark color scheme
PASS Light color scheme enabled
PASS Color schemes changed to dark
PASS Element colors are correct in light color scheme with only dark color scheme
PASS Dark color scheme enabled
PASS Element colors are correct in dark color scheme with only dark color scheme
PASS Color schemes changed to light and a bogus value
PASS Element colors are correct in dark color scheme with only light color scheme
PASS Color schemes changed to empty value
PASS Element colors are correct in dark color scheme with implicit light color scheme
PASS Color schemes changed to light,dark
PASS Element colors are in light color scheme since comma is not an allowed seperator
PASS Color schemes changed to foo\vdark
PASS Element colors are in light color scheme since vertical tab is not an allowed seperator
PASS Color schemes changed to a bogus value and dark
PASS Element colors are correct in dark color scheme with dark color scheme

@@ -0,0 +1,138 @@
<!DOCTYPE html>

<!-- webkit-test-runner [ experimental:DarkModeCSSEnabled=true ] -->

<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>

<style>
#test1 {
color: text;
}
</style>

<meta id="meta" name="color-scheme" content="light">

<div id="test1"></div>

<script>
function test_prop(id, prop, expected) {
assert_equals(window.getComputedStyle(document.getElementById(id)).getPropertyValue(prop).trim(), expected);
}

function test_color_is_white(id) {
test_prop("test1", "color", "rgb(255, 255, 255)");
}

function test_color_is_black(id) {
test_prop("test1", "color", "rgb(0, 0, 0)");
}

test(function() {
// The semantic text color should be black.
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with only light color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(true);
}, "Dark color scheme enabled");

test(function() {
// The semantic text color should be black, and not change.
test_color_is_black("test1");
}, "Element colors are correct in dark color scheme with only light color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(false);
}, "Light color scheme enabled");

test(function() {
document.getElementById("meta").content = "light dark";
}, "Color schemes changed to light and dark");

test(function() {
// The semantic text color should be black.
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with light and dark color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(true);
}, "Dark color scheme enabled");

test(function() {
// The semantic text color should be white.
test_color_is_white("test1");
}, "Element colors are correct in dark color scheme with light and dark color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(false);
}, "Light color scheme enabled");

test(function() {
document.getElementById("meta").content = "dark";
}, "Color schemes changed to dark");

test(function() {
// The semantic text color should be white.
test_color_is_white("test1");
}, "Element colors are correct in light color scheme with only dark color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(true);
}, "Dark color scheme enabled");

test(function() {
// The semantic text color should be white still.
test_color_is_white("test1");
}, "Element colors are correct in dark color scheme with only dark color scheme");

test(function() {
document.getElementById("meta").content = "\tlight foo ";
}, "Color schemes changed to light and a bogus value");

test(function() {
// The semantic text color should be black again.
test_color_is_black("test1");
}, "Element colors are correct in dark color scheme with only light color scheme");

test(function() {
document.getElementById("meta").content = "";
}, "Color schemes changed to empty value");

test(function() {
// The semantic text color should be black still.
test_color_is_black("test1");
}, "Element colors are correct in dark color scheme with implicit light color scheme");

test(function() {
document.getElementById("meta").content = " light,dark ";
}, "Color schemes changed to light,dark");

test(function() {
// The semantic text color should be black now.
test_color_is_black("test1");
}, "Element colors are in light color scheme since comma is not an allowed seperator");

test(function() {
document.getElementById("meta").content = "foo\vdark ";
}, "Color schemes changed to foo\\vdark");

test(function() {
// The semantic text color should be black still.
test_color_is_black("test1");
}, "Element colors are in light color scheme since vertical tab is not an allowed seperator");

test(function() {
document.getElementById("meta").content = " foo\ndark";
}, "Color schemes changed to a bogus value and dark");

test(function() {
// The semantic text color should be white still.
test_color_is_white("test1");
}, "Element colors are correct in dark color scheme with dark color scheme");
</script>
@@ -0,0 +1,5 @@

PASS Element colors are correct in light color scheme with light and dark color scheme
PASS Dark color scheme enabled
PASS Element colors are correct in dark color scheme with light and dark color scheme

@@ -0,0 +1,44 @@
<!DOCTYPE html>

<!-- webkit-test-runner [ experimental:DarkModeCSSEnabled=true ] -->

<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>

<style>
#test1 {
color-scheme: light dark;
color: text;
}
</style>

<div id="test1"></div>

<script>
function test_prop(id, prop, expected) {
assert_equals(window.getComputedStyle(document.getElementById(id)).getPropertyValue(prop), expected);
}

function test_color_is_white(id) {
test_prop("test1", "color", "rgb(255, 255, 255)");
}

function test_color_is_black(id) {
test_prop("test1", "color", "rgb(0, 0, 0)");
}

test(function() {
// The semantic text color should be black.
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with light and dark color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(true);
}, "Dark color scheme enabled");

test(function() {
// The semantic text color should be white.
test_color_is_white("test1");
}, "Element colors are correct in dark color scheme with light and dark color scheme");
</script>
@@ -0,0 +1,17 @@

PASS Set dark appearance
PASS Set view to transparent
PASS Body Element color scheme is light and dark
PASS Document Element color scheme is auto
PASS Document scrollbar overlay style is light
PASS Document scrollbar is using dark appearance
PASS Element scrollbar overlay style is default
PASS Element scrollbar is using dark appearance
PASS Set color scheme to light on the document element
PASS Body Element color scheme is light and dark
PASS Document Element color scheme is light
PASS Document scrollbar overlay style is default
PASS Document scrollbar is using light appearance
PASS Element scrollbar overlay style is default
PASS Element scrollbar is using dark appearance

@@ -0,0 +1,114 @@
<!DOCTYPE html>

<!-- webkit-test-runner [ experimental:DarkModeCSSEnabled=true ] -->

<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>

<style>
body {
color-scheme: light dark;
}

#test {
overflow-x: hidden;
overflow-y: scroll;
width: 100px;
height: 50px;
}

#test-content {
width: 100px;
height: 100px;
}
</style>

<body><div id="test"><div id="test-content"></div></div></body>

<script>
function test_prop(element, prop, expected) {
assert_equals(window.getComputedStyle(element).getPropertyValue(prop), expected);
}

test(function() {
if (!window.internals)
return;
internals.settings.setUseDarkAppearance(true);
}, "Set dark appearance");

test(function() {
if (!window.internals)
return;
internals.setViewIsTransparent(true);
}, "Set view to transparent");

test(function() {
test_prop(document.body, "color-scheme", "light dark");
}, "Body Element color scheme is light and dark");

test(function() {
test_prop(document.documentElement, "color-scheme", "auto");
}, "Document Element color scheme is auto");

test(function() {
if (!window.internals)
return;
assert_equals(internals.scrollbarOverlayStyle(), "light");
}, "Document scrollbar overlay style is light");

test(function() {
if (!window.internals)
return;
assert_equals(internals.scrollbarUsingDarkAppearance(), true);
}, "Document scrollbar is using dark appearance");

test(function() {
if (!window.internals)
return;
assert_equals(internals.scrollbarOverlayStyle(document.getElementById("test")), "default");
}, "Element scrollbar overlay style is default");

test(function() {
if (!window.internals)
return;
assert_equals(internals.scrollbarUsingDarkAppearance(document.getElementById("test")), true);
}, "Element scrollbar is using dark appearance");

test(function() {
let styleElement = document.createElement("style");
styleElement.textContent = ":root { color-scheme: light }";
document.head.appendChild(styleElement);
}, "Set color scheme to light on the document element");

test(function() {
test_prop(document.body, "color-scheme", "light dark");
}, "Body Element color scheme is light and dark");

test(function() {
test_prop(document.documentElement, "color-scheme", "light");
}, "Document Element color scheme is light");

test(function() {
if (!window.internals)
return;
assert_equals(internals.scrollbarOverlayStyle(), "default");
}, "Document scrollbar overlay style is default");

test(function() {
if (!window.internals)
return;
assert_equals(internals.scrollbarUsingDarkAppearance(), false);
}, "Document scrollbar is using light appearance");

test(function() {
if (!window.internals)
return;
assert_equals(internals.scrollbarOverlayStyle(document.getElementById("test")), "default");
}, "Element scrollbar overlay style is default");

test(function() {
if (!window.internals)
return;
assert_equals(internals.scrollbarUsingDarkAppearance(document.getElementById("test")), true);
}, "Element scrollbar is using dark appearance");
</script>
@@ -36,7 +36,7 @@

test(function() {
let styleElement = document.createElement("style");
styleElement.textContent = ":root { supported-color-schemes: light dark; }";
styleElement.textContent = ":root { color-scheme: light dark; }";
document.head.appendChild(styleElement);
}, "Set prefers-color-schemes: light dark on the body");

File renamed without changes.
@@ -0,0 +1,167 @@
<!DOCTYPE html>

<!-- webkit-test-runner [ experimental:DarkModeCSSEnabled=true ] -->

<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>

<style>
#test1 {
color: text;
}
</style>

<div id="test1"></div>

<script>
function test_prop(element, prop, expected) {
assert_equals(window.getComputedStyle(element).getPropertyValue(prop), expected);
}

function test_color_is_white(id) {
test_prop(document.getElementById("test1"), "color", "rgb(255, 255, 255)");
}

function test_color_is_black(id) {
test_prop(document.getElementById("test1"), "color", "rgb(0, 0, 0)");
}

test(function() {
// The semantic text color should be black.
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with only light supported color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(true);
}, "Dark color scheme enabled");

test(function() {
// The semantic text color should be black, and not change.
test_color_is_black("test1");
}, "Element colors are correct in dark color scheme with only light supported color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(false);
}, "Light color scheme enabled");

test(function() {
document.body.style.setProperty("supported-color-schemes", "light dark");
test_prop(document.body, "supported-color-schemes", "light dark");
test_prop(document.body, "color-scheme", "light dark");
}, "Supported color schemes changed to light and dark");

test(function() {
// The semantic text color should be black.
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with light and dark supported color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(true);
}, "Dark color scheme enabled");

test(function() {
// The semantic text color should be white.
test_color_is_white("test1");
}, "Element colors are correct in dark color scheme with light and dark supported color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(false);
}, "Light color scheme enabled");

test(function() {
document.body.style.setProperty("supported-color-schemes", "dark");
test_prop(document.body, "supported-color-schemes", "dark");
test_prop(document.body, "color-scheme", "dark");
}, "Supported color schemes changed to dark");

test(function() {
// The semantic text color should be white.
test_color_is_white("test1");
}, "Element colors are correct in light color scheme with only dark supported color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(true);
}, "Dark color scheme enabled");

test(function() {
// The semantic text color should be white still.
test_color_is_white("test1");
}, "Element colors are correct in dark color scheme with only dark supported color scheme");

test(function() {
document.body.style.setProperty("supported-color-schemes", "light foo");
test_prop(document.body, "supported-color-schemes", "light");
test_prop(document.body, "color-scheme", "light");
}, "Supported color schemes changed to light and a bogus value");

test(function() {
// The semantic text color should be black again.
test_color_is_black("test1");
}, "Element colors are correct in dark color scheme with only light supported color scheme");

test(function() {
document.body.style.setProperty("supported-color-schemes", "auto");
test_prop(document.body, "supported-color-schemes", "auto");
test_prop(document.body, "color-scheme", "auto");
}, "Supported color schemes changed to auto value");

test(function() {
// The semantic text color should be black still.
test_color_is_black("test1");
}, "Element colors are correct in dark color scheme with implicit light supported color scheme");

test(function() {
let meta = document.createElement("meta");
meta.id = "test-meta";
meta.name = "supported-color-schemes";
meta.content = "light dark";
document.head.appendChild(meta);
}, "Supported color schemes changed to light and dark via <meta> element");

test(function() {
// The semantic text color should be white now.
test_color_is_white("test1");
}, "Element colors are correct in dark color scheme with light and dark supported color scheme via <meta> element");

test(function() {
document.body.style.setProperty("supported-color-schemes", "light");
test_prop(document.body, "supported-color-schemes", "light");
test_prop(document.body, "color-scheme", "light");
}, "Supported color schemes changed to light value");

test(function() {
// The semantic text color should be black again.
test_color_is_black("test1");
}, "Element colors are correct in dark color scheme with explicit light, overriding <meta> element");

test(function() {
document.getElementById("test-meta").remove();
}, "Remove test meta element");

test(function() {
document.body.style.setProperty("supported-color-schemes", "light dark");
test_prop(document.body, "supported-color-schemes", "light dark");
test_prop(document.body, "color-scheme", "light dark");
}, "Supported color schemes changed to light and dark");

test(function() {
// The semantic text color should be white now.
test_color_is_white("test1");
}, "Element colors are correct in dark color scheme with light and dark supported color scheme");

test(function() {
document.body.style.setProperty("supported-color-schemes", "foo dark");
test_prop(document.body, "supported-color-schemes", "dark");
test_prop(document.body, "color-scheme", "dark");
}, "Supported color schemes changed to a bogus value and dark");

test(function() {
// The semantic text color should be white still.
test_color_is_white("test1");
}, "Element colors are correct in dark color scheme with dark supported color scheme");
</script>
@@ -0,0 +1,23 @@

PASS Element colors are correct in light color scheme with only light color scheme
PASS Dark color scheme enabled
PASS Element colors are correct in dark color scheme with only light color scheme
PASS Light color scheme enabled
PASS Supported color schemes changed to light and dark
PASS Element colors are correct in light color scheme with light and dark color scheme
PASS Dark color scheme enabled
PASS Element colors are correct in dark color scheme with light and dark color scheme
PASS Light color scheme enabled
PASS Supported color schemes changed to dark
PASS Element colors are correct in light color scheme with only dark color scheme
PASS Dark color scheme enabled
PASS Element colors are correct in dark color scheme with only dark color scheme
PASS Supported color schemes changed to light and a bogus value
PASS Element colors are correct in dark color scheme with only light color scheme
PASS Supported color schemes changed to empty value
PASS Element colors are correct in dark color scheme with implicit light color scheme
PASS Supported color schemes changed to light,dark
PASS Element colors are in light color scheme since comma is not an allowed seperator
PASS Supported color schemes changed to a bogus value and dark
PASS Element colors are correct in dark color scheme with dark color scheme

@@ -0,0 +1,129 @@
<!DOCTYPE html>

<!-- webkit-test-runner [ experimental:DarkModeCSSEnabled=true ] -->

<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>

<style>
#test1 {
color: text;
}
</style>

<meta id="meta" name="supported-color-schemes" content="light">

<div id="test1"></div>

<script>
function test_prop(id, prop, expected) {
assert_equals(window.getComputedStyle(document.getElementById(id)).getPropertyValue(prop).trim(), expected);
}

function test_color_is_white(id) {
test_prop("test1", "color", "rgb(255, 255, 255)");
}

function test_color_is_black(id) {
test_prop("test1", "color", "rgb(0, 0, 0)");
}

test(function() {
// The semantic text color should be black.
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with only light color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(true);
}, "Dark color scheme enabled");

test(function() {
// The semantic text color should be black, and not change.
test_color_is_black("test1");
}, "Element colors are correct in dark color scheme with only light color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(false);
}, "Light color scheme enabled");

test(function() {
document.getElementById("meta").content = "light dark";
}, "Supported color schemes changed to light and dark");

test(function() {
// The semantic text color should be black.
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with light and dark color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(true);
}, "Dark color scheme enabled");

test(function() {
// The semantic text color should be white.
test_color_is_white("test1");
}, "Element colors are correct in dark color scheme with light and dark color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(false);
}, "Light color scheme enabled");

test(function() {
document.getElementById("meta").content = "dark";
}, "Supported color schemes changed to dark");

test(function() {
// The semantic text color should be white.
test_color_is_white("test1");
}, "Element colors are correct in light color scheme with only dark color scheme");

test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(true);
}, "Dark color scheme enabled");

test(function() {
// The semantic text color should be white still.
test_color_is_white("test1");
}, "Element colors are correct in dark color scheme with only dark color scheme");

test(function() {
document.getElementById("meta").content = "light ,foo ";
}, "Supported color schemes changed to light and a bogus value");

test(function() {
// The semantic text color should be black again.
test_color_is_black("test1");
}, "Element colors are correct in dark color scheme with only light color scheme");

test(function() {
document.getElementById("meta").content = "";
}, "Supported color schemes changed to empty value");

test(function() {
// The semantic text color should be black still.
test_color_is_black("test1");
}, "Element colors are correct in dark color scheme with implicit light color scheme");

test(function() {
document.getElementById("meta").content = " light,dark ";
}, "Supported color schemes changed to light,dark");

test(function() {
// The semantic text color should be black now.
test_color_is_black("test1");
}, "Element colors are in light color scheme since comma is not an allowed seperator");

test(function() {
document.getElementById("meta").content = " foo dark";
}, "Supported color schemes changed to a bogus value and dark");

test(function() {
// The semantic text color should be white still.
test_color_is_white("test1");
}, "Element colors are correct in dark color scheme with dark color scheme");
</script>
@@ -0,0 +1,20 @@

PASS Element colors are correct in light color scheme with only light supported color scheme
PASS Color schemes changed to light and dark
PASS Element colors are correct in light color scheme with light and dark supported color scheme
PASS Color schemes changed to dark
PASS Element colors are correct in light color scheme with only dark supported color scheme
PASS Color schemes changed to light and a bogus value
PASS Element colors are correct in light color scheme with only light supported color scheme
PASS Color schemes changed to auto value
PASS Element colors are correct in light color scheme with implicit light supported color scheme
PASS Color schemes changed to light and dark via <meta> element
PASS Element colors are correct in light color scheme with light and dark supported color scheme via <meta> element
PASS Color schemes changed to light value
PASS Element colors are correct in light color scheme with explicit light, overriding <meta> element
PASS Remove test meta element
PASS Color schemes changed to light and dark
PASS Element colors are correct in light color scheme with light and dark supported color scheme
PASS Color schemes changed to a bogus value and dark
PASS Element colors are correct in light color scheme with dark supported color scheme

@@ -0,0 +1,105 @@
<!DOCTYPE html>

<!-- webkit-test-runner [ experimental:DarkModeCSSEnabled=true ] -->

<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>

<style>
#test1 {
color: text;
}
</style>

<div id="test1"></div>

<script>
function test_prop(id, prop, expected) {
assert_equals(window.getComputedStyle(document.getElementById(id)).getPropertyValue(prop), expected);
}

function test_color_is_black(id) {
test_prop("test1", "color", "rgb(0, 0, 0)");
}

test(function() {
// The semantic text color should be black.
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with only light supported color scheme");

test(function() {
document.body.style.setProperty("color-scheme", "light dark");
}, "Color schemes changed to light and dark");

test(function() {
// The semantic text color should be black.
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with light and dark supported color scheme");

test(function() {
document.body.style.setProperty("color-scheme", "dark");
}, "Color schemes changed to dark");

test(function() {
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with only dark supported color scheme");

test(function() {
document.body.style.setProperty("color-scheme", "light foo");
}, "Color schemes changed to light and a bogus value");

test(function() {
// The semantic text color should be black again.
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with only light supported color scheme");

test(function() {
document.body.style.setProperty("color-scheme", "auto");
}, "Color schemes changed to auto value");

test(function() {
// The semantic text color should be black still.
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with implicit light supported color scheme");

test(function() {
let meta = document.createElement("meta");
meta.id = "test-meta";
meta.name = "color-scheme";
meta.content = "light dark";
document.head.appendChild(meta);
}, "Color schemes changed to light and dark via <meta> element");

test(function() {
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with light and dark supported color scheme via <meta> element");

test(function() {
document.body.style.setProperty("color-scheme", "light");
}, "Color schemes changed to light value");

test(function() {
// The semantic text color should be black again.
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with explicit light, overriding <meta> element");

test(function() {
document.getElementById("test-meta").remove();
}, "Remove test meta element");

test(function() {
document.body.style.setProperty("color-scheme", "light dark");
}, "Color schemes changed to light and dark");

test(function() {
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with light and dark supported color scheme");

test(function() {
document.body.style.setProperty("color-scheme", "foo dark");
}, "Color schemes changed to a bogus value and dark");

test(function() {
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with dark supported color scheme");
</script>
@@ -0,0 +1,15 @@

PASS Element colors are correct in light color scheme with only light color scheme
PASS Color schemes changed to light and dark
PASS Element colors are correct in light color scheme with light and dark color scheme
PASS Color schemes changed to dark
PASS Element colors are correct in light color scheme with only dark color scheme
PASS Color schemes changed to light and a bogus value
PASS Element colors are correct in light color scheme with only light color scheme
PASS Color schemes changed to empty value
PASS Element colors are correct in light color scheme with implicit light color scheme
PASS Color schemes changed to light and dark
PASS Element colors are correct in light color scheme with light and dark color scheme
PASS Color schemes changed to a bogus value and dark
PASS Element colors are correct in light color scheme with dark color scheme

@@ -0,0 +1,78 @@
<!DOCTYPE html>

<!-- webkit-test-runner [ experimental:DarkModeCSSEnabled=true ] -->

<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>

<style>
#test1 {
color: text;
}
</style>

<meta id="meta" name="color-scheme" content="light">

<div id="test1"></div>

<script>
function test_prop(id, prop, expected) {
assert_equals(window.getComputedStyle(document.getElementById(id)).getPropertyValue(prop).trim(), expected);
}

function test_color_is_black(id) {
test_prop("test1", "color", "rgb(0, 0, 0)");
}

test(function() {
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with only light color scheme");

test(function() {
document.getElementById("meta").content = "light dark";
}, "Color schemes changed to light and dark");

test(function() {
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with light and dark color scheme");

test(function() {
document.getElementById("meta").content = "dark";
}, "Color schemes changed to dark");

test(function() {
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with only dark color scheme");

test(function() {
document.getElementById("meta").content = "light ,foo ";
}, "Color schemes changed to light and a bogus value");

test(function() {
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with only light color scheme");

test(function() {
document.getElementById("meta").content = "";
}, "Color schemes changed to empty value");

test(function() {
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with implicit light color scheme");

test(function() {
document.getElementById("meta").content = " light, dark ";
}, "Color schemes changed to light and dark");

test(function() {
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with light and dark color scheme");

test(function() {
document.getElementById("meta").content = ", foo dark";
}, "Color schemes changed to a bogus value and dark");

test(function() {
test_color_is_black("test1");
}, "Element colors are correct in light color scheme with dark color scheme");
</script>

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.