Index: LayoutTests/fast/css/font-face-css-change-while-loading.html |
diff --git a/LayoutTests/fast/css/font-face-css-change-while-loading.html b/LayoutTests/fast/css/font-face-css-change-while-loading.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bb985543bcd4bb0cbed11f464d4edb8f86f802d8 |
--- /dev/null |
+++ b/LayoutTests/fast/css/font-face-css-change-while-loading.html |
@@ -0,0 +1,42 @@ |
+<!DOCTYPE html> |
+<style id="sheet"> |
+@font-face { |
+ font-family: myahem; |
+ src: url(../../resources/Ahem.ttf); |
+} |
+</style> |
+<script> |
+if (window.testRunner) |
+ window.testRunner.waitUntilDone(); |
+ |
+function getDocumentFontFaces() { |
+ var faces = []; |
+ document.fonts.forEach(function(face) { faces.push(face); }); |
+ return faces; |
+} |
+ |
+function runTest() { |
+ var face = getDocumentFontFaces()[0]; |
+ |
+ document.getElementById("t").style.fontFamily = "myahem"; |
+ document.body.offsetTop; // force recalc and start loading font. |
+ |
+ var newStyle = document.createElement("style"); |
+ newStyle.innerHTML = "#dummy { color: red; }"; |
+ var referenceNode = document.getElementById("sheet"); |
+ referenceNode.parentNode.insertBefore(newStyle, referenceNode); |
+ |
+ face.loaded.then(finish); |
+} |
+ |
+function finish() { |
+ if (window.testRunner) |
+ window.testRunner.notifyDone(); |
+} |
+ |
+onload = function() { |
+ setTimeout(runTest, 0); |
+} |
+</script> |
+<p>You should see a black rectangle below.</p> |
+<div id="t">FAIL</div> |