mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
Added FontFace to wombat overrides, https://drafts.csswg.org/css-font-loading/#FontFace-interface (#340)
This commit is contained in:
parent
1e9f457ef1
commit
2825535ae2
@ -2073,6 +2073,30 @@ var _WBWombat = function($wbwindow, wbinfo) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//============================================
|
||||||
|
function initFontFaceOverride ($wbwindow) {
|
||||||
|
if (!$wbwindow.FontFace || $wbwindow.FontFace.__wboverriden__) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// per https://drafts.csswg.org/css-font-loading/#FontFace-interface and Chrome, FF, Opera Support
|
||||||
|
var origFontFace = $wbwindow.FontFace;
|
||||||
|
$wbwindow.FontFace = (function (FontFace) {
|
||||||
|
return function (family, source, descriptors) {
|
||||||
|
var rwSource = source;
|
||||||
|
if (source != null) {
|
||||||
|
if (typeof source !== 'string') {
|
||||||
|
source = source.toString(); // is CSSOMString or ArrayBuffer or ArrayBufferView
|
||||||
|
}
|
||||||
|
rwSource = rewrite_inline_style(source);
|
||||||
|
}
|
||||||
|
return new FontFace(family, rwSource, descriptors);
|
||||||
|
}
|
||||||
|
})($wbwindow.FontFace);
|
||||||
|
$wbwindow.FontFace.prototype = origFontFace.prototype;
|
||||||
|
Object.defineProperty($wbwindow.FontFace.prototype, "constructor", {value: $wbwindow.FontFace});
|
||||||
|
$wbwindow.FontFace.__wboverriden__ = true;
|
||||||
|
}
|
||||||
|
|
||||||
//============================================
|
//============================================
|
||||||
function init_wombat_loc(win) {
|
function init_wombat_loc(win) {
|
||||||
|
|
||||||
@ -3354,6 +3378,9 @@ var _WBWombat = function($wbwindow, wbinfo) {
|
|||||||
// Audio
|
// Audio
|
||||||
init_audio_override();
|
init_audio_override();
|
||||||
|
|
||||||
|
// FontFace
|
||||||
|
initFontFaceOverride($wbwindow);
|
||||||
|
|
||||||
// Worker override (experimental)
|
// Worker override (experimental)
|
||||||
init_web_worker_override();
|
init_web_worker_override();
|
||||||
init_service_worker_override();
|
init_service_worker_override();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user