1
0
Fork 0
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:
Calixte Denizet 2021-05-19 11:09:21 +02:00
parent 3538ef017f
commit 7cebdbd58c
14 changed files with 2019 additions and 366 deletions

View file

@ -24,6 +24,8 @@
.xfaLayer * {
color: inherit;
font: inherit;
font-style: inherit;
font-weight: inherit;
font-kerning: inherit;
letter-spacing: inherit;
text-align: inherit;
@ -33,6 +35,14 @@
background: transparent;
}
.xfaLayer a {
color: blue;
}
.xfaRich li {
margin-left: 3em;
}
.xfaFont {
color: black;
font-weight: normal;
@ -58,6 +68,7 @@
.xfaRich {
z-index: 300;
line-height: 1.2;
}
.xfaSubform {
@ -76,23 +87,52 @@
flex: 1 1 auto;
}
.xfaBorderDiv {
background: transparent;
position: absolute;
pointer-events: none;
}
.xfaWrapper {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: auto;
height: auto;
}
.xfaContentArea {
overflow: hidden;
}
.xfaTextfield,
.xfaSelect {
background-color: rgba(0, 54, 255, 0.13);
}
.xfaTextfield:focus,
.xfaSelect:focus {
background-color: transparent;
}
.xfaTextfield,
.xfaSelect {
width: 100%;
height: 100%;
flex: 1 1 auto;
flex: 100 1 0;
border: none;
resize: none;
}
.xfaLabel > input[type="checkbox"] {
.xfaLabel > input[type="radio"] {
/* Use this trick to make the checkbox invisible but
but still focusable. */
position: absolute;
left: -99999px;
}
.xfaLabel > input[type="checkbox"]:focus + .xfaCheckboxMark {
.xfaLabel > input[type="radio"]:focus + .xfaCheckboxMark {
box-shadow: 0 0 5px rgba(0, 0, 0, 0.7);
}
@ -133,19 +173,48 @@
white-space: pre-wrap;
}
.xfaImage,
.xfaRich {
.xfaImage {
width: 100%;
height: 100%;
}
.xfaLrTb,
.xfaRlTb,
.xfaTb,
.xfaRich {
width: 100%;
height: auto;
}
.xfaPosition {
display: block;
}
.xfaLrTb,
.xfaRlTb,
.xfaTb {
display: flex;
flex-direction: column;
align-items: stretch;
}
.xfaLr,
.xfaRl,
.xfaTb > div {
flex: 1 1 auto;
}
.xfaTb > div {
justify-content: left;
}
.xfaLr > div {
display: inline;
float: left;
}
.xfaRl > div {
display: inline;
float: right;
}
.xfaPosition {
position: relative;
}