webfontloader 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/Rakefile +2 -1
- data/lib/webfontloader.rb +1 -1
- data/spec/core/font_spec.js +9 -4
- data/spec/core/fontruler_spec.js +3 -10
- data/spec/core/fontwatcher_spec.js +22 -23
- data/spec/core/fontwatchrunner_spec.js +206 -231
- data/spec/deps.js +27 -0
- data/spec/google/lastresortwebkitfontwatchrunner_spec.js +47 -58
- data/spec/index.html +14 -25
- data/src/ascender/ascender_script.js +52 -45
- data/src/core/browserinfo.js +54 -47
- data/src/core/cssclassname.js +27 -22
- data/src/core/cssfontfamilyname.js +23 -17
- data/src/core/domhelper.js +209 -203
- data/src/core/eventdispatcher.js +111 -103
- data/src/core/font.js +110 -68
- data/src/core/fontmoduleloader.js +56 -13
- data/src/core/fontruler.js +52 -43
- data/src/core/fontvariationdescription.js +82 -76
- data/src/core/fontwatcher.js +93 -88
- data/src/core/fontwatchrunner.js +161 -161
- data/src/core/initialize.js +22 -15
- data/src/core/namespace.js +0 -29
- data/src/core/size.js +31 -25
- data/src/core/useragent.js +63 -48
- data/src/core/useragentparser.js +317 -306
- data/src/custom/customcss.js +31 -24
- data/src/fontdeck/fontdeck_script.js +46 -37
- data/src/google/fontapiparser.js +105 -97
- data/src/google/fontapiurlbuilder.js +46 -41
- data/src/google/googlefontapi.js +48 -32
- data/src/google/lastresortwebkitfontwatchrunner.js +80 -67
- data/src/modules.yml +6 -6
- data/src/monotype/monotype_script.js +47 -40
- data/src/typekit/typekit_script.js +41 -35
- data/tools/compiler/base.js +1548 -0
- data/tools/compiler/compiler.jar +0 -0
- data/webfontloader.gemspec +4 -2
- metadata +18 -16
data/spec/deps.js
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
// This file was autogenerated by calcdeps.js
|
2
|
+
goog.addDependency("../../src/ascender/ascender_script.js", ["webfont.AscenderScript"], []);
|
3
|
+
goog.addDependency("../../src/async_load.js", [], []);
|
4
|
+
goog.addDependency("../../src/closure.js", [], []);
|
5
|
+
goog.addDependency("../../src/core/browserinfo.js", ["webfont.BrowserInfo"], []);
|
6
|
+
goog.addDependency("../../src/core/cssclassname.js", ["webfont.CssClassName"], []);
|
7
|
+
goog.addDependency("../../src/core/cssfontfamilyname.js", ["webfont.CssFontFamilyName"], []);
|
8
|
+
goog.addDependency("../../src/core/domhelper.js", ["webfont.DomHelper"], []);
|
9
|
+
goog.addDependency("../../src/core/eventdispatcher.js", ["webfont.EventDispatcher"], ["webfont.CssClassName"]);
|
10
|
+
goog.addDependency("../../src/core/font.js", ["webfont.WebFont"], ["webfont.DomHelper","webfont.EventDispatcher","webfont.FontWatcher","webfont.Size"]);
|
11
|
+
goog.addDependency("../../src/core/fontmoduleloader.js", ["webfont.FontModuleLoader"], []);
|
12
|
+
goog.addDependency("../../src/core/fontruler.js", ["webfont.FontRuler"], ["webfont.CssFontFamilyName","webfont.FontVariationDescription","webfont.Size"]);
|
13
|
+
goog.addDependency("../../src/core/fontvariationdescription.js", ["webfont.FontVariationDescription"], []);
|
14
|
+
goog.addDependency("../../src/core/fontwatcher.js", ["webfont.FontWatcher"], ["webfont.FontWatchRunner"]);
|
15
|
+
goog.addDependency("../../src/core/fontwatchrunner.js", ["webfont.FontWatchRunner"], ["webfont.FontRuler"]);
|
16
|
+
goog.addDependency("../../src/core/initialize.js", ["webfont"], ["webfont.UserAgentParser","webfont.FontModuleLoader","webfont.WebFont"]);
|
17
|
+
goog.addDependency("../../src/core/size.js", ["webfont.Size"], []);
|
18
|
+
goog.addDependency("../../src/core/useragent.js", ["webfont.UserAgent"], []);
|
19
|
+
goog.addDependency("../../src/core/useragentparser.js", ["webfont.UserAgentParser"], ["webfont.BrowserInfo","webfont.UserAgent"]);
|
20
|
+
goog.addDependency("../../src/custom/customcss.js", ["webfont.CustomCss"], []);
|
21
|
+
goog.addDependency("../../src/fontdeck/fontdeck_script.js", ["webfont.FontdeckScript"], ["webfont.FontVariationDescription"]);
|
22
|
+
goog.addDependency("../../src/google/fontapiparser.js", ["webfont.FontApiParser"], ["webfont.FontVariationDescription"]);
|
23
|
+
goog.addDependency("../../src/google/fontapiurlbuilder.js", ["webfont.FontApiUrlBuilder"], []);
|
24
|
+
goog.addDependency("../../src/google/googlefontapi.js", ["webfont.GoogleFontApi"], ["webfont.FontApiUrlBuilder","webfont.FontApiParser","webfont.FontWatchRunner","webfont.LastResortWebKitFontWatchRunner"]);
|
25
|
+
goog.addDependency("../../src/google/lastresortwebkitfontwatchrunner.js", ["webfont.LastResortWebKitFontWatchRunner"], ["webfont.FontRuler"]);
|
26
|
+
goog.addDependency("../../src/monotype/monotype_script.js", ["webfont.MonotypeScript"], []);
|
27
|
+
goog.addDependency("../../src/typekit/typekit_script.js", ["webfont.TypekitScript"], []);
|
@@ -3,12 +3,12 @@ describe('LastResortWebKitFontWatchRunner', function () {
|
|
3
3
|
BrowserInfo = webfont.BrowserInfo,
|
4
4
|
Size = webfont.Size,
|
5
5
|
DomHelper = webfont.DomHelper,
|
6
|
+
FontRuler = webfont.FontRuler,
|
6
7
|
domHelper = new DomHelper(window),
|
7
8
|
fontFamily = 'My Family',
|
8
9
|
fontDescription = 'n4';
|
9
10
|
|
10
|
-
var
|
11
|
-
TARGET_SIZE = new Size(3, 3),
|
11
|
+
var TARGET_SIZE = new Size(3, 3),
|
12
12
|
FALLBACK_SIZE_A = new Size(1, 1),
|
13
13
|
FALLBACK_SIZE_B = new Size(2, 2),
|
14
14
|
LAST_RESORT_SIZE = new Size(4, 4),
|
@@ -16,67 +16,56 @@ describe('LastResortWebKitFontWatchRunner', function () {
|
|
16
16
|
browserInfo = new BrowserInfo(true, true, false),
|
17
17
|
setupSizes = [FALLBACK_SIZE_A, FALLBACK_SIZE_B, LAST_RESORT_SIZE],
|
18
18
|
actualSizes = [],
|
19
|
-
fakeGetSizeCount = 0,
|
20
|
-
setupFinished = false,
|
21
|
-
fakeFontSizer = {
|
22
|
-
getSize: function (el) {
|
23
|
-
var result = null;
|
24
|
-
|
25
|
-
if (setupFinished) {
|
26
|
-
// If you are getting an exception here your tests does not specify enough
|
27
|
-
// size data to run properly.
|
28
|
-
if (fakeGetSizeCount >= actualSizes.length) {
|
29
|
-
throw 'Invalid test data';
|
30
|
-
}
|
31
|
-
result = actualSizes[fakeGetSizeCount];
|
32
|
-
fakeGetSizeCount += 1;
|
33
|
-
} else {
|
34
|
-
result = setupSizes[Math.min(fakeGetSizeCount, setupSizes.length - 1)];
|
35
|
-
fakeGetSizeCount += 1;
|
36
|
-
}
|
37
|
-
return result;
|
38
|
-
}
|
39
|
-
},
|
40
19
|
timesToGetTimeBeforeTimeout = 10,
|
41
|
-
fakeGetTime = function () {
|
42
|
-
if (timesToGetTimeBeforeTimeout <= 0) {
|
43
|
-
return 6000;
|
44
|
-
} else {
|
45
|
-
timesToGetTimeBeforeTimeout -= 1;
|
46
|
-
return 1;
|
47
|
-
}
|
48
|
-
},
|
49
|
-
asyncCount = 0,
|
50
|
-
fakeAsyncCall = function (func, timeout) {
|
51
|
-
asyncCount += 1;
|
52
|
-
func();
|
53
|
-
},
|
54
|
-
setupFinished = false,
|
55
|
-
originalStartMethod = null,
|
56
20
|
activeCallback = null,
|
57
21
|
inactiveCallback = null;
|
58
22
|
|
59
23
|
beforeEach(function () {
|
24
|
+
jasmine.Clock.useMock();
|
25
|
+
|
60
26
|
actualSizes = [];
|
61
|
-
setupFinished = false;
|
62
|
-
fakeGetSizeCount = 0;
|
63
27
|
|
64
|
-
asyncCount = 0;
|
65
|
-
timesToGetTimeBeforeTimeout = 10;
|
66
28
|
activeCallback = jasmine.createSpy('activeCallback');
|
67
29
|
inactiveCallback = jasmine.createSpy('inactiveCallback');
|
30
|
+
timesToGetTimeBeforeTimeout = 10;
|
68
31
|
|
69
|
-
|
32
|
+
var setupFinished = false,
|
33
|
+
fakeGetSizeCount = 0;
|
70
34
|
|
71
|
-
|
35
|
+
spyOn(FontRuler.prototype, 'getSize').andCallFake(function () {
|
36
|
+
var result = null;
|
37
|
+
|
38
|
+
if (setupFinished) {
|
39
|
+
// If you are getting an exception here your tests does not specify enough
|
40
|
+
// size data to run properly.
|
41
|
+
if (fakeGetSizeCount >= actualSizes.length) {
|
42
|
+
throw 'Invalid test data';
|
43
|
+
}
|
44
|
+
result = actualSizes[fakeGetSizeCount];
|
45
|
+
fakeGetSizeCount += 1;
|
46
|
+
} else {
|
47
|
+
result = setupSizes[Math.min(fakeGetSizeCount, setupSizes.length - 1)];
|
48
|
+
fakeGetSizeCount += 1;
|
49
|
+
}
|
50
|
+
return result;
|
51
|
+
});
|
52
|
+
|
53
|
+
spyOn(goog, 'now').andCallFake(function () {
|
54
|
+
if (timesToGetTimeBeforeTimeout <= 0) {
|
55
|
+
return 6000;
|
56
|
+
} else {
|
57
|
+
timesToGetTimeBeforeTimeout -= 1;
|
58
|
+
return 1;
|
59
|
+
}
|
60
|
+
});
|
61
|
+
|
62
|
+
var originalStart = LastResortWebKitFontWatchRunner.prototype.start;
|
63
|
+
|
64
|
+
spyOn(LastResortWebKitFontWatchRunner.prototype, 'start').andCallFake(function () {
|
72
65
|
setupFinished = true;
|
73
66
|
fakeGetSizeCount = 0;
|
74
|
-
|
75
|
-
};
|
76
|
-
});
|
77
|
-
|
78
|
-
afterEach(function () {
|
79
|
-
LastResortWebKitFontWatchRunner.prototype.start = originalStartMethod;
|
67
|
+
originalStart.apply(this);
|
68
|
+
});
|
80
69
|
});
|
81
70
|
|
82
71
|
it('should ignore fallback size and call active', function () {
|
@@ -86,11 +75,11 @@ describe('LastResortWebKitFontWatchRunner', function () {
|
|
86
75
|
];
|
87
76
|
|
88
77
|
var fontWatchRunner = new LastResortWebKitFontWatchRunner(activeCallback, inactiveCallback,
|
89
|
-
domHelper,
|
78
|
+
domHelper, fontFamily, fontDescription, browserInfo);
|
90
79
|
|
91
80
|
fontWatchRunner.start();
|
92
81
|
|
93
|
-
|
82
|
+
jasmine.Clock.tick(1 * 25);
|
94
83
|
expect(activeCallback).toHaveBeenCalledWith('My Family', 'n4');
|
95
84
|
});
|
96
85
|
|
@@ -103,11 +92,11 @@ describe('LastResortWebKitFontWatchRunner', function () {
|
|
103
92
|
timesToGetTimeBeforeTimeout = 2;
|
104
93
|
|
105
94
|
var fontWatchRunner = new LastResortWebKitFontWatchRunner(activeCallback, inactiveCallback,
|
106
|
-
domHelper,
|
95
|
+
domHelper, 'Arimo', fontDescription, browserInfo);
|
107
96
|
|
108
97
|
fontWatchRunner.start();
|
109
98
|
|
110
|
-
|
99
|
+
jasmine.Clock.tick(1 * 25);
|
111
100
|
expect(activeCallback).toHaveBeenCalledWith('Arimo', 'n4');
|
112
101
|
});
|
113
102
|
|
@@ -121,11 +110,11 @@ describe('LastResortWebKitFontWatchRunner', function () {
|
|
121
110
|
timesToGetTimeBeforeTimeout = 3;
|
122
111
|
|
123
112
|
var fontWatchRunner = new LastResortWebKitFontWatchRunner(activeCallback, inactiveCallback,
|
124
|
-
domHelper,
|
113
|
+
domHelper, fontFamily, fontDescription, browserInfo);
|
125
114
|
|
126
115
|
fontWatchRunner.start();
|
127
116
|
|
128
|
-
|
117
|
+
jasmine.Clock.tick(2 * 25);
|
129
118
|
expect(inactiveCallback).toHaveBeenCalledWith('My Family', 'n4');
|
130
119
|
});
|
131
120
|
|
@@ -138,10 +127,10 @@ describe('LastResortWebKitFontWatchRunner', function () {
|
|
138
127
|
timesToGetTimeBeforeTimeout = 2;
|
139
128
|
|
140
129
|
var fontWatchRunner = new LastResortWebKitFontWatchRunner(activeCallback, inactiveCallback,
|
141
|
-
domHelper,
|
130
|
+
domHelper, fontFamily, fontDescription, browserInfo);
|
142
131
|
|
143
132
|
fontWatchRunner.start();
|
144
|
-
|
133
|
+
jasmine.Clock.tick(1 * 25);
|
145
134
|
expect(inactiveCallback).toHaveBeenCalledWith('My Family', 'n4');
|
146
135
|
});
|
147
136
|
});
|
data/spec/index.html
CHANGED
@@ -14,32 +14,21 @@
|
|
14
14
|
<script src="../tools/jasmine/jasmine.js"></script>
|
15
15
|
<script src="../tools/jasmine/jasmine-html.js"></script>
|
16
16
|
<script src="../tools/jasmine-phantomjs/terminal-reporter.js"></script>
|
17
|
+
<script src="../tools/compiler/base.js"></script>
|
18
|
+
<script src="../spec/deps.js"></script>
|
17
19
|
|
18
|
-
<script
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
<script src="../src/core/fontwatchrunner.js"></script>
|
31
|
-
<script src="../src/core/fontwatcher.js"></script>
|
32
|
-
<script src="../src/core/font.js"></script>
|
33
|
-
<script src="../src/core/initialize.js"></script>
|
34
|
-
<script src="../src/google/fontapiparser.js"></script>
|
35
|
-
<script src="../src/google/fontapiurlbuilder.js"></script>
|
36
|
-
<script src="../src/google/googlefontapi.js"></script>
|
37
|
-
<script src="../src/google/lastresortwebkitfontwatchrunner.js"></script>
|
38
|
-
<script src="../src/custom/customcss.js"></script>
|
39
|
-
<script src="../src/ascender/ascender_script.js"></script>
|
40
|
-
<script src="../src/fontdeck/fontdeck_script.js"></script>
|
41
|
-
<script src="../src/monotype/monotype_script.js"></script>
|
42
|
-
<script src="../src/typekit/typekit_script.js"></script>
|
20
|
+
<script>
|
21
|
+
goog.require('webfont');
|
22
|
+
|
23
|
+
// Require the modules because they don't have an explicit
|
24
|
+
// dependency on core.
|
25
|
+
goog.require('webfont.TypekitScript');
|
26
|
+
goog.require('webfont.AscenderScript');
|
27
|
+
goog.require('webfont.FontdeckScript');
|
28
|
+
goog.require('webfont.MonotypeScript');
|
29
|
+
goog.require('webfont.CustomCss');
|
30
|
+
goog.require('webfont.GoogleFontApi');
|
31
|
+
</script>
|
43
32
|
|
44
33
|
<script src="../spec/core/domhelper_spec.js"></script>
|
45
34
|
<script src="../spec/core/cssclassname_spec.js"></script>
|
@@ -1,3 +1,5 @@
|
|
1
|
+
goog.provide('webfont.AscenderScript');
|
2
|
+
|
1
3
|
/**
|
2
4
|
*
|
3
5
|
* WebFont.load({
|
@@ -8,6 +10,7 @@
|
|
8
10
|
* });
|
9
11
|
*
|
10
12
|
* @constructor
|
13
|
+
* @implements {webfont.FontModule}
|
11
14
|
*/
|
12
15
|
webfont.AscenderScript = function(domHelper, configuration) {
|
13
16
|
this.domHelper_ = domHelper;
|
@@ -27,56 +30,60 @@ webfont.AscenderScript.VARIATIONS = {
|
|
27
30
|
'bi': 'i7'
|
28
31
|
};
|
29
32
|
|
30
|
-
|
31
|
-
|
32
|
-
};
|
33
|
+
goog.scope(function () {
|
34
|
+
var AscenderScript = webfont.AscenderScript;
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
var url = protocol + '//webfonts.fontslive.com/css/' + key + '.css';
|
38
|
-
this.domHelper_.insertInto('head', this.domHelper_.createCssLink(url));
|
39
|
-
var fv = this.parseFamiliesAndVariations(this.configuration_['families']);
|
40
|
-
onReady(fv.families, fv.variations);
|
41
|
-
};
|
36
|
+
AscenderScript.prototype.supportUserAgent = function(userAgent, support) {
|
37
|
+
return support(userAgent.getBrowserInfo().hasWebFontSupport());
|
38
|
+
};
|
42
39
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
fv = this.
|
49
|
-
|
50
|
-
|
51
|
-
}
|
52
|
-
return { families:families, variations:variations };
|
53
|
-
};
|
40
|
+
AscenderScript.prototype.load = function(onReady) {
|
41
|
+
var key = this.configuration_['key'];
|
42
|
+
var protocol = this.domHelper_.getProtocol();
|
43
|
+
var url = protocol + '//webfonts.fontslive.com/css/' + key + '.css';
|
44
|
+
this.domHelper_.insertInto('head', this.domHelper_.createCssLink(url));
|
45
|
+
var fv = this.parseFamiliesAndVariations(this.configuration_['families']);
|
46
|
+
onReady(fv.families, fv.variations);
|
47
|
+
};
|
54
48
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
};
|
49
|
+
AscenderScript.prototype.parseFamiliesAndVariations = function(providedFamilies){
|
50
|
+
var families, variations, fv;
|
51
|
+
families = [];
|
52
|
+
variations = {};
|
53
|
+
for(var i = 0, len = providedFamilies.length; i < len; i++){
|
54
|
+
fv = this.parseFamilyAndVariations(providedFamilies[i]);
|
55
|
+
families.push(fv.family);
|
56
|
+
variations[fv.family] = fv.variations;
|
57
|
+
}
|
58
|
+
return { families:families, variations:variations };
|
59
|
+
};
|
67
60
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
if(
|
74
|
-
|
75
|
-
|
61
|
+
AscenderScript.prototype.parseFamilyAndVariations = function(providedFamily){
|
62
|
+
var family, variations, parts;
|
63
|
+
parts = providedFamily.split(':');
|
64
|
+
family = parts[0];
|
65
|
+
variations = [];
|
66
|
+
if(parts[1]){
|
67
|
+
variations = this.parseVariations(parts[1]);
|
68
|
+
}else{
|
69
|
+
variations = ['n4'];
|
76
70
|
}
|
77
|
-
|
78
|
-
|
79
|
-
|
71
|
+
return { family:family, variations:variations };
|
72
|
+
};
|
73
|
+
|
74
|
+
AscenderScript.prototype.parseVariations = function(source){
|
75
|
+
var providedVariations = source.split(',');
|
76
|
+
var variations = [];
|
77
|
+
for(var i = 0, len = providedVariations.length; i < len; i++){
|
78
|
+
var pv = providedVariations[i];
|
79
|
+
if(pv){
|
80
|
+
var v = AscenderScript.VARIATIONS[pv];
|
81
|
+
variations.push(v ? v : pv);
|
82
|
+
}
|
83
|
+
}
|
84
|
+
return variations;
|
85
|
+
};
|
86
|
+
});
|
80
87
|
|
81
88
|
globalNamespaceObject.addModule(webfont.AscenderScript.NAME, function(configuration, domHelper) {
|
82
89
|
return new webfont.AscenderScript(domHelper, configuration);
|
data/src/core/browserinfo.js
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
+
goog.provide('webfont.BrowserInfo');
|
2
|
+
|
1
3
|
/**
|
4
|
+
* @export
|
2
5
|
* @constructor
|
3
6
|
* @param {boolean} webfontSupport
|
4
7
|
* @param {boolean} webKitFallbackBug
|
@@ -10,52 +13,56 @@ webfont.BrowserInfo = function (webfontSupport, webKitFallbackBug, webKitMetrics
|
|
10
13
|
this.webKitMetricsBug_ = webKitMetricsBug;
|
11
14
|
};
|
12
15
|
|
13
|
-
|
14
|
-
|
15
|
-
*
|
16
|
-
* @return {boolean}
|
17
|
-
*/
|
18
|
-
webfont.BrowserInfo.prototype.hasWebFontSupport = function () {
|
19
|
-
return this.webfontSupport_;
|
20
|
-
};
|
16
|
+
goog.scope(function () {
|
17
|
+
var BrowserInfo = webfont.BrowserInfo;
|
21
18
|
|
22
|
-
/**
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
* font to occur (compared to other browsers which only change
|
31
|
-
* font once the web font has loaded.)
|
32
|
-
*
|
33
|
-
* The bug has been fixed and is only happens in WebKit versions
|
34
|
-
* below 536.11. Even though it is fixed we still have a large
|
35
|
-
* percentage of users on older WebKit versions, mostly on mobile
|
36
|
-
* platforms.
|
37
|
-
*
|
38
|
-
* Also see: https://bugs.webkit.org/show_bug.cgi?id=76684
|
39
|
-
*
|
40
|
-
* @return {boolean}
|
41
|
-
*/
|
42
|
-
webfont.BrowserInfo.prototype.hasWebKitFallbackBug = function () {
|
43
|
-
return this.webKitFallbackBug_;
|
44
|
-
};
|
19
|
+
/**
|
20
|
+
* Returns true if the browser supports web fonts.
|
21
|
+
*
|
22
|
+
* @return {boolean}
|
23
|
+
*/
|
24
|
+
BrowserInfo.prototype.hasWebFontSupport = function () {
|
25
|
+
return this.webfontSupport_;
|
26
|
+
};
|
45
27
|
|
46
|
-
/**
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
28
|
+
/**
|
29
|
+
* Returns true if the browser has the WebKit fallback bug.
|
30
|
+
*
|
31
|
+
* The bug causes the normal CSS font stack to be ignored while
|
32
|
+
* loading web fonts. Instead it picks the generic font family
|
33
|
+
* (or the default generic font family) of the first instance
|
34
|
+
* the web font is mentioned in CSS. It switches to this font
|
35
|
+
* immediately while loading web font, causing two changes in
|
36
|
+
* font to occur (compared to other browsers which only change
|
37
|
+
* font once the web font has loaded.)
|
38
|
+
*
|
39
|
+
* The bug has been fixed and is only happens in WebKit versions
|
40
|
+
* below 536.11. Even though it is fixed we still have a large
|
41
|
+
* percentage of users on older WebKit versions, mostly on mobile
|
42
|
+
* platforms.
|
43
|
+
*
|
44
|
+
* Also see: https://bugs.webkit.org/show_bug.cgi?id=76684
|
45
|
+
*
|
46
|
+
* @return {boolean}
|
47
|
+
*/
|
48
|
+
BrowserInfo.prototype.hasWebKitFallbackBug = function () {
|
49
|
+
return this.webKitFallbackBug_;
|
50
|
+
};
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Returns true if the browser has the WebKit metrics bug
|
54
|
+
*
|
55
|
+
* The metrics bug causes WebKit to change the height of a font
|
56
|
+
* while loading a web font. Other browsers do not modify
|
57
|
+
* the width or height of the fallback font while a web font is
|
58
|
+
* loading. This caused our width and height check to be incorrect,
|
59
|
+
* triggering a false positive.
|
60
|
+
*
|
61
|
+
* Also see: https://bugs.webkit.org/show_bug.cgi?id=110977
|
62
|
+
*
|
63
|
+
* @return {boolean}
|
64
|
+
*/
|
65
|
+
BrowserInfo.prototype.hasWebKitMetricsBug = function () {
|
66
|
+
return this.webKitMetricsBug_;
|
67
|
+
};
|
68
|
+
});
|