зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1434981 - Display fonts for text nodes too; r=gl
MozReview-Commit-ID: 4hzEowvZWk --HG-- extra : rebase_source : 3820f76d37728d57a0a7ae9df594fcd2f3b8d7c2
This commit is contained in:
Родитель
9e5f9ec900
Коммит
e548c28977
|
@ -139,13 +139,15 @@ class FontInspector {
|
|||
let { fontOptions } = this.store.getState();
|
||||
let { showAllFonts, previewText } = fontOptions;
|
||||
|
||||
// Clear the list of fonts if the currently selected node is not connected or an
|
||||
// element node unless all fonts are supposed to be shown.
|
||||
// Clear the list of fonts if the currently selected node is not connected or a text
|
||||
// or element node unless all fonts are supposed to be shown.
|
||||
let isElementOrTextNode = this.inspector.selection.isElementNode() ||
|
||||
this.inspector.selection.isTextNode();
|
||||
if (!showAllFonts &&
|
||||
(!node ||
|
||||
!this.isPanelVisible() ||
|
||||
!this.inspector.selection.isConnected() ||
|
||||
!this.inspector.selection.isElementNode())) {
|
||||
!isElementOrTextNode)) {
|
||||
this.store.dispatch(updateFonts(fonts));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -17,4 +17,5 @@ support-files =
|
|||
[browser_fontinspector.js]
|
||||
[browser_fontinspector_edit-previews.js]
|
||||
[browser_fontinspector_edit-previews-show-all.js]
|
||||
[browser_fontinspector_text-node.js]
|
||||
[browser_fontinspector_theme-change.js]
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Test that the font-inspector also display fonts when a text node is selected.
|
||||
|
||||
const TEST_URI = URL_ROOT + "browser_fontinspector.html";
|
||||
|
||||
add_task(function* () {
|
||||
let { inspector, view } = yield openFontInspectorForURL(TEST_URI);
|
||||
let viewDoc = view.document;
|
||||
|
||||
info("Selecting the first text-node first-child of <body>");
|
||||
let bodyNode = yield getNodeFront("body", inspector);
|
||||
let { nodes } = yield inspector.walker.children(bodyNode);
|
||||
yield selectNode(nodes[0], inspector);
|
||||
|
||||
let sections = viewDoc.querySelectorAll("#all-fonts > section");
|
||||
is(sections.length, 1, "Font inspector shows 1 font");
|
||||
});
|
Загрузка…
Ссылка в новой задаче