Merge pull request #13718 from calixteman/xfa_tooltip

XFA - Support assist element
This commit is contained in:
calixteman 2021-07-12 00:00:20 +02:00 committed by GitHub
commit bd3639ff80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 0 deletions

View File

@ -501,6 +501,12 @@ class Assist extends XFAObject {
this.speak = null;
this.toolTip = null;
}
[$toHTML]() {
return this.toolTip && this.toolTip[$content]
? this.toolTip[$content]
: null;
}
}
class Barcode extends XFAObject {
@ -1734,6 +1740,11 @@ class Draw extends XFAObject {
children: [],
};
const assist = this.assist ? this.assist[$toHTML]() : null;
if (assist) {
html.attributes.title = assist;
}
const bbox = computeBbox(this, html, availableSpace);
const value = this.value ? this.value[$toHTML](availableSpace).html : null;
@ -2345,6 +2356,11 @@ class ExclGroup extends XFAObject {
children,
};
const assist = this.assist ? this.assist[$toHTML]() : null;
if (assist) {
html.attributes.title = assist;
}
delete this[$extra];
return HTMLResult.success(createWrapper(this, html), bbox);
@ -2621,6 +2637,11 @@ class Field extends XFAObject {
children,
};
const assist = this.assist ? this.assist[$toHTML]() : null;
if (assist) {
html.attributes.title = assist;
}
const borderStyle = this.border ? this.border[$toStyle]() : null;
const bbox = computeBbox(this, html, availableSpace);
@ -4781,6 +4802,11 @@ class Subform extends XFAObject {
children,
};
const assist = this.assist ? this.assist[$toHTML]() : null;
if (assist) {
html.attributes.title = assist;
}
const result = HTMLResult.success(createWrapper(this, html), bbox);
if (this.breakAfter.children.length >= 1) {

View File

@ -44,6 +44,7 @@ describe("XFAFactory", function () {
<contentArea x="123pt" w="456pt" h="789pt"/>
<medium stock="default" short="456pt" long="789pt"/>
<draw y="1pt" w="11pt" h="22pt" rotate="90" x="2pt">
<assist><toolTip>A tooltip !!</toolTip></assist>
<font size="7pt" typeface="FooBar" baselineShift="2pt">
<fill>
<color value="12,23,34"/>
@ -118,6 +119,7 @@ describe("XFAFactory", function () {
"xfaFont",
"xfaWrapped",
]);
expect(draw.attributes.title).toEqual("A tooltip !!");
expect(draw.attributes.style).toEqual({
color: "#0c1722",
fontFamily: '"FooBar"',