Make "descriptors" argument of FontFace constructor optional

This reflects recent spec update.

spec: http://dev.w3.org/csswg/css-font-loading/#fontface-interface

BUG=
TEST=fast/css/font*

Review URL: https://codereview.chromium.org/335333002

git-svn-id: svn://svn.chromium.org/blink/trunk@176329 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent fa35c5da
...@@ -15,15 +15,15 @@ for (var i = 0; i < ahemString.length; i++) { ...@@ -15,15 +15,15 @@ for (var i = 0; i < ahemString.length; i++) {
uint8View[i] = ahemString.charCodeAt(i); uint8View[i] = ahemString.charCodeAt(i);
} }
var face1 = new FontFace('FontFromArrayBuffer', buffer, {}); var face1 = new FontFace('FontFromArrayBuffer', buffer);
shouldBeEqualToString('face1.status', 'loaded'); shouldBeEqualToString('face1.status', 'loaded');
document.fonts.add(face1); document.fonts.add(face1);
var face2 = new FontFace('FontFromArrayBufferView', uint8View, {}); var face2 = new FontFace('FontFromArrayBufferView', uint8View);
shouldBeEqualToString('face2.status', 'loaded'); shouldBeEqualToString('face2.status', 'loaded');
document.fonts.add(face2); document.fonts.add(face2);
var face3 = new FontFace('FontFromEmptyArrayBuffer', new ArrayBuffer(0), {}); var face3 = new FontFace('FontFromEmptyArrayBuffer', new ArrayBuffer(0));
shouldBeEqualToString('face3.status', 'error'); shouldBeEqualToString('face3.status', 'error');
face3.load().catch(function(v) { face3.load().catch(function(v) {
rejectionValue = v; rejectionValue = v;
......
...@@ -32,7 +32,7 @@ PASS modifiedFace.unicodeRange is "U+0-3FF" ...@@ -32,7 +32,7 @@ PASS modifiedFace.unicodeRange is "U+0-3FF"
PASS modifiedFace.variant is "small-caps" PASS modifiedFace.variant is "small-caps"
PASS modifiedFace.featureSettings is "'dlig' 1, 'liga' 0" PASS modifiedFace.featureSettings is "'dlig' 1, 'liga' 0"
PASS new FontFace('test', 'invalid_src', {}) threw exception SyntaxError: Failed to construct 'FontFace': The source provided ('invalid_src') could not be parsed as a value list.. PASS new FontFace('test', 'invalid_src') threw exception SyntaxError: Failed to construct 'FontFace': The source provided ('invalid_src') could not be parsed as a value list..
PASS face.style = '' threw exception SyntaxError: Failed to set the 'style' property on 'FontFace': Failed to set '' as a property value.. PASS face.style = '' threw exception SyntaxError: Failed to set the 'style' property on 'FontFace': Failed to set '' as a property value..
PASS face.weight = 'a' threw exception SyntaxError: Failed to set the 'weight' property on 'FontFace': Failed to set 'a' as a property value.. PASS face.weight = 'a' threw exception SyntaxError: Failed to set the 'weight' property on 'FontFace': Failed to set 'a' as a property value..
PASS face.unicodeRange = 'U+' threw exception SyntaxError: Failed to set the 'unicodeRange' property on 'FontFace': Failed to set 'U+' as a property value.. PASS face.unicodeRange = 'U+' threw exception SyntaxError: Failed to set the 'unicodeRange' property on 'FontFace': Failed to set 'U+' as a property value..
......
...@@ -32,7 +32,7 @@ function runTests() { ...@@ -32,7 +32,7 @@ function runTests() {
shouldBeEqualToString('ahemFace.featureSettings', "'dlig' 1"); shouldBeEqualToString('ahemFace.featureSettings', "'dlig' 1");
debug(''); debug('');
defaultFace = new FontFace('defaultFace', 'local(foo)', {}); defaultFace = new FontFace('defaultFace', 'local(foo)');
shouldBeEqualToString('defaultFace.family', 'defaultFace'); shouldBeEqualToString('defaultFace.family', 'defaultFace');
shouldBeEqualToString('defaultFace.style', 'normal'); shouldBeEqualToString('defaultFace.style', 'normal');
shouldBeEqualToString('defaultFace.weight', 'normal'); shouldBeEqualToString('defaultFace.weight', 'normal');
...@@ -57,7 +57,7 @@ function runTests() { ...@@ -57,7 +57,7 @@ function runTests() {
shouldBeEqualToString('constructedFace.featureSettings', "'liga' 0"); shouldBeEqualToString('constructedFace.featureSettings', "'liga' 0");
debug(''); debug('');
modifiedFace = new FontFace('unmodified', 'local(baz)', {}); modifiedFace = new FontFace('unmodified', 'local(baz)');
modifiedFace.family = 'modified'; modifiedFace.family = 'modified';
modifiedFace.style = 'italic'; modifiedFace.style = 'italic';
modifiedFace.weight = 900; modifiedFace.weight = 900;
...@@ -72,8 +72,8 @@ function runTests() { ...@@ -72,8 +72,8 @@ function runTests() {
shouldBeEqualToString('modifiedFace.featureSettings', "'dlig' 1, 'liga' 0"); shouldBeEqualToString('modifiedFace.featureSettings', "'dlig' 1, 'liga' 0");
debug(''); debug('');
shouldThrow("new FontFace('test', 'invalid_src', {})"); shouldThrow("new FontFace('test', 'invalid_src')");
face = new FontFace('test', 'local(foo)', {}); face = new FontFace('test', 'local(foo)');
shouldThrow("face.style = ''"); shouldThrow("face.style = ''");
shouldThrow("face.weight = 'a'"); shouldThrow("face.weight = 'a'");
shouldThrow("face.unicodeRange = 'U+'"); shouldThrow("face.unicodeRange = 'U+'");
......
...@@ -39,9 +39,9 @@ enum FontFaceLoadStatus { ...@@ -39,9 +39,9 @@ enum FontFaceLoadStatus {
[ [
// FIXME: should be union type http://crbug.com/240176 // FIXME: should be union type http://crbug.com/240176
Constructor(DOMString family, DOMString source, Dictionary descriptors), Constructor(DOMString family, DOMString source, optional Dictionary descriptors),
Constructor(DOMString family, ArrayBuffer source, Dictionary descriptors), Constructor(DOMString family, ArrayBuffer source, optional Dictionary descriptors),
Constructor(DOMString family, ArrayBufferView source, Dictionary descriptors), Constructor(DOMString family, ArrayBufferView source, optional Dictionary descriptors),
ConstructorCallWith=ExecutionContext, ConstructorCallWith=ExecutionContext,
RaisesException=Constructor, RaisesException=Constructor,
RuntimeEnabled=FontLoadEvents, RuntimeEnabled=FontLoadEvents,
......
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