mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
XFA - Fix lot of layout issues
- I thought it was possible to rely on browser layout engine to handle layout stuff but it isn't possible - mainly because when a contentArea overflows, we must continue to layout in the next contentArea - when no more contentArea is available then we must go to the next page... - we must handle breakBefore and breakAfter which allows to "break" the layout to go to the next container - Sometimes some containers don't provide their dimensions so we must compute them in order to know where to put them in their parents but to compute those dimensions we need to layout the container itself... - See top of file layout.js for more explanations about layout. - fix few bugs in other places I met during my work on layout.
This commit is contained in:
parent
3538ef017f
commit
7cebdbd58c
14 changed files with 2019 additions and 366 deletions
|
@ -332,7 +332,7 @@ describe("XFAParser", function () {
|
|||
[
|
||||
" The first line of this paragraph is indented a half-inch.\n",
|
||||
" Successive lines are not indented.\n",
|
||||
" This is the last line of the paragraph.\n ",
|
||||
" This is the last line of the paragraph.\n \n",
|
||||
].join("")
|
||||
);
|
||||
});
|
||||
|
|
|
@ -28,7 +28,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">
|
||||
<font size="7pt" typeface="Arial" baselineShift="2pt">
|
||||
<font size="7pt" typeface="FooBar" baselineShift="2pt">
|
||||
<fill>
|
||||
<color value="12,23,34"/>
|
||||
<solid/>
|
||||
|
@ -43,6 +43,7 @@ describe("XFAFactory", function () {
|
|||
<subform name="first">
|
||||
</subform>
|
||||
<subform name="second">
|
||||
<breakBefore targetType="pageArea" startNew="1"/>
|
||||
</subform>
|
||||
</subform>
|
||||
</template>
|
||||
|
@ -73,18 +74,23 @@ describe("XFAFactory", function () {
|
|||
position: "absolute",
|
||||
});
|
||||
|
||||
const draw = page1.children[1];
|
||||
const wrapper = page1.children[1];
|
||||
const draw = wrapper.children[0];
|
||||
|
||||
expect(wrapper.attributes.class).toEqual("xfaWrapper");
|
||||
expect(wrapper.attributes.style).toEqual({
|
||||
left: "2px",
|
||||
position: "absolute",
|
||||
top: "1px",
|
||||
});
|
||||
|
||||
expect(draw.attributes.class).toEqual("xfaDraw xfaFont");
|
||||
expect(draw.attributes.style).toEqual({
|
||||
color: "#0c1722",
|
||||
fontFamily: "Arial",
|
||||
fontSize: "7px",
|
||||
fontFamily: "FooBar",
|
||||
fontSize: "6.93px",
|
||||
height: "22px",
|
||||
left: "2px",
|
||||
padding: "1px 4px 2px 3px",
|
||||
position: "absolute",
|
||||
textAlign: "left",
|
||||
top: "1px",
|
||||
transform: "rotate(-90deg)",
|
||||
transformOrigin: "top left",
|
||||
verticalAlign: "2px",
|
||||
|
@ -93,7 +99,7 @@ describe("XFAFactory", function () {
|
|||
|
||||
// draw element must be on each page.
|
||||
expect(draw.attributes.style).toEqual(
|
||||
factory.getPage(1).children[1].attributes.style
|
||||
factory.getPage(1).children[1].children[0].attributes.style
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue