Skip to content

Commit

Permalink
#364 Add footnote and bottom as allowed values for float.
Browse files Browse the repository at this point in the history
  • Loading branch information
danfickle committed May 25, 2021
1 parent 4509837 commit 2bc0a97
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ public class IdentValue implements FSDerivedValue {
*/
public static final IdentValue COLUMN = addValue("column");

/**
* CSS footnotes for use in float: footnote
*/
public static final IdentValue FOOTNOTE = addValue("footnote");

/**
* Constructor for the IdentValue object
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,11 @@ protected BitSet getAllowed() {

public static class Float extends SingleIdent {
// left | right | none | inherit
// bottom | footnote
private static final BitSet ALLOWED = setFor(
new IdentValue[] { IdentValue.LEFT, IdentValue.RIGHT, IdentValue.NONE });
new IdentValue[] {
IdentValue.LEFT, IdentValue.RIGHT, IdentValue.NONE,
IdentValue.BOTTOM, IdentValue.FOOTNOTE });

@Override
protected BitSet getAllowed() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,10 @@ public boolean isFloatedRight() {
return isIdent(CSSName.FLOAT, IdentValue.RIGHT);
}

public boolean isFootnote() {
return isIdent(CSSName.FLOAT, IdentValue.FOOTNOTE);
}

public boolean isRelative() {
return isIdent(CSSName.POSITION, IdentValue.RELATIVE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import com.openhtmltopdf.render.FloatedBoxData;
import com.openhtmltopdf.render.FlowingColumnBox;
import com.openhtmltopdf.render.FlowingColumnContainerBox;
import com.openhtmltopdf.render.FootnoteData;
import com.openhtmltopdf.render.InlineBox;

/**
Expand Down Expand Up @@ -1038,7 +1039,11 @@ private static List<Styleable> createGeneratedMarginBoxContent(

private static BlockBox createBlockBox(
CalculatedStyle style, ChildBoxInfo info, boolean generated) {
if (style.isFloated() && !(style.isAbsolute() || style.isFixed())) {
if (style.isFootnote()) {
BlockBox result = new BlockBox();
result.setFootnoteData(new FootnoteData());
return result;
} else if (style.isFloated() && !(style.isAbsolute() || style.isFixed())) {
BlockBox result;
if (style.isTable() || style.isInlineTable()) {
result = new TableBox();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2400,6 +2400,10 @@ public boolean hasMargin() {
return maxPositive != 0 || maxNegative != 0;
}
}

public void setFootnoteData(FootnoteData footnoteData) {
// TODO Auto-generated method stub
}
}

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.openhtmltopdf.render;

public class FootnoteData {

}

0 comments on commit 2bc0a97

Please sign in to comment.