Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix area line margin-top of first line after page break (#1443) #1449

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,6 @@ protected AbstractArea createNewArea(ContainerArea parent, LayoutContext context
} else {
area = new BlockContainerArea(parent, context, content);
}
if (context.isFixedLayout()) {
area.setPageBreakInside(IStyle.AVOID_VALUE);
}
return area;

case IContent.IMAGE_CONTENT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,45 +290,45 @@ protected SplitResult _split(int height, boolean force) throws BirtException {
result.add(current);
continue;
}
contentHeight -= ah;
int childSplitHeight = cheight - contentHeight;
SplitResult splitResult = current.split(childSplitHeight, force && !isValidResult(result));
if (splitResult.status == SplitResult.SPLIT_SUCCEED_WITH_PART) {
ContainerArea splitChildArea = splitResult.getResult();
result.add(splitChildArea);
status = SplitResult.SPLIT_SUCCEED_WITH_PART;
contentHeight += splitChildArea.getAllocatedHeight();
break;
} else if (splitResult.status == SplitResult.SPLIT_BEFORE_AVOID_WITH_NULL) {
if (force) {
if (result.size() > 0) {
status = SplitResult.SPLIT_SUCCEED_WITH_PART;
}
contentHeight -= ah;
int childSplitHeight = cheight - contentHeight;
SplitResult splitResult = current.split(childSplitHeight, force && !isValidResult(result));
if (splitResult.status == SplitResult.SPLIT_SUCCEED_WITH_PART) {
ContainerArea splitChildArea = splitResult.getResult();
result.add(splitChildArea);
status = SplitResult.SPLIT_SUCCEED_WITH_PART;
contentHeight += splitChildArea.getAllocatedHeight();
break;
} else if (splitResult.status == SplitResult.SPLIT_BEFORE_AVOID_WITH_NULL) {
if (force) {
if (result.size() > 0) {
status = SplitResult.SPLIT_SUCCEED_WITH_PART;
}
break;
} else if (splitResult.status == SplitResult.SPLIT_SUCCEED_WITH_NULL) {
if (isValidResult(result)) {
if (force) {
status = SplitResult.SPLIT_SUCCEED_WITH_PART;
break;
}
if (previous.isPageBreakAfterAvoid()) {
status = SplitResult.SPLIT_BEFORE_AVOID_WITH_NULL;
break;
}
}
break;
} else if (splitResult.status == SplitResult.SPLIT_SUCCEED_WITH_NULL) {
if (isValidResult(result)) {
if (force) {
status = SplitResult.SPLIT_SUCCEED_WITH_PART;
break;
} else if (force) {
// error status
status = SplitResult.SPLIT_SUCCEED_WITH_PART;
}
if (previous.isPageBreakAfterAvoid()) {
status = SplitResult.SPLIT_BEFORE_AVOID_WITH_NULL;
break;
} else {
if (isPageBreakBeforeAvoid()) {
return SplitResult.BEFORE_AVOID_WITH_NULL;
}
return SplitResult.SUCCEED_WITH_NULL;
}
status = SplitResult.SPLIT_SUCCEED_WITH_PART;
break;
} else if (force) {
// error status
status = SplitResult.SPLIT_SUCCEED_WITH_PART;
break;
} else {
if (isPageBreakBeforeAvoid()) {
return SplitResult.BEFORE_AVOID_WITH_NULL;
}
return SplitResult.SUCCEED_WITH_NULL;
}
}
}
// split height is larger than content height.(cell)
if (result.size() == children.size()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,9 @@ public void setAllocatedHeight(int aHeight) {
}

/**
* Get content height
* Get content height, that is the height available for the content.
*
* This is computed as allocatedHeight minus bottom/top margin/border/padding. *
*
* @param allocatedHeight
* @return Return the content height
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,13 @@ public SplitResult split(int height, boolean force) throws BirtException {
result.addChild(splitChildArea);
splitChildArea.setParent(result);
} else {
// reset the line height due to negative height caused by page break.
// Otherwise the first line could be rendered too far down.
// See (old) BIRT bug 562873 and
// https://github.com/eclipse-birt/birt/issues/1443.
if (height < 0) {
height = 0;
}
child.setY(Math.max(0, child.getY() - height));
}
}
Expand Down
Loading