Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
2010-07-15 Yuzo Fujishima <yuzo@google.com>
Reviewed by Dan Bernstein. Fix for Bug 42342 - Font download error for an @font-face rule invalidates other @font-face rules for the same font-family https://bugs.webkit.org/show_bug.cgi?id=42342 * fast/css/font-face-download-error-expected.txt: Added. * fast/css/font-face-download-error.html: Added. 2010-07-15 Yuzo Fujishima <yuzo@google.com> Reviewed by Dan Bernstein. Fix for Bug 42342 - Font download error for an @font-face rule invalidates other @font-face rules for the same font-family https://bugs.webkit.org/show_bug.cgi?id=42342 Test: fast/css/font-face-download-error.html * css/CSSSegmentedFontFace.cpp: (WebCore::CSSSegmentedFontFace::isValid): Valid if at least one font face is valid. (WebCore::CSSSegmentedFontFace::getFontData): Check validity for each font face. * css/CSSSegmentedFontFace.h: Make isValid private. Canonical link: https://commits.webkit.org/54557@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@63719 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
205 additions
and 4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,36 @@ | ||
If no font resources are available for an @font-face rule due to download errors, the rule must be ignored but others must remain in effect. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
iiiiiiiiii test_0_0 | ||
iiiiiiiiii ref_0_0 | ||
jjjjjjjjjj test_0_1 | ||
jjjjjjjjjj ref_0_1 | ||
|
||
iiiiiiiiii test_1_0 | ||
iiiiiiiiii ref_1_0 | ||
jjjjjjjjjj test_1_1 | ||
jjjjjjjjjj ref_1_1 | ||
|
||
iiiiiiiiii test_2_0 | ||
iiiiiiiiii ref_2_0 | ||
jjjjjjjjjj test_2_1 | ||
jjjjjjjjjj ref_2_1 | ||
|
||
iiiiiiiiii test_3_0 | ||
iiiiiiiiii ref_3_0 | ||
jjjjjjjjjj test_3_1 | ||
jjjjjjjjjj ref_3_1 | ||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
PASS document.getElementById('test_0_0').offsetWidth is document.getElementById('ref_0_0').offsetWidth | ||
PASS document.getElementById('test_0_1').offsetWidth is document.getElementById('ref_0_1').offsetWidth | ||
PASS document.getElementById('test_1_0').offsetWidth is document.getElementById('ref_1_0').offsetWidth | ||
PASS document.getElementById('test_1_1').offsetWidth is document.getElementById('ref_1_1').offsetWidth | ||
PASS document.getElementById('test_2_0').offsetWidth is document.getElementById('ref_2_0').offsetWidth | ||
PASS document.getElementById('test_2_1').offsetWidth is document.getElementById('ref_2_1').offsetWidth | ||
PASS document.getElementById('test_3_0').offsetWidth is document.getElementById('ref_3_0').offsetWidth | ||
PASS document.getElementById('test_3_1').offsetWidth is document.getElementById('ref_3_1').offsetWidth | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,136 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Test for Bug 42342 - Font download error for an @font-face rule invalidates other @font-face rules for the same font-family</title> | ||
<style> | ||
.test { | ||
font-family: Times; | ||
border: solid 1px; | ||
} | ||
|
||
/* Test 0: Download sucess */ | ||
@font-face { | ||
font-family:myfont_0; | ||
src: local('Courier'); | ||
} | ||
@font-face { | ||
font-family:myfont_0; | ||
src: url('resources/Ahem.otf'); | ||
unicode-range: u+69; /* 'i' */ | ||
} | ||
|
||
/* Test 1: Download error */ | ||
@font-face { | ||
font-family:myfont_1; | ||
src: local('Courier'); | ||
} | ||
@font-face { | ||
font-family:myfont_1; | ||
src: url('resources/DownLoadErrorAhem.otf'); | ||
unicode-range: u+69; /* 'i' */ | ||
} | ||
|
||
/* Test 2: Download error followed by success */ | ||
@font-face { | ||
font-family:myfont_2; | ||
src: local('Courier'); | ||
} | ||
@font-face { | ||
font-family:myfont_2; | ||
src: url('resources/DownLoadErrorAhem.otf'), url('resources/Ahem.otf'); | ||
unicode-range: u+69; /* 'i' */ | ||
} | ||
|
||
/* Test 3: Download error followed by existing local font */ | ||
@font-face { | ||
font-family:myfont_3; | ||
src: local('Courier'); | ||
} | ||
@font-face { | ||
font-family:myfont_3; | ||
src: url('resources/DownLoadErrorAhem.otf'), local(Arial); | ||
unicode-range: u+69; /* 'i' */ | ||
} | ||
|
||
</style> | ||
<link rel="stylesheet" href="../js/resources/js-test-style.css"/> | ||
<script src="../js/resources/js-test-pre.js"></script> | ||
</head> | ||
<body> | ||
<div id="description"></div> | ||
<div id="tests"></div> | ||
|
||
<div id="console"></div> | ||
<div id="out"></div> | ||
<script> | ||
if (window.layoutTestController) | ||
window.layoutTestController.waitUntilDone(); | ||
|
||
description("If no font resources are available for an @font-face rule due to download errors, the rule must be ignored but others must remain in effect."); | ||
|
||
var testsElement = document.getElementById("tests"); | ||
var testStrings = [ | ||
"iiiiiiiiii", | ||
"jjjjjjjjjj" | ||
]; | ||
var expectedResults = [ | ||
// Effective font family for "i" and "j" | ||
["Ahem", "Courier"], | ||
["Courier", "Courier"], | ||
["Ahem", "Courier"], | ||
["Arial", "Courier"] | ||
]; | ||
|
||
function createAndAppendSpan(id, subId, fontFamily) | ||
{ | ||
var span = document.createElement("span"); | ||
span.id = id; | ||
span.className = "test"; | ||
span.style.fontFamily = fontFamily; | ||
span.innerHTML = testStrings[subId]; | ||
testsElement.appendChild(span); | ||
testsElement.appendChild(document.createTextNode(" " + id)); | ||
testsElement.appendChild(document.createElement("br")); | ||
} | ||
|
||
function testId(mainTestId, subTestId) | ||
{ | ||
return "test_" + mainTestId + "_" + subTestId; | ||
} | ||
|
||
function refId(mainTestId, subTestId) | ||
{ | ||
return "ref_" + mainTestId + "_" + subTestId; | ||
} | ||
|
||
function test() | ||
{ | ||
for (var mainTestId = 0; mainTestId < expectedResults.length; mainTestId++) { | ||
for (var subTestId = 0; subTestId < testStrings.length; subTestId++) { | ||
shouldBe("document.getElementById('" + testId(mainTestId, subTestId) + "').offsetWidth", "document.getElementById('" + refId(mainTestId, subTestId) + "').offsetWidth"); | ||
} | ||
} | ||
if (window.layoutTestController) | ||
window.layoutTestController.notifyDone(); | ||
} | ||
|
||
for (var mainTestId = 0; mainTestId < expectedResults.length; mainTestId++) { | ||
for (var subTestId = 0; subTestId < testStrings.length; subTestId++) { | ||
var testFontFamily = "myfont_" + mainTestId; | ||
createAndAppendSpan(testId(mainTestId, subTestId), subTestId, testFontFamily); | ||
var refFontFamily = expectedResults[mainTestId][subTestId]; | ||
createAndAppendSpan(refId(mainTestId, subTestId), subTestId, refFontFamily); | ||
} | ||
testsElement.appendChild(document.createElement("br")); | ||
} | ||
|
||
// We need to run tests after the font downloading succeeded or failed. | ||
// Using a timer is not ideal, but there seems to be no better options. | ||
window.setTimeout(test, 100); | ||
|
||
var successfullyParsed = true; | ||
</script> | ||
<script src="../js/resources/js-test-post.js"></script> | ||
</body> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters