Bug 1464801 - Assign writer methods to each axis defined in font-variation-settings during editor setup. r=pbro

MozReview-Commit-ID: 2L3etSyDBPR

--HG--
extra : rebase_source : 0f0a0df9a42125bf76cdea78e73e501817038791
This commit is contained in:
Razvan Caliman 2018-05-30 00:13:00 +02:00
Родитель c80923498e
Коммит 476e494dab
1 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -22,6 +22,7 @@ const INSPECTOR_L10N =
new LocalizationHelper("devtools/client/locales/inspector.properties");
const { getStr } = require("./utils/l10n");
const { parseFontVariationAxes } = require("./utils/font-utils");
const { updateFonts } = require("./actions/fonts");
const {
applyInstance,
@ -580,6 +581,12 @@ class FontInspector {
font.used = declaredFontNames.includes(font.CSSFamilyName);
}
// Assign writer methods to each axis defined in font-variation-settings.
const axes = parseFontVariationAxes(properties["font-variation-settings"]);
Object.keys(axes).map(axis => {
this.writers.set(axis, this.getWriterForAxis(axis));
});
// Update the font editor state only if property values differ from the ones in store.
// This can happen when a user makes manual changes in the Rule view.
if (JSON.stringify(properties) !== JSON.stringify(fontEditor.properties)) {