Merge pull request #10480 from Snuffleupagus/debugger-FontInspector

[Regression] Fix the `FontInspector` in the PDFBug debugging tools
This commit is contained in:
Brendan Dahl 2019-01-22 10:02:58 -08:00 committed by GitHub
commit d614cabfa0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,30 +21,26 @@ var FontInspector = (function FontInspectorClosure() {
var active = false;
var fontAttribute = 'data-font-name';
function removeSelection() {
var divs = document.querySelectorAll('div[' + fontAttribute + ']');
for (var i = 0, ii = divs.length; i < ii; ++i) {
var div = divs[i];
let divs = document.querySelectorAll(`span[${fontAttribute}]`);
for (let div of divs) {
div.className = '';
}
}
function resetSelection() {
var divs = document.querySelectorAll('div[' + fontAttribute + ']');
for (var i = 0, ii = divs.length; i < ii; ++i) {
var div = divs[i];
let divs = document.querySelectorAll(`span[${fontAttribute}]`);
for (let div of divs) {
div.className = 'debuggerHideText';
}
}
function selectFont(fontName, show) {
var divs = document.querySelectorAll('div[' + fontAttribute + '=' +
fontName + ']');
for (var i = 0, ii = divs.length; i < ii; ++i) {
var div = divs[i];
let divs = document.querySelectorAll(`span[${fontAttribute}=${fontName}]`);
for (let div of divs) {
div.className = show ? 'debuggerShowText' : 'debuggerHideText';
}
}
function textLayerClick(e) {
if (!e.target.dataset.fontName ||
e.target.tagName.toUpperCase() !== 'DIV') {
e.target.tagName.toUpperCase() !== 'SPAN') {
return;
}
var fontName = e.target.dataset.fontName;